Skip to contentSkip to conversation

scsi:scsi_transport_fc:Add an additional flag to fc_host_fpin_rcv()

PATCH Applied Muneendra Kumar 5 participants 5 messages Feb 9, 2023 – Feb 21, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi:scsi_transport_fc:Add an additional flag to fc_host_fpin_rcv()

From: Muneendra <[email protected]>

The LLDD and the stack currently process FPINs received from the fabric, but the stack is not aware of any action taken by the driver to alleviate congestion. The current interface between the driver and the SCSI stack is limited to passing the notification mainly for statistics and heuristics.

The reaction to an FPIN could be handled either by the driver or by the stack (marginal path and failover). This patch enhances the interface to indicate if action on an FPIN has already been reacted to by the LLDDs or not.Add an additional flag to fc_host_fpin_rcv() to indicate if the FPIN has been acknowledged/reacted to by the driver.

Also added a new event code FCH_EVT_LINK_FPIN_ACK to notify to the user that the event has been acknowledged/reacted by the LLDD driver

---
 drivers/scsi/lpfc/lpfc_els.c     |  2 +-
 drivers/scsi/qla2xxx/qla_isr.c   |  2 +-
 drivers/scsi/scsi_transport_fc.c | 10 +++++++---
 include/scsi/scsi_transport_fc.h |  4 +++-
 4 files changed, 12 insertions(+), 6 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +1 -1
index 569639dc8b2c..aee5d0d1187d 100644
@@ -10287,7 +10287,7 @@ lpfc_els_rcv_fpin(struct lpfc_vport *vport, void *p, u32 fpin_length)
 		/* Send every descriptor individually to the upper layer */
 		if (deliver)
 			fc_host_fpin_rcv(lpfc_shost_from_vport(vport),
-					 fpin_length, (char *)fpin);
+					 fpin_length, (char *)fpin, 0);
 		desc_cnt++;
 	}
 }
drivers/scsi/qla2xxx/qla_isr.c +1 -1
index 46e8b38603f0..030625ebb4e6 100644
@@ -45,7 +45,7 @@ qla27xx_process_purex_fpin(struct scsi_qla_host *vha, struct purex_item *item)
 	ql_dump_buffer(ql_dbg_init + ql_dbg_verbose, vha, 0x508f,
 		       pkt, pkt_size);
 
-	fc_host_fpin_rcv(vha->host, pkt_size, (char *)pkt);
+	fc_host_fpin_rcv(vha->host, pkt_size, (char *)pkt, 0);
 }
 
 const char *const port_state_str[] = {
drivers/scsi/scsi_transport_fc.c +7 -3
index 0965f8a7134f..f12e9467ebb4 100644
@@ -137,6 +137,7 @@ static const struct {
 	{ FCH_EVT_PORT_FABRIC,		"port_fabric" },
 	{ FCH_EVT_LINK_UNKNOWN,		"link_unknown" },
 	{ FCH_EVT_LINK_FPIN,		"link_FPIN" },
+	{ FCH_EVT_LINK_FPIN_ACK,	"link_FPIN_ACK" },
 	{ FCH_EVT_VENDOR_UNIQUE,	"vendor_unique" },
 };
 fc_enum_name_search(host_event_code, fc_host_event_code,
@@ -894,17 +895,20 @@ fc_fpin_congn_stats_update(struct Scsi_Host *shost,
  * @shost:		host the FPIN was received on
  * @fpin_len:		length of FPIN payload, in bytes
  * @fpin_buf:		pointer to FPIN payload
- *
+ * @event_acknowledge:	1, if LLDD handles this event.
  * Notes:
  *	This routine assumes no locks are held on entry.
  */
 void
-fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_len, char *fpin_buf)
+fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_len, char *fpin_buf,
+		u8 event_acknowledge)
 {
 	struct fc_els_fpin *fpin = (struct fc_els_fpin *)fpin_buf;
 	struct fc_tlv_desc *tlv;
 	u32 desc_cnt = 0, bytes_remain;
 	u32 dtag;
+	enum fc_host_event_code event_code =
+		event_acknowledge ? FCH_EVT_LINK_FPIN_ACK : FCH_EVT_LINK_FPIN;
 
 	/* Update Statistics */
 	tlv = (struct fc_tlv_desc *)&fpin->fpin_desc[0];
@@ -934,7 +938,7 @@ fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_len, char *fpin_buf)
 	}
 
 	fc_host_post_fc_event(shost, fc_get_event_number(),
-				FCH_EVT_LINK_FPIN, fpin_len, fpin_buf, 0);
+				event_code, fpin_len, fpin_buf, 0);
 }
 EXPORT_SYMBOL(fc_host_fpin_rcv);
 
