net/ixgbe: Fix concurrency issues between config flow and XSK
authorMaxim Mikityanskiy <maximmi@mellanox.com>
Tue, 17 Dec 2019 16:20:47 +0000 (16:20 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 19 Dec 2019 15:20:49 +0000 (16:20 +0100)
commitc0fdccfd226a1424683d3000d9e08384391210a2
treebc5d84b8543985f1b7c03f1ff1a2c6edc0306cdd
parentb3873a5be757b44d51af542a50a6f2a3b6f95284
net/ixgbe: Fix concurrency issues between config flow and XSK

Use synchronize_rcu to wait until the XSK wakeup function finishes
before destroying the resources it uses:

1. ixgbe_down already calls synchronize_rcu after setting __IXGBE_DOWN.

2. After switching the XDP program, call synchronize_rcu to let
ixgbe_xsk_wakeup exit before the XDP program is freed.

3. Changing the number of channels brings the interface down.

4. Disabling UMEM sets __IXGBE_TX_DISABLED before closing hardware
resources and resetting xsk_umem. Check that bit in ixgbe_xsk_wakeup to
avoid using the XDP ring when it's already destroyed. synchronize_rcu is
called from ixgbe_txrx_ring_disable.

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-5-maximmi@mellanox.com
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c