提交 545c4ab4 编写于 作者: B Bob Pearson 提交者: Jason Gunthorpe

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: 899aba89 ("RDMA/rxe: Fix FIXME in rxe_udp_encap_recv()")
Link: https://lore.kernel.org/r/20210304192048.2958-1-rpearson@hpe.comSigned-off-by: NBob Pearson <rpearsonhpe@gmail.com>
Signed-off-by: NJason Gunthorpe <jgg@nvidia.com>
上级 5e4a7ccc
...@@ -547,6 +547,7 @@ int rxe_completer(void *arg) ...@@ -547,6 +547,7 @@ int rxe_completer(void *arg)
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
struct rxe_pkt_info *pkt = NULL; struct rxe_pkt_info *pkt = NULL;
enum comp_state state; enum comp_state state;
int ret = 0;
rxe_add_ref(qp); rxe_add_ref(qp);
...@@ -554,7 +555,8 @@ int rxe_completer(void *arg) ...@@ -554,7 +555,8 @@ int rxe_completer(void *arg)
qp->req.state == QP_STATE_RESET) { qp->req.state == QP_STATE_RESET) {
rxe_drain_resp_pkts(qp, qp->valid && rxe_drain_resp_pkts(qp, qp->valid &&
qp->req.state == QP_STATE_ERROR); qp->req.state == QP_STATE_ERROR);
goto exit; ret = -EAGAIN;
goto done;
} }
if (qp->comp.timeout) { if (qp->comp.timeout) {
...@@ -564,8 +566,10 @@ int rxe_completer(void *arg) ...@@ -564,8 +566,10 @@ int rxe_completer(void *arg)
qp->comp.timeout_retry = 0; qp->comp.timeout_retry = 0;
} }
if (qp->req.need_retry) if (qp->req.need_retry) {
goto exit; ret = -EAGAIN;
goto done;
}
state = COMPST_GET_ACK; state = COMPST_GET_ACK;
...@@ -636,8 +640,6 @@ int rxe_completer(void *arg) ...@@ -636,8 +640,6 @@ int rxe_completer(void *arg)
break; break;
case COMPST_DONE: case COMPST_DONE:
if (pkt)
free_pkt(pkt);
goto done; goto done;
case COMPST_EXIT: case COMPST_EXIT:
...@@ -660,7 +662,8 @@ int rxe_completer(void *arg) ...@@ -660,7 +662,8 @@ int rxe_completer(void *arg)
qp->qp_timeout_jiffies) qp->qp_timeout_jiffies)
mod_timer(&qp->retrans_timer, mod_timer(&qp->retrans_timer,
jiffies + qp->qp_timeout_jiffies); jiffies + qp->qp_timeout_jiffies);
goto exit; ret = -EAGAIN;
goto done;
case COMPST_ERROR_RETRY: case COMPST_ERROR_RETRY:
/* we come here if the retry timer fired and we did /* we come here if the retry timer fired and we did
...@@ -672,18 +675,18 @@ int rxe_completer(void *arg) ...@@ -672,18 +675,18 @@ int rxe_completer(void *arg)
*/ */
/* there is nothing to retry in this case */ /* there is nothing to retry in this case */
if (!wqe || (wqe->state == wqe_state_posted)) if (!wqe || (wqe->state == wqe_state_posted)) {
goto exit; pr_warn("Retry attempted without a valid wqe\n");
ret = -EAGAIN;
goto done;
}
/* if we've started a retry, don't start another /* if we've started a retry, don't start another
* retry sequence, unless this is a timeout. * retry sequence, unless this is a timeout.
*/ */
if (qp->comp.started_retry && if (qp->comp.started_retry &&
!qp->comp.timeout_retry) { !qp->comp.timeout_retry)
if (pkt)
free_pkt(pkt);
goto done; goto done;
}
if (qp->comp.retry_cnt > 0) { if (qp->comp.retry_cnt > 0) {
if (qp->comp.retry_cnt != 7) if (qp->comp.retry_cnt != 7)
...@@ -704,8 +707,6 @@ int rxe_completer(void *arg) ...@@ -704,8 +707,6 @@ int rxe_completer(void *arg)
qp->comp.started_retry = 1; qp->comp.started_retry = 1;
rxe_run_task(&qp->req.task, 0); rxe_run_task(&qp->req.task, 0);
} }
if (pkt)
free_pkt(pkt);
goto done; goto done;
} else { } else {
...@@ -726,8 +727,8 @@ int rxe_completer(void *arg) ...@@ -726,8 +727,8 @@ int rxe_completer(void *arg)
mod_timer(&qp->rnr_nak_timer, mod_timer(&qp->rnr_nak_timer,
jiffies + rnrnak_jiffies(aeth_syn(pkt) jiffies + rnrnak_jiffies(aeth_syn(pkt)
& ~AETH_TYPE_MASK)); & ~AETH_TYPE_MASK));
free_pkt(pkt); ret = -EAGAIN;
goto exit; goto done;
} else { } else {
rxe_counter_inc(rxe, rxe_counter_inc(rxe,
RXE_CNT_RNR_RETRY_EXCEEDED); RXE_CNT_RNR_RETRY_EXCEEDED);
...@@ -740,25 +741,15 @@ int rxe_completer(void *arg) ...@@ -740,25 +741,15 @@ int rxe_completer(void *arg)
WARN_ON_ONCE(wqe->status == IB_WC_SUCCESS); WARN_ON_ONCE(wqe->status == IB_WC_SUCCESS);
do_complete(qp, wqe); do_complete(qp, wqe);
rxe_qp_error(qp); rxe_qp_error(qp);
if (pkt) ret = -EAGAIN;
free_pkt(pkt); goto done;
goto exit;
} }
} }
exit:
/* we come here if we are done with processing and want the task to
* exit from the loop calling us
*/
WARN_ON_ONCE(skb);
rxe_drop_ref(qp);
return -EAGAIN;
done: done:
/* we come here if we have processed a packet we want the task to call if (pkt)
* us again to see if there is anything else to do free_pkt(pkt);
*/
WARN_ON_ONCE(skb);
rxe_drop_ref(qp); rxe_drop_ref(qp);
return 0;
return ret;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册