Skip to content

Commit 68c3e4f

Browse files
josh8551021kuba-moo
authored andcommitted
gve: Cache link_speed value from device
The link speed is never changed for the uptime of a VM, and the current implementation sends an admin queue command for each call. Admin queue command invocations have nontrivial overhead (e.g., VM exits), which can be disruptive to users if triggered frequently. Our telemetry data shows that there are VMs that make frequent calls to this admin queue command. Caching the result of the original admin queue command would eliminate the need to send multiple admin queue commands on subsequent calls to retrieve link speed. Fixes: 7e074d5 ("gve: Enable Link Speed Reporting in the driver.") Signed-off-by: Joshua Washington <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 758d29f commit 68c3e4f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/net/ethernet/google/gve/gve_ethtool.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,10 @@ static int gve_get_link_ksettings(struct net_device *netdev,
537537
struct ethtool_link_ksettings *cmd)
538538
{
539539
struct gve_priv *priv = netdev_priv(netdev);
540-
int err = gve_adminq_report_link_speed(priv);
540+
int err = 0;
541+
542+
if (priv->link_speed == 0)
543+
err = gve_adminq_report_link_speed(priv);
541544

542545
cmd->base.speed = priv->link_speed;
543546
return err;

0 commit comments

Comments
 (0)