Message ID | 20240708230750.625986-1-anthony.l.nguyen@intel.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 01fc5142ae6b06b61ed51a624f2732d6525d8ea3 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net] i40e: Fix XDP program unloading while removing the driver | expand |
Hello: This patch was applied to netdev/net.git (main) by Jakub Kicinski <kuba@kernel.org>: On Mon, 8 Jul 2024 16:07:49 -0700 you wrote: > From: Michal Kubiak <michal.kubiak@intel.com> > > The commit 6533e558c650 ("i40e: Fix reset path while removing > the driver") introduced a new PF state "__I40E_IN_REMOVE" to block > modifying the XDP program while the driver is being removed. > Unfortunately, such a change is useful only if the ".ndo_bpf()" > callback was called out of the rmmod context because unloading the > existing XDP program is also a part of driver removing procedure. > In other words, from the rmmod context the driver is expected to > unload the XDP program without reporting any errors. Otherwise, > the kernel warning with callstack is printed out to dmesg. > > [...] Here is the summary with links: - [net] i40e: Fix XDP program unloading while removing the driver https://git.kernel.org/netdev/net/c/01fc5142ae6b You are awesome, thank you!
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 284c3fad5a6e..310513d9321b 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -13293,6 +13293,10 @@ static int i40e_xdp_setup(struct i40e_vsi *vsi, struct bpf_prog *prog, bool need_reset; int i; + /* VSI shall be deleted in a moment, block loading new programs */ + if (prog && test_bit(__I40E_IN_REMOVE, pf->state)) + return -EINVAL; + /* Don't allow frames that span over multiple buffers */ if (vsi->netdev->mtu > frame_size - I40E_PACKET_HDR_PAD) { NL_SET_ERR_MSG_MOD(extack, "MTU too large for linear frames and XDP prog does not support frags"); @@ -13301,14 +13305,9 @@ static int i40e_xdp_setup(struct i40e_vsi *vsi, struct bpf_prog *prog, /* When turning XDP on->off/off->on we reset and rebuild the rings. */ need_reset = (i40e_enabled_xdp_vsi(vsi) != !!prog); - if (need_reset) i40e_prep_for_reset(pf); - /* VSI shall be deleted in a moment, just return EINVAL */ - if (test_bit(__I40E_IN_REMOVE, pf->state)) - return -EINVAL; - old_prog = xchg(&vsi->xdp_prog, prog); if (need_reset) {