Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] nvmet: prevent redundant enable/disable of nvmet_port
@ 2025-09-20 23:49 Max Gurtovoy
  2025-09-20 23:49 ` [PATCH 2/3] nvmet: use port's tr_ops in nvmet_disable_port Max Gurtovoy
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Max Gurtovoy @ 2025-09-20 23:49 UTC (permalink / raw)
  To: hch, linux-nvme, kbusch, sagi, kch; +Cc: israelr, Max Gurtovoy

Add early return checks in nvmet_enable_port() and nvmet_disable_port()
to avoid redundant operations if the port is already enabled or
disabled.

Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
---
 drivers/nvme/target/core.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 0dd7bd99afa3..9f5159f04bbd 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -317,6 +317,9 @@ int nvmet_enable_port(struct nvmet_port *port)
 
 	lockdep_assert_held(&nvmet_config_sem);
 
+	if (port->enabled)
+		return 0;
+
 	if (port->disc_addr.trtype == NVMF_TRTYPE_MAX)
 		return -EINVAL;
 
@@ -382,6 +385,9 @@ void nvmet_disable_port(struct nvmet_port *port)
 
 	lockdep_assert_held(&nvmet_config_sem);
 
+	if (!port->enabled)
+		return;
+
 	port->enabled = false;
 	port->tr_ops = NULL;
 
-- 
2.18.1



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

* [PATCH 2/3] nvmet: use port's tr_ops in nvmet_disable_port
  2025-09-20 23:49 [PATCH 1/3] nvmet: prevent redundant enable/disable of nvmet_port Max Gurtovoy
@ 2025-09-20 23:49 ` Max Gurtovoy
  2025-09-22 17:33   ` Christoph Hellwig
  2025-09-20 23:49 ` [PATCH 3/3] nvmet: replace transports array with a linked list Max Gurtovoy
  2025-09-22 17:33 ` [PATCH 1/3] nvmet: prevent redundant enable/disable of nvmet_port Christoph Hellwig
  2 siblings, 1 reply; 9+ messages in thread
From: Max Gurtovoy @ 2025-09-20 23:49 UTC (permalink / raw)
  To: hch, linux-nvme, kbusch, sagi, kch; +Cc: israelr, Max Gurtovoy

Use the port's tr_ops pointer when disabling a port, instead of looking
up the ops by the transport type. An enabled port is guaranteed to have
a valid reference to its fabrics ops.

Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
---
 drivers/nvme/target/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 9f5159f04bbd..f31c7fa70740 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -388,10 +388,11 @@ void nvmet_disable_port(struct nvmet_port *port)
 	if (!port->enabled)
 		return;
 
+	ops = port->tr_ops;
+
 	port->enabled = false;
 	port->tr_ops = NULL;
 
-	ops = nvmet_transports[port->disc_addr.trtype];
 	ops->remove_port(port);
 	module_put(ops->owner);
 }
-- 
2.18.1



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

* [PATCH 3/3] nvmet: replace transports array with a linked list
  2025-09-20 23:49 [PATCH 1/3] nvmet: prevent redundant enable/disable of nvmet_port Max Gurtovoy
  2025-09-20 23:49 ` [PATCH 2/3] nvmet: use port's tr_ops in nvmet_disable_port Max Gurtovoy
