Re: [PATCH blktests 1/2] nvme: Add _setup_nvmet_port_marginal

Shin'ichiro Kawasaki <[email protected]>
Newsgroups org.infradead.lists.linux-nvme,org.kernel.vger.linux-block
Message-ID <an77IhZTP02mcn5E@shinmob>
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 <[email protected]>
> ---
>  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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.