]> git.baikalelectronics.ru Git - kernel.git/commit
i40e: fix potential RX buffer starvation for AF_XDP
authorMagnus Karlsson <magnus.karlsson@intel.com>
Tue, 29 Jan 2019 14:03:17 +0000 (15:03 +0100)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Thu, 21 Feb 2019 18:56:17 +0000 (10:56 -0800)
commitdc1531bd03240408f90905a8a9f6d1085e2dac3a
tree1ab88f787aa1167678fffaabce86e13510ffb879
parent5c991f3d85246033c78a7e569466037ebe179a3d
i40e: fix potential RX buffer starvation for AF_XDP

When the RX rings are created they are also populated with buffers
so that packets can be received. Usually these are kernel buffers,
but for AF_XDP in zero-copy mode, these are user-space buffers and
in this case the application might not have sent down any buffers
to the driver at this point. And if no buffers are allocated at ring
creation time, no packets can be received and no interrupts will be
generated so the NAPI poll function that allocates buffers to the
rings will never get executed.

To rectify this, we kick the NAPI context of any queue with an
attached AF_XDP zero-copy socket in two places in the code. Once
after an XDP program has loaded and once after the umem is registered.
This take care of both cases: XDP program gets loaded first then AF_XDP
socket is created, and the reverse, AF_XDP socket is created first,
then XDP program is loaded.

Fixes: 60e7aeb92ba1 ("i40e: add AF_XDP zero-copy Rx support")
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/intel/i40e/i40e_xsk.c