Skip to content

Commit

Permalink
veth: check for NAPI instead of xdp_prog before xmit of XDP frame
Browse files Browse the repository at this point in the history
The recent patch that tied enabling of veth NAPI to the GRO flag also has
the nice side effect that a veth device can be the target of an
XDP_REDIRECT without an XDP program needing to be loaded on the peer
device. However, the patch adding this extra NAPI mode didn't actually
change the check in veth_xdp_xmit() to also look at the new NAPI pointer,
so let's fix that.

Fixes: 6788fa154546 ("veth: allow enabling NAPI even without XDP")
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Toke Høiland-Jørgensen authored and David S. Miller committed Apr 16, 2021
1 parent aa8caa7 commit 0e672f3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/net/veth.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,11 +486,10 @@ static int veth_xdp_xmit(struct net_device *dev, int n,

rcv_priv = netdev_priv(rcv);
rq = &rcv_priv->rq[veth_select_rxq(rcv)];
/* Non-NULL xdp_prog ensures that xdp_ring is initialized on receive
* side. This means an XDP program is loaded on the peer and the peer
* device is up.
/* The napi pointer is set if NAPI is enabled, which ensures that
* xdp_ring is initialized on receive side and the peer device is up.
*/
if (!rcu_access_pointer(rq->xdp_prog))
if (!rcu_access_pointer(rq->napi))
goto out;

max_len = rcv->mtu + rcv->hard_header_len + VLAN_HLEN;
Expand Down

0 comments on commit 0e672f3

Please sign in to comment.