Commit 3eac5d94 authored by Aya Levin's avatar Aya Levin Committed by Jakub Kicinski

net/mlx5: Rename events notifier header

Change the naming of events notifier head to clarify that it handles
only firmware events. Coming patches in the set, add event notifier for
software events.
Signed-off-by: default avatarAya Levin <ayal@nvidia.com>
Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent f679247f
...@@ -23,7 +23,7 @@ static int temp_warn(struct notifier_block *, unsigned long, void *); ...@@ -23,7 +23,7 @@ static int temp_warn(struct notifier_block *, unsigned long, void *);
static int port_module(struct notifier_block *, unsigned long, void *); static int port_module(struct notifier_block *, unsigned long, void *);
static int pcie_core(struct notifier_block *, unsigned long, void *); static int pcie_core(struct notifier_block *, unsigned long, void *);
/* handler which forwards the event to events->nh, driver notifiers */ /* handler which forwards the event to events->fw_nh, driver notifiers */
static int forward_event(struct notifier_block *, unsigned long, void *); static int forward_event(struct notifier_block *, unsigned long, void *);
static struct mlx5_nb events_nbs_ref[] = { static struct mlx5_nb events_nbs_ref[] = {
...@@ -55,8 +55,8 @@ struct mlx5_events { ...@@ -55,8 +55,8 @@ struct mlx5_events {
struct mlx5_core_dev *dev; struct mlx5_core_dev *dev;
struct workqueue_struct *wq; struct workqueue_struct *wq;
struct mlx5_event_nb notifiers[ARRAY_SIZE(events_nbs_ref)]; struct mlx5_event_nb notifiers[ARRAY_SIZE(events_nbs_ref)];
/* driver notifier chain */ /* driver notifier chain for fw events */
struct atomic_notifier_head nh; struct atomic_notifier_head fw_nh;
/* port module events stats */ /* port module events stats */
struct mlx5_pme_stats pme_stats; struct mlx5_pme_stats pme_stats;
/*pcie_core*/ /*pcie_core*/
...@@ -331,7 +331,7 @@ static int forward_event(struct notifier_block *nb, unsigned long event, void *d ...@@ -331,7 +331,7 @@ static int forward_event(struct notifier_block *nb, unsigned long event, void *d
mlx5_core_dbg(events->dev, "Async eqe type %s, subtype (%d) forward to interfaces\n", mlx5_core_dbg(events->dev, "Async eqe type %s, subtype (%d) forward to interfaces\n",
eqe_type_str(eqe->type), eqe->sub_type); eqe_type_str(eqe->type), eqe->sub_type);
atomic_notifier_call_chain(&events->nh, event, data); atomic_notifier_call_chain(&events->fw_nh, event, data);
return NOTIFY_OK; return NOTIFY_OK;
} }
...@@ -342,7 +342,7 @@ int mlx5_events_init(struct mlx5_core_dev *dev) ...@@ -342,7 +342,7 @@ int mlx5_events_init(struct mlx5_core_dev *dev)
if (!events) if (!events)
return -ENOMEM; return -ENOMEM;
ATOMIC_INIT_NOTIFIER_HEAD(&events->nh); ATOMIC_INIT_NOTIFIER_HEAD(&events->fw_nh);
events->dev = dev; events->dev = dev;
dev->priv.events = events; dev->priv.events = events;
events->wq = create_singlethread_workqueue("mlx5_events"); events->wq = create_singlethread_workqueue("mlx5_events");
...@@ -383,11 +383,14 @@ void mlx5_events_stop(struct mlx5_core_dev *dev) ...@@ -383,11 +383,14 @@ void mlx5_events_stop(struct mlx5_core_dev *dev)
flush_workqueue(events->wq); flush_workqueue(events->wq);
} }
/* This API is used only for processing and forwarding firmware
* events to mlx5 consumer.
*/
int mlx5_notifier_register(struct mlx5_core_dev *dev, struct notifier_block *nb) int mlx5_notifier_register(struct mlx5_core_dev *dev, struct notifier_block *nb)
{ {
struct mlx5_events *events = dev->priv.events; struct mlx5_events *events = dev->priv.events;
return atomic_notifier_chain_register(&events->nh, nb); return atomic_notifier_chain_register(&events->fw_nh, nb);
} }
EXPORT_SYMBOL(mlx5_notifier_register); EXPORT_SYMBOL(mlx5_notifier_register);
...@@ -395,11 +398,11 @@ int mlx5_notifier_unregister(struct mlx5_core_dev *dev, struct notifier_block *n ...@@ -395,11 +398,11 @@ int mlx5_notifier_unregister(struct mlx5_core_dev *dev, struct notifier_block *n
{ {
struct mlx5_events *events = dev->priv.events; struct mlx5_events *events = dev->priv.events;
return atomic_notifier_chain_unregister(&events->nh, nb); return atomic_notifier_chain_unregister(&events->fw_nh, nb);
} }
EXPORT_SYMBOL(mlx5_notifier_unregister); EXPORT_SYMBOL(mlx5_notifier_unregister);
int mlx5_notifier_call_chain(struct mlx5_events *events, unsigned int event, void *data) int mlx5_notifier_call_chain(struct mlx5_events *events, unsigned int event, void *data)
{ {
return atomic_notifier_call_chain(&events->nh, event, data); return atomic_notifier_call_chain(&events->fw_nh, event, data);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment