All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] nvme-fc: Create Association corrections
@ 2017-07-08  1:08 James Smart
  2017-07-08  1:08 ` [PATCH 1/2] nvme_fc/nvmet_fc: revise Create Association descriptor length James Smart
  2017-07-08  1:08 ` [PATCH 2/2] nvmet_fc: Accept variable pad lengths on Create Association LS James Smart
  0 siblings, 2 replies; 5+ messages in thread
From: James Smart @ 2017-07-08  1:08 UTC (permalink / raw)


The FC-NVME spec changed between 1.14 and 1.15 and will again in 1.16
to adjust the Create Association LS. The main change was to reduce
the HostID field from 64bytes to 16bytes. This change was picked up in
a linux by checkin in march. However, the 1.15 spec added pad that the
checkin didn't have and added additional pad it shouldn't have, causing
it to exceed the desired 1Kbytes max payload size for FC-NVME LS's.
1.16 will revise the pad such that the overall LS is 1024 bytes in length.

This patch updates the headers for the spec mod and also modifies the
target such that it will accept a variable amount of pad. This allows
older initiators to still connect.


James Smart (2):
  nvme_fc/nvmet_fc: revise Create Association descriptor length
  nvmet_fc: Accept variable pad lengths on Create Association LS

 drivers/nvme/target/fc.c | 20 +++++++++++++-------
 include/linux/nvme-fc.h  | 23 ++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 8 deletions(-)

-- 
2.11.0

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

* [PATCH 1/2] nvme_fc/nvmet_fc: revise Create Association descriptor length
  2017-07-08  1:08 [PATCH 0/2] nvme-fc: Create Association corrections James Smart
@ 2017-07-08  1:08 ` James Smart
  2017-07-10  5:45   ` Sagi Grimberg
  2017-07-08  1:08 ` [PATCH 2/2] nvmet_fc: Accept variable pad lengths on Create Association LS James Smart
  1 sibling, 1 reply; 5+ messages in thread
From: James Smart @ 2017-07-08  1:08 UTC (permalink / raw)


Revises the Create Association LS for the amount of pad expected in 1.16.

Add defines for the minimum lengths that a target can accept (e.g. variable
pad lengths)

Signed-off-by: James Smart <james.smart at broadcom.com>
---
 include/linux/nvme-fc.h | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/include/linux/nvme-fc.h b/include/linux/nvme-fc.h
index bc711a10be05..21c37e39e41a 100644
--- a/include/linux/nvme-fc.h
+++ b/include/linux/nvme-fc.h
@@ -17,6 +17,7 @@
 
 /*
  * This file contains definitions relative to FC-NVME r1.14 (16-020vB).
+ * The fcnvme_lsdesc_cr_assoc_cmd struct reflects expected r1.16 content.
  */
 
 #ifndef _NVME_FC_H
@@ -193,9 +194,21 @@ struct fcnvme_lsdesc_cr_assoc_cmd {
 	uuid_t	hostid;
 	u8	hostnqn[FCNVME_ASSOC_HOSTNQN_LEN];
 	u8	subnqn[FCNVME_ASSOC_SUBNQN_LEN];
-	u8	rsvd632[384];
+	__be32	rsvd584[108];		/* pad to 1016 bytes,
+					 * which makes overall LS rqst
+					 * payload 1024 bytes
+					 */
 };
 
+#define FCNVME_LSDESC_CRA_CMD_DESC_MINLEN	\
+		offsetof(struct fcnvme_lsdesc_cr_assoc_cmd, rsvd584)
+
+#define FCNVME_LSDESC_CRA_CMD_DESC_MIN_DESCLEN	\
+		(FCNVME_LSDESC_CRA_CMD_DESC_MINLEN - \
+		 offsetof(struct fcnvme_lsdesc_cr_assoc_cmd, ersp_ratio))
+
+
+
 /* FCNVME_LSDESC_CREATE_CONN_CMD */
 struct fcnvme_lsdesc_cr_conn_cmd {
 	__be32	desc_tag;		/* FCNVME_LSDESC_xxx */
@@ -273,6 +286,14 @@ struct fcnvme_ls_cr_assoc_rqst {
 	struct fcnvme_lsdesc_cr_assoc_cmd	assoc_cmd;
 };
 
+#define FCNVME_LSDESC_CRA_RQST_MINLEN	\
+		(offsetof(struct fcnvme_ls_cr_assoc_rqst, assoc_cmd) + \
+			FCNVME_LSDESC_CRA_CMD_DESC_MINLEN)
+
+#define FCNVME_LSDESC_CRA_RQST_MIN_LISTLEN	\
+		FCNVME_LSDESC_CRA_CMD_DESC_MINLEN
+
+
 struct fcnvme_ls_cr_assoc_acc {
 	struct fcnvme_ls_acc_hdr		hdr;
 	struct fcnvme_lsdesc_assoc_id		associd;
-- 
2.11.0

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

* [PATCH 2/2] nvmet_fc: Accept variable pad lengths on Create Association LS
  2017-07-08  1:08 [PATCH 0/2] nvme-fc: Create Association corrections James Smart
  2017-07-08  1:08 ` [PATCH 1/2] nvme_fc/nvmet_fc: revise Create Association descriptor length James Smart
@ 2017-07-08  1:08 ` James Smart
  2017-07-10  5:45   ` Sagi Grimberg
  1 sibling, 1 reply; 5+ messages in thread
From: James Smart @ 2017-07-08  1:08 UTC (permalink / raw)


Target validation of the Create Association LS revised to accept any
LS as long as all non-pad data has been received. This allows a (newer)
target to accept the LS from older initiators with varying pad lengths.

Signed-off-by: James Smart <james.smart at broadcom.com>
---
 drivers/nvme/target/fc.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c
index 7692a96c9065..1e6dcc241b3c 100644
--- a/drivers/nvme/target/fc.c
+++ b/drivers/nvme/target/fc.c
@@ -1164,18 +1164,24 @@ nvmet_fc_ls_create_association(struct nvmet_fc_tgtport *tgtport,
 
 	memset(acc, 0, sizeof(*acc));
 
-	if (iod->rqstdatalen < sizeof(struct fcnvme_ls_cr_assoc_rqst))
+	/*
+	 * FC-NVME spec changes. There are initiators sending different
+	 * lengths as padding sizes for Create Association Cmd descriptor
+	 * was incorrect.
+	 * Accept anything of "minimum" length. Assume format per 1.15
+	 * spec (with HOSTID reduced to 16 bytes), ignore how long the
+	 * trailing pad length is.
+	 */
+	if (iod->rqstdatalen < FCNVME_LSDESC_CRA_RQST_MINLEN)
 		ret = VERR_CR_ASSOC_LEN;
-	else if (rqst->desc_list_len !=
-			fcnvme_lsdesc_len(
-				sizeof(struct fcnvme_ls_cr_assoc_rqst)))
+	else if (rqst->desc_list_len <
+			cpu_to_be32(FCNVME_LSDESC_CRA_RQST_MIN_LISTLEN))
 		ret = VERR_CR_ASSOC_RQST_LEN;
 	else if (rqst->assoc_cmd.desc_tag !=
 			cpu_to_be32(FCNVME_LSDESC_CREATE_ASSOC_CMD))
 		ret = VERR_CR_ASSOC_CMD;
-	else if (rqst->assoc_cmd.desc_len !=
-			fcnvme_lsdesc_len(
-				sizeof(struct fcnvme_lsdesc_cr_assoc_cmd)))
+	else if (rqst->assoc_cmd.desc_len <
+			cpu_to_be32(FCNVME_LSDESC_CRA_CMD_DESC_MIN_DESCLEN))
 		ret = VERR_CR_ASSOC_CMD_LEN;
 	else if (!rqst->assoc_cmd.ersp_ratio ||
 		 (be16_to_cpu(rqst->assoc_cmd.ersp_ratio) >=
-- 
2.11.0

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

* [PATCH 1/2] nvme_fc/nvmet_fc: revise Create Association descriptor length
  2017-07-08  1:08 ` [PATCH 1/2] nvme_fc/nvmet_fc: revise Create Association descriptor length James Smart
@ 2017-07-10  5:45   ` Sagi Grimberg
  0 siblings, 0 replies; 5+ messages in thread
From: Sagi Grimberg @ 2017-07-10  5:45 UTC (permalink / raw)


Looks good,

Reviewed-by: Sagi Grimberg <sagi at grimberg.me>

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

* [PATCH 2/2] nvmet_fc: Accept variable pad lengths on Create Association LS
  2017-07-08  1:08 ` [PATCH 2/2] nvmet_fc: Accept variable pad lengths on Create Association LS James Smart
@ 2017-07-10  5:45   ` Sagi Grimberg
  0 siblings, 0 replies; 5+ messages in thread
From: Sagi Grimberg @ 2017-07-10  5:45 UTC (permalink / raw)


Looks good,

Reviewed-by: Sagi Grimberg <sagi at grimberg.me>

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

end of thread, other threads:[~2017-07-10  5:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-08  1:08 [PATCH 0/2] nvme-fc: Create Association corrections James Smart
2017-07-08  1:08 ` [PATCH 1/2] nvme_fc/nvmet_fc: revise Create Association descriptor length James Smart
2017-07-10  5:45   ` Sagi Grimberg
2017-07-08  1:08 ` [PATCH 2/2] nvmet_fc: Accept variable pad lengths on Create Association LS James Smart
2017-07-10  5:45   ` Sagi Grimberg

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.