nvmet: fixup nvmetcli save/restore
Subsystems (2)
cover nvmet: fixup nvmetcli save/restore
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(-)
Signature · 1 line
2.35.3
PATCH 2/3 nvme: fixup comment for nvme RDMA Provider Type
From: Hannes Reinecke <[email protected]>
PRTYPE is the provider type, not the QP service type.
--- include/linux/nvme.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/nvme.h +2 -2
@@ -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 */
Signature · 1 line
2.35.3
PATCH 1/3 nvmet: do not return 'reserved' for empty TSAS values
In reply to Hannes ReineckeThe '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.
--- drivers/nvme/target/configfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/configfs.c +1 -1
@@ -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,
Signature · 1 line
2.35.3
PATCH 3/3 nvmet: make 'tsas' attribute idempotent for RDMA
In reply to Hannes ReineckeThe 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.
--- drivers/nvme/target/configfs.c | 39 ++++++++++++++++++++++++++-------- include/linux/nvme.h | 2 ++ 2 files changed, 32 insertions(+), 9 deletions(-)
drivers/nvme/target/configfs.c +30 -9
@@ -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);
include/linux/nvme.h +2 -0
@@ -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
Signature · 1 line
2.35.3
Re: [PATCH 1/3] nvmet: do not return 'reserved' for empty TSAS values
In reply to Hannes ReineckeQuoted 4 lines · 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.
Thanks, applied to nvme-6.10.
Re: [PATCH 2/3] nvme: fixup comment for nvme RDMA Provider Type
In reply to Hannes ReineckeLooks good:
Re: [PATCH 3/3] nvmet: make 'tsas' attribute idempotent for RDMA
In reply to Hannes ReineckeLooks good:
Quoted 4 lines · Hannes Reinecke
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.