提交 723ec9ae 编写于 作者: B Bart Van Assche 提交者: Doug Ledford

IB/rxe: Introduce functions for queue draining

This change makes the code easier to read and avoids that code is
duplicated.
Signed-off-by: NBart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: NAndrew Boyer <andrew.boyer@dell.com>
Cc: Moni Shoua <monis@mellanox.com>
Signed-off-by: NDoug Ledford <dledford@redhat.com>
上级 642c7cbc
...@@ -503,57 +503,40 @@ static inline enum comp_state complete_wqe(struct rxe_qp *qp, ...@@ -503,57 +503,40 @@ static inline enum comp_state complete_wqe(struct rxe_qp *qp,
return COMPST_GET_WQE; return COMPST_GET_WQE;
} }
int rxe_completer(void *arg) static void rxe_drain_resp_pkts(struct rxe_qp *qp, bool notify)
{ {
struct rxe_qp *qp = (struct rxe_qp *)arg; struct sk_buff *skb;
struct rxe_send_wqe *wqe = wqe; struct rxe_send_wqe *wqe;
struct sk_buff *skb = NULL;
struct rxe_pkt_info *pkt = NULL;
enum comp_state state;
rxe_add_ref(qp);
if (!qp->valid) {
while ((skb = skb_dequeue(&qp->resp_pkts))) {
rxe_drop_ref(qp);
kfree_skb(skb);
}
skb = NULL;
pkt = NULL;
while (queue_head(qp->sq.queue))
advance_consumer(qp->sq.queue);
goto exit; while ((skb = skb_dequeue(&qp->resp_pkts))) {
rxe_drop_ref(qp);
kfree_skb(skb);
} }
if (qp->req.state == QP_STATE_ERROR) { while ((wqe = queue_head(qp->sq.queue))) {
while ((skb = skb_dequeue(&qp->resp_pkts))) { if (notify) {
rxe_drop_ref(qp);
kfree_skb(skb);
}
skb = NULL;
pkt = NULL;
while ((wqe = queue_head(qp->sq.queue))) {
wqe->status = IB_WC_WR_FLUSH_ERR; wqe->status = IB_WC_WR_FLUSH_ERR;
do_complete(qp, wqe); do_complete(qp, wqe);
} else {
advance_consumer(qp->sq.queue);
} }
goto exit;
} }
}
if (qp->req.state == QP_STATE_RESET) { int rxe_completer(void *arg)
while ((skb = skb_dequeue(&qp->resp_pkts))) { {
rxe_drop_ref(qp); struct rxe_qp *qp = (struct rxe_qp *)arg;
kfree_skb(skb); struct rxe_send_wqe *wqe = wqe;
} struct sk_buff *skb = NULL;
skb = NULL; struct rxe_pkt_info *pkt = NULL;
pkt = NULL; enum comp_state state;
while (queue_head(qp->sq.queue)) rxe_add_ref(qp);
advance_consumer(qp->sq.queue);
if (!qp->valid || qp->req.state == QP_STATE_ERROR ||
qp->req.state == QP_STATE_RESET) {
rxe_drain_resp_pkts(qp, qp->valid &&
qp->req.state == QP_STATE_ERROR);
goto exit; goto exit;
} }
......
...@@ -1207,6 +1207,19 @@ static enum resp_states do_class_d1e_error(struct rxe_qp *qp) ...@@ -1207,6 +1207,19 @@ static enum resp_states do_class_d1e_error(struct rxe_qp *qp)
} }
} }
static void rxe_drain_req_pkts(struct rxe_qp *qp)
{
struct sk_buff *skb;
while ((skb = skb_dequeue(&qp->req_pkts))) {
rxe_drop_ref(qp);
kfree_skb(skb);
}
while (!qp->srq && qp->rq.queue && queue_head(qp->rq.queue))
advance_consumer(qp->rq.queue);
}
int rxe_responder(void *arg) int rxe_responder(void *arg)
{ {
struct rxe_qp *qp = (struct rxe_qp *)arg; struct rxe_qp *qp = (struct rxe_qp *)arg;
...@@ -1374,21 +1387,10 @@ int rxe_responder(void *arg) ...@@ -1374,21 +1387,10 @@ int rxe_responder(void *arg)
goto exit; goto exit;
case RESPST_RESET: { case RESPST_RESET:
struct sk_buff *skb; rxe_drain_req_pkts(qp);
while ((skb = skb_dequeue(&qp->req_pkts))) {
rxe_drop_ref(qp);
kfree_skb(skb);
}
while (!qp->srq && qp->rq.queue &&
queue_head(qp->rq.queue))
advance_consumer(qp->rq.queue);
qp->resp.wqe = NULL; qp->resp.wqe = NULL;
goto exit; goto exit;
}
case RESPST_ERROR: case RESPST_ERROR:
qp->resp.goto_error = 0; qp->resp.goto_error = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册