Skip to contentSkip to conversation

net: marvell: modernize RX ring count ethtool callbacks

PATCH Applied Breno Leitao 2 participants 4 messages Nov 21, 2025 – Nov 25, 2025

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

cover net: marvell: modernize RX ring count ethtool callbacks

This series converts the Marvell mvneta and mvpp2 drivers to use the new .get_rx_ring_count ethtool operation, following the ongoing modernization of the ethtool API introduced in commit 84eaf4359c36 ("net: ethtool: add get_rx_ring_count callback to optimize RX ring queries").

The conversion simplifies the code by replacing the generic .get_rxnfc callback with the more specific .get_rx_ring_count callback for retrieving RX ring counts. For mvneta, this completely removes .get_rxnfc since it only handled ETHTOOL_GRXRINGS. For mvpp2, the GRXRINGS case is extracted while keeping other rxnfc handlers intact.

PS: These changes were compile-tested only.
---
Breno Leitao (2):
net: mvneta: convert to use .get_rx_ring_count
net: mvpp2: extract GRXRINGS from .get_rxnfc

 drivers/net/ethernet/marvell/mvneta.c           | 14 +++-----------
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 11 ++++++++---
 2 files changed, 11 insertions(+), 14 deletions(-)

---
base-commit: e2c20036a8879476c88002730d8a27f4e3c32d4b
change-id: 20251121-marvell-0264eb5b214a

Best regards,

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

PATCH 1/2 net: mvneta: convert to use .get_rx_ring_count

Convert the mvneta driver to use the new .get_rx_ring_count ethtool operation instead of implementing .get_rxnfc solely for handling ETHTOOL_GRXRINGS command. This simplifies the code by removing the switch statement and replacing it with a direct return of the queue count.

The new callback provides the same functionality in a more direct way, following the ongoing ethtool API modernization.

---
 drivers/net/ethernet/marvell/mvneta.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/net/ethernet/marvell/mvneta.c +3 -11
index 89ccb8eb82c7..7af44f858fa3 100644
@@ -5012,17 +5012,9 @@ static u32 mvneta_ethtool_get_rxfh_indir_size(struct net_device *dev)
 	return MVNETA_RSS_LU_TABLE_SIZE;
 }
 
-static int mvneta_ethtool_get_rxnfc(struct net_device *dev,
-				    struct ethtool_rxnfc *info,
-				    u32 *rules __always_unused)
+static u32 mvneta_ethtool_get_rx_ring_count(struct net_device *dev)
 {
-	switch (info->cmd) {
-	case ETHTOOL_GRXRINGS:
-		info->data =  rxq_number;
-		return 0;
-	default:
-		return -EOPNOTSUPP;
-	}
+	return rxq_number;
 }
 
 static int  mvneta_config_rss(struct mvneta_port *pp)
@@ -5356,7 +5348,7 @@ static const struct ethtool_ops mvneta_eth_tool_ops = {
 	.get_ethtool_stats = mvneta_ethtool_get_stats,
 	.get_sset_count	= mvneta_ethtool_get_sset_count,
 	.get_rxfh_indir_size = mvneta_ethtool_get_rxfh_indir_size,
-	.get_rxnfc	= mvneta_ethtool_get_rxnfc,
+	.get_rx_ring_count = mvneta_ethtool_get_rx_ring_count,
 	.get_rxfh	= mvneta_ethtool_get_rxfh,
 	.set_rxfh	= mvneta_ethtool_set_rxfh,
 	.get_link_ksettings = mvneta_ethtool_get_link_ksettings,
Signature · 1 line
2.47.3
#2 lore raw

PATCH 2/2 net: mvpp2: extract GRXRINGS from .get_rxnfc

In reply to 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() for the mvpp2 driver.

This simplifies the RX ring count retrieval and aligns mvpp2 with the new ethtool API for querying RX ring parameters, while keeping the other rxnfc handlers (GRXCLSRLCNT, GRXCLSRULE, GRXCLSRLALL) intact.

---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +8 -3
index ab0c99aa9f9a..33426fded919 100644
@@ -5580,6 +5580,13 @@ static int mvpp2_ethtool_set_link_ksettings(struct net_device *dev,
 	return phylink_ethtool_ksettings_set(port->phylink, cmd);
 }
 
+static u32 mvpp2_ethtool_get_rx_ring_count(struct net_device *dev)
+{
+	struct mvpp2_port *port = netdev_priv(dev);
+
+	return port->nrxqs;
+}
+
 static int mvpp2_ethtool_get_rxnfc(struct net_device *dev,
 				   struct ethtool_rxnfc *info, u32 *rules)
 {
@@ -5590,9 +5597,6 @@ static int mvpp2_ethtool_get_rxnfc(struct net_device *dev,
 		return -EOPNOTSUPP;
 
 	switch (info->cmd) {
-	case ETHTOOL_GRXRINGS:
-		info->data = port->nrxqs;
-		break;
 	case ETHTOOL_GRXCLSRLCNT:
 		info->rule_cnt = port->n_rfs_rules;
 		break;
@@ -5827,6 +5831,7 @@ static const struct ethtool_ops mvpp2_eth_tool_ops = {
 	.set_pauseparam		= mvpp2_ethtool_set_pause_param,
 	.get_link_ksettings	= mvpp2_ethtool_get_link_ksettings,
 	.set_link_ksettings	= mvpp2_ethtool_set_link_ksettings,
+	.get_rx_ring_count	= mvpp2_ethtool_get_rx_ring_count,
 	.get_rxnfc		= mvpp2_ethtool_get_rxnfc,
 	.set_rxnfc		= mvpp2_ethtool_set_rxnfc,
 	.get_rxfh_indir_size	= mvpp2_ethtool_get_rxfh_indir_size,
Signature · 1 line
2.47.3
#3 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 5 lines · On Fri, 21 Nov 2025 09:02:34 -0800 you wrote:

This series converts the Marvell mvneta and mvpp2 drivers to use the new .get_rx_ring_count ethtool operation, following the ongoing modernization of the ethtool API introduced in commit 84eaf4359c36 ("net: ethtool: add get_rx_ring_count callback to optimize RX ring queries").

Quoted 7 lines

The conversion simplifies the code by replacing the generic .get_rxnfc callback with the more specific .get_rx_ring_count callback for retrieving RX ring counts. For mvneta, this completely removes .get_rxnfc since it only handled ETHTOOL_GRXRINGS. For mvpp2, the GRXRINGS case is extracted while keeping other rxnfc handlers intact.

[...]

Here is the summary with links:
- [net-next,1/2] net: mvneta: convert to use .get_rx_ring_count

    https://git.kernel.org/netdev/net-next/c/737e14c5dce3
  - [net-next,2/2] net: mvpp2: extract GRXRINGS from .get_rxnfc
    https://git.kernel.org/netdev/net-next/c/20c20f05cf50

You are awesome, thank you!

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