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

Breno Leitao posted 9 patches 2 weeks, 5 days ago
There is a newer version of this series
[PATCH net-next 4/9] net: mana: convert to use .get_rx_ring_count
Posted by Breno Leitao 2 weeks, 5 days ago
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.

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

diff --git a/drivers/net/ethernet/microsoft/mana/mana_ethtool.c b/drivers/net/ethernet/microsoft/mana/mana_ethtool.c
index 0e2f4343ac67f..f2d220b371b5d 100644
--- a/drivers/net/ethernet/microsoft/mana/mana_ethtool.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_ethtool.c
@@ -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,

-- 
2.47.3
Re: [PATCH net-next 4/9] net: mana: convert to use .get_rx_ring_count
Posted by Subbaraya Sundeep 2 weeks, 4 days ago
On 2026-01-21 at 21:24:41, Breno Leitao (leitao@debian.org) 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 mana_get_rxnfc(),
> remove the function entirely.
> 
> Signed-off-by: Breno Leitao <leitao@debian.org>

Reviewed-by: Subbaraya Sundeep <sbhatta@marvell.com>

Thanks,
Sundeep
> ---
>  drivers/net/ethernet/microsoft/mana/mana_ethtool.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/ethernet/microsoft/mana/mana_ethtool.c b/drivers/net/ethernet/microsoft/mana/mana_ethtool.c
> index 0e2f4343ac67f..f2d220b371b5d 100644
> --- a/drivers/net/ethernet/microsoft/mana/mana_ethtool.c
> +++ b/drivers/net/ethernet/microsoft/mana/mana_ethtool.c
> @@ -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,
> 
> -- 
> 2.47.3
>