public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/9] net: convert drivers to .get_rx_ring_count (part 2)
@ 2026-01-15 14:37 Breno Leitao
  2026-01-15 14:37 ` [PATCH net-next 1/9] net: benet: convert to use .get_rx_ring_count Breno Leitao
                   ` (9 more replies)
  0 siblings, 10 replies; 19+ messages in thread
From: Breno Leitao @ 2026-01-15 14:37 UTC (permalink / raw)
  To: Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Felix Fietkau, Sean Wang, Lorenzo Bianconi, Matthias Brugger,
	AngeloGioacchino Del Regno, Shay Agroskin, Arthur Kiyanovski,
	David Arinzon, Saeed Bishara, Bryan Whitehead, UNGLinuxDriver,
	Shyam Sundar S K, Raju Rangoju, Potnuri Bharat Teja,
	Nicolas Ferre, Claudiu Beznea, Jiawen Wu, Mengyuan Lou
  Cc: netdev, linux-kernel, linux-arm-kernel, linux-mediatek,
	Breno Leitao

Commit 84eaf4359c36 ("net: ethtool: add get_rx_ring_count callback to
optimize RX ring queries") added specific support for GRXRINGS callback,
simplifying .get_rxnfc.

Remove the handling of GRXRINGS in .get_rxnfc() by moving it to the new
.get_rx_ring_count().

This simplifies the RX ring count retrieval and aligns the following
drivers with the new ethtool API for querying RX ring parameters.
  * emulex/benet
  * engleder/tsnep
  * mediatek
  * amazon/ena
  * microchip/lan743x
  * amd/xgbe
  * chelsio/cxgb4
  * wangxun/txgbe
  * cadence/macb

Part 1 is already merged in net-next and can be seen in
https://lore.kernel.org/all/20260109-grxring_big_v1-v1-0-a0f77f732006@debian.org/

PS: all of these change were compile-tested only.
---
Breno Leitao (9):
      net: benet: convert to use .get_rx_ring_count
      net: tsnep: convert to use .get_rx_ring_count
      net: mediatek: convert to use .get_rx_ring_count
      net: ena: convert to use .get_rx_ring_count
      net: lan743x: convert to use .get_rx_ring_count
      net: xgbe: convert to use .get_rx_ring_count
      net: cxgb4: convert to use .get_rx_ring_count
      net: macb: convert to use .get_rx_ring_count
      net: txgbe: convert to use .get_rx_ring_count

 drivers/net/ethernet/amazon/ena/ena_ethtool.c      | 22 +++------------
 drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c       | 15 +++--------
 drivers/net/ethernet/cadence/macb_main.c           | 11 +++++---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 11 +++++---
 drivers/net/ethernet/emulex/benet/be_ethtool.c     | 31 ++++++----------------
 drivers/net/ethernet/engleder/tsnep_ethtool.c      | 11 +++++---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c        | 15 ++++++-----
 drivers/net/ethernet/microchip/lan743x_ethtool.c   | 13 +++------
 drivers/net/ethernet/wangxun/txgbe/txgbe_ethtool.c | 12 ++++++---
 9 files changed, 58 insertions(+), 83 deletions(-)
---
base-commit: cc75d43783f74fe0a1c288aba9e6ac55f1444977
change-id: 20260115-grxring_big_v2-eed9a5803431

Best regards,
--  
Breno Leitao <leitao@debian.org>


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

* [PATCH net-next 1/9] net: benet: convert to use .get_rx_ring_count
  2026-01-15 14:37 [PATCH net-next 0/9] net: convert drivers to .get_rx_ring_count (part 2) Breno Leitao
@ 2026-01-15 14:37 ` Breno Leitao
  2026-01-18  2:15   ` Jakub Kicinski
  2026-01-15 14:37 ` [PATCH net-next 2/9] net: tsnep: " Breno Leitao
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Breno Leitao @ 2026-01-15 14:37 UTC (permalink / raw)
  To: Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Felix Fietkau, Sean Wang, Lorenzo Bianconi, Matthias Brugger,
	AngeloGioacchino Del Regno, Shay Agroskin, Arthur Kiyanovski,
	David Arinzon, Saeed Bishara, Bryan Whitehead, UNGLinuxDriver,
	Shyam Sundar S K, Raju Rangoju, Potnuri Bharat Teja,
	Nicolas Ferre, Claudiu Beznea, Jiawen Wu, Mengyuan Lou
  Cc: netdev, linux-kernel, linux-arm-kernel, linux-mediatek,
	Breno Leitao

Use the newly introduced .get_rx_ring_count ethtool ops callback instead
of handling ETHTOOL_GRXRINGS directly in .get_rxnfc().

Since ETHTOOL_GRXRINGS was the only command handled by be_get_rxnfc(),
remove the function entirely.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 drivers/net/ethernet/emulex/benet/be_ethtool.c | 31 +++++++-------------------
 1 file changed, 8 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c
index f9216326bdfe..4717a1dacbe2 100644
--- a/drivers/net/ethernet/emulex/benet/be_ethtool.c
+++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c
@@ -1073,6 +1073,13 @@ static void be_set_msg_level(struct net_device *netdev, u32 level)
 	adapter->msg_enable = level;
 }
 
+static u32 be_get_rx_ring_count(struct net_device *netdev)
+{
+	struct be_adapter *adapter = netdev_priv(netdev);
+
+	return adapter->num_rx_qs;
+}
+
 static int be_get_rxfh_fields(struct net_device *netdev,
 			      struct ethtool_rxfh_fields *cmd)
 {
@@ -1117,28 +1124,6 @@ static int be_get_rxfh_fields(struct net_device *netdev,
 	return 0;
 }
 
-static int be_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
-			u32 *rule_locs)
-{
-	struct be_adapter *adapter = netdev_priv(netdev);
-
-	if (!be_multi_rxq(adapter)) {
-		dev_info(&adapter->pdev->dev,
-			 "ethtool::get_rxnfc: RX flow hashing is disabled\n");
-		return -EINVAL;
-	}
-
-	switch (cmd->cmd) {
-	case ETHTOOL_GRXRINGS:
-		cmd->data = adapter->num_rx_qs;
-		break;
-	default:
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
 static int be_set_rxfh_fields(struct net_device *netdev,
 			      const struct ethtool_rxfh_fields *cmd,
 			      struct netlink_ext_ack *extack)
@@ -1441,7 +1426,7 @@ const struct ethtool_ops be_ethtool_ops = {
 	.get_ethtool_stats = be_get_ethtool_stats,
 	.flash_device = be_do_flash,
 	.self_test = be_self_test,
-	.get_rxnfc = be_get_rxnfc,
+	.get_rx_ring_count = be_get_rx_ring_count,
 	.get_rxfh_fields = be_get_rxfh_fields,
 	.set_rxfh_fields = be_set_rxfh_fields,
 	.get_rxfh_indir_size = be_get_rxfh_indir_size,

-- 
2.47.3


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

* [PATCH net-next 2/9] net: tsnep: convert to use .get_rx_ring_count
  2026-01-15 14:37 [PATCH net-next 0/9] net: convert drivers to .get_rx_ring_count (part 2) Breno Leitao
  2026-01-15 14:37 ` [PATCH net-next 1/9] net: benet: convert to use .get_rx_ring_count Breno Leitao
@ 2026-01-15 14:37 ` Breno Leitao
  2026-01-15 14:37 ` [PATCH net-next 3/9] net: mediatek: " Breno Leitao
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Breno Leitao @ 2026-01-15 14:37 UTC (permalink / raw)
  To: Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Felix Fietkau, Sean Wang, Lorenzo Bianconi, Matthias Brugger,
	AngeloGioacchino Del Regno, Shay Agroskin, Arthur Kiyanovski,
	David Arinzon, Saeed Bishara, Bryan Whitehead, UNGLinuxDriver,
	Shyam Sundar S K, Raju Rangoju, Potnuri Bharat Teja,
	Nicolas Ferre, Claudiu Beznea, Jiawen Wu, Mengyuan Lou
  Cc: netdev, linux-kernel, linux-arm-kernel, linux-mediatek,
	Breno Leitao

Use the newly introduced .get_rx_ring_count ethtool ops callback instead
of handling ETHTOOL_GRXRINGS directly in .get_rxnfc().

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 drivers/net/ethernet/engleder/tsnep_ethtool.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/engleder/tsnep_ethtool.c b/drivers/net/ethernet/engleder/tsnep_ethtool.c
index 228a638eae16..d11168278515 100644
--- a/drivers/net/ethernet/engleder/tsnep_ethtool.c
+++ b/drivers/net/ethernet/engleder/tsnep_ethtool.c
@@ -257,15 +257,19 @@ static int tsnep_ethtool_get_sset_count(struct net_device *netdev, int sset)
 	}
 }
 
