scsi: lpfc: Remove handler for obsolete ELS - Read Port Status (RPS)
authorJames Smart <jsmart2021@gmail.com>
Tue, 28 Jan 2020 00:23:08 +0000 (16:23 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 11 Feb 2020 03:46:56 +0000 (22:46 -0500)
There was report of an odd "Fix me..." log message, which was tracked down
to the lpfc_els_rcv_rps() routine. This was in handling of a very old and
obsolete ELS - Read Port Status. The RPS ELS was defined in FC-LS-1, but
deprecated in FC-LS-2, and removed from all later FC-LS revisions. It was
replaced by the Read Diagnostic Parameters (RDP) ELS and the Link Error
Status Block descriptor.

There should be no support for the RSP ELS.  Remove support from driver.

Link: https://lore.kernel.org/r/20200128002312.16346-9-jsmart2021@gmail.com
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc.h
drivers/scsi/lpfc/lpfc_els.c
drivers/scsi/lpfc/lpfc_hw.h

index 3f2cb17..cebbad1 100644 (file)
@@ -262,7 +262,6 @@ struct lpfc_stats {
        uint32_t elsRcvPRLI;
        uint32_t elsRcvLIRR;
        uint32_t elsRcvRLS;
-       uint32_t elsRcvRPS;
        uint32_t elsRcvRPL;
        uint32_t elsRcvRRQ;
        uint32_t elsRcvRTV;
index 42a2bf3..371599d 100644 (file)
@@ -7135,108 +7135,12 @@ lpfc_els_rsp_rls_acc(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
 }
 
 /**
- * lpfc_els_rsp_rps_acc - Completion callbk func for MBX_READ_LNK_STAT mbox cmd
- * @phba: pointer to lpfc hba data structure.
- * @pmb: pointer to the driver internal queue element for mailbox command.
- *
- * This routine is the completion callback function for the MBX_READ_LNK_STAT
- * mailbox command. This callback function is to actually send the Accept
- * (ACC) response to a Read Port Status (RPS) unsolicited IOCB event. It
- * collects the link statistics from the completion of the MBX_READ_LNK_STAT
- * mailbox command, constructs the RPS response with the link statistics
- * collected, and then invokes the lpfc_sli_issue_iocb() routine to send ACC
- * response to the RPS.
- *
- * Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp
- * will be incremented by 1 for holding the ndlp and the reference to ndlp
- * will be stored into the context1 field of the IOCB for the completion
- * callback function to the RPS Accept Response ELS IOCB command.
- *
- **/
-static void
-lpfc_els_rsp_rps_acc(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
-{
-       MAILBOX_t *mb;
-       IOCB_t *icmd;
-       RPS_RSP *rps_rsp;
-       uint8_t *pcmd;
-       struct lpfc_iocbq *elsiocb;
-       struct lpfc_nodelist *ndlp;
-       uint16_t status;
-       uint16_t oxid;
-       uint16_t rxid;
-       uint32_t cmdsize;
-
-       mb = &pmb->u.mb;
-
-       ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp;
-       rxid = (uint16_t)((unsigned long)(pmb->ctx_buf) & 0xffff);
-       oxid = (uint16_t)(((unsigned long)(pmb->ctx_buf) >> 16) & 0xffff);
-       pmb->ctx_ndlp = NULL;
-       pmb->ctx_buf = NULL;
-
-       if (mb->mbxStatus) {
-               mempool_free(pmb, phba->mbox_mem_pool);
-               return;
-       }
-
-       cmdsize = sizeof(RPS_RSP) + sizeof(uint32_t);
-       mempool_free(pmb, phba->mbox_mem_pool);
-       elsiocb = lpfc_prep_els_iocb(phba->pport, 0, cmdsize,
-                                    lpfc_max_els_tries, ndlp,
-                                    ndlp->nlp_DID, ELS_CMD_ACC);
-
-       /* Decrement the ndlp reference count from previous mbox command */
-       lpfc_nlp_put(ndlp);
-
-       if (!elsiocb)
-               return;
-
-       icmd = &elsiocb->iocb;
-       icmd->ulpContext = rxid;
-       icmd->unsli3.rcvsli3.ox_id = oxid;
-
-       pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt);
-       *((uint32_t *) (pcmd)) = ELS_CMD_ACC;
-       pcmd += sizeof(uint32_t); /* Skip past command */
-       rps_rsp = (RPS_RSP *)pcmd;
-
-       if (phba->fc_topology != LPFC_TOPOLOGY_LOOP)
-               status = 0x10;
-       else
-               status = 0x8;
-       if (phba->pport->fc_flag & FC_FABRIC)
-               status |= 0x4;
-
-       rps_rsp->rsvd1 = 0;
-       rps_rsp->portStatus = cpu_to_be16(status);
-       rps_rsp->linkFailureCnt = cpu_to_be32(mb->un.varRdLnk.linkFailureCnt);
-       rps_rsp->lossSyncCnt = cpu_to_be32(mb->un.varRdLnk.lossSyncCnt);
-       rps_rsp->lossSignalCnt = cpu_to_be32(mb->un.varRdLnk.lossSignalCnt);
-       rps_rsp->primSeqErrCnt = cpu_to_be32(mb->un.varRdLnk.primSeqErrCnt);
-       rps_rsp->invalidXmitWord = cpu_to_be32(mb->un.varRdLnk.invalidXmitWord);
-       rps_rsp->crcCnt = cpu_to_be32(mb->un.varRdLnk.crcCnt);
-       /* Xmit ELS RPS ACC response tag <ulpIoTag> */
-       lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_ELS,
-                        "0118 Xmit ELS RPS ACC response tag x%x xri x%x, "
-                        "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n",
-                        elsiocb->iotag, elsiocb->iocb.ulpContext,
-                        ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
-                        ndlp->nlp_rpi);
-       elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp;
-       phba->fc_stat.elsXmitACC++;
-       if (lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, elsiocb, 0) == IOCB_ERROR)
-               lpfc_els_free_iocb(phba, elsiocb);
-       return;
-}
-
-/**
  * lpfc_els_rcv_rls - Process an unsolicited rls iocb
  * @vport: pointer to a host virtual N_Port data structure.
  * @cmdiocb: pointer to lpfc command iocb data structure.
  * @ndlp: pointer to a node-list data structure.
  *
- * This routine processes Read Port Status (RPL) IOCB received as an
+ * This routine processes Read Link Status (RLS) IOCB received as an
  * ELS unsolicited event. It first checks the remote port state. If the
  * remote port is not in NLP_STE_UNMAPPED_NODE state or NLP_STE_MAPPED_NODE
  * state, it invokes the lpfc_els_rsl_reject() routine to send the reject
@@ -7258,7 +7162,7 @@ lpfc_els_rcv_rls(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
 
        if ((ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) &&
            (ndlp->nlp_state != NLP_STE_MAPPED_NODE))
-               /* reject the unsolicited RPS request and done with it */
+               /* reject the unsolicited RLS request and done with it */
                goto reject_out;
 
        mbox = mempool_alloc(phba->mbox_mem_pool, GFP_ATOMIC);
