.. | .. |
---|
79 | 79 | int mlx5_wq_cyc_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, |
---|
80 | 80 | void *wqc, struct mlx5_wq_cyc *wq, |
---|
81 | 81 | 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); |
---|
83 | 84 | |
---|
84 | 85 | int mlx5_wq_qp_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, |
---|
85 | 86 | void *qpc, struct mlx5_wq_qp *wq, |
---|
.. | .. |
---|
88 | 89 | int mlx5_cqwq_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, |
---|
89 | 90 | void *cqc, struct mlx5_cqwq *wq, |
---|
90 | 91 | struct mlx5_wq_ctrl *wq_ctrl); |
---|
91 | | -u32 mlx5_cqwq_get_size(struct mlx5_cqwq *wq); |
---|
92 | 92 | |
---|
93 | 93 | int mlx5_wq_ll_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, |
---|
94 | 94 | void *wqc, struct mlx5_wq_ll *wq, |
---|
95 | 95 | 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); |
---|
97 | 97 | |
---|
98 | 98 | 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 | +} |
---|
99 | 104 | |
---|
100 | 105 | static inline int mlx5_wq_cyc_is_full(struct mlx5_wq_cyc *wq) |
---|
101 | 106 | { |
---|
.. | .. |
---|
167 | 172 | return !equal && !smaller; |
---|
168 | 173 | } |
---|
169 | 174 | |
---|
| 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 | + |
---|
170 | 190 | static inline u32 mlx5_cqwq_ctr2ix(struct mlx5_cqwq *wq, u32 ctr) |
---|
171 | 191 | { |
---|
172 | 192 | return ctr & wq->fbc.sz_m1; |
---|
.. | .. |
---|
177 | 197 | return mlx5_cqwq_ctr2ix(wq, wq->cc); |
---|
178 | 198 | } |
---|
179 | 199 | |
---|
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) |
---|
181 | 201 | { |
---|
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; |
---|
183 | 208 | } |
---|
184 | 209 | |
---|
185 | 210 | static inline u32 mlx5_cqwq_get_ctr_wrap_cnt(struct mlx5_cqwq *wq, u32 ctr) |
---|
.. | .. |
---|
218 | 243 | return cqe; |
---|
219 | 244 | } |
---|
220 | 245 | |
---|
| 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 | + |
---|
221 | 251 | static inline int mlx5_wq_ll_is_full(struct mlx5_wq_ll *wq) |
---|
222 | 252 | { |
---|
223 | 253 | return wq->cur_sz == wq->fbc.sz_m1; |
---|
.. | .. |
---|
238 | 268 | return mlx5_frag_buf_get_wqe(&wq->fbc, ix); |
---|
239 | 269 | } |
---|
240 | 270 | |
---|
| 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 | + |
---|
241 | 278 | static inline void mlx5_wq_ll_push(struct mlx5_wq_ll *wq, u16 head_next) |
---|
242 | 279 | { |
---|
243 | 280 | wq->head = head_next; |
---|
.. | .. |
---|
258 | 295 | *wq->db = cpu_to_be32(wq->wqe_ctr); |
---|
259 | 296 | } |
---|
260 | 297 | |
---|
| 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 | + |
---|
261 | 308 | #endif /* __MLX5_WQ_H__ */ |
---|