Commit cdfc6ffb authored by Shay Drory's avatar Shay Drory Committed by Saeed Mahameed

net/mlx5: Print initializing field in case of timeout

Print the initializing field in case of FW couldn't initialize before
timeout. This will help to better understand the root cause in some
cases.
Signed-off-by: default avatarShay Drory <shayd@nvidia.com>
Reviewed-by: default avatarMaor Gottlieb <maorg@nvidia.com>
Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent b5235a99
...@@ -177,30 +177,29 @@ static struct mlx5_profile profile[] = { ...@@ -177,30 +177,29 @@ static struct mlx5_profile profile[] = {
}, },
}; };
static int fw_initializing(struct mlx5_core_dev *dev)
{
return ioread32be(&dev->iseg->initializing) >> 31;
}
static int wait_fw_init(struct mlx5_core_dev *dev, u32 max_wait_mili, static int wait_fw_init(struct mlx5_core_dev *dev, u32 max_wait_mili,
u32 warn_time_mili) u32 warn_time_mili)
{ {
unsigned long warn = jiffies + msecs_to_jiffies(warn_time_mili); unsigned long warn = jiffies + msecs_to_jiffies(warn_time_mili);
unsigned long end = jiffies + msecs_to_jiffies(max_wait_mili); unsigned long end = jiffies + msecs_to_jiffies(max_wait_mili);
u32 fw_initializing;
int err = 0; int err = 0;
while (fw_initializing(dev)) { do {
fw_initializing = ioread32be(&dev->iseg->initializing);
if (!(fw_initializing >> 31))
break;
if (time_after(jiffies, end)) { if (time_after(jiffies, end)) {
err = -EBUSY; err = -EBUSY;
break; break;
} }
if (warn_time_mili && time_after(jiffies, warn)) { if (warn_time_mili && time_after(jiffies, warn)) {
mlx5_core_warn(dev, "Waiting for FW initialization, timeout abort in %ds\n", mlx5_core_warn(dev, "Waiting for FW initialization, timeout abort in %ds (0x%x)\n",
jiffies_to_msecs(end - warn) / 1000); jiffies_to_msecs(end - warn) / 1000, fw_initializing);
warn = jiffies + msecs_to_jiffies(warn_time_mili); warn = jiffies + msecs_to_jiffies(warn_time_mili);
} }
msleep(mlx5_tout_ms(dev, FW_PRE_INIT_WAIT)); msleep(mlx5_tout_ms(dev, FW_PRE_INIT_WAIT));
} } while (true);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment