Commit df3fe766 authored by James Smart's avatar James Smart Committed by Martin K. Petersen

scsi: lpfc: add RDF registration and Link Integrity FPIN logging

This patch modifies lpfc to register for Link Integrity events via the use
of an RDF ELS and to perform Link Integrity FPIN logging.

Specifically, the driver was modified to:

 - Format and issue the RDF ELS immediately following SCR registration.
   This registers the ability of the driver to receive FPIN ELS.

 - Adds decoding of the FPIN els into the received descriptors, with
   logging of the Link Integrity event information. After decoding, the ELS
   is delivered to the scsi fc transport to be delivered to any user-space
   applications.

 - To aid in logging, simple helpers were added to create enum to name
   string lookup functions that utilize the initialization helpers from the
   fc_els.h header.

 - Note: base header definitions for the ELS's don't populate the
   descriptor payloads. As such, lpfc creates it's own version of the
   structures, using the base definitions (mostly headers) and additionally
   declaring the descriptors that will complete the population of the ELS.

Link: https://lore.kernel.org/r/20200210173155.547-3-jsmart2021@gmail.comSigned-off-by: default avatarDick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 73ec6d27
...@@ -1353,3 +1353,32 @@ lpfc_sli4_mod_hba_eq_delay(struct lpfc_hba *phba, struct lpfc_queue *eq, ...@@ -1353,3 +1353,32 @@ lpfc_sli4_mod_hba_eq_delay(struct lpfc_hba *phba, struct lpfc_queue *eq,
writel(reg_data.word0, phba->sli4_hba.u.if_type2.EQDregaddr); writel(reg_data.word0, phba->sli4_hba.u.if_type2.EQDregaddr);
eq->q_mode = delay; eq->q_mode = delay;
} }
/*
* Macro that declares tables and a routine to perform enum type to
* ascii string lookup.
*
* Defines a <key,value> table for an enum. Uses xxx_INIT defines for
* the enum to populate the table. Macro defines a routine (named
* by caller) that will search all elements of the table for the key
* and return the name string if found or "Unrecognized" if not found.
*/
#define DECLARE_ENUM2STR_LOOKUP(routine, enum_name, enum_init) \
static struct { \
enum enum_name value; \
char *name; \
} fc_##enum_name##_e2str_names[] = enum_init; \
static const char *routine(enum enum_name table_key) \
{ \
int i; \
char *name = "Unrecognized"; \
\
for (i = 0; i < ARRAY_SIZE(fc_##enum_name##_e2str_names); i++) {\
if (fc_##enum_name##_e2str_names[i].value == table_key) {\
name = fc_##enum_name##_e2str_names[i].name; \
break; \
} \
} \
return name; \
}
...@@ -140,9 +140,10 @@ int lpfc_issue_els_prli(struct lpfc_vport *, struct lpfc_nodelist *, uint8_t); ...@@ -140,9 +140,10 @@ int lpfc_issue_els_prli(struct lpfc_vport *, struct lpfc_nodelist *, uint8_t);
int lpfc_issue_els_adisc(struct lpfc_vport *, struct lpfc_nodelist *, uint8_t); int lpfc_issue_els_adisc(struct lpfc_vport *, struct lpfc_nodelist *, uint8_t);
int lpfc_issue_els_logo(struct lpfc_vport *, struct lpfc_nodelist *, uint8_t); int lpfc_issue_els_logo(struct lpfc_vport *, struct lpfc_nodelist *, uint8_t);
int lpfc_issue_els_npiv_logo(struct lpfc_vport *, struct lpfc_nodelist *); int lpfc_issue_els_npiv_logo(struct lpfc_vport *, struct lpfc_nodelist *);
int lpfc_issue_els_scr(struct lpfc_vport *, uint32_t, uint8_t); int lpfc_issue_els_scr(struct lpfc_vport *vport, uint8_t retry);
int lpfc_issue_els_rscn(struct lpfc_vport *vport, uint8_t retry); int lpfc_issue_els_rscn(struct lpfc_vport *vport, uint8_t retry);
int lpfc_issue_fabric_reglogin(struct lpfc_vport *); int lpfc_issue_fabric_reglogin(struct lpfc_vport *);
int lpfc_issue_els_rdf(struct lpfc_vport *vport, uint8_t retry);
int lpfc_els_free_iocb(struct lpfc_hba *, struct lpfc_iocbq *); int lpfc_els_free_iocb(struct lpfc_hba *, struct lpfc_iocbq *);
int lpfc_ct_free_iocb(struct lpfc_hba *, struct lpfc_iocbq *); int lpfc_ct_free_iocb(struct lpfc_hba *, struct lpfc_iocbq *);
int lpfc_els_rsp_acc(struct lpfc_vport *, uint32_t, struct lpfc_iocbq *, int lpfc_els_rsp_acc(struct lpfc_vport *, uint32_t, struct lpfc_iocbq *,
......
This diff is collapsed.
...@@ -4089,7 +4089,9 @@ lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) ...@@ -4089,7 +4089,9 @@ lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
FC_TYPE_NVME); FC_TYPE_NVME);
/* Issue SCR just before NameServer GID_FT Query */ /* Issue SCR just before NameServer GID_FT Query */
lpfc_issue_els_scr(vport, SCR_DID, 0); lpfc_issue_els_scr(vport, 0);
lpfc_issue_els_rdf(vport, 0);
} }
vport->fc_ns_retry = 0; vport->fc_ns_retry = 0;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#define FDMI_DID 0xfffffaU #define FDMI_DID 0xfffffaU
#define NameServer_DID 0xfffffcU #define NameServer_DID 0xfffffcU
#define SCR_DID 0xfffffdU #define Fabric_Cntl_DID 0xfffffdU
#define Fabric_DID 0xfffffeU #define Fabric_DID 0xfffffeU
#define Bcast_DID 0xffffffU #define Bcast_DID 0xffffffU
#define Mask_DID 0xffffffU #define Mask_DID 0xffffffU
...@@ -588,6 +588,7 @@ struct fc_vft_header { ...@@ -588,6 +588,7 @@ struct fc_vft_header {
#define ELS_CMD_RRQ 0x12000000 #define ELS_CMD_RRQ 0x12000000
#define ELS_CMD_REC 0x13000000 #define ELS_CMD_REC 0x13000000
#define ELS_CMD_RDP 0x18000000 #define ELS_CMD_RDP 0x18000000
#define ELS_CMD_RDF 0x19000000
#define ELS_CMD_PRLI 0x20100014 #define ELS_CMD_PRLI 0x20100014
#define ELS_CMD_NVMEPRLI 0x20140018 #define ELS_CMD_NVMEPRLI 0x20140018
#define ELS_CMD_PRLO 0x21100014 #define ELS_CMD_PRLO 0x21100014
...@@ -629,6 +630,7 @@ struct fc_vft_header { ...@@ -629,6 +630,7 @@ struct fc_vft_header {
#define ELS_CMD_RRQ 0x12 #define ELS_CMD_RRQ 0x12
#define ELS_CMD_REC 0x13 #define ELS_CMD_REC 0x13
#define ELS_CMD_RDP 0x18 #define ELS_CMD_RDP 0x18
#define ELS_CMD_RDF 0x19
#define ELS_CMD_PRLI 0x14001020 #define ELS_CMD_PRLI 0x14001020
#define ELS_CMD_NVMEPRLI 0x18001420 #define ELS_CMD_NVMEPRLI 0x18001420
#define ELS_CMD_PRLO 0x14001021 #define ELS_CMD_PRLO 0x14001021
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
* included with this package. * * included with this package. *
*******************************************************************/ *******************************************************************/
#include <uapi/scsi/fc/fc_els.h>
/* Macros to deal with bit fields. Each bit field must have 3 #defines /* Macros to deal with bit fields. Each bit field must have 3 #defines
* associated with it (_SHIFT, _MASK, and _WORD). * associated with it (_SHIFT, _MASK, and _WORD).
* EG. For a bit field that is in the 7th bit of the "field4" field of a * EG. For a bit field that is in the 7th bit of the "field4" field of a
...@@ -4795,6 +4797,23 @@ struct send_frame_wqe { ...@@ -4795,6 +4797,23 @@ struct send_frame_wqe {
uint32_t fc_hdr_wd5; /* word 15 */ uint32_t fc_hdr_wd5; /* word 15 */
}; };
#define ELS_RDF_REG_TAG_CNT 1
struct lpfc_els_rdf_reg_desc {
struct fc_df_desc_fpin_reg reg_desc; /* descriptor header */
__be32 desc_tags[ELS_RDF_REG_TAG_CNT];
/* tags in reg_desc */
};
struct lpfc_els_rdf_req {
struct fc_els_rdf rdf; /* hdr up to descriptors */
struct lpfc_els_rdf_reg_desc reg_d1; /* 1st descriptor */
};
struct lpfc_els_rdf_rsp {
struct fc_els_rdf_resp rdf_resp; /* hdr up to descriptors */
struct lpfc_els_rdf_reg_desc reg_d1; /* 1st descriptor */
};
union lpfc_wqe { union lpfc_wqe {
uint32_t words[16]; uint32_t words[16];
struct lpfc_wqe_generic generic; struct lpfc_wqe_generic generic;
......
...@@ -9459,6 +9459,7 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq, ...@@ -9459,6 +9459,7 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
if (if_type >= LPFC_SLI_INTF_IF_TYPE_2) { if (if_type >= LPFC_SLI_INTF_IF_TYPE_2) {
if (pcmd && (*pcmd == ELS_CMD_FLOGI || if (pcmd && (*pcmd == ELS_CMD_FLOGI ||
*pcmd == ELS_CMD_SCR || *pcmd == ELS_CMD_SCR ||
*pcmd == ELS_CMD_RDF ||
*pcmd == ELS_CMD_RSCN_XMT || *pcmd == ELS_CMD_RSCN_XMT ||
*pcmd == ELS_CMD_FDISC || *pcmd == ELS_CMD_FDISC ||
*pcmd == ELS_CMD_LOGO || *pcmd == ELS_CMD_LOGO ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment