All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-next 0/7] IB/hfi1,rdmavt: Driver fixes for 10/9/2017
@ 2017-10-09 19:37 Dennis Dalessandro
       [not found] ` <20171009161736.6965.75352.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Dennis Dalessandro @ 2017-10-09 19:37 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: Mike Marciniszyn, Jan Sokolowski, Jakub Byczkowski,
	Leon Romanovsky, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Alex Estrin,
	Kaike Wan, Grzegorz Morys, Don Hiatt, Ira Weiny

Hi Doug,

Some more fixes for the 4.15 cycle. Nothing in here really warrants going into
the RC. There is one patch reported by Leon that Don has done. Nothing really
too scary in this set.

Patches can can also be found in my GitHub repo at:
https://github.com/ddalessa/kernel/tree/for-4.15

---

Alex Estrin (1):
      IB/rdmavt: Don't wait for resources in QP reset

Don Hiatt (2):
      IB/hfi1: Mask out A bit from psn trace
      IB/hfi1: Eliminate allocation while atomic

Grzegorz Morys (1):
      IB/hfi1: Correct unnecessary acquisition of HW mutex

Jakub Byczkowski (1):
      IB/hfi1: Allow meta version 4 for platform configuration

Jan Sokolowski (1):
      IB/hfi1: Fix serdes loopback set-up

Kaike Wan (1):
      IB/hfi1: Set hdr_type when tx req is allocated


 drivers/infiniband/hw/hfi1/chip.c        |   42 ++++++++++--------------------
 drivers/infiniband/hw/hfi1/chip.h        |    3 ++
 drivers/infiniband/hw/hfi1/common.h      |    1 +
 drivers/infiniband/hw/hfi1/firmware.c    |   21 +++++++++++++--
 drivers/infiniband/hw/hfi1/rc.c          |    1 -
 drivers/infiniband/hw/hfi1/trace.c       |    4 +--
 drivers/infiniband/hw/hfi1/uc.c          |    1 -
 drivers/infiniband/hw/hfi1/verbs.c       |   22 ++++++----------
 drivers/infiniband/hw/hfi1/verbs_txreq.h |    2 +
 drivers/infiniband/sw/rdmavt/mcast.c     |    2 +
 drivers/infiniband/sw/rdmavt/qp.c        |    2 +
 11 files changed, 50 insertions(+), 51 deletions(-)

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH for-next 1/7] IB/hfi1: Fix serdes loopback set-up
       [not found] ` <20171009161736.6965.75352.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
@ 2017-10-09 19:37   ` Dennis Dalessandro
       [not found]     ` <20171009193744.6965.76584.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
  2017-10-09 19:37   ` [PATCH for-next 2/7] IB/hfi1: Allow meta version 4 for platform configuration Dennis Dalessandro
                     ` (7 subsequent siblings)
  8 siblings, 1 reply; 13+ messages in thread
From: Dennis Dalessandro @ 2017-10-09 19:37 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Jan Sokolowski, Jakub Byczkowski

From: Jan Sokolowski <jan.sokolowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Change serdes mode setting to use MISC_CONFIG_BITS in
VERIFY_CAP_LOCAL_LINK_WIDTH register. This method of
setting up serdes loopback is universally compatible
across all firmware versions.

Change-Id: I3ccd935c4b33e843c83c36a2caee77d62249cdc8
Reviewed-by: Jakub Byczkowski <jakub.byczkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Jan Sokolowski <jan.sokolowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/hfi1/chip.c |   42 ++++++++++++-------------------------
 drivers/infiniband/hw/hfi1/chip.h |    3 +++
 2 files changed, 17 insertions(+), 28 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c
index d2d72e0..a6d61c4 100644
--- a/drivers/infiniband/hw/hfi1/chip.c
+++ b/drivers/infiniband/hw/hfi1/chip.c
@@ -9190,25 +9190,6 @@ static int do_quick_linkup(struct hfi1_devdata *dd)
 }
 
 /*
- * Set the SerDes to internal loopback mode.
- * Returns 0 on success, -errno on error.
- */
-static int set_serdes_loopback_mode(struct hfi1_devdata *dd)
-{
-	int ret;
-
-	ret = set_physical_link_state(dd, PLS_INTERNAL_SERDES_LOOPBACK);
-	if (ret == HCMD_SUCCESS)
-		return 0;
-	dd_dev_err(dd,
-		   "Set physical link state to SerDes Loopback failed with return %d\n",
-		   ret);
-	if (ret >= 0)
-		ret = -EINVAL;
-	return ret;
-}
-
-/*
  * Do all special steps to set up loopback.
  */
 static int init_loopback(struct hfi1_devdata *dd)
@@ -9233,13 +9214,11 @@ static int init_loopback(struct hfi1_devdata *dd)
 		return 0;
 	}
 
-	/* handle serdes loopback */
-	if (loopback == LOOPBACK_SERDES) {
-		/* internal serdes loopack needs quick linkup on RTL */
-		if (dd->icode == ICODE_RTL_SILICON)
-			quick_linkup = 1;
-		return set_serdes_loopback_mode(dd);
-	}
+	/*
+	 * SerDes loopback init sequence is handled in set_local_link_attributes
+	 */
+	if (loopback == LOOPBACK_SERDES)
+		return 0;
 
 	/* LCB loopback - handled at poll time */
 	if (loopback == LOOPBACK_LCB) {
@@ -9298,7 +9277,7 @@ static int set_local_link_attributes(struct hfi1_pportdata *ppd)
 	u8 tx_polarity_inversion;
 	u8 rx_polarity_inversion;
 	int ret;
-
+	u32 misc_bits = 0;
 	/* reset our fabric serdes to clear any lingering problems */
 	fabric_serdes_reset(dd);
 
@@ -9344,7 +9323,14 @@ static int set_local_link_attributes(struct hfi1_pportdata *ppd)
 	if (ret != HCMD_SUCCESS)
 		goto set_local_link_attributes_fail;
 
-	ret = write_vc_local_link_width(dd, 0, 0,
+	/*
+	 * SerDes loopback init sequence requires
+	 * setting bit 0 of MISC_CONFIG_BITS
+	 */
+	if (loopback == LOOPBACK_SERDES)
+		misc_bits |= 1 << LOOPBACK_SERDES_CONFIG_BIT_MASK_SHIFT;
+
+	ret = write_vc_local_link_width(dd, misc_bits, 0,
 					opa_to_vc_link_widths(
 						ppd->link_width_enabled));
 	if (ret != HCMD_SUCCESS)
diff --git a/drivers/infiniband/hw/hfi1/chip.h b/drivers/infiniband/hw/hfi1/chip.h
index 213b6a3..fc122c1 100644
--- a/drivers/infiniband/hw/hfi1/chip.h
+++ b/drivers/infiniband/hw/hfi1/chip.h
@@ -583,6 +583,9 @@ enum {
 #define LOOPBACK_LCB	2
 #define LOOPBACK_CABLE	3	/* external cable */
 
+/* set up serdes bit in MISC_CONFIG_BITS */
+#define LOOPBACK_SERDES_CONFIG_BIT_MASK_SHIFT 0
+
 /* read and write hardware registers */
 u64 read_csr(const struct hfi1_devdata *dd, u32 offset);
 void write_csr(const struct hfi1_devdata *dd, u32 offset, u64 value);

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH for-next 2/7] IB/hfi1: Allow meta version 4 for platform configuration
       [not found] ` <20171009161736.6965.75352.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
  2017-10-09 19:37   ` [PATCH for-next 1/7] IB/hfi1: Fix serdes loopback set-up Dennis Dalessandro
@ 2017-10-09 19:37   ` Dennis Dalessandro
  2017-10-09 19:38   ` [PATCH for-next 3/7] IB/hfi1: Correct unnecessary acquisition of HW mutex Dennis Dalessandro
                     ` (6 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Dennis Dalessandro @ 2017-10-09 19:37 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Ira Weiny, Jan Sokolowski,
	Jakub Byczkowski

From: Jakub Byczkowski <jakub.byczkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Parsing of platform configuration format 4 will fail on meta
version check. Allow meta version 4 during parsing.

Reviewed-by: Jan Sokolowski <jan.sokolowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Jakub Byczkowski <jakub.byczkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/hfi1/firmware.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/firmware.c b/drivers/infiniband/hw/hfi1/firmware.c
index dee3c67..b10781d 100644
--- a/drivers/infiniband/hw/hfi1/firmware.c
+++ b/drivers/infiniband/hw/hfi1/firmware.c
@@ -1770,7 +1770,7 @@ static int check_meta_version(struct hfi1_devdata *dd, u32 *system_table)
 	ver_start /= 8;
 	meta_ver = *((u8 *)system_table + ver_start) & ((1 << ver_len) - 1);
 
-	if (meta_ver < 5) {
+	if (meta_ver < 4) {
 		dd_dev_info(
 			dd, "%s:Please update platform config\n", __func__);
 		return -EINVAL;

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH for-next 3/7] IB/hfi1: Correct unnecessary acquisition of HW mutex
       [not found] ` <20171009161736.6965.75352.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
  2017-10-09 19:37   ` [PATCH for-next 1/7] IB/hfi1: Fix serdes loopback set-up Dennis Dalessandro
  2017-10-09 19:37   ` [PATCH for-next 2/7] IB/hfi1: Allow meta version 4 for platform configuration Dennis Dalessandro
@ 2017-10-09 19:38   ` Dennis Dalessandro
  2017-10-09 19:38   ` [PATCH for-next 4/7] IB/hfi1: Mask out A bit from psn trace Dennis Dalessandro
                     ` (5 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Dennis Dalessandro @ 2017-10-09 19:38 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Mike Marciniszyn, Grzegorz Morys

From: Grzegorz Morys <grzegorz.morys-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Avoid acquiring already acquired hardware mutex and releasing
the unacquired one as these are redundant operations.
Add printouts for such situations to help detect potential errors
within the driver.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Grzegorz Morys <grzegorz.morys-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/hfi1/firmware.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/firmware.c b/drivers/infiniband/hw/hfi1/firmware.c
index b10781d..148a2c7 100644
--- a/drivers/infiniband/hw/hfi1/firmware.c
+++ b/drivers/infiniband/hw/hfi1/firmware.c
@@ -1424,7 +1424,14 @@ int acquire_hw_mutex(struct hfi1_devdata *dd)
 	unsigned long timeout;
 	int try = 0;
 	u8 mask = 1 << dd->hfi1_id;
-	u8 user;
+	u8 user = (u8)read_csr(dd, ASIC_CFG_MUTEX);
+
+	if (user == mask) {
+		dd_dev_info(dd,
+			    "Hardware mutex already acquired, mutex mask %u\n",
+			    (u32)mask);
+		return 0;
+	}
 
 retry:
 	timeout = msecs_to_jiffies(HM_TIMEOUT) + jiffies;
@@ -1455,7 +1462,15 @@ int acquire_hw_mutex(struct hfi1_devdata *dd)
 
 void release_hw_mutex(struct hfi1_devdata *dd)
 {
-	write_csr(dd, ASIC_CFG_MUTEX, 0);
+	u8 mask = 1 << dd->hfi1_id;
+	u8 user = (u8)read_csr(dd, ASIC_CFG_MUTEX);
+
+	if (user != mask)
+		dd_dev_warn(dd,
+			    "Unable to release hardware mutex, mutex mask %u, my mask %u\n",
+			    (u32)user, (u32)mask);
+	else
+		write_csr(dd, ASIC_CFG_MUTEX, 0);
 }
 
 /* return the given resource bit(s) as a mask for the given HFI */

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH for-next 4/7] IB/hfi1: Mask out A bit from psn trace
       [not found] ` <20171009161736.6965.75352.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
                     ` (2 preceding siblings ...)
  2017-10-09 19:38   ` [PATCH for-next 3/7] IB/hfi1: Correct unnecessary acquisition of HW mutex Dennis Dalessandro
@ 2017-10-09 19:38   ` Dennis Dalessandro
  2017-10-09 19:38   ` [PATCH for-next 5/7] IB/hfi1: Eliminate allocation while atomic Dennis Dalessandro
                     ` (4 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Dennis Dalessandro @ 2017-10-09 19:38 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Don Hiatt, Mike Marciniszyn

From: Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

The trace logic prior to the fixes below used to mask the
A bit from the psn. It now mistakenly displays the A bit,
which is already displayed separately.

Fix by adding the appropriate mask to the psn tracing.

Fixes: 228d2af1b723 ("IB/hfi1: Separate input/output header tracing")
Fixes: 863cf89d472f ("IB/hfi1: Add 16B trace support")
Reviewed-by: Mike Marciniszyn <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/hfi1/trace.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/trace.c b/drivers/infiniband/hw/hfi1/trace.c
index ce5a43f..959a804 100644
--- a/drivers/infiniband/hw/hfi1/trace.c
+++ b/drivers/infiniband/hw/hfi1/trace.c
@@ -151,7 +151,7 @@ void hfi1_trace_parse_9b_bth(struct ib_other_headers *ohdr,
 	*opcode = ib_bth_get_opcode(ohdr);
 	*tver = ib_bth_get_tver(ohdr);
 	*pkey = ib_bth_get_pkey(ohdr);
-	*psn = ib_bth_get_psn(ohdr);
+	*psn = mask_psn(ib_bth_get_psn(ohdr));
 	*qpn = ib_bth_get_qpn(ohdr);
 }
 
@@ -166,7 +166,7 @@ void hfi1_trace_parse_16b_bth(struct ib_other_headers *ohdr,
 	*pad = ib_bth_get_pad(ohdr);
 	*se = ib_bth_get_se(ohdr);
 	*tver = ib_bth_get_tver(ohdr);
-	*psn = ib_bth_get_psn(ohdr);
+	*psn = mask_psn(ib_bth_get_psn(ohdr));
 	*qpn = ib_bth_get_qpn(ohdr);
 }
 

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH for-next 5/7] IB/hfi1: Eliminate allocation while atomic
       [not found] ` <20171009161736.6965.75352.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
                     ` (3 preceding siblings ...)
  2017-10-09 19:38   ` [PATCH for-next 4/7] IB/hfi1: Mask out A bit from psn trace Dennis Dalessandro
@ 2017-10-09 19:38   ` Dennis Dalessandro
       [not found]     ` <20171009193817.6965.44567.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
  2017-10-09 19:38   ` [PATCH for-next 6/7] IB/hfi1: Set hdr_type when tx req is allocated Dennis Dalessandro
                     ` (3 subsequent siblings)
  8 siblings, 1 reply; 13+ messages in thread
From: Dennis Dalessandro @ 2017-10-09 19:38 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Don Hiatt, Mike Marciniszyn,
	Leon Romanovsky

From: Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

The PIO trailing buffer was being dynamically allocated
but the kcalloc return value was not being checked. Further,
the GFP_KERNEL was being used even though the send engine
might be called with interrupts disabled.

Since the maximum size of the trailing buffer is only 12
bytes (CRC = 4, LT = 1, Pad = 0 to 7 bytes) just statically
allocate the buffer, remove the alloc entirely and share it
with the SDMA engine by making it global.

Reported-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Fixes: 566d53a82644 ("IB/hfi1: Enhance PIO/SDMA send for 16B")
Reviewed-by: Mike Marciniszyn <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/hfi1/common.h |    1 +
 drivers/infiniband/hw/hfi1/verbs.c  |   22 ++++++++--------------
 2 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/common.h b/drivers/infiniband/hw/hfi1/common.h
index 3e27794..7108d4d 100644
--- a/drivers/infiniband/hw/hfi1/common.h
+++ b/drivers/infiniband/hw/hfi1/common.h
@@ -328,6 +328,7 @@ struct diag_pkt {
 #define SC15_PACKET 0xF
 #define SIZE_OF_CRC 1
 #define SIZE_OF_LT 1
+#define MAX_16B_PADDING 12 /* CRC = 4, LT = 1, Pad = 0 to 7 bytes */
 
 #define LIM_MGMT_P_KEY       0x7FFF
 #define FULL_MGMT_P_KEY      0xFFFF
diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c
index e232f3c..726c064 100644
--- a/drivers/infiniband/hw/hfi1/verbs.c
+++ b/drivers/infiniband/hw/hfi1/verbs.c
@@ -146,6 +146,9 @@ static int pio_wait(struct rvt_qp *qp,
 /* Length of buffer to create verbs txreq cache name */
 #define TXREQ_NAME_LEN 24
 
+/* 16B trailing buffer */
+static const u8 trail_buf[MAX_16B_PADDING];
+
 static uint wss_threshold;
 module_param(wss_threshold, uint, S_IRUGO);
 MODULE_PARM_DESC(wss_threshold, "Percentage (1-100) of LLC to use as a threshold for a cacheless copy");
@@ -814,7 +817,6 @@ static int build_verbs_tx_desc(
 	u16 hdrbytes = tx->hdr_dwords << 2;
 	u32 *hdr;
 	u8 extra_bytes = 0;
-	static char trail_buf[12]; /* CRC = 4, LT = 1, Pad = 0 to 7 bytes */
 
 	if (tx->phdr.hdr.hdr_type) {
 		/*
@@ -869,9 +871,9 @@ static int build_verbs_tx_desc(
 	}
 
 	/* add icrc, lt byte, and padding to flit */
-	if (extra_bytes != 0)
+	if (extra_bytes)
 		ret = sdma_txadd_kvaddr(sde->dd, &tx->txreq,
-					trail_buf, extra_bytes);
+					(void *)trail_buf, extra_bytes);
 
 bail_txadd:
 	return ret;
@@ -1128,18 +1130,10 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps,
 				len -= slen;
 			}
 		}
-		/*
-		 * Bypass packet will need to copy additional
-		 * bytes to accommodate for CRC and LT bytes
-		 */
-		if (extra_bytes) {
-			u8 *empty_buf;
+		/* add icrc, lt byte, and padding to flit */
+		if (extra_bytes)
+			seg_pio_copy_mid(pbuf, trail_buf, extra_bytes);
 
-			empty_buf = kcalloc(extra_bytes, sizeof(u8),
-					    GFP_KERNEL);
-			seg_pio_copy_mid(pbuf, empty_buf, extra_bytes);
-			kfree(empty_buf);
-		}
 		seg_pio_copy_end(pbuf);
 	}
 

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH for-next 6/7] IB/hfi1: Set hdr_type when tx req is allocated
       [not found] ` <20171009161736.6965.75352.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
                     ` (4 preceding siblings ...)
  2017-10-09 19:38   ` [PATCH for-next 5/7] IB/hfi1: Eliminate allocation while atomic Dennis Dalessandro
@ 2017-10-09 19:38   ` Dennis Dalessandro
  2017-10-09 19:38   ` [PATCH for-next 7/7] IB/rdmavt: Don't wait for resources in QP reset Dennis Dalessandro
                     ` (2 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Dennis Dalessandro @ 2017-10-09 19:38 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Don Hiatt, Mike Marciniszyn,
	Kaike Wan

From: Kaike Wan <kaike.wan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Setting the protocol type should be part of initializing the tx request.
For UC and RC, the current protocol type is part of the qp priv structure.
For ud requests, it needs to be adjusted dynamically, based on the AV
posted with the WQE. This patch will simplify the initialization of the
tx request.

Fixes: 5b6cabb0db77 ("IB/hfi1: Add 16B RC/UC support")
Reviewed-by: Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Mike Marciniszyn <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Kaike Wan <kaike.wan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/hfi1/rc.c          |    1 -
 drivers/infiniband/hw/hfi1/uc.c          |    1 -
 drivers/infiniband/hw/hfi1/verbs_txreq.h |    2 ++
 3 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/rc.c b/drivers/infiniband/hw/hfi1/rc.c
index e1cf0c0..bfe3e38 100644
--- a/drivers/infiniband/hw/hfi1/rc.c
+++ b/drivers/infiniband/hw/hfi1/rc.c
@@ -276,7 +276,6 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)
 	if (IS_ERR(ps->s_txreq))
 		goto bail_no_tx;
 
-	ps->s_txreq->phdr.hdr.hdr_type = priv->hdr_type;
 	if (priv->hdr_type == HFI1_PKT_TYPE_9B) {
 		/* header size in 32-bit words LRH+BTH = (8+12)/4. */
 		hwords = 5;
diff --git a/drivers/infiniband/hw/hfi1/uc.c b/drivers/infiniband/hw/hfi1/uc.c
index 0b64617..fcd8186 100644
--- a/drivers/infiniband/hw/hfi1/uc.c
+++ b/drivers/infiniband/hw/hfi1/uc.c
@@ -93,7 +93,6 @@ int hfi1_make_uc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)
 		goto done_free_tx;
 	}
 
-	ps->s_txreq->phdr.hdr.hdr_type = priv->hdr_type;
 	if (priv->hdr_type == HFI1_PKT_TYPE_9B) {
 		/* header size in 32-bit words LRH+BTH = (8+12)/4. */
 		hwords = 5;
diff --git a/drivers/infiniband/hw/hfi1/verbs_txreq.h b/drivers/infiniband/hw/hfi1/verbs_txreq.h
index 76216f2..cec7a4b 100644
--- a/drivers/infiniband/hw/hfi1/verbs_txreq.h
+++ b/drivers/infiniband/hw/hfi1/verbs_txreq.h
@@ -92,6 +92,8 @@ struct verbs_txreq *__get_txreq(struct hfi1_ibdev *dev,
 	tx->psc = priv->s_sendcontext;
 	/* so that we can test if the sdma decriptors are there */
 	tx->txreq.num_desc = 0;
+	/* Set the header type */
+	tx->phdr.hdr.hdr_type = priv->hdr_type;
 	return tx;
 }
 

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH for-next 7/7] IB/rdmavt: Don't wait for resources in QP reset
       [not found] ` <20171009161736.6965.75352.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
                     ` (5 preceding siblings ...)
  2017-10-09 19:38   ` [PATCH for-next 6/7] IB/hfi1: Set hdr_type when tx req is allocated Dennis Dalessandro
@ 2017-10-09 19:38   ` Dennis Dalessandro
  2017-10-09 20:08   ` [PATCH for-next 1/7 TakeThisOne] IB/hfi1: Fix serdes loopback set-up Dennis Dalessandro
  2017-10-18 14:13   ` [PATCH for-next 0/7] IB/hfi1,rdmavt: Driver fixes for 10/9/2017 Doug Ledford
  8 siblings, 0 replies; 13+ messages in thread
From: Dennis Dalessandro @ 2017-10-09 19:38 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Mike Marciniszyn, Alex Estrin

From: Alex Estrin <alex.estrin-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Per the IBTA spec, QP destroy shall fail if the QP is attached
to multicast groups, although the spec is silent on modify_qp
to reset state. It implies that ULP must deregister QP from
all mcast groups for destroy to succeed.
The faulty patch "IB/ipoib: Update broadcast object if PKey value
was changed in index 0" exposed two issues in rdmavt:
1. Rvt QP reset waits for qp references to go to zero.
This will hang if QP is attached to multicast groups.
2. The mcast group detach will fail for a QP in reset state
therefore preventing ULP from correcting the issue.
This patch moves the reference count wait to the the destroy QP
path and allows a QP mcast detach to work in the reset state.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Alex Estrin <alex.estrin-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/sw/rdmavt/mcast.c |    2 +-
 drivers/infiniband/sw/rdmavt/qp.c    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/sw/rdmavt/mcast.c b/drivers/infiniband/sw/rdmavt/mcast.c
index 1f12b69..b3a38c5 100644
--- a/drivers/infiniband/sw/rdmavt/mcast.c
+++ b/drivers/infiniband/sw/rdmavt/mcast.c
@@ -351,7 +351,7 @@ int rvt_detach_mcast(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
 	int last = 0;
 	int ret = 0;
 
-	if (ibqp->qp_num <= 1 || qp->state == IB_QPS_RESET)
+	if (ibqp->qp_num <= 1)
 		return -EINVAL;
 
 	spin_lock_irq(&ibp->lock);
diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c
index 22df09a..367c786 100644
--- a/drivers/infiniband/sw/rdmavt/qp.c
+++ b/drivers/infiniband/sw/rdmavt/qp.c
@@ -717,7 +717,6 @@ static void rvt_reset_qp(struct rvt_dev_info *rdi, struct rvt_qp *qp,
 
 		/* take qp out the hash and wait for it to be unused */
 		rvt_remove_qp(rdi, qp);
-		wait_event(qp->wait, !atomic_read(&qp->refcount));
 
 		/* grab the lock b/c it was locked at call time */
 		spin_lock_irq(&qp->r_lock);
@@ -1443,6 +1442,7 @@ int rvt_destroy_qp(struct ib_qp *ibqp)
 	spin_unlock(&qp->s_hlock);
 	spin_unlock_irq(&qp->r_lock);
 
+	wait_event(qp->wait, !atomic_read(&qp->refcount));
 	/* qpn is now available for use again */
 	rvt_free_qpn(&rdi->qp_dev->qpn_table, qp->ibqp.qp_num);
 

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH for-next 5/7] IB/hfi1: Eliminate allocation while atomic
       [not found]     ` <20171009193817.6965.44567.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
@ 2017-10-09 19:57       ` Leon Romanovsky
  0 siblings, 0 replies; 13+ messages in thread
From: Leon Romanovsky @ 2017-10-09 19:57 UTC (permalink / raw)
  To: Dennis Dalessandro
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Don Hiatt, Mike Marciniszyn

[-- Attachment #1: Type: text/plain, Size: 1269 bytes --]

On Mon, Oct 09, 2017 at 12:38:19PM -0700, Dennis Dalessandro wrote:
> From: Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>
> The PIO trailing buffer was being dynamically allocated
> but the kcalloc return value was not being checked. Further,
> the GFP_KERNEL was being used even though the send engine
> might be called with interrupts disabled.
>
> Since the maximum size of the trailing buffer is only 12
> bytes (CRC = 4, LT = 1, Pad = 0 to 7 bytes) just statically
> allocate the buffer, remove the alloc entirely and share it
> with the SDMA engine by making it global.
>
> Reported-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Fixes: 566d53a82644 ("IB/hfi1: Enhance PIO/SDMA send for 16B")
> Reviewed-by: Mike Marciniszyn <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Don Hiatt <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> ---
>  drivers/infiniband/hw/hfi1/common.h |    1 +
>  drivers/infiniband/hw/hfi1/verbs.c  |   22 ++++++++--------------
>  2 files changed, 9 insertions(+), 14 deletions(-)
>

Thanks,
Reviewed-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH for-next 1/7] IB/hfi1: Fix serdes loopback set-up
       [not found]     ` <20171009193744.6965.76584.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
@ 2017-10-09 19:58       ` Leon Romanovsky
       [not found]         ` <20171009195846.GH1252-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Leon Romanovsky @ 2017-10-09 19:58 UTC (permalink / raw)
  To: Dennis Dalessandro
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Jan Sokolowski,
	Jakub Byczkowski

[-- Attachment #1: Type: text/plain, Size: 4042 bytes --]

On Mon, Oct 09, 2017 at 12:37:48PM -0700, Dennis Dalessandro wrote:
> From: Jan Sokolowski <jan.sokolowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>
> Change serdes mode setting to use MISC_CONFIG_BITS in
> VERIFY_CAP_LOCAL_LINK_WIDTH register. This method of
> setting up serdes loopback is universally compatible
> across all firmware versions.
>
> Change-Id: I3ccd935c4b33e843c83c36a2caee77d62249cdc8

It doesn't belong here.
We don't love Gerrit here :)

> Reviewed-by: Jakub Byczkowski <jakub.byczkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Jan Sokolowski <jan.sokolowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> ---
>  drivers/infiniband/hw/hfi1/chip.c |   42 ++++++++++++-------------------------
>  drivers/infiniband/hw/hfi1/chip.h |    3 +++
>  2 files changed, 17 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c
> index d2d72e0..a6d61c4 100644
> --- a/drivers/infiniband/hw/hfi1/chip.c
> +++ b/drivers/infiniband/hw/hfi1/chip.c
> @@ -9190,25 +9190,6 @@ static int do_quick_linkup(struct hfi1_devdata *dd)
>  }
>
>  /*
> - * Set the SerDes to internal loopback mode.
> - * Returns 0 on success, -errno on error.
> - */
> -static int set_serdes_loopback_mode(struct hfi1_devdata *dd)
> -{
> -	int ret;
> -
> -	ret = set_physical_link_state(dd, PLS_INTERNAL_SERDES_LOOPBACK);
> -	if (ret == HCMD_SUCCESS)
> -		return 0;
> -	dd_dev_err(dd,
> -		   "Set physical link state to SerDes Loopback failed with return %d\n",
> -		   ret);
> -	if (ret >= 0)
> -		ret = -EINVAL;
> -	return ret;
> -}
> -
> -/*
>   * Do all special steps to set up loopback.
>   */
>  static int init_loopback(struct hfi1_devdata *dd)
> @@ -9233,13 +9214,11 @@ static int init_loopback(struct hfi1_devdata *dd)
>  		return 0;
>  	}
>
> -	/* handle serdes loopback */
> -	if (loopback == LOOPBACK_SERDES) {
> -		/* internal serdes loopack needs quick linkup on RTL */
> -		if (dd->icode == ICODE_RTL_SILICON)
> -			quick_linkup = 1;
> -		return set_serdes_loopback_mode(dd);
> -	}
> +	/*
> +	 * SerDes loopback init sequence is handled in set_local_link_attributes
> +	 */
> +	if (loopback == LOOPBACK_SERDES)
> +		return 0;
>
>  	/* LCB loopback - handled at poll time */
>  	if (loopback == LOOPBACK_LCB) {
> @@ -9298,7 +9277,7 @@ static int set_local_link_attributes(struct hfi1_pportdata *ppd)
>  	u8 tx_polarity_inversion;
>  	u8 rx_polarity_inversion;
>  	int ret;
> -
> +	u32 misc_bits = 0;
>  	/* reset our fabric serdes to clear any lingering problems */
>  	fabric_serdes_reset(dd);
>
> @@ -9344,7 +9323,14 @@ static int set_local_link_attributes(struct hfi1_pportdata *ppd)
>  	if (ret != HCMD_SUCCESS)
>  		goto set_local_link_attributes_fail;
>
> -	ret = write_vc_local_link_width(dd, 0, 0,
> +	/*
> +	 * SerDes loopback init sequence requires
> +	 * setting bit 0 of MISC_CONFIG_BITS
> +	 */
> +	if (loopback == LOOPBACK_SERDES)
> +		misc_bits |= 1 << LOOPBACK_SERDES_CONFIG_BIT_MASK_SHIFT;
> +
> +	ret = write_vc_local_link_width(dd, misc_bits, 0,
>  					opa_to_vc_link_widths(
>  						ppd->link_width_enabled));
>  	if (ret != HCMD_SUCCESS)
> diff --git a/drivers/infiniband/hw/hfi1/chip.h b/drivers/infiniband/hw/hfi1/chip.h
> index 213b6a3..fc122c1 100644
> --- a/drivers/infiniband/hw/hfi1/chip.h
> +++ b/drivers/infiniband/hw/hfi1/chip.h
> @@ -583,6 +583,9 @@ enum {
>  #define LOOPBACK_LCB	2
>  #define LOOPBACK_CABLE	3	/* external cable */
>
> +/* set up serdes bit in MISC_CONFIG_BITS */
> +#define LOOPBACK_SERDES_CONFIG_BIT_MASK_SHIFT 0
> +
>  /* read and write hardware registers */
>  u64 read_csr(const struct hfi1_devdata *dd, u32 offset);
>  void write_csr(const struct hfi1_devdata *dd, u32 offset, u64 value);
>
> --
> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH for-next 1/7] IB/hfi1: Fix serdes loopback set-up
       [not found]         ` <20171009195846.GH1252-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
@ 2017-10-09 20:00           ` Dennis Dalessandro
  0 siblings, 0 replies; 13+ messages in thread
From: Dennis Dalessandro @ 2017-10-09 20:00 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Jan Sokolowski,
	Jakub Byczkowski

On 10/9/2017 3:58 PM, Leon Romanovsky wrote:
> On Mon, Oct 09, 2017 at 12:37:48PM -0700, Dennis Dalessandro wrote:
>> From: Jan Sokolowski <jan.sokolowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>>
>> Change serdes mode setting to use MISC_CONFIG_BITS in
>> VERIFY_CAP_LOCAL_LINK_WIDTH register. This method of
>> setting up serdes loopback is universally compatible
>> across all firmware versions.
>>
>> Change-Id: I3ccd935c4b33e843c83c36a2caee77d62249cdc8
> 
> It doesn't belong here.
> We don't love Gerrit here :)

I was literally about to hit send on a reply having just noticed that 
too. I forgot to remove the stupid gerrit commit hook when I edited 
Jan's patch. Doh!

v2 of this one coming up...

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH for-next 1/7 TakeThisOne] IB/hfi1: Fix serdes loopback set-up
       [not found] ` <20171009161736.6965.75352.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
                     ` (6 preceding siblings ...)
  2017-10-09 19:38   ` [PATCH for-next 7/7] IB/rdmavt: Don't wait for resources in QP reset Dennis Dalessandro
@ 2017-10-09 20:08   ` Dennis Dalessandro
  2017-10-18 14:13   ` [PATCH for-next 0/7] IB/hfi1,rdmavt: Driver fixes for 10/9/2017 Doug Ledford
  8 siblings, 0 replies; 13+ messages in thread
From: Dennis Dalessandro @ 2017-10-09 20:08 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Jan Sokolowski, Jakub Byczkowski

From: Jan Sokolowski <jan.sokolowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Change serdes mode setting to use MISC_CONFIG_BITS in
VERIFY_CAP_LOCAL_LINK_WIDTH register. This method of
setting up serdes loopback is universally compatible
across all firmware versions.

Reviewed-by: Jakub Byczkowski <jakub.byczkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Jan Sokolowski <jan.sokolowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/hfi1/chip.c |   42 ++++++++++++-------------------------
 drivers/infiniband/hw/hfi1/chip.h |    3 +++
 2 files changed, 17 insertions(+), 28 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c
index d2d72e0..a6d61c4 100644
--- a/drivers/infiniband/hw/hfi1/chip.c
+++ b/drivers/infiniband/hw/hfi1/chip.c
@@ -9190,25 +9190,6 @@ static int do_quick_linkup(struct hfi1_devdata *dd)
 }
 
 /*
- * Set the SerDes to internal loopback mode.
- * Returns 0 on success, -errno on error.
- */
-static int set_serdes_loopback_mode(struct hfi1_devdata *dd)
-{
-	int ret;
-
-	ret = set_physical_link_state(dd, PLS_INTERNAL_SERDES_LOOPBACK);
-	if (ret == HCMD_SUCCESS)
-		return 0;
-	dd_dev_err(dd,
-		   "Set physical link state to SerDes Loopback failed with return %d\n",
-		   ret);
-	if (ret >= 0)
-		ret = -EINVAL;
-	return ret;
-}
-
-/*
  * Do all special steps to set up loopback.
  */
 static int init_loopback(struct hfi1_devdata *dd)
