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

* Re: [PATCH net] ice: Fix logic of getting XSK pool associated with Tx queue
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Maciej Fijalkowski @ 2022-03-29 12:00 UTC (permalink / raw)
  To: Ivan Vecera
  Cc: netdev, 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,
	Alexander Lobakin, moderated list:INTEL ETHERNET DRIVERS,
	open list, open list:XDP (eXpress Data Path)

On Tue, Mar 29, 2022 at 12:27:51PM +0200, Ivan Vecera wrote:
> 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>

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

Maciej

> ---
>  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	[flat|nested] 6+ messages in thread

* Re: [PATCH net] ice: Fix logic of getting XSK pool associated with Tx queue
  2022-03-29 12:00 ` Maciej Fijalkowski
@ 2022-03-29 17:55   ` Ivan Vecera
  2022-03-30 16:47     ` Michael, Alice
  0 siblings, 1 reply; 6+ messages in thread
From: Ivan Vecera @ 2022-03-29 17:55 UTC (permalink / raw)
  To: Maciej Fijalkowski
  Cc: netdev, 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,
	Alexander Lobakin, moderated list:INTEL ETHERNET DRIVERS,
	open list, open list:XDP (eXpress Data Path)

On Tue, 29 Mar 2022 14:00:01 +0200
Maciej Fijalkowski <maciej.fijalkowski@intel.com> wrote:

> 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
> 
> Maciej

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

I.


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

* RE: [PATCH net] ice: Fix logic of getting XSK pool associated with Tx queue
  2022-03-29 17:55   ` Ivan Vecera
@ 2022-03-30 16:47     ` Michael, Alice
  2022-03-30 17:00       ` Alexander Lobakin
  0 siblings, 1 reply; 6+ messages in thread
From: Michael, Alice @ 2022-03-30 16:47 UTC (permalink / raw)
  To: ivecera, Fijalkowski, Maciej
  Cc: netdev, poros, mschmidt, Brandeburg, Jesse, Nguyen, Anthony L,
	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, Lobakin, Alexandr,
	moderated list:INTEL ETHERNET DRIVERS, open list,
	open list:XDP (eXpress Data Path)

> -----Original Message-----
> From: Ivan Vecera <ivecera@redhat.com>
> Sent: Tuesday, March 29, 2022 10:55 AM
> To: Fijalkowski, Maciej <maciej.fijalkowski@intel.com>
> Cc: netdev@vger.kernel.org; poros <poros@redhat.com>; mschmidt
> <mschmidt@redhat.com>; Brandeburg, Jesse
> <jesse.brandeburg@intel.com>; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>; David S. Miller <davem@davemloft.net>;
> Jakub Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>;
> Alexei Starovoitov <ast@kernel.org>; Daniel Borkmann
> <daniel@iogearbox.net>; Jesper Dangaard Brouer <hawk@kernel.org>; John
> Fastabend <john.fastabend@gmail.com>; Andrii Nakryiko
> <andrii@kernel.org>; Martin KaFai Lau <kafai@fb.com>; Song Liu
> <songliubraving@fb.com>; Yonghong Song <yhs@fb.com>; KP Singh
> <kpsingh@kernel.org>; Jeff Kirsher <jeffrey.t.kirsher@intel.com>; Krzysztof
> Kazimierczak <krzysztof.kazimierczak@intel.com>; Lobakin, Alexandr
> <alexandr.lobakin@intel.com>; moderated list:INTEL ETHERNET DRIVERS
> <intel-wired-lan@lists.osuosl.org>; open list <linux-kernel@vger.kernel.org>;
> open list:XDP (eXpress Data Path) <bpf@vger.kernel.org>
> Subject: Re: [PATCH net] ice: Fix logic of getting XSK pool associated with Tx
> queue
> 
> On Tue, 29 Mar 2022 14:00:01 +0200
> Maciej Fijalkowski <maciej.fijalkowski@intel.com> wrote:
> 
> > 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
> >
> > 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.

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

* Re: [PATCH net] ice: Fix logic of getting XSK pool associated with Tx queue
  2022-03-30 16:47     ` Michael, Alice
@ 2022-03-30 17:00       ` Alexander Lobakin
  2022-03-30 21:30         ` Michael, Alice
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Lobakin @ 2022-03-30 17:00 UTC (permalink / raw)
  To: Alice Michael
  Cc: Alexander Lobakin, Ivan Vecera, Maciej Fijalkowski, netdev,
	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,
	moderated list:INTEL ETHERNET DRIVERS, open list,
	open list:XDP (eXpress Data Path)

From: Alice Michael <alice.michael@intel.com>
Date: Wed, 30 Mar 2022 16:47:18 +0000

> > -----Original Message-----
> > From: Ivan Vecera <ivecera@redhat.com>
> > Sent: Tuesday, March 29, 2022 10:55 AM
> > To: Fijalkowski, Maciej <maciej.fijalkowski@intel.com>
> > Cc: netdev@vger.kernel.org; poros <poros@redhat.com>; mschmidt
> > <mschmidt@redhat.com>; Brandeburg, Jesse
> > <jesse.brandeburg@intel.com>; Nguyen, Anthony L
> > <anthony.l.nguyen@intel.com>; David S. Miller <davem@davemloft.net>;
> > Jakub Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>;
> > Alexei Starovoitov <ast@kernel.org>; Daniel Borkmann
> > <daniel@iogearbox.net>; Jesper Dangaard Brouer <hawk@kernel.org>; John
> > Fastabend <john.fastabend@gmail.com>; Andrii Nakryiko
> > <andrii@kernel.org>; Martin KaFai Lau <kafai@fb.com>; Song Liu
> > <songliubraving@fb.com>; Yonghong Song <yhs@fb.com>; KP Singh
> > <kpsingh@kernel.org>; Jeff Kirsher <jeffrey.t.kirsher@intel.com>; Krzysztof
> > Kazimierczak <krzysztof.kazimierczak@intel.com>; Lobakin, Alexandr
> > <alexandr.lobakin@intel.com>; moderated list:INTEL ETHERNET DRIVERS
> > <intel-wired-lan@lists.osuosl.org>; open list <linux-kernel@vger.kernel.org>;
> > open list:XDP (eXpress Data Path) <bpf@vger.kernel.org>
> > Subject: Re: [PATCH net] ice: Fix logic of getting XSK pool associated with Tx
> > queue
> > 
> > On Tue, 29 Mar 2022 14:00:01 +0200
> > Maciej Fijalkowski <maciej.fijalkowski@intel.com> wrote:
> > 
> > > 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
> > >
> > > 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.

> 
> 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@redhat.com
[2] https://lore.kernel.org/netdev/20220325132524.1765342-1-ivecera@redhat.com
[3] https://lore.kernel.org/netdev/20220325132819.1767050-1-ivecera@redhat.com

Thanks,
Al

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

* RE: [PATCH net] ice: Fix logic of getting XSK pool associated with Tx queue
  2022-03-30 17:00       ` Alexander Lobakin
