summaryrefslogtreecommitdiff
path: root/drivers/net/virtio_net.c
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2025-09-18 07:07:41 -0700
committerJakub Kicinski <kuba@kernel.org>2025-09-18 07:07:42 -0700
commit1d9770838dcbe25151a319c1eae0c9879385b49f (patch)
treeadd56f8011569b3c9fa580f1f8c10a1e33d297a9 /drivers/net/virtio_net.c
parent672beab06656f2f1bda4708cda2b9af61c58a7ea (diff)
parent483446690a625c325149c6d14283b9782aaefffe (diff)
Merge branch 'net-ethtool-add-dedicated-grxrings-driver-callbacks'
Breno Leitao says: ==================== net: ethtool: add dedicated GRXRINGS driver callbacks This patchset introduces a new dedicated ethtool_ops callback, .get_rx_ring_count, which enables drivers to provide the number of RX rings directly, improving efficiency and clarity in RX ring queries and RSS configuration. Number of drivers implements .get_rxnfc callback just to report the ring count, so, having a proper callback makes sense and simplify .get_rxnfc (in some cases remove it completely). This has been suggested by Jakub, and follow the same idea as RXFH driver callbacks [1]. This also port virtio_net to this new callback. Once there is consensus on this approach, I can start moving the drivers to this new callback. Link: https://lore.kernel.org/all/20250611145949.2674086-1-kuba@kernel.org/ [1] v3: https://lore.kernel.org/20250915-gxrings-v3-0-bfd717dbcaad@debian.org v2: https://lore.kernel.org/20250912-gxrings-v2-0-3c7a60bbeebf@debian.org v1: https://lore.kernel.org/20250909-gxrings-v1-0-634282f06a54@debian.org RFC: https://lore.kernel.org/20250905-gxrings-v1-0-984fc471f28f@debian.org ==================== Link: https://patch.msgid.link/20250917-gxrings-v4-0-dae520e2e1cb@debian.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r--drivers/net/virtio_net.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 06708c9a979e..7da5a37917e9 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -5609,20 +5609,11 @@ static int virtnet_set_rxfh(struct net_device *dev,
return 0;
}
-static int virtnet_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info, u32 *rule_locs)
+static u32 virtnet_get_rx_ring_count(struct net_device *dev)
{
struct virtnet_info *vi = netdev_priv(dev);
- int rc = 0;
- switch (info->cmd) {
- case ETHTOOL_GRXRINGS:
- info->data = vi->curr_queue_pairs;
- break;
- default:
- rc = -EOPNOTSUPP;
- }
-
- return rc;
+ return vi->curr_queue_pairs;
}
static const struct ethtool_ops virtnet_ethtool_ops = {
@@ -5650,7 +5641,7 @@ static const struct ethtool_ops virtnet_ethtool_ops = {
.set_rxfh = virtnet_set_rxfh,
.get_rxfh_fields = virtnet_get_hashflow,
.set_rxfh_fields = virtnet_set_hashflow,
- .get_rxnfc = virtnet_get_rxnfc,
+ .get_rx_ring_count = virtnet_get_rx_ring_count,
};
static void virtnet_get_queue_stats_rx(struct net_device *dev, int i,