* [PATCH 0/3] nvmet: fixup nvmetcli save/restore
@ 2024-06-17 7:27 Hannes Reinecke
2024-06-17 7:27 ` [PATCH 1/3] nvmet: do not return 'reserved' for empty TSAS values Hannes Reinecke
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Hannes Reinecke @ 2024-06-17 7:27 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Sagi Grimberg, Keith Busch, linux-nvme, Hannes Reinecke
Hi all,
I noticed that there are some small issues during nvmetcli
save and restore. This patchset fixes them up.
Hannes Reinecke (3):
nvmet: do not return 'reserved' for empty TSAS values
nvme: fixup comment for nvme RDMA Provider Type
nvmet: make 'tsas' attribute idempotent for RDMA
drivers/nvme/target/configfs.c | 41 +++++++++++++++++++++++++---------
include/linux/nvme.h | 6 +++--
2 files changed, 35 insertions(+), 12 deletions(-)
--
2.35.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] nvmet: do not return 'reserved' for empty TSAS values
2024-06-17 7:27 [PATCH 0/3] nvmet: fixup nvmetcli save/restore Hannes Reinecke
@ 2024-06-17 7:27 ` Hannes Reinecke
2024-06-17 18:29 ` Keith Busch
2024-06-17 7:27 ` [PATCH 2/3] nvme: fixup comment for nvme RDMA Provider Type Hannes Reinecke
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Hannes Reinecke @ 2024-06-17 7:27 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Sagi Grimberg, Keith Busch, linux-nvme, Hannes Reinecke
The 'TSAS' value is only defined for TCP and RDMA, but returning
'reserved' for undefined values tricked nvmetcli to try to write
'reserved' when restoring from a config file. This caused an error
and the configuration would not be applied.
Fixes: 3f123494db72 ("nvmet: make TCP sectype settable via configfs")
Signed-off-by: Hannes Reinecke <hare@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
drivers/nvme/target/configfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index bd87dfd173a4..e60224356048 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -410,7 +410,7 @@ static ssize_t nvmet_addr_tsas_show(struct config_item *item,
return sprintf(page, "%s\n", nvmet_addr_tsas_rdma[i].name);
}
}
- return sprintf(page, "reserved\n");
+ return sprintf(page, "\n");
}
static ssize_t nvmet_addr_tsas_store(struct config_item *item,
--
2.35.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] nvme: fixup comment for nvme RDMA Provider Type
2024-06-17 7:27 [PATCH 0/3] nvmet: fixup nvmetcli save/restore Hannes Reinecke
2024-06-17 7:27 ` [PATCH 1/3] nvmet: do not return 'reserved' for empty TSAS values Hannes Reinecke
@ 2024-06-17 7:27 ` Hannes Reinecke
2024-06-18 6:45 ` Christoph Hellwig
2024-06-17 7:27 ` [PATCH 3/3] nvmet: make 'tsas' attribute idempotent for RDMA Hannes Reinecke
2024-06-21 16:01 ` [PATCH 0/3] nvmet: fixup nvmetcli save/restore Keith Busch
3 siblings, 1 reply; 8+ messages in thread
From: Hannes Reinecke @ 2024-06-17 7:27 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Sagi Grimberg, Keith Busch, linux-nvme, Hannes Reinecke,
Hannes Reinecke
From: Hannes Reinecke <hare@suse.de>
PRTYPE is the provider type, not the QP service type.
Fixes: eb793e2c9286 ("nvme.h: add NVMe over Fabrics definitions")
Signed-off-by: Hannes Reinecke <hare@kernel.org>
---
include/linux/nvme.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 27faae34245d..0993703f6617 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -87,8 +87,8 @@ enum {
NVMF_RDMA_QPTYPE_DATAGRAM = 2, /* Reliable Datagram */
};
-/* RDMA QP Service Type codes for Discovery Log Page entry TSAS
- * RDMA_QPTYPE field
+/* RDMA Provider Type codes for Discovery Log Page entry TSAS
+ * RDMA_PRTYPE field
*/
enum {
NVMF_RDMA_PRTYPE_NOT_SPECIFIED = 1, /* No Provider Specified */
--
2.35.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] nvmet: make 'tsas' attribute idempotent for RDMA
2024-06-17 7:27 [PATCH 0/3] nvmet: fixup nvmetcli save/restore Hannes Reinecke
2024-06-17 7:27 ` [PATCH 1/3] nvmet: do not return 'reserved' for empty TSAS values Hannes Reinecke
2024-06-17 7:27 ` [PATCH 2/3] nvme: fixup comment for nvme RDMA Provider Type Hannes Reinecke
@ 2024-06-17 7:27 ` Hannes Reinecke
2024-06-18 6:46 ` Christoph Hellwig
2024-06-21 16:01 ` [PATCH 0/3] nvmet: fixup nvmetcli save/restore Keith Busch
3 siblings, 1 reply; 8+ messages in thread
From: Hannes Reinecke @ 2024-06-17 7:27 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Sagi Grimberg, Keith Busch, linux-nvme, Hannes Reinecke
The RDMA transport defines values for TSAS, but it cannot be changed as
we only support the 'connected' mode.
So to avoid errors during reconfiguration we should allow to write the
current value.
Fixes: 3f123494db72 ("nvmet: make TCP sectype settable via configfs")
Signed-off-by: Hannes Reinecke <hare@kernel.org>
---
drivers/nvme/target/configfs.c | 39 ++++++++++++++++++++++++++--------
include/linux/nvme.h | 2 ++
2 files changed, 32 insertions(+), 9 deletions(-)
diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index e60224356048..685e89b35d33 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -413,25 +413,46 @@ static ssize_t nvmet_addr_tsas_show(struct config_item *item,
return sprintf(page, "\n");
}
+static u8 nvmet_addr_tsas_rdma_store(const char *page)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(nvmet_addr_tsas_rdma); i++) {
+ if (sysfs_streq(page, nvmet_addr_tsas_rdma[i].name))
+ return nvmet_addr_tsas_rdma[i].type;
+ }
+ return NVMF_RDMA_QPTYPE_INVALID;
+}
+
+static u8 nvmet_addr_tsas_tcp_store(const char *page)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(nvmet_addr_tsas_tcp); i++) {
+ if (sysfs_streq(page, nvmet_addr_tsas_tcp[i].name))
+ return nvmet_addr_tsas_tcp[i].type;
+ }
+ return NVMF_TCP_SECTYPE_INVALID;
+}
+
static ssize_t nvmet_addr_tsas_store(struct config_item *item,
const char *page, size_t count)
{
struct nvmet_port *port = to_nvmet_port(item);
u8 treq = nvmet_port_disc_addr_treq_mask(port);
- u8 sectype;
- int i;
+ u8 sectype, qptype;
if (nvmet_is_port_enabled(port, __func__))
return -EACCES;
- if (port->disc_addr.trtype != NVMF_TRTYPE_TCP)
- return -EINVAL;
-
- for (i = 0; i < ARRAY_SIZE(nvmet_addr_tsas_tcp); i++) {
- if (sysfs_streq(page, nvmet_addr_tsas_tcp[i].name)) {
- sectype = nvmet_addr_tsas_tcp[i].type;
+ if (port->disc_addr.trtype == NVMF_TRTYPE_RDMA) {
+ qptype = nvmet_addr_tsas_rdma_store(page);
+ if (qptype == port->disc_addr.tsas.rdma.qptype)
+ return count;
+ } else if (port->disc_addr.trtype == NVMF_TRTYPE_TCP) {
+ sectype = nvmet_addr_tsas_tcp_store(page);
+ if (sectype != NVMF_TCP_SECTYPE_INVALID)
goto found;
- }
}
pr_err("Invalid value '%s' for tsas\n", page);
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 0993703f6617..efda407622c1 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -85,6 +85,7 @@ enum {
enum {
NVMF_RDMA_QPTYPE_CONNECTED = 1, /* Reliable Connected */
NVMF_RDMA_QPTYPE_DATAGRAM = 2, /* Reliable Datagram */
+ NVMF_RDMA_QPTYPE_INVALID = 0xff,
};
/* RDMA Provider Type codes for Discovery Log Page entry TSAS
@@ -110,6 +111,7 @@ enum {
NVMF_TCP_SECTYPE_NONE = 0, /* No Security */
NVMF_TCP_SECTYPE_TLS12 = 1, /* TLSv1.2, NVMe-oF 1.1 and NVMe-TCP 3.6.1.1 */
NVMF_TCP_SECTYPE_TLS13 = 2, /* TLSv1.3, NVMe-oF 1.1 and NVMe-TCP 3.6.1.1 */
+ NVMF_TCP_SECTYPE_INVALID = 0xff,
};
#define NVME_AQ_DEPTH 32
--
2.35.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] nvmet: do not return 'reserved' for empty TSAS values
2024-06-17 7:27 ` [PATCH 1/3] nvmet: do not return 'reserved' for empty TSAS values Hannes Reinecke
@ 2024-06-17 18:29 ` Keith Busch
0 siblings, 0 replies; 8+ messages in thread
From: Keith Busch @ 2024-06-17 18:29 UTC (permalink / raw)
To: Hannes Reinecke; +Cc: Christoph Hellwig, Sagi Grimberg, linux-nvme
On Mon, Jun 17, 2024 at 09:27:26AM +0200, Hannes Reinecke wrote:
> The 'TSAS' value is only defined for TCP and RDMA, but returning
> 'reserved' for undefined values tricked nvmetcli to try to write
> 'reserved' when restoring from a config file. This caused an error
> and the configuration would not be applied.
Thanks, applied to nvme-6.10.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] nvme: fixup comment for nvme RDMA Provider Type
2024-06-17 7:27 ` [PATCH 2/3] nvme: fixup comment for nvme RDMA Provider Type Hannes Reinecke
@ 2024-06-18 6:45 ` Christoph Hellwig
0 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2024-06-18 6:45 UTC (permalink / raw)
To: Hannes Reinecke
Cc: Christoph Hellwig, Sagi Grimberg, Keith Busch, linux-nvme,
Hannes Reinecke
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] nvmet: make 'tsas' attribute idempotent for RDMA
2024-06-17 7:27 ` [PATCH 3/3] nvmet: make 'tsas' attribute idempotent for RDMA Hannes Reinecke
@ 2024-06-18 6:46 ` Christoph Hellwig
0 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2024-06-18 6:46 UTC (permalink / raw)
To: Hannes Reinecke; +Cc: Christoph Hellwig, Sagi Grimberg, Keith Busch, linux-nvme
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/3] nvmet: fixup nvmetcli save/restore
2024-06-17 7:27 [PATCH 0/3] nvmet: fixup nvmetcli save/restore Hannes Reinecke
` (2 preceding siblings ...)
2024-06-17 7:27 ` [PATCH 3/3] nvmet: make 'tsas' attribute idempotent for RDMA Hannes Reinecke
@ 2024-06-21 16:01 ` Keith Busch
3 siblings, 0 replies; 8+ messages in thread
From: Keith Busch @ 2024-06-21 16:01 UTC (permalink / raw)
To: Hannes Reinecke; +Cc: Christoph Hellwig, Sagi Grimberg, linux-nvme
On Mon, Jun 17, 2024 at 09:27:25AM +0200, Hannes Reinecke wrote:
> Hi all,
>
> I noticed that there are some small issues during nvmetcli
> save and restore. This patchset fixes them up.
Thanks, applied to nvme-6.10. The web ui appears to not show the branch
anymore, but git says it's there.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-06-21 16:02 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-17 7:27 [PATCH 0/3] nvmet: fixup nvmetcli save/restore Hannes Reinecke
2024-06-17 7:27 ` [PATCH 1/3] nvmet: do not return 'reserved' for empty TSAS values Hannes Reinecke
2024-06-17 18:29 ` Keith Busch
2024-06-17 7:27 ` [PATCH 2/3] nvme: fixup comment for nvme RDMA Provider Type Hannes Reinecke
2024-06-18 6:45 ` Christoph Hellwig
2024-06-17 7:27 ` [PATCH 3/3] nvmet: make 'tsas' attribute idempotent for RDMA Hannes Reinecke
2024-06-18 6:46 ` Christoph Hellwig
2024-06-21 16:01 ` [PATCH 0/3] nvmet: fixup nvmetcli save/restore Keith Busch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).