From nobody Tue Sep 29 04:11:54 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A3A8485514 for ; Wed, 12 Aug 2026 18:13:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558415; cv=none; b=QjZ6nyavLyreZAwca3HMpKDUyTSWoS6qzr77cBkL70laXiI8drTyfk5Q4y9u3nbRNuQRbNxerSnkCNSEU7FvUwIxLZcyXKtlrmpAVw3QWieVzyI0V1+0k6xTmx+RhwHE4UslUTJr1PpPtLjtCqkavjTGWdbMrerWkJVXONBDtfo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558415; c=relaxed/simple; bh=e96OchnMFlBTwf3U2/LWDJ4Y9aNe68TSW4kWJDZbJ1Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fwT0rb7NXMqdl5UAgdmzeVAsWMM9WaiPR3lZbJSIoBnLxEaPUGnSnzwDK9CctdsqCPmj/Y3T7GfIHTQNfkMQ2Lpvjzcqu9HdJvt0cLUy8DHDcgLgpsYPM+TorE2HVREkiVihP4rrBFWpUGhqUf67mBgJKvLD90gJNkldoON/g+M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=BzWI6wjp; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BzWI6wjp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786558412; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/YMUpa8YvLLphIeGGv9+ehR4AWWW5XS1l0L51yHfUSk=; b=BzWI6wjpoc2yKqryxvgAeRiMQHaH61oy2gdUOnIKRTMtq+mtdUL+qfV3kEfuFN8CcvVwgZ kBCb3X0CFJtkBaliNj2+Km4H8uwqyTqz0LtoMd+p+OrsID1ETaSDNQt+ZNf0eu9y4uHyMh fHW2LjiDHvixJiE6YFB4VGbg5/rbgYA= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-622-2ytLjSLVPEeotdv85Wpz9A-1; Wed, 12 Aug 2026 14:13:26 -0400 X-MC-Unique: 2ytLjSLVPEeotdv85Wpz9A-1 X-Mimecast-MFC-AGG-ID: 2ytLjSLVPEeotdv85Wpz9A_1786558396 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9030E1956089; Wed, 12 Aug 2026 18:13:15 +0000 (UTC) Received: from jtaubepe-thinkpadx1carbongen12.ibmlowe.csb (unknown [10.22.88.181]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1D456180034F; Wed, 12 Aug 2026 18:13:08 +0000 (UTC) From: Jesse Taube To: linux-scsi@vger.kernel.org Cc: Jonathan Corbet , Shuah Khan , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Justin Tee , Naresh Gottumukkala , Paul Ely , Chaitanya Kulkarni , "James E.J. Bottomley" , "Martin K. Petersen" , Nilesh Javali , GR-QLogic-Storage-Upstream@marvell.com, Hannes Reinecke , Jesse Taube , "Gustavo A. R. Silva" , John Meneghini , Bryan Gurney , Chris Leech , "Ewan D . Milne" , shinichiro.kawasaki@wdc.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Hannes Reinecke Subject: [PATCH 01/13] fc_els: use 'union fc_tlv_desc' Date: Wed, 12 Aug 2026 14:12:48 -0400 Message-ID: <20260812181300.3712426-2-jtaubepe@redhat.com> In-Reply-To: <20260812181300.3712426-1-jtaubepe@redhat.com> References: <20260812181300.3712426-1-jtaubepe@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" From: Hannes Reinecke Introduce 'union fc_tlv_desc' to have a common structure for all FC ELS TLV structures and avoid type casts. Commit 44b6169ada7f ("scsi: fc: Avoid -Wflex-array-member-not-at-end warnings") conflicts with this change. To solve the problem I moved the fc_els_rdf_hdr and fc_els_rdf_resp_hdr definitions out of fc_els.h and into lpfc_hw4.h. Fixes: 44b6169ada7f ("scsi: fc: Avoid -Wflex-array-member-not-at-end warnin= gs") Cc: Gustavo A. R. Silva Co-developed-by: John Meneghini Signed-off-by: John Meneghini Signed-off-by: Hannes Reinecke Tested-by: Bryan Gurney --- V10 -> V11: - No change/Rebase --- drivers/scsi/lpfc/lpfc_els.c | 77 +++++++------- drivers/scsi/lpfc/lpfc_hw4.h | 12 ++- drivers/scsi/scsi_transport_fc.c | 27 ++--- include/uapi/scsi/fc/fc_els.h | 174 ++++++++++++++++--------------- 4 files changed, 146 insertions(+), 144 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 52fc5058976d..11143da24b54 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -3888,7 +3888,7 @@ lpfc_issue_els_rdf(struct lpfc_vport *vport, uint8_t = retry) memset(prdf, 0, cmdsize); prdf->rdf.fpin_cmd =3D ELS_RDF; prdf->rdf.desc_len =3D cpu_to_be32(sizeof(struct lpfc_els_rdf_req) - - sizeof(struct fc_els_rdf_hdr)); + offsetof(struct fc_els_rdf, desc)); prdf->reg_d1.reg_desc.desc_tag =3D cpu_to_be32(ELS_DTAG_FPIN_REGISTER); prdf->reg_d1.reg_desc.desc_len =3D cpu_to_be32( FC_TLV_DESC_LENGTH_FROM_SZ(prdf->reg_d1)); @@ -4075,7 +4075,7 @@ lpfc_cmpl_els_edc(struct lpfc_hba *phba, struct lpfc_= iocbq *cmdiocb, { IOCB_t *irsp_iocb; struct fc_els_edc_resp *edc_rsp; - struct fc_tlv_desc *tlv; + union fc_tlv_desc *tlv; struct fc_diag_cg_sig_desc *pcgd; struct fc_diag_lnkflt_desc *plnkflt; struct lpfc_dmabuf *pcmd, *prsp; @@ -4166,7 +4166,7 @@ lpfc_cmpl_els_edc(struct lpfc_hba *phba, struct lpfc_= iocbq *cmdiocb, goto out; } =20 - dtag =3D be32_to_cpu(tlv->desc_tag); + dtag =3D be32_to_cpu(tlv->hdr.desc_tag); switch (dtag) { case ELS_DTAG_LNK_FAULT_CAP: if (bytes_remain < FC_TLV_DESC_SZ_FROM_LENGTH(tlv) || @@ -4181,7 +4181,7 @@ lpfc_cmpl_els_edc(struct lpfc_hba *phba, struct lpfc_= iocbq *cmdiocb, sizeof(struct fc_diag_lnkflt_desc)); goto out; } - plnkflt =3D (struct fc_diag_lnkflt_desc *)tlv; + plnkflt =3D &tlv->lnkflt; lpfc_printf_log(phba, KERN_INFO, LOG_ELS | LOG_LDS_EVENT, "4617 Link Fault Desc Data: 0x%08x 0x%08x " @@ -4208,7 +4208,7 @@ lpfc_cmpl_els_edc(struct lpfc_hba *phba, struct lpfc_= iocbq *cmdiocb, goto out; } =20 - pcgd =3D (struct fc_diag_cg_sig_desc *)tlv; + pcgd =3D &tlv->cg_sig; lpfc_printf_log( phba, KERN_INFO, LOG_ELS | LOG_CGN_MGMT, "4616 CGN Desc Data: 0x%08x 0x%08x " @@ -4263,10 +4263,8 @@ lpfc_cmpl_els_edc(struct lpfc_hba *phba, struct lpfc= _iocbq *cmdiocb, } =20 static void -lpfc_format_edc_lft_desc(struct lpfc_hba *phba, struct fc_tlv_desc *tlv) +lpfc_format_edc_lft_desc(struct lpfc_hba *phba, struct fc_diag_lnkflt_desc= *lft) { - struct fc_diag_lnkflt_desc *lft =3D (struct fc_diag_lnkflt_desc *)tlv; - lft->desc_tag =3D cpu_to_be32(ELS_DTAG_LNK_FAULT_CAP); lft->desc_len =3D cpu_to_be32( FC_TLV_DESC_LENGTH_FROM_SZ(struct fc_diag_lnkflt_desc)); @@ -4279,10 +4277,8 @@ lpfc_format_edc_lft_desc(struct lpfc_hba *phba, stru= ct fc_tlv_desc *tlv) } =20 static void -lpfc_format_edc_cgn_desc(struct lpfc_hba *phba, struct fc_tlv_desc *tlv) +lpfc_format_edc_cgn_desc(struct lpfc_hba *phba, struct fc_diag_cg_sig_desc= *cgd) { - struct fc_diag_cg_sig_desc *cgd =3D (struct fc_diag_cg_sig_desc *)tlv; - /* We are assuming cgd was zero'ed before calling this routine */ =20 /* Configure the congestion detection capability */ @@ -4381,7 +4377,7 @@ lpfc_issue_els_edc(struct lpfc_vport *vport, uint8_t = retry) struct lpfc_hba *phba =3D vport->phba; struct lpfc_iocbq *elsiocb; struct fc_els_edc *edc_req; - struct fc_tlv_desc *tlv; + union fc_tlv_desc *tlv; u16 cmdsize; struct lpfc_nodelist *ndlp; u8 *pcmd =3D NULL; @@ -4420,13 +4416,13 @@ lpfc_issue_els_edc(struct lpfc_vport *vport, uint8_= t retry) tlv =3D edc_req->desc; =20 if (cgn_desc_size) { - lpfc_format_edc_cgn_desc(phba, tlv); + lpfc_format_edc_cgn_desc(phba, &tlv->cg_sig); phba->cgn_sig_freq =3D lpfc_fabric_cgn_frequency; tlv =3D fc_tlv_next_desc(tlv); } =20 if (lft_desc_size) - lpfc_format_edc_lft_desc(phba, tlv); + lpfc_format_edc_lft_desc(phba, &tlv->lnkflt); =20 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS | LOG_CGN_MGMT, "4623 Xmit EDC to remote " @@ -5999,7 +5995,7 @@ lpfc_issue_els_edc_rsp(struct lpfc_vport *vport, stru= ct lpfc_iocbq *cmdiocb, { struct lpfc_hba *phba =3D vport->phba; struct fc_els_edc_resp *edc_rsp; - struct fc_tlv_desc *tlv; + union fc_tlv_desc *tlv; struct lpfc_iocbq *elsiocb; IOCB_t *icmd, *cmd; union lpfc_wqe128 *wqe; @@ -6043,10 +6039,10 @@ lpfc_issue_els_edc_rsp(struct lpfc_vport *vport, st= ruct lpfc_iocbq *cmdiocb, FC_TLV_DESC_LENGTH_FROM_SZ(struct fc_els_lsri_desc)); edc_rsp->lsri.rqst_w0.cmd =3D ELS_EDC; tlv =3D edc_rsp->desc; - lpfc_format_edc_cgn_desc(phba, tlv); + lpfc_format_edc_cgn_desc(phba, &tlv->cg_sig); tlv =3D fc_tlv_next_desc(tlv); if (lft_desc_size) - lpfc_format_edc_lft_desc(phba, tlv); + lpfc_format_edc_lft_desc(phba, &tlv->lnkflt); =20 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, "Issue EDC ACC: did:x%x flg:x%lx refcnt %d", @@ -9439,7 +9435,7 @@ lpfc_els_rcv_edc(struct lpfc_vport *vport, struct lpf= c_iocbq *cmdiocb, { struct lpfc_hba *phba =3D vport->phba; struct fc_els_edc *edc_req; - struct fc_tlv_desc *tlv; + union fc_tlv_desc *tlv; uint8_t *payload; uint32_t *ptr, dtag; const char *dtag_nm; @@ -9482,7 +9478,7 @@ lpfc_els_rcv_edc(struct lpfc_vport *vport, struct lpf= c_iocbq *cmdiocb, goto out; } =20 - dtag =3D be32_to_cpu(tlv->desc_tag); + dtag =3D be32_to_cpu(tlv->hdr.desc_tag); switch (dtag) { case ELS_DTAG_LNK_FAULT_CAP: if (bytes_remain < FC_TLV_DESC_SZ_FROM_LENGTH(tlv) || @@ -9497,7 +9493,7 @@ lpfc_els_rcv_edc(struct lpfc_vport *vport, struct lpf= c_iocbq *cmdiocb, sizeof(struct fc_diag_lnkflt_desc)); goto out; } - plnkflt =3D (struct fc_diag_lnkflt_desc *)tlv; + plnkflt =3D &tlv->lnkflt; lpfc_printf_log(phba, KERN_INFO, LOG_ELS | LOG_LDS_EVENT, "4626 Link Fault Desc Data: x%08x len x%x " @@ -9534,7 +9530,7 @@ lpfc_els_rcv_edc(struct lpfc_vport *vport, struct lpf= c_iocbq *cmdiocb, phba->cgn_sig_freq =3D lpfc_fabric_cgn_frequency; =20 lpfc_least_capable_settings( - phba, (struct fc_diag_cg_sig_desc *)tlv); + phba, &tlv->cg_sig); break; default: dtag_nm =3D lpfc_get_tlv_dtag_nm(dtag); @@ -10124,14 +10120,13 @@ lpfc_display_fpin_wwpn(struct lpfc_hba *phba, __b= e64 *wwnlist, u32 cnt) /** * lpfc_els_rcv_fpin_li - Process an FPIN Link Integrity Event. * @phba: Pointer to phba object. - * @tlv: Pointer to the Link Integrity Notification Descriptor. + * @li: Pointer to the Link Integrity Notification Descriptor. * * This function processes a Link Integrity FPIN event by logging a messag= e. **/ static void -lpfc_els_rcv_fpin_li(struct lpfc_hba *phba, struct fc_tlv_desc *tlv) +lpfc_els_rcv_fpin_li(struct lpfc_hba *phba, struct fc_fn_li_desc *li) { - struct fc_fn_li_desc *li =3D (struct fc_fn_li_desc *)tlv; const char *li_evt_str; u32 li_evt, cnt; =20 @@ -10155,14 +10150,13 @@ lpfc_els_rcv_fpin_li(struct lpfc_hba *phba, struc= t fc_tlv_desc *tlv) /** * lpfc_els_rcv_fpin_del - Process an FPIN Delivery Event. * @phba: Pointer to hba object. - * @tlv: Pointer to the Delivery Notification Descriptor TLV + * @del: Pointer to the Delivery Notification Descriptor TLV * * This function processes a Delivery FPIN event by logging a message. **/ static void -lpfc_els_rcv_fpin_del(struct lpfc_hba *phba, struct fc_tlv_desc *tlv) +lpfc_els_rcv_fpin_del(struct lpfc_hba *phba, struct fc_fn_deli_desc *del) { - struct fc_fn_deli_desc *del =3D (struct fc_fn_deli_desc *)tlv; const char *del_rsn_str; u32 del_rsn; __be32 *frame; @@ -10193,14 +10187,14 @@ lpfc_els_rcv_fpin_del(struct lpfc_hba *phba, stru= ct fc_tlv_desc *tlv) /** * lpfc_els_rcv_fpin_peer_cgn - Process a FPIN Peer Congestion Event. * @phba: Pointer to hba object. - * @tlv: Pointer to the Peer Congestion Notification Descriptor TLV + * @pc: Pointer to the Peer Congestion Notification Descriptor TLV * * This function processes a Peer Congestion FPIN event by logging a messa= ge. **/ static void -lpfc_els_rcv_fpin_peer_cgn(struct lpfc_hba *phba, struct fc_tlv_desc *tlv) +lpfc_els_rcv_fpin_peer_cgn(struct lpfc_hba *phba, + struct fc_fn_peer_congn_desc *pc) { - struct fc_fn_peer_congn_desc *pc =3D (struct fc_fn_peer_congn_desc *)tlv; const char *pc_evt_str; u32 pc_evt, cnt; =20 @@ -10228,7 +10222,7 @@ lpfc_els_rcv_fpin_peer_cgn(struct lpfc_hba *phba, s= truct fc_tlv_desc *tlv) /** * lpfc_els_rcv_fpin_cgn - Process an FPIN Congestion notification * @phba: Pointer to hba object. - * @tlv: Pointer to the Congestion Notification Descriptor TLV + * @cgn: Pointer to the Congestion Notification Descriptor TLV * * This function processes an FPIN Congestion Notifiction. The notificati= on * could be an Alarm or Warning. This routine feeds that data into driver= 's @@ -10237,10 +10231,9 @@ lpfc_els_rcv_fpin_peer_cgn(struct lpfc_hba *phba, = struct fc_tlv_desc *tlv) * to the upper layer or 0 to indicate don't deliver it. **/ static int -lpfc_els_rcv_fpin_cgn(struct lpfc_hba *phba, struct fc_tlv_desc *tlv) +lpfc_els_rcv_fpin_cgn(struct lpfc_hba *phba, struct fc_fn_congn_desc *cgn) { struct lpfc_cgn_info *cp; - struct fc_fn_congn_desc *cgn =3D (struct fc_fn_congn_desc *)tlv; const char *cgn_evt_str; u32 cgn_evt; const char *cgn_sev_str; @@ -10341,7 +10334,7 @@ lpfc_els_rcv_fpin(struct lpfc_vport *vport, void *p= , u32 fpin_length) { struct lpfc_hba *phba =3D vport->phba; struct fc_els_fpin *fpin =3D (struct fc_els_fpin *)p; - struct fc_tlv_desc *tlv, *first_tlv, *current_tlv; + union fc_tlv_desc *tlv, *first_tlv, *current_tlv; const char *dtag_nm; int desc_cnt =3D 0, bytes_remain, cnt; u32 dtag, deliver =3D 0; @@ -10366,7 +10359,7 @@ lpfc_els_rcv_fpin(struct lpfc_vport *vport, void *p= , u32 fpin_length) return; } =20 - tlv =3D (struct fc_tlv_desc *)&fpin->fpin_desc[0]; + tlv =3D &fpin->fpin_desc[0]; first_tlv =3D tlv; bytes_remain =3D fpin_length - offsetof(struct fc_els_fpin, fpin_desc); bytes_remain =3D min_t(u32, bytes_remain, be32_to_cpu(fpin->desc_len)); @@ -10374,22 +10367,22 @@ lpfc_els_rcv_fpin(struct lpfc_vport *vport, void = *p, u32 fpin_length) /* process each descriptor separately */ while (bytes_remain >=3D FC_TLV_DESC_HDR_SZ && bytes_remain >=3D FC_TLV_DESC_SZ_FROM_LENGTH(tlv)) { - dtag =3D be32_to_cpu(tlv->desc_tag); + dtag =3D be32_to_cpu(tlv->hdr.desc_tag); switch (dtag) { case ELS_DTAG_LNK_INTEGRITY: - lpfc_els_rcv_fpin_li(phba, tlv); + lpfc_els_rcv_fpin_li(phba, &tlv->li); deliver =3D 1; break; case ELS_DTAG_DELIVERY: - lpfc_els_rcv_fpin_del(phba, tlv); + lpfc_els_rcv_fpin_del(phba, &tlv->deli); deliver =3D 1; break; case ELS_DTAG_PEER_CONGEST: - lpfc_els_rcv_fpin_peer_cgn(phba, tlv); + lpfc_els_rcv_fpin_peer_cgn(phba, &tlv->peer_congn); deliver =3D 1; break; case ELS_DTAG_CONGESTION: - deliver =3D lpfc_els_rcv_fpin_cgn(phba, tlv); + deliver =3D lpfc_els_rcv_fpin_cgn(phba, &tlv->congn); break; default: dtag_nm =3D lpfc_get_tlv_dtag_nm(dtag); @@ -10402,12 +10395,12 @@ lpfc_els_rcv_fpin(struct lpfc_vport *vport, void = *p, u32 fpin_length) return; } lpfc_cgn_update_stat(phba, dtag); - cnt =3D be32_to_cpu(tlv->desc_len); + cnt =3D be32_to_cpu(tlv->hdr.desc_len); =20 /* Sanity check descriptor length. The desc_len value does not * include space for the desc_tag and the desc_len fields. */ - len -=3D (cnt + sizeof(struct fc_tlv_desc)); + len -=3D (cnt + sizeof(struct fc_tlv_desc_hdr)); if (len < 0) { dtag_nm =3D lpfc_get_tlv_dtag_nm(dtag); lpfc_printf_log(phba, KERN_WARNING, LOG_CGN_MGMT, diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h index 41fa8f3329da..10490b3a05cd 100644 --- a/drivers/scsi/lpfc/lpfc_hw4.h +++ b/drivers/scsi/lpfc/lpfc_hw4.h @@ -4926,12 +4926,20 @@ struct lpfc_els_rdf_reg_desc { }; =20 struct lpfc_els_rdf_req { - struct fc_els_rdf_hdr rdf; /* hdr up to descriptors */ + struct { + __u8 fpin_cmd; /* command (0x19) */ + __u8 fpin_zero[3]; /* specified as zero - part of cmd */ + __be32 desc_len; /* Length of Descriptor List (in bytes) */ + } rdf; /* hdr up to descriptors */ struct lpfc_els_rdf_reg_desc reg_d1; /* 1st descriptor */ }; =20 struct lpfc_els_rdf_rsp { - struct fc_els_rdf_resp_hdr rdf_resp; /* hdr up to descriptors */ + struct { + struct fc_els_ls_acc acc_hdr; + __be32 desc_list_len; /* Length of response (in bytes) */ + struct fc_els_lsri_desc lsri; + } rdf_resp; /* hdr up to descriptors */ struct lpfc_els_rdf_reg_desc reg_d1; /* 1st descriptor */ }; =20 diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport= _fc.c index 173ed6373f04..02c58f4591d8 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -776,12 +776,11 @@ fc_fpin_pname_stats_update(struct Scsi_Host *shost, * */ static void -fc_fpin_li_stats_update(struct Scsi_Host *shost, struct fc_tlv_desc *tlv) +fc_fpin_li_stats_update(struct Scsi_Host *shost, struct fc_fn_li_desc *li_= desc) { struct fc_rport *rport =3D NULL; struct fc_rport *attach_rport =3D NULL; struct fc_host_attrs *fc_host =3D shost_to_fc_host(shost); - struct fc_fn_li_desc *li_desc =3D (struct fc_fn_li_desc *)tlv; u16 event_type =3D be16_to_cpu(li_desc->event_type); =20 rport =3D fc_find_rport_by_wwpn(shost, @@ -812,12 +811,11 @@ fc_fpin_li_stats_update(struct Scsi_Host *shost, stru= ct fc_tlv_desc *tlv) */ static void fc_fpin_delivery_stats_update(struct Scsi_Host *shost, - struct fc_tlv_desc *tlv) + struct fc_fn_deli_desc *dn_desc) { struct fc_rport *rport =3D NULL; struct fc_rport *attach_rport =3D NULL; struct fc_host_attrs *fc_host =3D shost_to_fc_host(shost); - struct fc_fn_deli_desc *dn_desc =3D (struct fc_fn_deli_desc *)tlv; u32 reason_code =3D be32_to_cpu(dn_desc->deli_reason_code); =20 rport =3D fc_find_rport_by_wwpn(shost, @@ -843,12 +841,10 @@ fc_fpin_delivery_stats_update(struct Scsi_Host *shost, */ static void fc_fpin_peer_congn_stats_update(struct Scsi_Host *shost, - struct fc_tlv_desc *tlv) + struct fc_fn_peer_congn_desc *pc_desc) { struct fc_rport *rport =3D NULL; struct fc_rport *attach_rport =3D NULL; - struct fc_fn_peer_congn_desc *pc_desc =3D - (struct fc_fn_peer_congn_desc *)tlv; u16 event_type =3D be16_to_cpu(pc_desc->event_type); =20 rport =3D fc_find_rport_by_wwpn(shost, @@ -876,10 +872,9 @@ fc_fpin_peer_congn_stats_update(struct Scsi_Host *shos= t, */ static void fc_fpin_congn_stats_update(struct Scsi_Host *shost, - struct fc_tlv_desc *tlv) + struct fc_fn_congn_desc *congn) { struct fc_host_attrs *fc_host =3D shost_to_fc_host(shost); - struct fc_fn_congn_desc *congn =3D (struct fc_fn_congn_desc *)tlv; =20 fc_cn_stats_update(be16_to_cpu(congn->event_type), &fc_host->fpin_stats); @@ -899,32 +894,32 @@ fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_le= n, char *fpin_buf, u8 event_acknowledge) { struct fc_els_fpin *fpin =3D (struct fc_els_fpin *)fpin_buf; - struct fc_tlv_desc *tlv; + union fc_tlv_desc *tlv; u32 bytes_remain; u32 dtag; enum fc_host_event_code event_code =3D event_acknowledge ? FCH_EVT_LINK_FPIN_ACK : FCH_EVT_LINK_FPIN; =20 /* Update Statistics */ - tlv =3D (struct fc_tlv_desc *)&fpin->fpin_desc[0]; + tlv =3D &fpin->fpin_desc[0]; bytes_remain =3D fpin_len - offsetof(struct fc_els_fpin, fpin_desc); bytes_remain =3D min_t(u32, bytes_remain, be32_to_cpu(fpin->desc_len)); =20 while (bytes_remain >=3D FC_TLV_DESC_HDR_SZ && bytes_remain >=3D FC_TLV_DESC_SZ_FROM_LENGTH(tlv)) { - dtag =3D be32_to_cpu(tlv->desc_tag); + dtag =3D be32_to_cpu(tlv->hdr.desc_tag); switch (dtag) { case ELS_DTAG_LNK_INTEGRITY: - fc_fpin_li_stats_update(shost, tlv); + fc_fpin_li_stats_update(shost, &tlv->li); break; case ELS_DTAG_DELIVERY: - fc_fpin_delivery_stats_update(shost, tlv); + fc_fpin_delivery_stats_update(shost, &tlv->deli); break; case ELS_DTAG_PEER_CONGEST: - fc_fpin_peer_congn_stats_update(shost, tlv); + fc_fpin_peer_congn_stats_update(shost, &tlv->peer_congn); break; case ELS_DTAG_CONGESTION: - fc_fpin_congn_stats_update(shost, tlv); + fc_fpin_congn_stats_update(shost, &tlv->congn); } =20 bytes_remain -=3D FC_TLV_DESC_SZ_FROM_LENGTH(tlv); diff --git a/include/uapi/scsi/fc/fc_els.h b/include/uapi/scsi/fc/fc_els.h index dca6a28f4e86..b5653e1dee13 100644 --- a/include/uapi/scsi/fc/fc_els.h +++ b/include/uapi/scsi/fc/fc_els.h @@ -259,12 +259,12 @@ enum fc_ls_tlv_dtag { =20 =20 /* - * Generic Link Service TLV Descriptor format + * Generic Link Service TLV Descriptor header * * This structure, as it defines no payload, will also be referred to * as the "tlv header" - which contains the tag and len fields. */ -struct fc_tlv_desc { +struct fc_tlv_desc_hdr { __be32 desc_tag; /* Notification Descriptor Tag */ __be32 desc_len; /* Length of Descriptor (in bytes). * Size of descriptor excluding @@ -273,36 +273,6 @@ struct fc_tlv_desc { __u8 desc_value[]; /* Descriptor Value */ }; =20 -/* Descriptor tag and len fields are considered the mandatory header - * for a descriptor - */ -#define FC_TLV_DESC_HDR_SZ sizeof(struct fc_tlv_desc) - -/* - * Macro, used when initializing payloads, to return the descriptor length. - * Length is size of descriptor minus the tag and len fields. - */ -#define FC_TLV_DESC_LENGTH_FROM_SZ(desc) \ - (sizeof(desc) - FC_TLV_DESC_HDR_SZ) - -/* Macro, used on received payloads, to return the descriptor length */ -#define FC_TLV_DESC_SZ_FROM_LENGTH(tlv) \ - (__be32_to_cpu((tlv)->desc_len) + FC_TLV_DESC_HDR_SZ) - -/* - * This helper is used to walk descriptors in a descriptor list. - * Given the address of the current descriptor, which minimally contains a - * tag and len field, calculate the address of the next descriptor based - * on the len field. - */ -static inline void *fc_tlv_next_desc(void *desc) -{ - struct fc_tlv_desc *tlv =3D desc; - - return (desc + FC_TLV_DESC_SZ_FROM_LENGTH(tlv)); -} - - /* * Link Service Request Information Descriptor */ @@ -1100,19 +1070,6 @@ struct fc_fn_congn_desc { __u8 resv[3]; /* reserved - must be zero */ }; =20 -/* - * ELS_FPIN - Fabric Performance Impact Notification - */ -struct fc_els_fpin { - __u8 fpin_cmd; /* command (0x16) */ - __u8 fpin_zero[3]; /* specified as zero - part of cmd */ - __be32 desc_len; /* Length of Descriptor List (in bytes). - * Size of ELS excluding fpin_cmd, - * fpin_zero and desc_len fields. - */ - struct fc_tlv_desc fpin_desc[]; /* Descriptor list */ -}; - /* Diagnostic Function Descriptor - FPIN Registration */ struct fc_df_desc_fpin_reg { /* New members MUST be added within the __struct_group() macro below. */ @@ -1136,42 +1093,6 @@ struct fc_df_desc_fpin_reg { _Static_assert(offsetof(struct fc_df_desc_fpin_reg, desc_tags) =3D=3D size= of(struct fc_df_desc_fpin_reg_hdr), "struct member likely outside of __struct_group()"); =20 -/* - * ELS_RDF - Register Diagnostic Functions - */ -struct fc_els_rdf { - /* New members MUST be added within the __struct_group() macro below. */ - __struct_group(fc_els_rdf_hdr, __hdr, /* no attrs */, - __u8 fpin_cmd; /* command (0x19) */ - __u8 fpin_zero[3]; /* specified as zero - part of cmd */ - __be32 desc_len; /* Length of Descriptor List (in bytes). - * Size of ELS excluding fpin_cmd, - * fpin_zero and desc_len fields. - */ - ); - struct fc_tlv_desc desc[]; /* Descriptor list */ -}; -_Static_assert(offsetof(struct fc_els_rdf, desc) =3D=3D sizeof(struct fc_e= ls_rdf_hdr), - "struct member likely outside of __struct_group()"); - -/* - * ELS RDF LS_ACC Response. - */ -struct fc_els_rdf_resp { - /* New members MUST be added within the __struct_group() macro below. */ - __struct_group(fc_els_rdf_resp_hdr, __hdr, /* no attrs */, - struct fc_els_ls_acc acc_hdr; - __be32 desc_list_len; /* Length of response (in - * bytes). Excludes acc_hdr - * and desc_list_len fields. - */ - struct fc_els_lsri_desc lsri; - ); - struct fc_tlv_desc desc[]; /* Supported Descriptor list */ -}; -_Static_assert(offsetof(struct fc_els_rdf_resp, desc) =3D=3D sizeof(struct= fc_els_rdf_resp_hdr), - "struct member likely outside of __struct_group()"); - /* * Diagnostic Capability Descriptors for EDC ELS */ @@ -1241,6 +1162,65 @@ struct fc_diag_cg_sig_desc { struct fc_diag_cg_sig_freq rcv_signal_frequency; }; =20 +/* + * Generic Link Service TLV Descriptor format + * + * This structure, as it defines no payload, will also be referred to + * as the "tlv header" - which contains the tag and len fields. + */ +union fc_tlv_desc { + struct fc_tlv_desc_hdr hdr; + struct fc_els_lsri_desc lsri; + struct fc_fn_li_desc li; + struct fc_fn_deli_desc deli; + struct fc_fn_peer_congn_desc peer_congn; + struct fc_fn_congn_desc congn; + struct fc_df_desc_fpin_reg fpin_reg; + struct fc_diag_lnkflt_desc lnkflt; + struct fc_diag_cg_sig_desc cg_sig; +}; + +/* Descriptor tag and len fields are considered the mandatory header + * for a descriptor + */ +#define FC_TLV_DESC_HDR_SZ sizeof(struct fc_tlv_desc_hdr) + +/* + * Macro, used when initializing payloads, to return the descriptor length. + * Length is size of descriptor minus the tag and len fields. + */ +#define FC_TLV_DESC_LENGTH_FROM_SZ(desc) \ + (sizeof(desc) - FC_TLV_DESC_HDR_SZ) + +/* Macro, used on received payloads, to return the descriptor length */ +#define FC_TLV_DESC_SZ_FROM_LENGTH(tlv) \ + (__be32_to_cpu((tlv)->hdr.desc_len) + FC_TLV_DESC_HDR_SZ) + +/* + * This helper is used to walk descriptors in a descriptor list. + * Given the address of the current descriptor, which minimally contains a + * tag and len field, calculate the address of the next descriptor based + * on the len field. + */ +static inline union fc_tlv_desc *fc_tlv_next_desc(union fc_tlv_desc *desc) +{ + return (union fc_tlv_desc *)((__u8 *)desc + FC_TLV_DESC_SZ_FROM_LENGTH(de= sc)); +} + + +/* + * ELS_FPIN - Fabric Performance Impact Notification + */ +struct fc_els_fpin { + __u8 fpin_cmd; /* command (0x16) */ + __u8 fpin_zero[3]; /* specified as zero - part of cmd */ + __be32 desc_len; /* Length of Descriptor List (in bytes). + * Size of ELS excluding fpin_cmd, + * fpin_zero and desc_len fields. + */ + union fc_tlv_desc fpin_desc[]; /* Descriptor list */ +}; + /* * ELS_EDC - Exchange Diagnostic Capabilities */ @@ -1251,10 +1231,37 @@ struct fc_els_edc { * Size of ELS excluding edc_cmd, * edc_zero and desc_len fields. */ - struct fc_tlv_desc desc[]; + union fc_tlv_desc desc[]; /* Diagnostic Descriptor list */ }; =20 +/* + * ELS_RDF - Register Diagnostic Functions + */ +struct fc_els_rdf { + __u8 fpin_cmd; /* command (0x19) */ + __u8 fpin_zero[3]; /* specified as zero - part of cmd */ + __be32 desc_len; /* Length of Descriptor List (in bytes). + * Size of ELS excluding fpin_cmd, + * fpin_zero and desc_len fields. + */ + union fc_tlv_desc desc[]; /* Descriptor list */ +}; + +/* + * ELS RDF LS_ACC Response. + */ +struct fc_els_rdf_resp { + struct fc_els_ls_acc acc_hdr; + __be32 desc_list_len; /* Length of response (in + * bytes). Excludes acc_hdr + * and desc_list_len fields. + */ + struct fc_els_lsri_desc lsri; + union fc_tlv_desc desc[]; /* Supported Descriptor list */ +}; + + /* * ELS EDC LS_ACC Response. */ @@ -1265,9 +1272,8 @@ struct fc_els_edc_resp { * and desc_list_len fields. */ struct fc_els_lsri_desc lsri; - struct fc_tlv_desc desc[]; + union fc_tlv_desc desc[]; /* Supported Diagnostic Descriptor list */ }; =20 - #endif /* _FC_ELS_H_ */ --=20 2.54.0 From nobody Tue Sep 29 04:11:54 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5112E484251 for ; Wed, 12 Aug 2026 18:13:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558412; cv=none; b=KsvuBcrstvQmeJGQrsSjzcKSN2pK02B7zCiEGjBCGd352mUCZbDhek1l2BMYNQMFaguFERTG9jjN0JDahiIvjELNgFoX6WumN9MSX0seaoXIOmoVdrSzc+R0H5ae047KgNAzZvz/vYTcGAPn4jaSeDjRWiIEwMmnz1F3BuBO/bk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558412; c=relaxed/simple; bh=nVNVKvSQnWy9q37hIpl8ldI2+SeX7+AmeDuXxjLSRoo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=B3vAvcYZnEj3/2Ym8uyJzjqa4FeSWQDoHAOUfU42vMOgw265Z3SY55jt7hbxHqkElSMV93fPTtlJ6Wqs6ZqhnB98Qn1AYi4EJqxzQDnu9VBoDLUB/9vGKuCPn+M6mE4AfXHdumV8OcZVosNk33EH37PaXzy2O4kRQPCwhV16Um0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=iqHBryTA; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iqHBryTA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786558410; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5MfzhQvKEBlzKJ7iDwtDZheNaAf+DCfS+roQ64ylDmU=; b=iqHBryTA+fA3sAqcAGGlGvqrx9nRKY5uIL3hFztHKnNQBQCZkJKUk+9PMruFAihCDjjKum NCgrrGFx37J4uxS2KDXrfD7BgabfdEbmRJ+12IkAU+EObHqQt/zBIvyuDv/2mIrKhqrdvA VEqGC4IvrS9FeOGywTvTFUzJ1IlZO9M= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-335-Tq0dORmYNgiX1CLBaA3nXg-1; Wed, 12 Aug 2026 14:13:25 -0400 X-MC-Unique: Tq0dORmYNgiX1CLBaA3nXg-1 X-Mimecast-MFC-AGG-ID: Tq0dORmYNgiX1CLBaA3nXg_1786558401 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C583218007E7; Wed, 12 Aug 2026 18:13:20 +0000 (UTC) Received: from jtaubepe-thinkpadx1carbongen12.ibmlowe.csb (unknown [10.22.88.181]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DD4C918005BB; Wed, 12 Aug 2026 18:13:15 +0000 (UTC) From: Jesse Taube To: linux-scsi@vger.kernel.org Cc: Jonathan Corbet , Shuah Khan , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Justin Tee , Naresh Gottumukkala , Paul Ely , Chaitanya Kulkarni , "James E.J. Bottomley" , "Martin K. Petersen" , Nilesh Javali , GR-QLogic-Storage-Upstream@marvell.com, Hannes Reinecke , Jesse Taube , "Gustavo A. R. Silva" , John Meneghini , Bryan Gurney , Chris Leech , "Ewan D . Milne" , shinichiro.kawasaki@wdc.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org Subject: [PATCH 02/13] nvme: add NVME_CTRL_MARGINAL flag Date: Wed, 12 Aug 2026 14:12:49 -0400 Message-ID: <20260812181300.3712426-3-jtaubepe@redhat.com> In-Reply-To: <20260812181300.3712426-1-jtaubepe@redhat.com> References: <20260812181300.3712426-1-jtaubepe@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" From: Bryan Gurney Add a new controller flag, NVME_CTRL_MARGINAL, to help multipath I/O policies to react to a path that is set to a "marginal" state. The flag is cleared on controller reset, which is often the case when faulty cabling or transceiver hardware is replaced. Signed-off-by: Bryan Gurney --- V10 -> V11: - No change --- drivers/nvme/host/core.c | 1 + drivers/nvme/host/fc.c | 4 ++++ drivers/nvme/host/nvme.h | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 453c1f0b2dd0..957090af2171 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -5165,6 +5165,7 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct dev= ice *dev, WRITE_ONCE(ctrl->state, NVME_CTRL_NEW); ctrl->passthru_err_log_enabled =3D false; clear_bit(NVME_CTRL_FAILFAST_EXPIRED, &ctrl->flags); + clear_bit(NVME_CTRL_MARGINAL, &ctrl->flags); spin_lock_init(&ctrl->lock); mutex_init(&ctrl->namespaces_lock); =20 diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index 04363b9c4489..d2ca65f70a0c 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -788,6 +788,10 @@ nvme_fc_ctrl_connectivity_loss(struct nvme_fc_ctrl *ct= rl) "Reconnect", ctrl->cnum); =20 set_bit(ASSOC_FAILED, &ctrl->flags); + + /* clear 'marginal' flag as controller will be reset */ + clear_bit(NVME_CTRL_MARGINAL, &ctrl->flags); + nvme_reset_ctrl(&ctrl->ctrl); } =20 diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 824651cc898d..3616742d6788 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -329,6 +329,7 @@ enum nvme_ctrl_flags { NVME_CTRL_SKIP_ID_CNS_CS =3D 4, NVME_CTRL_DIRTY_CAPABILITY =3D 5, NVME_CTRL_FROZEN =3D 6, + NVME_CTRL_MARGINAL =3D 7, }; =20 struct nvme_ctrl { @@ -479,6 +480,11 @@ static inline enum nvme_ctrl_state nvme_ctrl_state(str= uct nvme_ctrl *ctrl) return READ_ONCE(ctrl->state); } =20 +static inline bool nvme_ctrl_is_marginal(struct nvme_ctrl *ctrl) +{ + return test_bit(NVME_CTRL_MARGINAL, &ctrl->flags); +} + enum nvme_iopolicy { NVME_IOPOLICY_NUMA, NVME_IOPOLICY_RR, --=20 2.54.0 From nobody Tue Sep 29 04:11:54 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29A70486652 for ; Wed, 12 Aug 2026 18:13:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558417; cv=none; b=iTcuY7S/hqUClDkItByBcCVDG1T6mNjOVeaQs+9taSf9JFyrBRxGI5QqVNjVYoAdARBazcd38OJEfstR8ejKbhm5OD24ILiObbTq25TeETyIkan7IYMrogDiRa+UAzw8LYD4KsIl3MApiwvcNT3fFXte9yN8SE21l+V2wpRHsIA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558417; c=relaxed/simple; bh=ur2Hev1FLJ1HwFjaHZ/1lmfUBsMxcGkycZjqGOjKKGk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Gx2lBcTrb3qbBD/bR5ZeTuX63VV5pi+ERM6zfCSfU95nF3t/oiTbG4ma5okOM/6wk1XilFmT2CjlrZA6dicW2gNwdM/7JNZMhUQfJOrqqdbHiuU4Q5NrwyqAbTLQykpx584esqXCtCIsCGUzOITVeC+z55XRatQHq4iRaY0yum4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=jU65dH8+; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="jU65dH8+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786558415; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XuxldGJkQSNbqK2Yx8HEdsWR3K9j6pez914nD5LW/PI=; b=jU65dH8+4sDYL3LcRPNfyhqH9g9yYUunq5VkE78csuMrjIIDZ2gUBAYy2NP1FIpIa4zbXe ZO+qRmb8GRZf8C2VrbKjaOCrJ/YntHmkJ7R58Bi7PVgZrTCkh90tmnokIzJEXJuaZb289z 2AJPl//6b4+OSlslOgaOjI0y5vUsvwY= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-147-lkZ0DEioM9evW6z3W1nCnQ-1; Wed, 12 Aug 2026 14:13:30 -0400 X-MC-Unique: lkZ0DEioM9evW6z3W1nCnQ-1 X-Mimecast-MFC-AGG-ID: lkZ0DEioM9evW6z3W1nCnQ_1786558408 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AD9D018007FD; Wed, 12 Aug 2026 18:13:27 +0000 (UTC) Received: from jtaubepe-thinkpadx1carbongen12.ibmlowe.csb (unknown [10.22.88.181]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 15F99180034C; Wed, 12 Aug 2026 18:13:20 +0000 (UTC) From: Jesse Taube To: linux-scsi@vger.kernel.org Cc: Jonathan Corbet , Shuah Khan , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Justin Tee , Naresh Gottumukkala , Paul Ely , Chaitanya Kulkarni , "James E.J. Bottomley" , "Martin K. Petersen" , Nilesh Javali , GR-QLogic-Storage-Upstream@marvell.com, Hannes Reinecke , Jesse Taube , "Gustavo A. R. Silva" , John Meneghini , Bryan Gurney , Chris Leech , "Ewan D . Milne" , shinichiro.kawasaki@wdc.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org Subject: [PATCH 03/13] nvme-multipath: numa support for marginal paths Date: Wed, 12 Aug 2026 14:12:50 -0400 Message-ID: <20260812181300.3712426-4-jtaubepe@redhat.com> In-Reply-To: <20260812181300.3712426-1-jtaubepe@redhat.com> References: <20260812181300.3712426-1-jtaubepe@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" FPIN LI (link integrity) messages are received when the attached fabric detects hardware errors. In response to these messages I/O should be directed away from the affected ports, and only used if no other non-marginal paths are available. To handle this a new controller flag 'NVME_CTRL_MARGINAL' is added which will cause the multipath scheduler to skip these paths when checking for 'optimized' paths. Signed-off-by: Jesse Taube --- This is a distinct change from the previous commit which treated marginal paths as non-optimized but still usable. This changes the priority of marginal paths to be lower than non-optimized paths. V10 -> V11: - New commit --- drivers/nvme/host/multipath.c | 53 +++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index 9b9a657fa330..02936c580a37 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -305,10 +305,44 @@ static bool nvme_path_is_disabled(struct nvme_ns *ns) return false; } =20 +/* + * Returns true if the new distance is better than the old one. + */ +static bool is_best_distance(bool found_is_marginal, bool marginal, + int old_distance, int distance) +{ + if (found_is_marginal) { + if (marginal) { + /* + * A marginal path has already been found, + * or this is the first path found. + * This one is also marginal, but closer + * to the NUMA node, so prefer it. + */ + if (distance < old_distance) + return true; + } else { + /* Found a non-marginal path, use it over a marginal one. */ + return true; + } + } else { + /* A non-marginal path has already found. This one is marginal, so skip = it. */ + if (marginal) + return false; + + /* Found a closer non-marginal path, use it. */ + if (distance < old_distance) + return true; + } + + return false; +} + static struct nvme_ns *__nvme_find_path(struct nvme_ns_head *head, int nod= e) { int found_distance =3D INT_MAX, fallback_distance =3D INT_MAX, distance; struct nvme_ns *found =3D NULL, *fallback =3D NULL, *ns; + bool found_is_marginal =3D true, fallback_is_marginal =3D true; =20 list_for_each_entry_srcu(ns, &head->list, siblings, srcu_read_lock_held(&head->srcu)) { @@ -323,15 +357,19 @@ static struct nvme_ns *__nvme_find_path(struct nvme_n= s_head *head, int node) =20 switch (ns->ana_state) { case NVME_ANA_OPTIMIZED: - if (distance < found_distance) { + if (is_best_distance(found_is_marginal, nvme_ctrl_is_marginal(ns->ctrl), + found_distance, distance)) { found_distance =3D distance; found =3D ns; + found_is_marginal =3D nvme_ctrl_is_marginal(ns->ctrl); } break; case NVME_ANA_NONOPTIMIZED: - if (distance < fallback_distance) { + if (is_best_distance(fallback_is_marginal, nvme_ctrl_is_marginal(ns->ct= rl), + fallback_distance, distance)) { fallback_distance =3D distance; fallback =3D ns; + fallback_is_marginal =3D nvme_ctrl_is_marginal(ns->ctrl); } break; default: @@ -339,6 +377,14 @@ static struct nvme_ns *__nvme_find_path(struct nvme_ns= _head *head, int node) } } =20 + /* + * Use non-optimized path only if it is not marginal + * and no optimized path is marginal. + */ + if (found_is_marginal && !fallback_is_marginal) + found =3D fallback; + + /* No optimized path found, use the fallback */ if (!found) found =3D fallback; if (found) @@ -444,7 +490,8 @@ static struct nvme_ns *nvme_queue_depth_path(struct nvm= e_ns_head *head) static inline bool nvme_path_is_optimized(struct nvme_ns *ns) { return nvme_ctrl_state(ns->ctrl) =3D=3D NVME_CTRL_LIVE && - ns->ana_state =3D=3D NVME_ANA_OPTIMIZED; + ns->ana_state =3D=3D NVME_ANA_OPTIMIZED && + !nvme_ctrl_is_marginal(ns->ctrl); } =20 static struct nvme_ns *nvme_numa_path(struct nvme_ns_head *head) --=20 2.54.0 From nobody Tue Sep 29 04:11:54 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0A88484249 for ; Wed, 12 Aug 2026 18:13:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558437; cv=none; b=RB9CuMoIB/5T/FOQlsnOQMKWzqhnUzNFQJwXAFQ5PCGT5QSR5DvniOyqHwT7BT87dVnDD6jIP55WUEoWhFINp5ZoGcKb+GJa2HO8q1eeGP5LPrUHu0VZ1/rP+1FXlwENk9TAlyN3OMQZ7k/iBl7HeOJsS+XoaUMWFxEl0Z4hDJI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558437; c=relaxed/simple; bh=pXmsgew6LHplNFdkV6enDJUmqQO4wZCvzVIbfHl6bcw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W66JCFzxuk2QuO8EhUxkEENtfTX5I6NyHDRPGPdVmxbag4ZQj4xEXpg17BNSbB3q3LZIbUbkT4VVk0xijIFPO2Mw/r9z1tFsE46sqSDiw0VvFGsHIgg8FliNCmFrlChWX7QHH4eSEYKTR0LDVzswR+34q8K0bkeZv874ot8qZus= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=bCQegTn4; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bCQegTn4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786558433; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Vcu9PbtDT1pNYoR33movkVcPOA1p/h5oinwfvgSmomU=; b=bCQegTn4OxIJH7YrwcpwUBHTL9AzsHarQbVwx+yUZ0XiQb3khdgz1VP3577qQhPNiUU8dB BEkuhF057smqu2Bk6WE75W0R8zaaMqvD7VaQVt6Mq0wHUiLvDHPTZrBe7o6ymCkam7w9XR f6kANO6VbjrJpW0fb8WaAUjfM7LPVkw= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-258--3g3ShMDN3KjRurcw1SDwA-1; Wed, 12 Aug 2026 14:13:46 -0400 X-MC-Unique: -3g3ShMDN3KjRurcw1SDwA-1 X-Mimecast-MFC-AGG-ID: -3g3ShMDN3KjRurcw1SDwA_1786558414 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0849C195604B; Wed, 12 Aug 2026 18:13:34 +0000 (UTC) Received: from jtaubepe-thinkpadx1carbongen12.ibmlowe.csb (unknown [10.22.88.181]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 41C3E180034F; Wed, 12 Aug 2026 18:13:28 +0000 (UTC) From: Jesse Taube To: linux-scsi@vger.kernel.org Cc: Jonathan Corbet , Shuah Khan , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Justin Tee , Naresh Gottumukkala , Paul Ely , Chaitanya Kulkarni , "James E.J. Bottomley" , "Martin K. Petersen" , Nilesh Javali , GR-QLogic-Storage-Upstream@marvell.com, Hannes Reinecke , Jesse Taube , "Gustavo A. R. Silva" , John Meneghini , Bryan Gurney , Chris Leech , "Ewan D . Milne" , shinichiro.kawasaki@wdc.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org Subject: [PATCH 04/13] nvme-multipath: queue-depth support for marginal paths Date: Wed, 12 Aug 2026 14:12:51 -0400 Message-ID: <20260812181300.3712426-5-jtaubepe@redhat.com> In-Reply-To: <20260812181300.3712426-1-jtaubepe@redhat.com> References: <20260812181300.3712426-1-jtaubepe@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" From: John Meneghini Exclude marginal paths from queue-depth io policy. In the case where all paths are marginal and no optimized or non-optimized path is found, we fall back and select the best marginal path. Signed-off-by: Jesse Taube Signed-off-by: John Meneghini --- V10 -> V11: - New commit --- drivers/nvme/host/multipath.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index 02936c580a37..dc34634842be 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -453,7 +453,9 @@ static struct nvme_ns *nvme_round_robin_path(struct nvm= e_ns_head *head) static struct nvme_ns *nvme_queue_depth_path(struct nvme_ns_head *head) { struct nvme_ns *best_opt =3D NULL, *best_nonopt =3D NULL, *ns; - unsigned int min_depth_opt =3D UINT_MAX, min_depth_nonopt =3D UINT_MAX; + int min_depth_opt =3D INT_MAX, min_depth_nonopt =3D INT_MAX; + bool opt_is_marginal =3D true, nonopt_is_marginal =3D true, marginal; + unsigned int depth; =20 list_for_each_entry_srcu(ns, &head->list, siblings, @@ -462,28 +464,40 @@ static struct nvme_ns *nvme_queue_depth_path(struct n= vme_ns_head *head) continue; =20 depth =3D atomic_read(&ns->ctrl->nr_active); + marginal =3D nvme_ctrl_is_marginal(ns->ctrl); =20 switch (ns->ana_state) { case NVME_ANA_OPTIMIZED: - if (depth < min_depth_opt) { + if (is_best_distance(opt_is_marginal, marginal, + min_depth_opt, depth)) { min_depth_opt =3D depth; best_opt =3D ns; + opt_is_marginal =3D marginal; } break; case NVME_ANA_NONOPTIMIZED: - if (depth < min_depth_nonopt) { + if (is_best_distance(nonopt_is_marginal, marginal, + min_depth_nonopt, depth)) { min_depth_nonopt =3D depth; best_nonopt =3D ns; + nonopt_is_marginal =3D marginal; } break; default: break; } =20 - if (min_depth_opt =3D=3D 0) + if (min_depth_opt =3D=3D 0 && !opt_is_marginal) return best_opt; } =20 + /* + * Prefer non-marginal non-optimized path + * over a marginal optimized path. + */ + if (opt_is_marginal && !nonopt_is_marginal && best_nonopt) + return best_nonopt; + return best_opt ? best_opt : best_nonopt; } =20 --=20 2.54.0 From nobody Tue Sep 29 04:11:54 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5475A483806 for ; Wed, 12 Aug 2026 18:13:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558432; cv=none; b=BRAn0j5/Xm1Zwe0WCRANiS4w44nirDDcceffSjrcOJhmY490SPnYEPzqV3tK618rLRyFKz8BIJ4dCcdmNQvz6hx2iUNOQUQlPMegColVgoyQqCVq+mub0sShKGSuulHMJMf0kdr72rdUc6pdx6n3FaWQ5fokbOhorNRVy0PKlKo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558432; c=relaxed/simple; bh=ih+r6u2j+Jx4pTCdPB8B0Ila2P8nfiI+EO6yY7eySyM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cviaET5RJQmtSCfjD3llut7T1ZPku4A308vkeTuyk4fAVNU1l8KcPBZs/HT3iquImeEeb2lq3xPz5v4431poLDp27dBohNB6GCUqIUZWLSCykUUojQxkIhe5LI6AI/VIymORZKbOcGwd0d1EiRQLydSLnltPvb2XH4y8Bp0KvcU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=QHa7mJ/Q; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QHa7mJ/Q" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786558428; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p5hCJTyk+JlNhkqSdY8pBWBu0X2FbGauT5SMAOg6BwM=; b=QHa7mJ/QQfBfpiArRnHgI3XXso12OXdf28cdbrHFJ44DKFGiBRUdxG5DSmG1qA134HUWOx I+IGjMBQoAjw4V+OpCxnmMm0YYDnL2IL7Iz5FRpP1o6jdDetw6ksEhGxqsMtcs7Xe6IbFw DFFY7hDoAaDDb4wt573got3r3SzVfjQ= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-673-0Kh43q5oOv-BWeaItZ2FLg-1; Wed, 12 Aug 2026 14:13:43 -0400 X-MC-Unique: 0Kh43q5oOv-BWeaItZ2FLg-1 X-Mimecast-MFC-AGG-ID: 0Kh43q5oOv-BWeaItZ2FLg_1786558420 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E602619560AA; Wed, 12 Aug 2026 18:13:39 +0000 (UTC) Received: from jtaubepe-thinkpadx1carbongen12.ibmlowe.csb (unknown [10.22.88.181]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 42C76180034C; Wed, 12 Aug 2026 18:13:34 +0000 (UTC) From: Jesse Taube To: linux-scsi@vger.kernel.org Cc: Jonathan Corbet , Shuah Khan , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Justin Tee , Naresh Gottumukkala , Paul Ely , Chaitanya Kulkarni , "James E.J. Bottomley" , "Martin K. Petersen" , Nilesh Javali , GR-QLogic-Storage-Upstream@marvell.com, Hannes Reinecke , Jesse Taube , "Gustavo A. R. Silva" , John Meneghini , Bryan Gurney , Chris Leech , "Ewan D . Milne" , shinichiro.kawasaki@wdc.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org Subject: [PATCH 05/13] nvme-multipath: round-robin support for marginal paths Date: Wed, 12 Aug 2026 14:12:52 -0400 Message-ID: <20260812181300.3712426-6-jtaubepe@redhat.com> In-Reply-To: <20260812181300.3712426-1-jtaubepe@redhat.com> References: <20260812181300.3712426-1-jtaubepe@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" Exclude marginal paths from round-robin io policy. In the case where all paths are marginal and no optimized or non-optimized path is found, we fall back and perform round-robin on the marginal paths. Signed-off-by: Jesse Taube --- V10 -> V11: - New commit --- drivers/nvme/host/multipath.c | 47 +++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index dc34634842be..11f474704fdd 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -405,6 +405,7 @@ static struct nvme_ns *nvme_next_ns(struct nvme_ns_head= *head, static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head) { struct nvme_ns *ns, *found =3D NULL; + bool found_is_marginal =3D true; int node =3D numa_node_id(); struct nvme_ns *old =3D srcu_dereference(head->current_path[node], &head->srcu); @@ -425,22 +426,58 @@ static struct nvme_ns *nvme_round_robin_path(struct n= vme_ns_head *head) continue; =20 if (ns->ana_state =3D=3D NVME_ANA_OPTIMIZED) { + if (found_is_marginal && nvme_ctrl_is_marginal(ns->ctrl)) { + /* + * A marginal path has already found, + * or this is the first path found. + * This one is also marginal, but optimized, + * so prefer it. + */ + found =3D ns; + found_is_marginal =3D 1; + continue; + } + + + /* + * A non-marginal path has already found. + * This one is marginal, so skip it. + */ + if (nvme_ctrl_is_marginal(ns->ctrl)) + continue; + + /* Found a non-marginal, optimized path use it. */ found =3D ns; goto out; } - if (ns->ana_state =3D=3D NVME_ANA_NONOPTIMIZED) + if (ns->ana_state =3D=3D NVME_ANA_NONOPTIMIZED) { + /* + * A path has already found. This one is marginal, + * so skip it. + */ + if (found && nvme_ctrl_is_marginal(ns->ctrl)) + continue; found =3D ns; + found_is_marginal =3D nvme_ctrl_is_marginal(ns->ctrl); + } } =20 /* * The loop above skips the current path for round-robin semantics. * Fall back to the current path if either: - * - no other optimized path found and current is optimized, + * - no other non-marginal optimized path found and current is, + * optimized and not marginal. * - no other usable path found and current is usable. */ - if (!nvme_path_is_disabled(old) && - (old->ana_state =3D=3D NVME_ANA_OPTIMIZED || - (!found && old->ana_state =3D=3D NVME_ANA_NONOPTIMIZED))) + /* no other usable path found and current is usable. */ + if (!nvme_path_is_disabled(old) && !found) + return old; + /* + * no other non-marginal optimized path found and current is, + * optimized and not marginal. + */ + if (!nvme_path_is_disabled(old) && !nvme_ctrl_is_marginal(old->ctrl) && + (old->ana_state =3D=3D NVME_ANA_OPTIMIZED || found_is_marginal)) return old; =20 if (!found) --=20 2.54.0 From nobody Tue Sep 29 04:11:54 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA486488D83 for ; Wed, 12 Aug 2026 18:14:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558463; cv=none; b=YGH1CLdp7ZxbvHG7udlByiv6WyuduQI0MPwlyYmNpjssgg9Mi2BkLF2WZ0uR8a7zUZ02nE4hTdzBcYAauEoo6D1Ltm7gYnWTbYz4hTe6SEql3aHams9fYQY+Q0CcMZpIL0hxqY88V/tYNUyfcUYtHxzkbsVp2o1bj4ru6Dn5R+Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558463; c=relaxed/simple; bh=Tozo6v9zSWNbSekcCtx0iIWT50xK3WeyS2R6i0Dl6PQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=n70fIUrVuWnUuGE28mgUi9URc9a5bZjSCHbQ66dSq83l7ut5ZaAktua1bM5xFhe9e8IhHV4jjceWn3izgqWqr0r5h19jl9Brv8/a1qVAO7IzpQK3X8sc3el5EZGjCJeIleRdbqB9AV3flOGgxaQiG+bEGms0GwR5ZbSClHoNQEY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ZNx4y/Aa; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ZNx4y/Aa" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786558460; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m6MmefElPADUsUlsKoVw0MoCzb8atKySep+Ag3qO74g=; b=ZNx4y/Aa3gCxVWrsW43kcmjbRGR9HQaK/Ku/xU54e401IqvWXBwPSDEOdQrGjk2gNhHcdg CtRgcAmONgTRYVum0D5aD0WBxtXasIxmMyViA6A/sYc3WUutDpEGC9wDSmeGgmf8BpUZTg WHCXruv6G8q9XiMmkPizkSvmsW/QRYE= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-662-3CiHzm0rMVS3JEMHq_k8ZA-1; Wed, 12 Aug 2026 14:13:54 -0400 X-MC-Unique: 3CiHzm0rMVS3JEMHq_k8ZA-1 X-Mimecast-MFC-AGG-ID: 3CiHzm0rMVS3JEMHq_k8ZA_1786558426 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 155DD19560AD; Wed, 12 Aug 2026 18:13:46 +0000 (UTC) Received: from jtaubepe-thinkpadx1carbongen12.ibmlowe.csb (unknown [10.22.88.181]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3F79D18005BB; Wed, 12 Aug 2026 18:13:40 +0000 (UTC) From: Jesse Taube To: linux-scsi@vger.kernel.org Cc: Jonathan Corbet , Shuah Khan , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Justin Tee , Naresh Gottumukkala , Paul Ely , Chaitanya Kulkarni , "James E.J. Bottomley" , "Martin K. Petersen" , Nilesh Javali , GR-QLogic-Storage-Upstream@marvell.com, Hannes Reinecke , Jesse Taube , "Gustavo A. R. Silva" , John Meneghini , Bryan Gurney , Chris Leech , "Ewan D . Milne" , shinichiro.kawasaki@wdc.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Muneendra Kumar Subject: [PATCH 06/13] nvme: sysfs: emit the marginal path state in show_state() Date: Wed, 12 Aug 2026 14:12:53 -0400 Message-ID: <20260812181300.3712426-7-jtaubepe@redhat.com> In-Reply-To: <20260812181300.3712426-1-jtaubepe@redhat.com> References: <20260812181300.3712426-1-jtaubepe@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" From: Bryan Gurney If a controller has received a link integrity or congestion event, and has the NVME_CTRL_MARGINAL flag set, emit "marginal" in the state instead of "live", to identify the marginal paths. Co-developed-by: John Meneghini Signed-off-by: John Meneghini Reviewed-by: Hannes Reinecke Reviewed-by: Chaitanya Kulkarni Tested-by: Muneendra Kumar Signed-off-by: Bryan Gurney --- V10 -> V11: - No change --- drivers/nvme/host/sysfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/sysfs.c b/drivers/nvme/host/sysfs.c index 75b2d69b5957..01c771dc88cb 100644 --- a/drivers/nvme/host/sysfs.c +++ b/drivers/nvme/host/sysfs.c @@ -527,7 +527,9 @@ static ssize_t nvme_sysfs_show_state(struct device *dev, }; =20 if (state < ARRAY_SIZE(state_name) && state_name[state]) - return sysfs_emit(buf, "%s\n", state_name[state]); + return sysfs_emit(buf, "%s\n", + (nvme_ctrl_is_marginal(ctrl)) ? "marginal" : + state_name[state]); =20 return sysfs_emit(buf, "unknown state\n"); } --=20 2.54.0 From nobody Tue Sep 29 04:11:54 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60C5D47FAE8 for ; Wed, 12 Aug 2026 18:14:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558450; cv=none; b=JIJaQjbq/32Kzg68YOUDWSKa6xEMGHDRqrQVqU/ArTVYZEm4QLLUwVVHQS9ND8i4LSjFYZ/HdRiVjFW9VOWfHAam41yXsDKFaQYreIwaqOsBbyxYAM0ikEvcHO9u8zGNCtS2WD0Goiz43xtVKKjBiZ69ROj+ToHyirXNlkhF4xo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558450; c=relaxed/simple; bh=pizTKV9ynX6GILfJMYJeYpCEDVQFQ+vn/3t4N68wIWk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aqWbnEcMwpEpSedLsi9PBzsf0dwUIoNDHYi4rdG5mNOkTMLIbxHJPue3VE3mXNSRg3g4lo6PapYyG/e7BHP+M5fZaICd9vtdIG0SBHU1+GntECCBFtmgCAa2ez7d7w1+H4bAZIePOaJUogOb+UyCtMNBHn75zZT/qBLBtSvlzo0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=C8vKrQTA; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="C8vKrQTA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786558448; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B/EY5HcPxvHeK+xCdsYclzRmUx+RUOMbGT7U9T+HvrQ=; b=C8vKrQTAUxkQiLSg+OONH+Ug3lyTOwSCU1XDSq+UE/asze9uyhGMWoNZJ+2J6PA6es/3zp NE70FpLcQ7iiyqg3ph6bq1FXaNdNiy44D1MDOgJ1Ie/hEXnBUIsM+1IU6QBK7iC3FJAHma 7dwkV9SLY7J2Jfth1wzvwDHaGPtYttY= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-320-UzlbJ97wMXCuYR0ti4JcOA-1; Wed, 12 Aug 2026 14:13:57 -0400 X-MC-Unique: UzlbJ97wMXCuYR0ti4JcOA-1 X-Mimecast-MFC-AGG-ID: UzlbJ97wMXCuYR0ti4JcOA_1786558431 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3952D1954B0D; Wed, 12 Aug 2026 18:13:51 +0000 (UTC) Received: from jtaubepe-thinkpadx1carbongen12.ibmlowe.csb (unknown [10.22.88.181]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 742CC18005BB; Wed, 12 Aug 2026 18:13:46 +0000 (UTC) From: Jesse Taube To: linux-scsi@vger.kernel.org Cc: Jonathan Corbet , Shuah Khan , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Justin Tee , Naresh Gottumukkala , Paul Ely , Chaitanya Kulkarni , "James E.J. Bottomley" , "Martin K. Petersen" , Nilesh Javali , GR-QLogic-Storage-Upstream@marvell.com, Hannes Reinecke , Jesse Taube , "Gustavo A. R. Silva" , John Meneghini , Bryan Gurney , Chris Leech , "Ewan D . Milne" , shinichiro.kawasaki@wdc.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org Subject: [PATCH 07/13] scsi: scsi_transport_fc: Add set_rport_marginal to fc_function_template Date: Wed, 12 Aug 2026 14:12:54 -0400 Message-ID: <20260812181300.3712426-8-jtaubepe@redhat.com> In-Reply-To: <20260812181300.3712426-1-jtaubepe@redhat.com> References: <20260812181300.3712426-1-jtaubepe@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" Add fc_fpin_set_marginal function to evaluate the FPIN LI TLV information and set the 'marginal' path status for all affected nvme rports. Then call set_rport_marginal() callback added to fc_function_template. The implementation of set_rport_marginal() is almost identical to set_rport_dev_loss_tmo implementation. Signed-off-by: Jesse Taube --- V10 -> V11: - New commit - Replaces scsi: scsi_transport_fc: add fc_host_fpin_set_nvme_rport_marginal() --- drivers/scsi/scsi_transport_fc.c | 20 ++++++++++++++++++++ include/scsi/scsi_transport_fc.h | 1 + 2 files changed, 21 insertions(+) diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport= _fc.c index 02c58f4591d8..df1edf3c23fa 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -737,6 +737,25 @@ fc_cn_stats_update(u16 event_type, struct fc_fpin_stat= s *stats) } } =20 +static void fc_fpin_set_marginal(struct Scsi_Host *shost, struct fc_rport = *rport) +{ + struct fc_internal *i =3D to_fc_internal(shost->transportt); + unsigned long flags; + + spin_lock_irqsave(shost->host_lock, flags); + + if (rport->port_state =3D=3D FC_PORTSTATE_ONLINE && + rport->roles & FC_PORT_ROLE_NVME_TARGET) { + rport->port_state =3D FC_PORTSTATE_MARGINAL; + spin_unlock_irqrestore(shost->host_lock, flags); + if (i->f->set_rport_marginal) + i->f->set_rport_marginal(rport, true); + return; + } + + spin_unlock_irqrestore(shost->host_lock, flags); +} + static void fc_fpin_pname_stats_update(struct Scsi_Host *shost, struct fc_rport *attach_rport, u16 event_type, @@ -764,6 +783,7 @@ fc_fpin_pname_stats_update(struct Scsi_Host *shost, if (rport =3D=3D attach_rport) continue; stats_update(event_type, &rport->fpin_stats); + fc_fpin_set_marginal(shost, rport); } } } diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport= _fc.h index 9f30625aa0d3..bc7c3f832399 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h @@ -684,6 +684,7 @@ struct fc_host_attrs { struct fc_function_template { void (*get_rport_dev_loss_tmo)(struct fc_rport *); void (*set_rport_dev_loss_tmo)(struct fc_rport *, u32); + void (*set_rport_marginal)(struct fc_rport *rport, bool marginal); =20 void (*get_starget_node_name)(struct scsi_target *); void (*get_starget_port_name)(struct scsi_target *); --=20 2.54.0 From nobody Tue Sep 29 04:11:54 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FAC7486653 for ; Wed, 12 Aug 2026 18:14:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558454; cv=none; b=ukur+xEKg6oDyi6iHnSpZ82yQlhniZ3YTp1QWXcC0BiQjrgq8Mem44AYYMLI41tdqQPjS3PzdALuW/jWz0KLMcGRsUKJ2sarJDoEss6eaFEf5C6R0TluqMbTuL5sSj0Z9rBp4PljxfjGo1IYZRWlHQX77nA8ZrLrS12BQki01+E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558454; c=relaxed/simple; bh=4CHPSMtLkZkn+ALCdY42GhONGELxuDRtBOKdsP1nyEo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=giL34fNsN27Mug03+Dk+tvPTx7xjInyczUL4OBPXgk1Dolze9HlLFeq2KNHlU62QBQA8bTRCXRTor02E3UuJjD4EMvnIE++1sdWvPjIjoF17+16zcrvx9wkiEAyAzlQW4q4S5XiSgBV34K8dQzfKddvWhaIJRbWytsIPzhP9Iyw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=jTKEshao; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="jTKEshao" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786558452; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=woRBEeCuMp7hyrBJ2Q40BtYs80iQwOB8q8GOznjCNqM=; b=jTKEshao4fjQDk0Pl0Ogux90N8LhpRgnCDmmHtfbpe4Ik+P3Ag5HCLJ5ht649q/jlV0c2b y2ZFIfEqOaCjvksLPzbvaxWqN+Gy9V/ngQTkciZqkQIBeTTdrE2WwBV99FnBU0S2XbN5bu YdevT+34Bmv3A1b7Wr2S2wkPRwOzcNE= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-471-5lW4P-fXMsK4jTInPoZ6QA-1; Wed, 12 Aug 2026 14:14:01 -0400 X-MC-Unique: 5lW4P-fXMsK4jTInPoZ6QA-1 X-Mimecast-MFC-AGG-ID: 5lW4P-fXMsK4jTInPoZ6QA_1786558437 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 380B81800747; Wed, 12 Aug 2026 18:13:57 +0000 (UTC) Received: from jtaubepe-thinkpadx1carbongen12.ibmlowe.csb (unknown [10.22.88.181]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 777AB18005BC; Wed, 12 Aug 2026 18:13:51 +0000 (UTC) From: Jesse Taube To: linux-scsi@vger.kernel.org Cc: Jonathan Corbet , Shuah Khan , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Justin Tee , Naresh Gottumukkala , Paul Ely , Chaitanya Kulkarni , "James E.J. Bottomley" , "Martin K. Petersen" , Nilesh Javali , GR-QLogic-Storage-Upstream@marvell.com, Hannes Reinecke , Jesse Taube , "Gustavo A. R. Silva" , John Meneghini , Bryan Gurney , Chris Leech , "Ewan D . Milne" , shinichiro.kawasaki@wdc.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org Subject: [PATCH 08/13] scsi: scsi_transport_fc: user support for clearing NVME_CTRL_MARGINAL Date: Wed, 12 Aug 2026 14:12:55 -0400 Message-ID: <20260812181300.3712426-9-jtaubepe@redhat.com> In-Reply-To: <20260812181300.3712426-1-jtaubepe@redhat.com> References: <20260812181300.3712426-1-jtaubepe@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" From: John Meneghini Refactor and fc_rport_set_marginal_state smp safe by holding `shost->host_lock` around all `rport->port_state` accesses. Call nvme_fc_modify_rport_fpin_state() when FC_PORTSTATE_MARGINAL is set or cleared. This allows the user to quickly set or clear the NVME_CTRL_MARGINAL state from sysfs. E.g.: echo "Marginal" > /sys/class/fc_remote_ports/rport-13:0-5/port_state echo "Online" > /sys/class/fc_remote_ports/rport-13:0-5/port_state Note: nvme_fc_modify_rport_fpin_state() will only affect rports that have FC_PORT_ROLE_NVME_TARGET set. Signed-off-by: John Meneghini --- V10 -> V11: - No change --- drivers/scsi/scsi_transport_fc.c | 42 +++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport= _fc.c index df1edf3c23fa..af309a7bdc22 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -1251,34 +1251,58 @@ static ssize_t fc_rport_set_marginal_state(struct d= evice *dev, const char *buf, size_t count) { struct fc_rport *rport =3D transport_class_to_rport(dev); + struct Scsi_Host *shost =3D rport_to_shost(rport); + struct fc_internal *i =3D to_fc_internal(shost->transportt); enum fc_port_state port_state; int ret =3D 0; + unsigned long flags; =20 ret =3D get_fc_port_state_match(buf, &port_state); if (ret) return -EINVAL; - if (port_state =3D=3D FC_PORTSTATE_MARGINAL) { + + spin_lock_irqsave(shost->host_lock, flags); + + switch (port_state) { + case FC_PORTSTATE_MARGINAL: /* * Change the state to Marginal only if the * current rport state is Online * Allow only Online->Marginal */ - if (rport->port_state =3D=3D FC_PORTSTATE_ONLINE) + if (rport->port_state =3D=3D FC_PORTSTATE_ONLINE) { rport->port_state =3D port_state; - else if (port_state !=3D rport->port_state) - return -EINVAL; - } else if (port_state =3D=3D FC_PORTSTATE_ONLINE) { + spin_unlock_irqrestore(shost->host_lock, flags); + if (i->f->set_rport_marginal) + i->f->set_rport_marginal(rport, true); + return count; + } + break; + + case FC_PORTSTATE_ONLINE: /* * Change the state to Online only if the * current rport state is Marginal * Allow only Marginal->Online */ - if (rport->port_state =3D=3D FC_PORTSTATE_MARGINAL) + if (rport->port_state =3D=3D FC_PORTSTATE_MARGINAL) { rport->port_state =3D port_state; - else if (port_state !=3D rport->port_state) - return -EINVAL; - } else + spin_unlock_irqrestore(shost->host_lock, flags); + if (i->f->set_rport_marginal) + i->f->set_rport_marginal(rport, false); + return count; + } + break; + default: + break; + } + + if (port_state !=3D rport->port_state) { + spin_unlock_irqrestore(shost->host_lock, flags); return -EINVAL; + } + + spin_unlock_irqrestore(shost->host_lock, flags); return count; } =20 --=20 2.54.0 From nobody Tue Sep 29 04:11:54 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D2F4484227 for ; Wed, 12 Aug 2026 18:14:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558466; cv=none; b=E4FSlpOSl9lvk/+e82SE0dwC+GORN/1/zqc5IEVhRwka04TSHyS3G8qKyuLGdLpobCNgb1iYbPaZXGqYry3upMMWyKvWquztejhEkV1QShS8kxpnYAO5mPSjJbvlfllGnJzF43BSMH+4LGB97CkEdNvIaV0bqQlSBZ/TNKNRIsU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558466; c=relaxed/simple; bh=Mu0dZDZRYBGjV737bYAeXmdbHsjRLEp0W+HVs07CpOc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WyaSdkKn/o1qagMJaBcN5ogUSotCpjW136gQiG8nk67/XK66LMzDxuwhtB7NcuPeoEvoUdHrbJ/bNeyO64mlebSN4uuAoctgjEFJ5Ad+PRU/wPwhxnE2F7hZFhhDzj30Mjwcu50W9QcM/pEoN7YfOC1eCwcM2ymTtlCp+ALYkuM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Sil6I++W; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Sil6I++W" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786558462; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bZZCou7soQ7pIrWDtdlJ11V2SfEEEN4ySA1ofNj1hNQ=; b=Sil6I++W7VcAPvSRCKQVYHTyX/h49bKMzNOlRwZoCJAwbX7biNDqXqTblD/Z05WGkazqfB igE0d/wMqL32UWWwKf7F88pQTGZFKQVFrUQJj+0SY2IdLkOkuWqW6/f/EYG4pOZJ4+6f1E ldU3ndjp4Eh4DTCOluIV7TagtYffyCI= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-571-yAMZESISO2Ks1x7xS93MgQ-1; Wed, 12 Aug 2026 14:14:09 -0400 X-MC-Unique: yAMZESISO2Ks1x7xS93MgQ-1 X-Mimecast-MFC-AGG-ID: yAMZESISO2Ks1x7xS93MgQ_1786558442 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 22DBE195605E; Wed, 12 Aug 2026 18:14:02 +0000 (UTC) Received: from jtaubepe-thinkpadx1carbongen12.ibmlowe.csb (unknown [10.22.88.181]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 724E9180034F; Wed, 12 Aug 2026 18:13:57 +0000 (UTC) From: Jesse Taube To: linux-scsi@vger.kernel.org Cc: Jonathan Corbet , Shuah Khan , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Justin Tee , Naresh Gottumukkala , Paul Ely , Chaitanya Kulkarni , "James E.J. Bottomley" , "Martin K. Petersen" , Nilesh Javali , GR-QLogic-Storage-Upstream@marvell.com, Hannes Reinecke , Jesse Taube , "Gustavo A. R. Silva" , John Meneghini , Bryan Gurney , Chris Leech , "Ewan D . Milne" , shinichiro.kawasaki@wdc.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Hannes Reinecke Subject: [PATCH 09/13] nvme-fc: add nvme_fc_set_remoteport_fpin() Date: Wed, 12 Aug 2026 14:12:56 -0400 Message-ID: <20260812181300.3712426-10-jtaubepe@redhat.com> In-Reply-To: <20260812181300.3712426-1-jtaubepe@redhat.com> References: <20260812181300.3712426-1-jtaubepe@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" Add nvme_fc_set_remoteport_fpin() and supporting functions. This function is called by the SCSI FC transport and driver layer to set or clear the 'marginal' path status for a specific rport. Co-developed-by: Hannes Reinecke Signed-off-by: Hannes Reinecke Signed-off-by: John Meneghini Signed-off-by: Jesse Taube --- V10 -> V11: - Remove nvme_fc_modify_rport_fpin_state - Use struct nvme_fc_remote_port instead of wwpn and wwnn --- drivers/nvme/host/fc.c | 16 ++++++++++++++++ include/linux/nvme-fc-driver.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index d2ca65f70a0c..4acf23ea8aea 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -895,6 +895,22 @@ nvme_fc_set_remoteport_devloss(struct nvme_fc_remote_p= ort *portptr, } EXPORT_SYMBOL_GPL(nvme_fc_set_remoteport_devloss); =20 +void +nvme_fc_set_remoteport_fpin(struct nvme_fc_remote_port *portptr, bool marg= inal) +{ + struct nvme_fc_rport *rport =3D remoteport_to_rport(portptr); + struct nvme_fc_ctrl *ctrl; + + spin_lock_irq(&rport->lock); + list_for_each_entry(ctrl, &rport->ctrl_list, ctrl_list) { + if (marginal) + set_bit(NVME_CTRL_MARGINAL, &ctrl->ctrl.flags); + else + clear_bit(NVME_CTRL_MARGINAL, &ctrl->ctrl.flags); + } + spin_unlock_irq(&rport->lock); +} +EXPORT_SYMBOL_GPL(nvme_fc_set_remoteport_fpin); =20 /* *********************** FC-NVME DMA Handling **************************= ** */ =20 diff --git a/include/linux/nvme-fc-driver.h b/include/linux/nvme-fc-driver.h index 9f6acadfe0c8..95d79386d126 100644 --- a/include/linux/nvme-fc-driver.h +++ b/include/linux/nvme-fc-driver.h @@ -536,6 +536,8 @@ void nvme_fc_rescan_remoteport(struct nvme_fc_remote_po= rt *remoteport); int nvme_fc_set_remoteport_devloss(struct nvme_fc_remote_port *remoteport, u32 dev_loss_tmo); =20 +void nvme_fc_set_remoteport_fpin(struct nvme_fc_remote_port *portptr, bool= marginal); + /* * Routine called to pass a NVME-FC LS request, received by the lldd, * to the nvme-fc transport. --=20 2.54.0 From nobody Tue Sep 29 04:11:54 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94F6C483BEC for ; Wed, 12 Aug 2026 18:14:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558467; cv=none; b=DJ91TzPC0cvEgC6dNnk/v6DvR5hwBTGEQWBCLGHAr4FzQMilT33WNy+54fsVqLTj8qpN1HOC+XkF0CEOuFW5rE0uR4tv0P6WSC0FK43vI4CTvgbJX0ZL6wsTXFe6Ibl9z4s1WXIMUaXpsf9OtngAlTsRUe+X6M0LldsIJbBwyDY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558467; c=relaxed/simple; bh=Ej/ju0eoxUDvqOyYIbXYarc0aQqfSSydX8Z1cVSU0oM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JH1fnyA3Xk7qaCvyJScXREO7uPwmBUAUyT+FekUfYguf4oifU5y4m9rLEl7KFspl7JBX0vyByQlo1sgbUpEtzretiDrkTskODzNe+CP2wF3qREl2YhUCxsVrl2IMfIwFJZ6foCAkC8B1KX9Fwju8dVbq7bJ5DRzraf4sdnfFxHc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=DIIUDtqm; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="DIIUDtqm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786558464; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o8Vm2d0HmZn6yHF6SDZo37n0cyZKJwfRhArj8eZSh5c=; b=DIIUDtqm2zp6e1JibliMkJ/ioFu/dj+xZZuQc+YKP26rpnUAChmAN3a+RnXX5WvBAlU6i0 YKtbbxdbawrscx1it5zUyHe2ZtI1X2yq2+BT+9NfzAe92oL/kTWHBQ2br1iabvBhZolwho 0TZlZHBDH6BpB8oICyakodW4+P1zDkg= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-642--1tVOwXyPkSB9oZ3Oq5F1g-1; Wed, 12 Aug 2026 14:14:19 -0400 X-MC-Unique: -1tVOwXyPkSB9oZ3Oq5F1g-1 X-Mimecast-MFC-AGG-ID: -1tVOwXyPkSB9oZ3Oq5F1g_1786558448 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BE4961954B01; Wed, 12 Aug 2026 18:14:07 +0000 (UTC) Received: from jtaubepe-thinkpadx1carbongen12.ibmlowe.csb (unknown [10.22.88.181]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 69AFA18005BB; Wed, 12 Aug 2026 18:14:02 +0000 (UTC) From: Jesse Taube To: linux-scsi@vger.kernel.org Cc: Jonathan Corbet , Shuah Khan , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Justin Tee , Naresh Gottumukkala , Paul Ely , Chaitanya Kulkarni , "James E.J. Bottomley" , "Martin K. Petersen" , Nilesh Javali , GR-QLogic-Storage-Upstream@marvell.com, Hannes Reinecke , Jesse Taube , "Gustavo A. R. Silva" , John Meneghini , Bryan Gurney , Chris Leech , "Ewan D . Milne" , shinichiro.kawasaki@wdc.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org Subject: [PATCH 10/13] scsi: qla2xxx: enable FPIN notification for NVMe Date: Wed, 12 Aug 2026 14:12:57 -0400 Message-ID: <20260812181300.3712426-11-jtaubepe@redhat.com> In-Reply-To: <20260812181300.3712426-1-jtaubepe@redhat.com> References: <20260812181300.3712426-1-jtaubepe@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" Implement set_rport_marginal callback using nvme_fc_set_remoteport_fpin() to enable FPIN notifications for NVMe. Signed-off-by: Jesse Taube --- V10 -> V11: - Rewrite --- drivers/scsi/qla2xxx/qla_attr.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_att= r.c index a4ca22024ede..92db7d584eeb 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -2789,6 +2789,15 @@ qla2x00_set_rport_loss_tmo(struct fc_rport *rport, u= int32_t timeout) rport->dev_loss_tmo); } =20 +static inline void +qla2x00_set_rport_marginal(struct fc_rport *rport, bool marginal) +{ + fc_port_t *fcport =3D *(fc_port_t **)rport->dd_data; + + if (IS_ENABLED(CONFIG_NVME_FC) && fcport && fcport->nvme_remote_port) + nvme_fc_set_remoteport_fpin(fcport->nvme_remote_port, marginal); +} + static void qla2x00_dev_loss_tmo_callbk(struct fc_rport *rport) { @@ -3379,6 +3388,8 @@ struct fc_function_template qla2xxx_transport_functio= ns =3D { .set_rport_dev_loss_tmo =3D qla2x00_set_rport_loss_tmo, .show_rport_dev_loss_tmo =3D 1, =20 + .set_rport_marginal =3D qla2x00_set_rport_marginal, + .issue_fc_host_lip =3D qla2x00_issue_lip, .dev_loss_tmo_callbk =3D qla2x00_dev_loss_tmo_callbk, .terminate_rport_io =3D qla2x00_terminate_rport_io, @@ -3427,6 +3438,8 @@ struct fc_function_template qla2xxx_transport_vport_f= unctions =3D { .set_rport_dev_loss_tmo =3D qla2x00_set_rport_loss_tmo, .show_rport_dev_loss_tmo =3D 1, =20 + .set_rport_marginal =3D qla2x00_set_rport_marginal, + .issue_fc_host_lip =3D qla2x00_issue_lip, .dev_loss_tmo_callbk =3D qla2x00_dev_loss_tmo_callbk, .terminate_rport_io =3D qla2x00_terminate_rport_io, --=20 2.54.0 From nobody Tue Sep 29 04:11:54 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F4D0483821 for ; Wed, 12 Aug 2026 18:14:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558471; cv=none; b=rea7toISLgrbMY0T6uOrAShx0UmAjcC8shAPSUJthLIcd/Ip2AzREgyP3kFuKve33Eacg1t9lsKgpmaTjzupQCF6ExTxOl0FgyNCmTOUvzEGvoMYn4Z5CNo0FIMTvL2RSvESLBIcX1ZQ+8hTb4vdx68h69C/wx9N17vMeKIWd/Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558471; c=relaxed/simple; bh=EL7ZsU4nhSz7U7K66ArlbistoNCGHNGrlvoJ8RVm2I8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t/U+Ae+NU8TRezFFn47G1VhMECklGblAL4jrtpPwv27sWLuw5SsZX1VRvVvxqryzQdgc/pDg37nO4NhuW/avQLzX6pv0DbsXjnUlhn78x9pFFebV+41bhVBmtDOZ1mn6nmKjCbczCVccQ8PolHGD6rNBljyhbS4Zsuf8TIVY3NA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=HqtQDAgh; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HqtQDAgh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786558469; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H0zxaeAVSjXTNhTujVd3ws3OMZKb9NKMAq0h549TWrQ=; b=HqtQDAgh0SX1++mJl8QkIYQSFMgFq1oEwwR3NTOclc5L27AcA0J9/sY61cxQZthtAXk9RY +qft0QDFBjIB1MMIxFV3hmhhn0T+X0DLASzfX8IxwFgP7YtQfByv7vLTzWRUqVfE8PWdho ysjtAIp99WnLxH3esMCpCFobyCt0L3Y= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-261-5ZS0RTWTP72E3Tbr9Bx9aA-1; Wed, 12 Aug 2026 14:14:17 -0400 X-MC-Unique: 5ZS0RTWTP72E3Tbr9Bx9aA-1 X-Mimecast-MFC-AGG-ID: 5ZS0RTWTP72E3Tbr9Bx9aA_1786558453 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5E13F18002F8; Wed, 12 Aug 2026 18:14:13 +0000 (UTC) Received: from jtaubepe-thinkpadx1carbongen12.ibmlowe.csb (unknown [10.22.88.181]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 17B07180034C; Wed, 12 Aug 2026 18:14:07 +0000 (UTC) From: Jesse Taube To: linux-scsi@vger.kernel.org Cc: Jonathan Corbet , Shuah Khan , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Justin Tee , Naresh Gottumukkala , Paul Ely , Chaitanya Kulkarni , "James E.J. Bottomley" , "Martin K. Petersen" , Nilesh Javali , GR-QLogic-Storage-Upstream@marvell.com, Hannes Reinecke , Jesse Taube , "Gustavo A. R. Silva" , John Meneghini , Bryan Gurney , Chris Leech , "Ewan D . Milne" , shinichiro.kawasaki@wdc.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org Subject: [PATCH 11/13] scsi: lpfc: enable FPIN notification for NVMe Date: Wed, 12 Aug 2026 14:12:58 -0400 Message-ID: <20260812181300.3712426-12-jtaubepe@redhat.com> In-Reply-To: <20260812181300.3712426-1-jtaubepe@redhat.com> References: <20260812181300.3712426-1-jtaubepe@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" Implement set_rport_marginal callback using nvme_fc_set_remoteport_fpin() to enable FPIN notifications for NVMe. Signed-off-by: Jesse Taube --- V10 -> V11 - Rewrite --- drivers/scsi/lpfc/lpfc_attr.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index f4e8164b94ab..d54899cceed9 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -7134,6 +7134,30 @@ lpfc_set_rport_loss_tmo(struct fc_rport *rport, uint= 32_t timeout) #endif } =20 +static void +lpfc_set_rport_marginal(struct fc_rport *rport, bool marginal) +{ + struct lpfc_rport_data *rdata =3D rport->dd_data; + struct lpfc_nodelist *ndlp =3D rdata->pnode; + struct lpfc_nvme_rport *nrport =3D NULL; + + /* Break early if NVME_FC is not enabled */ + if (!IS_ENABLED(CONFIG_NVME_FC)) + return; + + if (!ndlp) { + dev_info(&rport->dev, "Cannot find remote node to "); + dev_info(&rport->dev, "set rport marginal, port_id x%x\n", + rport->port_id); + return; + } + + nrport =3D lpfc_ndlp_get_nrport(ndlp); + + if (nrport && nrport->remoteport) + nvme_fc_set_remoteport_fpin(nrport->remoteport, marginal); +} + /* * lpfc_rport_show_function - Return rport target information * @@ -7244,6 +7268,8 @@ struct fc_function_template lpfc_transport_functions = =3D { .set_rport_dev_loss_tmo =3D lpfc_set_rport_loss_tmo, .show_rport_dev_loss_tmo =3D 1, =20 + .set_rport_marginal =3D lpfc_set_rport_marginal, + .get_starget_port_id =3D lpfc_get_starget_port_id, .show_starget_port_id =3D 1, =20 @@ -7315,6 +7341,8 @@ struct fc_function_template lpfc_vport_transport_func= tions =3D { .set_rport_dev_loss_tmo =3D lpfc_set_rport_loss_tmo, .show_rport_dev_loss_tmo =3D 1, =20 + .set_rport_marginal =3D lpfc_set_rport_marginal, + .get_starget_port_id =3D lpfc_get_starget_port_id, .show_starget_port_id =3D 1, =20 --=20 2.54.0 From nobody Tue Sep 29 04:11:55 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4794E484238 for ; Wed, 12 Aug 2026 18:14:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558472; cv=none; b=pQT7/cVsz4T/SQsXdL5UZWYVvfDVWfaybEwkRi3GpWG2s/6/Qitey1kLZ+OA1PdlowPXp6NAVrf2qPUhbC90qaE7rdKmb0BsqIY6IROoXYy8knWuZZtPwW2QEL2G+HQzkJ2SvHQONrT73eltTxZpOSIdvgf/TDoNG0asQB4cCPE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558472; c=relaxed/simple; bh=g/n81m1hxwLglA1Zb50RdMsZl5VumQ+4z2KU1p5JlPM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NYU1BTSdMtIej6iddpL4qw3UZAHZ5+dxLJpGTXnmBZVxhzVsf4RQk8UydI8LJlFaVHk1NtBHYy4O/2rGJiffDGqIfTdmpIjwavCN5TQPeBPK28gPf9dKSfXOFmEf3Qol0bQKzgr9HckbxUmbsQYuPJKhV++qpF8Uf8JPN8ReoU0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Pdd46bdQ; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Pdd46bdQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786558470; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aPHquUGfzUwFwScaIXHkudmQmMhh2Jzly+/vDfBsyjU=; b=Pdd46bdQk8OMBj1D6hQ64tYTfz8/iUfpOysyBYPgOUU0zkXUEiPb0hPFwNbOCPC7W7vPRG WgyD/VMsMW+TtbHb03nfrmldCf/Ue0WmM69olj/exbdfI2D3d+IYngSxgsvhVfNT0wn3iZ jkoLmyvoomj8XIu6UdmjjxxaykbnprQ= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-75-08LnkDKONdql_U4AP8UScw-1; Wed, 12 Aug 2026 14:14:24 -0400 X-MC-Unique: 08LnkDKONdql_U4AP8UScw-1 X-Mimecast-MFC-AGG-ID: 08LnkDKONdql_U4AP8UScw_1786558458 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5613619560AD; Wed, 12 Aug 2026 18:14:18 +0000 (UTC) Received: from jtaubepe-thinkpadx1carbongen12.ibmlowe.csb (unknown [10.22.88.181]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 98C0C18005BB; Wed, 12 Aug 2026 18:14:13 +0000 (UTC) From: Jesse Taube To: linux-scsi@vger.kernel.org Cc: Jonathan Corbet , Shuah Khan , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Justin Tee , Naresh Gottumukkala , Paul Ely , Chaitanya Kulkarni , "James E.J. Bottomley" , "Martin K. Petersen" , Nilesh Javali , GR-QLogic-Storage-Upstream@marvell.com, Hannes Reinecke , Jesse Taube , "Gustavo A. R. Silva" , John Meneghini , Bryan Gurney , Chris Leech , "Ewan D . Milne" , shinichiro.kawasaki@wdc.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org Subject: [PATCH 12/13] nvme: fcloop: Add set_rport_marginal to sysfs Date: Wed, 12 Aug 2026 14:12:59 -0400 Message-ID: <20260812181300.3712426-13-jtaubepe@redhat.com> In-Reply-To: <20260812181300.3712426-1-jtaubepe@redhat.com> References: <20260812181300.3712426-1-jtaubepe@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" To allow testing of multipath failover, add a sysfs attribute to set a remote port as marginal. This will allow the fcloop LLDD to set the marginal flag on a remote port, simulating a marginal link. Example: Turn on marginal for a remote port matching wwnn and wwpn: `echo 'wwnn=3D0x200000109b5f2956,wwpn=3D0x100000109b5f2956,marginal=3D1' > /sys/class/fcloop/ctl/set_rport_marginal` Turn off marginal for a remote port matching wwnn and wwpn: `echo 'wwnn=3D0x200000109b5f2956,wwpn=3D0x100000109b5f2956,marginal=3D0' > /sys/class/fcloop/ctl/set_rport_marginal` Suggested-by: John Meneghini Signed-off-by: Jesse Taube V10 -> V11 - New patch --- drivers/nvme/target/fcloop.c | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/drivers/nvme/target/fcloop.c b/drivers/nvme/target/fcloop.c index b63af3b643a6..51a50743128d 100644 --- a/drivers/nvme/target/fcloop.c +++ b/drivers/nvme/target/fcloop.c @@ -6,6 +6,7 @@ #include #include #include +#include =20 #include "../host/nvme.h" #include "../target/nvmet.h" @@ -21,6 +22,7 @@ enum { NVMF_OPT_FCADDR =3D 1 << 3, NVMF_OPT_LPWWNN =3D 1 << 4, NVMF_OPT_LPWWPN =3D 1 << 5, + NVMF_OPT_MARGINAL =3D 1 << 6, }; =20 struct fcloop_ctrl_options { @@ -31,6 +33,7 @@ struct fcloop_ctrl_options { u32 fcaddr; u64 lpwwnn; u64 lpwwpn; + u32 marginal; }; =20 static const match_table_t opt_tokens =3D { @@ -40,6 +43,7 @@ static const match_table_t opt_tokens =3D { { NVMF_OPT_FCADDR, "fcaddr=3D%x" }, { NVMF_OPT_LPWWNN, "lpwwnn=3D%s" }, { NVMF_OPT_LPWWPN, "lpwwpn=3D%s" }, + { NVMF_OPT_MARGINAL, "marginal=3D%d" }, { NVMF_OPT_ERR, NULL } }; =20 @@ -120,6 +124,13 @@ fcloop_parse_options(struct fcloop_ctrl_options *opts, } opts->lpwwpn =3D token64; break; + case NVMF_OPT_MARGINAL: + if (match_int(args, &token)) { + ret =3D -EINVAL; + goto out_free_options; + } + opts->marginal =3D token; + break; default: pr_warn("unknown parameter or missing value '%s'\n", p); ret =3D -EINVAL; @@ -199,6 +210,9 @@ fcloop_parse_nm_options(struct device *dev, u64 *nname,= u64 *pname, =20 #define TGTPORT_OPTS (NVMF_OPT_WWNN | NVMF_OPT_WWPN) =20 +#define MARGINAL_OPTS (NVMF_OPT_WWNN | NVMF_OPT_WWPN | \ + NVMF_OPT_MARGINAL) + =20 static DEFINE_SPINLOCK(fcloop_lock); static LIST_HEAD(fcloop_lports); @@ -1663,6 +1677,31 @@ fcloop_set_cmd_drop(struct device *dev, struct devic= e_attribute *attr, return count; } =20 +static ssize_t +fcloop_set_marginal_rport(struct device *dev, struct device_attribute *att= r, + const char *buf, size_t count) +{ + struct fcloop_nport *nport; + struct fcloop_ctrl_options opts; + int ret; + + ret =3D fcloop_parse_options(&opts, buf); + if (ret) + return ret; + + /* everything there ? */ + if ((opts.mask & MARGINAL_OPTS) !=3D MARGINAL_OPTS) + return -EINVAL; + + nport =3D fcloop_nport_lookup(opts.wwnn, opts.wwpn); + if (!nport || !nport->tport || !nport->tport->remoteport) + return -ENOENT; + + nvme_fc_set_remoteport_fpin(nport->tport->remoteport, opts.marginal); + fcloop_nport_put(nport); + + return count; +} =20 static DEVICE_ATTR(add_local_port, 0200, NULL, fcloop_create_local_port); static DEVICE_ATTR(del_local_port, 0200, NULL, fcloop_delete_local_port); @@ -1671,6 +1710,7 @@ static DEVICE_ATTR(del_remote_port, 0200, NULL, fcloo= p_delete_remote_port); static DEVICE_ATTR(add_target_port, 0200, NULL, fcloop_create_target_port); static DEVICE_ATTR(del_target_port, 0200, NULL, fcloop_delete_target_port); static DEVICE_ATTR(set_cmd_drop, 0200, NULL, fcloop_set_cmd_drop); +static DEVICE_ATTR(set_marginal_rport, 0200, NULL, fcloop_set_marginal_rpo= rt); =20 static struct attribute *fcloop_dev_attrs[] =3D { &dev_attr_add_local_port.attr, @@ -1680,6 +1720,7 @@ static struct attribute *fcloop_dev_attrs[] =3D { &dev_attr_add_target_port.attr, &dev_attr_del_target_port.attr, &dev_attr_set_cmd_drop.attr, + &dev_attr_set_marginal_rport.attr, NULL }; =20 --=20 2.54.0 From nobody Tue Sep 29 04:11:55 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF03648A8BE for ; Wed, 12 Aug 2026 18:14:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558476; cv=none; b=txMoomwnFH0DpGyNQNe8+fr3hJnbULSbB/JlqOwgIy98Se+MJCm6kVjHcDFjD/GLCtA/IvtETrxZHF/HnNYBjYr2QgN+Yij8RYM1JtMNoVCvq9qYTiR6Z022PQdW3QPxPduLUvnmXe7pECGuz09hIVuvF0VjBFWqZ3bbgfrw/uc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786558476; c=relaxed/simple; bh=4n1tlQkjXyTWNqMtep5UugGOyl8D8s0TXsvJkpbQSzQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pT0fCaktv5/VzUyy+YWqQUrqP0kLrihXUiBxylErO9lAm+q/UUazjWA8SEs/Lsy+UHJ04imUPPTI6eRUuppbRvQq9pGbb8v62ym45Y0/fd3mNOHAwMhn0ZAftHCBfBZty3el0ccRCXxGmTykwCYegvqe/Ot9t4BulMXNC6f2f4M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=f61+FkFH; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="f61+FkFH" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786558473; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v/PkTYmB9Xqmq9DAbPY6/2gP1sruDO+EphGFwKZ0TkE=; b=f61+FkFHKQt6xmxhjE3roSI0xzI3yJDFKroxQXYS0h1GXIK3wEb0NmlJlnBeFmaXD+M385 iOWbNvZLJYPR+3xR7Nb+A/PFcZQG1UaZNjGhVTar78LT++Py56USDBcneO8FZTe2XDrEzH W1fQemaDl/W1WeYrqrEjG4/NyF86BfY= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-440-wKVI966jP82PysGX33rujA-1; Wed, 12 Aug 2026 14:14:29 -0400 X-MC-Unique: wKVI966jP82PysGX33rujA-1 X-Mimecast-MFC-AGG-ID: wKVI966jP82PysGX33rujA_1786558463 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F1000195605E; Wed, 12 Aug 2026 18:14:22 +0000 (UTC) Received: from jtaubepe-thinkpadx1carbongen12.ibmlowe.csb (unknown [10.22.88.181]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 75607180034F; Wed, 12 Aug 2026 18:14:18 +0000 (UTC) From: Jesse Taube To: linux-scsi@vger.kernel.org Cc: Jonathan Corbet , Shuah Khan , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Justin Tee , Naresh Gottumukkala , Paul Ely , Chaitanya Kulkarni , "James E.J. Bottomley" , "Martin K. Petersen" , Nilesh Javali , GR-QLogic-Storage-Upstream@marvell.com, Hannes Reinecke , Jesse Taube , "Gustavo A. R. Silva" , John Meneghini , Bryan Gurney , Chris Leech , "Ewan D . Milne" , shinichiro.kawasaki@wdc.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org Subject: [PATCH 13/13] docs: nvme-multipath: Add FC-NVMe marginal state Date: Wed, 12 Aug 2026 14:13:00 -0400 Message-ID: <20260812181300.3712426-14-jtaubepe@redhat.com> In-Reply-To: <20260812181300.3712426-1-jtaubepe@redhat.com> References: <20260812181300.3712426-1-jtaubepe@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" Adds documentation for the new marginal state for NVMe over Fibre Channel. Documents how to check and reset the state, as well as a description of how it affects multipath policies. Signed-off-by: Jesse Taube --- Documentation/admin-guide/nvme-multipath.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Documentation/admin-guide/nvme-multipath.rst b/Documentation/a= dmin-guide/nvme-multipath.rst index 97ca1ccef459..8df4235d4d10 100644 --- a/Documentation/admin-guide/nvme-multipath.rst +++ b/Documentation/admin-guide/nvme-multipath.rst @@ -31,6 +31,23 @@ To set the desired policy (e.g., round-robin), use one o= f the following methods: 1. echo -n "round-robin" > /sys/module/nvme_core/parameters/iopolicy 2. or add the "nvme_core.iopolicy=3Dround-robin" to cmdline. =20 +FC-NVMe +---- +On NVMe over Fibre Channel there is an additional state called `marginal` +All policies will treat this path as offline and will not use it unless +all other paths are marginal or unavailable. In that case, the policy will +select the best path based on the policy. + +To see the current path state, use one of the following methods: + 1. cat /sys/class/fc_host/host*/device/rport-*/fc_remote_ports/rport-*/= port_state + 2. cat /sys/devices/virtual/nvme-subsystem/nvme-subsys*/nvme*/state +To reset a path to online use: + 1. echo "Online" > /sys/class/fc_host/host*/device/rport-*/fc_remote_po= rts/rport-*/port_state + +The marginal state is caused by a +FPIN-LI (Fabric Performance Impact Notification - Link Impact) event. +FPIN-LI event counters can be seen with: + 1. cat /sys/class/fc_host/host*/statistics/fpin_li* =20 NUMA ---- --=20 2.54.0