linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dennis Dalessandro <dennis.dalessandro@intel.com>
To: jgg@ziepe.ca, dledford@redhat.com
Cc: linux-rdma@vger.kernel.org,
	Mike Marciniszyn <mike.marciniszyn@intel.com>,
	Kaike Wan <kaike.wan@intel.com>
Subject: [PATCH for-next v2 07/11] IB/hfi1: Create API for auto activate
Date: Tue, 26 Nov 2019 09:12:51 -0500	[thread overview]
Message-ID: <20191126141251.58836.34992.stgit@awfm-01.aw.intel.com> (raw)
In-Reply-To: <20191126141055.58836.79452.stgit@awfm-01.aw.intel.com>

From: Mike Marciniszyn <mike.marciniszyn@intel.com>

Add an auto activate routine for use by the interrupt handler.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Kaike Wan <kaike.wan@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
---
 drivers/infiniband/hw/hfi1/driver.c |   37 ++++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 14 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/driver.c b/drivers/infiniband/hw/hfi1/driver.c
index bbc7458..46c1be0 100644
--- a/drivers/infiniband/hw/hfi1/driver.c
+++ b/drivers/infiniband/hw/hfi1/driver.c
@@ -924,11 +924,8 @@ void set_all_slowpath(struct hfi1_devdata *dd)
 	}
 }
 
-static inline int set_armed_to_active(struct hfi1_ctxtdata *rcd,
-				      struct hfi1_packet *packet,
-				      struct hfi1_devdata *dd)
+static bool __set_armed_to_active(struct hfi1_packet *packet)
 {
-	struct work_struct *lsaw = &rcd->ppd->linkstate_active_work;
 	u8 etype = rhf_rcv_type(packet->rhf);
 	u8 sc = SC15_PACKET;
 
@@ -943,19 +940,34 @@ static inline int set_armed_to_active(struct hfi1_ctxtdata *rcd,
 		sc = hfi1_16B_get_sc(hdr);
 	}
 	if (sc != SC15_PACKET) {
-		int hwstate = driver_lstate(rcd->ppd);
+		int hwstate = driver_lstate(packet->rcd->ppd);
+		struct work_struct *lsaw =
+				&packet->rcd->ppd->linkstate_active_work;
 
 		if (hwstate != IB_PORT_ACTIVE) {
-			dd_dev_info(dd,
+			dd_dev_info(packet->rcd->dd,
 				    "Unexpected link state %s\n",
 				    opa_lstate_name(hwstate));
-			return 0;
+			return false;
 		}
 
-		queue_work(rcd->ppd->link_wq, lsaw);
-		return 1;
+		queue_work(packet->rcd->ppd->link_wq, lsaw);
+		return true;
 	}
-	return 0;
+	return false;
+}
+
+/**
+ * armed to active - the fast path for armed to active
+ * @packet: the packet structure
+ *
+ * Return true if packet processing needs to bail.
+ */
+static bool set_armed_to_active(struct hfi1_packet *packet)
+{
+	if (likely(packet->rcd->ppd->host_link_state != HLS_UP_ARMED))
+		return false;
+	return __set_armed_to_active(packet);
 }
 
 /*
@@ -1016,10 +1028,7 @@ int handle_receive_interrupt(struct hfi1_ctxtdata *rcd, int thread)
 			last = skip_rcv_packet(&packet, thread);
 			skip_pkt = 0;
 		} else {
-			/* Auto activate link on non-SC15 packet receive */
-			if (unlikely(rcd->ppd->host_link_state ==
-				     HLS_UP_ARMED) &&
-			    set_armed_to_active(rcd, &packet, dd))
+			if (set_armed_to_active(&packet))
 				goto bail;
 			last = process_rcv_packet(&packet, thread);
 		}


  parent reply	other threads:[~2019-11-26 14:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26 14:12 [PATCH for-next v2 00/11] rdmavt/hfi1 updates for next Dennis Dalessandro
2019-11-26 14:12 ` [PATCH for-next v2 01/11] IB/hfi1: Add accessor API routines to access context members Dennis Dalessandro
2019-11-26 14:12 ` [PATCH for-next v2 02/11] IB/hfi1: List all receive contexts from debugfs Dennis Dalessandro
2019-12-02 13:30   ` Ruhl, Michael J
2019-12-05 13:49   ` [PATCH for-next v3] " Dennis Dalessandro
2020-01-03 19:48     ` Jason Gunthorpe
2019-11-26 14:12 ` [PATCH for-next v2 03/11] IB/hfi1: Move chip specific functions to chip.c Dennis Dalessandro
2019-11-26 14:12 ` [PATCH for-next v2 04/11] IB/hfi1: Add fast and slow handlers for receive context Dennis Dalessandro
2019-11-26 14:12 ` [PATCH for-next v2 05/11] IB/hfi1: Move common receive IRQ code to function Dennis Dalessandro
2019-11-26 14:12 ` [PATCH for-next v2 06/11] IB/hfi1: IB/hfi1: Add an API to handle special case drop Dennis Dalessandro
2019-11-26 14:12 ` Dennis Dalessandro [this message]
2019-11-26 14:12 ` [PATCH for-next v2 08/11] IB/hfi1: Decouple IRQ name from type Dennis Dalessandro
2019-11-26 14:13 ` [PATCH for-next v2 09/11] IB/hfi1: Return void in packet receiving functions Dennis Dalessandro
2019-11-26 14:13 ` [PATCH for-next v2 10/11] IB/rdmavt: Correct comments in rdmavt_qp.h header Dennis Dalessandro
2019-11-26 14:13 ` [PATCH for-next v2 11/11] IB/hfi1: Don't cancel unused work item Dennis Dalessandro
2019-11-26 15:31 ` [PATCH for-next v2 00/11] rdmavt/hfi1 updates for next Jason Gunthorpe
2019-12-11 13:34 ` Dennis Dalessandro
2019-12-11 16:21   ` Jason Gunthorpe
2019-12-11 16:33     ` 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=20191126141251.58836.34992.stgit@awfm-01.aw.intel.com \
    --to=dennis.dalessandro@intel.com \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=kaike.wan@intel.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mike.marciniszyn@intel.com \
    /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).