nvmet: use macro definition for setting nmic value
Subsystems (2)
PATCH 1/2 nvmet: use macro definition for setting nmic value
This makes the code more readable.
--- drivers/nvme/target/admin-cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/admin-cmd.c +1 -1
@@ -536,7 +536,7 @@ static void nvmet_execute_identify_ns(struct nvmet_req *req)* Our namespace might always be shared. Not just with other * controllers, but also with any other user of the block device. */ - id->nmic = (1 <<0 ); + id->nmic =NVME_NS_NMIC_SHARED ; id->anagrpid =cpu_to_le32 (req->ns->anagrpid);memcpy (&id->nguid, &req->ns->nguid,sizeof (id->nguid));
Signature · 7 lines
2.18.1 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
PATCH 2/2 nvmet: use macro definitions for setting cmic value
This makes the code more readable.
--- drivers/nvme/target/admin-cmd.c | 3 ++- include/linux/nvme.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/nvme/target/admin-cmd.c +2 -1
@@ -380,7 +380,8 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req)*/ /* we support multiple ports, multiples hosts and ANA: */ - id->cmic = (1 <<0 ) | (1 <<1 ) | (1 <<3 ); + id->cmic =NVME_CTRL_CMIC_MULTI_PORT |NVME_CTRL_CMIC_MULTI_CTRL | +NVME_CTRL_CMIC_ANA ;/* Limit MDTS according to transport capability */ if (ctrl->ops->get_mdts)
include/linux/nvme.h +1 -0
@@ -312,6 +312,7 @@ struct nvme_id_ctrl { };enum { +NVME_CTRL_CMIC_MULTI_PORT =1 <<0 ,NVME_CTRL_CMIC_MULTI_CTRL =1 <<1 ,NVME_CTRL_CMIC_ANA =1 <<3 ,NVME_CTRL_ONCS_COMPARE =1 <<0 ,
Signature · 7 lines
2.18.1 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH 2/2] nvmet: use macro definitions for setting cmic value
Quoted 13 lines · Max Gurtovoy
This makes the code more readable.
Signed-off-by Max Gurtovoy <[email protected]>--- drivers/nvme/target/admin-cmd.c | 3 ++- include/linux/nvme.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)drivers/nvme/target/admin-cmd.c +0
-0
drivers/nvme/target/admin-cmd.c static void nvmet_execute_identify_ctrl(struct nvmet_req *req) · line 386
Quoted 8 lines
drivers/nvme/target/admin-cmd.c +2
-1@@ -380,7 +380,8 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req)*/ /* we support multiple ports, multiples hosts and ANA: */ - id->cmic = (1 <<0 ) | (1 <<1 ) | (1 <<3 ); + id->cmic =NVME_CTRL_CMIC_MULTI_PORT |NVME_CTRL_CMIC_MULTI_CTRL | +NVME_CTRL_CMIC_ANA ;
So we actually had this discussion before to keep it open coded.
If I remember Keith had already sent out patch for this one...
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Keith Busch
maintainerRe: [PATCH 2/2] nvmet: use macro definitions for setting cmic value
Quoted 25 lines · Chaitanya Kulkarni
Quoted 13 lines · Max Gurtovoy
This makes the code more readable.
Signed-off-by Max Gurtovoy <[email protected]>--- drivers/nvme/target/admin-cmd.c | 3 ++- include/linux/nvme.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)drivers/nvme/target/admin-cmd.c +0
-0drivers/nvme/target/admin-cmd.c static void nvmet_execute_identify_ctrl(struct nvmet_req *req) · line 386
Quoted 8 lines
drivers/nvme/target/admin-cmd.c +2
-1@@ -380,7 +380,8 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req)*/ /* we support multiple ports, multiples hosts and ANA: */ - id->cmic = (1 <<0 ) | (1 <<1 ) | (1 <<3 ); + id->cmic =NVME_CTRL_CMIC_MULTI_PORT |NVME_CTRL_CMIC_MULTI_CTRL | +NVME_CTRL_CMIC_ANA ;So we actually had this discussion before to keep it open coded.
Quoted 1 line
If I remember Keith had already sent out patch for this one...
The similiar patch I'd sent went in as 92decf118f1da. I argued symbolic names helps browsing the code since we can tag/cscope them, so I think this is a fine change.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH 2/2] nvmet: use macro definitions for setting cmic value
Quoted 10 lines
Quoted 5 lines
So we actually had this discussion before to keep it open coded.
If I remember Keith had already sent out patch for this one...
The similiar patch I'd sent went in as
92decf118f1da. I argued symbolic names helps browsing the code since we can tag/cscope them, so I think this is a fine change.
thanks for the clarification, I think I've missed the final decision..
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH 2/2] nvmet: use macro definitions for setting cmic value
In reply to Chaitanya KulkarniQuoted 24 lines · Chaitanya Kulkarni
Quoted 13 lines · Max Gurtovoy
This makes the code more readable.
Signed-off-by Max Gurtovoy <[email protected]>--- drivers/nvme/target/admin-cmd.c | 3 ++- include/linux/nvme.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)drivers/nvme/target/admin-cmd.c +0
-0drivers/nvme/target/admin-cmd.c static void nvmet_execute_identify_ctrl(struct nvmet_req *req) · line 386
Quoted 8 lines
drivers/nvme/target/admin-cmd.c +2
-1@@ -380,7 +380,8 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req)*/ /* we support multiple ports, multiples hosts and ANA: */ - id->cmic = (1 <<0 ) | (1 <<1 ) | (1 <<3 ); + id->cmic =NVME_CTRL_CMIC_MULTI_PORT |NVME_CTRL_CMIC_MULTI_CTRL | +NVME_CTRL_CMIC_ANA ;So we actually had this discussion before to keep it open coded.
Quoted 1 line
If I remember Keith had already sent out patch for this one...
I don't understand why our code should include constants and not macros.
And if so, let's do it for all macros we have for the spec. We need one policy.
Quoted 2 lines
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Chaitanya Kulkarni
Reviewed-byRe: [PATCH 2/2] nvmet: use macro definitions for setting cmic value
Quoted 23 lines
Quoted 23 lines
Quoted 14 lines
This makes the code more readable.
Signed-off-by Max Gurtovoy <[email protected]>---
drivers/nvme/target/admin-cmd.c| 3 ++-
include/linux/nvme.h | 1 +2 files changed, 3 insertions(+), 1 deletion(-)drivers/nvme/target/admin-cmd.c +0
-0drivers/nvme/target/admin-cmd.c static void nvmet_execute_identify_ctrl(struct · line 385
Quoted 7 lines
drivers/nvme/target/admin-cmd.c +2
-1@@ -380,7 +380,8 @@ static void nvmet_execute_identify_ctrl(structnvmet_req *req) */ /* we support multiple ports, multiples hosts and ANA: */ - id->cmic = (1 << 0) | (1 << 1) | (1 << 3); + id->cmic = NVME_CTRL_CMIC_MULTI_PORT | NVME_CTRL_CMIC_MULTI_CTRL | + NVME_CTRL_CMIC_ANA;So we actually had this discussion before to keep it open coded.
Quoted 7 lines
Quoted 1 line
If I remember Keith had already sent out patch for this one...
I don't understand why our code should include constants and not macros.
And if so, let's do it for all macros we have for the spec. We need one policy.
Agree, looks good.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH 2/2] nvmet: use macro definitions for setting cmic value
In reply to Max Gurtovoy_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Patches look good to me.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Quoted 4 lines · Max Gurtovoy
This makes the code more readable.
Signed-off-by Max Gurtovoy <[email protected]>---
Looks good.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Thanks,
applied to nvme-5.16.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme