mirror of
https://github.com/torvalds/linux.git
synced 2026-03-13 22:36:17 +01:00
gve: fix probe failure if clock read fails
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: a479a27f4d ("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>
This commit is contained in:
parent
d32ba904a4
commit
a040afa3bc
5 changed files with 14 additions and 15 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -938,7 +938,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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue