All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Wagner <dwagner@suse.de>
To: Keith Busch <kbusch@kernel.org>
Cc: linux-nvme@lists.infradead.org, Christoph Hellwig <hch@lst.de>,
	Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
	Chaitanya Kulkarni <chaitanyak@nvidia.com>,
	Martin Belanger <Martin.Belanger@dell.com>,
	Daniel Wagner <dwagner@suse.de>
Subject: [PATCH v1 1/2] nvme/rc: Parse optional arguments in _nvme_connect_subsys()
Date: Mon, 20 Mar 2023 18:38:05 +0100	[thread overview]
Message-ID: <20230320173806.12784-2-dwagner@suse.de> (raw)
In-Reply-To: <20230320173806.12784-1-dwagner@suse.de>

Extend the nvme_connect_subsys() function to parse optional arguments.
This avoids that all test have to pass in always all arguments.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 tests/nvme/rc | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/tests/nvme/rc b/tests/nvme/rc
index 210a82aea384..8f4b4601c44e 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -316,6 +316,42 @@ _nvme_disconnect_subsys() {
 }
 
 _nvme_connect_subsys() {
+	local positional_args=()
+
+	local nr_io_queues=""
+	local nr_write_queues=""
+	local nr_poll_queues=""
+
+	while [[ $# -gt 0 ]]; do
+		case $1 in
+			-i|--nr-io-queues)
+				nr_io_queues="$2"
+				shift
+				shift
+				;;
+			-W|--nr-write-queues)
+				nr_write_queues="$2"
+				shift
+				shift
+				;;
+			-P|--nr-poll-queues)
+				nr_poll_queues="$2"
+				shift
+				shift
+				;;
+			-*|--*)
+				echo "Unknown option $1"
+				exit 1
+				;;
+			*)
+				positional_args+=("$1")
+				shift
+				;;
+		esac
+	done
+
+	set -- "${positional_args[@]}"
+
 	local trtype="$1"
 	local subsysnqn="$2"
 	local traddr="${3:-$def_traddr}"
@@ -344,6 +380,16 @@ _nvme_connect_subsys() {
 	if [[ -n "${ctrlkey}" ]]; then
 		ARGS+=(--dhchap-ctrl-secret="${ctrlkey}")
 	fi
+	if [[ -n "${nr_io_queues}" ]]; then
+		ARGS+=(--nr-io-queues="${nr_io_queues}")
+	fi
+	if [[ -n "${nr_write_queues}" ]]; then
+		ARGS+=(--nr-write-queues="${nr_write_queues}")
+	fi
+	if [[ -n "${nr_poll_queues}" ]]; then
+		ARGS+=(--nr-poll-queues="${nr_poll_queues}")
+	fi
+
 	nvme connect "${ARGS[@]}" 2> /dev/null
 }
 
-- 
2.40.0



  reply	other threads:[~2023-03-20 17:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20 14:19 nvme-tcp poll queue crash Daniel Wagner
2023-03-20 14:36 ` Sagi Grimberg
2023-03-20 14:51   ` Daniel Wagner
2023-03-20 15:06     ` Keith Busch
2023-03-20 15:22       ` Daniel Wagner
2023-03-20 17:38         ` [PATCH v1 0/2] Test different queue counts Daniel Wagner
2023-03-20 17:38           ` Daniel Wagner [this message]
2023-03-21  5:16             ` [PATCH v1 1/2] nvme/rc: Parse optional arguments in _nvme_connect_subsys() Chaitanya Kulkarni
2023-03-21  7:20               ` Daniel Wagner
2023-03-22  5:17                 ` Chaitanya Kulkarni
2023-03-20 17:38           ` [PATCH v1 2/2] nvme/047: Test different queue counts Daniel Wagner
2023-03-20 20:00       ` nvme-tcp poll queue crash Sagi Grimberg
2023-03-20 20:01         ` Sagi Grimberg

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=20230320173806.12784-2-dwagner@suse.de \
    --to=dwagner@suse.de \
    --cc=Martin.Belanger@dell.com \
    --cc=chaitanyak@nvidia.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --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 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.