Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kamaljit Singh <kamaljit.singh@opensource.wdc.com>
To: kbusch@kernel.org, axboe@kernel.dk, hch@lst.de, sagi@grimberg.me,
	linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: cassel@kernel.org, dlemoal@kernel.org, kamaljit.singh1@wdc.com,
	Kamaljit Singh <kamaljit.singh@opensource.wdc.com>
Subject: [PATCH v2 1/2] nvme-core: add method to check for an I/O controller
Date: Fri,  5 Sep 2025 16:25:49 -0700	[thread overview]
Message-ID: <20250905232550.1950307-2-kamaljit.singh@opensource.wdc.com> (raw)
In-Reply-To: <20250905232550.1950307-1-kamaljit.singh@opensource.wdc.com>

Add nvme_is_io_ctrl() to check if the controller is of type I/O
controller. Uses negative logic by excluding an administrative
controller and a discovery controller.

Signed-off-by: Kamaljit Singh <kamaljit.singh@opensource.wdc.com>
---
 drivers/nvme/host/core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index d67545bd7abb..fab672e50510 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3167,6 +3167,11 @@ static inline bool nvme_admin_ctrl(struct nvme_ctrl *ctrl)
 	return ctrl->cntrltype == NVME_CTRL_ADMIN;
 }
 
+static inline bool nvme_is_io_ctrl(struct nvme_ctrl *ctrl)
+{
+	return !nvme_discovery_ctrl(ctrl) && !nvme_admin_ctrl(ctrl);
+}
+
 static bool nvme_validate_cntlid(struct nvme_subsystem *subsys,
 		struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
 {
-- 
2.43.0



  reply	other threads:[~2025-09-06  0:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-05 23:25 [PATCH v2 0/2] Preclude IOCCSZ/IORCSZ validation for admin controller connect Kamaljit Singh
2025-09-05 23:25 ` Kamaljit Singh [this message]
2025-09-08 12:56   ` [PATCH v2 1/2] nvme-core: add method to check for an I/O controller Hannes Reinecke
2025-09-17 21:42     ` Kamaljit Singh
2025-09-05 23:25 ` [PATCH v2 2/2] nvme-core: do ioccsz/iorcsz validation only for I/O controllers Kamaljit Singh
2025-09-08 12:57   ` Hannes Reinecke
2025-09-17 21:43     ` Kamaljit Singh
2025-09-17 22:41 ` [PATCH v2 0/2] Preclude IOCCSZ/IORCSZ validation for admin controller connect 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=20250905232550.1950307-2-kamaljit.singh@opensource.wdc.com \
    --to=kamaljit.singh@opensource.wdc.com \
    --cc=axboe@kernel.dk \
    --cc=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox