mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
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 84eaf4359c
("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>
This commit is contained in:
@@ -1770,6 +1770,13 @@ static int bnxt_set_rxfh_fields(struct net_device *dev,
|
||||
return rc;
|
||||
}
|
||||
|
||||
static u32 bnxt_get_rx_ring_count(struct net_device *dev)
|
||||
{
|
||||
struct bnxt *bp = netdev_priv(dev);
|
||||
|
||||
return bp->rx_nr_rings;
|
||||
}
|
||||
|
||||
static int bnxt_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
|
||||
u32 *rule_locs)
|
||||
{
|
||||
@@ -1777,10 +1784,6 @@ static int bnxt_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
|
||||
int rc = 0;
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_GRXRINGS:
|
||||
cmd->data = bp->rx_nr_rings;
|
||||
break;
|
||||
|
||||
case ETHTOOL_GRXCLSRLCNT:
|
||||
cmd->rule_cnt = bp->ntp_fltr_count;
|
||||
cmd->data = bp->max_fltr | RX_CLS_LOC_SPECIAL;
|
||||
@@ -5616,6 +5619,7 @@ const struct ethtool_ops bnxt_ethtool_ops = {
|
||||
.set_channels = bnxt_set_channels,
|
||||
.get_rxnfc = bnxt_get_rxnfc,
|
||||
.set_rxnfc = bnxt_set_rxnfc,
|
||||
.get_rx_ring_count = bnxt_get_rx_ring_count,
|
||||
.get_rxfh_indir_size = bnxt_get_rxfh_indir_size,
|
||||
.get_rxfh_key_size = bnxt_get_rxfh_key_size,
|
||||
.get_rxfh = bnxt_get_rxfh,
|
||||
|
||||
@@ -1640,6 +1640,13 @@ static int bcmgenet_get_num_flows(struct bcmgenet_priv *priv)
|
||||
return res;
|
||||
}
|
||||
|
||||
static u32 bcmgenet_get_rx_ring_count(struct net_device *dev)
|
||||
{
|
||||
struct bcmgenet_priv *priv = netdev_priv(dev);
|
||||
|
||||
return priv->hw_params->rx_queues ?: 1;
|
||||
}
|
||||
|
||||
static int bcmgenet_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
|
||||
u32 *rule_locs)
|
||||
{
|
||||
@@ -1649,9 +1656,6 @@ static int bcmgenet_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
|
||||
int i = 0;
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_GRXRINGS:
|
||||
cmd->data = priv->hw_params->rx_queues ?: 1;
|
||||
break;
|
||||
case ETHTOOL_GRXCLSRLCNT:
|
||||
cmd->rule_cnt = bcmgenet_get_num_flows(priv);
|
||||
cmd->data = MAX_NUM_OF_FS_RULES | RX_CLS_LOC_SPECIAL;
|
||||
@@ -1700,6 +1704,7 @@ static const struct ethtool_ops bcmgenet_ethtool_ops = {
|
||||
.get_ts_info = ethtool_op_get_ts_info,
|
||||
.get_rxnfc = bcmgenet_get_rxnfc,
|
||||
.set_rxnfc = bcmgenet_set_rxnfc,
|
||||
.get_rx_ring_count = bcmgenet_get_rx_ring_count,
|
||||
.get_pauseparam = bcmgenet_get_pauseparam,
|
||||
.set_pauseparam = bcmgenet_set_pauseparam,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user