Skip to content

Commit 545c4ab

Browse files
Bob Pearsonjgunthorpe
authored andcommitted
RDMA/rxe: Fix errant WARN_ONCE in rxe_completer()
In rxe_comp.c in rxe_completer() the function free_pkt() did not clear skb which triggered a warning at 'done:' and could possibly at 'exit:'. The WARN_ONCE() calls are not actually needed. The call to free_pkt() is moved to the end to clearly show that all skbs are freed. Fixes: 899aba8 ("RDMA/rxe: Fix FIXME in rxe_udp_encap_recv()") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bob Pearson <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 5e4a7cc commit 545c4ab

File tree

1 file changed

+23
-32
lines changed

1 file changed

+23
-32
lines changed

drivers/infiniband/sw/rxe/rxe_comp.c

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -547,14 +547,16 @@ int rxe_completer(void *arg)
547547
struct sk_buff *skb = NULL;
548548
struct rxe_pkt_info *pkt = NULL;
549549
enum comp_state state;
550+
int ret = 0;
550551

551552
rxe_add_ref(qp);
552553

553554
if (!qp->valid || qp->req.state == QP_STATE_ERROR ||
554555
qp->req.state == QP_STATE_RESET) {
555556
rxe_drain_resp_pkts(qp, qp->valid &&
556557
qp->req.state == QP_STATE_ERROR);
557-
goto exit;
558+
ret = -EAGAIN;
559+
goto done;
558560
}
559561

560562
if (qp->comp.timeout) {
@@ -564,8 +566,10 @@ int rxe_completer(void *arg)
564566
qp->comp.timeout_retry = 0;
565567
}
566568

567-
if (qp->req.need_retry)
568-
goto exit;
569+
if (qp->req.need_retry) {
570+
ret = -EAGAIN;
571+
goto done;
572+
}
569573

570574
state = COMPST_GET_ACK;
571575

@@ -636,8 +640,6 @@ int rxe_completer(void *arg)
636640
break;
637641

638642
case COMPST_DONE:
639-
if (pkt)
640-
free_pkt(pkt);
641643
goto done;
642644

643645
case COMPST_EXIT:
@@ -660,7 +662,8 @@ int rxe_completer(void *arg)
660662
qp->qp_timeout_jiffies)
661663
mod_timer(&qp->retrans_timer,
662664
jiffies + qp->qp_timeout_jiffies);
663-
goto exit;
665+
ret = -EAGAIN;
666+
goto done;
664667

665668
case COMPST_ERROR_RETRY:
666669
/* we come here if the retry timer fired and we did
@@ -672,18 +675,18 @@ int rxe_completer(void *arg)
672675
*/
673676

674677
/* there is nothing to retry in this case */
675-
if (!wqe || (wqe->state == wqe_state_posted))
676-
goto exit;
678+
if (!wqe || (wqe->state == wqe_state_posted)) {
679+
pr_warn("Retry attempted without a valid wqe\n");
680+
ret = -EAGAIN;
681+
goto done;
682+
}
677683

678684
/* if we've started a retry, don't start another
679685
* retry sequence, unless this is a timeout.
680686
*/
681687
if (qp->comp.started_retry &&
682-
!qp->comp.timeout_retry) {
683-
if (pkt)
684-
free_pkt(pkt);
688+
!qp->comp.timeout_retry)
685689
goto done;
686-
}
687690

688691
if (qp->comp.retry_cnt > 0) {
689692
if (qp->comp.retry_cnt != 7)
@@ -704,8 +707,6 @@ int rxe_completer(void *arg)
704707
qp->comp.started_retry = 1;
705708
rxe_run_task(&qp->req.task, 0);
706709
}
707-
if (pkt)
708-
free_pkt(pkt);
709710
goto done;
710711

711712
} else {
@@ -726,8 +727,8 @@ int rxe_completer(void *arg)
726727
mod_timer(&qp->rnr_nak_timer,
727728
jiffies + rnrnak_jiffies(aeth_syn(pkt)
728729
& ~AETH_TYPE_MASK));
729-
free_pkt(pkt);
730-
goto exit;
730+
ret = -EAGAIN;
731+
goto done;
731732
} else {
732733
rxe_counter_inc(rxe,
733734
RXE_CNT_RNR_RETRY_EXCEEDED);
@@ -740,25 +741,15 @@ int rxe_completer(void *arg)
740741
WARN_ON_ONCE(wqe->status == IB_WC_SUCCESS);
741742
do_complete(qp, wqe);
742743
rxe_qp_error(qp);
743-
if (pkt)
744-
free_pkt(pkt);
745-
goto exit;
744+
ret = -EAGAIN;
745+
goto done;
746746
}
747747
}
748748

749-
exit:
750-
/* we come here if we are done with processing and want the task to
751-
* exit from the loop calling us
752-
*/
753-
WARN_ON_ONCE(skb);
754-
rxe_drop_ref(qp);
755-
return -EAGAIN;
756-
757749
done:
758-
/* we come here if we have processed a packet we want the task to call
759-
* us again to see if there is anything else to do
760-
*/
761-
WARN_ON_ONCE(skb);
750+
if (pkt)
751+
free_pkt(pkt);
762752
rxe_drop_ref(qp);
763-
return 0;
753+
754+
return ret;
764755
}

0 commit comments

Comments
 (0)