Linux block layer
 help / color / mirror / Atom feed
From: Jesse Taube <jtaubepe@redhat.com>
To: linux-block@vger.kernel.org
Cc: linux-nvme@lists.infradead.org, shinichiro.kawasaki@wdc.com,
	John Meneghini <jmeneghi@redhat.com>,
	Daniel Wagner <dwagner@suse.de>,
	Jesse Taube <jtaubepe@redhat.com>
Subject: [PATCH blktests 1/2] nvme: Add _setup_nvmet_port_marginal
Date: Wed, 12 Aug 2026 13:45:02 -0400	[thread overview]
Message-ID: <20260812174503.3705830-2-jtaubepe@redhat.com> (raw)
In-Reply-To: <20260812174503.3705830-1-jtaubepe@redhat.com>

Adds functionality to set up a NVME port in marginal state.
This is useful for testing the behavior of the NVME driver when a port
is in a marginal state.

Signed-off-by: Jesse Taube <jtaubepe@redhat.com>
---
 common/nvme | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/common/nvme b/common/nvme
index f399937..d389e18 100644
--- a/common/nvme
+++ b/common/nvme
@@ -153,6 +153,15 @@ _nvme_fcloop_add_tport() {
 	echo "wwnn=${wwnn},wwpn=${wwpn}" > ${loopctl}/add_target_port
 }
 
+_nvme_fcloop_set_rport_marginal() {
+	local wwnn="$1"
+	local wwpn="$2"
+	local marginal="$3"
+	local loopctl=/sys/class/fcloop/ctl
+
+	echo "wwnn=${wwnn},wwpn=${wwpn},marginal=${marginal}" > ${loopctl}/set_marginal_rport
+}
+
 _nvme_fcloop_del_rport() {
 	local local_wwnn="$1"
 	local local_wwpn="$2"
@@ -763,6 +772,27 @@ _create_nvmet_port() {
 	echo "${port}"
 }
 
+_setup_nvmet_port_marginal() {
+	local -i port="$1"
+	local state="${2}"
+
+	if [[ ! "${nvme_trtype}" == "fc" ]]; then
+		echo "FAIL _setup_nvmet_port_marginal() only supports fc transport"
+		exit 1
+	fi
+
+	if [[ "${state}" == "live" ]]; then
+		_nvme_fcloop_set_rport_marginal "$(_remote_wwnn $port)" \
+					"$(_remote_wwpn $port)" 0
+	elif [[ "${state}" == "marginal" ]]; then
+		_nvme_fcloop_set_rport_marginal "$(_remote_wwnn $port)" \
+					"$(_remote_wwpn $port)" 1
+	else
+		echo "FAIL _setup_nvmet_port_marginal() invalid state: ${state}"
+		exit 1
+	fi
+}
+
 _setup_nvmet_port_ana() {
 	local port="$1"
 	local anagrpid="${2:-$def_anagrpid}"
-- 
2.54.0


  reply	other threads:[~2026-08-12 17:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12 17:45 [PATCH blktests 0/2] Test multipath and marginal ports Jesse Taube
2026-08-12 17:45 ` Jesse Taube [this message]
2026-08-12 19:03   ` [PATCH blktests 1/2] nvme: Add _setup_nvmet_port_marginal John Meneghini
2026-08-14 11:28   ` Shin'ichiro Kawasaki
2026-08-12 17:45 ` [PATCH blktests 2/2] nvme/070: Test multipath and marginal ports Jesse Taube
2026-08-12 19:03   ` John Meneghini
2026-08-14 11:47   ` Shin'ichiro Kawasaki
2026-08-14 11:24 ` [PATCH blktests 0/2] " Shin'ichiro Kawasaki
2026-08-14 14:18   ` Jesse Taube

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=20260812174503.3705830-2-jtaubepe@redhat.com \
    --to=jtaubepe@redhat.com \
    --cc=dwagner@suse.de \
    --cc=jmeneghi@redhat.com \
    --cc=linux-block@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox