Skip to content

Commit 4834466

Browse files
leitaokuba-moo
authored andcommitted
net: virtio_net: add get_rxrings ethtool callback for RX ring queries
Replace the existing virtnet_get_rxnfc callback with a dedicated virtnet_get_rxrings implementation to provide the number of RX rings directly via the new ethtool_ops get_rx_ring_count pointer. This simplifies the RX ring count retrieval and aligns virtio_net with the new ethtool API for querying RX ring parameters. Signed-off-by: Breno Leitao <leitao@debian.org> Link: https://patch.msgid.link/20250917-gxrings-v4-8-dae520e2e1cb@debian.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 8b7c4b6 commit 4834466

1 file changed

Lines changed: 3 additions & 12 deletions

File tree

drivers/net/virtio_net.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5609,20 +5609,11 @@ static int virtnet_set_rxfh(struct net_device *dev,
56095609
return 0;
56105610
}
56115611

5612-
static int virtnet_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info, u32 *rule_locs)
5612+
static u32 virtnet_get_rx_ring_count(struct net_device *dev)
56135613
{
56145614
struct virtnet_info *vi = netdev_priv(dev);
5615-
int rc = 0;
56165615

5617-
switch (info->cmd) {
5618-
case ETHTOOL_GRXRINGS:
5619-
info->data = vi->curr_queue_pairs;
5620-
break;
5621-
default:
5622-
rc = -EOPNOTSUPP;
5623-
}
5624-
5625-
return rc;
5616+
return vi->curr_queue_pairs;
56265617
}
56275618

56285619
static const struct ethtool_ops virtnet_ethtool_ops = {
@@ -5650,7 +5641,7 @@ static const struct ethtool_ops virtnet_ethtool_ops = {
56505641
.set_rxfh = virtnet_set_rxfh,
56515642
.get_rxfh_fields = virtnet_get_hashflow,
56525643
.set_rxfh_fields = virtnet_set_hashflow,
5653-
.get_rxnfc = virtnet_get_rxnfc,
5644+
.get_rx_ring_count = virtnet_get_rx_ring_count,
56545645
};
56555646

56565647
static void virtnet_get_queue_stats_rx(struct net_device *dev, int i,

0 commit comments

Comments
 (0)