[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230315174016.4193015-1-joshwash@google.com>
Date: Wed, 15 Mar 2023 10:40:16 -0700
From: joshwash@...gle.com
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, kuba@...nel.org,
Joshua Washington <joshwash@...gle.com>
Subject: [PATCH net] gve: Cache link_speed value from device
From: Joshua Washington <joshwash@...gle.com>
The link speed is never changed for the uptime of a VM. Caching the
value will allow for better performance.
Fixes: 7e074d5a76ca ("gve: Enable Link Speed Reporting in the driver.")
Signed-off-by: Joshua Washington <joshwash@...gle.com>
---
google/gve/gve_ethtool.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/google/gve/gve_ethtool.c b/google/gve/gve_ethtool.c
index b18804e..cfd4b8d 100644
--- a/google/gve/gve_ethtool.c
+++ b/google/gve/gve_ethtool.c
@@ -584,7 +584,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;
--
2.40.0.rc1.284.g88254d51c5-goog
Powered by blists - more mailing lists