@ 2025-09-20 23:49 ` Max Gurtovoy
  2025-09-22 17:35   ` Christoph Hellwig
  2025-09-22 17:33 ` [PATCH 1/3] nvmet: prevent redundant enable/disable of nvmet_port Christoph Hellwig
  2 siblings, 1 reply; 9+ messages in thread
From: Max Gurtovoy @ 2025-09-20 23:49 UTC (permalink / raw)
  To: hch, linux-nvme, kbusch, sagi, kch; +Cc: israelr, Max Gurtovoy

The nvmet_transports array was sized to 255 (NVMF_TRTYPE_MAX), although
only up to 5 transport types can ever be registered, resulting in
some unused memory. This change replaces the array with a linked list to
store registered transport ops, substantially improving memory
efficiency by allocating space only for active transports.

Reviewed-by: Israel Rukshin <israelr@nvidia.com>
Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
---
 drivers/nvme/target/core.c    | 48 +++++++++++++++++++++++++----------
 drivers/nvme/target/fc.c      |  4 +--
 drivers/nvme/target/loop.c    |  4 +--
 drivers/nvme/target/nvmet.h   |  5 ++--
 drivers/nvme/target/pci-epf.c |  2 +-
 drivers/nvme/target/rdma.c    |  4 +--
 drivers/nvme/target/tcp.c     |  4 +--
 7 files changed, 47 insertions(+), 24 deletions(-)

diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index f31c7fa70740..7ee12819e2b5 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -21,7 +21,7 @@
 struct kmem_cache *nvmet_bvec_cache;
 struct workqueue_struct *buffered_io_wq;
 struct workqueue_struct *zbd_wq;
-static const struct nvmet_fabrics_ops *nvmet_transports[NVMF_TRTYPE_MAX];
+static LIST_HEAD(nvmet_transports);
 static DEFINE_IDA(cntlid_ida);
 
 struct workqueue_struct *nvmet_wq;
@@ -37,7 +37,7 @@ EXPORT_SYMBOL_GPL(nvmet_wq);
  *  - per-subsystem allowed hosts list
  *  - allow_any_host subsystem attribute
  *  - nvmet_genctr
- *  - the nvmet_transports array
+ *  - the nvmet_transports list
  *
  * When updating any of those lists/structures write lock should be obtained,
  * while when reading (popolating discovery log page or checking host-subsystem
@@ -275,25 +275,46 @@ void nvmet_port_send_ana_event(struct nvmet_port *port)
 	up_read(&nvmet_config_sem);
 }
 
-int nvmet_register_transport(const struct nvmet_fabrics_ops *ops)
+static struct nvmet_fabrics_ops *nvmet_lookup_transport(unsigned int type)
 {
-	int ret = 0;
+	struct nvmet_fabrics_ops *ops;
 
+	lockdep_assert_held(&nvmet_config_sem);
+
+	list_for_each_entry(ops, &nvmet_transports, entry) {
+		if (ops->type == type)
+			return ops;
+	}
+
+	return NULL;
+}
+
+int nvmet_register_transport(struct nvmet_fabrics_ops *ops)
+{
 	down_write(&nvmet_config_sem);
-	if (nvmet_transports[ops->type])
-		ret = -EINVAL;
-	else
-		nvmet_transports[ops->type] = ops;
+	if (nvmet_lookup_transport(ops->type)) {
+		up_write(&nvmet_config_sem);
+		return -EEXIST;
+	}
+
+	list_add_tail(&ops->entry, &nvmet_transports);
 	up_write(&nvmet_config_sem);
 
-	return ret;
+	return 0;
 }
 EXPORT_SYMBOL_GPL(nvmet_register_transport);
 
-void nvmet_unregister_transport(const struct nvmet_fabrics_ops *ops)
+void nvmet_unregister_transport(struct nvmet_fabrics_ops *ops)
 {
+	struct nvmet_fabrics_ops *fops, *tmp;
+
 	down_write(&nvmet_config_sem);
-	nvmet_transports[ops->type] = NULL;
+	list_for_each_entry_safe(fops, tmp, &nvmet_transports, entry) {
+		if (fops == ops) {
+			list_del(&ops->entry);
+			break;
+		}
+	}
 	up_write(&nvmet_config_sem);
 }
 EXPORT_SYMBOL_GPL(nvmet_unregister_transport);
@@ -323,12 +344,12 @@ int nvmet_enable_port(struct nvmet_port *port)
 	if (port->disc_addr.trtype == NVMF_TRTYPE_MAX)
 		return -EINVAL;
 
-	ops = nvmet_transports[port->disc_addr.trtype];
+	ops = nvmet_lookup_transport(port->disc_addr.trtype);
 	if (!ops) {
 		up_write(&nvmet_config_sem);
 		request_module("nvmet-transport-%d", port->disc_addr.trtype);
 		down_write(&nvmet_config_sem);
-		ops = nvmet_transports[port->disc_addr.trtype];
+		ops = nvmet_lookup_transport(port->disc_addr.trtype);
 		if (!ops) {
 			pr_err("transport type %d not supported\n",
 				port->disc_addr.trtype);
@@ -2006,6 +2027,7 @@ static void __exit nvmet_exit(void)
 	destroy_workqueue(buffered_io_wq);
 	destroy_workqueue(zbd_wq);
 	kmem_cache_destroy(nvmet_bvec_cache);
+	WARN_ON_ONCE(!list_empty(&nvmet_transports));
 
 	BUILD_BUG_ON(sizeof(struct nvmf_disc_rsp_page_entry) != 1024);
 	BUILD_BUG_ON(sizeof(struct nvmf_disc_rsp_page_hdr) != 1024);
diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c
index a9b18c051f5b..58dfb658453c 100644
--- a/drivers/nvme/target/fc.c
+++ b/drivers/nvme/target/fc.c
@@ -1932,7 +1932,7 @@ nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport,
 
 static void nvmet_fc_fcp_nvme_cmd_done(struct nvmet_req *nvme_req);
 
-static const struct nvmet_fabrics_ops nvmet_fc_tgt_fcp_ops;
+static struct nvmet_fabrics_ops nvmet_fc_tgt_fcp_ops;
 
 static void
 nvmet_fc_xmt_ls_rsp_done(struct nvmefc_ls_rsp *lsrsp)
@@ -2994,7 +2994,7 @@ nvmet_fc_host_traddr(struct nvmet_ctrl *ctrl,
 	return ret;
 }
 
-static const struct nvmet_fabrics_ops nvmet_fc_tgt_fcp_ops = {
+static struct nvmet_fabrics_ops nvmet_fc_tgt_fcp_ops = {
 	.owner			= THIS_MODULE,
 	.type			= NVMF_TRTYPE_FC,
 	.msdbd			= 1,
diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c
index f85a8441bcc6..72c126b95fd2 100644
--- a/drivers/nvme/target/loop.c
+++ b/drivers/nvme/target/loop.c
@@ -66,7 +66,7 @@ static DEFINE_MUTEX(nvme_loop_ctrl_mutex);
 static void nvme_loop_queue_response(struct nvmet_req *nvme_req);
 static void nvme_loop_delete_ctrl(struct nvmet_ctrl *ctrl);
 
-static const struct nvmet_fabrics_ops nvme_loop_ops;
+static struct nvmet_fabrics_ops nvme_loop_ops;
 
 static inline int nvme_loop_queue_idx(struct nvme_loop_queue *queue)
 {
@@ -670,7 +670,7 @@ static void nvme_loop_remove_port(struct nvmet_port *port)
 	flush_workqueue(nvme_delete_wq);
 }
 
-static const struct nvmet_fabrics_ops nvme_loop_ops = {
+static struct nvmet_fabrics_ops nvme_loop_ops = {
 	.owner		= THIS_MODULE,
 	.type		= NVMF_TRTYPE_LOOP,
 	.add_port	= nvme_loop_add_port,
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index 51df72f5e89b..2d29df0f66eb 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -409,6 +409,7 @@ struct nvmet_subsys_link {
 struct nvmet_req;
 struct nvmet_fabrics_ops {
 	struct module *owner;
+	struct list_head entry;
 	unsigned int type;
 	unsigned int msdbd;
 	unsigned int flags;
@@ -637,8 +638,8 @@ void nvmet_send_ana_event(struct nvmet_subsys *subsys,
 		struct nvmet_port *port);
 void nvmet_port_send_ana_event(struct nvmet_port *port);
 
-int nvmet_register_transport(const struct nvmet_fabrics_ops *ops);
-void nvmet_unregister_transport(const struct nvmet_fabrics_ops *ops);
+int nvmet_register_transport(struct nvmet_fabrics_ops *ops);
+void nvmet_unregister_transport(struct nvmet_fabrics_ops *ops);
 
 void nvmet_port_del_ctrls(struct nvmet_port *port,
 			  struct nvmet_subsys *subsys);
diff --git a/drivers/nvme/target/pci-epf.c b/drivers/nvme/target/pci-epf.c
index 2e78397a7373..6be4e7586a98 100644
--- a/drivers/nvme/target/pci-epf.c
+++ b/drivers/nvme/target/pci-epf.c
@@ -1523,7 +1523,7 @@ static u16 nvmet_pci_epf_set_feat(const struct nvmet_ctrl *tctrl,
 	}
 }
 
-static const struct nvmet_fabrics_ops nvmet_pci_epf_fabrics_ops = {
+static struct nvmet_fabrics_ops nvmet_pci_epf_fabrics_ops = {
 	.owner		= THIS_MODULE,
 	.type		= NVMF_TRTYPE_PCI,
 	.add_port	= nvmet_pci_epf_add_port,
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index 0485e25ab797..9336cb7e25bb 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -176,7 +176,7 @@ static int nvmet_rdma_alloc_rsp(struct nvmet_rdma_device *ndev,
 				struct nvmet_rdma_rsp *r,
 				int tag);
 
-static const struct nvmet_fabrics_ops nvmet_rdma_ops;
+static struct nvmet_fabrics_ops nvmet_rdma_ops;
 
 static int srq_size_set(const char *val, const struct kernel_param *kp)
 {
@@ -2038,7 +2038,7 @@ static u16 nvmet_rdma_get_max_queue_size(const struct nvmet_ctrl *ctrl)
 	return NVME_RDMA_MAX_QUEUE_SIZE;
 }
 
-static const struct nvmet_fabrics_ops nvmet_rdma_ops = {
+static struct nvmet_fabrics_ops nvmet_rdma_ops = {
 	.owner			= THIS_MODULE,
 	.type			= NVMF_TRTYPE_RDMA,
 	.msdbd			= 1,
diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index 470bf37e5a63..88e728cb4779 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -211,7 +211,7 @@ static LIST_HEAD(nvmet_tcp_queue_list);
 static DEFINE_MUTEX(nvmet_tcp_queue_mutex);
 
 static struct workqueue_struct *nvmet_tcp_wq;
-static const struct nvmet_fabrics_ops nvmet_tcp_ops;
+static struct nvmet_fabrics_ops nvmet_tcp_ops;
 static void nvmet_tcp_free_cmd(struct nvmet_tcp_cmd *c);
 static void nvmet_tcp_free_cmd_buffers(struct nvmet_tcp_cmd *cmd);
 
@@ -2180,7 +2180,7 @@ static ssize_t nvmet_tcp_host_port_addr(struct nvmet_ctrl *ctrl,
 			(struct sockaddr *)&queue->sockaddr_peer);
 }
 
-static const struct nvmet_fabrics_ops nvmet_tcp_ops = {
+static struct nvmet_fabrics_ops nvmet_tcp_ops = {
 	.owner			= THIS_MODULE,
 	.type			= NVMF_TRTYPE_TCP,
 	.msdbd			= 1,
-- 
2.18.1



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

* Re: [PATCH 1/3] nvmet: prevent redundant enable/disable of nvmet_port
  2025-09-20 23:49 [PATCH 1/3] nvmet: prevent redundant enable/disable of nvmet_port Max Gurtovoy
  2025-09-20 23:49 ` [PATCH 2/3] nvmet: use port's tr_ops in nvmet_disable_port Max Gurtovoy
  2025-09-20 23:49 ` [PATCH 3/3] nvmet: replace transports array with a linked list Max Gurtovoy
@ 2025-09-22 17:33 ` Christoph Hellwig
  2 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2025-09-22 17:33 UTC (permalink / raw)
  To: Max Gurtovoy; +Cc: hch, linux-nvme, kbusch, sagi, kch, israelr

