| @@ -327,19 +327,6 @@ static int mlx5_health_try_recover(struct mlx5_core_dev *dev) · 326 unmodified lines |
| 327 | 327 | return 0; |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | | −static void health_recover_work(struct work_struct *work) |
| 331 | | −{ |
| 332 | | − struct mlx5_core_health *health; |
| 333 | | − struct mlx5_core_dev *dev; |
| 334 | | − struct mlx5_priv *priv; |
| 335 | | − |
| 336 | | − health = container_of(work, struct mlx5_core_health, work); |
| 337 | | − priv = container_of(health, struct mlx5_priv, health); |
| 338 | | − dev = container_of(priv, struct mlx5_core_dev, priv); |
| 339 | | − |
| 340 | | − mlx5_health_try_recover(dev); |
| 341 | | −} |
| 342 | | − |
| 343 | 330 | static const char *hsynd_str(u8 synd) |
| 344 | 331 | { |
| 345 | 332 | switch (synd) { |
| @@ -614,6 +601,29 @@ free_data: · 268 unmodified lines |
| 614 | 601 | return err; |
| 615 | 602 | } |
| 616 | 603 | |
| 604 | +static void mlx5_fw_fatal_reporter_err_work(struct work_struct *work) |
| 605 | +{ |
| 606 | + struct mlx5_fw_reporter_ctx fw_reporter_ctx; |
| 607 | + struct mlx5_core_health *health; |
| 608 | + struct mlx5_core_dev *dev; |
| 609 | + struct mlx5_priv *priv; |
| 610 | + |
| 611 | + health = container_of(work, struct mlx5_core_health, fatal_report_work); |
| 612 | + priv = container_of(health, struct mlx5_priv, health); |
| 613 | + dev = container_of(priv, struct mlx5_core_dev, priv); |
| 614 | + |
| 615 | + mlx5_enter_error_state(dev, false); |
| 616 | + if (IS_ERR_OR_NULL(health->fw_fatal_reporter)) { |
| 617 | + if (mlx5_health_try_recover(dev)) |
| 618 | + mlx5_core_err(dev, "health recovery failed\n"); |
| 619 | + return; |
| 620 | + } |
| 621 | + fw_reporter_ctx.err_synd = health->synd; |
| 622 | + fw_reporter_ctx.miss_counter = health->miss_counter; |
| 623 | + devlink_health_report(health->fw_fatal_reporter, |
| 624 | + "FW fatal error reported", &fw_reporter_ctx); |
| 625 | +} |
| 626 | + |
| 617 | 627 | static const struct devlink_health_reporter_ops mlx5_fw_fatal_reporter_ops = { |
| 618 | 628 | .name = "fw_fatal", |
| 619 | 629 | .recover = mlx5_fw_fatal_reporter_recover, |
| @@ -672,7 +682,7 @@ void mlx5_trigger_health_work(struct mlx5_core_dev *dev) · 52 unmodified lines |
| 672 | 682 | |
| 673 | 683 | spin_lock_irqsave(&health->wq_lock, flags); |
| 674 | 684 | if (!test_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags)) |
| 675 | | − queue_work(health->wq, &health->work); |
| 685 | + queue_work(health->wq, &health->fatal_report_work); |
| 676 | 686 | else |
| 677 | 687 | mlx5_core_err(dev, "new health works are not permitted at this stage\n"); |
| 678 | 688 | spin_unlock_irqrestore(&health->wq_lock, flags); |
| @@ -758,7 +768,7 @@ void mlx5_drain_health_wq(struct mlx5_core_dev *dev) · 79 unmodified lines |
| 758 | 768 | set_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags); |
| 759 | 769 | spin_unlock_irqrestore(&health->wq_lock, flags); |
| 760 | 770 | cancel_work_sync(&health->report_work); |
| 761 | | − cancel_work_sync(&health->work); |
| 771 | + cancel_work_sync(&health->fatal_report_work); |
| 762 | 772 | } |
| 763 | 773 | |
| 764 | 774 | void mlx5_health_flush(struct mlx5_core_dev *dev) |
| @@ -795,7 +805,7 @@ int mlx5_health_init(struct mlx5_core_dev *dev) · 30 unmodified lines |
| 795 | 805 | if (!health->wq) |
| 796 | 806 | goto out_err; |
| 797 | 807 | spin_lock_init(&health->wq_lock); |
| 798 | | − INIT_WORK(&health->work, health_recover_work); |
| 808 | + INIT_WORK(&health->fatal_report_work, mlx5_fw_fatal_reporter_err_work); |
| 799 | 809 | INIT_WORK(&health->report_work, mlx5_fw_reporter_err_work); |
| 800 | 810 | |
| 801 | 811 | return 0; |