@@ -330,6 +330,22 @@ static void mlx5_handle_error_cqe(struct mlx5_ib_dev *dev,
330
330
dump_cqe (dev , cqe );
331
331
}
332
332
333
+ static void handle_atomics (struct mlx5_ib_qp * qp , struct mlx5_cqe64 * cqe64 ,
334
+ u16 tail , u16 head )
335
+ {
336
+ u16 idx ;
337
+
338
+ do {
339
+ idx = tail & (qp -> sq .wqe_cnt - 1 );
340
+ if (idx == head )
341
+ break ;
342
+
343
+ tail = qp -> sq .w_list [idx ].next ;
344
+ } while (1 );
345
+ tail = qp -> sq .w_list [idx ].next ;
346
+ qp -> sq .last_poll = tail ;
347
+ }
348
+
333
349
static void free_cq_buf (struct mlx5_ib_dev * dev , struct mlx5_ib_cq_buf * buf )
334
350
{
335
351
mlx5_frag_buf_free (dev -> mdev , & buf -> frag_buf );
@@ -368,7 +384,7 @@ static void get_sig_err_item(struct mlx5_sig_err_cqe *cqe,
368
384
}
369
385
370
386
static void sw_comp (struct mlx5_ib_qp * qp , int num_entries , struct ib_wc * wc ,
371
- int * npolled , int is_send )
387
+ int * npolled , bool is_send )
372
388
{
373
389
struct mlx5_ib_wq * wq ;
374
390
unsigned int cur ;
@@ -383,10 +399,16 @@ static void sw_comp(struct mlx5_ib_qp *qp, int num_entries, struct ib_wc *wc,
383
399
return ;
384
400
385
401
for (i = 0 ; i < cur && np < num_entries ; i ++ ) {
386
- wc -> wr_id = wq -> wrid [wq -> tail & (wq -> wqe_cnt - 1 )];
402
+ unsigned int idx ;
403
+
404
+ idx = (is_send ) ? wq -> last_poll : wq -> tail ;
405
+ idx &= (wq -> wqe_cnt - 1 );
406
+ wc -> wr_id = wq -> wrid [idx ];
387
407
wc -> status = IB_WC_WR_FLUSH_ERR ;
388
408
wc -> vendor_err = MLX5_CQE_SYNDROME_WR_FLUSH_ERR ;
389
409
wq -> tail ++ ;
410
+ if (is_send )
411
+ wq -> last_poll = wq -> w_list [idx ].next ;
390
412
np ++ ;
391
413
wc -> qp = & qp -> ibqp ;
392
414
wc ++ ;
@@ -473,6 +495,7 @@ static int mlx5_poll_one(struct mlx5_ib_cq *cq,
473
495
wqe_ctr = be16_to_cpu (cqe64 -> wqe_counter );
474
496
idx = wqe_ctr & (wq -> wqe_cnt - 1 );
475
497
handle_good_req (wc , cqe64 , wq , idx );
498
+ handle_atomics (* cur_qp , cqe64 , wq -> last_poll , idx );
476
499
wc -> wr_id = wq -> wrid [idx ];
477
500
wq -> tail = wq -> wqe_head [idx ] + 1 ;
478
501
wc -> status = IB_WC_SUCCESS ;
0 commit comments