Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Max Gurtovoy <mgurtovoy@nvidia.com>
To: <dwagner@suse.de>, <johannes.thumshirn@wdc.com>, <kch@nvidia.com>,
	<linux-nvme@lists.infradead.org>
Cc: <israelr@nvidia.com>, <shinichiro.kawasaki@wdc.com>, <hch@lst.de>,
	<kbusch@kernel.org>, <sagi@grimberg.me>,
	Max Gurtovoy <mgurtovoy@nvidia.com>
Subject: [PATCH 4/4] nvmet: add --qid-max support for subsystem creation and setup
Date: Sun, 28 Sep 2025 14:51:25 +0300	[thread overview]
Message-ID: <20250928115125.38383-5-mgurtovoy@nvidia.com> (raw)
In-Reply-To: <20250928115125.38383-1-mgurtovoy@nvidia.com>

Introduce support for the --qid-max argument to both
_create_nvmet_subsystem and _nvmet_target_setup functions, allowing
configuration of the maximum queue ID through the "attr_qid_max" sysfs
attribute when available. This enables more flexible queue management
for NVMe subsystems.

Additionally, update test 048 to set qid_max via the new --qid-max
workflow. This will follow the new logic added to the NVMe target
driver, which forbid changing the attr_qid_max for a discovered
subsystem.

Also increase the sleep durations to adjust real RDMA HW devices.

Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
---
 common/nvme    | 18 ++++++++++++++++++
 tests/nvme/048 |  7 ++++---
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/common/nvme b/common/nvme
index 01d054d..3a883ff 100644
--- a/common/nvme
+++ b/common/nvme
@@ -752,6 +752,7 @@ _create_nvmet_subsystem() {
 	local blkdev
 	local uuid="${def_subsys_uuid}"
 	local resv_enable
+	local qid_max
 	local cfs_path
 	local -a ARGS
 
@@ -773,6 +774,10 @@ _create_nvmet_subsystem() {
 				resv_enable="--resv_enable";
 				shift 1
 				;;
+			--qid-max)
+				qid_max="$2"
+				shift 2
+				;;
 			*)
 				echo "WARNING: unknown argument: $1"
 				shift
@@ -794,6 +799,11 @@ _create_nvmet_subsystem() {
 	if [[ -n "$resv_enable" ]]; then
 		ARGS+=("${resv_enable}")
 	fi
+	if [[ -f "${cfs_path}/attr_qid_max" ]]; then
+		if [[ -n "$qid_max" ]]; then
+			echo "${qid_max}" > "${cfs_path}/attr_qid_max"
+		fi
+	fi
 	_create_nvmet_ns "${ARGS[@]}" > /dev/null
 }
 
@@ -971,6 +981,7 @@ _nvmet_target_setup() {
 	local port p
 	local resv_enable=""
 	local num_ports=1
+	local qid_max
 	local tls="none"
 	local -a ARGS
 
@@ -1012,6 +1023,10 @@ _nvmet_target_setup() {
 				tls="required"
 				shift 1
 				;;
+			--qid-max)
+				qid_max="$2"
+				shift 2
+				;;
 			*)
 				echo "WARNING: unknown argument: $1"
 				shift
@@ -1054,6 +1069,9 @@ _nvmet_target_setup() {
 	if [[ -n "${resv_enable}" ]]; then
 		ARGS+=("${resv_enable}")
 	fi
+	if [[ -n "${qid_max}" ]]; then
+		ARGS+=(--qid-max "${qid_max}")
+	fi
 	_create_nvmet_subsystem "${ARGS[@]}"
 
 	p=0
diff --git a/tests/nvme/048 b/tests/nvme/048
index afd9272..c6f4d9f 100755
--- a/tests/nvme/048
+++ b/tests/nvme/048
@@ -37,7 +37,7 @@ nvmf_check_queue_count() {
 			return 1
 		fi
 
-		sleep 1
+		sleep 2
 
 		retries=$((retries - 1))
 		queue_count_file=$(cat /sys/class/nvme-fabrics/ctl/"${nvmedev}"/queue_count)
@@ -58,9 +58,10 @@ set_qid_max() {
 	local subsys_name="$1"
 	local qid_max="$2"
 
-	set_nvmet_attr_qid_max "${subsys_name}" "${qid_max}"
+	_nvmet_target_cleanup
+	_nvmet_target_setup --blkdev file --qid-max "${qid_max}"
 	nvmf_check_queue_count "${subsys_name}" "${qid_max}" || return 1
-	_nvmf_wait_for_state "${subsys_name}" "live" || return 1
+	_nvmf_wait_for_state "${subsys_name}" "live" 10 || return 1
 
 	return 0
 }
-- 
2.18.1



  parent reply	other threads:[~2025-09-28 11:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-28 11:51 [PATCH 0/4] NVMe: add support for mlx5 RDMA HW and test enhancements Max Gurtovoy
2025-09-28 11:51 ` [PATCH 1/4] nvme/061: increase nvmf state wait timeout to 10s Max Gurtovoy
2025-09-30  1:44   ` Chaitanya Kulkarni
2025-09-28 11:51 ` [PATCH 2/4] nvme: add support for mlx5 RDMA devices Max Gurtovoy
2025-09-30  1:44   ` Chaitanya Kulkarni
2025-09-30  3:38   ` Shinichiro Kawasaki
2025-09-28 11:51 ` [PATCH 3/4] nvme/002: extend test to support TCP and RDMA transports Max Gurtovoy
2025-09-30  1:43   ` Chaitanya Kulkarni
2025-09-28 11:51 ` Max Gurtovoy [this message]
2025-09-30  1:43   ` [PATCH 4/4] nvmet: add --qid-max support for subsystem creation and setup Chaitanya Kulkarni
2025-09-30  3:41   ` Shinichiro Kawasaki
2025-09-30  3:46 ` [PATCH 0/4] NVMe: add support for mlx5 RDMA HW and test enhancements Shinichiro Kawasaki

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=20250928115125.38383-5-mgurtovoy@nvidia.com \
    --to=mgurtovoy@nvidia.com \
    --cc=dwagner@suse.de \
    --cc=hch@lst.de \
    --cc=israelr@nvidia.com \
    --cc=johannes.thumshirn@wdc.com \
    --cc=kbusch@kernel.org \
    --cc=kch@nvidia.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=shinichiro.kawasaki@wdc.com \
    /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