qla2xxx: Added interface to send explicit LOGO.
[cascardo/linux.git] / drivers / scsi / qla2xxx / qla_def.h
index 9ad819e..83d2251 100644 (file)
 #define RESPONSE_ENTRY_CNT_MQ          128     /* Number of response entries.*/
 #define ATIO_ENTRY_CNT_24XX            4096    /* Number of ATIO entries. */
 #define RESPONSE_ENTRY_CNT_FX00                256     /* Number of response entries.*/
+#define EXTENDED_EXCH_ENTRY_CNT                32768   /* Entries for offload case */
 
 struct req_que;
 struct qla_tgt_sess;
@@ -309,6 +310,14 @@ struct srb_cmd {
 /* To identify if a srb is of T10-CRC type. @sp => srb_t pointer */
 #define IS_PROT_IO(sp) (sp->flags & SRB_CRC_CTX_DSD_VALID)
 
+struct els_logo_payload {
+       uint8_t opcode;
+       uint8_t rsvd[3];
+       uint8_t s_id[3];
+       uint8_t rsvd1[1];
+       uint8_t wwpn[WWN_SIZE];
+};
+
 /*
  * SRB extensions.
  */
@@ -322,6 +331,15 @@ struct srb_iocb {
                        uint16_t data[2];
                } logio;
                struct {
+#define ELS_DCMD_TIMEOUT 20
+#define ELS_DCMD_LOGO 0x5
+                       uint32_t flags;
+                       uint32_t els_cmd;
+                       struct completion comp;
+                       struct els_logo_payload *els_logo_pyld;
+                       dma_addr_t els_logo_pyld_dma;
+               } els_logo;
+               struct {
                        /*
                         * Values for flags field below are as
                         * defined in tsk_mgmt_entry struct
@@ -382,7 +400,7 @@ struct srb_iocb {
 #define SRB_FXIOCB_DCMD        10
 #define SRB_FXIOCB_BCMD        11
 #define SRB_ABT_CMD    12
-
+#define SRB_ELS_DCMD   13
 
 typedef struct srb {
        atomic_t ref_count;
@@ -891,6 +909,7 @@ struct mbx_cmd_32 {
 #define MBC_DISABLE_VI                 0x24    /* Disable VI operation. */
 #define MBC_ENABLE_VI                  0x25    /* Enable VI operation. */
 #define MBC_GET_FIRMWARE_OPTION                0x28    /* Get Firmware Options. */
+#define MBC_GET_MEM_OFFLOAD_CNTRL_STAT 0x34    /* Memory Offload ctrl/Stat*/
 #define MBC_SET_FIRMWARE_OPTION                0x38    /* Set Firmware Options. */
 #define MBC_LOOP_PORT_BYPASS           0x40    /* Loop Port Bypass. */
 #define MBC_LOOP_PORT_ENABLE           0x41    /* Loop Port Enable. */
@@ -2915,7 +2934,7 @@ struct qlt_hw_data {
 #define MAX_QFULL_CMDS_ALLOC   8192
 #define Q_FULL_THRESH_HOLD_PERCENT 90
 #define Q_FULL_THRESH_HOLD(ha) \
-       ((ha->fw_xcb_count/100) * Q_FULL_THRESH_HOLD_PERCENT)
+       ((ha->cur_fw_xcb_count/100) * Q_FULL_THRESH_HOLD_PERCENT)
 
 #define LEAK_EXCHG_THRESH_HOLD_PERCENT 75      /* 75 percent */
 
@@ -2962,10 +2981,12 @@ struct qla_hw_data {
                uint32_t        isp82xx_no_md_cap:1;
                uint32_t        host_shutting_down:1;
                uint32_t        idc_compl_status:1;
-
                uint32_t        mr_reset_hdlr_active:1;
                uint32_t        mr_intr_valid:1;
+
                uint32_t        fawwpn_enabled:1;
+               uint32_t        exlogins_enabled:1;
+               uint32_t        exchoffld_enabled:1;
                /* 35 bits */
        } flags;
 
@@ -3061,6 +3082,7 @@ struct qla_hw_data {
 #define PCI_DEVICE_ID_QLOGIC_ISP2031   0x2031
 #define PCI_DEVICE_ID_QLOGIC_ISP2071   0x2071
 #define PCI_DEVICE_ID_QLOGIC_ISP2271   0x2271
+#define PCI_DEVICE_ID_QLOGIC_ISP2261   0x2261
 
        uint32_t        device_type;
 #define DT_ISP2100                      BIT_0
@@ -3084,7 +3106,8 @@ struct qla_hw_data {
 #define DT_ISP8044                     BIT_18
 #define DT_ISP2071                     BIT_19
 #define DT_ISP2271                     BIT_20
-#define DT_ISP_LAST                    (DT_ISP2271 << 1)
+#define DT_ISP2261                     BIT_21
+#define DT_ISP_LAST                    (DT_ISP2261 << 1)
 
 #define DT_T10_PI                       BIT_25
 #define DT_IIDMA                        BIT_26
@@ -3116,6 +3139,7 @@ struct qla_hw_data {
 #define IS_QLAFX00(ha) (DT_MASK(ha) & DT_ISPFX00)
 #define IS_QLA2071(ha) (DT_MASK(ha) & DT_ISP2071)
 #define IS_QLA2271(ha) (DT_MASK(ha) & DT_ISP2271)
+#define IS_QLA2261(ha) (DT_MASK(ha) & DT_ISP2261)
 
 #define IS_QLA23XX(ha)  (IS_QLA2300(ha) || IS_QLA2312(ha) || IS_QLA2322(ha) || \
                        IS_QLA6312(ha) || IS_QLA6322(ha))
@@ -3124,7 +3148,7 @@ struct qla_hw_data {
 #define IS_QLA25XX(ha)  (IS_QLA2532(ha))
 #define IS_QLA83XX(ha) (IS_QLA2031(ha) || IS_QLA8031(ha))
 #define IS_QLA84XX(ha)  (IS_QLA8432(ha))
-#define IS_QLA27XX(ha)  (IS_QLA2071(ha) || IS_QLA2271(ha))
+#define IS_QLA27XX(ha)  (IS_QLA2071(ha) || IS_QLA2271(ha) || IS_QLA2261(ha))
 #define IS_QLA24XX_TYPE(ha)     (IS_QLA24XX(ha) || IS_QLA54XX(ha) || \
                                IS_QLA84XX(ha))
 #define IS_CNA_CAPABLE(ha)     (IS_QLA81XX(ha) || IS_QLA82XX(ha) || \
@@ -3166,6 +3190,7 @@ struct qla_hw_data {
 #define IS_TGT_MODE_CAPABLE(ha)        (ha->tgt.atio_q_length)
 #define IS_SHADOW_REG_CAPABLE(ha)  (IS_QLA27XX(ha))
 #define IS_DPORT_CAPABLE(ha)  (IS_QLA83XX(ha) || IS_QLA27XX(ha))
+#define IS_FAWWN_CAPABLE(ha)   (IS_QLA83XX(ha) || IS_QLA27XX(ha))
 
        /* HBA serial number */
        uint8_t         serial0;
@@ -3233,6 +3258,21 @@ struct qla_hw_data {
        void            *async_pd;
        dma_addr_t      async_pd_dma;
 
+#define ENABLE_EXTENDED_LOGIN  BIT_7
+
+       /* Extended Logins  */
+       void            *exlogin_buf;
+       dma_addr_t      exlogin_buf_dma;
+       int             exlogin_size;
+
+#define ENABLE_EXCHANGE_OFFLD  BIT_2
+
+       /* Exchange Offload */
+       void            *exchoffld_buf;
+       dma_addr_t      exchoffld_buf_dma;
+       int             exchoffld_size;
+       int             exchoffld_count;
+
        void            *swl;
 
        /* These are used by mailbox operations. */
@@ -3275,8 +3315,14 @@ struct qla_hw_data {
 #define RISC_START_ADDRESS_2100 0x1000
 #define RISC_START_ADDRESS_2300 0x800
 #define RISC_START_ADDRESS_2400 0x100000
-       uint16_t        fw_xcb_count;
-       uint16_t        fw_iocb_count;
+
+       uint16_t        orig_fw_tgt_xcb_count;
+       uint16_t        cur_fw_tgt_xcb_count;
+       uint16_t        orig_fw_xcb_count;
+       uint16_t        cur_fw_xcb_count;
+       uint16_t        orig_fw_iocb_count;
+       uint16_t        cur_fw_iocb_count;
+       uint16_t        fw_max_fcf_count;
 
        uint32_t        fw_shared_ram_start;
        uint32_t        fw_shared_ram_end;
@@ -3288,6 +3334,7 @@ struct qla_hw_data {
        uint8_t         mpi_version[3];
        uint32_t        mpi_capabilities;
        uint8_t         phy_version[3];
+       uint8_t         pep_version[3];
 
        /* Firmware dump template */
        void            *fw_dump_template;
@@ -3318,6 +3365,9 @@ struct qla_hw_data {
        uint32_t        chain_offset;
        struct dentry *dfs_dir;
        struct dentry *dfs_fce;
+       struct dentry *dfs_tgt_counters;
+       struct dentry *dfs_fw_resource_cnt;
+
        dma_addr_t      fce_dma;
        void            *fce;
        uint32_t        fce_bufs;
@@ -3420,9 +3470,9 @@ struct qla_hw_data {
        mempool_t       *ctx_mempool;
 #define FCP_CMND_DMA_POOL_SIZE 512
 
-       unsigned long   nx_pcibase;             /* Base I/O address */
-       uint8_t         *nxdb_rd_ptr;           /* Doorbell read pointer */
-       unsigned long   nxdb_wr_ptr;            /* Door bell write pointer */
+       void __iomem    *nx_pcibase;            /* Base I/O address */
+       void __iomem    *nxdb_rd_ptr;           /* Doorbell read pointer */
+       void __iomem    *nxdb_wr_ptr;           /* Door bell write pointer */
 
        uint32_t        crb_win;
        uint32_t        curr_window;
@@ -3475,6 +3525,18 @@ struct qla_hw_data {
        int     allow_cna_fw_dump;
 };
 
+struct qla_tgt_counters {
+       uint64_t qla_core_sbt_cmd;
+       uint64_t core_qla_que_buf;
+       uint64_t qla_core_ret_ctio;
+       uint64_t core_qla_snd_status;
+       uint64_t qla_core_ret_sta_ctio;
+       uint64_t core_qla_free_cmd;
+       uint64_t num_q_full_sent;
+       uint64_t num_alloc_iocb_failed;
+       uint64_t num_term_xchg_sent;
+};
+
 /*
  * Qlogic scsi host structure
  */
@@ -3627,6 +3689,7 @@ typedef struct scsi_qla_host {
 
        atomic_t        vref_count;
        struct qla8044_reset_template reset_tmplt;
+       struct qla_tgt_counters tgt_counters;
 } scsi_qla_host_t;
 
 #define SET_VP_IDX     1