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 5/9] IB/hfi1: Create API for auto activate
Date: Mon, 06 Jan 2020 08:42:10 -0500 [thread overview]
Message-ID: <20200106134210.119356.43079.stgit@awfm-01.aw.intel.com> (raw)
In-Reply-To: <20200106133845.119356.20115.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);
}
next prev parent reply other threads:[~2020-01-06 13:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-06 13:41 [PATCH for-next 0/9] Clean ups, refactror, additions Dennis Dalessandro
2020-01-06 13:41 ` [PATCH for-next 1/9] IB/hfi1: Move chip specific functions to chip.c Dennis Dalessandro
2020-01-06 13:41 ` [PATCH for-next 2/9] IB/hfi1: Add fast and slow handlers for receive context Dennis Dalessandro
2020-01-06 13:41 ` [PATCH for-next 3/9] IB/hfi1: Move common receive IRQ code to function Dennis Dalessandro
2020-01-06 13:42 ` [PATCH for-next 4/9] IB/hfi1: IB/hfi1: Add an API to handle special case drop Dennis Dalessandro
2020-01-06 13:42 ` Dennis Dalessandro [this message]
2020-01-06 13:42 ` [PATCH for-next 6/9] IB/hfi1: Decouple IRQ name from type Dennis Dalessandro
2020-01-06 13:42 ` [PATCH for-next 7/9] IB/hfi1: Return void in packet receiving functions Dennis Dalessandro
2020-01-06 13:42 ` [PATCH for-next 8/9] IB/hfi1: Add software counter for ctxt0 seq drop Dennis Dalessandro
2020-01-06 13:42 ` [PATCH for-next 9/9] IB/hfi1: Add RcvShortLengthErrCnt to hfi1stats Dennis Dalessandro
2020-01-06 13:44 ` [PATCH for-next 0/9] Clean ups, refactror, additions Dennis Dalessandro
2020-01-10 15:15 ` Jason Gunthorpe
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=20200106134210.119356.43079.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).