+static u32 tsnep_ethtool_get_rx_ring_count(struct net_device *netdev)
+{
+	struct tsnep_adapter *adapter = netdev_priv(netdev);
+
+	return adapter->num_rx_queues;
+}
+
 static int tsnep_ethtool_get_rxnfc(struct net_device *netdev,
 				   struct ethtool_rxnfc *cmd, u32 *rule_locs)
 {
 	struct tsnep_adapter *adapter = netdev_priv(netdev);
 
 	switch (cmd->cmd) {
-	case ETHTOOL_GRXRINGS:
-		cmd->data = adapter->num_rx_queues;
-		return 0;
 	case ETHTOOL_GRXCLSRLCNT:
 		cmd->rule_cnt = adapter->rxnfc_count;
 		cmd->data = adapter->rxnfc_max;
@@ -469,6 +473,7 @@ const struct ethtool_ops tsnep_ethtool_ops = {
 	.get_sset_count = tsnep_ethtool_get_sset_count,
 	.get_rxnfc = tsnep_ethtool_get_rxnfc,
 	.set_rxnfc = tsnep_ethtool_set_rxnfc,
+	.get_rx_ring_count = tsnep_ethtool_get_rx_ring_count,
 	.get_channels = tsnep_ethtool_get_channels,
 	.get_ts_info = tsnep_ethtool_get_ts_info,
 	.get_coalesce = tsnep_ethtool_get_coalesce,

-- 
2.47.3


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

* [PATCH net-next 3/9] net: mediatek: convert to use .get_rx_ring_count
  2026-01-15 14:37 [PATCH net-next 0/9] net: convert drivers to .get_rx_ring_count (part 2) Breno Leitao
  2026-01-15 14:37 ` [PATCH net-next 1/9] net: benet: convert to use .get_rx_ring_count Breno Leitao
  2026-01-15 14:37 ` [PATCH net-next 2/9] net: tsnep: " Breno Leitao
@ 2026-01-15 14:37 ` Breno Leitao
  2026-01-15 14:37 ` [PATCH net-next 4/9] net: ena: " Breno Leitao
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Breno Leitao @ 2026-01-15 14:37 UTC (permalink / raw)
  To: Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Felix Fietkau, Sean Wang, Lorenzo Bianconi, Matthias Brugger,
	AngeloGioacchino Del Regno, Shay Agroskin, Arthur Kiyanovski,
	David Arinzon, Saeed Bishara, Bryan Whitehead, UNGLinuxDriver,
	Shyam Sundar S K, Raju Rangoju, Potnuri Bharat Teja,
	Nicolas Ferre, Claudiu Beznea, Jiawen Wu, Mengyuan Lou
  Cc: netdev, linux-kernel, linux-arm-kernel, linux-mediatek,
	Breno Leitao

Use the newly introduced .get_rx_ring_count ethtool ops callback instead
of handling ETHTOOL_GRXRINGS directly in .get_rxnfc().

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index e68997a29191..99abec2198d0 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -4625,18 +4625,20 @@ static void mtk_get_ethtool_stats(struct net_device *dev,
 	} while (u64_stats_fetch_retry(&hwstats->syncp, start));
 }
 
+static u32 mtk_get_rx_ring_count(struct net_device *dev)
+{
+	if (dev->hw_features & NETIF_F_LRO)
+		return MTK_MAX_RX_RING_NUM;
+
+	return 0;
+}
+
 static int mtk_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
 			 u32 *rule_locs)
 {
 	int ret = -EOPNOTSUPP;
 
 	switch (cmd->cmd) {
-	case ETHTOOL_GRXRINGS:
-		if (dev->hw_features & NETIF_F_LRO) {
-			cmd->data = MTK_MAX_RX_RING_NUM;
-			ret = 0;
-		}
-		break;
 	case ETHTOOL_GRXCLSRLCNT:
 		if (dev->hw_features & NETIF_F_LRO) {
 			struct mtk_mac *mac = netdev_priv(dev);
@@ -4741,6 +4743,7 @@ static const struct ethtool_ops mtk_ethtool_ops = {
 	.set_pauseparam		= mtk_set_pauseparam,
 	.get_rxnfc		= mtk_get_rxnfc,
 	.set_rxnfc		= mtk_set_rxnfc,
+	.get_rx_ring_count	= mtk_get_rx_ring_count,
 	.get_eee		= mtk_get_eee,
 	.set_eee		= mtk_set_eee,
 };

-- 
2.47.3


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

* [PATCH net-next 4/9] net: ena: convert to use .get_rx_ring_count
  2026-01-15 14:37 [PATCH net-next 0/9] net: convert drivers to .get_rx_ring_count (part 2) Breno Leitao
                   ` (2 preceding siblings ...)
  2026-01-15 14:37 ` [PATCH net-next 3/9] net: mediatek: " Breno Leitao
@ 2026-01-15 14:37 ` Breno Leitao
  2026-01-15 17:51   ` Kiyanovski, Arthur
  2026-01-15 14:37 ` [PATCH net-next 5/9] net: lan743x: " Breno Leitao
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Breno Leitao @ 2026-01-15 14:37 UTC (permalink / raw)
  To: Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Felix Fietkau, Sean Wang, Lorenzo Bianconi, Matthias Brugger,
	AngeloGioacchino Del Regno, Shay Agroskin, Arthur Kiyanovski,
	David Arinzon, Saeed Bishara, Bryan Whitehead, UNGLinuxDriver,
	Shyam Sundar S K, Raju Rangoju, Potnuri Bharat Teja,
	Nicolas Ferre, Claudiu Beznea, Jiawen Wu, Mengyuan Lou
  Cc: netdev, linux-kernel, linux-arm-kernel, linux-mediatek,
	Breno Leitao

Use the newly introduced .get_rx_ring_count ethtool ops callback instead
of handling ETHTOOL_GRXRINGS directly in .get_rxnfc().

Since ETHTOOL_GRXRINGS was the only useful command handled by
ena_get_rxnfc(), remove the function entirely.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 drivers/net/ethernet/amazon/ena/ena_ethtool.c | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ethernet/amazon/ena/ena_ethtool.c b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
index fe3479b84a1f..2455d6dddc26 100644
--- a/drivers/net/ethernet/amazon/ena/ena_ethtool.c
+++ b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
@@ -835,27 +835,11 @@ static int ena_set_rxfh_fields(struct net_device *netdev,
 	return ena_com_fill_hash_ctrl(ena_dev, proto, hash_fields);
 }
 
-static int ena_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *info,
-			 u32 *rules)
+static u32 ena_get_rx_ring_count(struct net_device *netdev)
 {
 	struct ena_adapter *adapter = netdev_priv(netdev);
-	int rc = 0;
 
-	switch (info->cmd) {
-	case ETHTOOL_GRXRINGS:
-		info->data = adapter->num_io_queues;
-		rc = 0;
-		break;
-	case ETHTOOL_GRXCLSRLCNT:
-	case ETHTOOL_GRXCLSRULE:
-	case ETHTOOL_GRXCLSRLALL:
-	default:
-		netif_err(adapter, drv, netdev,
-			  "Command parameter %d is not supported\n", info->cmd);
-		rc = -EOPNOTSUPP;
-	}
-
-	return rc;
+	return adapter->num_io_queues;
 }
 
 static u32 ena_get_rxfh_indir_size(struct net_device *netdev)
@@ -1096,7 +1080,7 @@ static const struct ethtool_ops ena_ethtool_ops = {
 	.get_sset_count         = ena_get_sset_count,
 	.get_strings		= ena_get_ethtool_strings,
 	.get_ethtool_stats      = ena_get_ethtool_stats,
-	.get_rxnfc		= ena_get_rxnfc,
+	.get_rx_ring_count	= ena_get_rx_ring_count,
 	.get_rxfh_indir_size    = ena_get_rxfh_indir_size,
 	.get_rxfh_key_size	= ena_get_rxfh_key_size,
 	.get_rxfh		= ena_get_rxfh,

-- 
2.47.3


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

* [PATCH net-next 5/9] net: lan743x: convert to use .get_rx_ring_count
  2026-01-15 14:37 [PATCH net-next 0/9] net: convert drivers to .get_rx_ring_count (part 2) Breno Leitao
                   ` (3 preceding siblings ...)
  2026-01-15 14:37 ` [PATCH net-next 4/9] net: ena: " Breno Leitao
@ 2026-01-15 14:37 ` Breno Leitao
  2026-01-15 14:37 ` [PATCH net-next 6/9] net: xgbe: " Breno Leitao
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Breno Leitao @ 2026-01-15 14:37 UTC (permalink / raw)
  To: Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Felix Fietkau, Sean Wang, Lorenzo Bianconi, Matthias Brugger,
	AngeloGioacchino Del Regno, Shay Agroskin, Arthur Kiyanovski,
	David Arinzon, Saeed Bishara, Bryan Whitehead, UNGLinuxDriver,
	Shyam Sundar S K, Raju Rangoju, Potnuri Bharat Teja,
	Nicolas Ferre, Claudiu Beznea, Jiawen Wu, Mengyuan Lou
  Cc: netdev, linux-kernel, linux-arm-kernel, linux-mediatek,
	Breno Leitao

Use the newly introduced .get_rx_ring_count ethtool ops callback instead
of handling ETHTOOL_GRXRINGS directly in .get_rxnfc().

Since ETHTOOL_GRXRINGS was the only command handled by
lan743x_ethtool_get_rxnfc(), remove the function entirely.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 drivers/net/ethernet/microchip/lan743x_ethtool.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.c b/drivers/net/ethernet/microchip/lan743x_ethtool.c
index 40002d9fe274..8a3c1ecc7866 100644
--- a/drivers/net/ethernet/microchip/lan743x_ethtool.c
+++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c
@@ -931,16 +931,9 @@ static int lan743x_ethtool_get_rxfh_fields(struct net_device *netdev,
 	return 0;
 }
 
-static int lan743x_ethtool_get_rxnfc(struct net_device *netdev,
-				     struct ethtool_rxnfc *rxnfc,
-				     u32 *rule_locs)
+static u32 lan743x_ethtool_get_rx_ring_count(struct net_device *netdev)
 {
-	switch (rxnfc->cmd) {
-	case ETHTOOL_GRXRINGS:
-		rxnfc->data = LAN743X_USED_RX_CHANNELS;
-		return 0;
-	}
-	return -EOPNOTSUPP;
+	return LAN743X_USED_RX_CHANNELS;
 }
 
 static u32 lan743x_ethtool_get_rxfh_key_size(struct net_device *netdev)
@@ -1369,7 +1362,7 @@ const struct ethtool_ops lan743x_ethtool_ops = {
 	.get_priv_flags = lan743x_ethtool_get_priv_flags,
 	.set_priv_flags = lan743x_ethtool_set_priv_flags,
 	.get_sset_count = lan743x_ethtool_get_sset_count,
-	.get_rxnfc = lan743x_ethtool_get_rxnfc,
+	.get_rx_ring_count = lan743x_ethtool_get_rx_ring_count,
 	.get_rxfh_key_size = lan743x_ethtool_get_rxfh_key_size,
 	.get_rxfh_indir_size = lan743x_ethtool_get_rxfh_indir_size,
 	.get_rxfh = lan743x_ethtool_get_rxfh,

-- 
2.47.3


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

* [PATCH net-next 6/9] net: xgbe: convert to use .get_rx_ring_count
  2026-01-15 14:37 [PATCH net-next 0/9] net: convert drivers to .get_rx_ring_count (part 2) Breno Leitao
                   ` (4 preceding siblings ...)
  2026-01-15 14:37 ` [PATCH net-next 5/9] net: lan743x: " Breno Leitao
@ 2026-01-15 14:37 ` Breno Leitao
  2026-01-19 12:10   ` Rangoju, Raju
  2026-01-15 14:37 ` [PATCH net-next 7/9] net: cxgb4: " Breno Leitao
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Breno Leitao @ 2026-01-15 14:37 UTC (permalink / raw)
  To: Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Felix Fietkau, Sean Wang, Lorenzo Bianconi, Matthias Brugger,
	AngeloGioacchino Del Regno, Shay Agroskin, Arthur Kiyanovski,
	David Arinzon, Saeed Bishara, Bryan Whitehead, UNGLinuxDriver,
	Shyam Sundar S K, Raju Rangoju, Potnuri Bharat Teja,
	Nicolas Ferre, Claudiu Beznea, Jiawen Wu, Mengyuan Lou
  Cc: netdev, linux-kernel, linux-arm-kernel, linux-mediatek,
	Breno Leitao

Use the newly introduced .get_rx_ring_count ethtool ops callback instead
of handling ETHTOOL_GRXRINGS directly in .get_rxnfc().

Since ETHTOOL_GRXRINGS was the only command handled by xgbe_get_rxnfc(),
remove the function entirely.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
index 0d19b09497a0..8ebf0de7a01b 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
@@ -414,20 +414,11 @@ static int xgbe_set_coalesce(struct net_device *netdev,
 	return 0;
 }
 
-static int xgbe_get_rxnfc(struct net_device *netdev,
-			  struct ethtool_rxnfc *rxnfc, u32 *rule_locs)
+static u32 xgbe_get_rx_ring_count(struct net_device *netdev)
 {
 	struct xgbe_prv_data *pdata = netdev_priv(netdev);
 
-	switch (rxnfc->cmd) {
-	case ETHTOOL_GRXRINGS:
-		rxnfc->data = pdata->rx_ring_count;
-		break;
-	default:
-		return -EOPNOTSUPP;
-	}
-
-	return 0;
+	return pdata->rx_ring_count;
 }
 
 static u32 xgbe_get_rxfh_key_size(struct net_device *netdev)
@@ -752,7 +743,7 @@ static const struct ethtool_ops xgbe_ethtool_ops = {
 	.get_strings = xgbe_get_strings,
 	.get_ethtool_stats = xgbe_get_ethtool_stats,
 	.get_sset_count = xgbe_get_sset_count,
-	.get_rxnfc = xgbe_get_rxnfc,
+	.get_rx_ring_count = xgbe_get_rx_ring_count,
 	.get_rxfh_key_size = xgbe_get_rxfh_key_size,
 	.get_rxfh_indir_size = xgbe_get_rxfh_indir_size,
 	.get_rxfh = xgbe_get_rxfh,

-- 
2.47.3


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

* [PATCH net-next 7/9] net: cxgb4: convert to use .get_rx_ring_count
  2026-01-15 14:37 [PATCH net-next 0/9] net: convert drivers to .get_rx_ring_count (part 2) Breno Leitao
                   ` (5 preceding siblings ...)
  2026-01-15 14:37 ` [PATCH net-next 6/9] net: xgbe: " Breno Leitao
@ 2026-01-15 14:37 ` Breno Leitao
  2026-01-15 14:37 ` [PATCH net-next 8/9] net: macb: " Breno Leitao
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Breno Leitao @ 2026-01-15 14:37 UTC (permalink / raw)
  To: Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Felix Fietkau, Sean Wang, Lorenzo Bianconi, Matthias Brugger,
	AngeloGioacchino Del Regno, Shay Agroskin, Arthur Kiyanovski,
	David Arinzon, Saeed Bishara, Bryan Whitehead, UNGLinuxDriver,
	Shyam Sundar S K, Raju Rangoju, Potnuri Bharat Teja,
	Nicolas Ferre, Claudiu Beznea, Jiawen Wu, Mengyuan Lou
  Cc: netdev, linux-kernel, linux-arm-kernel, linux-mediatek,
	Breno Leitao

Use the newly introduced .get_rx_ring_count ethtool ops callback instead
of handling ETHTOOL_GRXRINGS directly in .get_rxnfc().

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
index 23326235d4ab..faf8f7e86520 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
@@ -1784,6 +1784,13 @@ static int cxgb4_get_rxfh_fields(struct net_device *dev,
 	return 0;
 }
 
+static u32 get_rx_ring_count(struct net_device *dev)
+{
+	const struct port_info *pi = netdev_priv(dev);
+
+	return pi->nqsets;
+}
+
 static int get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
 		     u32 *rules)
 {
@@ -1793,9 +1800,6 @@ static int get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
 	int ret = 0;
 
 	switch (info->cmd) {
-	case ETHTOOL_GRXRINGS:
-		info->data = pi->nqsets;
-		return 0;
 	case ETHTOOL_GRXCLSRLCNT:
 		info->rule_cnt =
 		       adap->ethtool_filters->port[pi->port_id].in_use;
@@ -2200,6 +2204,7 @@ static const struct ethtool_ops cxgb_ethtool_ops = {
 	.get_regs          = get_regs,
 	.get_rxnfc         = get_rxnfc,
 	.set_rxnfc         = set_rxnfc,
+	.get_rx_ring_count = get_rx_ring_count,
 	.get_rxfh_indir_size = get_rss_table_size,
 	.get_rxfh	   = get_rss_table,
 	.set_rxfh	   = set_rss_table,

-- 
2.47.3


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

* [PATCH net-next 8/9] net: macb: convert to use .get_rx_ring_count
  2026-01-15 14:37 [PATCH net-next 0/9] net: convert drivers to .get_rx_ring_count (part 2) Breno Leitao
                   ` (6 preceding siblings ...)
  2026-01-15 14:37 ` [PATCH net-next 7/9] net: cxgb4: " Breno Leitao
@ 2026-01-15 14:37 ` Breno Leitao
  2026-01-19 13:08   ` Nicolas Ferre
  2026-01-15 14:37 ` [PATCH net-next 9/9] net: txgbe: " Breno Leitao
  2026-01-19 14:19 ` [PATCH net-next 0/9] net: convert drivers to .get_rx_ring_count (part 2) patchwork-bot+netdevbpf
  9 siblings, 1 reply; 19+ messages in thread
From: Breno Leitao @ 2026-01-15 14:37 UTC (permalink / raw)
  To: Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Felix Fietkau, Sean Wang, Lorenzo Bianconi, Matthias Brugger,
	AngeloGioacchino Del Regno, Shay Agroskin, Arthur Kiyanovski,
	David Arinzon, Saeed Bishara, Bryan Whitehead, UNGLinuxDriver,
	Shyam Sundar S K, Raju Rangoju, Potnuri Bharat Teja,
	Nicolas Ferre, Claudiu Beznea, Jiawen Wu, Mengyuan Lou
  Cc: netdev, linux-kernel, linux-arm-kernel, linux-mediatek,
	Breno Leitao

Use the newly introduced .get_rx_ring_count ethtool ops callback instead
of handling ETHTOOL_GRXRINGS directly in .get_rxnfc().

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 drivers/net/ethernet/cadence/macb_main.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 2d5f3eb09530..8135c5c2a51a 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -3850,6 +3850,13 @@ static int gem_get_all_flow_entries(struct net_device *netdev,
 	return 0;
 }
 
+static u32 gem_get_rx_ring_count(struct net_device *netdev)
+{
+	struct macb *bp = netdev_priv(netdev);
+
+	return bp->num_queues;
+}
+
 static int gem_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
 		u32 *rule_locs)
 {
@@ -3857,9 +3864,6 @@ static int gem_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
 	int ret = 0;
 
 	switch (cmd->cmd) {
-	case ETHTOOL_GRXRINGS:
-		cmd->data = bp->num_queues;
-		break;
 	case ETHTOOL_GRXCLSRLCNT:
 		cmd->rule_cnt = bp->rx_fs_list.count;
 		break;
@@ -3941,6 +3945,7 @@ static const struct ethtool_ops gem_ethtool_ops = {
 	.set_ringparam		= macb_set_ringparam,
 	.get_rxnfc			= gem_get_rxnfc,
 	.set_rxnfc			= gem_set_rxnfc,
+	.get_rx_ring_count		= gem_get_rx_ring_count,
 };
 
 static int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)

-- 
2.47.3


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

* [PATCH net-next 9/9] net: txgbe: convert to use .get_rx_ring_count
  2026-01-15 14:37 [PATCH net-next 0/9] net: convert drivers to .get_rx_ring_count (part 2) Breno Leitao
                   ` (7 preceding siblings ...)
  2026-01-15 14:37 ` [PATCH net-next 8/9] net: macb: " Breno Leitao
@ 2026-01-15 14:37 ` Breno Leitao
  2026-01-19 14:19 ` [PATCH net-next 0/9] net: convert drivers to .get_rx_ring_count (part 2) patchwork-bot+netdevbpf
  9 siblings, 0 replies; 19+ messages in thread
From: Breno Leitao @ 2026-01-15 14:37 UTC (permalink / raw)
  To: Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Felix Fietkau, Sean Wang, Lorenzo Bianconi, Matthias Brugger,
	AngeloGioacchino Del Regno, Shay Agroskin, Arthur Kiyanovski,
	David Arinzon, Saeed Bishara, Bryan Whitehead, UNGLinuxDriver,
	Shyam Sundar S K, Raju Rangoju, Potnuri Bharat Teja,
	Nicolas Ferre, Claudiu Beznea, Jiawen Wu, Mengyuan Lou
  Cc: netdev, linux-kernel, linux-arm-kernel, linux-mediatek,
	Breno Leitao

Use the newly introduced .get_rx_ring_count ethtool ops callback instead
of handling ETHTOOL_GRXRINGS directly in .get_rxnfc().

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 drivers/net/ethernet/wangxun/txgbe/txgbe_ethtool.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_ethtool.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_ethtool.c
index f3cb00109529..59d758acccf0 100644
--- a/drivers/net/ethernet/wangxun/txgbe/txgbe_ethtool.c
+++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_ethtool.c
@@ -193,6 +193,13 @@ static int txgbe_get_ethtool_fdir_all(struct txgbe *txgbe,
 	return 0;
 }
 
+static u32 txgbe_get_rx_ring_count(struct net_device *dev)
+{
+	struct wx *wx = netdev_priv(dev);
+
+	return wx->num_rx_queues;
+}
+
 static int txgbe_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
 			   u32 *rule_locs)
 {
@@ -201,10 +208,6 @@ static int txgbe_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
 	int ret = -EOPNOTSUPP;
 
 	switch (cmd->cmd) {
-	case ETHTOOL_GRXRINGS:
-		cmd->data = wx->num_rx_queues;
-		ret = 0;
-		break;
 	case ETHTOOL_GRXCLSRLCNT:
 		cmd->rule_cnt = txgbe->fdir_filter_count;
 		ret = 0;
@@ -587,6 +590,7 @@ static const struct ethtool_ops txgbe_ethtool_ops = {
 	.set_channels		= txgbe_set_channels,
 	.get_rxnfc		= txgbe_get_rxnfc,
 	.set_rxnfc		= txgbe_set_rxnfc,
+	.get_rx_ring_count	= txgbe_get_rx_ring_count,
 	.get_rxfh_fields	= wx_get_rxfh_fields,
 	.set_rxfh_fields	= wx_set_rxfh_fields,
 	.get_rxfh_indir_size	= wx_rss_indir_size,

-- 
2.47.3


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

* RE: [PATCH net-next 4/9] net: ena: convert to use .get_rx_ring_count
  2026-01-15 14:37 ` [PATCH net-next 4/9] net: ena: " Breno Leitao
@ 2026-01-15 17:51   ` Kiyanovski, Arthur
  0 siblings, 0 replies; 19+ messages in thread
From: Kiyanovski, Arthur @ 2026-01-15 17:51 UTC (permalink / raw)
  To: Breno Leitao, Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur,
	Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Felix Fietkau, Sean Wang, Lorenzo Bianconi,
	Matthias Brugger, AngeloGioacchino Del Regno, Allen, Neil,
	Arinzon, David, Bshara, Saeed, Bryan Whitehead,
	UNGLinuxDriver@microchip.com, Shyam Sundar S K, Raju Rangoju,
	Potnuri Bharat Teja, Nicolas Ferre, Claudiu Beznea, Jiawen Wu,
	Mengyuan Lou
  Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org


> -----Original Message-----
> From: Breno Leitao <leitao@debian.org>
> Sent: Thursday, January 15, 2026 6:38 AM
> Subject: [EXTERNAL] [PATCH net-next 4/9] net: ena: convert to use
> .get_rx_ring_count
> 
> Use the newly introduced .get_rx_ring_count ethtool ops callback instead of
> handling ETHTOOL_GRXRINGS directly in .get_rxnfc().
> 
> Since ETHTOOL_GRXRINGS was the only useful command handled by
> ena_get_rxnfc(), remove the function entirely.
> 
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---


Thank you for submitting this patch

Reviewed-by: Arthur Kiyanovski <akiyano@amazon.com>

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

* Re: [PATCH net-next 1/9] net: benet: convert to use .get_rx_ring_count
  2026-01-15 14:37 ` [PATCH net-next 1/9] net: benet: convert to use .get_rx_ring_count Breno Leitao
@ 2026-01-18  2:15   ` Jakub Kicinski
  2026-01-19 11:07     ` Breno Leitao
  0 siblings, 1 reply; 19+ messages in thread
From: Jakub Kicinski @ 2026-01-18  2:15 UTC (permalink / raw)
  To: Breno Leitao
  Cc: Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur, Andrew Lunn,
	David S. Miller, Eric Dumazet, Paolo Abeni, Felix Fietkau,
	Sean Wang, Lorenzo Bianconi, Matthias Brugger,
	AngeloGioacchino Del Regno, Shay Agroskin, Arthur Kiyanovski,
	David Arinzon, Saeed Bishara, Bryan Whitehead, UNGLinuxDriver,
	Shyam Sundar S K, Raju Rangoju, Potnuri Bharat Teja,
	Nicolas Ferre, Claudiu Beznea, Jiawen Wu, Mengyuan Lou, netdev,
	linux-kernel, linux-arm-kernel, linux-mediatek

On Thu, 15 Jan 2026 06:37:48 -0800 Breno Leitao wrote:
> -static int be_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
> -			u32 *rule_locs)
> -{
> -	struct be_adapter *adapter = netdev_priv(netdev);
> -
> -	if (!be_multi_rxq(adapter)) {
> -		dev_info(&adapter->pdev->dev,
> -			 "ethtool::get_rxnfc: RX flow hashing is disabled\n");
> -		return -EINVAL;
> -	}

I think we need to add this check to set_rxfh now. The error coming
from get_rxnfc/GRXRINGS effectively shielded the driver from set_rxfh
calls ever happening when there's only 1 ring. Now they will happen.

Applied the rest

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

* Re: [PATCH net-next 1/9] net: benet: convert to use .get_rx_ring_count
  2026-01-18  2:15   ` Jakub Kicinski
@ 2026-01-19 11:07     ` Breno Leitao
  2026-01-19 12:56       ` Breno Leitao
  0 siblings, 1 reply; 19+ messages in thread
From: Breno Leitao @ 2026-01-19 11:07 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur, Andrew Lunn,
	David S. Miller, Eric Dumazet, Paolo Abeni, Felix Fietkau,
	Sean Wang, Lorenzo Bianconi, Matthias Brugger,
	AngeloGioacchino Del Regno, Shay Agroskin, Arthur Kiyanovski,
	David Arinzon, Saeed Bishara, Bryan Whitehead, UNGLinuxDriver,
	Shyam Sundar S K, Raju Rangoju, Potnuri Bharat Teja,
	Nicolas Ferre, Claudiu Beznea, Jiawen Wu, Mengyuan Lou, netdev,
	linux-kernel, linux-arm-kernel, linux-mediatek

Hello Jakub,

On Sat, Jan 17, 2026 at 06:15:51PM -0800, Jakub Kicinski wrote:
> On Thu, 15 Jan 2026 06:37:48 -0800 Breno Leitao wrote:
> > -static int be_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
> > -			u32 *rule_locs)
> > -{
> > -	struct be_adapter *adapter = netdev_priv(netdev);
> > -
> > -	if (!be_multi_rxq(adapter)) {
> > -		dev_info(&adapter->pdev->dev,
> > -			 "ethtool::get_rxnfc: RX flow hashing is disabled\n");
> > -		return -EINVAL;
> > -	}
> 
> I think we need to add this check to set_rxfh now. The error coming
> from get_rxnfc/GRXRINGS effectively shielded the driver from set_rxfh
> calls ever happening when there's only 1 ring. Now they will happen.

You are absolutely correct. The ethtool core calls
get_rxnfc(ETHTOOL_GRXRINGS) _before_ allowing RSS configuration via
set_rxfh, and if it fails, ethtool_set_rxfh() will fail as well. And
with the current change, ethtool_set_rxfh() will not fail if the adapter
is not multi-queue.

Thanks for the heads-up. I will send a v2 shortly.
--breno

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

* Re: [PATCH net-next 6/9] net: xgbe: convert to use .get_rx_ring_count
  2026-01-15 14:37 ` [PATCH net-next 6/9] net: xgbe: " Breno Leitao
@ 2026-01-19 12:10   ` Rangoju, Raju
  0 siblings, 0 replies; 19+ messages in thread
From: Rangoju, Raju @ 2026-01-19 12:10 UTC (permalink / raw)
  To: Breno Leitao, Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur,
	Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Felix Fietkau, Sean Wang, Lorenzo Bianconi,
	Matthias Brugger, AngeloGioacchino Del Regno, Shay Agroskin,
	Arthur Kiyanovski, David Arinzon, Saeed Bishara, Bryan Whitehead,
	UNGLinuxDriver, Shyam Sundar S K, Potnuri Bharat Teja,
	Nicolas Ferre, Claudiu Beznea, Jiawen Wu, Mengyuan Lou
  Cc: netdev, linux-kernel, linux-arm-kernel, linux-mediatek



On 1/15/2026 8:07 PM, Breno Leitao wrote:
> Use the newly introduced .get_rx_ring_count ethtool ops callback instead
> of handling ETHTOOL_GRXRINGS directly in .get_rxnfc().
> 
> Since ETHTOOL_GRXRINGS was the only command handled by xgbe_get_rxnfc(),
> remove the function entirely.
> 
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---

Reviewed-by: Raju Rangoju <Raju.Rangoju@amd.com>



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

* Re: [PATCH net-next 1/9] net: benet: convert to use .get_rx_ring_count
  2026-01-19 11:07     ` Breno Leitao
@ 2026-01-19 12:56       ` Breno Leitao
  2026-01-19 17:45         ` Jakub Kicinski
  0 siblings, 1 reply; 19+ messages in thread
From: Breno Leitao @ 2026-01-19 12:56 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur, Andrew Lunn,
	David S. Miller, Eric Dumazet, Paolo Abeni, Felix Fietkau,
	Sean Wang, Lorenzo Bianconi, Matthias Brugger,
	AngeloGioacchino Del Regno, Shay Agroskin, Arthur Kiyanovski,
	David Arinzon, Saeed Bishara, Bryan Whitehead, UNGLinuxDriver,
	Shyam Sundar S K, Raju Rangoju, Potnuri Bharat Teja,
	Nicolas Ferre, Claudiu Beznea, Jiawen Wu, Mengyuan Lou, netdev,
	linux-kernel, linux-arm-kernel, linux-mediatek

On Mon, Jan 19, 2026 at 03:07:12AM -0800, Breno Leitao wrote:
> Hello Jakub,
> 
> On Sat, Jan 17, 2026 at 06:15:51PM -0800, Jakub Kicinski wrote:
> > On Thu, 15 Jan 2026 06:37:48 -0800 Breno Leitao wrote:
> > > -static int be_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
> > > -			u32 *rule_locs)
> > > -{
> > > -	struct be_adapter *adapter = netdev_priv(netdev);
> > > -
> > > -	if (!be_multi_rxq(adapter)) {
> > > -		dev_info(&adapter->pdev->dev,
> > > -			 "ethtool::get_rxnfc: RX flow hashing is disabled\n");
> > > -		return -EINVAL;
> > > -	}
> > 
> > I think we need to add this check to set_rxfh now. The error coming
> > from get_rxnfc/GRXRINGS effectively shielded the driver from set_rxfh
> > calls ever happening when there's only 1 ring. Now they will happen.
> 
> You are absolutely correct. The ethtool core calls
> get_rxnfc(ETHTOOL_GRXRINGS) _before_ allowing RSS configuration via
> set_rxfh, and if it fails, ethtool_set_rxfh() will fail as well. And
> with the current change, ethtool_set_rxfh() will not fail if the adapter
> is not multi-queue.

Upon further consideration, should we implement this limitation directly within
the ethtool infrastructure?

Something as:

Author: Breno Leitao <leitao@debian.org>
Date:   Mon Jan 19 03:25:05 2026 -0800

   ethtool: reject RSS configuration on single-queue devices

    Configuring RSS (Receive Side Scaling) makes no sense when the device
    only has a single RX queue - there is nothing to distribute traffic
    across. The indirection table would just map everything to queue 0.

    Add explicit checks in ethtool_set_rxfh_indir() and ethtool_set_rxfh()
    to reject RSS configuration when the device reports fewer than 2 RX rings.

    This protects all drivers uniformly at the core level.

    Signed-off-by: Breno Leitao <leitao@debian.org>


diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
index 9431e305b233..899864e96aab 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -1380,6 +1380,10 @@ static noinline_for_stack int ethtool_set_rxfh_indir(struct net_device *dev,
                ret = num_rx_rings;
                goto out;
        }
+       if (num_rx_rings < 2) {
+               ret = -EOPNOTSUPP;
+               goto out;
+       }

        if (user_size == 0) {
                u32 *indir = rxfh_dev.indir;
@@ -1599,6 +1603,10 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,
                ret = num_rx_rings;
                goto out_free;
        }
+       if (num_rx_rings < 2) {
+               ret = -EOPNOTSUPP;
+               goto out_free;
+       }


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

* Re: [PATCH net-next 8/9] net: macb: convert to use .get_rx_ring_count
  2026-01-15 14:37 ` [PATCH net-next 8/9] net: macb: " Breno Leitao
@ 2026-01-19 13:08   ` Nicolas Ferre
  0 siblings, 0 replies; 19+ messages in thread
From: Nicolas Ferre @ 2026-01-19 13:08 UTC (permalink / raw)
  To: Breno Leitao, Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur,
	Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Felix Fietkau, Sean Wang, Lorenzo Bianconi,
	Matthias Brugger, AngeloGioacchino Del Regno, Shay Agroskin,
	Arthur Kiyanovski, David Arinzon, Saeed Bishara, Bryan Whitehead,
	UNGLinuxDriver, Shyam Sundar S K, Raju Rangoju,
	Potnuri Bharat Teja, Claudiu Beznea, Jiawen Wu, Mengyuan Lou
  Cc: netdev, linux-kernel, linux-arm-kernel, linux-mediatek

On 15/01/2026 at 15:37, Breno Leitao wrote:
> Use the newly introduced .get_rx_ring_count ethtool ops callback instead
> of handling ETHTOOL_GRXRINGS directly in .get_rxnfc().
> 
> Signed-off-by: Breno Leitao <leitao@debian.org>

Looks good to me:
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

Thanks, best regards,
   Nicolas

> ---
>   drivers/net/ethernet/cadence/macb_main.c | 11 ++++++++---
>   1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index 2d5f3eb09530..8135c5c2a51a 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -3850,6 +3850,13 @@ static int gem_get_all_flow_entries(struct net_device *netdev,
>          return 0;
>   }
> 
> +static u32 gem_get_rx_ring_count(struct net_device *netdev)
> +{
> +       struct macb *bp = netdev_priv(netdev);
> +
> +       return bp->num_queues;
> +}
> +
>   static int gem_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
>                  u32 *rule_locs)
>   {
> @@ -3857,9 +3864,6 @@ static int gem_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
>          int ret = 0;
> 
>          switch (cmd->cmd) {
> -       case ETHTOOL_GRXRINGS:
> -               cmd->data = bp->num_queues;
> -               break;
>          case ETHTOOL_GRXCLSRLCNT:
>                  cmd->rule_cnt = bp->rx_fs_list.count;
>                  break;
> @@ -3941,6 +3945,7 @@ static const struct ethtool_ops gem_ethtool_ops = {
>          .set_ringparam          = macb_set_ringparam,
>          .get_rxnfc                      = gem_get_rxnfc,
>          .set_rxnfc                      = gem_set_rxnfc,
> +       .get_rx_ring_count              = gem_get_rx_ring_count,
>   };
> 
>   static int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
> 
> --
> 2.47.3
> 


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

* Re: [PATCH net-next 0/9] net: convert drivers to .get_rx_ring_count (part 2)
  2026-01-15 14:37 [PATCH net-next 0/9] net: convert drivers to .get_rx_ring_count (part 2) Breno Leitao
                   ` (8 preceding siblings ...)
  2026-01-15 14:37 ` [PATCH net-next 9/9] net: txgbe: " Breno Leitao
@ 2026-01-19 14:19 ` patchwork-bot+netdevbpf
  9 siblings, 0 replies; 19+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-19 14:19 UTC (permalink / raw)
  To: Breno Leitao
  Cc: ajit.khaparde, sriharsha.basavapatna, somnath.kotur,
	andrew+netdev, davem, edumazet, kuba, pabeni, nbd, sean.wang,
	lorenzo, matthias.bgg, angelogioacchino.delregno, shayagr,
	akiyano, darinzon, saeedb, bryan.whitehead, UNGLinuxDriver,
	Shyam-sundar.S-k, Raju.Rangoju, bharat, nicolas.ferre,
	claudiu.beznea, jiawenwu, mengyuanlou, netdev, linux-kernel,
	linux-arm-kernel, linux-mediatek

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 15 Jan 2026 06:37:47 -0800 you wrote:
> Commit 84eaf4359c36 ("net: ethtool: add get_rx_ring_count callback to
> optimize RX ring queries") added specific support for GRXRINGS callback,
> simplifying .get_rxnfc.
> 
> Remove the handling of GRXRINGS in .get_rxnfc() by moving it to the new
> .get_rx_ring_count().
> 
> [...]

Here is the summary with links:
  - [net-next,1/9] net: benet: convert to use .get_rx_ring_count
    (no matching commit)
  - [net-next,2/9] net: tsnep: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/efa375c44090
  - [net-next,3/9] net: mediatek: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/e33bd8dd7f1f
  - [net-next,4/9] net: ena: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/289f714a084c
  - [net-next,5/9] net: lan743x: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/05ba3044865d
  - [net-next,6/9] net: xgbe: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/507353bf84fc
  - [net-next,7/9] net: cxgb4: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/ceec168d03db
  - [net-next,8/9] net: macb: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/d1c7ed5dfa35
  - [net-next,9/9] net: txgbe: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/c4279332f479

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH net-next 1/9] net: benet: convert to use .get_rx_ring_count
  2026-01-19 12:56       ` Breno Leitao
@ 2026-01-19 17:45         ` Jakub Kicinski
  0 siblings, 0 replies; 19+ messages in thread
From: Jakub Kicinski @ 2026-01-19 17:45 UTC (permalink / raw)
  To: Breno Leitao
  Cc: Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur, Andrew Lunn,
	David S. Miller, Eric Dumazet, Paolo Abeni, Felix Fietkau,
	Sean Wang, Lorenzo Bianconi, Matthias Brugger,
	AngeloGioacchino Del Regno, Shay Agroskin, Arthur Kiyanovski,
	David Arinzon, Saeed Bishara, Bryan Whitehead, UNGLinuxDriver,
	Shyam Sundar S K, Raju Rangoju, Potnuri Bharat Teja,
	Nicolas Ferre, Claudiu Beznea, Jiawen Wu, Mengyuan Lou, netdev,
	linux-kernel, linux-arm-kernel, linux-mediatek

On Mon, 19 Jan 2026 04:56:49 -0800 Breno Leitao wrote:
> > > I think we need to add this check to set_rxfh now. The error coming
> > > from get_rxnfc/GRXRINGS effectively shielded the driver from set_rxfh
> > > calls ever happening when there's only 1 ring. Now they will happen.  
> > 
> > You are absolutely correct. The ethtool core calls
> > get_rxnfc(ETHTOOL_GRXRINGS) _before_ allowing RSS configuration via
> > set_rxfh, and if it fails, ethtool_set_rxfh() will fail as well. And
> > with the current change, ethtool_set_rxfh() will not fail if the adapter
> > is not multi-queue.  
> 
> Upon further consideration, should we implement this limitation directly within
> the ethtool infrastructure?

That may cause some regressions, we're getting the number of currently
configured Rx rings. If we were to check how many Rx rings the device
has that'd make sense. But since we can only access currently
configured rings, in theory, if the device has multiple rings,
just only one is active now - changing config for the RSS key or
function should work just fine. IOW

 # change key
 # increase ring count to make they key meaningful

Used to work.

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

* [PATCH net-next 1/9] net: benet: convert to use .get_rx_ring_count
  2026-01-21 15:54 [PATCH net-next 0/9] net: convert drivers to .get_rx_ring_count (last part) Breno Leitao
@ 2026-01-21 15:54 ` Breno Leitao
  0 siblings, 0 replies; 19+ messages in thread
From: Breno Leitao @ 2026-01-21 15:54 UTC (permalink / raw)
  To: Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Igor Russkikh, Simon Horman, K. Y. Srinivasan, Haiyang Zhang,
	Wei Liu, Dexuan Cui, Long Li, Alexander Duyck, kernel-team,
	Edward Cree, Brett Creeley
  Cc: netdev, linux-kernel, oss-drivers, linux-hyperv,
	linux-net-drivers, Breno Leitao

Use the newly introduced .get_rx_ring_count ethtool ops callback instead
of handling ETHTOOL_GRXRINGS directly in .get_rxnfc().

Since ETHTOOL_GRXRINGS was the only command handled by be_get_rxnfc(),
remove the function entirely.

Since the be_multi_rxq() check in be_get_rxnfc() previously blocked RSS
configuration on single-queue setups (via ethtool core validation), add
an equivalent check to be_set_rxfh() to preserve this behavior, as
suggested by Jakub.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 drivers/net/ethernet/emulex/benet/be_ethtool.c | 37 ++++++++++----------------
 1 file changed, 14 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c
index f55f1fd5d90fd..87dbbd5b7f4e6 100644
--- a/drivers/net/ethernet/emulex/benet/be_ethtool.c
+++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c
@@ -1073,6 +1073,13 @@ static void be_set_msg_level(struct net_device *netdev, u32 level)
 	adapter->msg_enable = level;
 }
 
+static u32 be_get_rx_ring_count(struct net_device *netdev)
+{
+	struct be_adapter *adapter = netdev_priv(netdev);
+
+	return adapter->num_rx_qs;
+}
+
 static int be_get_rxfh_fields(struct net_device *netdev,
 			      struct ethtool_rxfh_fields *cmd)
 {
@@ -1117,28 +1124,6 @@ static int be_get_rxfh_fields(struct net_device *netdev,
 	return 0;
 }
 
-static int be_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
-			u32 *rule_locs)
-{
-	struct be_adapter *adapter = netdev_priv(netdev);
-
-	if (!be_multi_rxq(adapter)) {
-		dev_info(&adapter->pdev->dev,
-			 "ethtool::get_rxnfc: RX flow hashing is disabled\n");
-		return -EINVAL;
-	}
-
-	switch (cmd->cmd) {
-	case ETHTOOL_GRXRINGS:
-		cmd->data = adapter->num_rx_qs;
-		break;
-	default:
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
 static int be_set_rxfh_fields(struct net_device *netdev,
 			      const struct ethtool_rxfh_fields *cmd,
 			      struct netlink_ext_ack *extack)
@@ -1293,6 +1278,12 @@ static int be_set_rxfh(struct net_device *netdev,
 	u8 *hkey = rxfh->key;
 	u8 rsstable[RSS_INDIR_TABLE_LEN];
 
+	if (!be_multi_rxq(adapter)) {
+		dev_info(&adapter->pdev->dev,
+			 "ethtool::set_rxfh: RX flow hashing is disabled\n");
+		return -EINVAL;
+	}
+
 	/* We do not allow change in unsupported parameters */
 	if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
 	    rxfh->hfunc != ETH_RSS_HASH_TOP)
@@ -1441,7 +1432,7 @@ const struct ethtool_ops be_ethtool_ops = {
 	.get_ethtool_stats = be_get_ethtool_stats,
 	.flash_device = be_do_flash,
 	.self_test = be_self_test,
-	.get_rxnfc = be_get_rxnfc,
+	.get_rx_ring_count = be_get_rx_ring_count,
 	.get_rxfh_fields = be_get_rxfh_fields,
 	.set_rxfh_fields = be_set_rxfh_fields,
 	.get_rxfh_indir_size = be_get_rxfh_indir_size,

-- 
2.47.3


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

end of thread, other threads:[~2026-01-21 15:56 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-15 14:37 [PATCH net-next 0/9] net: convert drivers to .get_rx_ring_count (part 2) Breno Leitao
2026-01-15 14:37 ` [PATCH net-next 1/9] net: benet: convert to use .get_rx_ring_count Breno Leitao
2026-01-18  2:15   ` Jakub Kicinski
2026-01-19 11:07     ` Breno Leitao
2026-01-19 12:56       ` Breno Leitao
2026-01-19 17:45         ` Jakub Kicinski
2026-01-15 14:37 ` [PATCH net-next 2/9] net: tsnep: " Breno Leitao
2026-01-15 14:37 ` [PATCH net-next 3/9] net: mediatek: " Breno Leitao
2026-01-15 14:37 ` [PATCH net-next 4/9] net: ena: " Breno Leitao
2026-01-15 17:51   ` Kiyanovski, Arthur
2026-01-15 14:37 ` [PATCH net-next 5/9] net: lan743x: " Breno Leitao
2026-01-15 14:37 ` [PATCH net-next 6/9] net: xgbe: " Breno Leitao
2026-01-19 12:10   ` Rangoju, Raju
2026-01-15 14:37 ` [PATCH net-next 7/9] net: cxgb4: " Breno Leitao
2026-01-15 14:37 ` [PATCH net-next 8/9] net: macb: " Breno Leitao
2026-01-19 13:08   ` Nicolas Ferre
2026-01-15 14:37 ` [PATCH net-next 9/9] net: txgbe: " Breno Leitao
2026-01-19 14:19 ` [PATCH net-next 0/9] net: convert drivers to .get_rx_ring_count (part 2) patchwork-bot+netdevbpf
  -- strict thread matches above, loose matches on Subject: below --
2026-01-21 15:54 [PATCH net-next 0/9] net: convert drivers to .get_rx_ring_count (last part) Breno Leitao
2026-01-21 15:54 ` [PATCH net-next 1/9] net: benet: convert to use .get_rx_ring_count Breno Leitao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox