Linux block layer
 help / color / mirror / Atom feed
From: Daniel Wagner <dwagner@suse.de>
To: linux-block@vger.kernel.org
Cc: linux-nvme@lists.infradead.org,
	Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
	Sagi Grimberg <sagi@grimberg.me>, Hannes Reinecke <hare@suse.de>,
	James Smart <jsmart2021@gmail.com>,
	Daniel Wagner <dwagner@suse.de>
Subject: [PATCH blktests v5 4/4] nvme/048: test queue count changes on reconnect
Date: Wed,  5 Apr 2023 17:46:30 +0200	[thread overview]
Message-ID: <20230405154630.16298-5-dwagner@suse.de> (raw)
In-Reply-To: <20230405154630.16298-1-dwagner@suse.de>

The target is allowed to change the number of I/O queues. Test if the
host is able to reconnect in this scenario.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 tests/nvme/048     | 81 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/048.out |  3 ++
 2 files changed, 84 insertions(+)
 create mode 100755 tests/nvme/048
 create mode 100644 tests/nvme/048.out

diff --git a/tests/nvme/048 b/tests/nvme/048
new file mode 100755
index 000000000000..bc4766e82159
--- /dev/null
+++ b/tests/nvme/048
@@ -0,0 +1,81 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2023 Daniel Wagner, SUSE Labs
+#
+# Test queue count changes on reconnect
+
+. tests/nvme/rc
+
+DESCRIPTION="Test queue count changes on reconnect"
+QUICK=1
+
+requires() {
+	_nvme_requires
+	_have_loop
+	_require_nvme_trtype tcp rdma fc
+	_require_min_cpus 2
+}
+
+set_max_qid() {
+	local port="$1"
+	local subsys_name="$2"
+	local max_qid="$3"
+
+	_set_nvmet_attr_qid_max "${subsys_name}" "${max_qid}"
+
+	# Setting qid_max forces a disconnect and the reconntect attempt starts
+	# 10s after connection lost, thus we will see the connecting state.
+	_nvmf_wait_for_state "${subsys_name}" "connecting"
+	_nvmf_wait_for_state "${subsys_name}" "live"
+}
+
+test() {
+	local port
+	local subsys_name="blktests-subsystem-1"
+	local hostid
+	local hostnqn="nqn.2014-08.org.nvmexpress:uuid:${hostid}"
+	local file_path="${TMPDIR}/img"
+
+	echo "Running ${TEST_NAME}"
+
+	hostid="$(uuidgen)"
+	if [ -z "$hostid" ] ; then
+		echo "uuidgen failed"
+		return 1
+	fi
+
+	if ! _detect_nvmet_subsys_attr "attr_qid_max"; then
+		SKIP_REASONS+=("missing attr_qid_max feature")
+		return 1
+	fi
+
+	truncate -s 512M "${file_path}"
+
+	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
+		"b92842df-a394-44b1-84a4-92ae7d112861"
+	port="$(_create_nvmet_port "${nvme_trtype}")"
+	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+	_create_nvmet_host "${subsys_name}" "${hostnqn}"
+
+	_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \
+			     --hostnqn "${hostnqn}" \
+			     --hostid "${hostid}"
+
+	_nvmf_wait_for_state "${subsys_name}" "live"
+
+	set_max_qid "${port}" "${subsys_name}" 1
+	set_max_qid "${port}" "${subsys_name}" 128
+
+	_nvme_disconnect_subsys "${subsys_name}"
+
+	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
+	_remove_nvmet_subsystem "${subsys_name}"
+
+	_remove_nvmet_port "${port}"
+
+	_remove_nvmet_host "${hostnqn}"
+
+	rm "${file_path}"
+
+	echo "Test complete"
+}
diff --git a/tests/nvme/048.out b/tests/nvme/048.out
new file mode 100644
index 000000000000..7f986ef9637d
--- /dev/null
+++ b/tests/nvme/048.out
@@ -0,0 +1,3 @@
+Running nvme/048
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Test complete
-- 
2.40.0


  parent reply	other threads:[~2023-04-05 15:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-05 15:46 [PATCH blktests v5 0/4] test queue count changes on reconnect Daniel Wagner
2023-04-05 15:46 ` [PATCH blktests v5 1/4] nvme/rc: Add setter for attr_qid_max Daniel Wagner
2023-04-05 18:39   ` Chaitanya Kulkarni
2023-04-06  6:12     ` Daniel Wagner
2023-04-06  7:05       ` Chaitanya Kulkarni
2023-04-06  7:32         ` Daniel Wagner
2023-04-05 15:46 ` [PATCH blktests v5 2/4] nvme/rc: Add nvmet attribute feature detection function Daniel Wagner
2023-04-05 15:46 ` [PATCH blktests v5 3/4] nvme/rc: Add helper to wait for nvme ctrl state Daniel Wagner
2023-04-05 18:43   ` Chaitanya Kulkarni
2023-04-05 15:46 ` Daniel Wagner [this message]
2023-04-05 18:44   ` [PATCH blktests v5 4/4] nvme/048: test queue count changes on reconnect Chaitanya Kulkarni
2023-04-05 18:57   ` Chaitanya Kulkarni
2023-04-06  6:17     ` Daniel Wagner
2023-04-06  7:04       ` Chaitanya Kulkarni

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=20230405154630.16298-5-dwagner@suse.de \
    --to=dwagner@suse.de \
    --cc=hare@suse.de \
    --cc=jsmart2021@gmail.com \
    --cc=linux-block@vger.kernel.org \
    --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