Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: lpfc: Add reporting capability for Link Degrade Signaling

Firmware reports link degrade signaling via ACQES.

Handlers and new additions to the SET_FEATURES mbox command are implemented
so that link degrade parameters for 64GB capable links are reported through
EDC ELS frames.

Link: https://lore.kernel.org/r/20220911221505.117655-12-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

James Smart and committed by
Martin K. Petersen
dbb1e2ff 045c58c8

+224 -68
+6
drivers/scsi/lpfc/lpfc.h
··· 403 403 link1, 404 404 link2, 405 405 link3; 406 + u32 phy_lnk_speed; 406 407 }; 407 408 408 409 /* Format of congestion module parameters */ ··· 1596 1595 #define LPFC_POLL_SLOWPATH 1 /* called from slowpath */ 1597 1596 1598 1597 char os_host_name[MAXHOSTNAMELEN]; 1598 + 1599 + /* LD Signaling */ 1600 + u32 degrade_activate_threshold; 1601 + u32 degrade_deactivate_threshold; 1602 + u32 fec_degrade_interval; 1599 1603 1600 1604 atomic_t dbg_log_idx; 1601 1605 atomic_t dbg_log_cnt;
+1
drivers/scsi/lpfc/lpfc_crtn.h
··· 78 78 void lpfc_free_iocb_list(struct lpfc_hba *phba); 79 79 int lpfc_post_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *hrq, 80 80 struct lpfc_queue *drq, int count, int idx); 81 + int lpfc_read_lds_params(struct lpfc_hba *phba); 81 82 uint32_t lpfc_calc_cmf_latency(struct lpfc_hba *phba); 82 83 void lpfc_cmf_signal_init(struct lpfc_hba *phba); 83 84 void lpfc_cmf_start(struct lpfc_hba *phba);
+111 -43
drivers/scsi/lpfc/lpfc_els.c
··· 3988 3988 goto out; 3989 3989 3990 3990 /* ELS cmd tag <ulpIoTag> completes */ 3991 - lpfc_printf_log(phba, KERN_INFO, LOG_ELS | LOG_CGN_MGMT, 3991 + lpfc_printf_log(phba, KERN_INFO, 3992 + LOG_ELS | LOG_CGN_MGMT | LOG_LDS_EVENT, 3992 3993 "4676 Fabric EDC Rsp: " 3993 3994 "0x%02x, 0x%08x\n", 3994 3995 edc_rsp->acc_hdr.la_cmd, ··· 4026 4025 if (bytes_remain < FC_TLV_DESC_SZ_FROM_LENGTH(tlv) || 4027 4026 FC_TLV_DESC_SZ_FROM_LENGTH(tlv) != 4028 4027 sizeof(struct fc_diag_lnkflt_desc)) { 4029 - lpfc_printf_log( 4030 - phba, KERN_WARNING, LOG_CGN_MGMT, 4028 + lpfc_printf_log(phba, KERN_WARNING, 4029 + LOG_ELS | LOG_CGN_MGMT | LOG_LDS_EVENT, 4031 4030 "6462 Truncated Link Fault Diagnostic " 4032 4031 "descriptor[%d]: %d vs 0x%zx 0x%zx\n", 4033 4032 desc_cnt, bytes_remain, 4034 4033 FC_TLV_DESC_SZ_FROM_LENGTH(tlv), 4035 - sizeof(struct fc_diag_cg_sig_desc)); 4034 + sizeof(struct fc_diag_lnkflt_desc)); 4036 4035 goto out; 4037 4036 } 4038 4037 plnkflt = (struct fc_diag_lnkflt_desc *)tlv; 4039 - lpfc_printf_log( 4040 - phba, KERN_INFO, LOG_ELS | LOG_CGN_MGMT, 4038 + lpfc_printf_log(phba, KERN_INFO, 4039 + LOG_ELS | LOG_LDS_EVENT, 4041 4040 "4617 Link Fault Desc Data: 0x%08x 0x%08x " 4042 4041 "0x%08x 0x%08x 0x%08x\n", 4043 4042 be32_to_cpu(plnkflt->desc_tag), ··· 4117 4116 } 4118 4117 4119 4118 static void 4120 - lpfc_format_edc_cgn_desc(struct lpfc_hba *phba, struct fc_diag_cg_sig_desc *cgd) 4119 + lpfc_format_edc_lft_desc(struct lpfc_hba *phba, struct fc_tlv_desc *tlv) 4121 4120 { 4121 + struct fc_diag_lnkflt_desc *lft = (struct fc_diag_lnkflt_desc *)tlv; 4122 + 4123 + lft->desc_tag = cpu_to_be32(ELS_DTAG_LNK_FAULT_CAP); 4124 + lft->desc_len = cpu_to_be32( 4125 + FC_TLV_DESC_LENGTH_FROM_SZ(struct fc_diag_lnkflt_desc)); 4126 + 4127 + lft->degrade_activate_threshold = 4128 + cpu_to_be32(phba->degrade_activate_threshold); 4129 + lft->degrade_deactivate_threshold = 4130 + cpu_to_be32(phba->degrade_deactivate_threshold); 4131 + lft->fec_degrade_interval = cpu_to_be32(phba->fec_degrade_interval); 4132 + } 4133 + 4134 + static void 4135 + lpfc_format_edc_cgn_desc(struct lpfc_hba *phba, struct fc_tlv_desc *tlv) 4136 + { 4137 + struct fc_diag_cg_sig_desc *cgd = (struct fc_diag_cg_sig_desc *)tlv; 4138 + 4122 4139 /* We are assuming cgd was zero'ed before calling this routine */ 4123 4140 4124 4141 /* Configure the congestion detection capability */ ··· 4180 4161 cpu_to_be16(EDC_CG_SIGFREQ_MSEC); 4181 4162 } 4182 4163 4164 + static bool 4165 + lpfc_link_is_lds_capable(struct lpfc_hba *phba) 4166 + { 4167 + if (!(phba->lmt & LMT_64Gb)) 4168 + return false; 4169 + if (phba->sli_rev != LPFC_SLI_REV4) 4170 + return false; 4171 + 4172 + if (phba->sli4_hba.conf_trunk) { 4173 + if (phba->trunk_link.phy_lnk_speed == LPFC_USER_LINK_SPEED_64G) 4174 + return true; 4175 + } else if (phba->fc_linkspeed == LPFC_LINK_SPEED_64GHZ) { 4176 + return true; 4177 + } 4178 + return false; 4179 + } 4180 + 4183 4181 /** 4184 4182 * lpfc_issue_els_edc - Exchange Diagnostic Capabilities with the fabric. 4185 4183 * @vport: pointer to a host virtual N_Port data structure. ··· 4224 4188 { 4225 4189 struct lpfc_hba *phba = vport->phba; 4226 4190 struct lpfc_iocbq *elsiocb; 4227 - struct lpfc_els_edc_req *edc_req; 4228 - struct fc_diag_cg_sig_desc *cgn_desc; 4191 + struct fc_els_edc *edc_req; 4192 + struct fc_tlv_desc *tlv; 4229 4193 u16 cmdsize; 4230 4194 struct lpfc_nodelist *ndlp; 4231 4195 u8 *pcmd = NULL; 4232 - u32 edc_req_size, cgn_desc_size; 4196 + u32 cgn_desc_size, lft_desc_size; 4233 4197 int rc; 4234 4198 4235 4199 if (vport->port_type == LPFC_NPIV_PORT) ··· 4239 4203 if (!ndlp || ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) 4240 4204 return -ENODEV; 4241 4205 4242 - /* If HBA doesn't support signals, drop into RDF */ 4243 - if (!phba->cgn_init_reg_signal) 4206 + cgn_desc_size = (phba->cgn_init_reg_signal) ? 4207 + sizeof(struct fc_diag_cg_sig_desc) : 0; 4208 + lft_desc_size = (lpfc_link_is_lds_capable(phba)) ? 4209 + sizeof(struct fc_diag_lnkflt_desc) : 0; 4210 + cmdsize = cgn_desc_size + lft_desc_size; 4211 + 4212 + /* Skip EDC if no applicable descriptors */ 4213 + if (!cmdsize) 4244 4214 goto try_rdf; 4245 4215 4246 - edc_req_size = sizeof(struct fc_els_edc); 4247 - cgn_desc_size = sizeof(struct fc_diag_cg_sig_desc); 4248 - cmdsize = edc_req_size + cgn_desc_size; 4216 + cmdsize += sizeof(struct fc_els_edc); 4249 4217 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp, 4250 4218 ndlp->nlp_DID, ELS_CMD_EDC); 4251 4219 if (!elsiocb) ··· 4258 4218 /* Configure the payload for the supported Diagnostics capabilities. */ 4259 4219 pcmd = (u8 *)elsiocb->cmd_dmabuf->virt; 4260 4220 memset(pcmd, 0, cmdsize); 4261 - edc_req = (struct lpfc_els_edc_req *)pcmd; 4262 - edc_req->edc.desc_len = cpu_to_be32(cgn_desc_size); 4263 - edc_req->edc.edc_cmd = ELS_EDC; 4221 + edc_req = (struct fc_els_edc *)pcmd; 4222 + edc_req->desc_len = cpu_to_be32(cgn_desc_size + lft_desc_size); 4223 + edc_req->edc_cmd = ELS_EDC; 4224 + tlv = edc_req->desc; 4264 4225 4265 - cgn_desc = &edc_req->cgn_desc; 4226 + if (cgn_desc_size) { 4227 + lpfc_format_edc_cgn_desc(phba, tlv); 4228 + phba->cgn_sig_freq = lpfc_fabric_cgn_frequency; 4229 + tlv = fc_tlv_next_desc(tlv); 4230 + } 4266 4231 4267 - lpfc_format_edc_cgn_desc(phba, cgn_desc); 4268 - 4269 - phba->cgn_sig_freq = lpfc_fabric_cgn_frequency; 4232 + if (lft_desc_size) 4233 + lpfc_format_edc_lft_desc(phba, tlv); 4270 4234 4271 4235 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS | LOG_CGN_MGMT, 4272 4236 "4623 Xmit EDC to remote " ··· 5824 5780 struct lpfc_nodelist *ndlp) 5825 5781 { 5826 5782 struct lpfc_hba *phba = vport->phba; 5827 - struct lpfc_els_edc_rsp *edc_rsp; 5783 + struct fc_els_edc_resp *edc_rsp; 5784 + struct fc_tlv_desc *tlv; 5828 5785 struct lpfc_iocbq *elsiocb; 5829 5786 IOCB_t *icmd, *cmd; 5830 5787 union lpfc_wqe128 *wqe; 5788 + u32 cgn_desc_size, lft_desc_size; 5789 + u16 cmdsize; 5831 5790 uint8_t *pcmd; 5832 - int cmdsize, rc; 5791 + int rc; 5833 5792 5834 - cmdsize = sizeof(struct lpfc_els_edc_rsp); 5793 + cmdsize = sizeof(struct fc_els_edc_resp); 5794 + cgn_desc_size = sizeof(struct fc_diag_cg_sig_desc); 5795 + lft_desc_size = (lpfc_link_is_lds_capable(phba)) ? 5796 + sizeof(struct fc_diag_lnkflt_desc) : 0; 5797 + cmdsize += cgn_desc_size + lft_desc_size; 5835 5798 elsiocb = lpfc_prep_els_iocb(vport, 0, cmdsize, cmdiocb->retry, 5836 5799 ndlp, ndlp->nlp_DID, ELS_CMD_ACC); 5837 5800 if (!elsiocb) ··· 5860 5809 pcmd = elsiocb->cmd_dmabuf->virt; 5861 5810 memset(pcmd, 0, cmdsize); 5862 5811 5863 - edc_rsp = (struct lpfc_els_edc_rsp *)pcmd; 5864 - edc_rsp->edc_rsp.acc_hdr.la_cmd = ELS_LS_ACC; 5865 - edc_rsp->edc_rsp.desc_list_len = cpu_to_be32( 5866 - FC_TLV_DESC_LENGTH_FROM_SZ(struct lpfc_els_edc_rsp)); 5867 - edc_rsp->edc_rsp.lsri.desc_tag = cpu_to_be32(ELS_DTAG_LS_REQ_INFO); 5868 - edc_rsp->edc_rsp.lsri.desc_len = cpu_to_be32( 5812 + edc_rsp = (struct fc_els_edc_resp *)pcmd; 5813 + edc_rsp->acc_hdr.la_cmd = ELS_LS_ACC; 5814 + edc_rsp->desc_list_len = cpu_to_be32(sizeof(struct fc_els_lsri_desc) + 5815 + cgn_desc_size + lft_desc_size); 5816 + edc_rsp->lsri.desc_tag = cpu_to_be32(ELS_DTAG_LS_REQ_INFO); 5817 + edc_rsp->lsri.desc_len = cpu_to_be32( 5869 5818 FC_TLV_DESC_LENGTH_FROM_SZ(struct fc_els_lsri_desc)); 5870 - edc_rsp->edc_rsp.lsri.rqst_w0.cmd = ELS_EDC; 5871 - lpfc_format_edc_cgn_desc(phba, &edc_rsp->cgn_desc); 5819 + edc_rsp->lsri.rqst_w0.cmd = ELS_EDC; 5820 + tlv = edc_rsp->desc; 5821 + lpfc_format_edc_cgn_desc(phba, tlv); 5822 + tlv = fc_tlv_next_desc(tlv); 5823 + if (lft_desc_size) 5824 + lpfc_format_edc_lft_desc(phba, tlv); 5872 5825 5873 5826 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP, 5874 5827 "Issue EDC ACC: did:x%x flg:x%x refcnt %d", ··· 9137 9082 uint32_t *ptr, dtag; 9138 9083 const char *dtag_nm; 9139 9084 int desc_cnt = 0, bytes_remain; 9140 - bool rcv_cap_desc = false; 9085 + struct fc_diag_lnkflt_desc *plnkflt; 9141 9086 9142 9087 payload = cmdiocb->cmd_dmabuf->virt; 9143 9088 ··· 9145 9090 bytes_remain = be32_to_cpu(edc_req->desc_len); 9146 9091 9147 9092 ptr = (uint32_t *)payload; 9148 - lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS | LOG_CGN_MGMT, 9093 + lpfc_printf_vlog(vport, KERN_INFO, 9094 + LOG_ELS | LOG_CGN_MGMT | LOG_LDS_EVENT, 9149 9095 "3319 Rcv EDC payload len %d: x%x x%x x%x\n", 9150 9096 bytes_remain, be32_to_cpu(*ptr), 9151 9097 be32_to_cpu(*(ptr + 1)), be32_to_cpu(*(ptr + 2))); ··· 9165 9109 * cycle through EDC diagnostic descriptors to find the 9166 9110 * congestion signaling capability descriptor 9167 9111 */ 9168 - while (bytes_remain && !rcv_cap_desc) { 9112 + while (bytes_remain) { 9169 9113 if (bytes_remain < FC_TLV_DESC_HDR_SZ) { 9170 - lpfc_printf_log(phba, KERN_WARNING, LOG_CGN_MGMT, 9114 + lpfc_printf_log(phba, KERN_WARNING, 9115 + LOG_ELS | LOG_CGN_MGMT | LOG_LDS_EVENT, 9171 9116 "6464 Truncated TLV hdr on " 9172 9117 "Diagnostic descriptor[%d]\n", 9173 9118 desc_cnt); ··· 9181 9124 if (bytes_remain < FC_TLV_DESC_SZ_FROM_LENGTH(tlv) || 9182 9125 FC_TLV_DESC_SZ_FROM_LENGTH(tlv) != 9183 9126 sizeof(struct fc_diag_lnkflt_desc)) { 9184 - lpfc_printf_log( 9185 - phba, KERN_WARNING, LOG_CGN_MGMT, 9127 + lpfc_printf_log(phba, KERN_WARNING, 9128 + LOG_ELS | LOG_CGN_MGMT | LOG_LDS_EVENT, 9186 9129 "6465 Truncated Link Fault Diagnostic " 9187 9130 "descriptor[%d]: %d vs 0x%zx 0x%zx\n", 9188 9131 desc_cnt, bytes_remain, 9189 9132 FC_TLV_DESC_SZ_FROM_LENGTH(tlv), 9190 - sizeof(struct fc_diag_cg_sig_desc)); 9133 + sizeof(struct fc_diag_lnkflt_desc)); 9191 9134 goto out; 9192 9135 } 9193 - /* No action for Link Fault descriptor for now */ 9136 + plnkflt = (struct fc_diag_lnkflt_desc *)tlv; 9137 + lpfc_printf_log(phba, KERN_INFO, 9138 + LOG_ELS | LOG_LDS_EVENT, 9139 + "4626 Link Fault Desc Data: x%08x len x%x " 9140 + "da x%x dd x%x interval x%x\n", 9141 + be32_to_cpu(plnkflt->desc_tag), 9142 + be32_to_cpu(plnkflt->desc_len), 9143 + be32_to_cpu( 9144 + plnkflt->degrade_activate_threshold), 9145 + be32_to_cpu( 9146 + plnkflt->degrade_deactivate_threshold), 9147 + be32_to_cpu(plnkflt->fec_degrade_interval)); 9194 9148 break; 9195 9149 case ELS_DTAG_CG_SIGNAL_CAP: 9196 9150 if (bytes_remain < FC_TLV_DESC_SZ_FROM_LENGTH(tlv) || ··· 9228 9160 9229 9161 lpfc_least_capable_settings( 9230 9162 phba, (struct fc_diag_cg_sig_desc *)tlv); 9231 - rcv_cap_desc = true; 9232 9163 break; 9233 9164 default: 9234 9165 dtag_nm = lpfc_get_tlv_dtag_nm(dtag); 9235 - lpfc_printf_log(phba, KERN_WARNING, LOG_CGN_MGMT, 9166 + lpfc_printf_log(phba, KERN_WARNING, 9167 + LOG_ELS | LOG_CGN_MGMT | LOG_LDS_EVENT, 9236 9168 "6467 unknown Diagnostic " 9237 9169 "Descriptor[%d]: tag x%x (%s)\n", 9238 9170 desc_cnt, dtag, dtag_nm);
+9 -1
drivers/scsi/lpfc/lpfc_hbadisc.c
··· 1242 1242 phba->trunk_link.link1.state = 0; 1243 1243 phba->trunk_link.link2.state = 0; 1244 1244 phba->trunk_link.link3.state = 0; 1245 + phba->trunk_link.phy_lnk_speed = 1246 + LPFC_LINK_SPEED_UNKNOWN; 1245 1247 phba->sli4_hba.link_state.logical_speed = 1246 1248 LPFC_LINK_SPEED_UNKNOWN; 1247 1249 } ··· 3796 3794 if (phba->cmf_active_mode != LPFC_CFG_OFF) 3797 3795 lpfc_cmf_signal_init(phba); 3798 3796 3797 + if (phba->lmt & LMT_64Gb) 3798 + lpfc_read_lds_params(phba); 3799 + 3799 3800 } else if (attn_type == LPFC_ATT_LINK_DOWN || 3800 3801 attn_type == LPFC_ATT_UNEXP_WWPN) { 3801 3802 phba->fc_stat.LinkDown++; ··· 4398 4393 rc = lpfc_issue_els_edc(vport, 0); 4399 4394 lpfc_printf_log(phba, KERN_INFO, 4400 4395 LOG_INIT | LOG_ELS | LOG_DISCOVERY, 4401 - "4220 EDC issue error x%x, Data: x%x\n", 4396 + "4220 Issue EDC status x%x Data x%x\n", 4402 4397 rc, phba->cgn_init_reg_signal); 4398 + } else if (phba->lmt & LMT_64Gb) { 4399 + /* may send link fault capability descriptor */ 4400 + lpfc_issue_els_edc(vport, 0); 4403 4401 } else { 4404 4402 lpfc_issue_els_rdf(vport, 0); 4405 4403 }
+11 -19
drivers/scsi/lpfc/lpfc_hw4.h
··· 3484 3484 3485 3485 #define LPFC_SET_UE_RECOVERY 0x10 3486 3486 #define LPFC_SET_MDS_DIAGS 0x12 3487 - #define LPFC_SET_CGN_SIGNAL 0x1f 3488 3487 #define LPFC_SET_DUAL_DUMP 0x1e 3488 + #define LPFC_SET_CGN_SIGNAL 0x1f 3489 3489 #define LPFC_SET_ENABLE_MI 0x21 3490 + #define LPFC_SET_LD_SIGNAL 0x23 3490 3491 #define LPFC_SET_ENABLE_CMF 0x24 3491 3492 struct lpfc_mbx_set_feature { 3492 3493 struct mbox_header header; ··· 3518 3517 #define lpfc_mbx_set_feature_cmf_SHIFT 0 3519 3518 #define lpfc_mbx_set_feature_cmf_MASK 0x00000001 3520 3519 #define lpfc_mbx_set_feature_cmf_WORD word6 3520 + #define lpfc_mbx_set_feature_lds_qry_SHIFT 0 3521 + #define lpfc_mbx_set_feature_lds_qry_MASK 0x00000001 3522 + #define lpfc_mbx_set_feature_lds_qry_WORD word6 3523 + #define LPFC_QUERY_LDS_OP 1 3521 3524 #define lpfc_mbx_set_feature_mi_SHIFT 0 3522 3525 #define lpfc_mbx_set_feature_mi_MASK 0x0000ffff 3523 3526 #define lpfc_mbx_set_feature_mi_WORD word6 3524 3527 #define lpfc_mbx_set_feature_milunq_SHIFT 16 3525 3528 #define lpfc_mbx_set_feature_milunq_MASK 0x0000ffff 3526 3529 #define lpfc_mbx_set_feature_milunq_WORD word6 3527 - uint32_t word7; 3530 + u32 word7; 3528 3531 #define lpfc_mbx_set_feature_UERP_SHIFT 0 3529 3532 #define lpfc_mbx_set_feature_UERP_MASK 0x0000ffff 3530 3533 #define lpfc_mbx_set_feature_UERP_WORD word7 ··· 3542 3537 #define lpfc_mbx_set_feature_CGN_acqe_freq_SHIFT 0 3543 3538 #define lpfc_mbx_set_feature_CGN_acqe_freq_MASK 0x000000ff 3544 3539 #define lpfc_mbx_set_feature_CGN_acqe_freq_WORD word8 3540 + u32 word9; 3541 + u32 word10; 3545 3542 }; 3546 3543 3547 3544 ··· 4321 4314 struct lpfc_acqe_sli { 4322 4315 uint32_t event_data1; 4323 4316 uint32_t event_data2; 4324 - uint32_t reserved; 4317 + uint32_t event_data3; 4325 4318 uint32_t trailer; 4326 4319 #define LPFC_SLI_EVENT_TYPE_PORT_ERROR 0x1 4327 4320 #define LPFC_SLI_EVENT_TYPE_OVER_TEMP 0x2 ··· 4334 4327 #define LPFC_SLI_EVENT_TYPE_MISCONF_FAWWN 0xF 4335 4328 #define LPFC_SLI_EVENT_TYPE_EEPROM_FAILURE 0x10 4336 4329 #define LPFC_SLI_EVENT_TYPE_CGN_SIGNAL 0x11 4330 + #define LPFC_SLI_EVENT_TYPE_RD_SIGNAL 0x12 4337 4331 }; 4338 4332 4339 4333 /* ··· 5057 5049 { FPIN_CONGN_SEVERITY_WARNING, "Warning" }, \ 5058 5050 { FPIN_CONGN_SEVERITY_ERROR, "Alarm" }, \ 5059 5051 } 5060 - 5061 - /* EDC supports two descriptors. When allocated, it is the 5062 - * size of this structure plus each supported descriptor. 5063 - */ 5064 - struct lpfc_els_edc_req { 5065 - struct fc_els_edc edc; /* hdr up to descriptors */ 5066 - struct fc_diag_cg_sig_desc cgn_desc; /* 1st descriptor */ 5067 - }; 5068 - 5069 - /* Minimum structure defines for the EDC response. 5070 - * Balance is in buffer. 5071 - */ 5072 - struct lpfc_els_edc_rsp { 5073 - struct fc_els_edc_resp edc_rsp; /* hdr up to descriptors */ 5074 - struct fc_diag_cg_sig_desc cgn_desc; /* 1st descriptor */ 5075 - }; 5076 5052 5077 5053 /* Used for logging FPIN messages */ 5078 5054 #define LPFC_FPIN_WWPN_LINE_SZ 128
+23 -3
drivers/scsi/lpfc/lpfc_init.c
··· 6185 6185 { 6186 6186 uint8_t port_fault = bf_get(lpfc_acqe_fc_la_trunk_linkmask, acqe_fc); 6187 6187 uint8_t err = bf_get(lpfc_acqe_fc_la_trunk_fault, acqe_fc); 6188 + u8 cnt = 0; 6188 6189 6189 6190 phba->sli4_hba.link_state.speed = 6190 6191 lpfc_sli4_port_speed_parse(phba, LPFC_TRAILER_CODE_FC, ··· 6204 6203 bf_get(lpfc_acqe_fc_la_trunk_link_status_port0, acqe_fc) 6205 6204 ? LPFC_LINK_UP : LPFC_LINK_DOWN; 6206 6205 phba->trunk_link.link0.fault = port_fault & 0x1 ? err : 0; 6206 + cnt++; 6207 6207 } 6208 6208 if (bf_get(lpfc_acqe_fc_la_trunk_config_port1, acqe_fc)) { 6209 6209 phba->trunk_link.link1.state = 6210 6210 bf_get(lpfc_acqe_fc_la_trunk_link_status_port1, acqe_fc) 6211 6211 ? LPFC_LINK_UP : LPFC_LINK_DOWN; 6212 6212 phba->trunk_link.link1.fault = port_fault & 0x2 ? err : 0; 6213 + cnt++; 6213 6214 } 6214 6215 if (bf_get(lpfc_acqe_fc_la_trunk_config_port2, acqe_fc)) { 6215 6216 phba->trunk_link.link2.state = 6216 6217 bf_get(lpfc_acqe_fc_la_trunk_link_status_port2, acqe_fc) 6217 6218 ? LPFC_LINK_UP : LPFC_LINK_DOWN; 6218 6219 phba->trunk_link.link2.fault = port_fault & 0x4 ? err : 0; 6220 + cnt++; 6219 6221 } 6220 6222 if (bf_get(lpfc_acqe_fc_la_trunk_config_port3, acqe_fc)) { 6221 6223 phba->trunk_link.link3.state = 6222 6224 bf_get(lpfc_acqe_fc_la_trunk_link_status_port3, acqe_fc) 6223 6225 ? LPFC_LINK_UP : LPFC_LINK_DOWN; 6224 6226 phba->trunk_link.link3.fault = port_fault & 0x8 ? err : 0; 6227 + cnt++; 6225 6228 } 6229 + 6230 + if (cnt) 6231 + phba->trunk_link.phy_lnk_speed = 6232 + phba->sli4_hba.link_state.logical_speed / (cnt * 1000); 6233 + else 6234 + phba->trunk_link.phy_lnk_speed = LPFC_LINK_SPEED_UNKNOWN; 6226 6235 6227 6236 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, 6228 6237 "2910 Async FC Trunking Event - Speed:%d\n" ··· 6311 6300 if (bf_get(lpfc_acqe_fc_la_att_type, acqe_fc) == 6312 6301 LPFC_FC_LA_TYPE_LINK_DOWN) 6313 6302 phba->sli4_hba.link_state.logical_speed = 0; 6314 - else if (!phba->sli4_hba.conf_trunk) 6303 + else if (!phba->sli4_hba.conf_trunk) 6315 6304 phba->sli4_hba.link_state.logical_speed = 6316 6305 bf_get(lpfc_acqe_fc_la_llink_spd, acqe_fc) * 10; 6317 6306 ··· 6429 6418 "2901 Async SLI event - Type:%d, Event Data: x%08x " 6430 6419 "x%08x x%08x x%08x\n", evt_type, 6431 6420 acqe_sli->event_data1, acqe_sli->event_data2, 6432 - acqe_sli->reserved, acqe_sli->trailer); 6421 + acqe_sli->event_data3, acqe_sli->trailer); 6433 6422 6434 6423 port_name = phba->Port[0]; 6435 6424 if (port_name == 0x00) ··· 6458 6447 temp_event_data.event_code = LPFC_NORMAL_TEMP; 6459 6448 temp_event_data.data = (uint32_t)acqe_sli->event_data1; 6460 6449 6461 - lpfc_printf_log(phba, KERN_INFO, LOG_SLI, 6450 + lpfc_printf_log(phba, KERN_INFO, LOG_SLI | LOG_LDS_EVENT, 6462 6451 "3191 Normal Temperature:%d Celsius - Port Name %c\n", 6463 6452 acqe_sli->event_data1, port_name); 6464 6453 ··· 6635 6624 atomic_add(cnt, &phba->cgn_sync_warn_cnt); 6636 6625 } 6637 6626 } 6627 + break; 6628 + case LPFC_SLI_EVENT_TYPE_RD_SIGNAL: 6629 + /* May be accompanied by a temperature event */ 6630 + lpfc_printf_log(phba, KERN_INFO, 6631 + LOG_SLI | LOG_LINK_EVENT | LOG_LDS_EVENT, 6632 + "2902 Remote Degrade Signaling: x%08x x%08x " 6633 + "x%08x\n", 6634 + acqe_sli->event_data1, acqe_sli->event_data2, 6635 + acqe_sli->event_data3); 6638 6636 break; 6639 6637 default: 6640 6638 lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
+1 -1
drivers/scsi/lpfc/lpfc_logmsg.h
··· 35 35 #define LOG_FCP_ERROR 0x00001000 /* log errors, not underruns */ 36 36 #define LOG_LIBDFC 0x00002000 /* Libdfc events */ 37 37 #define LOG_VPORT 0x00004000 /* NPIV events */ 38 - #define LOG_SECURITY 0x00008000 /* Security events */ 38 + #define LOG_LDS_EVENT 0x00008000 /* Link Degrade Signaling events */ 39 39 #define LOG_EVENT 0x00010000 /* CT,TEMP,DUMP, logging */ 40 40 #define LOG_FIP 0x00020000 /* FIP events */ 41 41 #define LOG_FCP_UNDER 0x00040000 /* FCP underruns errors */
+62 -1
drivers/scsi/lpfc/lpfc_sli.c
··· 6830 6830 bf_set(lpfc_mbx_set_feature_mi, &mbox->u.mqe.un.set_feature, 6831 6831 phba->sli4_hba.pc_sli4_params.mi_ver); 6832 6832 break; 6833 + case LPFC_SET_LD_SIGNAL: 6834 + mbox->u.mqe.un.set_feature.feature = LPFC_SET_LD_SIGNAL; 6835 + mbox->u.mqe.un.set_feature.param_len = 16; 6836 + bf_set(lpfc_mbx_set_feature_lds_qry, 6837 + &mbox->u.mqe.un.set_feature, LPFC_QUERY_LDS_OP); 6838 + break; 6833 6839 case LPFC_SET_ENABLE_CMF: 6834 - bf_set(lpfc_mbx_set_feature_dd, &mbox->u.mqe.un.set_feature, 1); 6835 6840 mbox->u.mqe.un.set_feature.feature = LPFC_SET_ENABLE_CMF; 6836 6841 mbox->u.mqe.un.set_feature.param_len = 4; 6837 6842 bf_set(lpfc_mbx_set_feature_cmf, ··· 7829 7824 } 7830 7825 spin_unlock_irqrestore(&phba->hbalock, flags); 7831 7826 return 1; 7827 + } 7828 + 7829 + static void 7830 + lpfc_mbx_cmpl_read_lds_params(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) 7831 + { 7832 + union lpfc_sli4_cfg_shdr *shdr; 7833 + u32 shdr_status, shdr_add_status; 7834 + 7835 + shdr = (union lpfc_sli4_cfg_shdr *) 7836 + &pmb->u.mqe.un.sli4_config.header.cfg_shdr; 7837 + shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response); 7838 + shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response); 7839 + if (shdr_status || shdr_add_status || pmb->u.mb.mbxStatus) { 7840 + lpfc_printf_log(phba, KERN_INFO, LOG_LDS_EVENT | LOG_MBOX, 7841 + "4622 SET_FEATURE (x%x) mbox failed, " 7842 + "status x%x add_status x%x, mbx status x%x\n", 7843 + LPFC_SET_LD_SIGNAL, shdr_status, 7844 + shdr_add_status, pmb->u.mb.mbxStatus); 7845 + phba->degrade_activate_threshold = 0; 7846 + phba->degrade_deactivate_threshold = 0; 7847 + phba->fec_degrade_interval = 0; 7848 + goto out; 7849 + } 7850 + 7851 + phba->degrade_activate_threshold = pmb->u.mqe.un.set_feature.word7; 7852 + phba->degrade_deactivate_threshold = pmb->u.mqe.un.set_feature.word8; 7853 + phba->fec_degrade_interval = pmb->u.mqe.un.set_feature.word10; 7854 + 7855 + lpfc_printf_log(phba, KERN_INFO, LOG_LDS_EVENT, 7856 + "4624 Success: da x%x dd x%x interval x%x\n", 7857 + phba->degrade_activate_threshold, 7858 + phba->degrade_deactivate_threshold, 7859 + phba->fec_degrade_interval); 7860 + out: 7861 + mempool_free(pmb, phba->mbox_mem_pool); 7862 + } 7863 + 7864 + int 7865 + lpfc_read_lds_params(struct lpfc_hba *phba) 7866 + { 7867 + LPFC_MBOXQ_t *mboxq; 7868 + int rc; 7869 + 7870 + mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); 7871 + if (!mboxq) 7872 + return -ENOMEM; 7873 + 7874 + lpfc_set_features(phba, mboxq, LPFC_SET_LD_SIGNAL); 7875 + mboxq->vport = phba->pport; 7876 + mboxq->mbox_cmpl = lpfc_mbx_cmpl_read_lds_params; 7877 + rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT); 7878 + if (rc == MBX_NOT_FINISHED) { 7879 + mempool_free(mboxq, phba->mbox_mem_pool); 7880 + return -EIO; 7881 + } 7882 + return 0; 7832 7883 } 7833 7884 7834 7885 static void