* [PATCH RESEND 1/2] nvme-fc: add a helper to check ctrl sgl support
@ 2021-06-08 19:10 Chaitanya Kulkarni
2021-06-08 19:10 ` [PATCH RESEND 2/2] nvme-tcp: use helper for ctrl sgl check Chaitanya Kulkarni
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Chaitanya Kulkarni @ 2021-06-08 19:10 UTC (permalink / raw)
To: linux-nvme; +Cc: hch, sagi, Chaitanya Kulkarni
For transports it is common to check if NVMe SGLs are supported or not
by the controller.
Add a helper instead of open coding controller SGL support and use it
in fc transport.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
drivers/nvme/host/fc.c | 2 +-
drivers/nvme/host/nvme.h | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index f183f9fa03d0..7600863f7752 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -3112,7 +3112,7 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
}
/* FC-NVME supports normal SGL Data Block Descriptors */
- if (!(ctrl->ctrl.sgls & ((1 << 0) | (1 << 1)))) {
+ if (!nvme_ctrl_sgl_supported(&ctrl->ctrl)) {
dev_err(ctrl->ctrl.device,
"Mandatory sgls are not supported!\n");
ret = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 1f397ecba16c..1aab74128d40 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -869,6 +869,14 @@ static inline void nvme_hwmon_exit(struct nvme_ctrl *ctrl)
}
#endif
+static inline bool nvme_ctrl_sgl_supported(struct nvme_ctrl *ctrl)
+{
+ if (!(ctrl->sgls & ((1 << 0) | (1 << 1))))
+ return true;
+
+ return false;
+}
+
u32 nvme_command_effects(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
u8 opcode);
void nvme_execute_passthru_rq(struct request *rq);
--
2.22.1
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH RESEND 2/2] nvme-tcp: use helper for ctrl sgl check
2021-06-08 19:10 [PATCH RESEND 1/2] nvme-fc: add a helper to check ctrl sgl support Chaitanya Kulkarni
@ 2021-06-08 19:10 ` Chaitanya Kulkarni
2021-06-09 0:23 ` Sagi Grimberg
2021-06-09 0:23 ` [PATCH RESEND 1/2] nvme-fc: add a helper to check ctrl sgl support Sagi Grimberg
2021-06-09 12:59 ` Christoph Hellwig
2 siblings, 1 reply; 5+ messages in thread
From: Chaitanya Kulkarni @ 2021-06-08 19:10 UTC (permalink / raw)
To: linux-nvme; +Cc: hch, sagi, Chaitanya Kulkarni
Use helper to check the controller's SGL support instead of open coding.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
drivers/nvme/host/tcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 6a65b0516180..c7bd37103cf4 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -1993,7 +1993,7 @@ static int nvme_tcp_setup_ctrl(struct nvme_ctrl *ctrl, bool new)
goto destroy_admin;
}
- if (!(ctrl->sgls & ((1 << 0) | (1 << 1)))) {
+ if (!nvme_ctrl_sgl_supported(ctrl)) {
ret = -EOPNOTSUPP;
dev_err(ctrl->device, "Mandatory sgls are not supported!\n");
goto destroy_admin;
--
2.22.1
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND 2/2] nvme-tcp: use helper for ctrl sgl check
2021-06-08 19:10 ` [PATCH RESEND 2/2] nvme-tcp: use helper for ctrl sgl check Chaitanya Kulkarni
@ 2021-06-09 0:23 ` Sagi Grimberg
0 siblings, 0 replies; 5+ messages in thread
From: Sagi Grimberg @ 2021-06-09 0:23 UTC (permalink / raw)
To: Chaitanya Kulkarni, linux-nvme; +Cc: hch
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND 1/2] nvme-fc: add a helper to check ctrl sgl support
2021-06-08 19:10 [PATCH RESEND 1/2] nvme-fc: add a helper to check ctrl sgl support Chaitanya Kulkarni
2021-06-08 19:10 ` [PATCH RESEND 2/2] nvme-tcp: use helper for ctrl sgl check Chaitanya Kulkarni
@ 2021-06-09 0:23 ` Sagi Grimberg
2021-06-09 12:59 ` Christoph Hellwig
2 siblings, 0 replies; 5+ messages in thread
From: Sagi Grimberg @ 2021-06-09 0:23 UTC (permalink / raw)
To: Chaitanya Kulkarni, linux-nvme; +Cc: hch
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND 1/2] nvme-fc: add a helper to check ctrl sgl support
2021-06-08 19:10 [PATCH RESEND 1/2] nvme-fc: add a helper to check ctrl sgl support Chaitanya Kulkarni
2021-06-08 19:10 ` [PATCH RESEND 2/2] nvme-tcp: use helper for ctrl sgl check Chaitanya Kulkarni
2021-06-09 0:23 ` [PATCH RESEND 1/2] nvme-fc: add a helper to check ctrl sgl support Sagi Grimberg
@ 2021-06-09 12:59 ` Christoph Hellwig
2 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2021-06-09 12:59 UTC (permalink / raw)
To: Chaitanya Kulkarni; +Cc: linux-nvme, hch, sagi
On Tue, Jun 08, 2021 at 12:10:36PM -0700, Chaitanya Kulkarni wrote:
> +static inline bool nvme_ctrl_sgl_supported(struct nvme_ctrl *ctrl)
> +{
> + if (!(ctrl->sgls & ((1 << 0) | (1 << 1))))
> + return true;
> +
> + return false;
> +}
Please move this into a separate patch as it isn't FC-related.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-06-09 13:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-08 19:10 [PATCH RESEND 1/2] nvme-fc: add a helper to check ctrl sgl support Chaitanya Kulkarni
2021-06-08 19:10 ` [PATCH RESEND 2/2] nvme-tcp: use helper for ctrl sgl check Chaitanya Kulkarni
2021-06-09 0:23 ` Sagi Grimberg
2021-06-09 0:23 ` [PATCH RESEND 1/2] nvme-fc: add a helper to check ctrl sgl support Sagi Grimberg
2021-06-09 12:59 ` Christoph Hellwig
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.