[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <65a1141a-efdb-62e2-729b-e69dd6f06eb8@gmail.com>
Date: Sun, 1 Mar 2020 20:41:16 -0700
From: David Ahern <dsahern@...il.com>
To: Jason Wang <jasowang@...hat.com>, David Ahern <dsahern@...nel.org>,
netdev@...r.kernel.org
Cc: davem@...emloft.net, kuba@...nel.org,
prashantbhole.linux@...il.com, brouer@...hat.com, toke@...hat.com,
mst@...hat.com, toshiaki.makita1@...il.com, daniel@...earbox.net,
john.fastabend@...il.com, ast@...nel.org, kafai@...com,
songliubraving@...com, yhs@...com, andriin@...com,
David Ahern <dahern@...italocean.com>
Subject: Re: [PATCH RFC v4 bpf-next 08/11] tun: Support xdp in the Tx path for
skb
On 3/1/20 8:28 PM, Jason Wang wrote:
>> +static u32 tun_do_xdp_tx_generic(struct tun_struct *tun,
>> + struct net_device *dev,
>> + struct sk_buff *skb)
>> +{
>> + struct bpf_prog *xdp_prog;
>> + u32 act = XDP_PASS;
>> +
>> + xdp_prog = rcu_dereference(tun->xdp_egress_prog);
>> + if (xdp_prog) {
>> + struct xdp_txq_info txq = { .dev = dev };
>> + struct xdp_buff xdp;
>> +
>> + skb = tun_prepare_xdp_skb(skb);
>> + if (!skb) {
>> + act = XDP_DROP;
>> + goto out;
>> + }
>> +
>> + xdp.txq = &txq;
>> +
>> + act = do_xdp_generic_core(skb, &xdp, xdp_prog);
>> + switch (act) {
>> + case XDP_TX: /* for Tx path, XDP_TX == XDP_PASS */
>> + act = XDP_PASS;
>> + break;
>
>
> Jute a note here, I agree for TX XDP it may be better to do this.
>
> But for offloaded program we need different semantic. Or we can deal
> this with attach types?
>
This path is for XDP_FLAGS_DRV_MODE. Offloaded programs
(XDP_FLAGS_HW_MODE) will be run in vhost context.
Powered by blists - more mailing lists