linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] ice: Fix logic of getting XSK pool associated with Tx queue
@ 2022-03-29 10:27 Ivan Vecera
  2022-03-29 12:00 ` Maciej Fijalkowski
  0 siblings, 1 reply; 6+ messages in thread
From: Ivan Vecera @ 2022-03-29 10:27 UTC (permalink / raw)
  To: netdev
  Cc: poros, mschmidt, Jesse Brandeburg, Tony Nguyen, David S. Miller,
	Jakub Kicinski, Paolo Abeni, Alexei Starovoitov, Daniel Borkmann,
	Jesper Dangaard Brouer, John Fastabend, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, KP Singh,
	Jeff Kirsher, Krzysztof Kazimierczak, Maciej Fijalkowski,
	Alexander Lobakin, moderated list:INTEL ETHERNET DRIVERS,
	open list, open list:XDP (eXpress Data Path)

Function ice_tx_xsk_pool() used to get XSK buffer pool associated
with XDP Tx queue returns NULL when number of ordinary Tx queues
is not equal to num_possible_cpus().

The function computes XDP Tx queue ID as an expression
`ring->q_index - vsi->num_xdp_txq` but this is wrong because
XDP Tx queues are placed after ordinary ones so the correct
formula is `ring->q_index - vsi->alloc_txq`.

Prior commit 792b2086584f ("ice: fix vsi->txq_map sizing") number
of XDP Tx queues was equal to number of ordinary Tx queues so
the bug in mentioned function was hidden.

Reproducer:
host# ethtool -L ens7f0 combined 1
host# ./xdpsock -i ens7f0 -q 0 -t -N
samples/bpf/xdpsock_user.c:kick_tx:794: errno: 6/"No such device or address"

 sock0@ens7f0:0 txonly xdp-drv
                pps         pkts        0.00
rx              0           0
tx              0           0

Fixes: 2d4238f55697 ("ice: Add support for AF_XDP")
Fixes: 792b2086584f ("ice: fix vsi->txq_map sizing")
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
 drivers/net/ethernet/intel/ice/ice.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h
index b0b27bfcd7a2..d4f1874df7d0 100644
--- a/drivers/net/ethernet/intel/ice/ice.h
+++ b/drivers/net/ethernet/intel/ice/ice.h
@@ -710,7 +710,7 @@ static inline struct xsk_buff_pool *ice_tx_xsk_pool(struct ice_tx_ring *ring)
 	struct ice_vsi *vsi = ring->vsi;
 	u16 qid;
 
-	qid = ring->q_index - vsi->num_xdp_txq;
+	qid = ring->q_index - vsi->alloc_txq;
 
 	if (!ice_is_xdp_ena_vsi(vsi) || !test_bit(qid, vsi->af_xdp_zc_qps))
 		return NULL;
-- 
2.34.1


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

end of thread, other threads:[~2022-03-30 21:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-29 10:27 [PATCH net] ice: Fix logic of getting XSK pool associated with Tx queue Ivan Vecera
2022-03-29 12:00 ` Maciej Fijalkowski
2022-03-29 17:55   ` Ivan Vecera
2022-03-30 16:47     ` Michael, Alice
2022-03-30 17:00       ` Alexander Lobakin
2022-03-30 21:30         ` Michael, Alice

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).