Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ae9e28f3 authored by James Smart's avatar James Smart Committed by Martin K. Petersen
Browse files

scsi: lpfc: Add MDS Diagnostic support.



Added code to support Cisco MDS loopback diagnostic. The diagnostics run
various loopbacks including one which loops-back frame through the
driver.

Signed-off-by: default avatarDick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent dc53a618
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -675,6 +675,8 @@ struct lpfc_hba {
					/* INIT_LINK mailbox command */
#define LS_NPIV_FAB_SUPPORTED 0x2	/* Fabric supports NPIV */
#define LS_IGNORE_ERATT       0x4	/* intr handler should ignore ERATT */
#define LS_MDS_LINK_DOWN      0x8	/* MDS Diagnostics Link Down */
#define LS_MDS_LOOPBACK      0x16	/* MDS Diagnostics Link Up (Loopback) */

	uint32_t hba_flag;	/* hba generic flags */
#define HBA_ERATT_HANDLED	0x1 /* This flag is set when eratt handled */
+7 −0
Original line number Diff line number Diff line
@@ -1047,6 +1047,13 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
				 irsp->ulpStatus, irsp->un.ulpWord[4],
				 irsp->ulpTimeout);


		/* If this is not a loop open failure, bail out */
		if (!(irsp->ulpStatus == IOSTAT_LOCAL_REJECT &&
		      ((irsp->un.ulpWord[4] & IOERR_PARAM_MASK) ==
					IOERR_LOOP_OPEN_FAILURE)))
			goto flogifail;

		/* FLOGI failed, so there is no fabric */
		spin_lock_irq(shost->host_lock);
		vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP);
+2 −1
Original line number Diff line number Diff line
@@ -701,7 +701,8 @@ lpfc_work_done(struct lpfc_hba *phba)
			/* Set the lpfc data pending flag */
			set_bit(LPFC_DATA_READY, &phba->data_flags);
		} else {
			if (phba->link_state >= LPFC_LINK_UP) {
			if (phba->link_state >= LPFC_LINK_UP ||
			    phba->link_flag & LS_MDS_LOOPBACK) {
				pring->flag &= ~LPFC_DEFERRED_RING_EVENT;
				lpfc_sli_handle_slow_ring_event(phba, pring,
								(status &
+14 −1
Original line number Diff line number Diff line
@@ -4421,6 +4421,19 @@ struct fcp_treceive64_wqe {
};
#define TXRDY_PAYLOAD_LEN      12

#define CMD_SEND_FRAME	0xE1

struct send_frame_wqe {
	struct ulp_bde64 bde;          /* words 0-2 */
	uint32_t frame_len;            /* word 3 */
	uint32_t fc_hdr_wd0;           /* word 4 */
	uint32_t fc_hdr_wd1;           /* word 5 */
	struct wqe_common wqe_com;     /* words 6-11 */
	uint32_t fc_hdr_wd2;           /* word 12 */
	uint32_t fc_hdr_wd3;           /* word 13 */
	uint32_t fc_hdr_wd4;           /* word 14 */
	uint32_t fc_hdr_wd5;           /* word 15 */
};

union lpfc_wqe {
	uint32_t words[16];
@@ -4439,7 +4452,7 @@ union lpfc_wqe {
	struct fcp_trsp64_wqe fcp_trsp;
	struct fcp_tsend64_wqe fcp_tsend;
	struct fcp_treceive64_wqe fcp_treceive;

	struct send_frame_wqe send_frame;
};

union lpfc_wqe128 {
+13 −0
Original line number Diff line number Diff line
@@ -4540,6 +4540,19 @@ lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc)
	pmb->vport = phba->pport;

	if (phba->sli4_hba.link_state.status != LPFC_FC_LA_TYPE_LINK_UP) {
		phba->link_flag &= ~(LS_MDS_LINK_DOWN | LS_MDS_LOOPBACK);

		switch (phba->sli4_hba.link_state.status) {
		case LPFC_FC_LA_TYPE_MDS_LINK_DOWN:
			phba->link_flag |= LS_MDS_LINK_DOWN;
			break;
		case LPFC_FC_LA_TYPE_MDS_LOOPBACK:
			phba->link_flag |= LS_MDS_LOOPBACK;
			break;
		default:
			break;
		}

		/* Parse and translate status field */
		mb = &pmb->u.mb;
		mb->mbxStatus = lpfc_sli4_parse_latt_fault(phba,
Loading