]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
scsi/lpfc: Fix parameter field in CQE to mask for LOCAL_REJECT status
authorVaios Papadimitriou <vaios.papadimitriou@emulex.com>
Tue, 28 Aug 2012 22:59:25 +0000 (15:59 -0700)
committerJerry Snitselaar <jerry.snitselaar@oracle.com>
Wed, 5 Sep 2012 19:25:48 +0000 (12:25 -0700)
commit id: http://marc.info/?l=linux-scsi&m=134496905829996

Signed-off-by: Jerry Snitselaar <jerry.snitselaar@oracle.com>
drivers/scsi/lpfc/lpfc_bsg.c
drivers/scsi/lpfc/lpfc_ct.c
drivers/scsi/lpfc/lpfc_els.c
drivers/scsi/lpfc/lpfc_hw.h
drivers/scsi/lpfc/lpfc_hw4.h
drivers/scsi/lpfc/lpfc_scsi.c
drivers/scsi/lpfc/lpfc_sli.c

index b0af7e195538db71f0a045810786cb178a40d433..cc15a9c9f4462710b097e18344ac646a200e6be8 100644 (file)
@@ -196,7 +196,7 @@ lpfc_bsg_send_mgmt_cmd_cmp(struct lpfc_hba *phba,
 
        if (rsp->ulpStatus) {
                if (rsp->ulpStatus == IOSTAT_LOCAL_REJECT) {
-                       switch (rsp->un.ulpWord[4] & 0xff) {
+                       switch (rsp->un.ulpWord[4] & IOERR_PARAM_MASK) {
                        case IOERR_SEQUENCE_TIMEOUT:
                                rc = -ETIMEDOUT;
                                break;
@@ -1235,7 +1235,7 @@ lpfc_issue_ct_rsp_cmp(struct lpfc_hba *phba,
 
        if (rsp->ulpStatus) {
                if (rsp->ulpStatus == IOSTAT_LOCAL_REJECT) {
-                       switch (rsp->un.ulpWord[4] & 0xff) {
+                       switch (rsp->un.ulpWord[4] & IOERR_PARAM_MASK) {
                        case IOERR_SEQUENCE_TIMEOUT:
                                rc = -ETIMEDOUT;
                                break;
@@ -4799,7 +4799,7 @@ lpfc_bsg_menlo_cmd_cmp(struct lpfc_hba *phba,
        menlo_resp->xri = rsp->ulpContext;
        if (rsp->ulpStatus) {
                if (rsp->ulpStatus == IOSTAT_LOCAL_REJECT) {
-                       switch (rsp->un.ulpWord[4] & 0xff) {
+                       switch (rsp->un.ulpWord[4] & IOERR_PARAM_MASK) {
                        case IOERR_SEQUENCE_TIMEOUT:
                                rc = -ETIMEDOUT;
                                break;
index 93e96b3c9097aff51694c6f7cc6f35dd695deead..7ffabb7e3afa536cb42f6aef511e80979ddb17c6 100644 (file)
@@ -104,7 +104,8 @@ lpfc_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
        if (unlikely(icmd->ulpStatus == IOSTAT_NEED_BUFFER)) {
                lpfc_sli_hbqbuf_add_hbqs(phba, LPFC_ELS_HBQ);
        } else if ((icmd->ulpStatus == IOSTAT_LOCAL_REJECT) &&
-               ((icmd->un.ulpWord[4] & 0xff) == IOERR_RCV_BUFFER_WAITING)) {
+                  ((icmd->un.ulpWord[4] & IOERR_PARAM_MASK) ==
+                  IOERR_RCV_BUFFER_WAITING)) {
                /* Not enough posted buffers; Try posting more buffers */
                phba->fc_stat.NoRcvBuf++;
                if (!(phba->sli3_options & LPFC_SLI3_HBQ_ENABLED))
@@ -633,7 +634,8 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                /* Check for retry */
                if (vport->fc_ns_retry < LPFC_MAX_NS_RETRY) {
                        if (irsp->ulpStatus != IOSTAT_LOCAL_REJECT ||
-                           irsp->un.ulpWord[4] != IOERR_NO_RESOURCES)
+                           (irsp->un.ulpWord[4] && IOERR_PARAM_MASK) !=
+                           IOERR_NO_RESOURCES)
                                vport->fc_ns_retry++;
 
                        /* CT command is being retried */
@@ -783,7 +785,9 @@ lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                if (cmdiocb->retry < LPFC_MAX_NS_RETRY) {
                        retry = 1;
                        if (irsp->ulpStatus == IOSTAT_LOCAL_REJECT) {
-                               switch (irsp->un.ulpWord[4]) {
+                               switch ((irsp->un.ulpWord[4] &
+                                       IOERR_PARAM_MASK)) {
+
                                case IOERR_NO_RESOURCES:
                                        /* We don't increment the retry
                                         * count for this case.
@@ -908,8 +912,10 @@ lpfc_cmpl_ct(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                                 cmdcode, irsp->ulpStatus, irsp->un.ulpWord[4]);
 
                if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) &&
-                       ((irsp->un.ulpWord[4] == IOERR_SLI_DOWN) ||
-                        (irsp->un.ulpWord[4] == IOERR_SLI_ABORTED)))
+                       (((irsp->un.ulpWord[4] & IOERR_PARAM_MASK) ==
+                         IOERR_SLI_DOWN) ||
+                        ((irsp->un.ulpWord[4] & IOERR_PARAM_MASK) ==
+                         IOERR_SLI_ABORTED)))
                        goto out;
 
                retry = cmdiocb->retry;
index 3c624a5494afde79b3185c44cb6e29adbc7d2a98..a610d9f16233bed5cec097cb672477c37fe84318 100644 (file)
@@ -962,7 +962,8 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                        if ((phba->fcoe_cvl_eventtag_attn ==
                             phba->fcoe_cvl_eventtag) &&
                            (irsp->ulpStatus == IOSTAT_LOCAL_REJECT) &&
-                           (irsp->un.ulpWord[4] == IOERR_SLI_ABORTED))
+                           ((irsp->un.ulpWord[4] & IOERR_PARAM_MASK) ==
+                           IOERR_SLI_ABORTED))
                                goto stop_rr_fcf_flogi;
                        else
                                phba->fcoe_cvl_eventtag_attn =
@@ -1108,8 +1109,10 @@ flogifail:
                /* Start discovery */
                lpfc_disc_start(vport);
        } else if (((irsp->ulpStatus != IOSTAT_LOCAL_REJECT) ||
-                       ((irsp->un.ulpWord[4] != IOERR_SLI_ABORTED) &&
-                       (irsp->un.ulpWord[4] != IOERR_SLI_DOWN))) &&
+                       (((irsp->un.ulpWord[4] & IOERR_PARAM_MASK) !=
+                        IOERR_SLI_ABORTED) &&
+                       ((irsp->un.ulpWord[4] & IOERR_PARAM_MASK) !=
+                        IOERR_SLI_DOWN))) &&
                        (phba->link_state != LPFC_CLEAR_LA)) {
                /* If FLOGI failed enable link interrupt. */
                lpfc_issue_clear_la(phba, vport);
@@ -3025,7 +3028,7 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                }
                break;
        case IOSTAT_LOCAL_REJECT:
-               switch ((irsp->un.ulpWord[4] & 0xff)) {
+               switch ((irsp->un.ulpWord[4] & IOERR_PARAM_MASK)) {
                case IOERR_LOOP_OPEN_FAILURE:
                        if (cmd == ELS_CMD_FLOGI) {
                                if (PCI_DEVICE_ID_HORNET ==
@@ -3232,7 +3235,8 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
 
                if (((cmd == ELS_CMD_PLOGI) || (cmd == ELS_CMD_ADISC)) &&
                        ((irsp->ulpStatus != IOSTAT_LOCAL_REJECT) ||
-                       ((irsp->un.ulpWord[4] & 0xff) != IOERR_NO_RESOURCES))) {
+                       ((irsp->un.ulpWord[4] & IOERR_PARAM_MASK) !=
+                       IOERR_NO_RESOURCES))) {
                        /* Don't reset timer for no resources */
 
                        /* If discovery / RSCN timer is running, reset it */
@@ -6821,7 +6825,8 @@ lpfc_els_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
        if (icmd->ulpStatus == IOSTAT_NEED_BUFFER) {
                lpfc_sli_hbqbuf_add_hbqs(phba, LPFC_ELS_HBQ);
        } else if (icmd->ulpStatus == IOSTAT_LOCAL_REJECT &&
-           (icmd->un.ulpWord[4] & 0xff) == IOERR_RCV_BUFFER_WAITING) {
+                  (icmd->un.ulpWord[4] & IOERR_PARAM_MASK) ==
+                  IOERR_RCV_BUFFER_WAITING) {
                phba->fc_stat.NoRcvBuf++;
                /* Not enough posted buffers; Try posting more buffers */
                if (!(phba->sli3_options & LPFC_SLI3_HBQ_ENABLED))
index 3715baff0748452687f1649483f29919cf203e74..ce6939d3ad6b5cf37968cdfa0554938d5c7218d4 100644 (file)
@@ -3245,6 +3245,7 @@ typedef struct {
 #define IOERR_SLI_DOWN                0x101  /* ulpStatus  - Driver defined */
 #define IOERR_SLI_BRESET              0x102
 #define IOERR_SLI_ABORTED             0x103
+#define IOERR_PARAM_MASK              0x1ff
 } PARM_ERR;
 
 typedef union {
index 0f717c1e0919bef4bae62a3ca5bfa369488f8dfb..d8ffebbd9949ff026baa6f73ec304f3fe24f50c4 100644 (file)
@@ -338,7 +338,7 @@ struct lpfc_cqe {
  * Define mask value for xri_aborted and wcqe completed CQE extended status.
  * Currently, extended status is limited to 9 bits (0x0 -> 0x103) .
  */
-#define WCQE_PARAM_MASK                0x1FF;
+#define WCQE_PARAM_MASK                0x1FF
 
 /* completion queue entry for wqe completions */
 struct lpfc_wcqe_complete {
index 1b684a12eb8000d540ef13e90a3a0e8b796d1205..3a1b234a67c1b07abe850a097b747eca8a7a67f0 100644 (file)
@@ -3606,7 +3606,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
        cmd = lpfc_cmd->pCmd;
        shost = cmd->device->host;
 
-       lpfc_cmd->result = pIocbOut->iocb.un.ulpWord[4];
+       lpfc_cmd->result = (pIocbOut->iocb.un.ulpWord[4] & IOERR_PARAM_MASK);
        lpfc_cmd->status = pIocbOut->iocb.ulpStatus;
        /* pick up SLI4 exhange busy status from HBA */
        lpfc_cmd->exch_busy = pIocbOut->iocb_flag & LPFC_EXCHANGE_BUSY;
index aaa3d2dd9f356b2df01e86dc012b629eb368991d..4643403b4690d10c585721d64e02680afff76ec4 100644 (file)
@@ -2916,7 +2916,8 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba,
                         * queuedepths of the SCSI device.
                         */
                        if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) &&
-                               (irsp->un.ulpWord[4] == IOERR_NO_RESOURCES)) {
+                           ((irsp->un.ulpWord[4] & IOERR_PARAM_MASK) ==
+                            IOERR_NO_RESOURCES)) {
                                spin_unlock_irqrestore(&phba->hbalock, iflag);
                                phba->lpfc_rampdown_queue_depth(phba);
                                spin_lock_irqsave(&phba->hbalock, iflag);
@@ -3087,7 +3088,8 @@ lpfc_sli_sp_handle_rspiocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
                 * queuedepths of the SCSI device.
                 */
                if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) &&
-                   (irsp->un.ulpWord[4] == IOERR_NO_RESOURCES)) {
+                   ((irsp->un.ulpWord[4] & IOERR_PARAM_MASK) ==
+                    IOERR_NO_RESOURCES)) {
                        spin_unlock_irqrestore(&phba->hbalock, iflag);
                        phba->lpfc_rampdown_queue_depth(phba);
                        spin_lock_irqsave(&phba->hbalock, iflag);
@@ -8590,7 +8592,7 @@ lpfc_sli4_abts_err_handler(struct lpfc_hba *phba,
         * LOCAL_REJECT and 0 for a failed ABTS exchange and later OCe and
         * LPe FW releases returned LOCAL_REJECT and SEQUENCE_TIMEOUT.
         */
-       ext_status = axri->parameter & WCQE_PARAM_MASK;
+       ext_status = axri->parameter & IOERR_PARAM_MASK;
        if ((bf_get(lpfc_wcqe_xa_status, axri) == IOSTAT_LOCAL_REJECT) &&
            ((ext_status == IOERR_SEQUENCE_TIMEOUT) || (ext_status == 0)))
                lpfc_sli_abts_recover_port(vport, ndlp);
@@ -11513,11 +11515,12 @@ lpfc_sli4_fp_handle_fcp_wcqe(struct lpfc_hba *phba,
                /* If resource errors reported from HBA, reduce queue
                 * depth of the SCSI device.
                 */
-               if ((bf_get(lpfc_wcqe_c_status, wcqe) ==
-                    IOSTAT_LOCAL_REJECT) &&
-                   (wcqe->parameter == IOERR_NO_RESOURCES)) {
+               if (((bf_get(lpfc_wcqe_c_status, wcqe) ==
+                    IOSTAT_LOCAL_REJECT)) &&
+                   ((wcqe->parameter & IOERR_PARAM_MASK) ==
+                    IOERR_NO_RESOURCES))
                        phba->lpfc_rampdown_queue_depth(phba);
-               }
+
                /* Log the error status */
                lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
                                "0373 FCP complete error: status=x%x, "