Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/mlx5/mlx5_core/mlx5_health.c
| Show First 20 Lines • Show All 259 Lines • ▼ Show 20 Lines | mlx5_health_allow_reset(struct mlx5_core_dev *dev) | ||||
| return (ret); | return (ret); | ||||
| } | } | ||||
| #define MLX5_CRDUMP_WAIT_MS 60000 | #define MLX5_CRDUMP_WAIT_MS 60000 | ||||
| #define MLX5_FW_RESET_WAIT_MS 1000 | #define MLX5_FW_RESET_WAIT_MS 1000 | ||||
| #define MLX5_NIC_STATE_POLL_MS 5 | #define MLX5_NIC_STATE_POLL_MS 5 | ||||
| void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force) | void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force) | ||||
| { | { | ||||
| int end, delay_ms = MLX5_CRDUMP_WAIT_MS; | unsigned long end; | ||||
| int delay_ms = MLX5_CRDUMP_WAIT_MS; | |||||
| u32 fatal_error; | u32 fatal_error; | ||||
| int lock = -EBUSY; | int lock = -EBUSY; | ||||
| fatal_error = check_fatal_sensors(dev); | fatal_error = check_fatal_sensors(dev); | ||||
| if (fatal_error || force) { | if (fatal_error || force) { | ||||
| if (xchg(&dev->state, MLX5_DEVICE_STATE_INTERNAL_ERROR) == | if (xchg(&dev->state, MLX5_DEVICE_STATE_INTERNAL_ERROR) == | ||||
| MLX5_DEVICE_STATE_INTERNAL_ERROR) | MLX5_DEVICE_STATE_INTERNAL_ERROR) | ||||
| ▲ Show 20 Lines • Show All 163 Lines • ▼ Show 20 Lines | if (!test_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags)) { | ||||
| schedule_delayed_work(&health->recover_work, recover_delay); | schedule_delayed_work(&health->recover_work, recover_delay); | ||||
| } else { | } else { | ||||
| mlx5_core_err(dev, | mlx5_core_err(dev, | ||||
| "new health works are not permitted at this stage\n"); | "new health works are not permitted at this stage\n"); | ||||
| } | } | ||||
| spin_unlock_irqrestore(&health->wq_lock, flags); | spin_unlock_irqrestore(&health->wq_lock, flags); | ||||
| } | } | ||||
| static int get_next_poll_jiffies(void) | static unsigned long get_next_poll_jiffies(void) | ||||
| { | { | ||||
| unsigned long next; | unsigned long next; | ||||
| get_random_bytes(&next, sizeof(next)); | get_random_bytes(&next, sizeof(next)); | ||||
| next %= HZ; | next %= HZ; | ||||
| next += jiffies + MLX5_HEALTH_POLL_INTERVAL; | next += jiffies + MLX5_HEALTH_POLL_INTERVAL; | ||||
| return next; | return next; | ||||
| ▲ Show 20 Lines • Show All 297 Lines • Show Last 20 Lines | |||||