[PATCH net-next 2/8] iavf: extract GRXRINGS from .get_rxnfc

Breno Leitao posted 8 patches 1 week ago
There is a newer version of this series
[PATCH net-next 2/8] iavf: extract GRXRINGS from .get_rxnfc
Posted by Breno Leitao 1 week ago
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 iavf with the new
ethtool API for querying RX ring parameters.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 drivers/net/ethernet/intel/iavf/iavf_ethtool.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
index a3f8ced23266..08ff90e73803 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
@@ -1638,6 +1638,19 @@ static int iavf_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd)
 	return ret;
 }
 
+/**
+ * iavf_get_rx_ring_count - get RX ring count
+ * @netdev: network interface device structure
+ *
+ * Returns the number of RX rings.
+ **/
+static u32 iavf_get_rx_ring_count(struct net_device *netdev)
+{
+	struct iavf_adapter *adapter = netdev_priv(netdev);
+
+	return adapter->num_active_queues;
+}
+
 /**
  * iavf_get_rxnfc - command to get RX flow classification rules
  * @netdev: network interface device structure
@@ -1653,10 +1666,6 @@ static int iavf_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
 	int ret = -EOPNOTSUPP;
 
 	switch (cmd->cmd) {
-	case ETHTOOL_GRXRINGS:
-		cmd->data = adapter->num_active_queues;
-		ret = 0;
-		break;
 	case ETHTOOL_GRXCLSRLCNT:
 		if (!(adapter->flags & IAVF_FLAG_FDIR_ENABLED))
 			break;
@@ -1866,6 +1875,7 @@ static const struct ethtool_ops iavf_ethtool_ops = {
 	.set_per_queue_coalesce = iavf_set_per_queue_coalesce,
 	.set_rxnfc		= iavf_set_rxnfc,
 	.get_rxnfc		= iavf_get_rxnfc,
+	.get_rx_ring_count	= iavf_get_rx_ring_count,
 	.get_rxfh_indir_size	= iavf_get_rxfh_indir_size,
 	.get_rxfh		= iavf_get_rxfh,
 	.set_rxfh		= iavf_set_rxfh,

-- 
2.47.3
RE: [Intel-wired-lan] [PATCH net-next 2/8] iavf: extract GRXRINGS from .get_rxnfc
Posted by Loktionov, Aleksandr 6 days, 17 hours ago

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Breno Leitao
> Sent: Monday, November 24, 2025 7:19 PM
> To: Lobakin, Aleksander <aleksander.lobakin@intel.com>; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@intel.com>; Andrew Lunn <andrew+netdev@lunn.ch>; David
> S. Miller <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub
> Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>
> Cc: michal.swiatkowski@linux.intel.com; michal.kubiak@intel.com;
> Fijalkowski, Maciej <maciej.fijalkowski@intel.com>; intel-wired-
> lan@lists.osuosl.org; netdev@vger.kernel.org; linux-kernel@vger.kernel.org;
> kernel-team@meta.com; Breno Leitao <leitao@debian.org>
> Subject: [Intel-wired-lan] [PATCH net-next 2/8] iavf: extract GRXRINGS from
> .get_rxnfc
> 
> 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 iavf with the new
> ethtool API for querying RX ring parameters.
> 
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
>  drivers/net/ethernet/intel/iavf/iavf_ethtool.c | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
> b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
> index a3f8ced23266..08ff90e73803 100644
> --- a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
> +++ b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
> @@ -1638,6 +1638,19 @@ static int iavf_set_rxnfc(struct net_device *netdev,
> struct ethtool_rxnfc *cmd)
>  	return ret;
>  }
> 
> +/**
> + * iavf_get_rx_ring_count - get RX ring count
> + * @netdev: network interface device structure
> + *
> + * Returns the number of RX rings.
> + **/
> +static u32 iavf_get_rx_ring_count(struct net_device *netdev) {
> +	struct iavf_adapter *adapter = netdev_priv(netdev);
> +
> +	return adapter->num_active_queues;
> +}
> +
>  /**
>   * iavf_get_rxnfc - command to get RX flow classification rules
>   * @netdev: network interface device structure @@ -1653,10 +1666,6 @@
> static int iavf_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc
> *cmd,
>  	int ret = -EOPNOTSUPP;
> 
>  	switch (cmd->cmd) {
> -	case ETHTOOL_GRXRINGS:
> -		cmd->data = adapter->num_active_queues;
> -		ret = 0;
> -		break;
>  	case ETHTOOL_GRXCLSRLCNT:
>  		if (!(adapter->flags & IAVF_FLAG_FDIR_ENABLED))
>  			break;
> @@ -1866,6 +1875,7 @@ static const struct ethtool_ops iavf_ethtool_ops = {
>  	.set_per_queue_coalesce = iavf_set_per_queue_coalesce,
>  	.set_rxnfc		= iavf_set_rxnfc,
>  	.get_rxnfc		= iavf_get_rxnfc,
> +	.get_rx_ring_count	= iavf_get_rx_ring_count,
>  	.get_rxfh_indir_size	= iavf_get_rxfh_indir_size,
>  	.get_rxfh		= iavf_get_rxfh,
>  	.set_rxfh		= iavf_set_rxfh,
> 
> --
> 2.47.3

Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>