Skip to contentSkip to conversation

nvmet: make 'tsas' attribute idempotent for RDMA

PATCH In review Hannes Reinecke 2 participants 2 messages Jun 14, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvmet: make 'tsas' attribute idempotent for RDMA

The RDMA transport defines values for TSAS, but it cannot be changed. To avoid errors during reconfiguration allow to write the current value.

Fixes 3f123494db72 ("nvmet: make TCP sectype settable via configfs")
---
 drivers/nvme/target/configfs.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/nvme/target/configfs.c +11 -0
index e60224356048..7dce276464a6 100644
@@ -424,6 +424,17 @@ static ssize_t nvmet_addr_tsas_store(struct config_item *item,
 	if (nvmet_is_port_enabled(port, __func__))
 		return -EACCES;
 
+	if (port->disc_addr.trtype == NVMF_TRTYPE_RDMA) {
+		for (i = 0; i < ARRAY_SIZE(nvmet_addr_tsas_rdma); i++) {
+			u8 qptype;
+
+			if (sysfs_streq(page, nvmet_addr_tsas_rdma[i].name)) {
+				qptype = nvmet_addr_tsas_rdma[i].type;
+				if (qptype == port->disc_addr.tsas.rdma.qptype)
+					return count;
+			}
+		}
+	}
 	if (port->disc_addr.trtype != NVMF_TRTYPE_TCP)
 		return -EINVAL;
 
Signature · 1 line
2.35.3
#1 lore raw

drivers/nvme/target/configfs.c static ssize_t nvmet_addr_tsas_store(struct config_item *item, · line 439

Quoted 13 lines
drivers/nvme/target/configfs.c +11 -0
+	if (port->disc_addr.trtype == NVMF_TRTYPE_RDMA) {
+		for (i = 0; i < ARRAY_SIZE(nvmet_addr_tsas_rdma); i++) {
+			u8 qptype;
+
+			if (sysfs_streq(page, nvmet_addr_tsas_rdma[i].name)) {
+				qptype = nvmet_addr_tsas_rdma[i].type;
+				if (qptype == port->disc_addr.tsas.rdma.qptype)
+					return count;
+			}
+		}
+	}
 	if (port->disc_addr.trtype != NVMF_TRTYPE_TCP)
 		return -EINVAL;

Sounds like this should switch on the transport types and have helpers for each.