Commit 4e2df04a authored by Saeed Mahameed's avatar Saeed Mahameed

net/mlx5: Forward SRQ resource events

Allow forwarding of SRQ events to mlx5_core interfaces, e.g. mlx5_ib.
Use mlx5_notifier_register/unregister in srq.c in order to allow seamless
transition of srq.c to infiniband subsystem.
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 451be51c
...@@ -44,6 +44,9 @@ static struct mlx5_nb events_nbs_ref[] = { ...@@ -44,6 +44,9 @@ static struct mlx5_nb events_nbs_ref[] = {
{.nb.notifier_call = forward_event, .event_type = MLX5_EVENT_TYPE_PATH_MIG_FAILED }, {.nb.notifier_call = forward_event, .event_type = MLX5_EVENT_TYPE_PATH_MIG_FAILED },
{.nb.notifier_call = forward_event, .event_type = MLX5_EVENT_TYPE_WQ_INVAL_REQ_ERROR }, {.nb.notifier_call = forward_event, .event_type = MLX5_EVENT_TYPE_WQ_INVAL_REQ_ERROR },
{.nb.notifier_call = forward_event, .event_type = MLX5_EVENT_TYPE_WQ_ACCESS_ERROR }, {.nb.notifier_call = forward_event, .event_type = MLX5_EVENT_TYPE_WQ_ACCESS_ERROR },
/* SRQ events */
{.nb.notifier_call = forward_event, .event_type = MLX5_EVENT_TYPE_SRQ_CATAS_ERROR },
{.nb.notifier_call = forward_event, .event_type = MLX5_EVENT_TYPE_SRQ_RQ_LIMIT },
}; };
struct mlx5_events { struct mlx5_events {
......
...@@ -40,15 +40,21 @@ ...@@ -40,15 +40,21 @@
#include "mlx5_core.h" #include "mlx5_core.h"
#include "lib/eq.h" #include "lib/eq.h"
static int srq_event_notifier(struct mlx5_srq_table *table, static int srq_event_notifier(struct notifier_block *nb,
unsigned long type, void *data) unsigned long type, void *data)
{ {
struct mlx5_srq_table *table;
struct mlx5_core_dev *dev; struct mlx5_core_dev *dev;
struct mlx5_core_srq *srq; struct mlx5_core_srq *srq;
struct mlx5_priv *priv; struct mlx5_priv *priv;
struct mlx5_eqe *eqe; struct mlx5_eqe *eqe;
u32 srqn; u32 srqn;
if (type != MLX5_EVENT_TYPE_SRQ_CATAS_ERROR &&
type != MLX5_EVENT_TYPE_SRQ_RQ_LIMIT)
return NOTIFY_DONE;
table = container_of(nb, struct mlx5_srq_table, nb);
priv = container_of(table, struct mlx5_priv, srq_table); priv = container_of(table, struct mlx5_priv, srq_table);
dev = container_of(priv, struct mlx5_core_dev, priv); dev = container_of(priv, struct mlx5_core_dev, priv);
...@@ -77,26 +83,6 @@ static int srq_event_notifier(struct mlx5_srq_table *table, ...@@ -77,26 +83,6 @@ static int srq_event_notifier(struct mlx5_srq_table *table,
return NOTIFY_OK; return NOTIFY_OK;
} }
static int catas_err_notifier(struct notifier_block *nb,
unsigned long type, void *data)
{
struct mlx5_srq_table *table;
table = mlx5_nb_cof(nb, struct mlx5_srq_table, catas_err_nb);
/* type == MLX5_EVENT_TYPE_SRQ_CATAS_ERROR */
return srq_event_notifier(table, type, data);
}
static int rq_limit_notifier(struct notifier_block *nb,
unsigned long type, void *data)
{
struct mlx5_srq_table *table;
table = mlx5_nb_cof(nb, struct mlx5_srq_table, rq_limit_nb);
/* type == MLX5_EVENT_TYPE_SRQ_RQ_LIMIT */
return srq_event_notifier(table, type, data);
}
static int get_pas_size(struct mlx5_srq_attr *in) static int get_pas_size(struct mlx5_srq_attr *in)
{ {
u32 log_page_size = in->log_page_size + 12; u32 log_page_size = in->log_page_size + 12;
...@@ -743,17 +729,13 @@ void mlx5_init_srq_table(struct mlx5_core_dev *dev) ...@@ -743,17 +729,13 @@ void mlx5_init_srq_table(struct mlx5_core_dev *dev)
spin_lock_init(&table->lock); spin_lock_init(&table->lock);
INIT_RADIX_TREE(&table->tree, GFP_ATOMIC); INIT_RADIX_TREE(&table->tree, GFP_ATOMIC);
MLX5_NB_INIT(&table->catas_err_nb, catas_err_notifier, SRQ_CATAS_ERROR); table->nb.notifier_call = srq_event_notifier;
mlx5_eq_notifier_register(dev, &table->catas_err_nb); mlx5_notifier_register(dev, &table->nb);
MLX5_NB_INIT(&table->rq_limit_nb, rq_limit_notifier, SRQ_RQ_LIMIT);
mlx5_eq_notifier_register(dev, &table->rq_limit_nb);
} }
void mlx5_cleanup_srq_table(struct mlx5_core_dev *dev) void mlx5_cleanup_srq_table(struct mlx5_core_dev *dev)
{ {
struct mlx5_srq_table *table = &dev->priv.srq_table; struct mlx5_srq_table *table = &dev->priv.srq_table;
mlx5_eq_notifier_unregister(dev, &table->rq_limit_nb); mlx5_notifier_unregister(dev, &table->nb);
mlx5_eq_notifier_unregister(dev, &table->catas_err_nb);
} }
...@@ -465,8 +465,7 @@ struct mlx5_qp_table { ...@@ -465,8 +465,7 @@ struct mlx5_qp_table {
}; };
struct mlx5_srq_table { struct mlx5_srq_table {
struct mlx5_nb catas_err_nb; struct notifier_block nb;
struct mlx5_nb rq_limit_nb;
/* protect radix tree /* protect radix tree
*/ */
spinlock_t lock; spinlock_t lock;
......
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