linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvmet: make 'tsas' attribute idempotent for RDMA
@ 2024-06-14 10:44 Hannes Reinecke
  2024-06-14 16:49 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Hannes Reinecke @ 2024-06-14 10:44 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.
To avoid errors during reconfiguration 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 | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index e60224356048..7dce276464a6 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -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;
 
-- 
2.35.3



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] nvmet: make 'tsas' attribute idempotent for RDMA
  2024-06-14 10:44 [PATCH] nvmet: make 'tsas' attribute idempotent for RDMA Hannes Reinecke
@ 2024-06-14 16:49 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2024-06-14 16:49 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: Christoph Hellwig, Sagi Grimberg, Keith Busch, linux-nvme

> +	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.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-14 16:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-14 10:44 [PATCH] nvmet: make 'tsas' attribute idempotent for RDMA Hannes Reinecke
2024-06-14 16:49 ` Christoph Hellwig

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).