All of lore.kernel.org
 help / color / mirror / Atom feed
From: Selvin Xavier <selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
To: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	michael.chan-dY08KVG/lbpWk0Htik3J/w@public.gmane.org,
	Selvin Xavier
	<selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	Eddie Wai <eddie.wai-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	Devesh Sharma
	<devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	Somnath Kotur
	<somnath.kotur-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	Sriharsha Basavapatna
	<sriharsha.basavapatna-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
Subject: [PATCH for bnxt_re V3 20/21] bnxt_re: Add QP event handling
Date: Tue, 20 Dec 2016 01:13:30 -0800	[thread overview]
Message-ID: <1482225211-22423-21-git-send-email-selvin.xavier@broadcom.com> (raw)
In-Reply-To: <1482225211-22423-1-git-send-email-selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>

Implements callback handler for processing Async events related to a QP.
This patch also implements the control path command completion handling.

v3: Removes unwanted braces

Signed-off-by: Eddie Wai <eddie.wai-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
Signed-off-by: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
Signed-off-by: Somnath Kotur <somnath.kotur-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
Signed-off-by: Selvin Xavier <selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/hw/bnxtre/bnxt_qplib_rcfw.c | 47 ++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/drivers/infiniband/hw/bnxtre/bnxt_qplib_rcfw.c b/drivers/infiniband/hw/bnxtre/bnxt_qplib_rcfw.c
index 488c26f..761d32a 100644
--- a/drivers/infiniband/hw/bnxtre/bnxt_qplib_rcfw.c
+++ b/drivers/infiniband/hw/bnxtre/bnxt_qplib_rcfw.c
@@ -257,6 +257,44 @@ static int bnxt_qplib_process_func_event(struct bnxt_qplib_rcfw *rcfw,
 	return 0;
 }
 
