Skip to contentSkip to conversation

net: convert drivers to .get_rx_ring_count()

PATCH Applied Breno Leitao 4 participants 13 messages Jan 9 – Jan 12

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

cover net: convert drivers to .get_rx_ring_count()

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.
* hns3
* hns
* qede
* niu
* funeth
* enic
* hinic
* octeontx2

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

---
Breno Leitao (8):
net: octeontx2: convert to use .get_rx_ring_count
net: hinic: convert to use .get_rx_ring_count
net: enic: convert to use .get_rx_ring_count
net: funeth: convert to use .get_rx_ring_count
net: niu: convert to use .get_rx_ring_count
net: qede: convert to use .get_rx_ring_count
net: hns: convert to use .get_rx_ring_count
net: hns3: convert to use .get_rx_ring_count

 drivers/net/ethernet/cisco/enic/enic_ethtool.c        | 11 ++++++++---
 drivers/net/ethernet/fungible/funeth/funeth_ethtool.c | 14 +++-----------
 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c      | 16 +++-------------
 drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c    | 12 +++++++++---
 drivers/net/ethernet/huawei/hinic/hinic_ethtool.c     | 19 ++++---------------
 .../net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 13 +++++++++----
 drivers/net/ethernet/qlogic/qede/qede_ethtool.c       | 12 +++++++++---
 drivers/net/ethernet/sun/niu.c                        | 11 ++++++++---
 8 files changed, 53 insertions(+), 55 deletions(-)

---
base-commit: 6ed2b32038ec31450d0d82c8bda5d6c4826b9355
change-id: 20260109-grxring_big_v1-45b5faf768e2
prerequisite-change-id: 20260108-grxring_big-95b950cf9f4b:v1

Best regards,

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

PATCH 1/8 net: octeontx2: 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().

---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +9 -4
index b6449f0a9e7d..8918be3ce45e 100644
@@ -568,6 +568,13 @@ static int otx2_set_coalesce(struct net_device *netdev,
 	return 0;
 }
 
