From: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 5/5] libbnxt_re: reset head and tail when moving to RST
Date: Fri, 12 May 2017 06:24:26 -0400 [thread overview]
Message-ID: <1494584666-11064-6-git-send-email-devesh.sharma@broadcom.com> (raw)
In-Reply-To: <1494584666-11064-1-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
When the QP is moving to RESET state from any state
the head and tail of SQ and RQ(if present) should move
to initial state (which is 0).
This patch adds the code to handle reseting head and tail.
Signed-off-by: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
---
providers/bnxt_re/verbs.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/providers/bnxt_re/verbs.c b/providers/bnxt_re/verbs.c
index d337514..1fe7967 100644
--- a/providers/bnxt_re/verbs.c
+++ b/providers/bnxt_re/verbs.c
@@ -419,6 +419,11 @@ static void bnxt_re_poll_success_rcqe(struct bnxt_re_qp *qp,
ibvwc->wc_flags = 0;
if (is_imm) {
ibvwc->wc_flags |= IBV_WC_WITH_IMM;
+ /* Completion reports the raw-data in LE format, While
+ * user expects it in BE format. Thus, swapping on outgoing
+ * data is needed. On a BE platform le32toh will do the swap
+ * while on LE platform htobe32 will do the job.
+ */
ibvwc->imm_data = htobe32(le32toh(rcqe->imm_key));
if (is_rdma)
ibvwc->opcode = IBV_WC_RECV_RDMA_WITH_IMM;
@@ -917,9 +922,18 @@ int bnxt_re_modify_qp(struct ibv_qp *ibvqp, struct ibv_qp_attr *attr,
rc = ibv_cmd_modify_qp(ibvqp, attr, attr_mask, &cmd, sizeof(cmd));
if (!rc) {
- if (attr_mask & IBV_QP_STATE)
+ if (attr_mask & IBV_QP_STATE) {
qp->qpst = attr->qp_state;
-
+ /* transition to reset */
+ if (qp->qpst == IBV_QPS_RESET) {
+ qp->sqq->head = 0;
+ qp->sqq->tail = 0;
+ if (qp->rqq) {
+ qp->rqq->head = 0;
+ qp->rqq->tail = 0;
+ }
+ }
+ }
if (attr_mask & IBV_QP_SQ_PSN)
qp->sq_psn = attr->sq_psn;
if (attr_mask & IBV_QP_PATH_MTU)
@@ -1200,6 +1214,11 @@ int bnxt_re_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr,
qp->cap.sqsig);
switch (wr->opcode) {
case IBV_WR_SEND_WITH_IMM:
+ /* Since our h/w is LE and user supplies raw-data in
+ * BE format. Swapping on incoming data is needed.
+ * On a BE platform htole32 will do the swap while on
+ * LE platform be32toh will do the job.
+ */
hdr->key_immd = htole32(be32toh(wr->imm_data));
case IBV_WR_SEND:
if (qp->qptyp == IBV_QPT_UD)
--
1.8.3.1
--
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-05-12 10:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-12 10:24 [PATCH 0/5] libbnxt_re: Critical bug fix series Devesh Sharma
[not found] ` <1494584666-11064-1-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-05-12 10:24 ` [PATCH 1/5] libbnxt_re: sq needs to be augmented by 128B Devesh Sharma
2017-05-12 10:24 ` [PATCH 2/5] libbnxt_re: fix wqe size for the 0-len posting Devesh Sharma
2017-05-12 10:24 ` [PATCH 3/5] libbnxt_re: move rts to rts after a threshold Devesh Sharma
2017-05-12 10:24 ` [PATCH 4/5] libbnxt_re: unmap DB page during uninit ucontext Devesh Sharma
2017-05-12 10:24 ` Devesh Sharma [this message]
[not found] ` <1494584666-11064-6-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-05-12 16:08 ` [PATCH 5/5] libbnxt_re: reset head and tail when moving to RST Jason Gunthorpe
2017-05-13 10:49 ` [PATCH 0/5] libbnxt_re: Critical bug fix series Leon Romanovsky
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=1494584666-11064-6-git-send-email-devesh.sharma@broadcom.com \
--to=devesh.sharma-dy08kvg/lbpwk0htik3j/w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@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.