+static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw,
+				       struct creq_qp_event *qp_event)
+{
+	struct bnxt_qplib_crsq *crsq = &rcfw->crsq;
+	struct bnxt_qplib_hwq *cmdq = &rcfw->cmdq;
+	struct bnxt_qplib_crsqe *crsqe;
+	u16 cbit, cookie, blocked = 0;
+	unsigned long flags;
+	u32 sw_cons;
+
+	switch (qp_event->event) {
+	case CREQ_QP_EVENT_EVENT_QP_ERROR_NOTIFICATION:
+		break;
+	default:
+		/* Command Response */
+		spin_lock_irqsave(&cmdq->lock, flags);
+		sw_cons = HWQ_CMP(crsq->cons, crsq);
+		crsqe = &crsq->crsq[sw_cons];
+		crsq->cons++;
+		memcpy(&crsqe->qp_event, qp_event, sizeof(crsqe->qp_event));
+
+		cookie = le16_to_cpu(crsqe->qp_event.cookie);
+		blocked = cookie & RCFW_CMD_IS_BLOCKING;
+		cookie &= RCFW_MAX_COOKIE_VALUE;
+		cbit = cookie % RCFW_MAX_OUTSTANDING_CMD;
+		if (!test_and_clear_bit(cbit, rcfw->cmdq_bitmap))
+			dev_warn(&rcfw->pdev->dev,
+				 "QPLIB: CMD bit %d was not requested", cbit);
+
+		cmdq->cons += crsqe->req_size;
+		spin_unlock_irqrestore(&cmdq->lock, flags);
+		if (!blocked)
+			wake_up(&rcfw->waitq);
+		break;
+	}
+	return 0;
+}
+
 /* SP - CREQ Completion handlers */
 static void bnxt_qplib_service_creq(unsigned long data)
 {
@@ -280,6 +318,15 @@ static void bnxt_qplib_service_creq(unsigned long data)
 		type = creqe->type & CREQ_BASE_TYPE_MASK;
 		switch (type) {
 		case CREQ_BASE_TYPE_QP_EVENT:
+			if (!bnxt_qplib_process_qp_event
+			    (rcfw, (struct creq_qp_event *)creqe))
+				rcfw->creq_qp_event_processed++;
+			else {
+				dev_warn(&rcfw->pdev->dev, "QPLIB: crsqe with");
+				dev_warn(&rcfw->pdev->dev,
+					 "QPLIB: type = 0x%x not handled",
+					 type);
+			}
 			break;
 		case CREQ_BASE_TYPE_FUNC_EVENT:
 			if (!bnxt_qplib_process_func_event
-- 
2.5.5

--
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

  parent reply	other threads:[~2016-12-20  9:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-20  9:13 [PATCH for bnxt_re V3 00/21] Broadcom RoCE Driver (bnxt_re) Selvin Xavier
2016-12-20  9:13 ` [PATCH for bnxt_re V3 01/21] bnxt_re: Add bnxt_re RoCE driver files Selvin Xavier
2016-12-20  9:13 ` [PATCH for bnxt_re V3 03/21] bnxt_re: register with the NIC driver Selvin Xavier
2017-01-15 19:41   ` Leon Romanovsky
2017-01-16  8:08     ` Selvin Xavier
2017-01-16  8:33       ` Leon Romanovsky
2016-12-20  9:13 ` [PATCH for bnxt_re V3 04/21] bnxt_re: Enabling RoCE control path Selvin Xavier
2016-12-20  9:13 ` [PATCH for bnxt_re V3 05/21] bnxt_re: Adding Notification Queue support Selvin Xavier
2016-12-20  9:13 ` [PATCH for bnxt_re V3 06/21] bnxt_re: Support for PD, ucontext and mmap verbs Selvin Xavier
2016-12-20  9:13 ` [PATCH for bnxt_re V3 07/21] bnxt_re: Support for query and modify device verbs Selvin Xavier
2016-12-20  9:13 ` [PATCH for bnxt_re V3 09/21] bnxt_re: Support for GID related verbs Selvin Xavier
2016-12-20  9:13 ` [PATCH for bnxt_re V3 12/21] bnxt_re: Support memory registration verbs Selvin Xavier
2016-12-20  9:13 ` [PATCH for bnxt_re V3 14/21] bnxt_re: Support post_send verb Selvin Xavier
2016-12-20  9:13 ` [PATCH for bnxt_re V3 15/21] bnxt_re: Support post_recv Selvin Xavier
     [not found] ` <1482225211-22423-1-git-send-email-selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2016-12-20  9:13   ` [PATCH for bnxt_re V3 02/21] bnxt_re: Introducing autogenerated Host Software Interface(hsi) file Selvin Xavier
2016-12-20  9:13   ` [PATCH for bnxt_re V3 08/21] bnxt_re: Adding support for port related verbs Selvin Xavier
2016-12-20  9:13   ` [PATCH for bnxt_re V3 10/21] bnxt_re: Support for CQ verbs Selvin Xavier
2016-12-20  9:13   ` [PATCH for bnxt_re V3 11/21] bnxt_re: Support for AH verbs Selvin Xavier
2016-12-20  9:13   ` [PATCH for bnxt_re V3 13/21] bnxt_re: Support QP verbs Selvin Xavier
2016-12-20  9:13   ` [PATCH for bnxt_re V3 16/21] bnxt_re: Support poll_cq verb Selvin Xavier
2016-12-20  9:13   ` [PATCH for bnxt_re V3 17/21] bnxt_re: Handling dispatching of events to IB stack Selvin Xavier
2016-12-20  9:13   ` Selvin Xavier [this message]
2016-12-20  9:13   ` [PATCH for bnxt_re V3 21/21] bnxt_re: Add bnxt_re driver build support Selvin Xavier
2016-12-20 14:28   ` [PATCH for bnxt_re V3 00/21] Broadcom RoCE Driver (bnxt_re) Doug Ledford
2016-12-20  9:13 ` [PATCH for bnxt_re V3 18/21] bnxt_re: Support for DCB Selvin Xavier
2016-12-20  9:13 ` [PATCH for bnxt_re V3 19/21] bnxt_re: Set uverbs command mask Selvin Xavier

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=1482225211-22423-21-git-send-email-selvin.xavier@broadcom.com \
    --to=selvin.xavier-dy08kvg/lbpwk0htik3j/w@public.gmane.org \
    --cc=devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=eddie.wai-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=michael.chan-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=somnath.kotur-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=sriharsha.basavapatna-dY08KVG/lbpWk0Htik3J/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 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.