Skip to content

Commit b6272e5

Browse files
leitaoNipaLocal
authored andcommitted
net: ixgbe: convert to use .get_rx_ring_count
Convert the ixgbe driver to use the new .get_rx_ring_count ethtool operation for handling ETHTOOL_GRXRINGS command. This simplifies the code by extracting the ring count logic into a dedicated callback. The new callback provides the same functionality in a more direct way, following the ongoing ethtool API modernization. Signed-off-by: Breno Leitao <[email protected]> Reviewed-by: Paul Menzel <[email protected]> Reviewed-by: Aleksandr Loktionov <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent b33a24d commit b6272e5

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2807,18 +2807,21 @@ static int ixgbe_rss_indir_tbl_max(struct ixgbe_adapter *adapter)
28072807
return 64;
28082808
}
28092809

2810+
static u32 ixgbe_get_rx_ring_count(struct net_device *dev)
2811+
{
2812+
struct ixgbe_adapter *adapter = ixgbe_from_netdev(dev);
2813+
2814+
return min_t(u32, adapter->num_rx_queues,
2815+
ixgbe_rss_indir_tbl_max(adapter));
2816+
}
2817+
28102818
static int ixgbe_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
28112819
u32 *rule_locs)
28122820
{
28132821
struct ixgbe_adapter *adapter = ixgbe_from_netdev(dev);
28142822
int ret = -EOPNOTSUPP;
28152823

28162824
switch (cmd->cmd) {
2817-
case ETHTOOL_GRXRINGS:
2818-
cmd->data = min_t(int, adapter->num_rx_queues,
2819-
ixgbe_rss_indir_tbl_max(adapter));
2820-
ret = 0;
2821-
break;
28222825
case ETHTOOL_GRXCLSRLCNT:
28232826
cmd->rule_cnt = adapter->fdir_filter_count;
28242827
ret = 0;
@@ -3745,6 +3748,7 @@ static const struct ethtool_ops ixgbe_ethtool_ops = {
37453748
.get_ethtool_stats = ixgbe_get_ethtool_stats,
37463749
.get_coalesce = ixgbe_get_coalesce,
37473750
.set_coalesce = ixgbe_set_coalesce,
3751+
.get_rx_ring_count = ixgbe_get_rx_ring_count,
37483752
.get_rxnfc = ixgbe_get_rxnfc,
37493753
.set_rxnfc = ixgbe_set_rxnfc,
37503754
.get_rxfh_indir_size = ixgbe_rss_indir_size,
@@ -3793,6 +3797,7 @@ static const struct ethtool_ops ixgbe_ethtool_ops_e610 = {
37933797
.get_ethtool_stats = ixgbe_get_ethtool_stats,
37943798
.get_coalesce = ixgbe_get_coalesce,
37953799
.set_coalesce = ixgbe_set_coalesce,
3800+
.get_rx_ring_count = ixgbe_get_rx_ring_count,
37963801
.get_rxnfc = ixgbe_get_rxnfc,
37973802
.set_rxnfc = ixgbe_set_rxnfc,
37983803
.get_rxfh_indir_size = ixgbe_rss_indir_size,

0 commit comments

Comments
 (0)