include/scsi/scsi_transport_fc.h +3 -1
index 3dcda19d3520..483513c57597 100644
@@ -496,6 +496,7 @@ enum fc_host_event_code  {
 	FCH_EVT_PORT_FABRIC		= 0x204,
 	FCH_EVT_LINK_UNKNOWN		= 0x500,
 	FCH_EVT_LINK_FPIN		= 0x501,
+	FCH_EVT_LINK_FPIN_ACK		= 0x502,
 	FCH_EVT_VENDOR_UNIQUE		= 0xffff,
 };
 
@@ -856,7 +857,8 @@ void fc_host_post_fc_event(struct Scsi_Host *shost, u32 event_number,
 	 * Note: when calling fc_host_post_fc_event(), vendor_id may be
 	 *   specified as 0.
 	 */
-void fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_len, char *fpin_buf);
+void fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_len, char *fpin_buf,
+		u8 event_acknowledge);
 struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel,
 		struct fc_vport_identifiers *);
 int fc_vport_terminate(struct fc_vport *vport);
Signature · 1 line
2.26.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Muneendra Kumar

From: Muneendra <[email protected]>

The LLDD and the stack currently process FPINs received from the fabric, but the stack is not aware of any action taken by the driver to alleviate congestion. The current interface between the driver and the SCSI stack is limited to passing the notification mainly for statistics and heuristics.

The reaction to an FPIN could be handled either by the driver or by the stack (marginal path and failover). This patch enhances the interface to indicate if action on an FPIN has already been reacted to by the LLDDs or not.Add an additional flag to fc_host_fpin_rcv() to indicate if the FPIN has been acknowledged/reacted to by the driver.

Also added a new event code FCH_EVT_LINK_FPIN_ACK to notify to the user that the event has been acknowledged/reacted by the LLDD driver

Quoted 7 lines
---
  drivers/scsi/lpfc/lpfc_els.c     |  2 +-
  drivers/scsi/qla2xxx/qla_isr.c   |  2 +-
  drivers/scsi/scsi_transport_fc.c | 10 +++++++---
  include/scsi/scsi_transport_fc.h |  4 +++-
  4 files changed, 12 insertions(+), 6 deletions(-)

Looks good.

Thanks

-- james

Reviewed-by on v1 1/1
#2 lore raw
In reply to Muneendra Kumar
Quoted 125 lines · Muneendra Kumar

From: Muneendra <[email protected]>

The LLDD and the stack currently process FPINs received from the fabric, but the stack is not aware of any action taken by the driver to alleviate congestion. The current interface between the driver and the SCSI stack is limited to passing the notification mainly for statistics and heuristics.

The reaction to an FPIN could be handled either by the driver or by the stack (marginal path and failover). This patch enhances the interface to indicate if action on an FPIN has already been reacted to by the LLDDs or not.Add an additional flag to fc_host_fpin_rcv() to indicate if the FPIN has been acknowledged/reacted to by the driver.

Also added a new event code FCH_EVT_LINK_FPIN_ACK to notify to the user that the event has been acknowledged/reacted by the LLDD driver

---

drivers/scsi/lpfc/lpfc_els.c     |  2 +-
drivers/scsi/qla2xxx/qla_isr.c   |  2 +-
drivers/scsi/scsi_transport_fc.c | 10 +++++++---
include/scsi/scsi_transport_fc.h |  4 +++-
4 files changed, 12 insertions(+), 6 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +1 -1
index 569639dc8b2c..aee5d0d1187d 100644
@@ -10287,7 +10287,7 @@ lpfc_els_rcv_fpin(struct lpfc_vport *vport, void *p, u32 fpin_length)
 /* Send every descriptor individually to the upper layer */
 if (deliver)
 fc_host_fpin_rcv(lpfc_shost_from_vport(vport),
- fpin_length, (char *)fpin);
+ fpin_length, (char *)fpin, 0);
 desc_cnt++;
 }
 }
drivers/scsi/qla2xxx/qla_isr.c +1 -1
index 46e8b38603f0..030625ebb4e6 100644
@@ -45,7 +45,7 @@ qla27xx_process_purex_fpin(struct scsi_qla_host *vha, struct purex_item *item)
 ql_dump_buffer(ql_dbg_init + ql_dbg_verbose, vha, 0x508f,
      pkt, pkt_size);
 
