gve: fix probe failure if clock read fails
Subsystems (4)
Harshitha Ramamurthy
maintainerPATCH 1/1 gve: fix probe failure if clock read fails
From: Jordan Rhee <[email protected]>
If timestamping is supported, GVE reads the clock during probe, which can fail for various reasons. Previously, this failure would abort the driver probe, rendering the device unusable. This behavior has been observed on production GCP VMs, causing driver initialization to fail completely.
This patch allows the driver to degrade gracefully. If gve_init_clock() fails, it logs a warning and continues loading the driver without PTP support.
--- drivers/net/ethernet/google/gve/gve.h | 5 +++++ drivers/net/ethernet/google/gve/gve_ethtool.c | 2 +- drivers/net/ethernet/google/gve/gve_main.c | 12 +++++++----- drivers/net/ethernet/google/gve/gve_ptp.c | 8 -------- drivers/net/ethernet/google/gve/gve_rx_dqo.c | 2 +- 5 files changed, 14 insertions(+), 15 deletions(-)
drivers/net/ethernet/google/gve/gve.h +5 -0
@@ -1206,6 +1206,11 @@ static inline bool gve_supports_xdp_xmit(struct gve_priv *priv) } } +static inline bool gve_is_clock_enabled (struct gve_priv *priv) +{ +return priv->nic_ts_report; +} +/* gqi napi handler defined in gve_main.c */ int gve_napi_poll (struct napi_struct *napi,int budget);
drivers/net/ethernet/google/gve/gve_ethtool.c +1 -1
@@ -952,7 +952,7 @@ static int gve_get_ts_info(struct net_device *netdev,ethtool_op_get_ts_info (netdev, info); -if (priv->nic_timestamp_supported) { +if (gve_is_clock_enabled (priv)) { info->so_timestamping |=SOF_TIMESTAMPING_RX_HARDWARE |SOF_TIMESTAMPING_RAW_HARDWARE ;
drivers/net/ethernet/google/gve/gve_main.c +7 -5
@@ -680,10 +680,12 @@ static int gve_setup_device_resources(struct gve_priv *priv) } } - err =gve_init_clock (priv); -if (err) { -dev_err (&priv->pdev->dev,"Failed to init clock" ); - goto abort_with_ptype_lut; +if (priv->nic_timestamp_supported) { + err =gve_init_clock (priv); +if (err) { +dev_warn (&priv->pdev->dev,"Failed to init clock, continuing without PTP support" ); + err =0 ; + } } err =gve_init_rss_config (priv, priv->rx_cfg.num_queues);
@@ -2183,7 +2185,7 @@ static int gve_set_ts_config(struct net_device *dev, }if (kernel_config->rx_filter !=HWTSTAMP_FILTER_NONE ) { -if (!priv->nic_ts_report) { +if (!gve_is_clock_enabled (priv)) {NL_SET_ERR_MSG_MOD (extack,"RX timestamping is not supported" ); kernel_config->rx_filter =HWTSTAMP_FILTER_NONE ;
drivers/net/ethernet/google/gve/gve_ptp.c +0 -8
@@ -70,11 +70,6 @@ static int gve_ptp_init(struct gve_priv *priv)struct gve_ptp *ptp;int err; -if (!priv->nic_timestamp_supported) { -dev_dbg (&priv->pdev->dev,"Device does not support PTP\n" ); -return -EOPNOTSUPP ; - } - priv->ptp =kzalloc (sizeof (*priv->ptp),GFP_KERNEL );if (!priv->ptp)return -ENOMEM ;
@@ -116,9 +111,6 @@ int gve_init_clock(struct gve_priv *priv) {int err; -if (!priv->nic_timestamp_supported) -return 0 ; - err =gve_ptp_init (priv);if (err)return err;
drivers/net/ethernet/google/gve/gve_rx_dqo.c +1 -1
@@ -484,7 +484,7 @@ int gve_xdp_rx_timestamp(const struct xdp_md *_ctx, u64 *timestamp) {const struct gve_xdp_buff *ctx = (void *)_ctx; -if (!ctx->gve->nic_ts_report) +if (!gve_is_clock_enabled (ctx->gve))return -ENODATA ;if (!(ctx->compl_desc->ts_sub_nsecs_low &GVE_DQO_RX_HWTSTAMP_VALID ))
Signature · 1 line
2.52.0.457.g6b5491de43-goog
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 9 lines · On Tue, 27 Jan 2026 01:02:10 +0000 you wrote:
From: Jordan Rhee <[email protected]>
If timestamping is supported, GVE reads the clock during probe, which can fail for various reasons. Previously, this failure would abort the driver probe, rendering the device unusable. This behavior has been observed on production GCP VMs, causing driver initialization to fail completely.
[...]
Here is the summary with links:
- [net] gve: fix probe failure if clock read fails
https://git.kernel.org/netdev/net/c/a040afa3bca4
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html