diff mbox series

[net,v2] gve: Cache link_speed value from device

Message ID 20230321172332.91678-1-joshwash@google.com (mailing list archive)
State Accepted
Commit 68c3e4fc8628b1487c965aabb29207249657eb5f
Delegated to: Netdev Maintainers
Headers show
Series [net,v2] gve: Cache link_speed value from device | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 18 this patch: 18
netdev/cc_maintainers fail 2 blamed authors not CCed: awogbemila@google.com yangchun@google.com; 11 maintainers not CCed: pabeni@redhat.com simon.horman@corigine.com yangchun@google.com peterz@infradead.org shailend@google.com edumazet@google.com csully@google.com bigeasy@linutronix.de awogbemila@google.com tglx@linutronix.de jeroendb@google.com
netdev/build_clang success Errors and warnings before: 21 this patch: 21
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 18 this patch: 18
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Joshua Washington March 21, 2023, 5:23 p.m. UTC
From: Joshua Washington <joshwash@google.com>

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.")
Signed-off-by: Joshua Washington <joshwash@google.com>
---
 drivers/net/ethernet/google/gve/gve_ethtool.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Simon Horman March 22, 2023, 4:03 p.m. UTC | #1
On Tue, Mar 21, 2023 at 10:23:32AM -0700, joshwash@google.com wrote:
> From: Joshua Washington <joshwash@google.com>
> 
> 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.")
> Signed-off-by: Joshua Washington <joshwash@google.com>

Reviewed-by: Simon Horman <simon.horman@corigine.com>
patchwork-bot+netdevbpf@kernel.org March 23, 2023, 5:10 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 21 Mar 2023 10:23:32 -0700 you wrote:
> From: Joshua Washington <joshwash@google.com>
> 
> 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.
> 
> [...]

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!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/google/gve/gve_ethtool.c b/drivers/net/ethernet/google/gve/gve_ethtool.c
index ce574d097e28..5f81470843b4 100644
--- a/drivers/net/ethernet/google/gve/gve_ethtool.c
+++ b/drivers/net/ethernet/google/gve/gve_ethtool.c
@@ -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;