]> git.baikalelectronics.ru Git - kernel.git/commit
i40e: fix receiving of single packets in xsk zero-copy mode
authorMagnus Karlsson <magnus.karlsson@intel.com>
Fri, 19 Mar 2021 09:44:10 +0000 (10:44 +0100)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Thu, 1 Apr 2021 16:27:38 +0000 (09:27 -0700)
commit528060ef3e1105c5c3eba66ffbfc80e0825e2cce
treede6a5189e7fd17d1596e3d96e8cb050571f53bc9
parent7a75a8412fdd52a64ee860bd9708d16b1b2aa77a
i40e: fix receiving of single packets in xsk zero-copy mode

Fix so that single packets are received immediately instead of in
batches of 8. If you sent 1 pps to a system, you received 8 packets
every 8 seconds instead of 1 packet every second. The problem behind
this was that the work_done reporting from the Tx part of the driver
was broken. The work_done reporting in i40e controls not only the
reporting back to the napi logic but also the setting of the interrupt
throttling logic. When Tx or Rx reports that it has more to do,
interrupts are throttled or coalesced and when they both report that
they are done, interrupts are armed right away. If the wrong work_done
value is returned, the logic will start to throttle interrupts in a
situation where it should have just enabled them. This leads to the
undesired batching behavior seen in user-space.

Fix this by returning the correct boolean value from the Tx xsk
zero-copy path. Return true if there is nothing to do or if we got
fewer packets to process than we asked for. Return false if we got as
many packets as the budget since there might be more packets we can
process.

Fixes: 3106c580fb7c ("i40e: Use batched xsk Tx interfaces to increase performance")
Reported-by: Sreedevi Joshi <sreedevi.joshi@intel.com>
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Tested-by: Kiran Bhandare <kiranx.bhandare@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/i40e/i40e_xsk.c