Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: bnx2x: convert to use get_rx_ring_count

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>

authored by

Breno Leitao and committed by
Jakub Kicinski
04ca7a69 f455d3f0

+4 -12
+4 -12
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
··· 3355 3355 return 0; 3356 3356 } 3357 3357 3358 - static int bnx2x_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info, 3359 - u32 *rules __always_unused) 3358 + static u32 bnx2x_get_rx_ring_count(struct net_device *dev) 3360 3359 { 3361 3360 struct bnx2x *bp = netdev_priv(dev); 3362 3361 3363 - switch (info->cmd) { 3364 - case ETHTOOL_GRXRINGS: 3365 - info->data = BNX2X_NUM_ETH_QUEUES(bp); 3366 - return 0; 3367 - default: 3368 - DP(BNX2X_MSG_ETHTOOL, "Command parameters not supported\n"); 3369 - return -EOPNOTSUPP; 3370 - } 3362 + return BNX2X_NUM_ETH_QUEUES(bp); 3371 3363 } 3372 3364 3373 3365 static int bnx2x_set_rxfh_fields(struct net_device *dev, ··· 3666 3674 .get_strings = bnx2x_get_strings, 3667 3675 .set_phys_id = bnx2x_set_phys_id, 3668 3676 .get_ethtool_stats = bnx2x_get_ethtool_stats, 3669 - .get_rxnfc = bnx2x_get_rxnfc, 3677 + .get_rx_ring_count = bnx2x_get_rx_ring_count, 3670 3678 .get_rxfh_indir_size = bnx2x_get_rxfh_indir_size, 3671 3679 .get_rxfh = bnx2x_get_rxfh, 3672 3680 .set_rxfh = bnx2x_set_rxfh, ··· 3694 3702 .get_sset_count = bnx2x_get_sset_count, 3695 3703 .get_strings = bnx2x_get_strings, 3696 3704 .get_ethtool_stats = bnx2x_get_ethtool_stats, 3697 - .get_rxnfc = bnx2x_get_rxnfc, 3705 + .get_rx_ring_count = bnx2x_get_rx_ring_count, 3698 3706 .get_rxfh_indir_size = bnx2x_get_rxfh_indir_size, 3699 3707 .get_rxfh = bnx2x_get_rxfh, 3700 3708 .set_rxfh = bnx2x_set_rxfh,