@ 2022-03-30 21:30         ` Michael, Alice
  0 siblings, 0 replies; 6+ messages in thread
From: Michael, Alice @ 2022-03-30 21:30 UTC (permalink / raw)
  To: Lobakin, Alexandr
  Cc: ivecera, Fijalkowski, Maciej, netdev, poros, mschmidt,
	Brandeburg, Jesse, Nguyen, Anthony L, 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,
	moderated list:INTEL ETHERNET DRIVERS, open list,
	open list:XDP (eXpress Data Path)

> -----Original Message-----
> From: Lobakin, Alexandr <alexandr.lobakin@intel.com>
> Sent: Wednesday, March 30, 2022 10:01 AM
> To: Michael, Alice <alice.michael@intel.com>
> Cc: Lobakin, Alexandr <alexandr.lobakin@intel.com>; ivecera
> <ivecera@redhat.com>; Fijalkowski, Maciej <maciej.fijalkowski@intel.com>;
> netdev@vger.kernel.org; poros <poros@redhat.com>; mschmidt
> <mschmidt@redhat.com>; Brandeburg, Jesse
> <jesse.brandeburg@intel.com>; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>; David S. Miller <davem@davemloft.net>;
> Jakub Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>;
> Alexei Starovoitov <ast@kernel.org>; Daniel Borkmann
> <daniel@iogearbox.net>; Jesper Dangaard Brouer <hawk@kernel.org>; John
> Fastabend <john.fastabend@gmail.com>; Andrii Nakryiko
> <andrii@kernel.org>; Martin KaFai Lau <kafai@fb.com>; Song Liu
> <songliubraving@fb.com>; Yonghong Song <yhs@fb.com>; KP Singh
> <kpsingh@kernel.org>; moderated list:INTEL ETHERNET DRIVERS <intel-
> wired-lan@lists.osuosl.org>; open list <linux-kernel@vger.kernel.org>; open
> list:XDP (eXpress Data Path) <bpf@vger.kernel.org>
> Subject: Re: [PATCH net] ice: Fix logic of getting XSK pool associated with Tx
> queue
> 
> From: Alice Michael <alice.michael@intel.com>
> Date: Wed, 30 Mar 2022 16:47:18 +0000
> 
> > > -----Original Message-----
> > > From: Ivan Vecera <ivecera@redhat.com>
> > > Sent: Tuesday, March 29, 2022 10:55 AM
> > > To: Fijalkowski, Maciej <maciej.fijalkowski@intel.com>
> > > Cc: netdev@vger.kernel.org; poros <poros@redhat.com>; mschmidt
> > > <mschmidt@redhat.com>; Brandeburg, Jesse
> > > <jesse.brandeburg@intel.com>; Nguyen, Anthony L
> > > <anthony.l.nguyen@intel.com>; David S. Miller <davem@davemloft.net>;
> > > Jakub Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>;
> > > Alexei Starovoitov <ast@kernel.org>; Daniel Borkmann
> > > <daniel@iogearbox.net>; Jesper Dangaard Brouer <hawk@kernel.org>;
> > > John Fastabend <john.fastabend@gmail.com>; Andrii Nakryiko
> > > <andrii@kernel.org>; Martin KaFai Lau <kafai@fb.com>; Song Liu
> > > <songliubraving@fb.com>; Yonghong Song <yhs@fb.com>; KP Singh
> > > <kpsingh@kernel.org>; Jeff Kirsher <jeffrey.t.kirsher@intel.com>;
> > > Krzysztof Kazimierczak <krzysztof.kazimierczak@intel.com>; Lobakin,
> > > Alexandr <alexandr.lobakin@intel.com>; moderated list:INTEL ETHERNET
> > > DRIVERS <intel-wired-lan@lists.osuosl.org>; open list
> > > <linux-kernel@vger.kernel.org>; open list:XDP (eXpress Data Path)
> > > <bpf@vger.kernel.org>
> > > Subject: Re: [PATCH net] ice: Fix logic of getting XSK pool
> > > associated with Tx queue
> > >
> > > On Tue, 29 Mar 2022 14:00:01 +0200
> > > Maciej Fijalkowski <maciej.fijalkowski@intel.com> wrote:
> > >
> > > > 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
> > > >
> > > > 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.
> 
> >
> > 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@redhat.com
> [2] https://lore.kernel.org/netdev/20220325132524.1765342-1-
> ivecera@redhat.com
> [3] https://lore.kernel.org/netdev/20220325132819.1767050-1-
> ivecera@redhat.com
> 
> 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

^ permalink raw reply	[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).