- fc_host_fpin_rcv(vha->host, pkt_size, (char *)pkt);
+ fc_host_fpin_rcv(vha->host, pkt_size, (char *)pkt, 0);
 }
 
 const char *const port_state_str[] = {
drivers/scsi/scsi_transport_fc.c +2 -1
index 0965f8a7134f..f12e9467ebb4 100644
@@ -137,6 +137,7 @@ static const struct {
 { FCH_EVT_PORT_FABRIC, "port_fabric" },
 { FCH_EVT_LINK_UNKNOWN, "link_unknown" },
 { FCH_EVT_LINK_FPIN, "link_FPIN" },
+ { FCH_EVT_LINK_FPIN_ACK, "link_FPIN_ACK" },
 { FCH_EVT_VENDOR_UNIQUE, "vendor_unique" },
 };
 fc_enum_name_search(host_event_code, fc_host_event_code,
@@ -894,17 +895,20 @@ fc_fpin_congn_stats_update(struct Scsi_Host *shost,
 * @shost: host the FPIN was received on
 * @fpin_len: length of FPIN payload, in bytes
 * @fpin_buf: pointer to FPIN payload
- *
+ * @event_acknowledge: 1, if LLDD handles this event.
 * Notes:
 * This routine assumes no locks are held on entry.
 */

void

drivers/scsi/scsi_transport_fc.c +2 -1
-fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_len, char *fpin_buf)
+fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_len, char *fpin_buf,
+ u8 event_acknowledge)

{
struct fc_els_fpin *fpin = (struct fc_els_fpin *)fpin_buf; struct fc_tlv_desc *tlv;
u32 desc_cnt = 0, bytes_remain;
u32 dtag;
+ enum fc_host_event_code event_code =
+ event_acknowledge ? FCH_EVT_LINK_FPIN_ACK : FCH_EVT_LINK_FPIN;

/* Update Statistics */
tlv = (struct fc_tlv_desc *)&fpin->fpin_desc[0];

drivers/scsi/scsi_transport_fc.c +1 -1
@@ -934,7 +938,7 @@ fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_len, char *fpin_buf)
 }
 
 fc_host_post_fc_event(shost, fc_get_event_number(),
- FCH_EVT_LINK_FPIN, fpin_len, fpin_buf, 0);
+ event_code, fpin_len, fpin_buf, 0);
 }
 EXPORT_SYMBOL(fc_host_fpin_rcv);
 
include/scsi/scsi_transport_fc.h +3 -1
index 3dcda19d3520..483513c57597 100644
@@ -496,6 +496,7 @@ enum fc_host_event_code  {
 FCH_EVT_PORT_FABRIC = 0x204,
 FCH_EVT_LINK_UNKNOWN = 0x500,
 FCH_EVT_LINK_FPIN = 0x501,
+ FCH_EVT_LINK_FPIN_ACK = 0x502,
 FCH_EVT_VENDOR_UNIQUE = 0xffff,
 };
 
@@ -856,7 +857,8 @@ void fc_host_post_fc_event(struct Scsi_Host *shost, u32 event_number,
 * Note: when calling fc_host_post_fc_event(), vendor_id may be
 *   specified as 0.
 */
-void fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_len, char *fpin_buf);
+void fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_len, char *fpin_buf,
+ u8 event_acknowledge);
 struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel,
 struct fc_vport_identifiers *);
 int fc_vport_terminate(struct fc_vport *vport);
Signature · 1 line
2.26.2
Reviewed-by Himanshu Madhani <[email protected] <mailto:[email protected]>>
Signature · 1 line
Himanshu Madhani Oracle Linux Engineering
Reviewed-by on v1 1/1
#3 lore raw
In reply to Muneendra Kumar

Looks fine.

Quoted 122 lines · Muneendra Kumar

From: Muneendra <[email protected]>

The LLDD and the stack currently process FPINs received from the fabric, but the stack is not aware of any action taken by the driver to alleviate congestion. The current interface between the driver and the SCSI stack is limited to passing the notification mainly for statistics and heuristics.

The reaction to an FPIN could be handled either by the driver or by the stack (marginal path and failover). This patch enhances the interface to indicate if action on an FPIN has already been reacted to by the LLDDs or not.Add an additional flag to fc_host_fpin_rcv() to indicate if the FPIN has been acknowledged/reacted to by the driver.

Also added a new event code FCH_EVT_LINK_FPIN_ACK to notify to the user that the event has been acknowledged/reacted by the LLDD driver

---
 drivers/scsi/lpfc/lpfc_els.c     |  2 +-
 drivers/scsi/qla2xxx/qla_isr.c   |  2 +-
 drivers/scsi/scsi_transport_fc.c | 10 +++++++---
 include/scsi/scsi_transport_fc.h |  4 +++-
 4 files changed, 12 insertions(+), 6 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +1 -1
