All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] nvme: fix byte swapping in the streams code
@ 2017-07-14 10:43 Christoph Hellwig
  2017-07-14 10:43 ` [PATCH 2/2] nvmet-fc: fix byte swapping in nvmet_fc_ls_create_association Christoph Hellwig
  2017-07-14 14:01 ` [PATCH 1/2] nvme: fix byte swapping in the streams code Jens Axboe
  0 siblings, 2 replies; 4+ messages in thread
From: Christoph Hellwig @ 2017-07-14 10:43 UTC (permalink / raw)


Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 drivers/nvme/host/core.c |  2 +-
 include/linux/nvme.h     | 14 +++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index cb96f4a7ae3a..3b77cfe5aa1e 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -336,7 +336,7 @@ static int nvme_get_stream_params(struct nvme_ctrl *ctrl,
 
 	c.directive.opcode = nvme_admin_directive_recv;
 	c.directive.nsid = cpu_to_le32(nsid);
-	c.directive.numd = sizeof(*s);
+	c.directive.numd = cpu_to_le32(sizeof(*s));
 	c.directive.doper = NVME_DIR_RCV_ST_OP_PARAM;
 	c.directive.dtype = NVME_DIR_STREAMS;
 
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 6b8ee9e628e1..bc74da018bdc 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -963,14 +963,14 @@ struct nvme_dbbuf {
 };
 
 struct streams_directive_params {
-	__u16	msl;
-	__u16	nssa;
-	__u16	nsso;
+	__le16	msl;
+	__le16	nssa;
+	__le16	nsso;
 	__u8	rsvd[10];
-	__u32	sws;
-	__u16	sgs;
-	__u16	nsa;
-	__u16	nso;
+	__le32	sws;
+	__le16	sgs;
+	__le16	nsa;
+	__le16	nso;
 	__u8	rsvd2[6];
 };
 
-- 
2.11.0

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

* [PATCH 2/2] nvmet-fc: fix byte swapping in nvmet_fc_ls_create_association
  2017-07-14 10:43 [PATCH 1/2] nvme: fix byte swapping in the streams code Christoph Hellwig
@ 2017-07-14 10:43 ` Christoph Hellwig
  2017-07-14 15:34   ` James Smart
  2017-07-14 14:01 ` [PATCH 1/2] nvme: fix byte swapping in the streams code Jens Axboe
  1 sibling, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2017-07-14 10:43 UTC (permalink / raw)


We always need to do non-equal comparisms on the native endian versions
to get the correct result.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 drivers/nvme/target/fc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c
index 1e6dcc241b3c..d5801c150b1c 100644
--- a/drivers/nvme/target/fc.c
+++ b/drivers/nvme/target/fc.c
@@ -1174,14 +1174,14 @@ nvmet_fc_ls_create_association(struct nvmet_fc_tgtport *tgtport,
 	 */
 	if (iod->rqstdatalen < FCNVME_LSDESC_CRA_RQST_MINLEN)
 		ret = VERR_CR_ASSOC_LEN;
-	else if (rqst->desc_list_len <
-			cpu_to_be32(FCNVME_LSDESC_CRA_RQST_MIN_LISTLEN))
+	else if (be32_to_cpu(rqst->desc_list_len) <
+			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 <
-			cpu_to_be32(FCNVME_LSDESC_CRA_CMD_DESC_MIN_DESCLEN))
+	else if (be32_to_cpu(rqst->assoc_cmd.desc_len) <
+			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] 4+ messages in thread

* [PATCH 1/2] nvme: fix byte swapping in the streams code
  2017-07-14 10:43 [PATCH 1/2] nvme: fix byte swapping in the streams code Christoph Hellwig
  2017-07-14 10:43 ` [PATCH 2/2] nvmet-fc: fix byte swapping in nvmet_fc_ls_create_association Christoph Hellwig
@ 2017-07-14 14:01 ` Jens Axboe
  1 sibling, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2017-07-14 14:01 UTC (permalink / raw)


On 07/14/2017 04:43 AM, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch at lst.de>

Oops, obviously correct.

Reviewed-by: Jens Axboe <axboe at kernel.dk>

-- 
Jens Axboe

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

* [PATCH 2/2] nvmet-fc: fix byte swapping in nvmet_fc_ls_create_association
  2017-07-14 10:43 ` [PATCH 2/2] nvmet-fc: fix byte swapping in nvmet_fc_ls_create_association Christoph Hellwig
@ 2017-07-14 15:34   ` James Smart
  0 siblings, 0 replies; 4+ messages in thread
From: James Smart @ 2017-07-14 15:34 UTC (permalink / raw)


On 7/14/2017 3:43 AM, Christoph Hellwig wrote:
> We always need to do non-equal comparisms on the native endian versions
> to get the correct result.
> 
> Signed-off-by: Christoph Hellwig <hch at lst.de>

Looks good.

Reviewed-by: James Smart <james.smart at broadcom.com>

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

end of thread, other threads:[~2017-07-14 15:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-14 10:43 [PATCH 1/2] nvme: fix byte swapping in the streams code Christoph Hellwig
2017-07-14 10:43 ` [PATCH 2/2] nvmet-fc: fix byte swapping in nvmet_fc_ls_create_association Christoph Hellwig
2017-07-14 15:34   ` James Smart
2017-07-14 14:01 ` [PATCH 1/2] nvme: fix byte swapping in the streams code Jens Axboe

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.