Skip to contentSkip to conversation

ice: use netif_get_num_default_rss_queues()

PATCH In review Michal Swiatkowski 4 participants 7 messages Oct 30, 2025 – Dec 11, 2025

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

PATCH v3 1/1 ice: use netif_get_num_default_rss_queues()

On some high-core systems (like AMD EPYC Bergamo, Intel Clearwater Forest) loading ice driver with default values can lead to queue/irq exhaustion. It will result in no additional resources for SR-IOV.

In most cases there is no performance reason for more than half num_cpus(). Limit the default value to it using generic netif_get_num_default_rss_queues().

Still, using ethtool the number of queues can be changed up to num_online_cpus(). It can be done by calling:
$ethtool -L ethX combined $(nproc)

This change affects only the default queue amount.

---
v2 --> v3:
* use $(nproc) in command example in commit message

v1 --> v2:
* Follow Olek's comment and switch from custom limiting to the generic netif_...() function.
* Add more info in commit message (Paul)
* Dropping RB tags, as it is different patch now

---
 drivers/net/ethernet/intel/ice/ice_irq.c |  5 +++--
 drivers/net/ethernet/intel/ice/ice_lib.c | 12 ++++++++----
 2 files changed, 11 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ice/ice_irq.c +3 -2
index 30801fd375f0..1d9b2d646474 100644
@@ -106,9 +106,10 @@ static struct ice_irq_entry *ice_get_irq_res(struct ice_pf *pf,
 #define ICE_RDMA_AEQ_MSIX 1
 static int ice_get_default_msix_amount(struct ice_pf *pf)
 {
-	return ICE_MIN_LAN_OICR_MSIX + num_online_cpus() +
+	return ICE_MIN_LAN_OICR_MSIX + netif_get_num_default_rss_queues() +
 	       (test_bit(ICE_FLAG_FD_ENA, pf->flags) ? ICE_FDIR_MSIX : 0) +
-	       (ice_is_rdma_ena(pf) ? num_online_cpus() + ICE_RDMA_AEQ_MSIX : 0);
+	       (ice_is_rdma_ena(pf) ? netif_get_num_default_rss_queues() +
+				      ICE_RDMA_AEQ_MSIX : 0);
 }
 
 /**
drivers/net/ethernet/intel/ice/ice_lib.c +8 -4
index bac481e8140d..e366d089bef9 100644
@@ -159,12 +159,14 @@ static void ice_vsi_set_num_desc(struct ice_vsi *vsi)
 
 static u16 ice_get_rxq_count(struct ice_pf *pf)
 {
-	return min(ice_get_avail_rxq_count(pf), num_online_cpus());
+	return min(ice_get_avail_rxq_count(pf),
+		   netif_get_num_default_rss_queues());
 }
 
 static u16 ice_get_txq_count(struct ice_pf *pf)
 {
-	return min(ice_get_avail_txq_count(pf), num_online_cpus());
+	return min(ice_get_avail_txq_count(pf),
+		   netif_get_num_default_rss_queues());
 }
 
 /**
@@ -907,13 +909,15 @@ static void ice_vsi_set_rss_params(struct ice_vsi *vsi)
 		if (vsi->type == ICE_VSI_CHNL)
 			vsi->rss_size = min_t(u16, vsi->num_rxq, max_rss_size);
 		else
-			vsi->rss_size = min_t(u16, num_online_cpus(),
+			vsi->rss_size = min_t(u16,
+					      netif_get_num_default_rss_queues(),
 					      max_rss_size);
 		vsi->rss_lut_type = ICE_LUT_PF;
 		break;
 	case ICE_VSI_SF:
 		vsi->rss_table_size = ICE_LUT_VSI_SIZE;
-		vsi->rss_size = min_t(u16, num_online_cpus(), max_rss_size);
+		vsi->rss_size = min_t(u16, netif_get_num_default_rss_queues(),
+				      max_rss_size);
 		vsi->rss_lut_type = ICE_LUT_VSI;
 		break;
 	case ICE_VSI_VF:
Signature · 1 line
2.49.0
#1 lore raw

Dear Michal,

Thank you for your patch. For the summary, I’d add:

ice: Use netif_get_num_default_rss_queues() to decrease queue number

Am 30.10.25 um 09:30 schrieb Michal Swiatkowski:

Quoted 3 lines

On some high-core systems (like AMD EPYC Bergamo, Intel Clearwater Forest) loading ice driver with default values can lead to queue/irq exhaustion. It will result in no additional resources for SR-IOV.

Could you please elaborate how to make the queue/irq exhaustion visible?

Quoted 9 lines

In most cases there is no performance reason for more than half num_cpus(). Limit the default value to it using generic netif_get_num_default_rss_queues().

Still, using ethtool the number of queues can be changed up to num_online_cpus(). It can be done by calling:
$ethtool -L ethX combined $(nproc)

This change affects only the default queue amount.

How would you judge the regression potential, that means for people where the defaults work good enough, and the queue number is reduced now?

Kind regards,

Paul

Quoted 72 lines

---
v2 --> v3:
* use $(nproc) in command example in commit message

v1 --> v2:
* Follow Olek's comment and switch from custom limiting to the generic

    netif_...() function.
  * Add more info in commit message (Paul)
  * Dropping RB tags, as it is different patch now
---
  drivers/net/ethernet/intel/ice/ice_irq.c |  5 +++--
  drivers/net/ethernet/intel/ice/ice_lib.c | 12 ++++++++----
  2 files changed, 11 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ice/ice_irq.c +3 -2
index 30801fd375f0..1d9b2d646474 100644
@@ -106,9 +106,10 @@ static struct ice_irq_entry *ice_get_irq_res(struct ice_pf *pf,
  #define ICE_RDMA_AEQ_MSIX 1
  static int ice_get_default_msix_amount(struct ice_pf *pf)
  {
-	return ICE_MIN_LAN_OICR_MSIX + num_online_cpus() +
+	return ICE_MIN_LAN_OICR_MSIX + netif_get_num_default_rss_queues() +
  	       (test_bit(ICE_FLAG_FD_ENA, pf->flags) ? ICE_FDIR_MSIX : 0) +
-	       (ice_is_rdma_ena(pf) ? num_online_cpus() + ICE_RDMA_AEQ_MSIX : 0);
+	       (ice_is_rdma_ena(pf) ? netif_get_num_default_rss_queues() +
+				      ICE_RDMA_AEQ_MSIX : 0);
  }
 
  /**
drivers/net/ethernet/intel/ice/ice_lib.c +8 -4
index bac481e8140d..e366d089bef9 100644
@@ -159,12 +159,14 @@ static void ice_vsi_set_num_desc(struct ice_vsi *vsi)
 
  static u16 ice_get_rxq_count(struct ice_pf *pf)
  {
-	return min(ice_get_avail_rxq_count(pf), num_online_cpus());
+	return min(ice_get_avail_rxq_count(pf),
+		   netif_get_num_default_rss_queues());
  }
 
  static u16 ice_get_txq_count(struct ice_pf *pf)
  {
-	return min(ice_get_avail_txq_count(pf), num_online_cpus());
+	return min(ice_get_avail_txq_count(pf),
+		   netif_get_num_default_rss_queues());
  }
 
  /**
@@ -907,13 +909,15 @@ static void ice_vsi_set_rss_params(struct ice_vsi *vsi)
  		if (vsi->type == ICE_VSI_CHNL)
  			vsi->rss_size = min_t(u16, vsi->num_rxq, max_rss_size);
  		else
-			vsi->rss_size = min_t(u16, num_online_cpus(),
+			vsi->rss_size = min_t(u16,
+					      netif_get_num_default_rss_queues(),
  					      max_rss_size);
  		vsi->rss_lut_type = ICE_LUT_PF;
  		break;
  	case ICE_VSI_SF:
  		vsi->rss_table_size = ICE_LUT_VSI_SIZE;
-		vsi->rss_size = min_t(u16, num_online_cpus(), max_rss_size);
+		vsi->rss_size = min_t(u16, netif_get_num_default_rss_queues(),
+				      max_rss_size);
  		vsi->rss_lut_type = ICE_LUT_VSI;
  		break;
  	case ICE_VSI_VF:
#2 lore raw
Quoted 5 lines · Paul Menzel

Dear Michal,

Thank you for your patch. For the summary, I’d add:

Quoted 9 lines

ice: Use netif_get_num_default_rss_queues() to decrease queue number

Am 30.10.25 um 09:30 schrieb Michal Swiatkowski:

Quoted 3 lines

On some high-core systems (like AMD EPYC Bergamo, Intel Clearwater Forest) loading ice driver with default values can lead to queue/irq exhaustion. It will result in no additional resources for SR-IOV.

Could you please elaborate how to make the queue/irq exhaustion visible?

What do you mean? On high core system, lets say num_online_cpus() returns 288, on 8 ports card we have online 256 irqs per eqch PF (2k in total). Driver will load with the 256 queues (and irqs) on each PF. Any VFs creation command will fail due to no free irqs available. (echo X > /sys/class/net/ethX/device/sriov_numvfs)

Quoted 4 lines
Quoted 4 lines

In most cases there is no performance reason for more than half num_cpus(). Limit the default value to it using generic netif_get_num_default_rss_queues().

Quoted 9 lines
Quoted 5 lines

Still, using ethtool the number of queues can be changed up to num_online_cpus(). It can be done by calling:
$ethtool -L ethX combined $(nproc)

This change affects only the default queue amount.

How would you judge the regression potential, that means for people where the defaults work good enough, and the queue number is reduced now?

You can take a look into commit that introduce /2 change in netif_get_num_default_rss_queues() [1]. There is a good justification for such situation. In short, heaving physical core number is just a wasting of CPU resources.

[1] https://lore.kernel.org/netdev/[email protected]/

Quoted 75 lines

Kind regards,

Paul

Quoted 68 lines

---
v2 --> v3:
* use $(nproc) in command example in commit message

v1 --> v2:
* Follow Olek's comment and switch from custom limiting to the generic

    netif_...() function.
  * Add more info in commit message (Paul)
  * Dropping RB tags, as it is different patch now
---
  drivers/net/ethernet/intel/ice/ice_irq.c |  5 +++--
  drivers/net/ethernet/intel/ice/ice_lib.c | 12 ++++++++----
  2 files changed, 11 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ice/ice_irq.c +3 -2
index 30801fd375f0..1d9b2d646474 100644
@@ -106,9 +106,10 @@ static struct ice_irq_entry *ice_get_irq_res(struct ice_pf *pf,
  #define ICE_RDMA_AEQ_MSIX 1
  static int ice_get_default_msix_amount(struct ice_pf *pf)
  {
-	return ICE_MIN_LAN_OICR_MSIX + num_online_cpus() +
+	return ICE_MIN_LAN_OICR_MSIX + netif_get_num_default_rss_queues() +
  	       (test_bit(ICE_FLAG_FD_ENA, pf->flags) ? ICE_FDIR_MSIX : 0) +
-	       (ice_is_rdma_ena(pf) ? num_online_cpus() + ICE_RDMA_AEQ_MSIX : 0);
+	       (ice_is_rdma_ena(pf) ? netif_get_num_default_rss_queues() +
+				      ICE_RDMA_AEQ_MSIX : 0);
  }
  /**
drivers/net/ethernet/intel/ice/ice_lib.c +8 -4
index bac481e8140d..e366d089bef9 100644
@@ -159,12 +159,14 @@ static void ice_vsi_set_num_desc(struct ice_vsi *vsi)
  static u16 ice_get_rxq_count(struct ice_pf *pf)
  {
-	return min(ice_get_avail_rxq_count(pf), num_online_cpus());
+	return min(ice_get_avail_rxq_count(pf),
+		   netif_get_num_default_rss_queues());
  }
  static u16 ice_get_txq_count(struct ice_pf *pf)
  {
-	return min(ice_get_avail_txq_count(pf), num_online_cpus());
+	return min(ice_get_avail_txq_count(pf),
+		   netif_get_num_default_rss_queues());
  }
  /**
@@ -907,13 +909,15 @@ static void ice_vsi_set_rss_params(struct ice_vsi *vsi)
  		if (vsi->type == ICE_VSI_CHNL)
  			vsi->rss_size = min_t(u16, vsi->num_rxq, max_rss_size);
  		else
-			vsi->rss_size = min_t(u16, num_online_cpus(),
+			vsi->rss_size = min_t(u16,
+					      netif_get_num_default_rss_queues(),
  					      max_rss_size);
  		vsi->rss_lut_type = ICE_LUT_PF;
  		break;
  	case ICE_VSI_SF:
  		vsi->rss_table_size = ICE_LUT_VSI_SIZE;
-		vsi->rss_size = min_t(u16, num_online_cpus(), max_rss_size);
+		vsi->rss_size = min_t(u16, netif_get_num_default_rss_queues(),
+				      max_rss_size);
  		vsi->rss_lut_type = ICE_LUT_VSI;
  		break;
  	case ICE_VSI_VF:
maintainer
#3 lore raw
Quoted 7 lines · Michal Swiatkowski
Quoted 6 lines · Paul Menzel

Dear Michal,

Thank you for your patch. For the summary, I’d add:

ice: Use netif_get_num_default_rss_queues() to decrease queue number

I would instead just say:
ice: cap the default number of queues to 64

as this is exactly what happens. Then next paragraph could be:
Use netif_get_num_default_rss_queues() as a better base (instead of the number of CPU cores), but still cap it to 64 to avoid excess IRQs assigned to PF (what would leave, in some cases, nothing for VFs).

sorry for such late nitpicks
and, see below too

Quoted 6 lines
Quoted 6 lines

Am 30.10.25 um 09:30 schrieb Michal Swiatkowski:

Quoted 3 lines

On some high-core systems (like AMD EPYC Bergamo, Intel Clearwater Forest) loading ice driver with default values can lead to queue/irq exhaustion. It will result in no additional resources for SR-IOV.

Quoted 7 lines
Quoted 2 lines

Could you please elaborate how to make the queue/irq exhaustion visible?

What do you mean? On high core system, lets say num_online_cpus() returns 288, on 8 ports card we have online 256 irqs per eqch PF (2k in total). Driver will load with the 256 queues (and irqs) on each PF. Any VFs creation command will fail due to no free irqs available.

this clearly means this is a -net material,
even if this commit will be rather unpleasant for backports to stable

Quoted 23 lines

(echo X > /sys/class/net/ethX/device/sriov_numvfs)

Quoted 4 lines
Quoted 4 lines

In most cases there is no performance reason for more than half num_cpus(). Limit the default value to it using generic netif_get_num_default_rss_queues().

Quoted 9 lines
Quoted 5 lines

Still, using ethtool the number of queues can be changed up to num_online_cpus(). It can be done by calling:
$ethtool -L ethX combined $(nproc)

This change affects only the default queue amount.

How would you judge the regression potential, that means for people where the defaults work good enough, and the queue number is reduced now?

You can take a look into commit that introduce /2 change in netif_get_num_default_rss_queues() [1]. There is a good justification for such situation. In short, heaving physical core number is just a wasting of CPU resources.

[1] https://lore.kernel.org/netdev/[email protected]/

[...]

#4 lore raw
Quoted 12 lines · Przemek Kitszel
Quoted 7 lines · Michal Swiatkowski
Quoted 6 lines · Paul Menzel

Dear Michal,

Thank you for your patch. For the summary, I’d add:

ice: Use netif_get_num_default_rss_queues() to decrease queue number

I would instead just say:
ice: cap the default number of queues to 64

Quoted 7 lines

as this is exactly what happens. Then next paragraph could be:
Use netif_get_num_default_rss_queues() as a better base (instead of the number of CPU cores), but still cap it to 64 to avoid excess IRQs assigned to PF (what would leave, in some cases, nothing for VFs).

sorry for such late nitpicks
and, see below too

I moved away from capping to 64, now it is just call to netif_get_num_default_rss_queues(). Following Olek's comment, dividing by 2 is just fine now and looks like there is no good reasone to cap it more in the driver, but let's discuss it here if you have different opinion.

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

Am 30.10.25 um 09:30 schrieb Michal Swiatkowski:

Quoted 3 lines

On some high-core systems (like AMD EPYC Bergamo, Intel Clearwater Forest) loading ice driver with default values can lead to queue/irq exhaustion. It will result in no additional resources for SR-IOV.

Could you please elaborate how to make the queue/irq exhaustion visible?

Quoted 8 lines
Quoted 4 lines

What do you mean? On high core system, lets say num_online_cpus() returns 288, on 8 ports card we have online 256 irqs per eqch PF (2k in total). Driver will load with the 256 queues (and irqs) on each PF. Any VFs creation command will fail due to no free irqs available.

this clearly means this is a -net material,
even if this commit will be rather unpleasant for backports to stable

In my opinion it isn't. It is just about default values. Still in the described case user can call ethtool -L and lower the queues to create VFs without a problem.

Quoted 24 lines
Quoted 23 lines

(echo X > /sys/class/net/ethX/device/sriov_numvfs)

Quoted 4 lines
Quoted 4 lines

In most cases there is no performance reason for more than half num_cpus(). Limit the default value to it using generic netif_get_num_default_rss_queues().

Quoted 9 lines
Quoted 5 lines

Still, using ethtool the number of queues can be changed up to num_online_cpus(). It can be done by calling:
$ethtool -L ethX combined $(nproc)

This change affects only the default queue amount.

How would you judge the regression potential, that means for people where the defaults work good enough, and the queue number is reduced now?

You can take a look into commit that introduce /2 change in netif_get_num_default_rss_queues() [1]. There is a good justification for such situation. In short, heaving physical core number is just a wasting of CPU resources.

[1] https://lore.kernel.org/netdev/[email protected]/

[...]

maintainer Reviewed-by
#5 lore raw
Quoted 18 lines · Michal Swiatkowski
Quoted 17 lines · Przemek Kitszel
Quoted 7 lines · Michal Swiatkowski
Quoted 6 lines · Paul Menzel

Dear Michal,

Thank you for your patch. For the summary, I’d add:

ice: Use netif_get_num_default_rss_queues() to decrease queue number

I would instead just say:
ice: cap the default number of queues to 64

as this is exactly what happens. Then next paragraph could be:
Use netif_get_num_default_rss_queues() as a better base (instead of the number of CPU cores), but still cap it to 64 to avoid excess IRQs assigned to PF (what would leave, in some cases, nothing for VFs).

Quoted 8 lines
Quoted 2 lines

sorry for such late nitpicks
and, see below too

I moved away from capping to 64, now it is just call to netif_get_num_default_rss_queues(). Following Olek's comment, dividing by 2 is just fine now and looks like there is no good reasone to cap it more in the driver, but let's discuss it here if you have different opinion.

I see, sorry for the confusion
with that I'm fine with the change being -next material, and commit message is good (not sure if perfect, but it does not need to be)

Quoted 48 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

Am 30.10.25 um 09:30 schrieb Michal Swiatkowski:

Quoted 3 lines

On some high-core systems (like AMD EPYC Bergamo, Intel Clearwater Forest) loading ice driver with default values can lead to queue/irq exhaustion. It will result in no additional resources for SR-IOV.

Could you please elaborate how to make the queue/irq exhaustion visible?

Quoted 8 lines
Quoted 4 lines

What do you mean? On high core system, lets say num_online_cpus() returns 288, on 8 ports card we have online 256 irqs per eqch PF (2k in total). Driver will load with the 256 queues (and irqs) on each PF. Any VFs creation command will fail due to no free irqs available.

this clearly means this is a -net material,
even if this commit will be rather unpleasant for backports to stable

In my opinion it isn't. It is just about default values. Still in the described case user can call ethtool -L and lower the queues to create VFs without a problem.

Quoted 24 lines
Quoted 23 lines

(echo X > /sys/class/net/ethX/device/sriov_numvfs)

Quoted 4 lines
Quoted 4 lines

In most cases there is no performance reason for more than half num_cpus(). Limit the default value to it using generic netif_get_num_default_rss_queues().

Quoted 9 lines
Quoted 5 lines

Still, using ethtool the number of queues can be changed up to num_online_cpus(). It can be done by calling:
$ethtool -L ethX combined $(nproc)

This change affects only the default queue amount.

How would you judge the regression potential, that means for people where the defaults work good enough, and the queue number is reduced now?

You can take a look into commit that introduce /2 change in netif_get_num_default_rss_queues() [1]. There is a good justification for such situation. In short, heaving physical core number is just a wasting of CPU resources.

[1] https://lore.kernel.org/netdev/[email protected]/

[...]

#6 lore raw
Quoted 41 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Przemek Kitszel
Sent: Wednesday, November 5, 2025 11:14
To: Michal Swiatkowski <[email protected]>
Cc: Paul Menzel <[email protected]>; [email protected]; [email protected]; Lobakin, Aleksander <[email protected]>; Keller, Jacob E <[email protected]>; Loktionov, Aleksandr <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH iwl-next v3] ice: use netif_get_num_default_rss_queues()

Quoted 19 lines · Michal Swiatkowski
Quoted 18 lines · Przemek Kitszel
Quoted 8 lines · Michal Swiatkowski
Quoted 7 lines · Paul Menzel

Dear Michal,

Thank you for your patch. For the summary, I’d add:

ice: Use netif_get_num_default_rss_queues() to decrease queue number

I would instead just say:
ice: cap the default number of queues to 64

as this is exactly what happens. Then next paragraph could be:
Use netif_get_num_default_rss_queues() as a better base (instead of the number of CPU cores), but still cap it to 64 to avoid excess IRQs assigned to PF (what would leave, in some cases, nothing for VFs).

Quoted 8 lines
Quoted 2 lines

sorry for such late nitpicks
and, see below too

I moved away from capping to 64, now it is just call to netif_get_num_default_rss_queues(). Following Olek's comment, dividing by 2 is just fine now and looks like there is no good reasone to cap it more in the driver, but let's discuss it here if you have different opinion.

Quoted 8 lines

I see, sorry for the confusion
with that I'm fine with the change being -next material, and commit message is good (not sure if perfect, but it does not need to be)

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines