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 idpf with the new
ethtool API for querying RX ring parameters.
I was not totatly convinced I needed to have the lock, but, I decided to
be on the safe side and get the exact same behaviour it was before.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
drivers/net/ethernet/intel/idpf/idpf_ethtool.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_ethtool.c b/drivers/net/ethernet/intel/idpf/idpf_ethtool.c
index a5a1eec9ade8..1b21747b8b13 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_ethtool.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_ethtool.c
@@ -5,6 +5,25 @@
#include "idpf_ptp.h"
#include "idpf_virtchnl.h"
+/**
+ * idpf_get_rx_ring_count - get RX ring count
+ * @netdev: network interface device structure
+ *
+ * Returns the number of RX rings.
+ */
+static u32 idpf_get_rx_ring_count(struct net_device *netdev)
+{
+ struct idpf_vport *vport;
+ u32 num_rxq;
+
+ idpf_vport_ctrl_lock(netdev);
+ vport = idpf_netdev_to_vport(netdev);
+ num_rxq = vport->num_rxq;
+ idpf_vport_ctrl_unlock(netdev);
+
+ return num_rxq;
+}
+
/**
* idpf_get_rxnfc - command to get RX flow classification rules
* @netdev: network interface device structure
@@ -28,9 +47,6 @@ static int idpf_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
user_config = &np->adapter->vport_config[np->vport_idx]->user_config;
switch (cmd->cmd) {
- case ETHTOOL_GRXRINGS:
- cmd->data = vport->num_rxq;
- break;
case ETHTOOL_GRXCLSRLCNT:
cmd->rule_cnt = user_config->num_fsteer_fltrs;
cmd->data = idpf_fsteer_max_rules(vport);
@@ -1757,6 +1773,7 @@ static const struct ethtool_ops idpf_ethtool_ops = {
.get_channels = idpf_get_channels,
.get_rxnfc = idpf_get_rxnfc,
.set_rxnfc = idpf_set_rxnfc,
+ .get_rx_ring_count = idpf_get_rx_ring_count,
.get_rxfh_key_size = idpf_get_rxfh_key_size,
.get_rxfh_indir_size = idpf_get_rxfh_indir_size,
.get_rxfh = idpf_get_rxfh,
--
2.47.3
> -----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 4/8] idpf: 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 idpf with the
> new ethtool API for querying RX ring parameters.
>
> I was not totatly convinced I needed to have the lock, but, I decided
> to be on the safe side and get the exact same behaviour it was before.
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
> drivers/net/ethernet/intel/idpf/idpf_ethtool.c | 23
> ++++++++++++++++++++---
> 1 file changed, 20 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_ethtool.c
> b/drivers/net/ethernet/intel/idpf/idpf_ethtool.c
> index a5a1eec9ade8..1b21747b8b13 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_ethtool.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_ethtool.c
> @@ -5,6 +5,25 @@
> #include "idpf_ptp.h"
> #include "idpf_virtchnl.h"
>
> +/**
> + * idpf_get_rx_ring_count - get RX ring count
> + * @netdev: network interface device structure
> + *
> + * Returns the number of RX rings.
> + */
> +static u32 idpf_get_rx_ring_count(struct net_device *netdev) {
> + struct idpf_vport *vport;
> + u32 num_rxq;
> +
> + idpf_vport_ctrl_lock(netdev);
> + vport = idpf_netdev_to_vport(netdev);
> + num_rxq = vport->num_rxq;
> + idpf_vport_ctrl_unlock(netdev);
> +
> + return num_rxq;
> +}
> +
> /**
> * idpf_get_rxnfc - command to get RX flow classification rules
> * @netdev: network interface device structure @@ -28,9 +47,6 @@
> static int idpf_get_rxnfc(struct net_device *netdev, struct
> ethtool_rxnfc *cmd,
> user_config = &np->adapter->vport_config[np->vport_idx]-
> >user_config;
>
> switch (cmd->cmd) {
> - case ETHTOOL_GRXRINGS:
> - cmd->data = vport->num_rxq;
> - break;
> case ETHTOOL_GRXCLSRLCNT:
> cmd->rule_cnt = user_config->num_fsteer_fltrs;
> cmd->data = idpf_fsteer_max_rules(vport); @@ -1757,6
> +1773,7 @@ static const struct ethtool_ops idpf_ethtool_ops = {
> .get_channels = idpf_get_channels,
> .get_rxnfc = idpf_get_rxnfc,
> .set_rxnfc = idpf_set_rxnfc,
> + .get_rx_ring_count = idpf_get_rx_ring_count,
> .get_rxfh_key_size = idpf_get_rxfh_key_size,
> .get_rxfh_indir_size = idpf_get_rxfh_indir_size,
> .get_rxfh = idpf_get_rxfh,
>
> --
> 2.47.3
Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> -----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 4/8] idpf: 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 idpf with the
> new ethtool API for querying RX ring parameters.
>
> I was not totatly convinced I needed to have the lock, but, I decided
totatly -> totally
With the best regards
Alex
...
Hello Alex,
On Tue, Nov 25, 2025 at 06:48:08AM +0000, Loktionov, Aleksandr wrote:
>
>
> > -----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 4/8] idpf: 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 idpf with the
> > new ethtool API for querying RX ring parameters.
> >
> > I was not totatly convinced I needed to have the lock, but, I decided
>
> totatly -> totally
Good catch, I will update and respin with your "Signed-off-by".
Thanks for the review,
--breno
© 2016 - 2025 Red Hat, Inc.