Skip to contentSkip to conversation

net: convert drivers to .get_rx_ring_count (part 2)

PATCH In review Breno Leitao 6 participants 18 messages Jan 15 – Jan 19

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

cover net: convert drivers to .get_rx_ring_count (part 2)

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/[email protected]/

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,

Signature · 1 line
Breno Leitao <[email protected]>
#1 lore raw

PATCH 1/9 net: benet: 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 command handled by be_get_rxnfc(), remove the function entirely.

---
 drivers/net/ethernet/emulex/benet/be_ethtool.c | 31 +++++++-------------------
 1 file changed, 8 insertions(+), 23 deletions(-)
drivers/net/ethernet/emulex/benet/be_ethtool.c +8 -23
index f9216326bdfe..4717a1dacbe2 100644
@@ -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,
Signature · 1 line
2.47.3
maintainer
#2 lore raw

Re: [PATCH net-next 1/9] net: benet: convert to use .get_rx_ring_count

drivers/net/ethernet/emulex/benet/be_ethtool.c static int be_get_rxfh_fields(struct net_device *netdev, · line 1129

Quoted 10 lines · On Thu, 15 Jan 2026 06:37:48 -0800 Breno Leitao wrote:
drivers/net/ethernet/emulex/benet/be_ethtool.c +0 -10
-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

#3 lore raw

Re: [PATCH net-next 1/9] net: benet: convert to use .get_rx_ring_count

Hello Jakub,

Quoted 15 lines · Jakub Kicinski

drivers/net/ethernet/emulex/benet/be_ethtool.c static int be_get_rxfh_fields(struct net_device *netdev, · line 1129

Quoted 10 lines · On Thu, 15 Jan 2026 06:37:48 -0800 Breno Leitao wrote:
drivers/net/ethernet/emulex/benet/be_ethtool.c +0 -10
-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

#4 lore raw

Re: [PATCH net-next 1/9] net: benet: convert to use .get_rx_ring_count

Quoted 19 lines · Breno Leitao

Hello Jakub,

Quoted 15 lines · Jakub Kicinski

Review

Quoted 10 lines · On Thu, 15 Jan 2026 06:37:48 -0800 Breno Leitao wrote:
(quoted diff) +0 -10
-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.

Quoted 5 lines

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 <[email protected]>
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.

net/ethtool/ioctl.c +8 -0
index 9431e305b233..899864e96aab 100644
@@ -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;
+       }
 
maintainer
#5 lore raw

Re: [PATCH net-next 1/9] net: benet: convert to use .get_rx_ring_count

Quoted 4 lines · On Mon, 19 Jan 2026 04:56:49 -0800 Breno Leitao wrote:
Quoted 4 lines
Quoted 3 lines

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.

Quoted 8 lines
Quoted 5 lines

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.

#6 lore raw

PATCH 2/9 net: tsnep: convert to use .get_rx_ring_count

In reply to Breno Leitao

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

---
 drivers/net/ethernet/engleder/tsnep_ethtool.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/ethernet/engleder/tsnep_ethtool.c +8 -3
index 228a638eae16..d11168278515 100644
@@ -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,
Signature · 1 line
2.47.3
#7 lore raw

PATCH 3/9 net: mediatek: convert to use .get_rx_ring_count

In reply to Breno Leitao

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

---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +9 -6
index e68997a29191..99abec2198d0 100644
@@ -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,
 };
Signature · 1 line
2.47.3
#8 lore raw

PATCH 4/9 net: ena: convert to use .get_rx_ring_count

In reply to 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.

---
 drivers/net/ethernet/amazon/ena/ena_ethtool.c | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)
drivers/net/ethernet/amazon/ena/ena_ethtool.c +3 -19
index fe3479b84a1f..2455d6dddc26 100644
@@ -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,
Signature · 1 line
2.47.3
maintainer Reviewed-by on v1 4/9
#9 lore raw

RE: [PATCH net-next 4/9] net: ena: convert to use .get_rx_ring_count

Quoted 7 lines

-----Original Message-----
From: Breno Leitao <[email protected]>
Sent: Thursday, January 15, 2026 6:38 AM
Subject: [EXTERNAL] [PATCH net-next 4/9] net: ena: convert to use .get_rx_ring_count

Quoted 8 lines

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.

---

Thank you for submitting this patch

#10 lore raw

PATCH 5/9 net: lan743x: convert to use .get_rx_ring_count

In reply to 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.

---
 drivers/net/ethernet/microchip/lan743x_ethtool.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/net/ethernet/microchip/lan743x_ethtool.c +3 -10
index 40002d9fe274..8a3c1ecc7866 100644
@@ -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,
Signature · 1 line
2.47.3
#11 lore raw

PATCH 6/9 net: xgbe: convert to use .get_rx_ring_count

In reply to 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.

---
 drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +3 -12
index 0d19b09497a0..8ebf0de7a01b 100644
@@ -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,
Signature · 1 line
2.47.3
maintainer Reviewed-by on v1 6/9
#12 lore raw

Re: [PATCH net-next 6/9] net: xgbe: convert to use .get_rx_ring_count

Quoted 8 lines · 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.

---

#13 lore raw

PATCH 7/9 net: cxgb4: convert to use .get_rx_ring_count

In reply to Breno Leitao

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

---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +8 -3
index 23326235d4ab..faf8f7e86520 100644
@@ -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,
Signature · 1 line
2.47.3
#14 lore raw

PATCH 8/9 net: macb: convert to use .get_rx_ring_count

In reply to Breno Leitao

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

---
 drivers/net/ethernet/cadence/macb_main.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/ethernet/cadence/macb_main.c +8 -3
index 2d5f3eb09530..8135c5c2a51a 100644
@@ -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)
Signature · 1 line
2.47.3
Acked-by on v1 8/9
#15 lore raw

Re: [PATCH net-next 8/9] net: macb: convert to use .get_rx_ring_count

Quoted 4 lines · Breno Leitao

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

Looks good to me:

Thanks, best regards,
Nicolas

Quoted 44 lines
---
  drivers/net/ethernet/cadence/macb_main.c | 11 ++++++++---
  1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/ethernet/cadence/macb_main.c +8 -4
index 2d5f3eb09530..8135c5c2a51a 100644
@@ -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

#16 lore raw

PATCH 9/9 net: txgbe: convert to use .get_rx_ring_count

In reply to Breno Leitao

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

---
 drivers/net/ethernet/wangxun/txgbe/txgbe_ethtool.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/wangxun/txgbe/txgbe_ethtool.c +8 -4
index f3cb00109529..59d758acccf0 100644
@@ -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,
Signature · 1 line
2.47.3
#17 lore raw
In reply to Breno Leitao
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · 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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html