Skip to contentSkip to conversation

net: convert drivers to .get_rx_ring_count (last part)

PATCH Applied Breno Leitao 3 participants 12 messages Jan 22 – Jan 23

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

v2 cover net: convert drivers to .get_rx_ring_count (last part)

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.

* sfc
* ionic
* sfc/siena
* sfc/ef100
* fbnic
* mana
* nfp
* atlantic
* benet (this is v2 in fact, where v1 had some discussions that required a v2). See link [0]

This is covering the last drivers, and as soon as this lands, I will change the ethtool framework to avoid calling .get_rx_ring_count for ETHTOOL_GRXRINGS, simplifying the ethtool core framework.

Part 1 is already merged in net-next and can be seen in
https://lore.kernel.org/all/[email protected]/

Part 2 is already merged in net-next except benet driver, which is now included in here
https://lore.kernel.org/all/[email protected]/

PS: all of these change were compile-tested only.

---
Changes in v2:
- Respect reverse xmas tree in Atlantic driver (Brett Creeley)
- Link to v1: https://patch.msgid.link/[email protected]

---
Breno Leitao (9):
net: benet: convert to use .get_rx_ring_count
net: atlantic: convert to use .get_rx_ring_count
net: nfp: convert to use .get_rx_ring_count
net: mana: convert to use .get_rx_ring_count
net: fbnic: convert to use .get_rx_ring_count
net: ionic: convert to use .get_rx_ring_count
net: sfc: efx: convert to use .get_rx_ring_count
net: sfc: siena: convert to use .get_rx_ring_count
net: sfc: falcon: convert to use .get_rx_ring_count

 .../net/ethernet/aquantia/atlantic/aq_ethtool.c    | 18 +++++++----
 drivers/net/ethernet/emulex/benet/be_ethtool.c     | 37 ++++++++--------------
 drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c    | 12 ++++---
 drivers/net/ethernet/microsoft/mana/mana_ethtool.c | 13 ++------
 .../net/ethernet/netronome/nfp/nfp_net_ethtool.c   | 11 +++++--
 .../net/ethernet/pensando/ionic/ionic_ethtool.c    | 18 ++---------
 drivers/net/ethernet/sfc/ef100_ethtool.c           |  1 +
 drivers/net/ethernet/sfc/ethtool.c                 |  1 +
 drivers/net/ethernet/sfc/ethtool_common.c          | 11 ++++---
 drivers/net/ethernet/sfc/ethtool_common.h          |  1 +
 drivers/net/ethernet/sfc/falcon/ethtool.c          | 12 ++++---
 drivers/net/ethernet/sfc/siena/ethtool.c           |  1 +
 drivers/net/ethernet/sfc/siena/ethtool_common.c    | 11 ++++---
 drivers/net/ethernet/sfc/siena/ethtool_common.h    |  1 +
 14 files changed, 75 insertions(+), 73 deletions(-)

---
base-commit: d8f87aa5fa0a4276491fa8ef436cd22605a3f9ba
change-id: 20260121-grxring_big_v4-55037f9e001e

Best regards,

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

PATCH v2 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.

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.

---
 drivers/net/ethernet/emulex/benet/be_ethtool.c | 37 ++++++++++----------------
 1 file changed, 14 insertions(+), 23 deletions(-)
drivers/net/ethernet/emulex/benet/be_ethtool.c +14 -23
index f55f1fd5d90fd..87dbbd5b7f4e6 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)
@@ -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,
Signature · 1 line
2.47.3
#2 lore raw

PATCH v2 2/9 net: atlantic: 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/aquantia/atlantic/aq_ethtool.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +12 -6
index 6fef47ba0a59b..a6e1826dd5d7e 100644
@@ -500,20 +500,25 @@ static int aq_ethtool_set_rss(struct net_device *netdev,
 	return err;
 }
 
