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.
Cc: stable@vger.kernel.org
Fixes: a479a27f4da4 ("gve: Move gve_init_clock to after AQ CONFIGURE_DEVICE_RESOURCES call")
Signed-off-by: Jordan Rhee <jordanrhee@google.com>
Reviewed-by: Shachar Raindel <shacharr@google.com>
Signed-off-by: Harshitha Ramamurthy <hramamurthy@google.com>
Link: https://patch.msgid.link/20260127010210.969823-1-hramamurthy@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
}
}
+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);
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;
}
}
- 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);
}
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;
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;
{
int err;
- if (!priv->nic_timestamp_supported)
- return 0;
-
err = gve_ptp_init(priv);
if (err)
return err;
{
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))