2021-08-26 21:18:00

by Adam Manzanares

[permalink] [raw]
Subject: [PATCH 0/2] Make nvmet_init_cap dependent on passthru controller

nvme_init_cap unconditionally sets support for one or more command sets. When
using a passthru controller this may cause a conventional namespace to be
ignored when checking the namespace identification descriptors which must
include the command set identifier when the cap is set to support one or more
command sets. Since the namespace identification descriptors come from the
passthru controller they may not include the command set identifier causing the
namespace to be ignored.

Adam Manzanares (2):
nvme: move nvme_multi_css into nvme.h
nvmet: use passthru cntrl in nvmet_init_cap

drivers/nvme/host/core.c | 5 -----
drivers/nvme/host/nvme.h | 5 +++++
drivers/nvme/target/core.c | 9 ++++++---
3 files changed, 11 insertions(+), 8 deletions(-)

--
2.25.1


2021-08-26 21:18:14

by Adam Manzanares

[permalink] [raw]
Subject: [PATCH 1/2] nvme: move nvme_multi_css into nvme.h

Preparatory patch in order to reuse nvme_multi_css in the nvme target code

Signed-off-by: Adam Manzanares <[email protected]>
---
drivers/nvme/host/core.c | 5 -----
drivers/nvme/host/nvme.h | 5 +++++
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 42b69f3c6e20..cd5dc104d4b1 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1303,11 +1303,6 @@ static int nvme_identify_ctrl(struct nvme_ctrl *dev, struct nvme_id_ctrl **id)
return error;
}

-static bool nvme_multi_css(struct nvme_ctrl *ctrl)
-{
- return (ctrl->ctrl_config & NVME_CC_CSS_MASK) == NVME_CC_CSS_CSI;
-}
-
static int nvme_process_ns_desc(struct nvme_ctrl *ctrl, struct nvme_ns_ids *ids,
struct nvme_ns_id_desc *cur, bool *csi_seen)
{
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 8fd30ef19757..9871c0c9374c 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -892,4 +892,9 @@ struct nvme_ctrl *nvme_ctrl_from_file(struct file *file);
struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid);
void nvme_put_ns(struct nvme_ns *ns);

+static inline bool nvme_multi_css(struct nvme_ctrl *ctrl)
+{
+ return (ctrl->ctrl_config & NVME_CC_CSS_MASK) == NVME_CC_CSS_CSI;
+}
+
#endif /* _NVME_H */
--
2.25.1

2021-08-26 21:51:00

by Keith Busch

[permalink] [raw]
Subject: Re: [PATCH 0/2] Make nvmet_init_cap dependent on passthru controller

On Thu, Aug 26, 2021 at 09:15:45PM +0000, Adam Manzanares wrote:
> nvme_init_cap unconditionally sets support for one or more command sets. When
> using a passthru controller this may cause a conventional namespace to be
> ignored when checking the namespace identification descriptors which must
> include the command set identifier when the cap is set to support one or more
> command sets. Since the namespace identification descriptors come from the
> passthru controller they may not include the command set identifier causing the
> namespace to be ignored.
>
> Adam Manzanares (2):
> nvme: move nvme_multi_css into nvme.h
> nvmet: use passthru cntrl in nvmet_init_cap

Looks good to me.

Reviewed-by: Keith Busch <[email protected]>