Commit 48b27ea6 authored by Breno Leitao's avatar Breno Leitao Committed by Jakub Kicinski
Browse files

net: gve: convert to use .get_rx_ring_count



Convert the Google Virtual Ethernet (GVE) driver to use the new
.get_rx_ring_count ethtool operation instead of handling
ETHTOOL_GRXRINGS in .get_rxnfc. This simplifies the code by moving the
ring count query to a dedicated callback.

The new callback provides the same functionality in a more direct way,
following the ongoing ethtool API modernization.

Reviewed-by: default avatarSubbaraya Sundeep <sbhatta@marvell.com>
Reviewed-by: default avatarHarshitha Ramamurthy <hramamurthy@google.com>
Signed-off-by: default avatarBreno Leitao <leitao@debian.org>
Link: https://patch.msgid.link/20260105-gxring_google-v2-1-e7cfe924d429@debian.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 27a01c19
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -815,15 +815,19 @@ static int gve_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd)
	return err;
}

static u32 gve_get_rx_ring_count(struct net_device *netdev)
{
	struct gve_priv *priv = netdev_priv(netdev);

	return priv->rx_cfg.num_queues;
}

static int gve_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd, u32 *rule_locs)
{
	struct gve_priv *priv = netdev_priv(netdev);
	int err = 0;

	switch (cmd->cmd) {
	case ETHTOOL_GRXRINGS:
		cmd->data = priv->rx_cfg.num_queues;
		break;
	case ETHTOOL_GRXCLSRLCNT:
		if (!priv->max_flow_rules)
			return -EOPNOTSUPP;
@@ -966,6 +970,7 @@ const struct ethtool_ops gve_ethtool_ops = {
	.get_channels = gve_get_channels,
	.set_rxnfc = gve_set_rxnfc,
	.get_rxnfc = gve_get_rxnfc,
	.get_rx_ring_count = gve_get_rx_ring_count,
	.get_rxfh_indir_size = gve_get_rxfh_indir_size,
	.get_rxfh_key_size = gve_get_rxfh_key_size,
	.get_rxfh = gve_get_rxfh,