Skip to contentSkip to conversation

gve: Cache link_speed value from device

PATCH Applied [email protected] 3 participants 3 messages Mar 21, 2023 – Mar 23, 2023

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH v2 1/1 gve: Cache link_speed value from device

From: Joshua Washington <[email protected]>

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 7e074d5a76ca ("gve: Enable Link Speed Reporting in the driver.")
---
 drivers/net/ethernet/google/gve/gve_ethtool.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/google/gve/gve_ethtool.c +4 -1
index ce574d097e28..5f81470843b4 100644
@@ -537,7 +537,10 @@ static int gve_get_link_ksettings(struct net_device *netdev,
 				  struct ethtool_link_ksettings *cmd)
 {
 	struct gve_priv *priv = netdev_priv(netdev);
-	int err = gve_adminq_report_link_speed(priv);
+	int err = 0;
+
+	if (priv->link_speed == 0)
+		err = gve_adminq_report_link_speed(priv);
 
 	cmd->base.speed = priv->link_speed;
 	return err;
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
Reviewed-by on v2 1/1
#1 lore raw
Quoted 11 lines · On Tue, Mar 21, 2023 at 10:23:32AM -0700, [email protected] wrote:

From: Joshua Washington <[email protected]>

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.

Quoted 2 lines
Fixes 7e074d5a76ca ("gve: Enable Link Speed Reporting in the driver.")
#2 lore raw
In reply to [email protected]
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 11 lines · On Tue, 21 Mar 2023 10:23:32 -0700 you wrote:

From: Joshua Washington <[email protected]>

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.

Quoted 1 line

[...]

Here is the summary with links:
- [net,v2] gve: Cache link_speed value from device

    https://git.kernel.org/netdev/net/c/68c3e4fc8628

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html