diff options
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_def.h')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_def.h | 182 |
1 files changed, 153 insertions, 29 deletions
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index eddbc1218a39..0730b10b4280 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -37,6 +37,7 @@ #include "qla_bsg.h" #include "qla_nx.h" #include "qla_nx2.h" +#include "qla_nvme.h" #define QLA2XXX_DRIVER_NAME "qla2xxx" #define QLA2XXX_APIDEV "ql2xapidev" #define QLA2XXX_MANUFACTURER "QLogic Corporation" @@ -252,6 +253,8 @@ #define NPH_F_PORT 0x7fe /* FFFFFE */ #define NPH_IP_BROADCAST 0x7ff /* FFFFFF */ +#define NPH_SNS_LID(ha) (IS_FWI2_CAPABLE(ha) ? NPH_SNS : SIMPLE_NAME_SERVER) + #define MAX_CMDSZ 16 /* SCSI maximum CDB size. */ #include "qla_fw.h" @@ -284,7 +287,7 @@ struct name_list_extended { #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 */ +#define FW_DEF_EXCHANGES_CNT 2048 struct req_que; struct qla_tgt_sess; @@ -341,6 +344,7 @@ struct srb_iocb { #define SRB_LOGIN_RETRIED BIT_0 #define SRB_LOGIN_COND_PLOGI BIT_1 #define SRB_LOGIN_SKIP_PRLI BIT_2 +#define SRB_LOGIN_NVME_PRLI BIT_3 uint16_t data[2]; u32 iop[2]; } logio; @@ -409,6 +413,21 @@ struct srb_iocb { struct { struct imm_ntfy_from_isp *ntfy; } nack; + struct { + __le16 comp_status; + uint16_t rsp_pyld_len; + uint8_t aen_op; + void *desc; + + /* These are only used with ls4 requests */ + int cmd_len; + int rsp_len; + dma_addr_t cmd_dma; + dma_addr_t rsp_dma; + enum nvmefc_fcp_datadir dir; + uint32_t dl; + uint32_t timeout_sec; + } nvme; } u; struct timer_list timer; @@ -434,9 +453,24 @@ struct srb_iocb { #define SRB_NACK_PLOGI 16 #define SRB_NACK_PRLI 17 #define SRB_NACK_LOGO 18 +#define SRB_NVME_CMD 19 +#define SRB_NVME_LS 20 +#define SRB_PRLI_CMD 21 + +enum { + TYPE_SRB, + TYPE_TGT_CMD, +}; typedef struct srb { + /* + * Do not move cmd_type field, it needs to + * line up with qla_tgt_cmd->cmd_type + */ + uint8_t cmd_type; + uint8_t pad[3]; atomic_t ref_count; + wait_queue_head_t nvme_ls_waitQ; struct fc_port *fcport; struct scsi_qla_host *vha; uint32_t handle; @@ -1075,6 +1109,7 @@ struct mbx_cmd_32 { #define MBX_1 BIT_1 #define MBX_0 BIT_0 +#define RNID_TYPE_PORT_LOGIN 0x7 #define RNID_TYPE_SET_VERSION 0x9 #define RNID_TYPE_ASIC_TEMP 0xC @@ -2139,6 +2174,7 @@ typedef struct { uint8_t fabric_port_name[WWN_SIZE]; uint16_t fp_speed; uint8_t fc4_type; + uint8_t fc4f_nvme; /* nvme fc4 feature bits */ } sw_info_t; /* FCP-4 types */ @@ -2167,7 +2203,8 @@ typedef enum { FCT_SWITCH, FCT_BROADCAST, FCT_INITIATOR, - FCT_TARGET + FCT_TARGET, + FCT_NVME } fc_port_type_t; enum qla_sess_deletion { @@ -2224,10 +2261,12 @@ enum fcport_mgt_event { FCME_RSCN, FCME_GIDPN_DONE, FCME_PLOGI_DONE, /* Initiator side sent LLIOCB */ + FCME_PRLI_DONE, FCME_GNL_DONE, FCME_GPSC_DONE, FCME_GPDB_DONE, FCME_GPNID_DONE, + FCME_GFFID_DONE, FCME_DELETE_DONE, }; @@ -2261,6 +2300,17 @@ typedef struct fc_port { unsigned int login_pause:1; unsigned int login_succ:1; + struct work_struct nvme_del_work; + atomic_t nvme_ref_count; + wait_queue_head_t nvme_waitQ; + uint32_t nvme_prli_service_param; +#define NVME_PRLI_SP_CONF BIT_7 +#define NVME_PRLI_SP_INITIATOR BIT_5 +#define NVME_PRLI_SP_TARGET BIT_4 +#define NVME_PRLI_SP_DISCOVERY BIT_3 + uint8_t nvme_flag; +#define NVME_FLAG_REGISTERED 4 + struct fc_port *conflict; unsigned char logout_completed; int generation; @@ -2293,6 +2343,7 @@ typedef struct fc_port { u32 supported_classes; uint8_t fc4_type; + uint8_t fc4f_nvme; uint8_t scan_state; unsigned long last_queue_full; @@ -2300,6 +2351,8 @@ typedef struct fc_port { uint16_t port_id; + struct nvme_fc_remote_port *nvme_remote_port; + unsigned long retry_delay_timestamp; struct qla_tgt_sess *tgt_session; struct ct_sns_desc ct_desc; @@ -2732,7 +2785,7 @@ struct ct_sns_req { struct { uint8_t reserved; - uint8_t port_name[3]; + uint8_t port_id[3]; } gff_id; struct { @@ -2814,6 +2867,7 @@ struct ct_sns_rsp { } gpsc; #define GFF_FCP_SCSI_OFFSET 7 +#define GFF_NVME_OFFSET 23 /* type = 28h */ struct { uint8_t fc4_features[128]; } gff_id; @@ -3039,6 +3093,7 @@ enum qla_work_type { QLA_EVT_GPNID_DONE, QLA_EVT_NEW_SESS, QLA_EVT_GPDB, + QLA_EVT_PRLI, QLA_EVT_GPSC, QLA_EVT_UPD_FCPORT, QLA_EVT_GNL, @@ -3169,6 +3224,21 @@ struct qla_tc_param { #define QLA_PRECONFIG_VPORTS 32 #define QLA_MAX_VPORTS_QLA24XX 128 #define QLA_MAX_VPORTS_QLA25XX 256 + +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; +}; + +struct qla_qpair; + /* Response queue data structure */ struct rsp_que { dma_addr_t dma; @@ -3188,6 +3258,7 @@ struct rsp_que { struct qla_msix_entry *msix; struct req_que *req; srb_t *status_srb; /* status continuation entry */ + struct qla_qpair *qpair; dma_addr_t dma_fx00; response_t *ring_fx00; @@ -3228,6 +3299,15 @@ struct req_que { struct qla_qpair { spinlock_t qp_lock; atomic_t ref_count; + uint32_t lun_cnt; + /* + * For qpair 0, qp_lock_ptr will point at hardware_lock due to + * legacy code. For other Qpair(s), it will point at qp_lock. + */ + spinlock_t *qp_lock_ptr; + struct scsi_qla_host *vha; + u32 chip_reset; + /* distill these fields down to 'online=0/1' * ha->flags.eeh_busy * ha->flags.pci_channel_io_perm_failure @@ -3237,14 +3317,18 @@ struct qla_qpair { /* move vha->flags.difdix_supported here */ uint32_t difdix_supported:1; uint32_t delete_in_progress:1; + uint32_t fw_started:1; + uint32_t enable_class_2:1; + uint32_t enable_explicit_conf:1; + uint32_t use_shadow_reg:1; uint16_t id; /* qp number used with FW */ - uint16_t num_active_cmd; /* cmds down at firmware */ - cpumask_t cpu_mask; /* CPU mask for cpu affinity operation */ uint16_t vp_idx; /* vport ID */ - mempool_t *srb_mempool; + struct pci_dev *pdev; + void (*reqq_start_iocbs)(struct qla_qpair *); + /* to do: New driver: move queues to here instead of pointers */ struct req_que *req; struct rsp_que *rsp; @@ -3253,7 +3337,9 @@ struct qla_qpair { struct qla_hw_data *hw; struct work_struct q_work; struct list_head qp_list_elem; /* vha->qp_list */ - struct scsi_qla_host *vha; + struct list_head hints_list; + uint16_t cpuid; + struct qla_tgt_counters tgt_counters; }; /* Place holder for FW buffer parameters */ @@ -3272,8 +3358,6 @@ struct scsi_qlt_host { struct qlt_hw_data { /* Protected by hw lock */ - uint32_t enable_class_2:1; - uint32_t enable_explicit_conf:1; uint32_t node_name_set:1; dma_addr_t atio_dma; /* Physical address. */ @@ -3285,9 +3369,6 @@ struct qlt_hw_data { uint32_t __iomem *atio_q_out; struct qla_tgt_func_tmpl *tgt_ops; - struct qla_tgt_cmd *cmds[DEFAULT_OUTSTANDING_COMMANDS]; - uint16_t current_handle; - struct qla_tgt_vp_map *tgt_vp_map; int saved_set; @@ -3302,6 +3383,7 @@ struct qlt_hw_data { struct dentry *dfs_tgt_sess; struct dentry *dfs_tgt_port_database; + struct dentry *dfs_naqp; struct list_head q_full_list; uint32_t num_pend_cmds; @@ -3310,7 +3392,8 @@ struct qlt_hw_data { spinlock_t q_full_lock; uint32_t leak_exchg_thresh_hold; spinlock_t sess_lock; - int rspq_vector_cpuid; + int num_act_qpairs; +#define DEFAULT_NAQP 2 spinlock_t atio_lock ____cacheline_aligned; struct btree_head32 host_map; }; @@ -3591,6 +3674,10 @@ struct qla_hw_data { #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)) +#define IS_EXCHG_OFFLD_CAPABLE(ha) \ + (IS_QLA81XX(ha) || IS_QLA83XX(ha) || IS_QLA27XX(ha)) +#define IS_EXLOGIN_OFFLD_CAPABLE(ha) \ + (IS_QLA25XX(ha) || IS_QLA81XX(ha) || IS_QLA83XX(ha) || IS_QLA27XX(ha)) /* HBA serial number */ uint8_t serial0; @@ -3927,24 +4014,11 @@ struct qla_hw_data { struct work_struct board_disable; struct mr_data_fx00 mr; - uint32_t chip_reset; struct qlt_hw_data tgt; 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 */ @@ -3973,6 +4047,9 @@ typedef struct scsi_qla_host { uint32_t fw_tgt_reported:1; uint32_t bbcr_enable:1; uint32_t qpairs_available:1; + uint32_t qpairs_req_created:1; + uint32_t qpairs_rsp_created:1; + uint32_t nvme_enabled:1; } flags; atomic_t loop_state; @@ -4017,7 +4094,6 @@ typedef struct scsi_qla_host { #define PFLG_DISCONNECTED 0 /* PCI device removed */ #define PFLG_DRIVER_REMOVING 1 /* PCI driver .remove */ #define PFLG_DRIVER_PROBING 2 /* PCI driver .probe */ -#define PCI_ERR 30 uint32_t device_flags; #define SWITCH_FOUND BIT_0 @@ -4052,6 +4128,13 @@ typedef struct scsi_qla_host { uint8_t port_name[WWN_SIZE]; uint8_t fabric_node_name[WWN_SIZE]; + struct nvme_fc_local_port *nvme_local_port; + atomic_t nvme_ref_count; + wait_queue_head_t nvme_waitQ; + struct list_head nvme_rport_list; + atomic_t nvme_active_aen_cnt; + uint16_t nvme_last_rptd_aen; + uint16_t fcoe_vlan_id; uint16_t fcoe_fcf_idx; uint8_t fcoe_vn_port_mac[6]; @@ -4108,10 +4191,8 @@ typedef struct scsi_qla_host { struct fc_host_statistics fc_host_stat; struct qla_statistics qla_stats; struct bidi_statistics bidi_stats; - atomic_t vref_count; struct qla8044_reset_template reset_tmplt; - struct qla_tgt_counters tgt_counters; uint16_t bbcr; struct name_list_extended gnl; /* Count of active session/fcport */ @@ -4156,6 +4237,26 @@ struct qla2_sgx { srb_t *sp; }; +#define QLA_FW_STARTED(_ha) { \ + int i; \ + _ha->flags.fw_started = 1; \ + _ha->base_qpair->fw_started = 1; \ + for (i = 0; i < _ha->max_qpairs; i++) { \ + if (_ha->queue_pair_map[i]) \ + _ha->queue_pair_map[i]->fw_started = 1; \ + } \ +} + +#define QLA_FW_STOPPED(_ha) { \ + int i; \ + _ha->flags.fw_started = 0; \ + _ha->base_qpair->fw_started = 0; \ + for (i = 0; i < _ha->max_qpairs; i++) { \ + if (_ha->queue_pair_map[i]) \ + _ha->queue_pair_map[i]->fw_started = 0; \ + } \ +} + /* * Macros to help code, maintain, etc. */ @@ -4199,6 +4300,25 @@ struct qla2_sgx { #define QLA_QPAIR_MARK_NOT_BUSY(__qpair) \ atomic_dec(&__qpair->ref_count); \ + +#define QLA_ENA_CONF(_ha) {\ + int i;\ + _ha->base_qpair->enable_explicit_conf = 1; \ + for (i = 0; i < _ha->max_qpairs; i++) { \ + if (_ha->queue_pair_map[i]) \ + _ha->queue_pair_map[i]->enable_explicit_conf = 1; \ + } \ +} + +#define QLA_DIS_CONF(_ha) {\ + int i;\ + _ha->base_qpair->enable_explicit_conf = 0; \ + for (i = 0; i < _ha->max_qpairs; i++) { \ + if (_ha->queue_pair_map[i]) \ + _ha->queue_pair_map[i]->enable_explicit_conf = 0; \ + } \ +} + /* * qla2x00 local function return status codes */ @@ -4253,6 +4373,10 @@ enum nexus_wait_type { WAIT_LUN, }; +#define USER_CTRL_IRQ(_ha) (ql2xuctrlirq && QLA_TGT_MODE_ENABLED() && \ + (IS_QLA27XX(_ha) || IS_QLA83XX(_ha))) + +#include "qla_target.h" #include "qla_gbl.h" #include "qla_dbg.h" #include "qla_inline.h" |