On Sun, Sep 21, 2025 at 02:49:41AM +0300, Max Gurtovoy wrote:
> Add early return checks in nvmet_enable_port() and nvmet_disable_port()
> to avoid redundant operations if the port is already enabled or
> disabled.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>



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

* Re: [PATCH 2/3] nvmet: use port's tr_ops in nvmet_disable_port
  2025-09-20 23:49 ` [PATCH 2/3] nvmet: use port's tr_ops in nvmet_disable_port Max Gurtovoy
@ 2025-09-22 17:33   ` Christoph Hellwig
  0 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2025-09-22 17:33 UTC (permalink / raw)
  To: Max Gurtovoy; +Cc: hch, linux-nvme, kbusch, sagi, kch, israelr

On Sun, Sep 21, 2025 at 02:49:42AM +0300, Max Gurtovoy wrote:
> Use the port's tr_ops pointer when disabling a port, instead of looking
> up the ops by the transport type. An enabled port is guaranteed to have
> a valid reference to its fabrics ops.
> 
> Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
> ---
>  drivers/nvme/target/core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
> index 9f5159f04bbd..f31c7fa70740 100644
> --- a/drivers/nvme/target/core.c
> +++ b/drivers/nvme/target/core.c
> @@ -388,10 +388,11 @@ void nvmet_disable_port(struct nvmet_port *port)
>  	if (!port->enabled)
>  		return;
>  
> +	ops = port->tr_ops;
> +

Please assign ops in the line declaring it.

Otherwise this looks fine.


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

* Re: [PATCH 3/3] nvmet: replace transports array with a linked list
  2025-09-20 23:49 ` [PATCH 3/3] nvmet: replace transports array with a linked list Max Gurtovoy
@ 2025-09-22 17:35   ` Christoph Hellwig
  2025-09-22 21:19     ` Max Gurtovoy
  0 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2025-09-22 17:35 UTC (permalink / raw)
  To: Max Gurtovoy; +Cc: hch, linux-nvme, kbusch, sagi, kch, israelr

On Sun, Sep 21, 2025 at 02:49:43AM +0300, Max Gurtovoy wrote:
> The nvmet_transports array was sized to 255 (NVMF_TRTYPE_MAX), although
> only up to 5 transport types can ever be registered, resulting in
> some unused memory. This change replaces the array with a linked list to
> store registered transport ops, substantially improving memory
> efficiency by allocating space only for active transports.

This adds extra code and makes previously const data structures mutable
to save a little bit of space, which feels like the wrong tradeoff.

What is your motivation here?



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

* Re: [PATCH 3/3] nvmet: replace transports array with a linked list
  2025-09-22 17:35   ` Christoph Hellwig
@ 2025-09-22 21:19     ` Max Gurtovoy
  2025-09-22 21:27       ` Keith Busch
  0 siblings, 1 reply; 9+ messages in thread
From: Max Gurtovoy @ 2025-09-22 21:19 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-nvme, kbusch, sagi, kch, israelr


On 22/09/2025 20:35, Christoph Hellwig wrote:
> On Sun, Sep 21, 2025 at 02:49:43AM +0300, Max Gurtovoy wrote:
>> The nvmet_transports array was sized to 255 (NVMF_TRTYPE_MAX), although
>> only up to 5 transport types can ever be registered, resulting in
>> some unused memory. This change replaces the array with a linked list to
>> store registered transport ops, substantially improving memory
>> efficiency by allocating space only for active transports.
> This adds extra code and makes previously const data structures mutable
> to save a little bit of space, which feels like the wrong tradeoff.
>
> What is your motivation here?

The main goal is to save the wasted memory (even though it is no huge).

maybe we can do something like this instead:

diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 655d194f8e72..8e076960875c 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -68,7 +68,7 @@ enum {
         NVMF_TRTYPE_RDMA        = 1,    /* RDMA */
         NVMF_TRTYPE_FC          = 2,    /* Fibre Channel */
         NVMF_TRTYPE_TCP         = 3,    /* TCP/IP */
-       NVMF_TRTYPE_LOOP        = 254,  /* Reserved for host usage */
+       NVMF_TRTYPE_LOOP        = 15,   /* Reserved for host usage */
         NVMF_TRTYPE_MAX,
  };




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

* Re: [PATCH 3/3] nvmet: replace transports array with a linked list
  2025-09-22 21:19     ` Max Gurtovoy
@ 2025-09-22 21:27       ` Keith Busch
  2025-09-22 21:45         ` Max Gurtovoy
  0 siblings, 1 reply; 9+ messages in thread
From: Keith Busch @ 2025-09-22 21:27 UTC (permalink / raw)
  To: Max Gurtovoy; +Cc: Christoph Hellwig, linux-nvme, sagi, kch, israelr

On Tue, Sep 23, 2025 at 12:19:59AM +0300, Max Gurtovoy wrote:
> 
> maybe we can do something like this instead:
> 
> diff --git a/include/linux/nvme.h b/include/linux/nvme.h
> index 655d194f8e72..8e076960875c 100644
> --- a/include/linux/nvme.h
> +++ b/include/linux/nvme.h
> @@ -68,7 +68,7 @@ enum {
>         NVMF_TRTYPE_RDMA        = 1,    /* RDMA */
>         NVMF_TRTYPE_FC          = 2,    /* Fibre Channel */
>         NVMF_TRTYPE_TCP         = 3,    /* TCP/IP */
> -       NVMF_TRTYPE_LOOP        = 254,  /* Reserved for host usage */
> +       NVMF_TRTYPE_LOOP        = 15,   /* Reserved for host usage */
>         NVMF_TRTYPE_MAX,
>  };

The 254 value for the host loopback transport type is in defined that
way in the fabrics spec, so we can't readily change in the driver.


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

* Re: [PATCH 3/3] nvmet: replace transports array with a linked list
  2025-09-22 21:27       ` Keith Busch
@ 2025-09-22 21:45         ` Max Gurtovoy
  0 siblings, 0 replies; 9+ messages in thread
From: Max Gurtovoy @ 2025-09-22 21:45 UTC (permalink / raw)
  To: Keith Busch; +Cc: Christoph Hellwig, linux-nvme, sagi, kch, israelr


On 23/09/2025 0:27, Keith Busch wrote:
> On Tue, Sep 23, 2025 at 12:19:59AM +0300, Max Gurtovoy wrote:
>> maybe we can do something like this instead:
>>
>> diff --git a/include/linux/nvme.h b/include/linux/nvme.h
>> index 655d194f8e72..8e076960875c 100644
>> --- a/include/linux/nvme.h
>> +++ b/include/linux/nvme.h
>> @@ -68,7 +68,7 @@ enum {
>>          NVMF_TRTYPE_RDMA        = 1,    /* RDMA */
>>          NVMF_TRTYPE_FC          = 2,    /* Fibre Channel */
>>          NVMF_TRTYPE_TCP         = 3,    /* TCP/IP */
>> -       NVMF_TRTYPE_LOOP        = 254,  /* Reserved for host usage */
>> +       NVMF_TRTYPE_LOOP        = 15,   /* Reserved for host usage */
>>          NVMF_TRTYPE_MAX,
>>   };
> The 254 value for the host loopback transport type is in defined that
> way in the fabrics spec, so we can't readily change in the driver.

ohh, I was sure it's out of spec but I guess you're right.

Anyway, we use a list in the host fabrics driver for the same purpose so 
we probably need to align having a single design: an array with const 
structures or a list with non-const structures




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

end of thread, other threads:[~2025-09-22 21:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-20 23:49 [PATCH 1/3] nvmet: prevent redundant enable/disable of nvmet_port Max Gurtovoy
2025-09-20 23:49 ` [PATCH 2/3] nvmet: use port's tr_ops in nvmet_disable_port Max Gurtovoy
2025-09-22 17:33   ` Christoph Hellwig
2025-09-20 23:49 ` [PATCH 3/3] nvmet: replace transports array with a linked list Max Gurtovoy
2025-09-22 17:35   ` Christoph Hellwig
2025-09-22 21:19     ` Max Gurtovoy
2025-09-22 21:27       ` Keith Busch
2025-09-22 21:45         ` Max Gurtovoy
2025-09-22 17:33 ` [PATCH 1/3] nvmet: prevent redundant enable/disable of nvmet_port Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox