mirror of
https://git.FreeBSD.org/src.git
synced 2025-02-04 17:15:50 +00:00
Move workqueue from mlx5en(4) to mlx5core.
This avoids creating more workqueues in mlx5core to do simple firmware command polling tasks. MFC after: 3 days Sponsored by: Mellanox Technologies
This commit is contained in:
parent
ebf7e777cd
commit
40218d734d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=347305
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved.
|
||||
* Copyright (c) 2013-2019, Mellanox Technologies, Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -505,6 +505,7 @@ struct mlx5_core_health {
|
||||
u32 prev;
|
||||
int miss_counter;
|
||||
u32 fatal_error;
|
||||
struct workqueue_struct *wq_watchdog;
|
||||
/* wq spinlock to synchronize draining */
|
||||
spinlock_t wq_lock;
|
||||
struct workqueue_struct *wq;
|
||||
|
@ -604,27 +604,28 @@ void mlx5_health_cleanup(struct mlx5_core_dev *dev)
|
||||
struct mlx5_core_health *health = &dev->priv.health;
|
||||
|
||||
destroy_workqueue(health->wq);
|
||||
destroy_workqueue(health->wq_watchdog);
|
||||
}
|
||||
|
||||
#define HEALTH_NAME "mlx5_health"
|
||||
int mlx5_health_init(struct mlx5_core_dev *dev)
|
||||
{
|
||||
struct mlx5_core_health *health;
|
||||
char *name;
|
||||
int len;
|
||||
char name[64];
|
||||
|
||||
health = &dev->priv.health;
|
||||
len = strlen(HEALTH_NAME) + strlen(dev_name(&dev->pdev->dev));
|
||||
name = kmalloc(len + 1, GFP_KERNEL);
|
||||
if (!name)
|
||||
return -ENOMEM;
|
||||
|
||||
snprintf(name, len, "%s:%s", HEALTH_NAME, dev_name(&dev->pdev->dev));
|
||||
snprintf(name, sizeof(name), "%s-rec", dev_name(&dev->pdev->dev));
|
||||
health->wq = create_singlethread_workqueue(name);
|
||||
kfree(name);
|
||||
if (!health->wq)
|
||||
return -ENOMEM;
|
||||
|
||||
snprintf(name, sizeof(name), "%s-wdg", dev_name(&dev->pdev->dev));
|
||||
health->wq_watchdog = create_singlethread_workqueue(name);
|
||||
if (!health->wq_watchdog) {
|
||||
destroy_workqueue(health->wq);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
spin_lock_init(&health->wq_lock);
|
||||
INIT_WORK(&health->work, health_care);
|
||||
INIT_DELAYED_WORK(&health->recover_work, health_recover);
|
||||
|
@ -4134,13 +4134,8 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev)
|
||||
goto err_free_sysctl;
|
||||
}
|
||||
|
||||
snprintf(unit, sizeof(unit), "mce%u_wq",
|
||||
device_get_unit(mdev->pdev->dev.bsddev));
|
||||
priv->wq = alloc_workqueue(unit, 0, 1);
|
||||
if (priv->wq == NULL) {
|
||||
if_printf(ifp, "%s: alloc_workqueue failed\n", __func__);
|
||||
goto err_free_sysctl;
|
||||
}
|
||||
/* reuse mlx5core's watchdog workqueue */
|
||||
priv->wq = mdev->priv.health.wq_watchdog;
|
||||
|
||||
err = mlx5_alloc_map_uar(mdev, &priv->cq_uar);
|
||||
if (err) {
|
||||
@ -4297,7 +4292,7 @@ err_unmap_free_uar:
|
||||
mlx5_unmap_free_uar(mdev, &priv->cq_uar);
|
||||
|
||||
err_free_wq:
|
||||
destroy_workqueue(priv->wq);
|
||||
flush_workqueue(priv->wq);
|
||||
|
||||
err_free_sysctl:
|
||||
sysctl_ctx_free(&priv->sysctl_ctx);
|
||||
@ -4383,7 +4378,7 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vpriv)
|
||||
mlx5_core_dealloc_pd(priv->mdev, priv->pdn);
|
||||
mlx5_unmap_free_uar(priv->mdev, &priv->cq_uar);
|
||||
mlx5e_disable_async_events(priv);
|
||||
destroy_workqueue(priv->wq);
|
||||
flush_workqueue(priv->wq);
|
||||
mlx5e_priv_mtx_destroy(priv);
|
||||
free(priv, M_MLX5EN);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user