@@ -9233,13 +9214,11 @@ static int init_loopback(struct hfi1_devdata *dd)
 		return 0;
 	}
 
-	/* handle serdes loopback */
-	if (loopback == LOOPBACK_SERDES) {
-		/* internal serdes loopack needs quick linkup on RTL */
-		if (dd->icode == ICODE_RTL_SILICON)
-			quick_linkup = 1;
-		return set_serdes_loopback_mode(dd);
-	}
+	/*
+	 * SerDes loopback init sequence is handled in set_local_link_attributes
+	 */
+	if (loopback == LOOPBACK_SERDES)
+		return 0;
 
 	/* LCB loopback - handled at poll time */
 	if (loopback == LOOPBACK_LCB) {
@@ -9298,7 +9277,7 @@ static int set_local_link_attributes(struct hfi1_pportdata *ppd)
 	u8 tx_polarity_inversion;
 	u8 rx_polarity_inversion;
 	int ret;
-
+	u32 misc_bits = 0;
 	/* reset our fabric serdes to clear any lingering problems */
 	fabric_serdes_reset(dd);
 
@@ -9344,7 +9323,14 @@ static int set_local_link_attributes(struct hfi1_pportdata *ppd)
 	if (ret != HCMD_SUCCESS)
 		goto set_local_link_attributes_fail;
 
-	ret = write_vc_local_link_width(dd, 0, 0,
+	/*
+	 * SerDes loopback init sequence requires
+	 * setting bit 0 of MISC_CONFIG_BITS
+	 */
+	if (loopback == LOOPBACK_SERDES)
+		misc_bits |= 1 << LOOPBACK_SERDES_CONFIG_BIT_MASK_SHIFT;
+
+	ret = write_vc_local_link_width(dd, misc_bits, 0,
 					opa_to_vc_link_widths(
 						ppd->link_width_enabled));
 	if (ret != HCMD_SUCCESS)
diff --git a/drivers/infiniband/hw/hfi1/chip.h b/drivers/infiniband/hw/hfi1/chip.h
index 213b6a3..fc122c1 100644
--- a/drivers/infiniband/hw/hfi1/chip.h
+++ b/drivers/infiniband/hw/hfi1/chip.h
@@ -583,6 +583,9 @@ enum {
 #define LOOPBACK_LCB	2
 #define LOOPBACK_CABLE	3	/* external cable */
 
+/* set up serdes bit in MISC_CONFIG_BITS */
+#define LOOPBACK_SERDES_CONFIG_BIT_MASK_SHIFT 0
+
 /* read and write hardware registers */
 u64 read_csr(const struct hfi1_devdata *dd, u32 offset);
 void write_csr(const struct hfi1_devdata *dd, u32 offset, u64 value);

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH for-next 0/7] IB/hfi1,rdmavt: Driver fixes for 10/9/2017
       [not found] ` <20171009161736.6965.75352.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
                     ` (7 preceding siblings ...)
  2017-10-09 20:08   ` [PATCH for-next 1/7 TakeThisOne] IB/hfi1: Fix serdes loopback set-up Dennis Dalessandro
@ 2017-10-18 14:13   ` Doug Ledford
  8 siblings, 0 replies; 13+ messages in thread
From: Doug Ledford @ 2017-10-18 14:13 UTC (permalink / raw)
  To: Dennis Dalessandro
  Cc: Mike Marciniszyn, Jan Sokolowski, Jakub Byczkowski,
	Leon Romanovsky, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Alex Estrin,
	Kaike Wan, Grzegorz Morys, Don Hiatt, Ira Weiny

On Mon, 2017-10-09 at 12:37 -0700, Dennis Dalessandro wrote:
> Hi Doug,
> 
> Some more fixes for the 4.15 cycle. Nothing in here really warrants
> going into
> the RC. There is one patch reported by Leon that Don has done.
> Nothing really
> too scary in this set.
> 
> Patches can can also be found in my GitHub repo at:
> https://github.com/ddalessa/kernel/tree/for-4.15

Thanks, applied.

-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
    GPG KeyID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-10-18 14:13 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-09 19:37 [PATCH for-next 0/7] IB/hfi1,rdmavt: Driver fixes for 10/9/2017 Dennis Dalessandro
     [not found] ` <20171009161736.6965.75352.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2017-10-09 19:37   ` [PATCH for-next 1/7] IB/hfi1: Fix serdes loopback set-up Dennis Dalessandro
     [not found]     ` <20171009193744.6965.76584.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2017-10-09 19:58       ` Leon Romanovsky
     [not found]         ` <20171009195846.GH1252-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-10-09 20:00           ` Dennis Dalessandro
2017-10-09 19:37   ` [PATCH for-next 2/7] IB/hfi1: Allow meta version 4 for platform configuration Dennis Dalessandro
2017-10-09 19:38   ` [PATCH for-next 3/7] IB/hfi1: Correct unnecessary acquisition of HW mutex Dennis Dalessandro
2017-10-09 19:38   ` [PATCH for-next 4/7] IB/hfi1: Mask out A bit from psn trace Dennis Dalessandro
2017-10-09 19:38   ` [PATCH for-next 5/7] IB/hfi1: Eliminate allocation while atomic Dennis Dalessandro
     [not found]     ` <20171009193817.6965.44567.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2017-10-09 19:57       ` Leon Romanovsky
2017-10-09 19:38   ` [PATCH for-next 6/7] IB/hfi1: Set hdr_type when tx req is allocated Dennis Dalessandro
2017-10-09 19:38   ` [PATCH for-next 7/7] IB/rdmavt: Don't wait for resources in QP reset Dennis Dalessandro
2017-10-09 20:08   ` [PATCH for-next 1/7 TakeThisOne] IB/hfi1: Fix serdes loopback set-up Dennis Dalessandro
2017-10-18 14:13   ` [PATCH for-next 0/7] IB/hfi1,rdmavt: Driver fixes for 10/9/2017 Doug Ledford

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.