Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] nvme: add semicolon in nvme_command setting
@ 2017-01-26 15:17 Max Gurtovoy
  2017-01-26 15:17 ` [PATCH 2/2] nvme: Use CNS as 8-bit field and avoid endianness conversion Max Gurtovoy
  2017-01-26 17:08 ` [PATCH 1/2] nvme: add semicolon in nvme_command setting Keith Busch
  0 siblings, 2 replies; 4+ messages in thread
From: Max Gurtovoy @ 2017-01-26 15:17 UTC (permalink / raw)


Reviewed-by: Parav Pandit <parav at mellanox.com>
Signed-off-by: Max Gurtovoy <maxg at mellanox.com>
---
 drivers/nvme/host/core.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 8a3c3e3..4300f88 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -568,8 +568,8 @@ int nvme_identify_ns(struct nvme_ctrl *dev, unsigned nsid,
 	int error;
 
 	/* gcc-4.4.4 (at least) has issues with initializers and anon unions */
-	c.identify.opcode = nvme_admin_identify,
-	c.identify.nsid = cpu_to_le32(nsid),
+	c.identify.opcode = nvme_admin_identify;
+	c.identify.nsid = cpu_to_le32(nsid);
 
 	*id = kmalloc(sizeof(struct nvme_id_ns), GFP_KERNEL);
 	if (!*id)
-- 
1.7.1

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

* [PATCH 2/2] nvme: Use CNS as 8-bit field and avoid endianness conversion
  2017-01-26 15:17 [PATCH 1/2] nvme: add semicolon in nvme_command setting Max Gurtovoy
@ 2017-01-26 15:17 ` Max Gurtovoy
  2017-01-26 17:09   ` Keith Busch
  2017-01-26 17:08 ` [PATCH 1/2] nvme: add semicolon in nvme_command setting Keith Busch
  1 sibling, 1 reply; 4+ messages in thread
From: Max Gurtovoy @ 2017-01-26 15:17 UTC (permalink / raw)


From: Parav Pandit <parav@mellanox.com>

This patch defines CNS field as 8-bit field and avoids cpu_to/from_le
conversions.
Also initialize nvme_command cns value explicitly to NVME_ID_CNS_NS
for readability (don't rely on the fact that NVME_ID_CNS_NS = 0).

Reviewed-by: Max Gurtovoy <maxg at mellanox.com>
Signed-off-by: Parav Pandit <parav at mellanox.com>
---
 drivers/nvme/host/core.c        |    5 +++--
 drivers/nvme/target/admin-cmd.c |    2 +-
 drivers/nvme/target/discovery.c |    4 ++--
 include/linux/nvme.h            |    4 +++-
 4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 4300f88..bde2406 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -538,7 +538,7 @@ int nvme_identify_ctrl(struct nvme_ctrl *dev, struct nvme_id_ctrl **id)
 
 	/* gcc-4.4.4 (at least) has issues with initializers and anon unions */
 	c.identify.opcode = nvme_admin_identify;
-	c.identify.cns = cpu_to_le32(NVME_ID_CNS_CTRL);
+	c.identify.cns = NVME_ID_CNS_CTRL;
 
 	*id = kmalloc(sizeof(struct nvme_id_ctrl), GFP_KERNEL);
 	if (!*id)
@@ -556,7 +556,7 @@ static int nvme_identify_ns_list(struct nvme_ctrl *dev, unsigned nsid, __le32 *n
 	struct nvme_command c = { };
 
 	c.identify.opcode = nvme_admin_identify;
-	c.identify.cns = cpu_to_le32(NVME_ID_CNS_NS_ACTIVE_LIST);
+	c.identify.cns = NVME_ID_CNS_NS_ACTIVE_LIST;
 	c.identify.nsid = cpu_to_le32(nsid);
 	return nvme_submit_sync_cmd(dev->admin_q, &c, ns_list, 0x1000);
 }
@@ -570,6 +570,7 @@ int nvme_identify_ns(struct nvme_ctrl *dev, unsigned nsid,
 	/* gcc-4.4.4 (at least) has issues with initializers and anon unions */
 	c.identify.opcode = nvme_admin_identify;
 	c.identify.nsid = cpu_to_le32(nsid);
+	c.identify.cns = NVME_ID_CNS_NS;
 
 	*id = kmalloc(sizeof(struct nvme_id_ns), GFP_KERNEL);
 	if (!*id)
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 95ae523..f376dc4 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -509,7 +509,7 @@ int nvmet_parse_admin_cmd(struct nvmet_req *req)
 		break;
 	case nvme_admin_identify:
 		req->data_len = 4096;
-		switch (le32_to_cpu(cmd->identify.cns)) {
+		switch (cmd->identify.cns) {
 		case NVME_ID_CNS_NS:
 			req->execute = nvmet_execute_identify_ns;
 			return 0;
diff --git a/drivers/nvme/target/discovery.c b/drivers/nvme/target/discovery.c
index 12f39ee..af8aabf 100644
--- a/drivers/nvme/target/discovery.c
+++ b/drivers/nvme/target/discovery.c
@@ -186,14 +186,14 @@ int nvmet_parse_discovery_cmd(struct nvmet_req *req)
 		}
 	case nvme_admin_identify:
 		req->data_len = 4096;
-		switch (le32_to_cpu(cmd->identify.cns)) {
+		switch (cmd->identify.cns) {
 		case NVME_ID_CNS_CTRL:
 			req->execute =
 				nvmet_execute_identify_disc_ctrl;
 			return 0;
 		default:
 			pr_err("nvmet: unsupported identify cns %d\n",
-				le32_to_cpu(cmd->identify.cns));
+				cmd->identify.cns);
 			return NVME_SC_INVALID_OPCODE | NVME_SC_DNR;
 		}
 	default:
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 3d1c6f1..d718890 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -641,7 +641,9 @@ struct nvme_identify {
 	__le32			nsid;
 	__u64			rsvd2[2];
 	union nvme_data_ptr	dptr;
-	__le32			cns;
+	__u8			cns;
+	__u8			rsvd3;
+	__le16			ctrlid;
 	__u32			rsvd11[5];
 };
 
-- 
1.7.1

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

* [PATCH 1/2] nvme: add semicolon in nvme_command setting
  2017-01-26 15:17 [PATCH 1/2] nvme: add semicolon in nvme_command setting Max Gurtovoy
  2017-01-26 15:17 ` [PATCH 2/2] nvme: Use CNS as 8-bit field and avoid endianness conversion Max Gurtovoy
@ 2017-01-26 17:08 ` Keith Busch
  1 sibling, 0 replies; 4+ messages in thread
From: Keith Busch @ 2017-01-26 17:08 UTC (permalink / raw)


On Thu, Jan 26, 2017@05:17:27PM +0200, Max Gurtovoy wrote:
> Reviewed-by: Parav Pandit <parav at mellanox.com>
> Signed-off-by: Max Gurtovoy <maxg at mellanox.com>

Reviewed-by: Keith Busch <keith.busch at intel.com>

> ---
>  drivers/nvme/host/core.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 8a3c3e3..4300f88 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -568,8 +568,8 @@ int nvme_identify_ns(struct nvme_ctrl *dev, unsigned nsid,
>  	int error;
>  
>  	/* gcc-4.4.4 (at least) has issues with initializers and anon unions */
> -	c.identify.opcode = nvme_admin_identify,
> -	c.identify.nsid = cpu_to_le32(nsid),
> +	c.identify.opcode = nvme_admin_identify;
> +	c.identify.nsid = cpu_to_le32(nsid);
>  
>  	*id = kmalloc(sizeof(struct nvme_id_ns), GFP_KERNEL);
>  	if (!*id)
> -- 
> 1.7.1
> 

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

* [PATCH 2/2] nvme: Use CNS as 8-bit field and avoid endianness conversion
  2017-01-26 15:17 ` [PATCH 2/2] nvme: Use CNS as 8-bit field and avoid endianness conversion Max Gurtovoy
@ 2017-01-26 17:09   ` Keith Busch
  0 siblings, 0 replies; 4+ messages in thread
From: Keith Busch @ 2017-01-26 17:09 UTC (permalink / raw)


On Thu, Jan 26, 2017@05:17:28PM +0200, Max Gurtovoy wrote:
> From: Parav Pandit <parav at mellanox.com>
> 
> This patch defines CNS field as 8-bit field and avoids cpu_to/from_le
> conversions.
> Also initialize nvme_command cns value explicitly to NVME_ID_CNS_NS
> for readability (don't rely on the fact that NVME_ID_CNS_NS = 0).
> 
> Reviewed-by: Max Gurtovoy <maxg at mellanox.com>
> Signed-off-by: Parav Pandit <parav at mellanox.com>

Reviewed-by: Keith Busch <keith.busch at intel.com>

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

end of thread, other threads:[~2017-01-26 17:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-26 15:17 [PATCH 1/2] nvme: add semicolon in nvme_command setting Max Gurtovoy
2017-01-26 15:17 ` [PATCH 2/2] nvme: Use CNS as 8-bit field and avoid endianness conversion Max Gurtovoy
2017-01-26 17:09   ` Keith Busch
2017-01-26 17:08 ` [PATCH 1/2] nvme: add semicolon in nvme_command setting Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox