@@ -401,6 +401,7 @@ typedef struct srb {
401401 uint16_t type ;
402402 char * name ;
403403 int iocbs ;
404+ struct qla_qpair * qpair ;
404405 union {
405406 struct srb_iocb iocb_cmd ;
406407 struct bsg_job * bsg_job ;
@@ -2719,6 +2720,7 @@ struct isp_operations {
27192720
27202721 int (* get_flash_version ) (struct scsi_qla_host * , void * );
27212722 int (* start_scsi ) (srb_t * );
2723+ int (* start_scsi_mq ) (srb_t * );
27222724 int (* abort_isp ) (struct scsi_qla_host * );
27232725 int (* iospace_config )(struct qla_hw_data * );
27242726 int (* initialize_adapter )(struct scsi_qla_host * );
@@ -2730,8 +2732,9 @@ struct isp_operations {
27302732#define QLA_MSIX_FW_MODE (m ) (((m) & (BIT_7|BIT_8|BIT_9)) >> 7)
27312733#define QLA_MSIX_FW_MODE_1 (m ) (QLA_MSIX_FW_MODE(m) == 1)
27322734
2733- #define QLA_MSIX_DEFAULT 0x00
2734- #define QLA_MSIX_RSP_Q 0x01
2735+ #define QLA_MSIX_DEFAULT 0x00
2736+ #define QLA_MSIX_RSP_Q 0x01
2737+ #define QLA_MSIX_QPAIR_MULTIQ_RSP_Q 0x02
27352738
27362739#define QLA_MIDX_DEFAULT 0
27372740#define QLA_MIDX_RSP_Q 1
@@ -2745,8 +2748,10 @@ struct scsi_qla_host;
27452748
27462749struct qla_msix_entry {
27472750 int have_irq ;
2751+ int in_use ;
27482752 uint32_t vector ;
27492753 uint16_t entry ;
2754+ char name [30 ];
27502755 void * handle ;
27512756 struct irq_affinity_notify irq_notify ;
27522757 int cpuid ;
@@ -2872,7 +2877,6 @@ struct rsp_que {
28722877 struct qla_msix_entry * msix ;
28732878 struct req_que * req ;
28742879 srb_t * status_srb ; /* status continuation entry */
2875- struct work_struct q_work ;
28762880
28772881 dma_addr_t dma_fx00 ;
28782882 response_t * ring_fx00 ;
@@ -2909,6 +2913,37 @@ struct req_que {
29092913 uint8_t req_pkt [REQUEST_ENTRY_SIZE ];
29102914};
29112915
2916+ /*Queue pair data structure */
2917+ struct qla_qpair {
2918+ spinlock_t qp_lock ;
2919+ atomic_t ref_count ;
2920+ /* distill these fields down to 'online=0/1'
2921+ * ha->flags.eeh_busy
2922+ * ha->flags.pci_channel_io_perm_failure
2923+ * base_vha->loop_state
2924+ */
2925+ uint32_t online :1 ;
2926+ /* move vha->flags.difdix_supported here */
2927+ uint32_t difdix_supported :1 ;
2928+ uint32_t delete_in_progress :1 ;
2929+
2930+ uint16_t id ; /* qp number used with FW */
2931+ uint16_t num_active_cmd ; /* cmds down at firmware */
2932+ cpumask_t cpu_mask ; /* CPU mask for cpu affinity operation */
2933+ uint16_t vp_idx ; /* vport ID */
2934+
2935+ mempool_t * srb_mempool ;
2936+
2937+ /* to do: New driver: move queues to here instead of pointers */
2938+ struct req_que * req ;
2939+ struct rsp_que * rsp ;
2940+ struct atio_que * atio ;
2941+ struct qla_msix_entry * msix ; /* point to &ha->msix_entries[x] */
2942+ struct qla_hw_data * hw ;
2943+ struct work_struct q_work ;
2944+ struct list_head qp_list_elem ; /* vha->qp_list */
2945+ };
2946+
29122947/* Place holder for FW buffer parameters */
29132948struct qlfc_fw {
29142949 void * fw_buf ;
@@ -3004,7 +3039,6 @@ struct qla_hw_data {
30043039 uint32_t chip_reset_done :1 ;
30053040 uint32_t running_gold_fw :1 ;
30063041 uint32_t eeh_busy :1 ;
3007- uint32_t cpu_affinity_enabled :1 ;
30083042 uint32_t disable_msix_handshake :1 ;
30093043 uint32_t fcp_prio_enabled :1 ;
30103044 uint32_t isp82xx_fw_hung :1 ;
@@ -3061,10 +3095,15 @@ struct qla_hw_data {
30613095 uint8_t mqenable ;
30623096 struct req_que * * req_q_map ;
30633097 struct rsp_que * * rsp_q_map ;
3098+ struct qla_qpair * * queue_pair_map ;
30643099 unsigned long req_qid_map [(QLA_MAX_QUEUES / 8 ) / sizeof (unsigned long )];
30653100 unsigned long rsp_qid_map [(QLA_MAX_QUEUES / 8 ) / sizeof (unsigned long )];
3101+ unsigned long qpair_qid_map [(QLA_MAX_QUEUES / 8 )
3102+ / sizeof (unsigned long )];
30663103 uint8_t max_req_queues ;
30673104 uint8_t max_rsp_queues ;
3105+ uint8_t max_qpairs ;
3106+ struct qla_qpair * base_qpair ;
30683107 struct qla_npiv_entry * npiv_info ;
30693108 uint16_t nvram_npiv_size ;
30703109
@@ -3328,6 +3367,7 @@ struct qla_hw_data {
33283367
33293368 struct mutex vport_lock ; /* Virtual port synchronization */
33303369 spinlock_t vport_slock ; /* order is hardware_lock, then vport_slock */
3370+ struct mutex mq_lock ; /* multi-queue synchronization */
33313371 struct completion mbx_cmd_comp ; /* Serialize mbx access */
33323372 struct completion mbx_intr_comp ; /* Used for completion notification */
33333373 struct completion dcbx_comp ; /* For set port config notification */
@@ -3608,6 +3648,7 @@ typedef struct scsi_qla_host {
36083648
36093649 uint32_t fw_tgt_reported :1 ;
36103650 uint32_t bbcr_enable :1 ;
3651+ uint32_t qpairs_available :1 ;
36113652 } flags ;
36123653
36133654 atomic_t loop_state ;
@@ -3646,6 +3687,7 @@ typedef struct scsi_qla_host {
36463687#define FX00_TARGET_SCAN 24
36473688#define FX00_CRITEMP_RECOVERY 25
36483689#define FX00_HOST_INFO_RESEND 26
3690+ #define QPAIR_ONLINE_CHECK_NEEDED 27
36493691
36503692 unsigned long pci_flags ;
36513693#define PFLG_DISCONNECTED 0 /* PCI device removed */
@@ -3704,10 +3746,13 @@ typedef struct scsi_qla_host {
37043746 /* List of pending PLOGI acks, protected by hw lock */
37053747 struct list_head plogi_ack_list ;
37063748
3749+ struct list_head qp_list ;
3750+
37073751 uint32_t vp_abort_cnt ;
37083752
37093753 struct fc_vport * fc_vport ; /* holds fc_vport * for each vport */
37103754 uint16_t vp_idx ; /* vport ID */
3755+ struct qla_qpair * qpair ; /* base qpair */
37113756
37123757 unsigned long vp_flags ;
37133758#define VP_IDX_ACQUIRED 0 /* bit no 0 */
@@ -3763,6 +3808,23 @@ struct qla_tgt_vp_map {
37633808 scsi_qla_host_t * vha ;
37643809};
37653810
3811+ struct qla2_sgx {
3812+ dma_addr_t dma_addr ; /* OUT */
3813+ uint32_t dma_len ; /* OUT */
3814+
3815+ uint32_t tot_bytes ; /* IN */
3816+ struct scatterlist * cur_sg ; /* IN */
3817+
3818+ /* for book keeping, bzero on initial invocation */
3819+ uint32_t bytes_consumed ;
3820+ uint32_t num_bytes ;
3821+ uint32_t tot_partial ;
3822+
3823+ /* for debugging */
3824+ uint32_t num_sg ;
3825+ srb_t * sp ;
3826+ };
3827+
37663828/*
37673829 * Macros to help code, maintain, etc.
37683830 */
@@ -3775,21 +3837,34 @@ struct qla_tgt_vp_map {
37753837 (test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \
37763838 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags))
37773839
3778- #define QLA_VHA_MARK_BUSY (__vha , __bail ) do { \
3779- atomic_inc(&__vha->vref_count); \
3780- mb(); \
3781- if (__vha->flags.delete_progress) { \
3782- atomic_dec(&__vha->vref_count); \
3783- __bail = 1; \
3784- } else { \
3785- __bail = 0; \
3786- } \
3840+ #define QLA_VHA_MARK_BUSY (__vha , __bail ) do { \
3841+ atomic_inc(&__vha->vref_count); \
3842+ mb(); \
3843+ if (__vha->flags.delete_progress) { \
3844+ atomic_dec(&__vha->vref_count); \
3845+ __bail = 1; \
3846+ } else { \
3847+ __bail = 0; \
3848+ } \
37873849} while (0)
37883850
3789- #define QLA_VHA_MARK_NOT_BUSY (__vha ) do { \
3790- atomic_dec(&__vha->vref_count); \
3851+ #define QLA_VHA_MARK_NOT_BUSY (__vha ) \
3852+ atomic_dec(&__vha->vref_count); \
3853+
3854+ #define QLA_QPAIR_MARK_BUSY (__qpair , __bail ) do { \
3855+ atomic_inc(&__qpair->ref_count); \
3856+ mb(); \
3857+ if (__qpair->delete_in_progress) { \
3858+ atomic_dec(&__qpair->ref_count); \
3859+ __bail = 1; \
3860+ } else { \
3861+ __bail = 0; \
3862+ } \
37913863} while (0)
37923864
3865+ #define QLA_QPAIR_MARK_NOT_BUSY (__qpair ) \
3866+ atomic_dec(&__qpair->ref_count); \
3867+
37933868/*
37943869 * qla2x00 local function return status codes
37953870 */
0 commit comments