summaryrefslogtreecommitdiffstats
path: root/net/xdp/xsk_queue.h
diff options
context:
space:
mode:
authorMaxim Mikityanskiy <maximmi@mellanox.com>2019-12-17 17:20:42 +0100
committerDaniel Borkmann <daniel@iogearbox.net>2019-12-19 16:20:48 +0100
commit06870682087b58398671e8cdc896cd62314c4399 (patch)
treedef06aab14ab1c53d12fe4fc7c9f77fec90d0ac7 /net/xdp/xsk_queue.h
parentbpf: Fix cgroup local storage prog tracking (diff)
downloadlinux-06870682087b58398671e8cdc896cd62314c4399.tar.xz
linux-06870682087b58398671e8cdc896cd62314c4399.zip
xsk: Add rcu_read_lock around the XSK wakeup
The XSK wakeup callback in drivers makes some sanity checks before triggering NAPI. However, some configuration changes may occur during this function that affect the result of those checks. For example, the interface can go down, and all the resources will be destroyed after the checks in the wakeup function, but before it attempts to use these resources. Wrap this callback in rcu_read_lock to allow driver to synchronize_rcu before actually destroying the resources. xsk_wakeup is a new function that encapsulates calling ndo_xsk_wakeup wrapped into the RCU lock. After this commit, xsk_poll starts using xsk_wakeup and checks xs->zc instead of ndo_xsk_wakeup != NULL to decide ndo_xsk_wakeup should be called. It also fixes a bug introduced with the need_wakeup feature: a non-zero-copy socket may be used with a driver supporting zero-copy, and in this case ndo_xsk_wakeup should not be called, so the xs->zc check is the correct one. Fixes: 77cd0d7b3f25 ("xsk: add support for need_wakeup flag in AF_XDP rings") Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com> Signed-off-by: Björn Töpel <bjorn.topel@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20191217162023.16011-2-maximmi@mellanox.com
Diffstat (limited to 'net/xdp/xsk_queue.h')
0 files changed, 0 insertions, 0 deletions