From: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Harish Chegondi
<harish.chegondi-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Mike Marciniszyn
<mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: [PATCH 6/8] IB/rdmavt: Add post receive to rdmavt
Date: Sat, 09 Jan 2016 07:00:30 -0800 [thread overview]
Message-ID: <20160109150030.8585.17045.stgit@scvm10.sc.intel.com> (raw)
In-Reply-To: <20160109145731.8585.48926.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
This patch adds the simple post receive verbs call to rdmavt. The actual
interrupt handling and packet processing is still done in the low level
driver.
Reviewed-by: Mike Marciniszyn <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Harish Chegondi <harish.chegondi-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
drivers/infiniband/sw/rdmavt/qp.c | 47 +++++++++++++++++++++++++++++++------
1 files changed, 40 insertions(+), 7 deletions(-)
diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c
index 6aa7d6f..0b606b1 100644
--- a/drivers/infiniband/sw/rdmavt/qp.c
+++ b/drivers/infiniband/sw/rdmavt/qp.c
@@ -1214,14 +1214,47 @@ int rvt_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
int rvt_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr,
struct ib_recv_wr **bad_wr)
{
- /*
- * When a packet arrives the driver needs to call up to rvt to process
- * the packet. The UD, RC, UC processing will be done in rvt, however
- * the driver should be able to override this if it so choses. Perhaps a
- * set of function pointers set up at registration time.
- */
+ struct rvt_qp *qp = ibqp_to_rvtqp(ibqp);
+ struct rvt_rwq *wq = qp->r_rq.wq;
+ unsigned long flags;
- return -EOPNOTSUPP;
+ /* Check that state is OK to post receive. */
+ if (!(ib_rvt_state_ops[qp->state] & RVT_POST_RECV_OK) || !wq) {
+ *bad_wr = wr;
+ return -EINVAL;
+ }
+
+ for (; wr; wr = wr->next) {
+ struct rvt_rwqe *wqe;
+ u32 next;
+ int i;
+
+ if ((unsigned)wr->num_sge > qp->r_rq.max_sge) {
+ *bad_wr = wr;
+ return -EINVAL;
+ }
+
+ spin_lock_irqsave(&qp->r_rq.lock, flags);
+ next = wq->head + 1;
+ if (next >= qp->r_rq.size)
+ next = 0;
+ if (next == wq->tail) {
+ spin_unlock_irqrestore(&qp->r_rq.lock, flags);
+ *bad_wr = wr;
+ return -ENOMEM;
+ }
+
+ wqe = rvt_get_rwqe_ptr(&qp->r_rq, wq->head);
+ wqe->wr_id = wr->wr_id;
+ wqe->num_sge = wr->num_sge;
+ for (i = 0; i < wr->num_sge; i++)
+ wqe->sg_list[i] = wr->sg_list[i];
+ /* Make sure queue entry is written before the head index. */
+ smp_wmb();
+ wq->head = next;
+ spin_unlock_irqrestore(&qp->r_rq.lock, flags);
+ }
+ return 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:[~2016-01-09 15:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-09 14:59 [PATCH 0/8] IB/rdmavt: Add functions for cq, qp, post send and recv Dennis Dalessandro
[not found] ` <20160109145731.8585.48926.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2016-01-09 15:00 ` [PATCH 1/8] IB/rdmavt: Add completion queue functions Dennis Dalessandro
2016-01-09 15:00 ` [PATCH 2/8] IB/rdmavt: Add post send to rdmavt Dennis Dalessandro
[not found] ` <20160109150007.8585.76575.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2016-01-19 16:23 ` Moni Shoua
[not found] ` <CAG9sBKOpDfxOaPU+dJ+M42JrbCVEoNAORi8jk1KJLay-KDhSSA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-01-19 18:46 ` Dennis Dalessandro
2016-01-09 15:00 ` [PATCH 3/8] IB/rdmavt: Add support for tracing events Dennis Dalessandro
2016-01-09 15:00 ` [PATCH 4/8] IB/rdmavt: Add modify qp Dennis Dalessandro
2016-01-09 15:00 ` [PATCH 5/8] IB/rdmavt: Add destroy qp verb Dennis Dalessandro
2016-01-09 15:00 ` Dennis Dalessandro [this message]
2016-01-09 15:00 ` [PATCH 7/8] IB/rdmavt: Add multicast functions Dennis Dalessandro
2016-01-09 15:00 ` [PATCH 8/8] IB/rdmavt: Add misc dev register functionality Dennis Dalessandro
2016-01-19 16:44 ` [PATCH 0/8] IB/rdmavt: Add functions for cq, qp, post send and recv Moni Shoua
[not found] ` <CAG9sBKMNm1bMtjoUsGjj+FVL3ZmBw--tK-6iXYMW+0N5j2VE2A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-01-19 18:53 ` Dennis Dalessandro
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=20160109150030.8585.17045.stgit@scvm10.sc.intel.com \
--to=dennis.dalessandro-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=harish.chegondi-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.