From: "Boyer, Andrew" <Andrew.Boyer-8PEkshWhKlo@public.gmane.org>
To: Bart Van Assche
<Bart.VanAssche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>,
"dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org"
<dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: "monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org"
<monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 10/15] IB/rxe: Introduce functions for queue draining
Date: Mon, 9 Jan 2017 15:06:39 +0000 [thread overview]
Message-ID: <D49910D0.9088%Andrew.Boyer@emc.com> (raw)
In-Reply-To: <1483353661.3592.32.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
On 1/2/17, 5:42 AM, "Bart Van Assche" <Bart.VanAssche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org> wrote:
>This change makes the code easier to read and avoids that code is
>duplicated.
>
>Signed-off-by: Bart Van Assche <bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
>Cc: Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>Cc: Andrew Boyer <andrew.boyer-8PEkshWhKlo@public.gmane.org>
>---
> drivers/infiniband/sw/rxe/rxe_comp.c | 63
>+++++++++++++-----------------------
> drivers/infiniband/sw/rxe/rxe_resp.c | 28 ++++++++--------
> 2 files changed, 38 insertions(+), 53 deletions(-)
>
>diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c
>b/drivers/infiniband/sw/rxe/rxe_comp.c
>index e912e5396e8c..6769a075501e 100644
>--- a/drivers/infiniband/sw/rxe/rxe_comp.c
>+++ b/drivers/infiniband/sw/rxe/rxe_comp.c
>@@ -503,57 +503,40 @@ static inline enum comp_state complete_wqe(struct
>rxe_qp *qp,
> 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 rxe_send_wqe *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);
>+ struct sk_buff *skb;
>+ struct rxe_send_wqe *wqe;
>
>- goto exit;
>+ while ((skb = skb_dequeue(&qp->resp_pkts))) {
>+ rxe_drop_ref(qp);
>+ kfree_skb(skb);
> }
>
>- if (qp->req.state == QP_STATE_ERROR) {
>- while ((skb = skb_dequeue(&qp->resp_pkts))) {
>- rxe_drop_ref(qp);
>- kfree_skb(skb);
>- }
>- skb = NULL;
>- pkt = NULL;
>-
>- while ((wqe = queue_head(qp->sq.queue))) {
>+ while ((wqe = queue_head(qp->sq.queue))) {
>+ if (notify) {
> wqe->status = IB_WC_WR_FLUSH_ERR;
> do_complete(qp, wqe);
>+ } else {
>+ advance_consumer(qp->sq.queue);
> }
>-
>- goto exit;
> }
>+}
>
>- if (qp->req.state == QP_STATE_RESET) {
>- while ((skb = skb_dequeue(&qp->resp_pkts))) {
>- rxe_drop_ref(qp);
>- kfree_skb(skb);
>- }
>- skb = NULL;
>- pkt = NULL;
>+int rxe_completer(void *arg)
>+{
>+ struct rxe_qp *qp = (struct rxe_qp *)arg;
>+ struct rxe_send_wqe *wqe = wqe;
>+ struct sk_buff *skb = NULL;
>+ struct rxe_pkt_info *pkt = NULL;
>+ enum comp_state state;
>
>- while (queue_head(qp->sq.queue))
>- advance_consumer(qp->sq.queue);
>+ rxe_add_ref(qp);
>
>+ 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;
> }
>
>diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c
>b/drivers/infiniband/sw/rxe/rxe_resp.c
>index 6dbd069689fc..25951e9413b8 100644
>--- a/drivers/infiniband/sw/rxe/rxe_resp.c
>+++ b/drivers/infiniband/sw/rxe/rxe_resp.c
>@@ -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, bool notify)
Is notify unused? Is it here just for symmetry with the responder?
>+{
>+ 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)
> {
> struct rxe_qp *qp = (struct rxe_qp *)arg;
>@@ -1374,21 +1387,10 @@ int rxe_responder(void *arg)
>
> goto exit;
>
>- case RESPST_RESET: {
>- 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);
>-
>+ case RESPST_RESET:
>+ rxe_drain_req_pkts(qp, false);
> qp->resp.wqe = NULL;
> goto exit;
>- }
>
> case RESPST_ERROR:
> qp->resp.goto_error = 0;
>--
>2.11.0
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-01-09 15:06 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-02 10:35 [PATCH 00/15] IB/rxe patches for kernel v4.11 Bart Van Assche
[not found] ` <1483353316.3592.14.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-02 10:39 ` [PATCH 01/15] IB/rxe: Suppress sparse warnings Bart Van Assche
[not found] ` <1483353409.3592.15.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-05 12:59 ` Leon Romanovsky
[not found] ` <20170105125955.GB15685-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-01-09 12:42 ` Bart Van Assche
[not found] ` <1483965701.2923.0.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-09 13:13 ` Leon Romanovsky
2017-01-09 14:27 ` Boyer, Andrew
2017-01-02 10:39 ` [PATCH 02/15] IB/rxe: Constify the pool name Bart Van Assche
[not found] ` <1483353445.3592.17.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-08 9:40 ` Leon Romanovsky
2017-01-09 14:27 ` Boyer, Andrew
2017-01-02 10:39 ` [PATCH 03/15] IB/rxe: Remove an unused function Bart Van Assche
[not found] ` <1483353474.3592.18.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-08 9:39 ` Leon Romanovsky
2017-01-09 14:28 ` Boyer, Andrew
2017-01-02 10:40 ` [PATCH 04/15] IB/rxe: Remove an unused variable Bart Van Assche
[not found] ` <1483353498.3592.20.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-02 18:24 ` Leon Romanovsky
2017-01-03 18:39 ` Parav Pandit
[not found] ` <CAG53R5WnJy1cLdEZOpzk03aAE2L6v86n_-qEBpoaG+arymCxPw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-04 10:37 ` Bart Van Assche
[not found] ` <1483526210.3048.6.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-04 12:29 ` Leon Romanovsky
2017-01-09 14:29 ` Boyer, Andrew
2017-01-02 10:40 ` [PATCH 05/15] IB/rxe: Remove superfluous casts Bart Van Assche
[not found] ` <1483353522.3592.22.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-05 6:48 ` Leon Romanovsky
2017-01-09 14:29 ` Boyer, Andrew
2017-01-02 10:40 ` [PATCH 06/15] IB/rxe: Enable type checking on SKB_TO_PKT() and PKT_TO_SKB() arguments Bart Van Assche
[not found] ` <1483353555.3592.24.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-08 9:44 ` Leon Romanovsky
2017-01-09 14:31 ` Boyer, Andrew
2017-01-02 10:41 ` [PATCH 07/15] IB/rxe: Let the compiler check the type of the cleanup functions Bart Van Assche
[not found] ` <1483353591.3592.26.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-08 14:22 ` Leon Romanovsky
2017-01-09 14:33 ` Boyer, Andrew
2017-01-02 10:41 ` [PATCH 08/15] IB/rxe: Issue warnings once Bart Van Assche
[not found] ` <1483353613.3592.28.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-04 14:18 ` Leon Romanovsky
2017-01-02 10:41 ` [PATCH 09/15] IB/rxe: Add a runtime check in alloc_index() Bart Van Assche
[not found] ` <1483353638.3592.30.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-04 17:27 ` Leon Romanovsky
[not found] ` <20170104172704.GU12077-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-01-04 18:38 ` Bart Van Assche
[not found] ` <1483555108.3101.1.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-05 6:43 ` Leon Romanovsky
2017-01-09 14:35 ` Boyer, Andrew
2017-01-02 10:42 ` [PATCH 10/15] IB/rxe: Introduce functions for queue draining Bart Van Assche
[not found] ` <1483353661.3592.32.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-09 15:06 ` Boyer, Andrew [this message]
[not found] ` <D49910D0.9088%Andrew.Boyer-mb1K0bWo544@public.gmane.org>
2017-01-09 15:11 ` Boyer, Andrew
2017-01-02 10:42 ` [PATCH 11/15] IB/rxe: Generate a completion for all failed work requests Bart Van Assche
[not found] ` <1483353685.3592.34.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-09 15:15 ` Boyer, Andrew
2017-01-02 10:43 ` [PATCH 12/15] IB/rxe: Fix a MR reference leak in check_rkey() Bart Van Assche
[not found] ` <1483353706.3592.35.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-09 14:42 ` Boyer, Andrew
2017-01-02 10:43 ` [PATCH 13/15] IB/rxe: Fix reference leaks in memory key invalidation code Bart Van Assche
[not found] ` <1483353732.3592.38.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-09 14:52 ` Boyer, Andrew
2017-01-02 10:43 ` [PATCH 14/15] IB/rxe: Remove a pointless indirection layer Bart Van Assche
[not found] ` <1483353755.3592.40.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-09 12:35 ` Leon Romanovsky
2017-01-09 15:09 ` Boyer, Andrew
2017-01-02 10:44 ` [PATCH 15/15] IB/rxe: Fix an skb leak Bart Van Assche
[not found] ` <1483353777.3592.42.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-08 13:37 ` Leon Romanovsky
2017-01-09 14:59 ` Boyer, Andrew
2017-01-10 18:06 ` [PATCH 00/15] IB/rxe patches for kernel v4.11 Doug Ledford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D49910D0.9088%Andrew.Boyer@emc.com \
--to=andrew.boyer-8pekshwhklo@public.gmane.org \
--cc=Bart.VanAssche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).