BPF List
 help / color / mirror / Atom feed
* [PATCH net 1/1] ice: xsk: clear status_error0 for each allocated desc
@ 2021-11-29 23:17 Tony Nguyen
  2021-11-30 12:20 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Tony Nguyen @ 2021-11-29 23:17 UTC (permalink / raw)
  To: davem, kuba
  Cc: Maciej Fijalkowski, netdev, anthony.l.nguyen, magnus.karlsson,
	ast, daniel, hawk, john.fastabend, bpf, Alexander Lobakin

From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>

Fix a bug in which the receiving of packets can stop in the zero-copy
driver. Ice HW ignores 3 lower bits from QRX_TAIL register, which means
that tail is bumped only on intervals of 8. Currently with XSK RX
batching in place, ice_alloc_rx_bufs_zc() clears the status_error0 only
of the last descriptor that has been allocated/taken from the XSK buffer
pool. status_error0 includes DD bit that is looked upon by the
ice_clean_rx_irq_zc() to tell if a descriptor can be processed.

The bug can be triggered when driver updates the ntu but not the
QRX_TAIL, so HW wouldn't have a chance to write to the ready
descriptors. Later on driver moves the ntc to the mentioned set of
descriptors and interprets them as a ready to be processed, since
corresponding DD bits were not cleared nor any writeback has happened
that would clear it. This can then lead to ntc == ntu case which means
that ring is empty and no further packet processing.

Fix the XSK traffic hang that can be observed when l2fwd scenario from
xdpsock is used by making sure that status_error0 is cleared for each
descriptor that is fed to HW and therefore we are sure that driver will
not processed non-valid DD bits. This will also prevent the driver from
processing the descriptors that were allocated in favor of the
previously processed ones, but writeback didn't happen yet.

Fixes: db804cfc21e9 ("ice: Use the xsk batched rx allocation interface")
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Reviewed-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_xsk.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c
index ff55cb415b11..bb9a80847298 100644
--- a/drivers/net/ethernet/intel/ice/ice_xsk.c
+++ b/drivers/net/ethernet/intel/ice/ice_xsk.c
@@ -383,6 +383,7 @@ bool ice_alloc_rx_bufs_zc(struct ice_rx_ring *rx_ring, u16 count)
 	while (i--) {
 		dma = xsk_buff_xdp_get_dma(*xdp);
 		rx_desc->read.pkt_addr = cpu_to_le64(dma);
+		rx_desc->wb.status_error0 = 0;
 
 		rx_desc++;
 		xdp++;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net 1/1] ice: xsk: clear status_error0 for each allocated desc
  2021-11-29 23:17 [PATCH net 1/1] ice: xsk: clear status_error0 for each allocated desc Tony Nguyen
@ 2021-11-30 12:20 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-11-30 12:20 UTC (permalink / raw)
  To: Tony Nguyen
  Cc: davem, kuba, maciej.fijalkowski, netdev, magnus.karlsson, ast,
	daniel, hawk, john.fastabend, bpf, alexandr.lobakin

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Mon, 29 Nov 2021 15:17:46 -0800 you wrote:
> From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> 
> Fix a bug in which the receiving of packets can stop in the zero-copy
> driver. Ice HW ignores 3 lower bits from QRX_TAIL register, which means
> that tail is bumped only on intervals of 8. Currently with XSK RX
> batching in place, ice_alloc_rx_bufs_zc() clears the status_error0 only
> of the last descriptor that has been allocated/taken from the XSK buffer
> pool. status_error0 includes DD bit that is looked upon by the
> ice_clean_rx_irq_zc() to tell if a descriptor can be processed.
> 
> [...]

Here is the summary with links:
  - [net,1/1] ice: xsk: clear status_error0 for each allocated desc
    https://git.kernel.org/netdev/net/c/d1ec975f9fa6

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-30 12:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-29 23:17 [PATCH net 1/1] ice: xsk: clear status_error0 for each allocated desc Tony Nguyen
2021-11-30 12:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox