forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/net/ethernet/mellanox/mlx5/core/wq.h
....@@ -79,7 +79,8 @@
7979 int mlx5_wq_cyc_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param,
8080 void *wqc, struct mlx5_wq_cyc *wq,
8181 struct mlx5_wq_ctrl *wq_ctrl);
82
-u32 mlx5_wq_cyc_get_size(struct mlx5_wq_cyc *wq);
82
+void mlx5_wq_cyc_wqe_dump(struct mlx5_wq_cyc *wq, u16 ix, u8 nstrides);
83
+void mlx5_wq_cyc_reset(struct mlx5_wq_cyc *wq);
8384
8485 int mlx5_wq_qp_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param,
8586 void *qpc, struct mlx5_wq_qp *wq,
....@@ -88,14 +89,18 @@
8889 int mlx5_cqwq_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param,
8990 void *cqc, struct mlx5_cqwq *wq,
9091 struct mlx5_wq_ctrl *wq_ctrl);
91
-u32 mlx5_cqwq_get_size(struct mlx5_cqwq *wq);
9292
9393 int mlx5_wq_ll_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param,
9494 void *wqc, struct mlx5_wq_ll *wq,
9595 struct mlx5_wq_ctrl *wq_ctrl);
96
-u32 mlx5_wq_ll_get_size(struct mlx5_wq_ll *wq);
96
+void mlx5_wq_ll_reset(struct mlx5_wq_ll *wq);
9797
9898 void mlx5_wq_destroy(struct mlx5_wq_ctrl *wq_ctrl);
99
+
100
+static inline u32 mlx5_wq_cyc_get_size(struct mlx5_wq_cyc *wq)
101
+{
102
+ return (u32)wq->fbc.sz_m1 + 1;
103
+}
99104
100105 static inline int mlx5_wq_cyc_is_full(struct mlx5_wq_cyc *wq)
101106 {
....@@ -167,6 +172,21 @@
167172 return !equal && !smaller;
168173 }
169174
175
+static inline u16 mlx5_wq_cyc_get_counter(struct mlx5_wq_cyc *wq)
176
+{
177
+ return wq->wqe_ctr;
178
+}
179
+
180
+static inline u32 mlx5_cqwq_get_size(struct mlx5_cqwq *wq)
181
+{
182
+ return wq->fbc.sz_m1 + 1;
183
+}
184
+
185
+static inline u8 mlx5_cqwq_get_log_stride_size(struct mlx5_cqwq *wq)
186
+{
187
+ return wq->fbc.log_stride;
188
+}
189
+
170190 static inline u32 mlx5_cqwq_ctr2ix(struct mlx5_cqwq *wq, u32 ctr)
171191 {
172192 return ctr & wq->fbc.sz_m1;
....@@ -177,9 +197,14 @@
177197 return mlx5_cqwq_ctr2ix(wq, wq->cc);
178198 }
179199
180
-static inline void *mlx5_cqwq_get_wqe(struct mlx5_cqwq *wq, u32 ix)
200
+static inline struct mlx5_cqe64 *mlx5_cqwq_get_wqe(struct mlx5_cqwq *wq, u32 ix)
181201 {
182
- return mlx5_frag_buf_get_wqe(&wq->fbc, ix);
202
+ struct mlx5_cqe64 *cqe = mlx5_frag_buf_get_wqe(&wq->fbc, ix);
203
+
204
+ /* For 128B CQEs the data is in the last 64B */
205
+ cqe += wq->fbc.log_stride == 7;
206
+
207
+ return cqe;
183208 }
184209
185210 static inline u32 mlx5_cqwq_get_ctr_wrap_cnt(struct mlx5_cqwq *wq, u32 ctr)
....@@ -218,6 +243,11 @@
218243 return cqe;
219244 }
220245
246
+static inline u32 mlx5_wq_ll_get_size(struct mlx5_wq_ll *wq)
247
+{
248
+ return (u32)wq->fbc.sz_m1 + 1;
249
+}
250
+
221251 static inline int mlx5_wq_ll_is_full(struct mlx5_wq_ll *wq)
222252 {
223253 return wq->cur_sz == wq->fbc.sz_m1;
....@@ -238,6 +268,13 @@
238268 return mlx5_frag_buf_get_wqe(&wq->fbc, ix);
239269 }
240270
271
+static inline u16 mlx5_wq_ll_get_wqe_next_ix(struct mlx5_wq_ll *wq, u16 ix)
272
+{
273
+ struct mlx5_wqe_srq_next_seg *wqe = mlx5_wq_ll_get_wqe(wq, ix);
274
+
275
+ return be16_to_cpu(wqe->next_wqe_index);
276
+}
277
+
241278 static inline void mlx5_wq_ll_push(struct mlx5_wq_ll *wq, u16 head_next)
242279 {
243280 wq->head = head_next;
....@@ -258,4 +295,14 @@
258295 *wq->db = cpu_to_be32(wq->wqe_ctr);
259296 }
260297
298
+static inline u16 mlx5_wq_ll_get_head(struct mlx5_wq_ll *wq)
299
+{
300
+ return wq->head;
301
+}
302
+
303
+static inline u16 mlx5_wq_ll_get_counter(struct mlx5_wq_ll *wq)
304
+{
305
+ return wq->wqe_ctr;
306
+}
307
+
261308 #endif /* __MLX5_WQ_H__ */