+static u32 aq_ethtool_get_rx_ring_count(struct net_device *ndev)
+{
+	struct aq_nic_cfg_s *cfg;
+	struct aq_nic_s *aq_nic;
+
+	aq_nic = netdev_priv(ndev);
+	cfg = aq_nic_get_cfg(aq_nic);
+
+	return cfg->vecs;
+}
+
 static int aq_ethtool_get_rxnfc(struct net_device *ndev,
 				struct ethtool_rxnfc *cmd,
 				u32 *rule_locs)
 {
 	struct aq_nic_s *aq_nic = netdev_priv(ndev);
-	struct aq_nic_cfg_s *cfg;
 	int err = 0;
 
-	cfg = aq_nic_get_cfg(aq_nic);
-
 	switch (cmd->cmd) {
-	case ETHTOOL_GRXRINGS:
-		cmd->data = cfg->vecs;
-		break;
 	case ETHTOOL_GRXCLSRLCNT:
 		cmd->rule_cnt = aq_get_rxnfc_count_all_rules(aq_nic);
 		break;
@@ -1072,6 +1077,7 @@ const struct ethtool_ops aq_ethtool_ops = {
 	.set_rxfh            = aq_ethtool_set_rss,
 	.get_rxnfc           = aq_ethtool_get_rxnfc,
 	.set_rxnfc           = aq_ethtool_set_rxnfc,
+	.get_rx_ring_count   = aq_ethtool_get_rx_ring_count,
 	.get_msglevel        = aq_get_msg_level,
 	.set_msglevel        = aq_set_msg_level,
 	.get_sset_count      = aq_ethtool_get_sset_count,
Signature · 1 line
2.47.3
#3 lore raw

PATCH v2 3/9 net: nfp: 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/netronome/nfp/nfp_net_ethtool.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c +8 -3
index 16c828dd5c1a3..e88b1c4732a57 100644
@@ -1435,15 +1435,19 @@ static int nfp_net_get_fs_loc(struct nfp_net *nn, u32 *rule_locs)
 	return 0;
 }
 
+static u32 nfp_net_get_rx_ring_count(struct net_device *netdev)
+{
+	struct nfp_net *nn = netdev_priv(netdev);
+
+	return nn->dp.num_rx_rings;
+}
+
 static int nfp_net_get_rxnfc(struct net_device *netdev,
 			     struct ethtool_rxnfc *cmd, u32 *rule_locs)
 {
 	struct nfp_net *nn = netdev_priv(netdev);
 
 	switch (cmd->cmd) {
-	case ETHTOOL_GRXRINGS:
-		cmd->data = nn->dp.num_rx_rings;
-		return 0;
 	case ETHTOOL_GRXCLSRLCNT:
 		cmd->rule_cnt = nn->fs.count;
 		return 0;
@@ -2501,6 +2505,7 @@ static const struct ethtool_ops nfp_net_ethtool_ops = {
 	.get_sset_count		= nfp_net_get_sset_count,
 	.get_rxnfc		= nfp_net_get_rxnfc,
 	.set_rxnfc		= nfp_net_set_rxnfc,
+	.get_rx_ring_count	= nfp_net_get_rx_ring_count,
 	.get_rxfh_indir_size	= nfp_net_get_rxfh_indir_size,
 	.get_rxfh_key_size	= nfp_net_get_rxfh_key_size,
 	.get_rxfh		= nfp_net_get_rxfh,
Signature · 1 line
2.47.3
#4 lore raw

PATCH v2 4/9 net: mana: 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 mana_get_rxnfc(), remove the function entirely.

---
 drivers/net/ethernet/microsoft/mana/mana_ethtool.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/net/ethernet/microsoft/mana/mana_ethtool.c +3 -10
index 0e2f4343ac67f..f2d220b371b5d 100644
@@ -282,18 +282,11 @@ static void mana_get_ethtool_stats(struct net_device *ndev,
 	}
 }
 
-static int mana_get_rxnfc(struct net_device *ndev, struct ethtool_rxnfc *cmd,
-			  u32 *rules)
+static u32 mana_get_rx_ring_count(struct net_device *ndev)
 {
 	struct mana_port_context *apc = netdev_priv(ndev);
 
-	switch (cmd->cmd) {
-	case ETHTOOL_GRXRINGS:
-		cmd->data = apc->num_queues;
-		return 0;
-	}
-
-	return -EOPNOTSUPP;
+	return apc->num_queues;
 }
 
 static u32 mana_get_rxfh_key_size(struct net_device *ndev)
@@ -520,7 +513,7 @@ const struct ethtool_ops mana_ethtool_ops = {
 	.get_ethtool_stats	= mana_get_ethtool_stats,
 	.get_sset_count		= mana_get_sset_count,
 	.get_strings		= mana_get_strings,
-	.get_rxnfc		= mana_get_rxnfc,
+	.get_rx_ring_count	= mana_get_rx_ring_count,
 	.get_rxfh_key_size	= mana_get_rxfh_key_size,
 	.get_rxfh_indir_size	= mana_rss_indir_size,
 	.get_rxfh		= mana_get_rxfh,
Signature · 1 line
2.47.3
#5 lore raw

PATCH v2 5/9 net: fbnic: 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/meta/fbnic/fbnic_ethtool.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c +8 -4
index 61b8005a0db5f..11745a2d8a443 100644
@@ -825,6 +825,13 @@ static int fbnic_get_cls_rule(struct fbnic_net *fbn, struct ethtool_rxnfc *cmd)
 	return 0;
 }
 
+static u32 fbnic_get_rx_ring_count(struct net_device *netdev)
+{
+	struct fbnic_net *fbn = netdev_priv(netdev);
+
+	return fbn->num_rx_queues;
+}
+
 static int fbnic_get_rxnfc(struct net_device *netdev,
 			   struct ethtool_rxnfc *cmd, u32 *rule_locs)
 {
@@ -833,10 +840,6 @@ static int fbnic_get_rxnfc(struct net_device *netdev,
 	u32 special = 0;
 
 	switch (cmd->cmd) {
-	case ETHTOOL_GRXRINGS:
-		cmd->data = fbn->num_rx_queues;
-		ret = 0;
-		break;
 	case ETHTOOL_GRXCLSRULE:
 		ret = fbnic_get_cls_rule(fbn, cmd);
 		break;
@@ -1895,6 +1898,7 @@ static const struct ethtool_ops fbnic_ethtool_ops = {
 	.get_sset_count			= fbnic_get_sset_count,
 	.get_rxnfc			= fbnic_get_rxnfc,
 	.set_rxnfc			= fbnic_set_rxnfc,
+	.get_rx_ring_count		= fbnic_get_rx_ring_count,
 	.get_rxfh_key_size		= fbnic_get_rxfh_key_size,
 	.get_rxfh_indir_size		= fbnic_get_rxfh_indir_size,
 	.get_rxfh			= fbnic_get_rxfh,
Signature · 1 line
2.47.3
#6 lore raw

PATCH v2 6/9 net: ionic: 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 ionic_get_rxnfc(), remove the function entirely.

---
 drivers/net/ethernet/pensando/ionic/ionic_ethtool.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_ethtool.c +3 -15
index 2d9efadb5d2ae..b0a459eeaa640 100644
@@ -843,23 +843,11 @@ static int ionic_set_channels(struct net_device *netdev,
 	return err;
 }
 
-static int ionic_get_rxnfc(struct net_device *netdev,
-			   struct ethtool_rxnfc *info, u32 *rules)
+static u32 ionic_get_rx_ring_count(struct net_device *netdev)
 {
 	struct ionic_lif *lif = netdev_priv(netdev);
-	int err = 0;
-
-	switch (info->cmd) {
-	case ETHTOOL_GRXRINGS:
-		info->data = lif->nxqs;
-		break;
-	default:
-		netdev_dbg(netdev, "Command parameter %d is not supported\n",
-			   info->cmd);
-		err = -EOPNOTSUPP;
-	}
 
-	return err;
+	return lif->nxqs;
 }
 
 static u32 ionic_get_rxfh_indir_size(struct net_device *netdev)
@@ -1152,7 +1140,7 @@ static const struct ethtool_ops ionic_ethtool_ops = {
 	.get_strings		= ionic_get_strings,
 	.get_ethtool_stats	= ionic_get_stats,
 	.get_sset_count		= ionic_get_sset_count,
-	.get_rxnfc		= ionic_get_rxnfc,
+	.get_rx_ring_count	= ionic_get_rx_ring_count,
 	.get_rxfh_indir_size	= ionic_get_rxfh_indir_size,
 	.get_rxfh_key_size	= ionic_get_rxfh_key_size,
 	.get_rxfh		= ionic_get_rxfh,
Signature · 1 line
2.47.3
#7 lore raw

PATCH v2 7/9 net: sfc: efx: 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/sfc/ef100_ethtool.c  |  1 +
 drivers/net/ethernet/sfc/ethtool.c        |  1 +
 drivers/net/ethernet/sfc/ethtool_common.c | 11 +++++++----
 drivers/net/ethernet/sfc/ethtool_common.h |  1 +
 4 files changed, 10 insertions(+), 4 deletions(-)
drivers/net/ethernet/sfc/ef100_ethtool.c +1 -0
index 6c3b74000d3b6..05dc7b10c8855 100644
@@ -54,6 +54,7 @@ const struct ethtool_ops ef100_ethtool_ops = {
 	.get_ethtool_stats	= efx_ethtool_get_stats,
 	.get_rxnfc              = efx_ethtool_get_rxnfc,
 	.set_rxnfc              = efx_ethtool_set_rxnfc,
+	.get_rx_ring_count	= efx_ethtool_get_rx_ring_count,
 	.reset                  = efx_ethtool_reset,
 
 	.get_rxfh_indir_size	= efx_ethtool_get_rxfh_indir_size,
drivers/net/ethernet/sfc/ethtool.c +1 -0
index 18fe5850a9786..362388754a292 100644
@@ -261,6 +261,7 @@ const struct ethtool_ops efx_ethtool_ops = {
 	.reset			= efx_ethtool_reset,
 	.get_rxnfc		= efx_ethtool_get_rxnfc,
 	.set_rxnfc		= efx_ethtool_set_rxnfc,
+	.get_rx_ring_count	= efx_ethtool_get_rx_ring_count,
 	.get_rxfh_indir_size	= efx_ethtool_get_rxfh_indir_size,
 	.get_rxfh_key_size	= efx_ethtool_get_rxfh_key_size,
 	.rxfh_per_ctx_fields	= true,
drivers/net/ethernet/sfc/ethtool_common.c +7 -4
index fa303e171d98b..2fc42b1a2bfb7 100644
@@ -850,6 +850,13 @@ int efx_ethtool_get_rxfh_fields(struct net_device *net_dev,
 	return rc;
 }
 
+u32 efx_ethtool_get_rx_ring_count(struct net_device *net_dev)
+{
+	struct efx_nic *efx = efx_netdev_priv(net_dev);
+
+	return efx->n_rx_channels;
+}
+
 int efx_ethtool_get_rxnfc(struct net_device *net_dev,
 			  struct ethtool_rxnfc *info, u32 *rule_locs)
 {
@@ -858,10 +865,6 @@ int efx_ethtool_get_rxnfc(struct net_device *net_dev,
 	s32 rc = 0;
 
 	switch (info->cmd) {
-	case ETHTOOL_GRXRINGS:
-		info->data = efx->n_rx_channels;
-		return 0;
-
 	case ETHTOOL_GRXCLSRLCNT:
 		info->data = efx_filter_get_rx_id_limit(efx);
 		if (info->data == 0)
drivers/net/ethernet/sfc/ethtool_common.h +1 -0
index 24db4fccbe78a..f96db42534546 100644
@@ -40,6 +40,7 @@ int efx_ethtool_set_fecparam(struct net_device *net_dev,
 			     struct ethtool_fecparam *fecparam);
 int efx_ethtool_get_rxnfc(struct net_device *net_dev,
 			  struct ethtool_rxnfc *info, u32 *rule_locs);
+u32 efx_ethtool_get_rx_ring_count(struct net_device *net_dev);
 int efx_ethtool_set_rxnfc(struct net_device *net_dev,
 			  struct ethtool_rxnfc *info);
 u32 efx_ethtool_get_rxfh_indir_size(struct net_device *net_dev);
Signature · 1 line
2.47.3
#8 lore raw

PATCH v2 8/9 net: sfc: siena: 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/sfc/siena/ethtool.c        |  1 +
 drivers/net/ethernet/sfc/siena/ethtool_common.c | 11 +++++++----
 drivers/net/ethernet/sfc/siena/ethtool_common.h |  1 +
 3 files changed, 9 insertions(+), 4 deletions(-)
drivers/net/ethernet/sfc/siena/ethtool.c +1 -0
index 8c3ebd0617fb1..36feedffe4444 100644
@@ -261,6 +261,7 @@ const struct ethtool_ops efx_siena_ethtool_ops = {
 	.reset			= efx_siena_ethtool_reset,
 	.get_rxnfc		= efx_siena_ethtool_get_rxnfc,
 	.set_rxnfc		= efx_siena_ethtool_set_rxnfc,
+	.get_rx_ring_count	= efx_siena_ethtool_get_rx_ring_count,
 	.get_rxfh_indir_size	= efx_siena_ethtool_get_rxfh_indir_size,
 	.get_rxfh_key_size	= efx_siena_ethtool_get_rxfh_key_size,
 	.get_rxfh		= efx_siena_ethtool_get_rxfh,
drivers/net/ethernet/sfc/siena/ethtool_common.c +7 -4
index 47cd16a113cf1..c56e0b54d8541 100644
@@ -841,6 +841,13 @@ int efx_siena_ethtool_get_rxfh_fields(struct net_device *net_dev,
 	return 0;
 }
 
+u32 efx_siena_ethtool_get_rx_ring_count(struct net_device *net_dev)
+{
+	struct efx_nic *efx = netdev_priv(net_dev);
+
+	return efx->n_rx_channels;
+}
+
 int efx_siena_ethtool_get_rxnfc(struct net_device *net_dev,
 				struct ethtool_rxnfc *info, u32 *rule_locs)
 {
@@ -849,10 +856,6 @@ int efx_siena_ethtool_get_rxnfc(struct net_device *net_dev,
 	s32 rc = 0;
 
 	switch (info->cmd) {
-	case ETHTOOL_GRXRINGS:
-		info->data = efx->n_rx_channels;
-		return 0;
-
 	case ETHTOOL_GRXCLSRLCNT:
 		info->data = efx_filter_get_rx_id_limit(efx);
 		if (info->data == 0)
drivers/net/ethernet/sfc/siena/ethtool_common.h +1 -0
index 278d69e920d9f..7b445b0ba38aa 100644
@@ -37,6 +37,7 @@ int efx_siena_ethtool_set_fecparam(struct net_device *net_dev,
 				   struct ethtool_fecparam *fecparam);
 int efx_siena_ethtool_get_rxnfc(struct net_device *net_dev,
 				struct ethtool_rxnfc *info, u32 *rule_locs);
+u32 efx_siena_ethtool_get_rx_ring_count(struct net_device *net_dev);
 int efx_siena_ethtool_set_rxnfc(struct net_device *net_dev,
 				struct ethtool_rxnfc *info);
 u32 efx_siena_ethtool_get_rxfh_indir_size(struct net_device *net_dev);
Signature · 1 line
2.47.3
#9 lore raw

PATCH v2 9/9 net: sfc: falcon: 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/sfc/falcon/ethtool.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/sfc/falcon/ethtool.c +8 -4
index 27d1cd6f24ca1..0493640315454 100644
@@ -974,6 +974,13 @@ ef4_ethtool_get_rxfh_fields(struct net_device *net_dev,
 	return 0;
 }
 
+static u32 ef4_ethtool_get_rx_ring_count(struct net_device *net_dev)
+{
+	struct ef4_nic *efx = netdev_priv(net_dev);
+
+	return efx->n_rx_channels;
+}
+
 static int
 ef4_ethtool_get_rxnfc(struct net_device *net_dev,
 		      struct ethtool_rxnfc *info, u32 *rule_locs)
@@ -981,10 +988,6 @@ ef4_ethtool_get_rxnfc(struct net_device *net_dev,
 	struct ef4_nic *efx = netdev_priv(net_dev);
 
 	switch (info->cmd) {
-	case ETHTOOL_GRXRINGS:
-		info->data = efx->n_rx_channels;
-		return 0;
-
 	case ETHTOOL_GRXCLSRLCNT:
 		info->data = ef4_filter_get_rx_id_limit(efx);
 		if (info->data == 0)
@@ -1348,6 +1351,7 @@ const struct ethtool_ops ef4_ethtool_ops = {
 	.reset			= ef4_ethtool_reset,
 	.get_rxnfc		= ef4_ethtool_get_rxnfc,
 	.set_rxnfc		= ef4_ethtool_set_rxnfc,
+	.get_rx_ring_count	= ef4_ethtool_get_rx_ring_count,
 	.get_rxfh_indir_size	= ef4_ethtool_get_rxfh_indir_size,
 	.get_rxfh		= ef4_ethtool_get_rxfh,
 	.set_rxfh		= ef4_ethtool_set_rxfh,
Signature · 1 line
2.47.3
Reviewed-by Brett Creeley on the v2 series
#10 lore raw
In reply to Breno Leitao
Quoted 72 lines · Breno Leitao

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

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.

* sfc
* ionic
* sfc/siena
* sfc/ef100
* fbnic
* mana
* nfp
* atlantic
* benet (this is v2 in fact, where v1 had some discussions that required a v2). See link [0]

This is covering the last drivers, and as soon as this lands, I will change the ethtool framework to avoid calling .get_rx_ring_count for ETHTOOL_GRXRINGS, simplifying the ethtool core framework.

Part 1 is already merged in net-next and can be seen in
https://lore.kernel.org/all/[email protected]/

Part 2 is already merged in net-next except benet driver, which is now included in here
https://lore.kernel.org/all/[email protected]/

PS: all of these change were compile-tested only.

---
Changes in v2:
- Respect reverse xmas tree in Atlantic driver (Brett Creeley)
- Link to v1: https://patch.msgid.link/[email protected]

---
Breno Leitao (9):
net: benet: convert to use .get_rx_ring_count
net: atlantic: convert to use .get_rx_ring_count
net: nfp: convert to use .get_rx_ring_count
net: mana: convert to use .get_rx_ring_count
net: fbnic: convert to use .get_rx_ring_count
net: ionic: convert to use .get_rx_ring_count
net: sfc: efx: convert to use .get_rx_ring_count
net: sfc: siena: convert to use .get_rx_ring_count
net: sfc: falcon: convert to use .get_rx_ring_count

  .../net/ethernet/aquantia/atlantic/aq_ethtool.c    | 18 +++++++----
  drivers/net/ethernet/emulex/benet/be_ethtool.c     | 37 ++++++++--------------
  drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c    | 12 ++++---
  drivers/net/ethernet/microsoft/mana/mana_ethtool.c | 13 ++------
  .../net/ethernet/netronome/nfp/nfp_net_ethtool.c   | 11 +++++--
  .../net/ethernet/pensando/ionic/ionic_ethtool.c    | 18 ++---------
  drivers/net/ethernet/sfc/ef100_ethtool.c           |  1 +
  drivers/net/ethernet/sfc/ethtool.c                 |  1 +
  drivers/net/ethernet/sfc/ethtool_common.c          | 11 ++++---
  drivers/net/ethernet/sfc/ethtool_common.h          |  1 +
  drivers/net/ethernet/sfc/falcon/ethtool.c          | 12 ++++---
  drivers/net/ethernet/sfc/siena/ethtool.c           |  1 +
  drivers/net/ethernet/sfc/siena/ethtool_common.c    | 11 ++++---
  drivers/net/ethernet/sfc/siena/ethtool_common.h    |  1 +
  14 files changed, 75 insertions(+), 73 deletions(-)
Quoted 7 lines

---
base-commit: d8f87aa5fa0a4276491fa8ef436cd22605a3f9ba
change-id: 20260121-grxring_big_v4-55037f9e001e

Best regards,
--
Breno Leitao <[email protected]>

Entire series LGTM.

Quoted 1 line
#11 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, 22 Jan 2026 10:40:12 -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,v2,1/9] net: benet: convert to use .get_rx_ring_count

    https://git.kernel.org/netdev/net-next/c/8f2a880d652e
  - [net-next,v2,2/9] net: atlantic: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/489a5b81abbc
  - [net-next,v2,3/9] net: nfp: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/46f4ad55605e
  - [net-next,v2,4/9] net: mana: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/3eb722571835
  - [net-next,v2,5/9] net: fbnic: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/ea28b02da84c
  - [net-next,v2,6/9] net: ionic: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/8bd5cee9891a
  - [net-next,v2,7/9] net: sfc: efx: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/67f16fba554f
  - [net-next,v2,8/9] net: sfc: siena: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/c9e4688b2ee2
  - [net-next,v2,9/9] net: sfc: falcon: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/f584347c1a2b

You are awesome, thank you!

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