diff options
author | John Fastabend <john.fastabend@gmail.com> | 2020-01-27 01:14:01 +0100 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2020-01-27 11:16:25 +0100 |
commit | 9719c6b98db42462bfb9aa172f017bdfd6d66c6f (patch) | |
tree | a6f7a4cd60fb300d1261a7d00599a9de4b3ea64b /drivers/net/virtio_net.c | |
parent | bpf, xdp: Update devmap comments to reflect napi/rcu usage (diff) | |
download | linux-9719c6b98db42462bfb9aa172f017bdfd6d66c6f.tar.xz linux-9719c6b98db42462bfb9aa172f017bdfd6d66c6f.zip |
bpf, xdp: virtio_net use access ptr macro for xdp enable check
virtio_net currently relies on rcu critical section to access the xdp
program in its xdp_xmit handler. However, the pointer to the xdp program
is only used to do a NULL pointer comparison to determine if xdp is
enabled or not.
Use rcu_access_pointer() instead of rcu_dereference() to reflect this.
Then later when we drop rcu_read critical section virtio_net will not
need in special handling.
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Link: https://lore.kernel.org/bpf/1580084042-11598-3-git-send-email-john.fastabend@gmail.com
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r-- | drivers/net/virtio_net.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index c458cd313281..2fe7a3188282 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -501,7 +501,7 @@ static int virtnet_xdp_xmit(struct net_device *dev, /* Only allow ndo_xdp_xmit if XDP is loaded on dev, as this * indicate XDP resources have been successfully allocated. */ - xdp_prog = rcu_dereference(rq->xdp_prog); + xdp_prog = rcu_access_pointer(rq->xdp_prog); if (!xdp_prog) return -ENXIO; |