All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Alexander Lobakin <aleksander.lobakin@intel.com>
Cc: <intel-wired-lan@lists.osuosl.org>,
	Michal Kubiak <michal.kubiak@intel.com>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	"Przemek Kitszel" <przemyslaw.kitszel@intel.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	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>,
	Simon Horman <horms@kernel.org>, <bpf@vger.kernel.org>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next 06/16] idpf: a use saner limit for default number of queues to allocate
Date: Fri, 7 Mar 2025 11:32:15 +0100	[thread overview]
Message-ID: <Z8rLLwZlRACyA49U@boxer> (raw)
In-Reply-To: <20250305162132.1106080-7-aleksander.lobakin@intel.com>

On Wed, Mar 05, 2025 at 05:21:22PM +0100, Alexander Lobakin wrote:
> Currently, the maximum number of queues available for one vport is 16.
> This is hardcoded, but then the function calculating the optimal number
> of queues takes min(16, num_online_cpus()).
> On order to be able to allocate more queues, which will be then used for

nit: s/On/In

> XDP, stop hardcoding 16 and rely on what the device gives us. Instead of
> num_online_cpus(), which is considered suboptimal since at least 2013,
> use netif_get_num_default_rss_queues() to still have free queues in the
> pool.

Should we update older drivers as well?

> nr_cpu_ids number of Tx queues are needed only for lockless XDP sending,
> the regular stack doesn't benefit from that anyhow.
> On a 128-thread Xeon, this now gives me 32 regular Tx queues and leaves
> 224 free for XDP (128 of which will handle XDP_TX, .ndo_xdp_xmit(), and
> XSk xmit when enabled).
> 
> Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
> ---
>  drivers/net/ethernet/intel/idpf/idpf_txrx.c     | 8 +-------
>  drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 2 +-
>  2 files changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> index c15833928ea1..2f221c0abad8 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> @@ -1234,13 +1234,7 @@ int idpf_vport_calc_total_qs(struct idpf_adapter *adapter, u16 vport_idx,
>  		num_req_tx_qs = vport_config->user_config.num_req_tx_qs;
>  		num_req_rx_qs = vport_config->user_config.num_req_rx_qs;
>  	} else {
> -		int num_cpus;
> -
> -		/* Restrict num of queues to cpus online as a default
> -		 * configuration to give best performance. User can always
> -		 * override to a max number of queues via ethtool.
> -		 */
> -		num_cpus = num_online_cpus();
> +		u32 num_cpus = netif_get_num_default_rss_queues();
>  
>  		dflt_splitq_txq_grps = min_t(int, max_q->max_txq, num_cpus);
>  		dflt_singleq_txqs = min_t(int, max_q->max_txq, num_cpus);
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> index 3d2413b8684f..135af3cc243f 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> @@ -937,7 +937,7 @@ int idpf_vport_alloc_max_qs(struct idpf_adapter *adapter,
>  	max_tx_q = le16_to_cpu(caps->max_tx_q) / default_vports;
>  	if (adapter->num_alloc_vports < default_vports) {
>  		max_q->max_rxq = min_t(u16, max_rx_q, IDPF_MAX_Q);
> -		max_q->max_txq = min_t(u16, max_tx_q, IDPF_MAX_Q);
> +		max_q->max_txq = min_t(u16, max_tx_q, IDPF_LARGE_MAX_Q);
>  	} else {
>  		max_q->max_rxq = IDPF_MIN_Q;
>  		max_q->max_txq = IDPF_MIN_Q;
> -- 
> 2.48.1
> 

WARNING: multiple messages have this Message-ID (diff)
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Alexander Lobakin <aleksander.lobakin@intel.com>
Cc: <intel-wired-lan@lists.osuosl.org>,
	Michal Kubiak <michal.kubiak@intel.com>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	"Przemek Kitszel" <przemyslaw.kitszel@intel.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	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>,
	Simon Horman <horms@kernel.org>, <bpf@vger.kernel.org>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [Intel-wired-lan] [PATCH net-next 06/16] idpf: a use saner limit for default number of queues to allocate
Date: Fri, 7 Mar 2025 11:32:15 +0100	[thread overview]
Message-ID: <Z8rLLwZlRACyA49U@boxer> (raw)
In-Reply-To: <20250305162132.1106080-7-aleksander.lobakin@intel.com>

On Wed, Mar 05, 2025 at 05:21:22PM +0100, Alexander Lobakin wrote:
> Currently, the maximum number of queues available for one vport is 16.
> This is hardcoded, but then the function calculating the optimal number
> of queues takes min(16, num_online_cpus()).
> On order to be able to allocate more queues, which will be then used for

nit: s/On/In

> XDP, stop hardcoding 16 and rely on what the device gives us. Instead of
> num_online_cpus(), which is considered suboptimal since at least 2013,
> use netif_get_num_default_rss_queues() to still have free queues in the
> pool.

Should we update older drivers as well?

> nr_cpu_ids number of Tx queues are needed only for lockless XDP sending,
> the regular stack doesn't benefit from that anyhow.
> On a 128-thread Xeon, this now gives me 32 regular Tx queues and leaves
> 224 free for XDP (128 of which will handle XDP_TX, .ndo_xdp_xmit(), and
> XSk xmit when enabled).
> 
> Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
> ---
>  drivers/net/ethernet/intel/idpf/idpf_txrx.c     | 8 +-------
>  drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 2 +-
>  2 files changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> index c15833928ea1..2f221c0abad8 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> @@ -1234,13 +1234,7 @@ int idpf_vport_calc_total_qs(struct idpf_adapter *adapter, u16 vport_idx,
>  		num_req_tx_qs = vport_config->user_config.num_req_tx_qs;
>  		num_req_rx_qs = vport_config->user_config.num_req_rx_qs;
>  	} else {
> -		int num_cpus;
> -
> -		/* Restrict num of queues to cpus online as a default
> -		 * configuration to give best performance. User can always
> -		 * override to a max number of queues via ethtool.
> -		 */
> -		num_cpus = num_online_cpus();
> +		u32 num_cpus = netif_get_num_default_rss_queues();
>  
>  		dflt_splitq_txq_grps = min_t(int, max_q->max_txq, num_cpus);
>  		dflt_singleq_txqs = min_t(int, max_q->max_txq, num_cpus);
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> index 3d2413b8684f..135af3cc243f 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> @@ -937,7 +937,7 @@ int idpf_vport_alloc_max_qs(struct idpf_adapter *adapter,
>  	max_tx_q = le16_to_cpu(caps->max_tx_q) / default_vports;
>  	if (adapter->num_alloc_vports < default_vports) {
>  		max_q->max_rxq = min_t(u16, max_rx_q, IDPF_MAX_Q);
> -		max_q->max_txq = min_t(u16, max_tx_q, IDPF_MAX_Q);
> +		max_q->max_txq = min_t(u16, max_tx_q, IDPF_LARGE_MAX_Q);
>  	} else {
>  		max_q->max_rxq = IDPF_MIN_Q;
>  		max_q->max_txq = IDPF_MIN_Q;
> -- 
> 2.48.1
> 

  reply	other threads:[~2025-03-07 10:32 UTC|newest]

Thread overview: 117+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-05 16:21 [PATCH net-next 00/16] idpf: add XDP support Alexander Lobakin
2025-03-05 16:21 ` [Intel-wired-lan] " Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 01/16] libeth: convert to netmem Alexander Lobakin
2025-03-05 16:21   ` [Intel-wired-lan] " Alexander Lobakin
2025-03-06  0:13   ` Mina Almasry
2025-03-06  0:13     ` [Intel-wired-lan] " Mina Almasry
2025-03-11 17:22     ` Alexander Lobakin
2025-03-11 17:22       ` [Intel-wired-lan] " Alexander Lobakin
2025-03-11 17:43       ` Mina Almasry
2025-03-11 17:43         ` [Intel-wired-lan] " Mina Almasry
2025-03-05 16:21 ` [PATCH net-next 02/16] libeth: support native XDP and register memory model Alexander Lobakin
2025-03-05 16:21   ` [Intel-wired-lan] " Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 03/16] libeth: add a couple of XDP helpers (libeth_xdp) Alexander Lobakin
2025-03-05 16:21   ` [Intel-wired-lan] " Alexander Lobakin
2025-03-11 14:05   ` Maciej Fijalkowski
2025-03-11 14:05     ` [Intel-wired-lan] " Maciej Fijalkowski
2025-03-17 15:26     ` Alexander Lobakin
2025-03-17 15:26       ` [Intel-wired-lan] " Alexander Lobakin
2025-03-19 16:19       ` Maciej Fijalkowski
2025-03-19 16:19         ` [Intel-wired-lan] " Maciej Fijalkowski
2025-04-01 13:11         ` Alexander Lobakin
2025-04-01 13:11           ` [Intel-wired-lan] " Alexander Lobakin
2025-04-08 13:38           ` Alexander Lobakin
2025-04-08 13:38             ` [Intel-wired-lan] " Alexander Lobakin
2025-04-08 13:22     ` Alexander Lobakin
2025-04-08 13:22       ` [Intel-wired-lan] " Alexander Lobakin
2025-04-08 13:51       ` Alexander Lobakin
2025-04-08 13:51         ` [Intel-wired-lan] " Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 04/16] libeth: add XSk helpers Alexander Lobakin
2025-03-05 16:21   ` [Intel-wired-lan] " Alexander Lobakin
2025-03-07 10:15   ` Maciej Fijalkowski
2025-03-07 10:15     ` [Intel-wired-lan] " Maciej Fijalkowski
2025-03-12 17:03     ` Alexander Lobakin
2025-03-12 17:03       ` [Intel-wired-lan] " Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 05/16] idpf: fix Rx descriptor ready check barrier in splitq Alexander Lobakin
2025-03-05 16:21   ` [Intel-wired-lan] " Alexander Lobakin
2025-03-07 10:17   ` Maciej Fijalkowski
2025-03-07 10:17     ` [Intel-wired-lan] " Maciej Fijalkowski
2025-03-12 17:10     ` Alexander Lobakin
2025-03-12 17:10       ` [Intel-wired-lan] " Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 06/16] idpf: a use saner limit for default number of queues to allocate Alexander Lobakin
2025-03-05 16:21   ` [Intel-wired-lan] " Alexander Lobakin
2025-03-07 10:32   ` Maciej Fijalkowski [this message]
2025-03-07 10:32     ` Maciej Fijalkowski
2025-03-12 17:22     ` Alexander Lobakin
2025-03-12 17:22       ` [Intel-wired-lan] " Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 07/16] idpf: link NAPIs to queues Alexander Lobakin
2025-03-05 16:21   ` [Intel-wired-lan] " Alexander Lobakin
2025-03-07 10:28   ` Eric Dumazet
2025-03-07 10:28     ` [Intel-wired-lan] " Eric Dumazet
2025-03-12 17:16     ` Alexander Lobakin
2025-03-12 17:16       ` [Intel-wired-lan] " Alexander Lobakin
2025-03-18 17:10       ` Alexander Lobakin
2025-03-18 17:10         ` [Intel-wired-lan] " Alexander Lobakin
2025-03-07 10:51   ` Maciej Fijalkowski
2025-03-07 10:51     ` [Intel-wired-lan] " Maciej Fijalkowski
2025-03-12 17:25     ` Alexander Lobakin
2025-03-12 17:25       ` [Intel-wired-lan] " Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 08/16] idpf: make complq cleaning dependent on scheduling mode Alexander Lobakin
2025-03-05 16:21   ` [Intel-wired-lan] " Alexander Lobakin
2025-03-07 11:11   ` Maciej Fijalkowski
2025-03-07 11:11     ` [Intel-wired-lan] " Maciej Fijalkowski
2025-03-13 16:16     ` Alexander Lobakin
2025-03-13 16:16       ` [Intel-wired-lan] " Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 09/16] idpf: remove SW marker handling from NAPI Alexander Lobakin
2025-03-05 16:21   ` [Intel-wired-lan] " Alexander Lobakin
2025-03-07 11:42   ` Maciej Fijalkowski
2025-03-07 11:42     ` [Intel-wired-lan] " Maciej Fijalkowski
2025-03-13 16:50     ` Alexander Lobakin
2025-03-13 16:50       ` [Intel-wired-lan] " Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 10/16] idpf: add support for nointerrupt queues Alexander Lobakin
2025-03-05 16:21   ` [Intel-wired-lan] " Alexander Lobakin
2025-03-07 12:10   ` Maciej Fijalkowski
2025-03-07 12:10     ` [Intel-wired-lan] " Maciej Fijalkowski
2025-03-13 16:19     ` Alexander Lobakin
2025-03-13 16:19       ` [Intel-wired-lan] " Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 11/16] idpf: prepare structures to support XDP Alexander Lobakin
2025-03-05 16:21   ` [Intel-wired-lan] " Alexander Lobakin
2025-03-07  1:12   ` Jakub Kicinski
2025-03-07  1:12     ` [Intel-wired-lan] " Jakub Kicinski
2025-03-12 14:00     ` Alexander Lobakin
2025-03-07 13:27   ` Maciej Fijalkowski
2025-03-07 13:27     ` [Intel-wired-lan] " Maciej Fijalkowski
2025-03-17 14:50     ` Alexander Lobakin
2025-03-17 14:50       ` [Intel-wired-lan] " Alexander Lobakin
2025-03-19 16:29       ` Maciej Fijalkowski
2025-03-19 16:29         ` [Intel-wired-lan] " Maciej Fijalkowski
2025-04-08 13:42         ` Alexander Lobakin
2025-04-08 13:42           ` [Intel-wired-lan] " Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 12/16] idpf: implement XDP_SETUP_PROG in ndo_bpf for splitq Alexander Lobakin
2025-03-05 16:21   ` [Intel-wired-lan] " Alexander Lobakin
2025-03-07 14:16   ` Maciej Fijalkowski
2025-03-07 14:16     ` [Intel-wired-lan] " Maciej Fijalkowski
2025-03-17 14:58     ` Alexander Lobakin
2025-03-17 14:58       ` [Intel-wired-lan] " Alexander Lobakin
2025-03-19 16:23       ` Maciej Fijalkowski
2025-03-19 16:23         ` [Intel-wired-lan] " Maciej Fijalkowski
2025-03-05 16:21 ` [PATCH net-next 13/16] idpf: use generic functions to build xdp_buff and skb Alexander Lobakin
2025-03-05 16:21   ` [Intel-wired-lan] " Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 14/16] idpf: add support for XDP on Rx Alexander Lobakin
2025-03-05 16:21   ` [Intel-wired-lan] " Alexander Lobakin
2025-03-11 15:50   ` Maciej Fijalkowski
2025-03-11 15:50     ` [Intel-wired-lan] " Maciej Fijalkowski
2025-04-08 13:28     ` Alexander Lobakin
2025-04-08 13:28       ` [Intel-wired-lan] " Alexander Lobakin
2025-04-08 15:53       ` Maciej Fijalkowski
2025-04-08 15:53         ` [Intel-wired-lan] " Maciej Fijalkowski
2025-03-05 16:21 ` [PATCH net-next 15/16] idpf: add support for .ndo_xdp_xmit() Alexander Lobakin
2025-03-05 16:21   ` [Intel-wired-lan] " Alexander Lobakin
2025-03-11 16:08   ` Maciej Fijalkowski
2025-03-11 16:08     ` [Intel-wired-lan] " Maciej Fijalkowski
2025-04-08 13:31     ` Alexander Lobakin
2025-04-08 13:31       ` [Intel-wired-lan] " Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 16/16] idpf: add XDP RSS hash hint Alexander Lobakin
2025-03-05 16:21   ` [Intel-wired-lan] " Alexander Lobakin
2025-03-11 15:28 ` [PATCH net-next 00/16] idpf: add XDP support Alexander Lobakin
2025-03-11 15:28   ` [Intel-wired-lan] " Alexander Lobakin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z8rLLwZlRACyA49U@boxer \
    --to=maciej.fijalkowski@intel.com \
    --cc=aleksander.lobakin@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=horms@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.kubiak@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.