]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: bnx2x: convert to use get_rx_ring_count
authorBreno Leitao <leitao@debian.org>
Wed, 12 Nov 2025 09:50:23 +0000 (01:50 -0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 15 Nov 2025 02:04:21 +0000 (18:04 -0800)
Convert the bnx2x 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 replacing the
switch statement 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.

Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20251112-bnx_grxrings-v1-1-1c2cb73979e2@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c

index fc8dec37a9e48ab8900297e2f7d7eae7da815f78..3d853eeb976f60b25593da999d955c184ef583cd 100644 (file)
@@ -3355,19 +3355,11 @@ static int bnx2x_get_rxfh_fields(struct net_device *dev,
        return 0;
 }
 
-static int bnx2x_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
-                          u32 *rules __always_unused)
+static u32 bnx2x_get_rx_ring_count(struct net_device *dev)
 {
        struct bnx2x *bp = netdev_priv(dev);
 
-       switch (info->cmd) {
-       case ETHTOOL_GRXRINGS:
-               info->data = BNX2X_NUM_ETH_QUEUES(bp);
-               return 0;
-       default:
-               DP(BNX2X_MSG_ETHTOOL, "Command parameters not supported\n");
-               return -EOPNOTSUPP;
-       }
+       return BNX2X_NUM_ETH_QUEUES(bp);
 }
 
 static int bnx2x_set_rxfh_fields(struct net_device *dev,
@@ -3674,7 +3666,7 @@ static const struct ethtool_ops bnx2x_ethtool_ops = {
        .get_strings            = bnx2x_get_strings,
        .set_phys_id            = bnx2x_set_phys_id,
        .get_ethtool_stats      = bnx2x_get_ethtool_stats,
-       .get_rxnfc              = bnx2x_get_rxnfc,
+       .get_rx_ring_count      = bnx2x_get_rx_ring_count,
        .get_rxfh_indir_size    = bnx2x_get_rxfh_indir_size,
        .get_rxfh               = bnx2x_get_rxfh,
        .set_rxfh               = bnx2x_set_rxfh,
@@ -3702,7 +3694,7 @@ static const struct ethtool_ops bnx2x_vf_ethtool_ops = {
        .get_sset_count         = bnx2x_get_sset_count,
        .get_strings            = bnx2x_get_strings,
        .get_ethtool_stats      = bnx2x_get_ethtool_stats,
-       .get_rxnfc              = bnx2x_get_rxnfc,
+       .get_rx_ring_count      = bnx2x_get_rx_ring_count,
        .get_rxfh_indir_size    = bnx2x_get_rxfh_indir_size,
        .get_rxfh               = bnx2x_get_rxfh,
        .set_rxfh               = bnx2x_set_rxfh,