@@ -7306,7 +7210,7 @@ reject_out:
  * Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp
  * will be incremented by 1 for holding the ndlp and the reference to ndlp
  * will be stored into the context1 field of the IOCB for the completion
- * callback function to the RPS Accept Response ELS IOCB command.
+ * callback function to the RTV Accept Response ELS IOCB command.
  *
  * Return codes
  *   0 - Successfully processed rtv iocb (currently always return 0)
@@ -7325,7 +7229,7 @@ lpfc_els_rcv_rtv(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
 
        if ((ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) &&
            (ndlp->nlp_state != NLP_STE_MAPPED_NODE))
-               /* reject the unsolicited RPS request and done with it */
+               /* reject the unsolicited RTV request and done with it */
                goto reject_out;
 
        cmdsize = sizeof(struct RTV_RSP) + sizeof(uint32_t);
@@ -7378,84 +7282,7 @@ reject_out:
        return 0;
 }
 
-/* lpfc_els_rcv_rps - Process an unsolicited rps iocb
- * @vport: pointer to a host virtual N_Port data structure.
- * @cmdiocb: pointer to lpfc command iocb data structure.
- * @ndlp: pointer to a node-list data structure.
- *
- * This routine processes Read Port Status (RPS) IOCB received as an
- * ELS unsolicited event. It first checks the remote port state. If the
- * remote port is not in NLP_STE_UNMAPPED_NODE state or NLP_STE_MAPPED_NODE
- * state, it invokes the lpfc_els_rsp_reject() routine to send the reject
- * response. Otherwise, it issue the MBX_READ_LNK_STAT mailbox command
- * for reading the HBA link statistics. It is for the callback function,
- * lpfc_els_rsp_rps_acc(), set to the MBX_READ_LNK_STAT mailbox command
- * to actually sending out RPS Accept (ACC) response.
- *
- * Return codes
- *   0 - Successfully processed rps iocb (currently always return 0)
- **/
-static int
-lpfc_els_rcv_rps(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
-                struct lpfc_nodelist *ndlp)
-{
-       struct lpfc_hba *phba = vport->phba;
-       uint32_t *lp;
-       uint8_t flag;
-       LPFC_MBOXQ_t *mbox;
-       struct lpfc_dmabuf *pcmd;
-       RPS *rps;
-       struct ls_rjt stat;
-
-       if ((ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) &&
-           (ndlp->nlp_state != NLP_STE_MAPPED_NODE))
-               /* reject the unsolicited RPS request and done with it */
-               goto reject_out;
-
-       pcmd = (struct lpfc_dmabuf *) cmdiocb->context2;
-       lp = (uint32_t *) pcmd->virt;
-       flag = (be32_to_cpu(*lp++) & 0xf);
-       rps = (RPS *) lp;
-
-       if ((flag == 0) ||
-           ((flag == 1) && (be32_to_cpu(rps->un.portNum) == 0)) ||
-           ((flag == 2) && (memcmp(&rps->un.portName, &vport->fc_portname,
-                                   sizeof(struct lpfc_name)) == 0))) {
-
-               printk("Fix me....\n");
-               dump_stack();
-               mbox = mempool_alloc(phba->mbox_mem_pool, GFP_ATOMIC);
-               if (mbox) {
-                       lpfc_read_lnk_stat(phba, mbox);
-                       mbox->ctx_buf = (void *)((unsigned long)
-                               ((cmdiocb->iocb.unsli3.rcvsli3.ox_id << 16) |
-                               cmdiocb->iocb.ulpContext)); /* rx_id */
-                       mbox->ctx_ndlp = lpfc_nlp_get(ndlp);
-                       mbox->vport = vport;
-                       mbox->mbox_cmpl = lpfc_els_rsp_rps_acc;
-                       if (lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT)
-                               != MBX_NOT_FINISHED)
-                               /* Mbox completion will send ELS Response */
-                               return 0;
-                       /* Decrement reference count used for the failed mbox
-                        * command.
-                        */
-                       lpfc_nlp_put(ndlp);
-                       mempool_free(mbox, phba->mbox_mem_pool);
-               }
-       }
-
-reject_out:
-       /* issue rejection response */
-       stat.un.b.lsRjtRsvd0 = 0;
-       stat.un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC;
-       stat.un.b.lsRjtRsnCodeExp = LSEXP_CANT_GIVE_DATA;
-       stat.un.b.vendorUnique = 0;
-       lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp, NULL);
-       return 0;
-}
-
-/* lpfc_issue_els_rrq - Process an unsolicited rps iocb
+/* lpfc_issue_els_rrq - Process an unsolicited rrq iocb
  * @vport: pointer to a host virtual N_Port data structure.
  * @ndlp: pointer to a node-list data structure.
  * @did: DID of the target.
@@ -8632,16 +8459,6 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
                if (newnode)
                        lpfc_nlp_put(ndlp);
                break;
-       case ELS_CMD_RPS:
-               lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL,
-                       "RCV RPS:         did:x%x/ste:x%x flg:x%x",
-                       did, vport->port_state, ndlp->nlp_flag);
-
-               phba->fc_stat.elsRcvRPS++;
-               lpfc_els_rcv_rps(vport, elsiocb, ndlp);
-               if (newnode)
-                       lpfc_nlp_put(ndlp);
-               break;
        case ELS_CMD_RPL:
                lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL,
                        "RCV RPL:         did:x%x/ste:x%x flg:x%x",
index b5642c8..9a59790 100644 (file)
@@ -597,7 +597,6 @@ struct fc_vft_header {
 #define ELS_CMD_ADISC     0x52000000
 #define ELS_CMD_FARP      0x54000000
 #define ELS_CMD_FARPR     0x55000000
-#define ELS_CMD_RPS       0x56000000
 #define ELS_CMD_RPL       0x57000000
 #define ELS_CMD_FAN       0x60000000
 #define ELS_CMD_RSCN      0x61040000
@@ -639,7 +638,6 @@ struct fc_vft_header {
 #define ELS_CMD_ADISC     0x52
 #define ELS_CMD_FARP      0x54
 #define ELS_CMD_FARPR     0x55
-#define ELS_CMD_RPS       0x56
 #define ELS_CMD_RPL       0x57
 #define ELS_CMD_FAN       0x60
 #define ELS_CMD_RSCN      0x0461
@@ -919,24 +917,6 @@ typedef struct _RNID {             /* Structure is in Big Endian format */
        } un;
 } __packed RNID;
 
-typedef struct  _RPS {         /* Structure is in Big Endian format */
-       union {
-               uint32_t portNum;
-               struct lpfc_name portName;
-       } un;
-} RPS;
-
-typedef struct  _RPS_RSP {     /* Structure is in Big Endian format */
-       uint16_t rsvd1;
-       uint16_t portStatus;
-       uint32_t linkFailureCnt;
-       uint32_t lossSyncCnt;
-       uint32_t lossSignalCnt;
-       uint32_t primSeqErrCnt;
-       uint32_t invalidXmitWord;
-       uint32_t crcCnt;
-} RPS_RSP;
-
 struct RLS {                   /* Structure is in Big Endian format */
        uint32_t rls;
 #define rls_rsvd_SHIFT         24