OSDN Git Service

scsi: scsi_transport_fc: Add FPIN fc event codes
authorJames Smart <jsmart2021@gmail.com>
Fri, 5 Apr 2019 23:04:22 +0000 (16:04 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 9 Apr 2019 01:29:16 +0000 (21:29 -0400)
Add a new event type - an FPIN event.

Add a new routine, fc_host_fpin_rcv(), that lldd's call when an FPIN is
received. The routine processes the fpin payload.  For now, the routine
only logs an FPIN event.

Signed-off-by: Muneendra <muneendra.kumar@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_transport_fc.c
include/scsi/scsi_transport_fc.h

index 9bea4df..14e5100 100644 (file)
@@ -147,6 +147,7 @@ static const struct {
        { FCH_EVT_PORT_OFFLINE,         "port_offline" },
        { FCH_EVT_PORT_FABRIC,          "port_fabric" },
        { FCH_EVT_LINK_UNKNOWN,         "link_unknown" },
+       { FCH_EVT_LINK_FPIN,            "link_FPIN" },
        { FCH_EVT_VENDOR_UNIQUE,        "vendor_unique" },
 };
 fc_enum_name_search(host_event_code, fc_host_event_code,
@@ -640,6 +641,23 @@ fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,
 }
 EXPORT_SYMBOL(fc_host_post_vendor_event);
 
+/**
+ * fc_host_rcv_fpin - routine to process a received FPIN.
+ * @shost:             host the FPIN was received on
+ * @fpin_len:          length of FPIN payload, in bytes
+ * @fpin_buf:          pointer to FPIN payload
+ *
+ * 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_post_fc_event(shost, fc_get_event_number(),
+                               FCH_EVT_LINK_FPIN, fpin_len, fpin_buf, 0);
+}
+EXPORT_SYMBOL(fc_host_fpin_rcv);
+
 
 static __init int fc_transport_init(void)
 {
index 7998b32..3bd5925 100644 (file)
@@ -473,6 +473,7 @@ enum fc_host_event_code  {
        FCH_EVT_PORT_ONLINE             = 0x202,
        FCH_EVT_PORT_FABRIC             = 0x204,
        FCH_EVT_LINK_UNKNOWN            = 0x500,
+       FCH_EVT_LINK_FPIN               = 0x501,
        FCH_EVT_VENDOR_UNIQUE           = 0xffff,
 };
 
@@ -808,6 +809,7 @@ 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);
 struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel,
                struct fc_vport_identifiers *);
 int fc_vport_terminate(struct fc_vport *vport);