aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mlx5/eq.h
diff options
context:
space:
mode:
authorSaeed Mahameed <saeedm@mellanox.com>2018-11-20 17:12:18 -0500
committerSaeed Mahameed <saeedm@mellanox.com>2018-11-26 16:39:33 -0500
commit0f597ed435b9ea1296e25474b762bedceba97a50 (patch)
tree524da4980b9136d50dca0e0e2ef4f3d7ddbb7af0 /include/linux/mlx5/eq.h
parent6d2d6fc83a281d51863fb5d08b59333ed1b46cc1 (diff)
net/mlx5: EQ, Introduce atomic notifier chain subscription API
Use atomic_notifier_chain to fire firmware events at internal mlx5 core components such as eswitch/fpga/clock/FW tracer/etc.., this is to avoid explicit calls from low level mlx5_core to upper components and to simplify the mlx5_core API for future developments. Simply provide register/unregister notifiers API and call the notifier chain on firmware async events. Example: to subscribe to a FW event: struct mlx5_nb port_event; MLX5_NB_INIT(&port_event, port_event_handler, PORT_CHANGE); mlx5_eq_notifier_register(mdev, &port_event); where: - port_event_handler is the notifier block callback. - PORT_EVENT is the suffix of MLX5_EVENT_TYPE_PORT_CHANGE. The above will guarantee that port_event_handler will receive all FW events of the type MLX5_EVENT_TYPE_PORT_CHANGE. To receive all FW/HW events one can subscribe to MLX5_EVENT_TYPE_NOTIFY_ANY. The next few patches will start moving all mlx5 core components to use this new API and cleanup mlx5_eq_async_int misx handler from component explicit calls and specific logic. Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Diffstat (limited to 'include/linux/mlx5/eq.h')
-rw-r--r--include/linux/mlx5/eq.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/include/linux/mlx5/eq.h b/include/linux/mlx5/eq.h
index 71d82c5a1a02..00045cc4ea11 100644
--- a/include/linux/mlx5/eq.h
+++ b/include/linux/mlx5/eq.h
@@ -4,8 +4,6 @@
4#ifndef MLX5_CORE_EQ_H 4#ifndef MLX5_CORE_EQ_H
5#define MLX5_CORE_EQ_H 5#define MLX5_CORE_EQ_H
6 6
7#include <linux/mlx5/driver.h>
8
9enum { 7enum {
10 MLX5_EQ_PAGEREQ_IDX = 0, 8 MLX5_EQ_PAGEREQ_IDX = 0,
11 MLX5_EQ_CMD_IDX = 1, 9 MLX5_EQ_CMD_IDX = 1,
@@ -22,6 +20,7 @@ enum {
22#define MLX5_NUM_SPARE_EQE (0x80) 20#define MLX5_NUM_SPARE_EQE (0x80)
23 21
24struct mlx5_eq; 22struct mlx5_eq;
23struct mlx5_core_dev;
25 24
26struct mlx5_eq_param { 25struct mlx5_eq_param {
27 u8 index; 26 u8 index;
@@ -57,4 +56,17 @@ static inline u32 mlx5_eq_update_cc(struct mlx5_eq *eq, u32 cc)
57 return cc; 56 return cc;
58} 57}
59 58
59struct mlx5_nb {
60 struct notifier_block nb;
61 u8 event_type;
62};
63
64#define mlx5_nb_cof(ptr, type, member) \
65 (container_of(container_of(ptr, struct mlx5_nb, nb), type, member))
66
67#define MLX5_NB_INIT(name, handler, event) do { \
68 (name)->nb.notifier_call = handler; \
69 (name)->event_type = MLX5_EVENT_TYPE_##event; \
70} while (0)
71
60#endif /* MLX5_CORE_EQ_H */ 72#endif /* MLX5_CORE_EQ_H */