Skip to contentSkip to conversation

ice: Fix logic of getting XSK pool associated with Tx queue

PATCH In review Ivan Vecera 4 participants 6 messages Mar 29, 2022 – Mar 30, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ice: Fix logic of getting XSK pool associated with Tx queue

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 at 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")
---
 drivers/net/ethernet/intel/ice/ice.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice.h +1 -1
index b0b27bfcd7a2..d4f1874df7d0 100644
@@ -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;
Signature · 1 line
2.34.1
#1 lore raw
Quoted 18 lines · Ivan Vecera

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"

Quoted 8 lines

sock0 at 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")

Thanks for this fix! I did exactly the same patch yesterday and it's already applied to bpf tree:

https://lore.kernel.org/bpf/20220328142123.170157-5-maciej.fijalkowski at intel.com/T/#u

Maciej

Quoted 20 lines
---
 drivers/net/ethernet/intel/ice/ice.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice.h +1 -1
index b0b27bfcd7a2..d4f1874df7d0 100644
@@ -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;
Signature · 1 line
2.34.1
#3 lore raw
Quoted 28 lines

-----Original Message-----
From: Ivan Vecera <[email protected]>
Sent: Tuesday, March 29, 2022 10:55 AM
To: Fijalkowski, Maciej <[email protected]>
Cc: netdev at vger.kernel.org; poros <[email protected]>; mschmidt <[email protected]>; Brandeburg, Jesse <[email protected]>; Nguyen, Anthony L <[email protected]>; David S. Miller <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Andrii Nakryiko <[email protected]>; Martin KaFai Lau <[email protected]>; Song Liu <[email protected]>; Yonghong Song <[email protected]>; KP Singh <[email protected]>; Jeff Kirsher <[email protected]>; Krzysztof Kazimierczak <[email protected]>; Lobakin, Alexandr <[email protected]>; moderated list:INTEL ETHERNET DRIVERS <[email protected]>; open list <[email protected]>; open list:XDP (eXpress Data Path) <[email protected]>
Subject: Re: [PATCH net] ice: Fix logic of getting XSK pool associated with Tx queue

Quoted 3 lines · On Tue, 29 Mar 2022 14:00:01 +0200 Maciej Fijalkowski…

Thanks for this fix! I did exactly the same patch yesterday and it's already applied to bpf tree:

Quoted 8 lines
Quoted 4 lines

https://lore.kernel.org/bpf/20220328142123.170157-5-maciej.fijalkowski
@intel.com/T/#u

Maciej

Thanks for info... Nice human race condition ;-)

I.

I'm covering for Tony this week maintaining this tree. He let me know there were a few patches you had to send Ivan and I was waiting on this one. If I'm following correctly, this one will be dropped and the other ones are ready to be sent now to net then?

Alice.

#4 lore raw

From: Alice Michael <[email protected]>
Date: Wed, 30 Mar 2022 16:47:18 +0000

Quoted 31 lines
Quoted 31 lines

-----Original Message-----
From: Ivan Vecera <[email protected]>
Sent: Tuesday, March 29, 2022 10:55 AM
To: Fijalkowski, Maciej <[email protected]>
Cc: netdev at vger.kernel.org; poros <[email protected]>; mschmidt <[email protected]>; Brandeburg, Jesse <[email protected]>; Nguyen, Anthony L <[email protected]>; David S. Miller <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Andrii Nakryiko <[email protected]>; Martin KaFai Lau <[email protected]>; Song Liu <[email protected]>; Yonghong Song <[email protected]>; KP Singh <[email protected]>; Jeff Kirsher <[email protected]>; Krzysztof Kazimierczak <[email protected]>; Lobakin, Alexandr <[email protected]>; moderated list:INTEL ETHERNET DRIVERS <[email protected]>; open list <[email protected]>; open list:XDP (eXpress Data Path) <[email protected]>
Subject: Re: [PATCH net] ice: Fix logic of getting XSK pool associated with Tx queue

Quoted 6 lines · On Tue, 29 Mar 2022 14:00:01 +0200 Maciej Fijalkowski…

Thanks for this fix! I did exactly the same patch yesterday and it's already applied to bpf tree:

https://lore.kernel.org/bpf/20220328142123.170157-5-maciej.fijalkowski
@intel.com/T/#u

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Maciej

Thanks for info... Nice human race condition ;-)

I.

I'm covering for Tony this week maintaining this tree. He let me know there were a few patches you had to send Ivan and I was waiting on this one. If I'm following correctly, this one will be dropped and the other ones are ready to be sent now to net then?

Yes, this one is beaten and the net tree already contains it[0]. There are still 3 Ivan's fixes not applied yet:
* [1]
* [2]
* [3]

I'm wondering if it's worth to pass them through dev-queue since they're urgent and have been tested already in 2 companies? They could go directly to -net and make it into RC1.

Quoted 2 lines

Alice.

[0] https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=1ac2524de7b366633fc336db6c94062768d0ab03
[1] https://lore.kernel.org/netdev/20220322142554.3253428-1-ivecera at redhat.com
[2] https://lore.kernel.org/netdev/20220325132524.1765342-1-ivecera at redhat.com
[3] https://lore.kernel.org/netdev/20220325132819.1767050-1-ivecera at redhat.com

Thanks,
Al

#5 lore raw
Quoted 92 lines

-----Original Message-----
From: Lobakin, Alexandr <[email protected]>
Sent: Wednesday, March 30, 2022 10:01 AM
To: Michael, Alice <[email protected]>
Cc: Lobakin, Alexandr <[email protected]>; ivecera <[email protected]>; Fijalkowski, Maciej <[email protected]>; netdev at vger.kernel.org; poros <[email protected]>; mschmidt <[email protected]>; Brandeburg, Jesse <[email protected]>; Nguyen, Anthony L <[email protected]>; David S. Miller <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Andrii Nakryiko <[email protected]>; Martin KaFai Lau <[email protected]>; Song Liu <[email protected]>; Yonghong Song <[email protected]>; KP Singh <[email protected]>; moderated list:INTEL ETHERNET DRIVERS <intel- wired-lan at lists.osuosl.org>; open list <[email protected]>; open list:XDP (eXpress Data Path) <[email protected]>
Subject: Re: [PATCH net] ice: Fix logic of getting XSK pool associated with Tx queue

From: Alice Michael <[email protected]>
Date: Wed, 30 Mar 2022 16:47:18 +0000

Quoted 33 lines
Quoted 33 lines

-----Original Message-----
From: Ivan Vecera <[email protected]>
Sent: Tuesday, March 29, 2022 10:55 AM
To: Fijalkowski, Maciej <[email protected]>
Cc: netdev at vger.kernel.org; poros <[email protected]>; mschmidt <[email protected]>; Brandeburg, Jesse <[email protected]>; Nguyen, Anthony L <[email protected]>; David S. Miller <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Andrii Nakryiko <[email protected]>; Martin KaFai Lau <[email protected]>; Song Liu <[email protected]>; Yonghong Song <[email protected]>; KP Singh <[email protected]>; Jeff Kirsher <[email protected]>; Krzysztof Kazimierczak <[email protected]>; Lobakin, Alexandr <[email protected]>; moderated list:INTEL ETHERNET DRIVERS <[email protected]>; open list <[email protected]>; open list:XDP (eXpress Data Path) <[email protected]>
Subject: Re: [PATCH net] ice: Fix logic of getting XSK pool associated with Tx queue

Quoted 7 lines · On Tue, 29 Mar 2022 14:00:01 +0200 Maciej Fijalkowski…

Thanks for this fix! I did exactly the same patch yesterday and it's already applied to bpf tree:

https://lore.kernel.org/bpf/20220328142123.170157-5-maciej.fijalko
wski
@intel.com/T/#u

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Maciej

Thanks for info... Nice human race condition ;-)

I.

I'm covering for Tony this week maintaining this tree. He let me know there

were a few patches you had to send Ivan and I was waiting on this one. If I'm following correctly, this one will be dropped and the other ones are ready to be sent now to net then?

Yes, this one is beaten and the net tree already contains it[0]. There are still 3 Ivan's fixes not applied yet:
* [1]
* [2]
* [3]

I'm wondering if it's worth to pass them through dev-queue since they're urgent and have been tested already in 2 companies? They could go directly to -net and make it into RC1.

Quoted 2 lines

Alice.

[0]
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=
1ac2524de7b366633fc336db6c94062768d0ab03
[1] https://lore.kernel.org/netdev/20220322142554.3253428-1-
ivecera at redhat.com
[2] https://lore.kernel.org/netdev/20220325132524.1765342-1-
ivecera at redhat.com
[3] https://lore.kernel.org/netdev/20220325132819.1767050-1-
ivecera at redhat.com

Quoted 2 lines

Thanks,
Al

Yes, if you read my original message, I said to net =) I am the one that takes it from here and sends to net. I was asserting that his changes were done now and ready to be sent to net or if I was missing another patch he is working on before putting it up.
Alice