From: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: jgg-uk2M96/98Pc@public.gmane.org,
dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Mike Marciniszyn
<mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Sebastian Sanchez
<sebastian.sanchez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: [PATCH for-next 10/16] IB/hfi1: Optimize packet type comparison using 9B and bypass code paths
Date: Fri, 26 Jan 2018 06:32:38 -0800 [thread overview]
Message-ID: <20180126143235.6868.32732.stgit@scvm10.sc.intel.com> (raw)
In-Reply-To: <20180126142640.6868.12402.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
From: Sebastian Sanchez <sebastian.sanchez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
The packet type comparison used to find out if a packet is a bypass
packet in the hot path is an expensive operation as seen in a profile.
Determine packet's pkey and migration bit through the bypass and 9B
code paths instead.
Reviewed-by: Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Mike Marciniszyn <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Sebastian Sanchez <sebastian.sanchez-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
drivers/infiniband/hw/hfi1/driver.c | 4 ++++
drivers/infiniband/hw/hfi1/hfi.h | 2 ++
drivers/infiniband/hw/hfi1/ruc.c | 15 ++-------------
drivers/infiniband/hw/hfi1/verbs.h | 5 +++++
include/rdma/ib_hdrs.h | 5 +++++
5 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/drivers/infiniband/hw/hfi1/driver.c b/drivers/infiniband/hw/hfi1/driver.c
index e6a318c..7ef8634 100644
--- a/drivers/infiniband/hw/hfi1/driver.c
+++ b/drivers/infiniband/hw/hfi1/driver.c
@@ -1440,6 +1440,8 @@ static int hfi1_setup_9B_packet(struct hfi1_packet *packet)
packet->extra_byte = 0;
packet->fecn = ib_bth_get_fecn(packet->ohdr);
packet->becn = ib_bth_get_becn(packet->ohdr);
+ packet->pkey = ib_bth_get_pkey(packet->ohdr);
+ packet->migrated = ib_bth_is_migration(packet->ohdr);
return 0;
drop:
@@ -1508,6 +1510,8 @@ static int hfi1_setup_bypass_packet(struct hfi1_packet *packet)
packet->extra_byte = SIZE_OF_LT;
packet->fecn = hfi1_16B_get_fecn(packet->hdr);
packet->becn = hfi1_16B_get_becn(packet->hdr);
+ packet->pkey = hfi1_16B_get_pkey(packet->hdr);
+ packet->migrated = opa_bth_is_migration(packet->ohdr);
if (hfi1_bypass_ingress_pkt_check(packet))
goto drop;
diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h
index 8aea811..e0ed2b4 100644
--- a/drivers/infiniband/hw/hfi1/hfi.h
+++ b/drivers/infiniband/hw/hfi1/hfi.h
@@ -341,6 +341,7 @@ struct hfi1_packet {
u32 slid;
u16 tlen;
s16 etail;
+ u16 pkey;
u8 hlen;
u8 numpkt;
u8 rsize;
@@ -353,6 +354,7 @@ struct hfi1_packet {
u8 opcode;
bool becn;
bool fecn;
+ bool migrated;
};
/* Packet types */
diff --git a/drivers/infiniband/hw/hfi1/ruc.c b/drivers/infiniband/hw/hfi1/ruc.c
index 1033068..e7d4e04 100644
--- a/drivers/infiniband/hw/hfi1/ruc.c
+++ b/drivers/infiniband/hw/hfi1/ruc.c
@@ -225,19 +225,8 @@ int hfi1_ruc_check_hdr(struct hfi1_ibport *ibp, struct hfi1_packet *packet)
u32 dlid = packet->dlid;
u32 slid = packet->slid;
u32 sl = packet->sl;
- int migrated;
- u32 bth0, bth1;
- u16 pkey;
-
- bth0 = be32_to_cpu(packet->ohdr->bth[0]);
- bth1 = be32_to_cpu(packet->ohdr->bth[1]);
- if (packet->etype == RHF_RCV_TYPE_BYPASS) {
- pkey = hfi1_16B_get_pkey(packet->hdr);
- migrated = bth1 & OPA_BTH_MIG_REQ;
- } else {
- pkey = ib_bth_get_pkey(packet->ohdr);
- migrated = bth0 & IB_BTH_MIG_REQ;
- }
+ bool migrated = packet->migrated;
+ u16 pkey = packet->pkey;
if (qp->s_mig_state == IB_MIG_ARMED && migrated) {
if (!packet->grh) {
diff --git a/drivers/infiniband/hw/hfi1/verbs.h b/drivers/infiniband/hw/hfi1/verbs.h
index 26c1ed6..90a170e 100644
--- a/drivers/infiniband/hw/hfi1/verbs.h
+++ b/drivers/infiniband/hw/hfi1/verbs.h
@@ -410,6 +410,11 @@ static inline void cacheless_memcpy(void *dst, void *src, size_t n)
__copy_user_nocache(dst, (void __user *)src, n, 0);
}
+static inline bool opa_bth_is_migration(struct ib_other_headers *ohdr)
+{
+ return !!(ohdr->bth[1] & cpu_to_be32(OPA_BTH_MIG_REQ));
+}
+
extern const enum ib_wc_opcode ib_hfi1_wc_opcode[];
extern const u8 hdr_len_by_opcode[];
diff --git a/include/rdma/ib_hdrs.h b/include/rdma/ib_hdrs.h
index 6a86d14..2aa19ec 100644
--- a/include/rdma/ib_hdrs.h
+++ b/include/rdma/ib_hdrs.h
@@ -335,4 +335,9 @@ static inline bool ib_bth_is_solicited(struct ib_other_headers *ohdr)
{
return !!(ohdr->bth[0] & cpu_to_be32(IB_BTH_SOLICITED));
}
+
+static inline bool ib_bth_is_migration(struct ib_other_headers *ohdr)
+{
+ return !!(ohdr->bth[0] & cpu_to_be32(IB_BTH_MIG_REQ));
+}
#endif /* IB_HDRS_H */
--
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:[~2018-01-26 14:32 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-26 14:31 [PATCH for-next 00/16] IB/hfi1,core: Driver updates for 1/26/2018 Dennis Dalessandro
[not found] ` <20180126142640.6868.12402.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2018-01-26 14:31 ` [PATCH for-next 01/16] IB/hfi1: Do not override given pcie_pset value Dennis Dalessandro
2018-01-26 14:31 ` [PATCH for-next 02/16] IB/hfi1: Fix for early release of sdma context Dennis Dalessandro
2018-01-26 14:31 ` [PATCH for-next 03/16] IB/hfi1: Remove dependence on qp->s_hdrwords Dennis Dalessandro
2018-01-26 14:31 ` [PATCH for-next 04/16] IB/hfi1: Remove blind constants from 16B update Dennis Dalessandro
2018-01-26 14:31 ` [PATCH for-next 05/16] IB/hfi1: Convert PortXmitWait/PortVLXmitWait counters to flit times Dennis Dalessandro
2018-01-26 14:32 ` [PATCH for-next 06/16] IB/hfi1: hfi1_open_file() missing kobject_put in err path Dennis Dalessandro
[not found] ` <20180126143203.6868.85360.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2018-01-26 15:51 ` Jason Gunthorpe
2018-01-26 14:32 ` [PATCH for-next 07/16] IB/hfi1: Show fault stats in both TX and RX directions Dennis Dalessandro
2018-01-26 14:32 ` [PATCH for-next 08/16] IB/hfi1: Prevent LNI hang when LCB can't obtain lanes Dennis Dalessandro
2018-01-26 14:32 ` [PATCH for-next 09/16] IB/hfi1: Compute BTH only for RDMA_WRITE_LAST/SEND_LAST packet Dennis Dalessandro
2018-01-26 14:32 ` Dennis Dalessandro [this message]
2018-01-26 14:32 ` [PATCH for-next 11/16] IB/hfi1: Look up ibport using a pointer in receive path Dennis Dalessandro
2018-01-26 14:32 ` [PATCH for-next 12/16] IB/hfi1: Remove unnecessary fecn and becn fields Dennis Dalessandro
2018-01-26 14:33 ` [PATCH for-next 13/16] IB/hfi1: Optimize process_receive_ib() Dennis Dalessandro
2018-01-26 14:33 ` [PATCH for-next 14/16] IB/hfi1: Re-order IRQ cleanup to address driver cleanup race Dennis Dalessandro
2018-01-26 14:33 ` [PATCH for-next 15/16] IB/core: Map iWarp AH type to undefined in rdma_ah_find_type Dennis Dalessandro
[not found] ` <20180126143315.6868.67354.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2018-01-26 15:45 ` Jason Gunthorpe
[not found] ` <20180126154540.GA23869-uk2M96/98Pc@public.gmane.org>
2018-01-26 15:58 ` Dennis Dalessandro
[not found] ` <ce815670-cf1b-5199-9a52-2779cb8f8c75-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2018-01-26 17:47 ` Parav Pandit
2018-01-26 18:55 ` Shiraz Saleem
2018-01-26 14:33 ` [PATCH for-next 16/16] IB/ipoib: Fix for potential no-carrier state Dennis Dalessandro
[not found] ` <20180126143323.6868.89162.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2018-01-26 17:00 ` Doug Ledford
[not found] ` <1516986011.27592.207.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-01-26 17:06 ` Jason Gunthorpe
[not found] ` <20180126170610.GD23869-uk2M96/98Pc@public.gmane.org>
2018-01-26 17:09 ` Doug Ledford
[not found] ` <1516986596.27592.209.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-01-26 17:27 ` Estrin, Alex
2018-01-26 17:18 ` Estrin, Alex
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=20180126143235.6868.32732.stgit@scvm10.sc.intel.com \
--to=dennis.dalessandro-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=jgg-uk2M96/98Pc@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=sebastian.sanchez-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox