mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-01 11:21:51 +00:00
net/mlx5: Introduce trigger_health_work function
Introduce new function for entering bad-health state. This function will be called from FPGA-related logic in a later patch from asynchronous event (IRQ) context, for that we change the spin lock to an IRQ-safe one. Signed-off-by: Ilan Tayari <ilant@mellanox.com> Reviewed-by: Boris Pismenny <borisp@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
parent
2e9d3e83ab
commit
0179720d6b
2 changed files with 22 additions and 11 deletions
|
@ -185,6 +185,7 @@ static void health_care(struct work_struct *work)
|
||||||
struct mlx5_core_health *health;
|
struct mlx5_core_health *health;
|
||||||
struct mlx5_core_dev *dev;
|
struct mlx5_core_dev *dev;
|
||||||
struct mlx5_priv *priv;
|
struct mlx5_priv *priv;
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
health = container_of(work, struct mlx5_core_health, work);
|
health = container_of(work, struct mlx5_core_health, work);
|
||||||
priv = container_of(health, struct mlx5_priv, health);
|
priv = container_of(health, struct mlx5_priv, health);
|
||||||
|
@ -192,13 +193,13 @@ static void health_care(struct work_struct *work)
|
||||||
mlx5_core_warn(dev, "handling bad device here\n");
|
mlx5_core_warn(dev, "handling bad device here\n");
|
||||||
mlx5_handle_bad_state(dev);
|
mlx5_handle_bad_state(dev);
|
||||||
|
|
||||||
spin_lock(&health->wq_lock);
|
spin_lock_irqsave(&health->wq_lock, flags);
|
||||||
if (!test_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags))
|
if (!test_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags))
|
||||||
schedule_delayed_work(&health->recover_work, recover_delay);
|
schedule_delayed_work(&health->recover_work, recover_delay);
|
||||||
else
|
else
|
||||||
dev_err(&dev->pdev->dev,
|
dev_err(&dev->pdev->dev,
|
||||||
"new health works are not permitted at this stage\n");
|
"new health works are not permitted at this stage\n");
|
||||||
spin_unlock(&health->wq_lock);
|
spin_unlock_irqrestore(&health->wq_lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *hsynd_str(u8 synd)
|
static const char *hsynd_str(u8 synd)
|
||||||
|
@ -269,6 +270,20 @@ static unsigned long get_next_poll_jiffies(void)
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mlx5_trigger_health_work(struct mlx5_core_dev *dev)
|
||||||
|
{
|
||||||
|
struct mlx5_core_health *health = &dev->priv.health;
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
|
spin_lock_irqsave(&health->wq_lock, flags);
|
||||||
|
if (!test_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags))
|
||||||
|
queue_work(health->wq, &health->work);
|
||||||
|
else
|
||||||
|
dev_err(&dev->pdev->dev,
|
||||||
|
"new health works are not permitted at this stage\n");
|
||||||
|
spin_unlock_irqrestore(&health->wq_lock, flags);
|
||||||
|
}
|
||||||
|
|
||||||
static void poll_health(unsigned long data)
|
static void poll_health(unsigned long data)
|
||||||
{
|
{
|
||||||
struct mlx5_core_dev *dev = (struct mlx5_core_dev *)data;
|
struct mlx5_core_dev *dev = (struct mlx5_core_dev *)data;
|
||||||
|
@ -297,13 +312,7 @@ static void poll_health(unsigned long data)
|
||||||
if (in_fatal(dev) && !health->sick) {
|
if (in_fatal(dev) && !health->sick) {
|
||||||
health->sick = true;
|
health->sick = true;
|
||||||
print_health_info(dev);
|
print_health_info(dev);
|
||||||
spin_lock(&health->wq_lock);
|
mlx5_trigger_health_work(dev);
|
||||||
if (!test_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags))
|
|
||||||
queue_work(health->wq, &health->work);
|
|
||||||
else
|
|
||||||
dev_err(&dev->pdev->dev,
|
|
||||||
"new health works are not permitted at this stage\n");
|
|
||||||
spin_unlock(&health->wq_lock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,10 +342,11 @@ void mlx5_stop_health_poll(struct mlx5_core_dev *dev)
|
||||||
void mlx5_drain_health_wq(struct mlx5_core_dev *dev)
|
void mlx5_drain_health_wq(struct mlx5_core_dev *dev)
|
||||||
{
|
{
|
||||||
struct mlx5_core_health *health = &dev->priv.health;
|
struct mlx5_core_health *health = &dev->priv.health;
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
spin_lock(&health->wq_lock);
|
spin_lock_irqsave(&health->wq_lock, flags);
|
||||||
set_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags);
|
set_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags);
|
||||||
spin_unlock(&health->wq_lock);
|
spin_unlock_irqrestore(&health->wq_lock, flags);
|
||||||
cancel_delayed_work_sync(&health->recover_work);
|
cancel_delayed_work_sync(&health->recover_work);
|
||||||
cancel_work_sync(&health->work);
|
cancel_work_sync(&health->work);
|
||||||
}
|
}
|
||||||
|
|
|
@ -915,6 +915,7 @@ int mlx5_health_init(struct mlx5_core_dev *dev);
|
||||||
void mlx5_start_health_poll(struct mlx5_core_dev *dev);
|
void mlx5_start_health_poll(struct mlx5_core_dev *dev);
|
||||||
void mlx5_stop_health_poll(struct mlx5_core_dev *dev);
|
void mlx5_stop_health_poll(struct mlx5_core_dev *dev);
|
||||||
void mlx5_drain_health_wq(struct mlx5_core_dev *dev);
|
void mlx5_drain_health_wq(struct mlx5_core_dev *dev);
|
||||||
|
void mlx5_trigger_health_work(struct mlx5_core_dev *dev);
|
||||||
int mlx5_buf_alloc_node(struct mlx5_core_dev *dev, int size,
|
int mlx5_buf_alloc_node(struct mlx5_core_dev *dev, int size,
|
||||||
struct mlx5_buf *buf, int node);
|
struct mlx5_buf *buf, int node);
|
||||||
int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, struct mlx5_buf *buf);
|
int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, struct mlx5_buf *buf);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue