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

Merge branch 'net-broadcom-migrate-to-get_rx_ring_count-ethtool-callback'

Breno Leitao says:

====================
net: broadcom: migrate to .get_rx_ring_count() ethtool callback

This series migrates Broadcom ethernet drivers to use the new
.get_rx_ring_count() ethtool callback introduced in commit 84eaf4359c36
("net: ethtool: add get_rx_ring_count callback to optimize RX ring
queries").

This change simplifies the .get_rxnfc() implementation by
extracting the ETHTOOL_GRXRINGS case handling into a dedicated callback,
making the code cleaner and aligning these drivers with the updated
ethtool API.

The series covers two Broadcom drivers: bnxt and bcmgenet. Each patch
removes the ETHTOOL_GRXRINGS case from the driver's .get_rxnfc() switch
statement and implements the new .get_rx_ring_count() callback that
returns the number of RX rings.
====================

Link: https://patch.msgid.link/20251127-grxrings_broadcom-v1-0-b0b182864950@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+16 -7
+8 -4
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
··· 1770 1770 return rc; 1771 1771 } 1772 1772 1773 + static u32 bnxt_get_rx_ring_count(struct net_device *dev) 1774 + { 1775 + struct bnxt *bp = netdev_priv(dev); 1776 + 1777 + return bp->rx_nr_rings; 1778 + } 1779 + 1773 1780 static int bnxt_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, 1774 1781 u32 *rule_locs) 1775 1782 { ··· 1784 1777 int rc = 0; 1785 1778 1786 1779 switch (cmd->cmd) { 1787 - case ETHTOOL_GRXRINGS: 1788 - cmd->data = bp->rx_nr_rings; 1789 - break; 1790 - 1791 1780 case ETHTOOL_GRXCLSRLCNT: 1792 1781 cmd->rule_cnt = bp->ntp_fltr_count; 1793 1782 cmd->data = bp->max_fltr | RX_CLS_LOC_SPECIAL; ··· 5619 5616 .set_channels = bnxt_set_channels, 5620 5617 .get_rxnfc = bnxt_get_rxnfc, 5621 5618 .set_rxnfc = bnxt_set_rxnfc, 5619 + .get_rx_ring_count = bnxt_get_rx_ring_count, 5622 5620 .get_rxfh_indir_size = bnxt_get_rxfh_indir_size, 5623 5621 .get_rxfh_key_size = bnxt_get_rxfh_key_size, 5624 5622 .get_rxfh = bnxt_get_rxfh,
+8 -3
drivers/net/ethernet/broadcom/genet/bcmgenet.c
··· 1640 1640 return res; 1641 1641 } 1642 1642 1643 + static u32 bcmgenet_get_rx_ring_count(struct net_device *dev) 1644 + { 1645 + struct bcmgenet_priv *priv = netdev_priv(dev); 1646 + 1647 + return priv->hw_params->rx_queues ?: 1; 1648 + } 1649 + 1643 1650 static int bcmgenet_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, 1644 1651 u32 *rule_locs) 1645 1652 { ··· 1656 1649 int i = 0; 1657 1650 1658 1651 switch (cmd->cmd) { 1659 - case ETHTOOL_GRXRINGS: 1660 - cmd->data = priv->hw_params->rx_queues ?: 1; 1661 - break; 1662 1652 case ETHTOOL_GRXCLSRLCNT: 1663 1653 cmd->rule_cnt = bcmgenet_get_num_flows(priv); 1664 1654 cmd->data = MAX_NUM_OF_FS_RULES | RX_CLS_LOC_SPECIAL; ··· 1704 1700 .get_ts_info = ethtool_op_get_ts_info, 1705 1701 .get_rxnfc = bcmgenet_get_rxnfc, 1706 1702 .set_rxnfc = bcmgenet_set_rxnfc, 1703 + .get_rx_ring_count = bcmgenet_get_rx_ring_count, 1707 1704 .get_pauseparam = bcmgenet_get_pauseparam, 1708 1705 .set_pauseparam = bcmgenet_set_pauseparam, 1709 1706 };