net/i40e: Fix concurrency issues between config flow and XSK
authorMaxim Mikityanskiy <maximmi@mellanox.com>
Tue, 17 Dec 2019 16:20:45 +0000 (16:20 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 19 Dec 2019 15:20:49 +0000 (16:20 +0100)
commitb3873a5be757b44d51af542a50a6f2a3b6f95284
tree5881ff638c61189cea401718fdc953a795f331f4
parent9cf88808ad6a0f1e958e00abd9a081295fe6da0c
net/i40e: 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. i40e_down already calls synchronize_rcu. On i40e_down either
__I40E_VSI_DOWN or __I40E_CONFIG_BUSY is set. Check the latter in
i40e_xsk_wakeup (the former is already checked there).

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

3. Changing the number of channels brings the interface down (see
i40e_prep_for_reset and i40e_pf_quiesce_all_vsi).

4. Disabling UMEM sets __I40E_CONFIG_BUSY, too.

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-4-maximmi@mellanox.com
drivers/net/ethernet/intel/i40e/i40e.h
drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/intel/i40e/i40e_xsk.c