]> git.ipfire.org Git - thirdparty/kernel/stable.git/blobdiff - drivers/scsi/lpfc/lpfc.h
scsi: lpfc: Introduce FC_RSCN_MEMENTO flag for tracking post RSCN completion
[thirdparty/kernel/stable.git] / drivers / scsi / lpfc / lpfc.h
index a1e0a106c132bd4d2ba64bd60e380256826cf716..a62cf1a19280836a5a20f80a1aa2608b71fa3f68 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2017-2021 Broadcom. All Rights Reserved. The term *
+ * Copyright (C) 2017-2022 Broadcom. All Rights Reserved. The term *
  * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.     *
  * Copyright (C) 2004-2016 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
@@ -592,6 +592,7 @@ struct lpfc_vport {
 #define FC_VPORT_LOGO_RCVD      0x200    /* LOGO received on vport */
 #define FC_RSCN_DISCOVERY       0x400   /* Auth all devices after RSCN */
 #define FC_LOGO_RCVD_DID_CHNG   0x800    /* FDISC on phys port detect DID chng*/
+#define FC_PT2PT_NO_NVME        0x1000   /* Don't send NVME PRLI */
 #define FC_SCSI_SCAN_TMO        0x4000  /* scsi scan timer running */
 #define FC_ABORT_DISCOVERY      0x8000  /* we want to abort discovery */
 #define FC_NDISC_ACTIVE         0x10000         /* NPort discovery active */
@@ -603,6 +604,7 @@ struct lpfc_vport {
 #define FC_VFI_REGISTERED      0x800000 /* VFI is registered */
 #define FC_FDISC_COMPLETED     0x1000000/* FDISC completed */
 #define FC_DISC_DELAYED                0x2000000/* Delay NPort discovery */
+#define FC_RSCN_MEMENTO                0x4000000/* RSCN cmd processed */
 
        uint32_t ct_flags;
 #define FC_CT_RFF_ID           0x1      /* RFF_ID accepted by switch */
@@ -896,6 +898,11 @@ enum lpfc_irq_chann_mode {
        NHT_MODE,
 };
 
+enum lpfc_hba_bit_flags {
+       FABRIC_COMANDS_BLOCKED,
+       HBA_PCI_ERR,
+};
+
 struct lpfc_hba {
        /* SCSI interface function jump table entries */
        struct lpfc_io_buf * (*lpfc_get_scsi_buf)
@@ -916,6 +923,10 @@ struct lpfc_hba {
                (struct lpfc_vport *vport,
                 struct lpfc_io_buf *lpfc_cmd,
                 uint8_t tmo);
+       int (*lpfc_scsi_prep_task_mgmt_cmd)
+               (struct lpfc_vport *vport,
+                struct lpfc_io_buf *lpfc_cmd,
+                u64 lun, u8 task_mgmt_cmd);
 
        /* IOCB interface function jump table entries */
        int (*__lpfc_sli_issue_iocb)
@@ -927,8 +938,6 @@ struct lpfc_hba {
        void (*__lpfc_sli_release_iocbq)(struct lpfc_hba *,
                         struct lpfc_iocbq *);
        int (*lpfc_hba_down_post)(struct lpfc_hba *phba);
-       IOCB_t * (*lpfc_get_iocb_from_iocbq)
-               (struct lpfc_iocbq *);
        void (*lpfc_scsi_cmd_iocb_cmpl)
                (struct lpfc_hba *, struct lpfc_iocbq *, struct lpfc_iocbq *);
 
@@ -961,7 +970,23 @@ struct lpfc_hba {
 
        int (*lpfc_bg_scsi_prep_dma_buf)
                (struct lpfc_hba *, struct lpfc_io_buf *);
-       /* Add new entries here */
+
+       /* Prep SLI WQE/IOCB jump table entries */
+       void (*__lpfc_sli_prep_els_req_rsp)(struct lpfc_iocbq *cmdiocbq,
+                                           struct lpfc_vport *vport,
+                                           struct lpfc_dmabuf *bmp,
+                                           u16 cmd_size, u32 did, u32 elscmd,
+                                           u8 tmo, u8 expect_rsp);
+       void (*__lpfc_sli_prep_gen_req)(struct lpfc_iocbq *cmdiocbq,
+                                       struct lpfc_dmabuf *bmp, u16 rpi,
+                                       u32 num_entry, u8 tmo);
+       void (*__lpfc_sli_prep_xmit_seq64)(struct lpfc_iocbq *cmdiocbq,
+                                          struct lpfc_dmabuf *bmp, u16 rpi,
+                                          u16 ox_id, u32 num_entry, u8 rctl,
+                                          u8 last_seq, u8 cr_cx_cmd);
+       void (*__lpfc_sli_prep_abort_xri)(struct lpfc_iocbq *cmdiocbq,
+                                         u16 ulp_context, u16 iotag,
+                                         u8 ulp_class, u16 cqid, bool ia);
 
        /* expedite pool */
        struct lpfc_epd_pool epd_pool;
@@ -1024,7 +1049,6 @@ struct lpfc_hba {
                                         * Firmware supports Forced Link Speed
                                         * capability
                                         */
-#define HBA_PCI_ERR            0x80000 /* The PCI slot is offline */
 #define HBA_FLOGI_ISSUED       0x100000 /* FLOGI was issued */
 #define HBA_SHORT_CMF          0x200000 /* shorter CMF timer routine */
 #define HBA_CGN_DAY_WRAP       0x400000 /* HBA Congestion info day wraps */
@@ -1135,8 +1159,6 @@ struct lpfc_hba {
        uint32_t cfg_nvme_seg_cnt;
        uint32_t cfg_scsi_seg_cnt;
        uint32_t cfg_sg_dma_buf_size;
-       uint64_t cfg_soft_wwnn;
-       uint64_t cfg_soft_wwpn;
        uint32_t cfg_hba_queue_depth;
        uint32_t cfg_enable_hba_reset;
        uint32_t cfg_enable_hba_heartbeat;
@@ -1268,7 +1290,6 @@ struct lpfc_hba {
 #define VPD_PORT            0x8         /* valid vpd port data */
 #define VPD_MASK            0xf         /* mask for any vpd data */
 
-       uint8_t soft_wwn_enable;
 
        struct timer_list fcp_poll_timer;
        struct timer_list eratt_poll;
@@ -1334,7 +1355,6 @@ struct lpfc_hba {
        atomic_t fabric_iocb_count;
        struct timer_list fabric_block_timer;
        unsigned long bit_flags;
-#define        FABRIC_COMANDS_BLOCKED  0
        atomic_t num_rsrc_err;
        atomic_t num_cmd_success;
        unsigned long last_rsrc_error_time;
@@ -1800,3 +1820,75 @@ static inline int lpfc_is_vmid_enabled(struct lpfc_hba *phba)
 {
        return phba->cfg_vmid_app_header || phba->cfg_vmid_priority_tagging;
 }
+
+static inline
+u8 get_job_ulpstatus(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
+{
+       if (phba->sli_rev == LPFC_SLI_REV4)
+               return bf_get(lpfc_wcqe_c_status, &iocbq->wcqe_cmpl);
+       else
+               return iocbq->iocb.ulpStatus;
+}
+
+static inline
+u32 get_job_word4(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
+{
+       if (phba->sli_rev == LPFC_SLI_REV4)
+               return iocbq->wcqe_cmpl.parameter;
+       else
+               return iocbq->iocb.un.ulpWord[4];
+}
+
+static inline
+u8 get_job_cmnd(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
+{
+       if (phba->sli_rev == LPFC_SLI_REV4)
+               return bf_get(wqe_cmnd, &iocbq->wqe.generic.wqe_com);
+       else
+               return iocbq->iocb.ulpCommand;
+}
+
+static inline
+u16 get_job_ulpcontext(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
+{
+       if (phba->sli_rev == LPFC_SLI_REV4)
+               return bf_get(wqe_ctxt_tag, &iocbq->wqe.generic.wqe_com);
+       else
+               return iocbq->iocb.ulpContext;
+}
+
+static inline
+u16 get_job_rcvoxid(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
+{
+       if (phba->sli_rev == LPFC_SLI_REV4)
+               return bf_get(wqe_rcvoxid, &iocbq->wqe.generic.wqe_com);
+       else
+               return iocbq->iocb.unsli3.rcvsli3.ox_id;
+}
+
+static inline
+u32 get_job_data_placed(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
+{
+       if (phba->sli_rev == LPFC_SLI_REV4)
+               return iocbq->wcqe_cmpl.total_data_placed;
+       else
+               return iocbq->iocb.un.genreq64.bdl.bdeSize;
+}
+
+static inline
+u32 get_job_abtsiotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
+{
+       if (phba->sli_rev == LPFC_SLI_REV4)
+               return iocbq->wqe.abort_cmd.wqe_com.abort_tag;
+       else
+               return iocbq->iocb.un.acxri.abortIoTag;
+}
+
+static inline
+u32 get_job_els_rsp64_did(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
+{
+       if (phba->sli_rev == LPFC_SLI_REV4)
+               return bf_get(wqe_els_did, &iocbq->wqe.els_req.wqe_dest);
+       else
+               return iocbq->iocb.un.elsreq64.remoteID;
+}