index 569639dc8b2c..aee5d0d1187d 100644
@@ -10287,7 +10287,7 @@ lpfc_els_rcv_fpin(struct lpfc_vport *vport, void *p, u32 fpin_length)
                /* Send every descriptor individually to the upper layer */
                if (deliver)
                        fc_host_fpin_rcv(lpfc_shost_from_vport(vport),
-                                        fpin_length, (char *)fpin);
+                                        fpin_length, (char *)fpin, 0);
                desc_cnt++;
        }
 }
drivers/scsi/qla2xxx/qla_isr.c +1 -1
index 46e8b38603f0..030625ebb4e6 100644
@@ -45,7 +45,7 @@ qla27xx_process_purex_fpin(struct scsi_qla_host *vha, struct purex_item *item)
        ql_dump_buffer(ql_dbg_init + ql_dbg_verbose, vha, 0x508f,
                       pkt, pkt_size);
 
-       fc_host_fpin_rcv(vha->host, pkt_size, (char *)pkt);
+       fc_host_fpin_rcv(vha->host, pkt_size, (char *)pkt, 0);
 }
 
 const char *const port_state_str[] = {
drivers/scsi/scsi_transport_fc.c +7 -3
index 0965f8a7134f..f12e9467ebb4 100644
@@ -137,6 +137,7 @@ static const struct {
        { FCH_EVT_PORT_FABRIC,          "port_fabric" },
        { FCH_EVT_LINK_UNKNOWN,         "link_unknown" },
        { FCH_EVT_LINK_FPIN,            "link_FPIN" },
+       { FCH_EVT_LINK_FPIN_ACK,        "link_FPIN_ACK" },
        { FCH_EVT_VENDOR_UNIQUE,        "vendor_unique" },
 };
 fc_enum_name_search(host_event_code, fc_host_event_code,
@@ -894,17 +895,20 @@ fc_fpin_congn_stats_update(struct Scsi_Host *shost,
  * @shost:             host the FPIN was received on
  * @fpin_len:          length of FPIN payload, in bytes
  * @fpin_buf:          pointer to FPIN payload
- *
+ * @event_acknowledge: 1, if LLDD handles this event.
  * Notes:
  *     This routine assumes no locks are held on entry.
  */
 void
-fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_len, char *fpin_buf)
+fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_len, char *fpin_buf,
+               u8 event_acknowledge)
 {
        struct fc_els_fpin *fpin = (struct fc_els_fpin *)fpin_buf;
        struct fc_tlv_desc *tlv;
        u32 desc_cnt = 0, bytes_remain;
        u32 dtag;
+       enum fc_host_event_code event_code =
+               event_acknowledge ? FCH_EVT_LINK_FPIN_ACK : FCH_EVT_LINK_FPIN;
 
        /* Update Statistics */
        tlv = (struct fc_tlv_desc *)&fpin->fpin_desc[0];
@@ -934,7 +938,7 @@ fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_len, char *fpin_buf)
        }
 
        fc_host_post_fc_event(shost, fc_get_event_number(),
-                               FCH_EVT_LINK_FPIN, fpin_len, fpin_buf, 0);
+                               event_code, fpin_len, fpin_buf, 0);
 }
 EXPORT_SYMBOL(fc_host_fpin_rcv);
 
include/scsi/scsi_transport_fc.h +3 -2
index 3dcda19d3520..483513c57597 100644
@@ -496,6 +496,7 @@ enum fc_host_event_code  {
        FCH_EVT_PORT_FABRIC             = 0x204,
        FCH_EVT_LINK_UNKNOWN            = 0x500,
        FCH_EVT_LINK_FPIN               = 0x501,
+       FCH_EVT_LINK_FPIN_ACK           = 0x502,
        FCH_EVT_VENDOR_UNIQUE           = 0xffff,
 };
 
@@ -856,7 +857,8 @@ void fc_host_post_fc_event(struct Scsi_Host *shost, u32 event_number,
         * Note: when calling fc_host_post_fc_event(), vendor_id may be
         *   specified as 0.
         */
-void fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_len, char *fpin_buf);
+void fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_len, char *fpin_buf,
+               u8 event_acknowledge);
 struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel,
                struct fc_vport_identifiers *);
 int fc_vport_terminate(struct fc_vport *vport);
--

2.26.2

#4 lore raw
In reply to Muneendra Kumar

Muneendra,

Quoted 5 lines

The LLDD and the stack currently process FPINs received from the fabric, but the stack is not aware of any action taken by the driver to alleviate congestion. The current interface between the driver and the SCSI stack is limited to passing the notification mainly for statistics and heuristics.

Applied to 6.3/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering