[PATCH net-next 1/8] net: octeontx2: convert to use .get_rx_ring_count

Breno Leitao posted 8 patches 1 month ago
[PATCH net-next 1/8] net: octeontx2: convert to use .get_rx_ring_count
Posted by Breno Leitao 1 month ago
Use the newly introduced .get_rx_ring_count ethtool ops callback instead
of handling ETHTOOL_GRXRINGS directly in .get_rxnfc().

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
index b6449f0a9e7d..8918be3ce45e 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
@@ -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,

-- 
2.47.3
Re: [PATCH net-next 1/8] net: octeontx2: convert to use .get_rx_ring_count
Posted by Hariprasad Kelam 4 weeks ago
On 2026-01-09 at 23:10:52, 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().
> 
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
>  drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
>

   Reviewed-by: Hariprasad Kelam <hkelam@marvell.com>
 
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> index b6449f0a9e7d..8918be3ce45e 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> @@ -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,
> 
> -- 
> 2.47.3
> 
>