[PATCH blktests 1/2] nvme: Add _setup_nvmet_port_marginal

Shin'ichiro Kawasaki shinichiro.kawasaki at wdc.com
Fri Aug 14 04:28:52 PDT 2026


On Aug 12, 2026 / 13:45, Jesse Taube wrote:
> 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 at 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

Nit: Most of blktests filess keep each line within 80 characters.
     Folding the line above into two lines is a bit better for small
     terminals.

	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

Nit: it can be a bit shorter:

	if [[ "${nvme_trtype}" != "fc" ]]; then



More information about the Linux-nvme mailing list