From: Damien Le Moal <dlemoal@kernel.org>
To: Kamaljit Singh <kamaljit.singh1@wdc.com>,
"kbusch@kernel.org" <kbusch@kernel.org>,
"axboe@kernel.dk" <axboe@kernel.dk>, hch <hch@lst.de>,
"sagi@grimberg.me" <sagi@grimberg.me>,
"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Niklas Cassel <Niklas.Cassel@wdc.com>
Subject: Re: [PATCH v1 1/1] nvme: add admin controller support. prohibit ioq creation for admin & disco ctrlrs
Date: Fri, 28 Mar 2025 15:09:13 -0700 [thread overview]
Message-ID: <ca53c3a8-8af2-4e34-b0e6-3571cbec4bee@kernel.org> (raw)
In-Reply-To: <20250328213640.798910-2-kamaljit.singh1@wdc.com>
On 2025/03/28 14:36, Kamaljit Singh wrote:
> Added capability to connect to an administrative controller by
s/Added/Add
> preventing ioq creation for admin-controllers. Also prevent ioq creation
> for discovery-controllers as the spec prohibits them.
This second part should be a different (preparatory) patch.
>
> * Added nvme_admin_ctrl() to check for an administrative controller
s/Added/Add
And this should be a different preparatory patch.
>
> * Renamed nvme_discovery_ctrl() to nvmf_discovery_ctrl() as discovery is
> more relevant to fabrics
I do not think that is necessary since this is testing the controller type,
which may be limited to fabrics or not.
> * Similar to a discovery ctrl, prevent an admin-ctrl from getting a
> smart log (LID=2). LID 2 is optional for admin controllers but in the
> future when we add support for the newly added LID=0 (supported log
> pages), we can make GLP accesses smarter by basing such calls on
> response from LID=0 reads.
>
> Signed-off-by: Kamaljit Singh <kamaljit.singh1@wdc.com>
[...]
> @@ -2863,13 +2858,19 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
> else
> subsys->subtype = NVME_NQN_NVME;
>
> - if (nvme_discovery_ctrl(ctrl) && subsys->subtype != NVME_NQN_DISC) {
> + if (nvmf_discovery_ctrl(ctrl) && subsys->subtype != NVME_NQN_DISC) {
> dev_err(ctrl->device,
> "Subsystem %s is not a discovery controller",
> subsys->subnqn);
> kfree(subsys);
> return -EINVAL;
> }
> + if (nvme_admin_ctrl(ctrl)) {
> + dev_info(ctrl->device,
> + "Subsystem %s is an administrative controller",
> + subsys->subnqn);
> + }
Is this really necessary ? In any case, please remove the curly brackets.
[...]
> diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
> index 299e3c19df9d..0f3150411bd5 100644
> --- a/drivers/nvme/host/rdma.c
> +++ b/drivers/nvme/host/rdma.c
> @@ -1030,6 +1030,17 @@ static int nvme_rdma_setup_ctrl(struct nvme_rdma_ctrl *ctrl, bool new)
> goto destroy_admin;
> }
>
> + /* An admin or discovery controller has one admin queue, but no I/O queues */
> + if (nvme_admin_ctrl(&ctrl->ctrl) || nvmf_discovery_ctrl(&ctrl->ctrl)) {
> + ctrl->ctrl.queue_count = 1;
> + } else if (ctrl->ctrl.queue_count < 2) {
> + /* I/O controller with no I/O queues is not allowed */
> + ret = -EOPNOTSUPP;
> + dev_err(ctrl->ctrl.device,
> + "I/O controller doesn't allow zero I/O queues!\n");
> + goto destroy_admin;
> + }
This is identical to the change for tcp, so maybe make this a helper function ?
> +
> if (ctrl->ctrl.opts->queue_size > ctrl->ctrl.sqsize + 1) {
> dev_warn(ctrl->ctrl.device,
> "queue_size %zu > ctrl sqsize %u, clamping down\n",
> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
> index 644f84284b6f..3fe2f617bfd5 100644
> --- a/drivers/nvme/host/tcp.c
> +++ b/drivers/nvme/host/tcp.c
> @@ -2199,6 +2199,17 @@ static int nvme_tcp_setup_ctrl(struct nvme_ctrl *ctrl, bool new)
> goto destroy_admin;
> }
>
> + /* An admin or discovery controller has one admin queue, but no I/O queues */
> + if (nvme_admin_ctrl(ctrl) || nvmf_discovery_ctrl(ctrl)) {
> + ctrl->queue_count = 1;
> + } else if (ctrl->queue_count < 2) {
> + /* I/O controller with no I/O queues is not allowed */
> + ret = -EOPNOTSUPP;
> + dev_err(ctrl->device,
> + "I/O controller doesn't allow zero I/O queues!\n");
> + goto destroy_admin;
> + }
> +
> if (opts->queue_size > ctrl->sqsize + 1)
> dev_warn(ctrl->device,
> "queue_size %zu > ctrl sqsize %u, clamping down\n",
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2025-03-28 22:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-28 21:36 [PATCH v1 0/1] nvme: add admin controller support. prohibit ioq creation for admin & disco ctrlrs Kamaljit Singh
2025-03-28 21:36 ` [PATCH v1 1/1] " Kamaljit Singh
2025-03-28 22:09 ` Damien Le Moal [this message]
[not found] ` <BY5PR04MB6849189D63EBB6EF4B66AD42BCAD2@BY5PR04MB6849.namprd04.prod.outlook.com>
2025-04-01 22:47 ` Kamaljit Singh
2025-03-31 7:25 ` Niklas Cassel
[not found] ` <BY5PR04MB68491AD9C47CD7AB9B552098BCAC2@BY5PR04MB6849.namprd04.prod.outlook.com>
2025-04-01 22:52 ` Kamaljit Singh
2025-03-31 15:03 ` Keith Busch
2025-04-01 2:20 ` Chaitanya Kulkarni
2025-04-01 8:04 ` Niklas Cassel
[not found] ` <BY5PR04MB68496CB7512F91FEA30DFF86BCAC2@BY5PR04MB6849.namprd04.prod.outlook.com>
2025-04-01 22:57 ` Kamaljit Singh
2025-04-02 6:37 ` Niklas Cassel
2025-04-02 21:03 ` Kamaljit Singh
2025-04-03 4:49 ` Christoph Hellwig
2025-04-03 18:59 ` Keith Busch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ca53c3a8-8af2-4e34-b0e6-3571cbec4bee@kernel.org \
--to=dlemoal@kernel.org \
--cc=Niklas.Cassel@wdc.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=kamaljit.singh1@wdc.com \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.