+static u32 otx2_get_rx_ring_count(struct net_device *dev)
+{
+	struct otx2_nic *pfvf = netdev_priv(dev);
+
+	return pfvf->hw.rx_queues;
+}
+
 static int otx2_get_rss_hash_opts(struct net_device *dev,
 				  struct ethtool_rxfh_fields *nfc)
 {
@@ -742,10 +749,6 @@ static int otx2_get_rxnfc(struct net_device *dev,
 	int ret = -EOPNOTSUPP;
 
 	switch (nfc->cmd) {
-	case ETHTOOL_GRXRINGS:
-		nfc->data = pfvf->hw.rx_queues;
-		ret = 0;
-		break;
 	case ETHTOOL_GRXCLSRLCNT:
 		if (netif_running(dev) && ntuple) {
 			nfc->rule_cnt = pfvf->flow_cfg->nr_flows;
@@ -1344,6 +1347,7 @@ static const struct ethtool_ops otx2_ethtool_ops = {
 	.set_coalesce		= otx2_set_coalesce,
 	.get_rxnfc		= otx2_get_rxnfc,
 	.set_rxnfc              = otx2_set_rxnfc,
+	.get_rx_ring_count	= otx2_get_rx_ring_count,
 	.get_rxfh_key_size	= otx2_get_rxfh_key_size,
 	.get_rxfh_indir_size	= otx2_get_rxfh_indir_size,
 	.get_rxfh		= otx2_get_rxfh,
@@ -1462,6 +1466,7 @@ static const struct ethtool_ops otx2vf_ethtool_ops = {
 	.get_channels		= otx2_get_channels,
 	.get_rxnfc		= otx2_get_rxnfc,
 	.set_rxnfc              = otx2_set_rxnfc,
+	.get_rx_ring_count	= otx2_get_rx_ring_count,
 	.get_rxfh_key_size	= otx2_get_rxfh_key_size,
 	.get_rxfh_indir_size	= otx2_get_rxfh_indir_size,
 	.get_rxfh		= otx2_get_rxfh,
Signature · 1 line
2.47.3
Reviewed-by on v1 1/8
#2 lore raw

Re: [PATCH net-next 1/8] net: octeontx2: 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().

---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
Quoted 50 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +9 -4
index b6449f0a9e7d..8918be3ce45e 100644
@@ -568,6 +568,13 @@ static int otx2_set_coalesce(struct net_device *netdev,
 	return 0;
 }
 
+static u32 otx2_get_rx_ring_count(struct net_device *dev)
+{
+	struct otx2_nic *pfvf = netdev_priv(dev);
+
+	return pfvf->hw.rx_queues;
+}
+
 static int otx2_get_rss_hash_opts(struct net_device *dev,
 				  struct ethtool_rxfh_fields *nfc)
 {
@@ -742,10 +749,6 @@ static int otx2_get_rxnfc(struct net_device *dev,
 	int ret = -EOPNOTSUPP;
 
 	switch (nfc->cmd) {
-	case ETHTOOL_GRXRINGS:
-		nfc->data = pfvf->hw.rx_queues;
-		ret = 0;
-		break;
 	case ETHTOOL_GRXCLSRLCNT:
 		if (netif_running(dev) && ntuple) {
 			nfc->rule_cnt = pfvf->flow_cfg->nr_flows;
@@ -1344,6 +1347,7 @@ static const struct ethtool_ops otx2_ethtool_ops = {
 	.set_coalesce		= otx2_set_coalesce,
 	.get_rxnfc		= otx2_get_rxnfc,
 	.set_rxnfc              = otx2_set_rxnfc,
+	.get_rx_ring_count	= otx2_get_rx_ring_count,
 	.get_rxfh_key_size	= otx2_get_rxfh_key_size,
 	.get_rxfh_indir_size	= otx2_get_rxfh_indir_size,
 	.get_rxfh		= otx2_get_rxfh,
@@ -1462,6 +1466,7 @@ static const struct ethtool_ops otx2vf_ethtool_ops = {
 	.get_channels		= otx2_get_channels,
 	.get_rxnfc		= otx2_get_rxnfc,
 	.set_rxnfc              = otx2_set_rxnfc,
+	.get_rx_ring_count	= otx2_get_rx_ring_count,
 	.get_rxfh_key_size	= otx2_get_rxfh_key_size,
 	.get_rxfh_indir_size	= otx2_get_rxfh_indir_size,
 	.get_rxfh		= otx2_get_rxfh,
Signature · 2 lines
-- 
2.47.3
#3 lore raw

PATCH 2/8 net: hinic: 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/huawei/hinic/hinic_ethtool.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)
drivers/net/ethernet/huawei/hinic/hinic_ethtool.c +4 -15
index e9f338e9dbe7..f28528df5aac 100644
@@ -1101,22 +1101,11 @@ static int __set_rss_rxfh(struct net_device *netdev,
 	return 0;
 }
 
-static int hinic_get_rxnfc(struct net_device *netdev,
-			   struct ethtool_rxnfc *cmd, u32 *rule_locs)
+static u32 hinic_get_rx_ring_count(struct net_device *netdev)
 {
 	struct hinic_dev *nic_dev = netdev_priv(netdev);
-	int err = 0;
 
-	switch (cmd->cmd) {
-	case ETHTOOL_GRXRINGS:
-		cmd->data = nic_dev->num_qps;
-		break;
-	default:
-		err = -EOPNOTSUPP;
-		break;
-	}
-
-	return err;
+	return nic_dev->num_qps;
 }
 
 static int hinic_get_rxfh(struct net_device *netdev,
@@ -1779,7 +1768,7 @@ static const struct ethtool_ops hinic_ethtool_ops = {
 	.set_pauseparam = hinic_set_pauseparam,
 	.get_channels = hinic_get_channels,
 	.set_channels = hinic_set_channels,
-	.get_rxnfc = hinic_get_rxnfc,
+	.get_rx_ring_count = hinic_get_rx_ring_count,
 	.get_rxfh_key_size = hinic_get_rxfh_key_size,
 	.get_rxfh_indir_size = hinic_get_rxfh_indir_size,
 	.get_rxfh = hinic_get_rxfh,
@@ -1812,7 +1801,7 @@ static const struct ethtool_ops hinicvf_ethtool_ops = {
 	.set_per_queue_coalesce = hinic_set_per_queue_coalesce,
 	.get_channels = hinic_get_channels,
 	.set_channels = hinic_set_channels,
-	.get_rxnfc = hinic_get_rxnfc,
+	.get_rx_ring_count = hinic_get_rx_ring_count,
 	.get_rxfh_key_size = hinic_get_rxfh_key_size,
 	.get_rxfh_indir_size = hinic_get_rxfh_indir_size,
 	.get_rxfh = hinic_get_rxfh,
Signature · 1 line
2.47.3
#4 lore raw

PATCH 3/8 net: enic: 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/cisco/enic/enic_ethtool.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/ethernet/cisco/enic/enic_ethtool.c +8 -3
index a50f5dad34d5..471613899ec0 100644
@@ -573,6 +573,13 @@ static int enic_get_rx_flow_hash(struct net_device *dev,
 	return 0;
 }
 
+static u32 enic_get_rx_ring_count(struct net_device *dev)
+{
+	struct enic *enic = netdev_priv(dev);
+
+	return enic->rq_count;
+}
+
 static int enic_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
 			  u32 *rule_locs)
 {
@@ -580,9 +587,6 @@ static int enic_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
 	int ret = 0;
 
 	switch (cmd->cmd) {
-	case ETHTOOL_GRXRINGS:
-		cmd->data = enic->rq_count;
-		break;
 	case ETHTOOL_GRXCLSRLCNT:
 		spin_lock_bh(&enic->rfs_h.lock);
 		cmd->rule_cnt = enic->rfs_h.max - enic->rfs_h.free;
@@ -689,6 +693,7 @@ static const struct ethtool_ops enic_ethtool_ops = {
 	.get_coalesce = enic_get_coalesce,
 	.set_coalesce = enic_set_coalesce,
 	.get_rxnfc = enic_get_rxnfc,
+	.get_rx_ring_count = enic_get_rx_ring_count,
 	.get_rxfh_key_size = enic_get_rxfh_key_size,
 	.get_rxfh = enic_get_rxfh,
 	.set_rxfh = enic_set_rxfh,
Signature · 1 line
2.47.3
#5 lore raw

PATCH 4/8 net: funeth: 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/fungible/funeth/funeth_ethtool.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/net/ethernet/fungible/funeth/funeth_ethtool.c +3 -11
index 1966dba512f8..106adf7a870f 100644
@@ -946,17 +946,9 @@ static void fun_get_fec_stats(struct net_device *netdev,
 #undef TX_STAT
 #undef FEC_STAT
 
-static int fun_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
-			 u32 *rule_locs)
+static u32 fun_get_rx_ring_count(struct net_device *netdev)
 {
-	switch (cmd->cmd) {
-	case ETHTOOL_GRXRINGS:
-		cmd->data = netdev->real_num_rx_queues;
-		return 0;
-	default:
-		break;
-	}
-	return -EOPNOTSUPP;
+	return netdev->real_num_rx_queues;
 }
 
 static int fun_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *info)
@@ -1169,8 +1161,8 @@ static const struct ethtool_ops fun_ethtool_ops = {
 	.get_sset_count      = fun_get_sset_count,
 	.get_strings         = fun_get_strings,
 	.get_ethtool_stats   = fun_get_ethtool_stats,
-	.get_rxnfc	     = fun_get_rxnfc,
 	.set_rxnfc           = fun_set_rxnfc,
+	.get_rx_ring_count   = fun_get_rx_ring_count,
 	.get_rxfh_indir_size = fun_get_rxfh_indir_size,
 	.get_rxfh_key_size   = fun_get_rxfh_key_size,
 	.get_rxfh            = fun_get_rxfh,
Signature · 1 line
2.47.3
#6 lore raw

PATCH 5/8 net: niu: 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/sun/niu.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/ethernet/sun/niu.c +8 -3
index 893216b0e08d..f035e3bbbef8 100644
@@ -7302,6 +7302,13 @@ static int niu_get_ethtool_tcam_all(struct niu *np,
 	return ret;
 }
 
+static u32 niu_get_rx_ring_count(struct net_device *dev)
+{
+	struct niu *np = netdev_priv(dev);
+
+	return np->num_rx_rings;
+}
+
 static int niu_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
 		       u32 *rule_locs)
 {
@@ -7309,9 +7316,6 @@ static int niu_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
 	int ret = 0;
 
 	switch (cmd->cmd) {
-	case ETHTOOL_GRXRINGS:
-		cmd->data = np->num_rx_rings;
-		break;
 	case ETHTOOL_GRXCLSRLCNT:
 		cmd->rule_cnt = tcam_get_valid_entry_cnt(np);
 		break;
@@ -7928,6 +7932,7 @@ static const struct ethtool_ops niu_ethtool_ops = {
 	.set_phys_id		= niu_set_phys_id,
 	.get_rxnfc		= niu_get_nfc,
 	.set_rxnfc		= niu_set_nfc,
+	.get_rx_ring_count	= niu_get_rx_ring_count,
 	.get_rxfh_fields	= niu_get_rxfh_fields,
 	.set_rxfh_fields	= niu_set_rxfh_fields,
 	.get_link_ksettings	= niu_get_link_ksettings,
Signature · 1 line
2.47.3
#7 lore raw

PATCH 6/8 net: qede: 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/qlogic/qede/qede_ethtool.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_ethtool.c +9 -3
index 23982704273c..647f30a16a94 100644
@@ -1199,6 +1199,13 @@ static int qede_get_rxfh_fields(struct net_device *dev,
 	return 0;
 }
 
+static u32 qede_get_rx_ring_count(struct net_device *dev)
+{
+	struct qede_dev *edev = netdev_priv(dev);
+
+	return QEDE_RSS_COUNT(edev);
+}
+
 static int qede_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
 			  u32 *rule_locs)
 {
@@ -1206,9 +1213,6 @@ static int qede_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
 	int rc = 0;
 
 	switch (info->cmd) {
-	case ETHTOOL_GRXRINGS:
-		info->data = QEDE_RSS_COUNT(edev);
-		break;
 	case ETHTOOL_GRXCLSRLCNT:
 		info->rule_cnt = qede_get_arfs_filter_count(edev);
 		info->data = QEDE_RFS_MAX_FLTR;
@@ -2289,6 +2293,7 @@ static const struct ethtool_ops qede_ethtool_ops = {
 	.get_sset_count			= qede_get_sset_count,
 	.get_rxnfc			= qede_get_rxnfc,
 	.set_rxnfc			= qede_set_rxnfc,
+	.get_rx_ring_count		= qede_get_rx_ring_count,
 	.get_rxfh_indir_size		= qede_get_rxfh_indir_size,
 	.get_rxfh_key_size		= qede_get_rxfh_key_size,
 	.get_rxfh			= qede_get_rxfh,
@@ -2333,6 +2338,7 @@ static const struct ethtool_ops qede_vf_ethtool_ops = {
 	.get_sset_count			= qede_get_sset_count,
 	.get_rxnfc			= qede_get_rxnfc,
 	.set_rxnfc			= qede_set_rxnfc,
+	.get_rx_ring_count		= qede_get_rx_ring_count,
 	.get_rxfh_indir_size		= qede_get_rxfh_indir_size,
 	.get_rxfh_key_size		= qede_get_rxfh_key_size,
 	.get_rxfh			= qede_get_rxfh,
Signature · 1 line
2.47.3
#8 lore raw

PATCH 7/8 net: hns: 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/hisilicon/hns/hns_ethtool.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c +3 -13
index 60a586a951a0..23b295dedaef 100644
@@ -1230,21 +1230,11 @@ hns_set_rss(struct net_device *netdev, struct ethtool_rxfh_param *rxfh,
 			    rxfh->indir, rxfh->key, rxfh->hfunc);
 }
 
-static int hns_get_rxnfc(struct net_device *netdev,
-			 struct ethtool_rxnfc *cmd,
-			 u32 *rule_locs)
+static u32 hns_get_rx_ring_count(struct net_device *netdev)
 {
 	struct hns_nic_priv *priv = netdev_priv(netdev);
 
-	switch (cmd->cmd) {
-	case ETHTOOL_GRXRINGS:
-		cmd->data = priv->ae_handle->q_num;
-		break;
-	default:
-		return -EOPNOTSUPP;
-	}
-
-	return 0;
+	return priv->ae_handle->q_num;
 }
 
 static const struct ethtool_ops hns_ethtool_ops = {
@@ -1273,7 +1263,7 @@ static const struct ethtool_ops hns_ethtool_ops = {
 	.get_rxfh_indir_size = hns_get_rss_indir_size,
 	.get_rxfh = hns_get_rss,
 	.set_rxfh = hns_set_rss,
-	.get_rxnfc = hns_get_rxnfc,
+	.get_rx_ring_count = hns_get_rx_ring_count,
 	.get_link_ksettings  = hns_nic_get_link_ksettings,
 	.set_link_ksettings  = hns_nic_set_link_ksettings,
 };
Signature · 1 line
2.47.3
maintainer Reviewed-by on v1 7/8
#9 lore raw

Re: [PATCH net-next 7/8] net: hns: 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().

Thanks,

Quoted 42 lines
---
  drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 16 +++-------------
  1 file changed, 3 insertions(+), 13 deletions(-)
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c +3 -13
index 60a586a951a0..23b295dedaef 100644
@@ -1230,21 +1230,11 @@ hns_set_rss(struct net_device *netdev, struct ethtool_rxfh_param *rxfh,
  			    rxfh->indir, rxfh->key, rxfh->hfunc);
  }
 
-static int hns_get_rxnfc(struct net_device *netdev,
-			 struct ethtool_rxnfc *cmd,
-			 u32 *rule_locs)
+static u32 hns_get_rx_ring_count(struct net_device *netdev)
  {
  	struct hns_nic_priv *priv = netdev_priv(netdev);
 
-	switch (cmd->cmd) {
-	case ETHTOOL_GRXRINGS:
-		cmd->data = priv->ae_handle->q_num;
-		break;
-	default:
-		return -EOPNOTSUPP;
-	}
-
-	return 0;
+	return priv->ae_handle->q_num;
  }
 
  static const struct ethtool_ops hns_ethtool_ops = {
@@ -1273,7 +1263,7 @@ static const struct ethtool_ops hns_ethtool_ops = {
  	.get_rxfh_indir_size = hns_get_rss_indir_size,
  	.get_rxfh = hns_get_rss,
  	.set_rxfh = hns_set_rss,
-	.get_rxnfc = hns_get_rxnfc,
+	.get_rx_ring_count = hns_get_rx_ring_count,
  	.get_link_ksettings  = hns_nic_get_link_ksettings,
  	.set_link_ksettings  = hns_nic_set_link_ksettings,
  };
#10 lore raw

PATCH 8/8 net: hns3: 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/hisilicon/hns3/hns3_ethtool.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +9 -3
index a5eefa28454c..6d746a9fb687 100644
@@ -988,6 +988,13 @@ static int hns3_get_rxfh_fields(struct net_device *netdev,
 	return -EOPNOTSUPP;
 }
 
+static u32 hns3_get_rx_ring_count(struct net_device *netdev)
+{
+	struct hnae3_handle *h = hns3_get_handle(netdev);
+
+	return h->kinfo.num_tqps;
+}
+
 static int hns3_get_rxnfc(struct net_device *netdev,
 			  struct ethtool_rxnfc *cmd,
 			  u32 *rule_locs)
@@ -995,9 +1002,6 @@ static int hns3_get_rxnfc(struct net_device *netdev,
 	struct hnae3_handle *h = hns3_get_handle(netdev);
 
 	switch (cmd->cmd) {
-	case ETHTOOL_GRXRINGS:
-		cmd->data = h->kinfo.num_tqps;
-		return 0;
 	case ETHTOOL_GRXCLSRLCNT:
 		if (h->ae_algo->ops->get_fd_rule_cnt)
 			return h->ae_algo->ops->get_fd_rule_cnt(h, cmd);
@@ -2148,6 +2152,7 @@ static const struct ethtool_ops hns3vf_ethtool_ops = {
 	.get_sset_count = hns3_get_sset_count,
 	.get_rxnfc = hns3_get_rxnfc,
 	.set_rxnfc = hns3_set_rxnfc,
+	.get_rx_ring_count = hns3_get_rx_ring_count,
 	.get_rxfh_key_size = hns3_get_rss_key_size,
 	.get_rxfh_indir_size = hns3_get_rss_indir_size,
 	.get_rxfh = hns3_get_rss,
@@ -2187,6 +2192,7 @@ static const struct ethtool_ops hns3_ethtool_ops = {
 	.get_sset_count = hns3_get_sset_count,
 	.get_rxnfc = hns3_get_rxnfc,
 	.set_rxnfc = hns3_set_rxnfc,
+	.get_rx_ring_count = hns3_get_rx_ring_count,
 	.get_rxfh_key_size = hns3_get_rss_key_size,
 	.get_rxfh_indir_size = hns3_get_rss_indir_size,
 	.get_rxfh = hns3_get_rss,
Signature · 1 line
2.47.3
maintainer Reviewed-by on v1 8/8
#11 lore raw

Re: [PATCH net-next 8/8] net: hns3: 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().

Thanks,

Quoted 49 lines
---
  drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 12 +++++++++---
  1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +9 -3
index a5eefa28454c..6d746a9fb687 100644
@@ -988,6 +988,13 @@ static int hns3_get_rxfh_fields(struct net_device *netdev,
  	return -EOPNOTSUPP;
  }
 
+static u32 hns3_get_rx_ring_count(struct net_device *netdev)
+{
+	struct hnae3_handle *h = hns3_get_handle(netdev);
+
+	return h->kinfo.num_tqps;
+}
+
  static int hns3_get_rxnfc(struct net_device *netdev,
  			  struct ethtool_rxnfc *cmd,
  			  u32 *rule_locs)
@@ -995,9 +1002,6 @@ static int hns3_get_rxnfc(struct net_device *netdev,
  	struct hnae3_handle *h = hns3_get_handle(netdev);
 
  	switch (cmd->cmd) {
-	case ETHTOOL_GRXRINGS:
-		cmd->data = h->kinfo.num_tqps;
-		return 0;
  	case ETHTOOL_GRXCLSRLCNT:
  		if (h->ae_algo->ops->get_fd_rule_cnt)
  			return h->ae_algo->ops->get_fd_rule_cnt(h, cmd);
@@ -2148,6 +2152,7 @@ static const struct ethtool_ops hns3vf_ethtool_ops = {
  	.get_sset_count = hns3_get_sset_count,
  	.get_rxnfc = hns3_get_rxnfc,
  	.set_rxnfc = hns3_set_rxnfc,
+	.get_rx_ring_count = hns3_get_rx_ring_count,
  	.get_rxfh_key_size = hns3_get_rss_key_size,
  	.get_rxfh_indir_size = hns3_get_rss_indir_size,
  	.get_rxfh = hns3_get_rss,
@@ -2187,6 +2192,7 @@ static const struct ethtool_ops hns3_ethtool_ops = {
  	.get_sset_count = hns3_get_sset_count,
  	.get_rxnfc = hns3_get_rxnfc,
  	.set_rxnfc = hns3_set_rxnfc,
+	.get_rx_ring_count = hns3_get_rx_ring_count,
  	.get_rxfh_key_size = hns3_get_rss_key_size,
  	.get_rxfh_indir_size = hns3_get_rss_indir_size,
  	.get_rxfh = hns3_get_rss,
#12 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 Fri, 09 Jan 2026 09:40:51 -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/8] net: octeontx2: convert to use .get_rx_ring_count

    https://git.kernel.org/netdev/net-next/c/623b213825fd
  - [net-next,2/8] net: hinic: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/08cbb4a3de08
  - [net-next,3/8] net: enic: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/415a9d10d180
  - [net-next,4/8] net: funeth: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/983d4b8ec519
  - [net-next,5/8] net: niu: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/5baf736ba4f3
  - [net-next,6/8] net: qede: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/a64f302022ba
  - [net-next,7/8] net: hns: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/2103a5ed1b5b
  - [net-next,8/8] net: hns3: convert to use .get_rx_ring_count
    https://git.kernel.org/netdev/net-next/c/cf8c4e1f08ec

You are awesome, thank you!

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