Skip to content

Commit

Permalink
net/mlx5: Skip clock update work when device is in error state
Browse files Browse the repository at this point in the history
When device is in error state, marked by the flag
MLX5_DEVICE_STATE_INTERNAL_ERROR, the HW and PCI may not be accessible
and so clock update work should be skipped. Furthermore, such access
through PCI in error state, after calling mlx5_pci_disable_device() can
result in failing to recover from pci errors.

Fixes: ef9814d ("net/mlx5e: Add HW timestamping (TS) support")
Reported-and-tested-by: Ganesh G R <[email protected]>
Closes: https://lore.kernel.org/netdev/[email protected]
Signed-off-by: Moshe Shemesh <[email protected]>
Reviewed-by: Aya Levin <[email protected]>
Signed-off-by: Saeed Mahameed <[email protected]>
  • Loading branch information
mosheshemesh2 authored and Saeed Mahameed committed Aug 7, 2023
1 parent 86ed7b7 commit d006207
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,15 @@ static void mlx5_timestamp_overflow(struct work_struct *work)
clock = container_of(timer, struct mlx5_clock, timer);
mdev = container_of(clock, struct mlx5_core_dev, clock);

if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
goto out;

write_seqlock_irqsave(&clock->lock, flags);
timecounter_read(&timer->tc);
mlx5_update_clock_info_page(mdev);
write_sequnlock_irqrestore(&clock->lock, flags);

out:
schedule_delayed_work(&timer->overflow_work, timer->overflow_period);
}

Expand Down

0 comments on commit d006207

Please sign in to comment.