aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormajd@mellanox.com <majd@mellanox.com>2016-01-14 12:13:01 -0500
committerDoug Ledford <dledford@redhat.com>2016-01-21 12:01:09 -0500
commita14c2d4beee5633081d344f130b81e5ee76e4585 (patch)
tree12d052dc649cfc8be35147e04578296970e106dc
parente2013b212f9f201c71fc5826ce41f39ebece0852 (diff)
net/mlx5_core: Warn on unsupported events of QP/RQ/SQ
When an event arrives on QP/RQ/SQ, check whether it's supported, and print a warning message otherwise. Signed-off-by: Majd Dibbiny <majd@mellanox.com> Reviewed-by: Matan Barak <matanb@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/qp.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/qp.c b/drivers/net/ethernet/mellanox/mlx5/core/qp.c
index 431885f77369..c46024910736 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/qp.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/qp.c
@@ -68,6 +68,52 @@ void mlx5_core_put_rsc(struct mlx5_core_rsc_common *common)
68 complete(&common->free); 68 complete(&common->free);
69} 69}
70 70
71static u64 qp_allowed_event_types(void)
72{
73 u64 mask;
74
75 mask = BIT(MLX5_EVENT_TYPE_PATH_MIG) |
76 BIT(MLX5_EVENT_TYPE_COMM_EST) |
77 BIT(MLX5_EVENT_TYPE_SQ_DRAINED) |
78 BIT(MLX5_EVENT_TYPE_SRQ_LAST_WQE) |
79 BIT(MLX5_EVENT_TYPE_WQ_CATAS_ERROR) |
80 BIT(MLX5_EVENT_TYPE_PATH_MIG_FAILED) |
81 BIT(MLX5_EVENT_TYPE_WQ_INVAL_REQ_ERROR) |
82 BIT(MLX5_EVENT_TYPE_WQ_ACCESS_ERROR);
83
84 return mask;
85}
86
87static u64 rq_allowed_event_types(void)
88{
89 u64 mask;
90
91 mask = BIT(MLX5_EVENT_TYPE_SRQ_LAST_WQE) |
92 BIT(MLX5_EVENT_TYPE_WQ_CATAS_ERROR);
93
94 return mask;
95}
96
97static u64 sq_allowed_event_types(void)
98{
99 return BIT(MLX5_EVENT_TYPE_WQ_CATAS_ERROR);
100}
101
102static bool is_event_type_allowed(int rsc_type, int event_type)
103{
104 switch (rsc_type) {
105 case MLX5_EVENT_QUEUE_TYPE_QP:
106 return BIT(event_type) & qp_allowed_event_types();
107 case MLX5_EVENT_QUEUE_TYPE_RQ:
108 return BIT(event_type) & rq_allowed_event_types();
109 case MLX5_EVENT_QUEUE_TYPE_SQ:
110 return BIT(event_type) & sq_allowed_event_types();
111 default:
112 WARN(1, "Event arrived for unknown resource type");
113 return false;
114 }
115}
116
71void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type) 117void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type)
72{ 118{
73 struct mlx5_core_rsc_common *common = mlx5_get_rsc(dev, rsn); 119 struct mlx5_core_rsc_common *common = mlx5_get_rsc(dev, rsn);
@@ -76,6 +122,12 @@ void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type)
76 if (!common) 122 if (!common)
77 return; 123 return;
78 124
125 if (!is_event_type_allowed((rsn >> MLX5_USER_INDEX_LEN), event_type)) {
126 mlx5_core_warn(dev, "event 0x%.2x is not allowed on resource 0x%.8x\n",
127 event_type, rsn);
128 return;
129 }
130
79 switch (common->res) { 131 switch (common->res) {
80 case MLX5_RES_QP: 132 case MLX5_RES_QP:
81 case MLX5_RES_RQ: 133 case MLX5_RES_RQ: