[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250721173700.4153098-2-kamaljit.singh1@wdc.com>
Date: Mon, 21 Jul 2025 10:36:59 -0700
From: Kamaljit Singh <kamaljit.singh1@....com>
To: kbusch@...nel.org,
axboe@...nel.dk,
hch@....de,
sagi@...mberg.me,
linux-nvme@...ts.infradead.org,
linux-kernel@...r.kernel.org
Cc: cassel@...nel.org,
dlemoal@...nel.org,
kamaljit.singh1@....com
Subject: [PATCH v4 1/2] nvme: add capability to connect to an administrative controller
Add capability to connect to an administrative controller by
preventing ioq creation for admin-controllers.
* Add helper nvme_admin_ctrl() to check if a controller's CNTRLTYPE
indicates that it is an administrative controller.
* Override ctrl->queue_count to 1, so only one admin queue and no IO
queues are allocated for an administrative controller.
* This override is done in nvme_init_ctrl_finish() after ctrl->cntrltype
has been initialized in nvme_init_identify() so nvme_admin_ctrl() will
work correctly.
* Doing this override in generic code (nvme_init_ctrl_finish) makes it
transport agnostic and will work properly for nvme/tcp as well as for
nvme/rdma.
Suggested-by: Niklas Cassel <cassel@...nel.org>
Reviewed-by: Damien Le Moal <dlemoal@...nel.org>
Reviewed-by: Niklas Cassel <cassel@...nel.org>
Reviewed-by: Christoph Hellwig <hch@....de>
Signed-off-by: Kamaljit Singh <kamaljit.singh1@....com>
---
drivers/nvme/host/core.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index e533d791955d..a6388ed3ddca 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3149,6 +3149,11 @@ static inline bool nvme_discovery_ctrl(struct nvme_ctrl *ctrl)
return ctrl->opts && ctrl->opts->discovery_nqn;
}
+static inline bool nvme_admin_ctrl(struct nvme_ctrl *ctrl)
+{
+ return ctrl->cntrltype == NVME_CTRL_ADMIN;
+}
+
static bool nvme_validate_cntlid(struct nvme_subsystem *subsys,
struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
{
@@ -3670,6 +3675,17 @@ int nvme_init_ctrl_finish(struct nvme_ctrl *ctrl, bool was_suspended)
if (ret)
return ret;
+ if (nvme_admin_ctrl(ctrl)) {
+ /*
+ * An admin controller has one admin queue, but no I/O queues.
+ * Override queue_count so it only creates an admin queue.
+ */
+ dev_dbg(ctrl->device,
+ "Subsystem %s is an administrative controller",
+ ctrl->subsys->subnqn);
+ ctrl->queue_count = 1;
+ }
+
ret = nvme_configure_apst(ctrl);
if (ret < 0)
return ret;
--
2.43.0
Powered by blists - more mailing lists