Commit 2afa19a9 authored by Anirban Chakraborty's avatar Anirban Chakraborty Committed by James Bottomley

[SCSI] qla2xxx: Add QoS support.

Set the number of request queues to the module paramater
ql2xmaxqueues.  Each vport gets a request queue. The QoS value
set to the request queues determines priority control for queued
IOs. If QoS value is not specified, the vports use the default
queue 0.
Signed-off-by: default avatarAnirban Chakraborty <anirban.chakraborty@qlogic.com>
Signed-off-by: default avatarAndrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 7640335e
...@@ -1469,11 +1469,12 @@ static int ...@@ -1469,11 +1469,12 @@ static int
qla24xx_vport_create(struct fc_vport *fc_vport, bool disable) qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
{ {
int ret = 0; int ret = 0;
int cnt = 0; uint8_t qos = 0;
uint8_t qos = QLA_DEFAULT_QUE_QOS;
scsi_qla_host_t *base_vha = shost_priv(fc_vport->shost); scsi_qla_host_t *base_vha = shost_priv(fc_vport->shost);
scsi_qla_host_t *vha = NULL; scsi_qla_host_t *vha = NULL;
struct qla_hw_data *ha = base_vha->hw; struct qla_hw_data *ha = base_vha->hw;
uint16_t options = 0;
int cnt;
ret = qla24xx_vport_create_req_sanity_check(fc_vport); ret = qla24xx_vport_create_req_sanity_check(fc_vport);
if (ret) { if (ret) {
...@@ -1529,23 +1530,35 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable) ...@@ -1529,23 +1530,35 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
qla24xx_vport_disable(fc_vport, disable); qla24xx_vport_disable(fc_vport, disable);
/* Create a queue pair for the vport */ ret = 0;
if (ha->mqenable) { if (ha->cur_vport_count <= ha->flex_port_count
if (ha->npiv_info) { || ha->max_req_queues == 1 || !ha->npiv_info)
for (; cnt < ha->nvram_npiv_size; cnt++) { goto vport_queue;
if (ha->npiv_info[cnt].port_name == /* Create a request queue in QoS mode for the vport */
vha->port_name && for (cnt = ha->flex_port_count; cnt < ha->nvram_npiv_size; cnt++) {
ha->npiv_info[cnt].node_name == if (ha->npiv_info[cnt].port_name == vha->port_name &&
vha->node_name) { ha->npiv_info[cnt].node_name == vha->node_name) {
qos = ha->npiv_info[cnt].q_qos; qos = ha->npiv_info[cnt].q_qos;
break; break;
}
}
} }
qla25xx_create_queues(vha, qos); }
if (qos) {
ret = qla25xx_create_req_que(ha, options, vha->vp_idx, 0, 0,
qos);
if (!ret)
qla_printk(KERN_WARNING, ha,
"Can't create request queue for vp_idx:%d\n",
vha->vp_idx);
else
DEBUG2(qla_printk(KERN_INFO, ha,
"Request Que:%d created for vp_idx:%d\n",
ret, vha->vp_idx));
} }
vport_queue:
vha->req = ha->req_q_map[ret];
return 0; return 0;
vport_create_failed_2: vport_create_failed_2:
qla24xx_disable_vp(vha); qla24xx_disable_vp(vha);
qla24xx_deallocate_vp_id(vha); qla24xx_deallocate_vp_id(vha);
...@@ -1586,8 +1599,8 @@ qla24xx_vport_delete(struct fc_vport *fc_vport) ...@@ -1586,8 +1599,8 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
vha->host_no, vha->vp_idx, vha)); vha->host_no, vha->vp_idx, vha));
} }
if (ha->mqenable) { if (vha->req->id) {
if (qla25xx_delete_queues(vha, 0) != QLA_SUCCESS) if (qla25xx_delete_req_que(vha, vha->req) != QLA_SUCCESS)
qla_printk(KERN_WARNING, ha, qla_printk(KERN_WARNING, ha,
"Queue delete failed.\n"); "Queue delete failed.\n");
} }
......
...@@ -351,7 +351,7 @@ static inline void * ...@@ -351,7 +351,7 @@ static inline void *
qla25xx_copy_mq(struct qla_hw_data *ha, void *ptr, uint32_t **last_chain) qla25xx_copy_mq(struct qla_hw_data *ha, void *ptr, uint32_t **last_chain)
{ {
uint32_t cnt, que_idx; uint32_t cnt, que_idx;
uint8_t req_cnt, rsp_cnt, que_cnt; uint8_t que_cnt;
struct qla2xxx_mq_chain *mq = ptr; struct qla2xxx_mq_chain *mq = ptr;
struct device_reg_25xxmq __iomem *reg; struct device_reg_25xxmq __iomem *reg;
...@@ -363,9 +363,8 @@ qla25xx_copy_mq(struct qla_hw_data *ha, void *ptr, uint32_t **last_chain) ...@@ -363,9 +363,8 @@ qla25xx_copy_mq(struct qla_hw_data *ha, void *ptr, uint32_t **last_chain)
mq->type = __constant_htonl(DUMP_CHAIN_MQ); mq->type = __constant_htonl(DUMP_CHAIN_MQ);
mq->chain_size = __constant_htonl(sizeof(struct qla2xxx_mq_chain)); mq->chain_size = __constant_htonl(sizeof(struct qla2xxx_mq_chain));
req_cnt = find_first_zero_bit(ha->req_qid_map, ha->max_queues); que_cnt = ha->max_req_queues > ha->max_rsp_queues ?
rsp_cnt = find_first_zero_bit(ha->rsp_qid_map, ha->max_queues); ha->max_req_queues : ha->max_rsp_queues;
que_cnt = req_cnt > rsp_cnt ? req_cnt : rsp_cnt;
mq->count = htonl(que_cnt); mq->count = htonl(que_cnt);
for (cnt = 0; cnt < que_cnt; cnt++) { for (cnt = 0; cnt < que_cnt; cnt++) {
reg = (struct device_reg_25xxmq *) ((void *) reg = (struct device_reg_25xxmq *) ((void *)
......
...@@ -93,6 +93,7 @@ ...@@ -93,6 +93,7 @@
#define LSD(x) ((uint32_t)((uint64_t)(x))) #define LSD(x) ((uint32_t)((uint64_t)(x)))
#define MSD(x) ((uint32_t)((((uint64_t)(x)) >> 16) >> 16)) #define MSD(x) ((uint32_t)((((uint64_t)(x)) >> 16) >> 16))
#define MAKE_HANDLE(x, y) ((uint32_t)((((uint32_t)(x)) << 16) | (uint32_t)(y)))
/* /*
* I/O register * I/O register
...@@ -179,6 +180,7 @@ ...@@ -179,6 +180,7 @@
#define REQUEST_ENTRY_CNT_24XX 2048 /* Number of request entries. */ #define REQUEST_ENTRY_CNT_24XX 2048 /* Number of request entries. */
#define RESPONSE_ENTRY_CNT_2100 64 /* Number of response entries.*/ #define RESPONSE_ENTRY_CNT_2100 64 /* Number of response entries.*/
#define RESPONSE_ENTRY_CNT_2300 512 /* Number of response entries.*/ #define RESPONSE_ENTRY_CNT_2300 512 /* Number of response entries.*/
#define RESPONSE_ENTRY_CNT_MQ 128 /* Number of response entries.*/
struct req_que; struct req_que;
...@@ -2008,7 +2010,8 @@ typedef struct vport_params { ...@@ -2008,7 +2010,8 @@ typedef struct vport_params {
#define VP_RET_CODE_NOT_FOUND 6 #define VP_RET_CODE_NOT_FOUND 6
struct qla_hw_data; struct qla_hw_data;
struct req_que;
struct rsp_que;
/* /*
* ISP operations * ISP operations
*/ */
...@@ -2030,10 +2033,9 @@ struct isp_operations { ...@@ -2030,10 +2033,9 @@ struct isp_operations {
void (*enable_intrs) (struct qla_hw_data *); void (*enable_intrs) (struct qla_hw_data *);
void (*disable_intrs) (struct qla_hw_data *); void (*disable_intrs) (struct qla_hw_data *);
int (*abort_command) (struct scsi_qla_host *, srb_t *, int (*abort_command) (srb_t *);
struct req_que *); int (*target_reset) (struct fc_port *, unsigned int, int);
int (*target_reset) (struct fc_port *, unsigned int); int (*lun_reset) (struct fc_port *, unsigned int, int);
int (*lun_reset) (struct fc_port *, unsigned int);
int (*fabric_login) (struct scsi_qla_host *, uint16_t, uint8_t, int (*fabric_login) (struct scsi_qla_host *, uint16_t, uint8_t,
uint8_t, uint8_t, uint16_t *, uint8_t); uint8_t, uint8_t, uint16_t *, uint8_t);
int (*fabric_logout) (struct scsi_qla_host *, uint16_t, uint8_t, int (*fabric_logout) (struct scsi_qla_host *, uint16_t, uint8_t,
...@@ -2079,7 +2081,6 @@ struct isp_operations { ...@@ -2079,7 +2081,6 @@ struct isp_operations {
#define QLA_PCI_MSIX_CONTROL 0xa2 #define QLA_PCI_MSIX_CONTROL 0xa2
struct scsi_qla_host; struct scsi_qla_host;
struct rsp_que;
struct qla_msix_entry { struct qla_msix_entry {
int have_irq; int have_irq;
...@@ -2140,7 +2141,6 @@ struct qla_statistics { ...@@ -2140,7 +2141,6 @@ struct qla_statistics {
#define MBC_INITIALIZE_MULTIQ 0x1f #define MBC_INITIALIZE_MULTIQ 0x1f
#define QLA_QUE_PAGE 0X1000 #define QLA_QUE_PAGE 0X1000
#define QLA_MQ_SIZE 32 #define QLA_MQ_SIZE 32
#define QLA_MAX_HOST_QUES 16
#define QLA_MAX_QUEUES 256 #define QLA_MAX_QUEUES 256
#define ISP_QUE_REG(ha, id) \ #define ISP_QUE_REG(ha, id) \
((ha->mqenable) ? \ ((ha->mqenable) ? \
...@@ -2170,6 +2170,7 @@ struct rsp_que { ...@@ -2170,6 +2170,7 @@ struct rsp_que {
struct qla_hw_data *hw; struct qla_hw_data *hw;
struct qla_msix_entry *msix; struct qla_msix_entry *msix;
struct req_que *req; struct req_que *req;
srb_t *status_srb; /* status continuation entry */
}; };
/* Request queue data structure */ /* Request queue data structure */
...@@ -2246,7 +2247,8 @@ struct qla_hw_data { ...@@ -2246,7 +2247,8 @@ struct qla_hw_data {
struct rsp_que **rsp_q_map; struct rsp_que **rsp_q_map;
unsigned long req_qid_map[(QLA_MAX_QUEUES / 8) / sizeof(unsigned long)]; unsigned long req_qid_map[(QLA_MAX_QUEUES / 8) / sizeof(unsigned long)];
unsigned long rsp_qid_map[(QLA_MAX_QUEUES / 8) / sizeof(unsigned long)]; unsigned long rsp_qid_map[(QLA_MAX_QUEUES / 8) / sizeof(unsigned long)];
uint16_t max_queues; uint8_t max_req_queues;
uint8_t max_rsp_queues;
struct qla_npiv_entry *npiv_info; struct qla_npiv_entry *npiv_info;
uint16_t nvram_npiv_size; uint16_t nvram_npiv_size;
...@@ -2532,6 +2534,7 @@ struct qla_hw_data { ...@@ -2532,6 +2534,7 @@ struct qla_hw_data {
uint16_t num_vsans; /* number of vsan created */ uint16_t num_vsans; /* number of vsan created */
uint16_t max_npiv_vports; /* 63 or 125 per topoloty */ uint16_t max_npiv_vports; /* 63 or 125 per topoloty */
int cur_vport_count; int cur_vport_count;
uint16_t flex_port_count;
struct qla_chip_state_84xx *cs84xx; struct qla_chip_state_84xx *cs84xx;
struct qla_statistics qla_stats; struct qla_statistics qla_stats;
...@@ -2591,8 +2594,6 @@ typedef struct scsi_qla_host { ...@@ -2591,8 +2594,6 @@ typedef struct scsi_qla_host {
#define SWITCH_FOUND BIT_0 #define SWITCH_FOUND BIT_0
#define DFLG_NO_CABLE BIT_1 #define DFLG_NO_CABLE BIT_1
srb_t *status_srb; /* Status continuation entry. */
/* ISP configuration data. */ /* ISP configuration data. */
uint16_t loop_id; /* Host adapter loop id */ uint16_t loop_id; /* Host adapter loop id */
...@@ -2648,7 +2649,7 @@ typedef struct scsi_qla_host { ...@@ -2648,7 +2649,7 @@ typedef struct scsi_qla_host {
#define VP_ERR_FAB_LOGOUT 4 #define VP_ERR_FAB_LOGOUT 4
#define VP_ERR_ADAP_NORESOURCES 5 #define VP_ERR_ADAP_NORESOURCES 5
struct qla_hw_data *hw; struct qla_hw_data *hw;
int req_ques[QLA_MAX_HOST_QUES]; struct req_que *req;
} scsi_qla_host_t; } scsi_qla_host_t;
/* /*
......
...@@ -67,6 +67,7 @@ extern int ql2xextended_error_logging; ...@@ -67,6 +67,7 @@ extern int ql2xextended_error_logging;
extern int ql2xqfullrampup; extern int ql2xqfullrampup;
extern int ql2xiidmaenable; extern int ql2xiidmaenable;
extern int ql2xmaxqueues; extern int ql2xmaxqueues;
extern int ql2xmultique_tag;
extern int qla2x00_loop_reset(scsi_qla_host_t *); extern int qla2x00_loop_reset(scsi_qla_host_t *);
extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int); extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int);
...@@ -165,13 +166,13 @@ extern int ...@@ -165,13 +166,13 @@ extern int
qla2x00_issue_iocb(scsi_qla_host_t *, void *, dma_addr_t, size_t); qla2x00_issue_iocb(scsi_qla_host_t *, void *, dma_addr_t, size_t);
extern int extern int
qla2x00_abort_command(scsi_qla_host_t *, srb_t *, struct req_que *); qla2x00_abort_command(srb_t *);
extern int extern int
qla2x00_abort_target(struct fc_port *, unsigned int); qla2x00_abort_target(struct fc_port *, unsigned int, int);
extern int extern int
qla2x00_lun_reset(struct fc_port *, unsigned int); qla2x00_lun_reset(struct fc_port *, unsigned int, int);
extern int extern int
qla2x00_get_adapter_id(scsi_qla_host_t *, uint16_t *, uint8_t *, uint8_t *, qla2x00_get_adapter_id(scsi_qla_host_t *, uint16_t *, uint8_t *, uint8_t *,
...@@ -236,9 +237,11 @@ extern int ...@@ -236,9 +237,11 @@ extern int
qla24xx_get_isp_stats(scsi_qla_host_t *, struct link_statistics *, qla24xx_get_isp_stats(scsi_qla_host_t *, struct link_statistics *,
dma_addr_t); dma_addr_t);
extern int qla24xx_abort_command(scsi_qla_host_t *, srb_t *, struct req_que *); extern int qla24xx_abort_command(srb_t *);
extern int qla24xx_abort_target(struct fc_port *, unsigned int); extern int
extern int qla24xx_lun_reset(struct fc_port *, unsigned int); qla24xx_abort_target(struct fc_port *, unsigned int, int);
extern int
qla24xx_lun_reset(struct fc_port *, unsigned int, int);
extern int extern int
qla2x00_system_error(scsi_qla_host_t *); qla2x00_system_error(scsi_qla_host_t *);
...@@ -295,8 +298,8 @@ extern irqreturn_t qla2100_intr_handler(int, void *); ...@@ -295,8 +298,8 @@ extern irqreturn_t qla2100_intr_handler(int, void *);
extern irqreturn_t qla2300_intr_handler(int, void *); extern irqreturn_t qla2300_intr_handler(int, void *);
extern irqreturn_t qla24xx_intr_handler(int, void *); extern irqreturn_t qla24xx_intr_handler(int, void *);
extern void qla2x00_process_response_queue(struct rsp_que *); extern void qla2x00_process_response_queue(struct rsp_que *);
extern void qla24xx_process_response_queue(struct rsp_que *); extern void
qla24xx_process_response_queue(struct scsi_qla_host *, struct rsp_que *);
extern int qla2x00_request_irqs(struct qla_hw_data *, struct rsp_que *); extern int qla2x00_request_irqs(struct qla_hw_data *, struct rsp_que *);
extern void qla2x00_free_irqs(scsi_qla_host_t *); extern void qla2x00_free_irqs(scsi_qla_host_t *);
...@@ -401,19 +404,21 @@ extern int qla25xx_request_irq(struct rsp_que *); ...@@ -401,19 +404,21 @@ extern int qla25xx_request_irq(struct rsp_que *);
extern int qla25xx_init_req_que(struct scsi_qla_host *, struct req_que *); extern int qla25xx_init_req_que(struct scsi_qla_host *, struct req_que *);
extern int qla25xx_init_rsp_que(struct scsi_qla_host *, struct rsp_que *); extern int qla25xx_init_rsp_que(struct scsi_qla_host *, struct rsp_que *);
extern int qla25xx_create_req_que(struct qla_hw_data *, uint16_t, uint8_t, extern int qla25xx_create_req_que(struct qla_hw_data *, uint16_t, uint8_t,
uint16_t, uint8_t, uint8_t); uint16_t, int, uint8_t);
extern int qla25xx_create_rsp_que(struct qla_hw_data *, uint16_t, uint8_t, extern int qla25xx_create_rsp_que(struct qla_hw_data *, uint16_t, uint8_t,
uint16_t); uint16_t, int);
extern int qla25xx_update_req_que(struct scsi_qla_host *, uint8_t, uint8_t); extern int qla25xx_update_req_que(struct scsi_qla_host *, uint8_t, uint8_t);
extern void qla2x00_init_response_q_entries(struct rsp_que *); extern void qla2x00_init_response_q_entries(struct rsp_que *);
extern int qla25xx_delete_req_que(struct scsi_qla_host *, struct req_que *); extern int qla25xx_delete_req_que(struct scsi_qla_host *, struct req_que *);
extern int qla25xx_delete_rsp_que(struct scsi_qla_host *, struct rsp_que *); extern int qla25xx_delete_rsp_que(struct scsi_qla_host *, struct rsp_que *);
extern int qla25xx_create_queues(struct scsi_qla_host *, uint8_t); extern int qla25xx_create_queues(struct scsi_qla_host *, uint8_t);
extern int qla25xx_delete_queues(struct scsi_qla_host *, uint8_t); extern int qla25xx_delete_queues(struct scsi_qla_host *);
extern uint16_t qla24xx_rd_req_reg(struct qla_hw_data *, uint16_t); extern uint16_t qla24xx_rd_req_reg(struct qla_hw_data *, uint16_t);
extern uint16_t qla25xx_rd_req_reg(struct qla_hw_data *, uint16_t); extern uint16_t qla25xx_rd_req_reg(struct qla_hw_data *, uint16_t);
extern void qla24xx_wrt_req_reg(struct qla_hw_data *, uint16_t, uint16_t); extern void qla24xx_wrt_req_reg(struct qla_hw_data *, uint16_t, uint16_t);
extern void qla25xx_wrt_req_reg(struct qla_hw_data *, uint16_t, uint16_t); extern void qla25xx_wrt_req_reg(struct qla_hw_data *, uint16_t, uint16_t);
extern void qla25xx_wrt_rsp_reg(struct qla_hw_data *, uint16_t, uint16_t); extern void qla25xx_wrt_rsp_reg(struct qla_hw_data *, uint16_t, uint16_t);
extern void qla24xx_wrt_rsp_reg(struct qla_hw_data *, uint16_t, uint16_t); extern void qla24xx_wrt_rsp_reg(struct qla_hw_data *, uint16_t, uint16_t);
extern struct scsi_qla_host * qla25xx_get_host(struct rsp_que *);
#endif /* _QLA_GBL_H */ #endif /* _QLA_GBL_H */
...@@ -786,7 +786,6 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) ...@@ -786,7 +786,6 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
sizeof(uint32_t); sizeof(uint32_t);
if (ha->mqenable) if (ha->mqenable)
mq_size = sizeof(struct qla2xxx_mq_chain); mq_size = sizeof(struct qla2xxx_mq_chain);
/* Allocate memory for Fibre Channel Event Buffer. */ /* Allocate memory for Fibre Channel Event Buffer. */
if (!IS_QLA25XX(ha) && !IS_QLA81XX(ha)) if (!IS_QLA25XX(ha) && !IS_QLA81XX(ha))
goto try_eft; goto try_eft;
...@@ -850,8 +849,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) ...@@ -850,8 +849,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
rsp_q_size = rsp->length * sizeof(response_t); rsp_q_size = rsp->length * sizeof(response_t);
dump_size = offsetof(struct qla2xxx_fw_dump, isp); dump_size = offsetof(struct qla2xxx_fw_dump, isp);
dump_size += fixed_size + mem_size + req_q_size + rsp_q_size + dump_size += fixed_size + mem_size + req_q_size + rsp_q_size + eft_size;
eft_size;
ha->chain_offset = dump_size; ha->chain_offset = dump_size;
dump_size += mq_size + fce_size; dump_size += mq_size + fce_size;
...@@ -1013,12 +1011,14 @@ qla2x00_init_response_q_entries(struct rsp_que *rsp) ...@@ -1013,12 +1011,14 @@ qla2x00_init_response_q_entries(struct rsp_que *rsp)
uint16_t cnt; uint16_t cnt;
response_t *pkt; response_t *pkt;
rsp->ring_ptr = rsp->ring;
rsp->ring_index = 0;
rsp->status_srb = NULL;
pkt = rsp->ring_ptr; pkt = rsp->ring_ptr;
for (cnt = 0; cnt < rsp->length; cnt++) { for (cnt = 0; cnt < rsp->length; cnt++) {
pkt->signature = RESPONSE_PROCESSED; pkt->signature = RESPONSE_PROCESSED;
pkt++; pkt++;
} }
} }
/** /**
...@@ -1176,7 +1176,7 @@ qla24xx_config_rings(struct scsi_qla_host *vha) ...@@ -1176,7 +1176,7 @@ qla24xx_config_rings(struct scsi_qla_host *vha)
if (ha->flags.msix_enabled) { if (ha->flags.msix_enabled) {
msix = &ha->msix_entries[1]; msix = &ha->msix_entries[1];
DEBUG2_17(printk(KERN_INFO DEBUG2_17(printk(KERN_INFO
"Reistering vector 0x%x for base que\n", msix->entry)); "Registering vector 0x%x for base que\n", msix->entry));
icb->msix = cpu_to_le16(msix->entry); icb->msix = cpu_to_le16(msix->entry);
} }
/* Use alternate PCI bus number */ /* Use alternate PCI bus number */
...@@ -1230,14 +1230,14 @@ qla2x00_init_rings(scsi_qla_host_t *vha) ...@@ -1230,14 +1230,14 @@ qla2x00_init_rings(scsi_qla_host_t *vha)
spin_lock_irqsave(&ha->hardware_lock, flags); spin_lock_irqsave(&ha->hardware_lock, flags);
/* Clear outstanding commands array. */ /* Clear outstanding commands array. */
for (que = 0; que < ha->max_queues; que++) { for (que = 0; que < ha->max_req_queues; que++) {
req = ha->req_q_map[que]; req = ha->req_q_map[que];
if (!req) if (!req)
continue; continue;
for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++)
req->outstanding_cmds[cnt] = NULL; req->outstanding_cmds[cnt] = NULL;
req->current_outstanding_cmd = 0; req->current_outstanding_cmd = 1;
/* Initialize firmware. */ /* Initialize firmware. */
req->ring_ptr = req->ring; req->ring_ptr = req->ring;
...@@ -1245,13 +1245,10 @@ qla2x00_init_rings(scsi_qla_host_t *vha) ...@@ -1245,13 +1245,10 @@ qla2x00_init_rings(scsi_qla_host_t *vha)
req->cnt = req->length; req->cnt = req->length;
} }
for (que = 0; que < ha->max_queues; que++) { for (que = 0; que < ha->max_rsp_queues; que++) {
rsp = ha->rsp_q_map[que]; rsp = ha->rsp_q_map[que];
if (!rsp) if (!rsp)
continue; continue;
rsp->ring_ptr = rsp->ring;
rsp->ring_index = 0;
/* Initialize response queue entries */ /* Initialize response queue entries */
qla2x00_init_response_q_entries(rsp); qla2x00_init_response_q_entries(rsp);
} }
...@@ -3180,8 +3177,7 @@ qla2x00_loop_resync(scsi_qla_host_t *vha) ...@@ -3180,8 +3177,7 @@ qla2x00_loop_resync(scsi_qla_host_t *vha)
{ {
int rval = QLA_SUCCESS; int rval = QLA_SUCCESS;
uint32_t wait_time; uint32_t wait_time;
struct qla_hw_data *ha = vha->hw; struct req_que *req = vha->req;
struct req_que *req = ha->req_q_map[vha->req_ques[0]];
struct rsp_que *rsp = req->rsp; struct rsp_que *rsp = req->rsp;
atomic_set(&vha->loop_state, LOOP_UPDATE); atomic_set(&vha->loop_state, LOOP_UPDATE);
...@@ -3448,7 +3444,7 @@ qla25xx_init_queues(struct qla_hw_data *ha) ...@@ -3448,7 +3444,7 @@ qla25xx_init_queues(struct qla_hw_data *ha)
int ret = -1; int ret = -1;
int i; int i;
for (i = 1; i < ha->max_queues; i++) { for (i = 1; i < ha->max_rsp_queues; i++) {
rsp = ha->rsp_q_map[i]; rsp = ha->rsp_q_map[i];
if (rsp) { if (rsp) {
rsp->options &= ~BIT_0; rsp->options &= ~BIT_0;
...@@ -3462,6 +3458,8 @@ qla25xx_init_queues(struct qla_hw_data *ha) ...@@ -3462,6 +3458,8 @@ qla25xx_init_queues(struct qla_hw_data *ha)
"%s Rsp que:%d inited\n", __func__, "%s Rsp que:%d inited\n", __func__,
rsp->id)); rsp->id));
} }
}
for (i = 1; i < ha->max_req_queues; i++) {
req = ha->req_q_map[i]; req = ha->req_q_map[i];
if (req) { if (req) {
/* Clear outstanding commands array. */ /* Clear outstanding commands array. */
...@@ -4165,7 +4163,7 @@ qla24xx_configure_vhba(scsi_qla_host_t *vha) ...@@ -4165,7 +4163,7 @@ qla24xx_configure_vhba(scsi_qla_host_t *vha)
uint16_t mb[MAILBOX_REGISTER_COUNT]; uint16_t mb[MAILBOX_REGISTER_COUNT];
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
struct req_que *req = ha->req_q_map[vha->req_ques[0]]; struct req_que *req = vha->req;
struct rsp_que *rsp = req->rsp; struct rsp_que *rsp = req->rsp;
if (!vha->vp_idx) if (!vha->vp_idx)
......
...@@ -453,6 +453,7 @@ __qla2x00_marker(struct scsi_qla_host *vha, struct req_que *req, ...@@ -453,6 +453,7 @@ __qla2x00_marker(struct scsi_qla_host *vha, struct req_que *req,
mrk24->lun[2] = MSB(lun); mrk24->lun[2] = MSB(lun);
host_to_fcp_swap(mrk24->lun, sizeof(mrk24->lun)); host_to_fcp_swap(mrk24->lun, sizeof(mrk24->lun));
mrk24->vp_index = vha->vp_idx; mrk24->vp_index = vha->vp_idx;
mrk24->handle = MAKE_HANDLE(req->id, mrk24->handle);
} else { } else {
SET_TARGET_ID(ha, mrk->target, loop_id); SET_TARGET_ID(ha, mrk->target, loop_id);
mrk->lun = cpu_to_le16(lun); mrk->lun = cpu_to_le16(lun);
...@@ -531,9 +532,6 @@ qla2x00_req_pkt(struct scsi_qla_host *vha, struct req_que *req, ...@@ -531,9 +532,6 @@ qla2x00_req_pkt(struct scsi_qla_host *vha, struct req_que *req,
for (cnt = 0; cnt < REQUEST_ENTRY_SIZE / 4; cnt++) for (cnt = 0; cnt < REQUEST_ENTRY_SIZE / 4; cnt++)
*dword_ptr++ = 0; *dword_ptr++ = 0;
/* Set system defined field. */
pkt->sys_define = (uint8_t)req->ring_index;
/* Set entry count. */ /* Set entry count. */
pkt->entry_count = 1; pkt->entry_count = 1;
...@@ -724,19 +722,14 @@ qla24xx_start_scsi(srb_t *sp) ...@@ -724,19 +722,14 @@ qla24xx_start_scsi(srb_t *sp)
struct scsi_cmnd *cmd = sp->cmd; struct scsi_cmnd *cmd = sp->cmd;
struct scsi_qla_host *vha = sp->fcport->vha; struct scsi_qla_host *vha = sp->fcport->vha;
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
uint16_t que_id;
/* Setup device pointers. */ /* Setup device pointers. */
ret = 0; ret = 0;
que_id = vha->req_ques[0];
req = ha->req_q_map[que_id]; req = vha->req;
rsp = ha->rsp_q_map[0];
sp->que = req; sp->que = req;
if (req->rsp)
rsp = req->rsp;
else
rsp = ha->rsp_q_map[que_id];
/* So we know we haven't pci_map'ed anything yet */ /* So we know we haven't pci_map'ed anything yet */
tot_dsds = 0; tot_dsds = 0;
...@@ -794,7 +787,7 @@ qla24xx_start_scsi(srb_t *sp) ...@@ -794,7 +787,7 @@ qla24xx_start_scsi(srb_t *sp)
req->cnt -= req_cnt; req->cnt -= req_cnt;
cmd_pkt = (struct cmd_type_7 *)req->ring_ptr; cmd_pkt = (struct cmd_type_7 *)req->ring_ptr;
cmd_pkt->handle = handle; cmd_pkt->handle = MAKE_HANDLE(req->id, handle);
/* Zero out remaining portion of packet. */ /* Zero out remaining portion of packet. */
/* tagged queuing modifier -- default is TSK_SIMPLE (0). */ /* tagged queuing modifier -- default is TSK_SIMPLE (0). */
...@@ -823,6 +816,8 @@ qla24xx_start_scsi(srb_t *sp) ...@@ -823,6 +816,8 @@ qla24xx_start_scsi(srb_t *sp)
/* Set total data segment count. */ /* Set total data segment count. */
cmd_pkt->entry_count = (uint8_t)req_cnt; cmd_pkt->entry_count = (uint8_t)req_cnt;
/* Specify response queue number where completion should happen */
cmd_pkt->entry_status = (uint8_t) rsp->id;
wmb(); wmb();
/* Adjust ring index. */ /* Adjust ring index. */
...@@ -842,7 +837,7 @@ qla24xx_start_scsi(srb_t *sp) ...@@ -842,7 +837,7 @@ qla24xx_start_scsi(srb_t *sp)
/* Manage unprocessed RIO/ZIO commands in response queue. */ /* Manage unprocessed RIO/ZIO commands in response queue. */
if (vha->flags.process_response_queue && if (vha->flags.process_response_queue &&
rsp->ring_ptr->signature != RESPONSE_PROCESSED) rsp->ring_ptr->signature != RESPONSE_PROCESSED)
qla24xx_process_response_queue(rsp); qla24xx_process_response_queue(vha, rsp);
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&ha->hardware_lock, flags);
return QLA_SUCCESS; return QLA_SUCCESS;
......
This diff is collapsed.
...@@ -748,20 +748,20 @@ qla2x00_issue_iocb(scsi_qla_host_t *vha, void *buffer, dma_addr_t phys_addr, ...@@ -748,20 +748,20 @@ qla2x00_issue_iocb(scsi_qla_host_t *vha, void *buffer, dma_addr_t phys_addr,
* Kernel context. * Kernel context.
*/ */
int int
qla2x00_abort_command(scsi_qla_host_t *vha, srb_t *sp, struct req_que *req) qla2x00_abort_command(srb_t *sp)
{ {
unsigned long flags = 0; unsigned long flags = 0;
fc_port_t *fcport;
int rval; int rval;
uint32_t handle = 0; uint32_t handle = 0;
mbx_cmd_t mc; mbx_cmd_t mc;
mbx_cmd_t *mcp = &mc; mbx_cmd_t *mcp = &mc;
fc_port_t *fcport = sp->fcport;
scsi_qla_host_t *vha = fcport->vha;
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
struct req_que *req = vha->req;
DEBUG11(printk("qla2x00_abort_command(%ld): entered.\n", vha->host_no)); DEBUG11(printk("qla2x00_abort_command(%ld): entered.\n", vha->host_no));
fcport = sp->fcport;
spin_lock_irqsave(&ha->hardware_lock, flags); spin_lock_irqsave(&ha->hardware_lock, flags);
for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) { for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) {
if (req->outstanding_cmds[handle] == sp) if (req->outstanding_cmds[handle] == sp)
...@@ -800,7 +800,7 @@ qla2x00_abort_command(scsi_qla_host_t *vha, srb_t *sp, struct req_que *req) ...@@ -800,7 +800,7 @@ qla2x00_abort_command(scsi_qla_host_t *vha, srb_t *sp, struct req_que *req)
} }
int int
qla2x00_abort_target(struct fc_port *fcport, unsigned int l) qla2x00_abort_target(struct fc_port *fcport, unsigned int l, int tag)
{ {
int rval, rval2; int rval, rval2;
mbx_cmd_t mc; mbx_cmd_t mc;
...@@ -813,8 +813,8 @@ qla2x00_abort_target(struct fc_port *fcport, unsigned int l) ...@@ -813,8 +813,8 @@ qla2x00_abort_target(struct fc_port *fcport, unsigned int l)
l = l; l = l;
vha = fcport->vha; vha = fcport->vha;
req = vha->hw->req_q_map[0]; req = vha->hw->req_q_map[tag];
rsp = vha->hw->rsp_q_map[0]; rsp = vha->hw->rsp_q_map[tag];
mcp->mb[0] = MBC_ABORT_TARGET; mcp->mb[0] = MBC_ABORT_TARGET;
mcp->out_mb = MBX_9|MBX_2|MBX_1|MBX_0; mcp->out_mb = MBX_9|MBX_2|MBX_1|MBX_0;
if (HAS_EXTENDED_IDS(vha->hw)) { if (HAS_EXTENDED_IDS(vha->hw)) {
...@@ -850,7 +850,7 @@ qla2x00_abort_target(struct fc_port *fcport, unsigned int l) ...@@ -850,7 +850,7 @@ qla2x00_abort_target(struct fc_port *fcport, unsigned int l)
} }
int int
qla2x00_lun_reset(struct fc_port *fcport, unsigned int l) qla2x00_lun_reset(struct fc_port *fcport, unsigned int l, int tag)
{ {
int rval, rval2; int rval, rval2;
mbx_cmd_t mc; mbx_cmd_t mc;
...@@ -862,8 +862,8 @@ qla2x00_lun_reset(struct fc_port *fcport, unsigned int l) ...@@ -862,8 +862,8 @@ qla2x00_lun_reset(struct fc_port *fcport, unsigned int l)
DEBUG11(printk("%s(%ld): entered.\n", __func__, fcport->vha->host_no)); DEBUG11(printk("%s(%ld): entered.\n", __func__, fcport->vha->host_no));
vha = fcport->vha; vha = fcport->vha;
req = vha->hw->req_q_map[0]; req = vha->hw->req_q_map[tag];
rsp = vha->hw->rsp_q_map[0]; rsp = vha->hw->rsp_q_map[tag];
mcp->mb[0] = MBC_LUN_RESET; mcp->mb[0] = MBC_LUN_RESET;
mcp->out_mb = MBX_9|MBX_3|MBX_2|MBX_1|MBX_0; mcp->out_mb = MBX_9|MBX_3|MBX_2|MBX_1|MBX_0;
if (HAS_EXTENDED_IDS(vha->hw)) if (HAS_EXTENDED_IDS(vha->hw))
...@@ -1492,9 +1492,14 @@ qla24xx_login_fabric(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain, ...@@ -1492,9 +1492,14 @@ qla24xx_login_fabric(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain,
dma_addr_t lg_dma; dma_addr_t lg_dma;
uint32_t iop[2]; uint32_t iop[2];
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
struct req_que *req;
struct rsp_que *rsp;
DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
req = vha->req;
rsp = req->rsp;
lg = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma); lg = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma);
if (lg == NULL) { if (lg == NULL) {
DEBUG2_3(printk("%s(%ld): failed to allocate Login IOCB.\n", DEBUG2_3(printk("%s(%ld): failed to allocate Login IOCB.\n",
...@@ -1505,6 +1510,7 @@ qla24xx_login_fabric(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain, ...@@ -1505,6 +1510,7 @@ qla24xx_login_fabric(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain,
lg->entry_type = LOGINOUT_PORT_IOCB_TYPE; lg->entry_type = LOGINOUT_PORT_IOCB_TYPE;
lg->entry_count = 1; lg->entry_count = 1;
lg->handle = MAKE_HANDLE(req->id, lg->handle);
lg->nport_handle = cpu_to_le16(loop_id); lg->nport_handle = cpu_to_le16(loop_id);
lg->control_flags = __constant_cpu_to_le16(LCF_COMMAND_PLOGI); lg->control_flags = __constant_cpu_to_le16(LCF_COMMAND_PLOGI);
if (opt & BIT_0) if (opt & BIT_0)
...@@ -1753,6 +1759,8 @@ qla24xx_fabric_logout(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain, ...@@ -1753,6 +1759,8 @@ qla24xx_fabric_logout(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain,
struct logio_entry_24xx *lg; struct logio_entry_24xx *lg;
dma_addr_t lg_dma; dma_addr_t lg_dma;
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
struct req_que *req;
struct rsp_que *rsp;
DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
...@@ -1764,8 +1772,14 @@ qla24xx_fabric_logout(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain, ...@@ -1764,8 +1772,14 @@ qla24xx_fabric_logout(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain,
} }
memset(lg, 0, sizeof(struct logio_entry_24xx)); memset(lg, 0, sizeof(struct logio_entry_24xx));
if (ql2xmaxqueues > 1)
req = ha->req_q_map[0];
else
req = vha->req;
rsp = req->rsp;
lg->entry_type = LOGINOUT_PORT_IOCB_TYPE; lg->entry_type = LOGINOUT_PORT_IOCB_TYPE;
lg->entry_count = 1; lg->entry_count = 1;
lg->handle = MAKE_HANDLE(req->id, lg->handle);
lg->nport_handle = cpu_to_le16(loop_id); lg->nport_handle = cpu_to_le16(loop_id);
lg->control_flags = lg->control_flags =
__constant_cpu_to_le16(LCF_COMMAND_LOGO|LCF_IMPL_LOGO); __constant_cpu_to_le16(LCF_COMMAND_LOGO|LCF_IMPL_LOGO);
...@@ -2204,21 +2218,21 @@ qla24xx_get_isp_stats(scsi_qla_host_t *vha, struct link_statistics *stats, ...@@ -2204,21 +2218,21 @@ qla24xx_get_isp_stats(scsi_qla_host_t *vha, struct link_statistics *stats,
} }
int int
qla24xx_abort_command(scsi_qla_host_t *vha, srb_t *sp, struct req_que *req) qla24xx_abort_command(srb_t *sp)
{ {
int rval; int rval;
fc_port_t *fcport;
unsigned long flags = 0; unsigned long flags = 0;
struct abort_entry_24xx *abt; struct abort_entry_24xx *abt;
dma_addr_t abt_dma; dma_addr_t abt_dma;
uint32_t handle; uint32_t handle;
fc_port_t *fcport = sp->fcport;
struct scsi_qla_host *vha = fcport->vha;
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
struct req_que *req = sp->que;
DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
fcport = sp->fcport;
spin_lock_irqsave(&ha->hardware_lock, flags); spin_lock_irqsave(&ha->hardware_lock, flags);
for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) { for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) {
if (req->outstanding_cmds[handle] == sp) if (req->outstanding_cmds[handle] == sp)
...@@ -2240,6 +2254,7 @@ qla24xx_abort_command(scsi_qla_host_t *vha, srb_t *sp, struct req_que *req) ...@@ -2240,6 +2254,7 @@ qla24xx_abort_command(scsi_qla_host_t *vha, srb_t *sp, struct req_que *req)
abt->entry_type = ABORT_IOCB_TYPE; abt->entry_type = ABORT_IOCB_TYPE;
abt->entry_count = 1; abt->entry_count = 1;
abt->handle = MAKE_HANDLE(req->id, abt->handle);
abt->nport_handle = cpu_to_le16(fcport->loop_id); abt->nport_handle = cpu_to_le16(fcport->loop_id);
abt->handle_to_abort = handle; abt->handle_to_abort = handle;
abt->port_id[0] = fcport->d_id.b.al_pa; abt->port_id[0] = fcport->d_id.b.al_pa;
...@@ -2281,7 +2296,7 @@ struct tsk_mgmt_cmd { ...@@ -2281,7 +2296,7 @@ struct tsk_mgmt_cmd {
static int static int
__qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport, __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport,
unsigned int l) unsigned int l, int tag)
{ {
int rval, rval2; int rval, rval2;
struct tsk_mgmt_cmd *tsk; struct tsk_mgmt_cmd *tsk;
...@@ -2295,8 +2310,8 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport, ...@@ -2295,8 +2310,8 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport,
vha = fcport->vha; vha = fcport->vha;
ha = vha->hw; ha = vha->hw;
req = ha->req_q_map[0]; req = vha->req;
rsp = ha->rsp_q_map[0]; rsp = req->rsp;
tsk = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &tsk_dma); tsk = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &tsk_dma);
if (tsk == NULL) { if (tsk == NULL) {
DEBUG2_3(printk("%s(%ld): failed to allocate Task Management " DEBUG2_3(printk("%s(%ld): failed to allocate Task Management "
...@@ -2307,6 +2322,7 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport, ...@@ -2307,6 +2322,7 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport,
tsk->p.tsk.entry_type = TSK_MGMT_IOCB_TYPE; tsk->p.tsk.entry_type = TSK_MGMT_IOCB_TYPE;
tsk->p.tsk.entry_count = 1; tsk->p.tsk.entry_count = 1;
tsk->p.tsk.handle = MAKE_HANDLE(req->id, tsk->p.tsk.handle);
tsk->p.tsk.nport_handle = cpu_to_le16(fcport->loop_id); tsk->p.tsk.nport_handle = cpu_to_le16(fcport->loop_id);
tsk->p.tsk.timeout = cpu_to_le16(ha->r_a_tov / 10 * 2); tsk->p.tsk.timeout = cpu_to_le16(ha->r_a_tov / 10 * 2);
tsk->p.tsk.control_flags = cpu_to_le32(type); tsk->p.tsk.control_flags = cpu_to_le32(type);
...@@ -2353,15 +2369,15 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport, ...@@ -2353,15 +2369,15 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport,
} }
int int
qla24xx_abort_target(struct fc_port *fcport, unsigned int l) qla24xx_abort_target(struct fc_port *fcport, unsigned int l, int tag)
{ {
return __qla24xx_issue_tmf("Target", TCF_TARGET_RESET, fcport, l); return __qla24xx_issue_tmf("Target", TCF_TARGET_RESET, fcport, l, tag);
} }
int int
qla24xx_lun_reset(struct fc_port *fcport, unsigned int l) qla24xx_lun_reset(struct fc_port *fcport, unsigned int l, int tag)
{ {
return __qla24xx_issue_tmf("Lun", TCF_LUN_RESET, fcport, l); return __qla24xx_issue_tmf("Lun", TCF_LUN_RESET, fcport, l, tag);
} }
int int
...@@ -3150,6 +3166,8 @@ qla25xx_init_req_que(struct scsi_qla_host *vha, struct req_que *req) ...@@ -3150,6 +3166,8 @@ qla25xx_init_req_que(struct scsi_qla_host *vha, struct req_que *req)
WRT_REG_DWORD(&reg->req_q_in, 0); WRT_REG_DWORD(&reg->req_q_in, 0);
WRT_REG_DWORD(&reg->req_q_out, 0); WRT_REG_DWORD(&reg->req_q_out, 0);
} }
req->req_q_in = &reg->req_q_in;
req->req_q_out = &reg->req_q_out;
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&ha->hardware_lock, flags);
rval = qla2x00_mailbox_command(vha, mcp); rval = qla2x00_mailbox_command(vha, mcp);
...@@ -3176,7 +3194,6 @@ qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp) ...@@ -3176,7 +3194,6 @@ qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp)
mcp->mb[6] = MSW(MSD(rsp->dma)); mcp->mb[6] = MSW(MSD(rsp->dma));
mcp->mb[7] = LSW(MSD(rsp->dma)); mcp->mb[7] = LSW(MSD(rsp->dma));
mcp->mb[5] = rsp->length; mcp->mb[5] = rsp->length;
mcp->mb[11] = rsp->vp_idx;
mcp->mb[14] = rsp->msix->entry; mcp->mb[14] = rsp->msix->entry;
mcp->mb[13] = rsp->rid; mcp->mb[13] = rsp->rid;
...@@ -3188,7 +3205,7 @@ qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp) ...@@ -3188,7 +3205,7 @@ qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp)
mcp->mb[8] = 0; mcp->mb[8] = 0;
/* que out ptr index */ /* que out ptr index */
mcp->mb[9] = 0; mcp->mb[9] = 0;
mcp->out_mb = MBX_14|MBX_13|MBX_12|MBX_11|MBX_10|MBX_9|MBX_8|MBX_7 mcp->out_mb = MBX_14|MBX_13|MBX_9|MBX_8|MBX_7
|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; |MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0;
mcp->in_mb = MBX_0; mcp->in_mb = MBX_0;
mcp->flags = MBX_DMA_OUT; mcp->flags = MBX_DMA_OUT;
......
...@@ -398,9 +398,8 @@ qla24xx_create_vhost(struct fc_vport *fc_vport) ...@@ -398,9 +398,8 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
qla2x00_start_timer(vha, qla2x00_timer, WATCH_INTERVAL); qla2x00_start_timer(vha, qla2x00_timer, WATCH_INTERVAL);
memset(vha->req_ques, 0, sizeof(vha->req_ques)); vha->req = base_vha->req;
vha->req_ques[0] = ha->req_q_map[0]->id; host->can_queue = base_vha->req->length + 128;
host->can_queue = ha->req_q_map[0]->length + 128;
host->this_id = 255; host->this_id = 255;
host->cmd_per_lun = 3; host->cmd_per_lun = 3;
host->max_cmd_len = MAX_CMDSZ; host->max_cmd_len = MAX_CMDSZ;
...@@ -515,76 +514,53 @@ int qla25xx_update_req_que(struct scsi_qla_host *vha, uint8_t que, uint8_t qos) ...@@ -515,76 +514,53 @@ int qla25xx_update_req_que(struct scsi_qla_host *vha, uint8_t que, uint8_t qos)
/* Delete all queues for a given vhost */ /* Delete all queues for a given vhost */
int int
qla25xx_delete_queues(struct scsi_qla_host *vha, uint8_t que_no) qla25xx_delete_queues(struct scsi_qla_host *vha)
{ {
int cnt, ret = 0; int cnt, ret = 0;
struct req_que *req = NULL; struct req_que *req = NULL;
struct rsp_que *rsp = NULL; struct rsp_que *rsp = NULL;
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
if (que_no) { /* Delete request queues */
/* Delete request queue */ for (cnt = 1; cnt < ha->max_req_queues; cnt++) {
req = ha->req_q_map[que_no]; req = ha->req_q_map[cnt];
if (req) { if (req) {
rsp = req->rsp;
ret = qla25xx_delete_req_que(vha, req); ret = qla25xx_delete_req_que(vha, req);
if (ret != QLA_SUCCESS) { if (ret != QLA_SUCCESS) {
qla_printk(KERN_WARNING, ha, qla_printk(KERN_WARNING, ha,
"Couldn't delete req que %d\n", req->id); "Couldn't delete req que %d\n",
req->id);
return ret; return ret;
} }
/* Delete associated response queue */
if (rsp) {
ret = qla25xx_delete_rsp_que(vha, rsp);
if (ret != QLA_SUCCESS) {
qla_printk(KERN_WARNING, ha,
"Couldn't delete rsp que %d\n",
rsp->id);
return ret;
}
}
} }
} else { /* delete all queues of this host */ }
for (cnt = 0; cnt < QLA_MAX_HOST_QUES; cnt++) {
/* Delete request queues */ /* Delete response queues */
req = ha->req_q_map[vha->req_ques[cnt]]; for (cnt = 1; cnt < ha->max_rsp_queues; cnt++) {
if (req && req->id) { rsp = ha->rsp_q_map[cnt];
rsp = req->rsp; if (rsp) {
ret = qla25xx_delete_req_que(vha, req); ret = qla25xx_delete_rsp_que(vha, rsp);
if (ret != QLA_SUCCESS) { if (ret != QLA_SUCCESS) {
qla_printk(KERN_WARNING, ha, qla_printk(KERN_WARNING, ha,
"Couldn't delete req que %d\n", "Couldn't delete rsp que %d\n",
vha->req_ques[cnt]); rsp->id);
return ret; return ret;
}
vha->req_ques[cnt] = ha->req_q_map[0]->id;
/* Delete associated response queue */
if (rsp && rsp->id) {
ret = qla25xx_delete_rsp_que(vha, rsp);
if (ret != QLA_SUCCESS) {
qla_printk(KERN_WARNING, ha,
"Couldn't delete rsp que %d\n",
rsp->id);
return ret;
}
}
} }
} }
} }
qla_printk(KERN_INFO, ha, "Queues deleted for vport:%d\n",
vha->vp_idx);
return ret; return ret;
} }
int int
qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options, qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options,
uint8_t vp_idx, uint16_t rid, uint8_t rsp_que, uint8_t qos) uint8_t vp_idx, uint16_t rid, int rsp_que, uint8_t qos)
{ {
int ret = 0; int ret = 0;
struct req_que *req = NULL; struct req_que *req = NULL;
struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
uint16_t que_id = 0; uint16_t que_id = 0;
device_reg_t __iomem *reg; device_reg_t __iomem *reg;
uint32_t cnt;
req = kzalloc(sizeof(struct req_que), GFP_KERNEL); req = kzalloc(sizeof(struct req_que), GFP_KERNEL);
if (req == NULL) { if (req == NULL) {
...@@ -604,8 +580,8 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options, ...@@ -604,8 +580,8 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options,
} }
mutex_lock(&ha->vport_lock); mutex_lock(&ha->vport_lock);
que_id = find_first_zero_bit(ha->req_qid_map, ha->max_queues); que_id = find_first_zero_bit(ha->req_qid_map, ha->max_req_queues);
if (que_id >= ha->max_queues) { if (que_id >= ha->max_req_queues) {
mutex_unlock(&ha->vport_lock); mutex_unlock(&ha->vport_lock);
qla_printk(KERN_INFO, ha, "No resources to create " qla_printk(KERN_INFO, ha, "No resources to create "
"additional request queue\n"); "additional request queue\n");
...@@ -617,10 +593,10 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options, ...@@ -617,10 +593,10 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options,
req->vp_idx = vp_idx; req->vp_idx = vp_idx;
req->qos = qos; req->qos = qos;
if (ha->rsp_q_map[rsp_que]) { if (rsp_que < 0)
req->rsp = NULL;
else
req->rsp = ha->rsp_q_map[rsp_que]; req->rsp = ha->rsp_q_map[rsp_que];
req->rsp->req = req;
}
/* Use alternate PCI bus number */ /* Use alternate PCI bus number */
if (MSB(req->rid)) if (MSB(req->rid))
options |= BIT_4; options |= BIT_4;
...@@ -628,13 +604,16 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options, ...@@ -628,13 +604,16 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options,
if (LSB(req->rid)) if (LSB(req->rid))
options |= BIT_5; options |= BIT_5;
req->options = options; req->options = options;
for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++)
req->outstanding_cmds[cnt] = NULL;
req->current_outstanding_cmd = 1;
req->ring_ptr = req->ring; req->ring_ptr = req->ring;
req->ring_index = 0; req->ring_index = 0;
req->cnt = req->length; req->cnt = req->length;
req->id = que_id; req->id = que_id;
reg = ISP_QUE_REG(ha, que_id); reg = ISP_QUE_REG(ha, que_id);
req->req_q_in = &reg->isp25mq.req_q_in;
req->req_q_out = &reg->isp25mq.req_q_out;
req->max_q_depth = ha->req_q_map[0]->max_q_depth; req->max_q_depth = ha->req_q_map[0]->max_q_depth;
mutex_unlock(&ha->vport_lock); mutex_unlock(&ha->vport_lock);
...@@ -657,7 +636,7 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options, ...@@ -657,7 +636,7 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options,
/* create response queue */ /* create response queue */
int int
qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options, qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options,
uint8_t vp_idx, uint16_t rid) uint8_t vp_idx, uint16_t rid, int req)
{ {
int ret = 0; int ret = 0;
struct rsp_que *rsp = NULL; struct rsp_que *rsp = NULL;
...@@ -672,7 +651,7 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options, ...@@ -672,7 +651,7 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options,
goto que_failed; goto que_failed;
} }
rsp->length = RESPONSE_ENTRY_CNT_2300; rsp->length = RESPONSE_ENTRY_CNT_MQ;
rsp->ring = dma_alloc_coherent(&ha->pdev->dev, rsp->ring = dma_alloc_coherent(&ha->pdev->dev,
(rsp->length + 1) * sizeof(response_t), (rsp->length + 1) * sizeof(response_t),
&rsp->dma, GFP_KERNEL); &rsp->dma, GFP_KERNEL);
...@@ -683,8 +662,8 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options, ...@@ -683,8 +662,8 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options,
} }
mutex_lock(&ha->vport_lock); mutex_lock(&ha->vport_lock);
que_id = find_first_zero_bit(ha->rsp_qid_map, ha->max_queues); que_id = find_first_zero_bit(ha->rsp_qid_map, ha->max_rsp_queues);
if (que_id >= ha->max_queues) { if (que_id >= ha->max_rsp_queues) {
mutex_unlock(&ha->vport_lock); mutex_unlock(&ha->vport_lock);
qla_printk(KERN_INFO, ha, "No resources to create " qla_printk(KERN_INFO, ha, "No resources to create "
"additional response queue\n"); "additional response queue\n");
...@@ -708,8 +687,6 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options, ...@@ -708,8 +687,6 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options,
if (LSB(rsp->rid)) if (LSB(rsp->rid))
options |= BIT_5; options |= BIT_5;
rsp->options = options; rsp->options = options;
rsp->ring_ptr = rsp->ring;
rsp->ring_index = 0;
rsp->id = que_id; rsp->id = que_id;
reg = ISP_QUE_REG(ha, que_id); reg = ISP_QUE_REG(ha, que_id);
rsp->rsp_q_in = &reg->isp25mq.rsp_q_in; rsp->rsp_q_in = &reg->isp25mq.rsp_q_in;
...@@ -728,9 +705,12 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options, ...@@ -728,9 +705,12 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options,
mutex_unlock(&ha->vport_lock); mutex_unlock(&ha->vport_lock);
goto que_failed; goto que_failed;
} }
if (req >= 0)
rsp->req = ha->req_q_map[req];
else
rsp->req = NULL;
qla2x00_init_response_q_entries(rsp); qla2x00_init_response_q_entries(rsp);
return rsp->id; return rsp->id;
que_failed: que_failed:
...@@ -744,14 +724,16 @@ qla25xx_create_queues(struct scsi_qla_host *vha, uint8_t qos) ...@@ -744,14 +724,16 @@ qla25xx_create_queues(struct scsi_qla_host *vha, uint8_t qos)
uint16_t options = 0; uint16_t options = 0;
uint8_t ret = 0; uint8_t ret = 0;
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
struct rsp_que *rsp;
options |= BIT_1; options |= BIT_1;
ret = qla25xx_create_rsp_que(ha, options, vha->vp_idx, 0); ret = qla25xx_create_rsp_que(ha, options, vha->vp_idx, 0, -1);
if (!ret) { if (!ret) {
qla_printk(KERN_WARNING, ha, "Response Que create failed\n"); qla_printk(KERN_WARNING, ha, "Response Que create failed\n");
return ret; return ret;
} else } else
qla_printk(KERN_INFO, ha, "Response Que:%d created.\n", ret); qla_printk(KERN_INFO, ha, "Response Que:%d created.\n", ret);
rsp = ha->rsp_q_map[ret];
options = 0; options = 0;
if (qos & BIT_7) if (qos & BIT_7)
...@@ -759,10 +741,11 @@ qla25xx_create_queues(struct scsi_qla_host *vha, uint8_t qos) ...@@ -759,10 +741,11 @@ qla25xx_create_queues(struct scsi_qla_host *vha, uint8_t qos)
ret = qla25xx_create_req_que(ha, options, vha->vp_idx, 0, ret, ret = qla25xx_create_req_que(ha, options, vha->vp_idx, 0, ret,
qos & ~BIT_7); qos & ~BIT_7);
if (ret) { if (ret) {
vha->req_ques[0] = ret; vha->req = ha->req_q_map[ret];
qla_printk(KERN_INFO, ha, "Request Que:%d created.\n", ret); qla_printk(KERN_INFO, ha, "Request Que:%d created.\n", ret);
} else } else
qla_printk(KERN_WARNING, ha, "Request Que create failed\n"); qla_printk(KERN_WARNING, ha, "Request Que create failed\n");
rsp->req = ha->req_q_map[ret];
return ret; return ret;
} }
...@@ -187,7 +187,7 @@ static void qla2x00_sp_free_dma(srb_t *); ...@@ -187,7 +187,7 @@ static void qla2x00_sp_free_dma(srb_t *);
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
static int qla2x00_alloc_queues(struct qla_hw_data *ha) static int qla2x00_alloc_queues(struct qla_hw_data *ha)
{ {
ha->req_q_map = kzalloc(sizeof(struct req_que *) * ha->max_queues, ha->req_q_map = kzalloc(sizeof(struct req_que *) * ha->max_req_queues,
GFP_KERNEL); GFP_KERNEL);
if (!ha->req_q_map) { if (!ha->req_q_map) {
qla_printk(KERN_WARNING, ha, qla_printk(KERN_WARNING, ha,
...@@ -195,7 +195,7 @@ static int qla2x00_alloc_queues(struct qla_hw_data *ha) ...@@ -195,7 +195,7 @@ static int qla2x00_alloc_queues(struct qla_hw_data *ha)
goto fail_req_map; goto fail_req_map;
} }
ha->rsp_q_map = kzalloc(sizeof(struct rsp_que *) * ha->max_queues, ha->rsp_q_map = kzalloc(sizeof(struct rsp_que *) * ha->max_rsp_queues,
GFP_KERNEL); GFP_KERNEL);
if (!ha->rsp_q_map) { if (!ha->rsp_q_map) {
qla_printk(KERN_WARNING, ha, qla_printk(KERN_WARNING, ha,
...@@ -213,16 +213,8 @@ static int qla2x00_alloc_queues(struct qla_hw_data *ha) ...@@ -213,16 +213,8 @@ static int qla2x00_alloc_queues(struct qla_hw_data *ha)
return -ENOMEM; return -ENOMEM;
} }
static void qla2x00_free_que(struct qla_hw_data *ha, struct req_que *req, static void qla2x00_free_req_que(struct qla_hw_data *ha, struct req_que *req)
struct rsp_que *rsp)
{ {
if (rsp && rsp->ring)
dma_free_coherent(&ha->pdev->dev,
(rsp->length + 1) * sizeof(response_t),
rsp->ring, rsp->dma);
kfree(rsp);
rsp = NULL;
if (req && req->ring) if (req && req->ring)
dma_free_coherent(&ha->pdev->dev, dma_free_coherent(&ha->pdev->dev,
(req->length + 1) * sizeof(request_t), (req->length + 1) * sizeof(request_t),
...@@ -232,22 +224,36 @@ static void qla2x00_free_que(struct qla_hw_data *ha, struct req_que *req, ...@@ -232,22 +224,36 @@ static void qla2x00_free_que(struct qla_hw_data *ha, struct req_que *req,
req = NULL; req = NULL;
} }
static void qla2x00_free_rsp_que(struct qla_hw_data *ha, struct rsp_que *rsp)
{
if (rsp && rsp->ring)
dma_free_coherent(&ha->pdev->dev,
(rsp->length + 1) * sizeof(response_t),
rsp->ring, rsp->dma);
kfree(rsp);
rsp = NULL;
}
static void qla2x00_free_queues(struct qla_hw_data *ha) static void qla2x00_free_queues(struct qla_hw_data *ha)
{ {
struct req_que *req; struct req_que *req;
struct rsp_que *rsp; struct rsp_que *rsp;
int cnt; int cnt;
for (cnt = 0; cnt < ha->max_queues; cnt++) { for (cnt = 0; cnt < ha->max_req_queues; cnt++) {
rsp = ha->rsp_q_map[cnt];
req = ha->req_q_map[cnt]; req = ha->req_q_map[cnt];
qla2x00_free_que(ha, req, rsp); qla2x00_free_req_que(ha, req);
} }
kfree(ha->rsp_q_map);
ha->rsp_q_map = NULL;
kfree(ha->req_q_map); kfree(ha->req_q_map);
ha->req_q_map = NULL; ha->req_q_map = NULL;
for (cnt = 0; cnt < ha->max_rsp_queues; cnt++) {
rsp = ha->rsp_q_map[cnt];
qla2x00_free_rsp_que(ha, rsp);
}
kfree(ha->rsp_q_map);
ha->rsp_q_map = NULL;
} }
static char * static char *
...@@ -612,7 +618,7 @@ qla2x00_wait_for_loop_ready(scsi_qla_host_t *vha) ...@@ -612,7 +618,7 @@ qla2x00_wait_for_loop_ready(scsi_qla_host_t *vha)
void void
qla2x00_abort_fcport_cmds(fc_port_t *fcport) qla2x00_abort_fcport_cmds(fc_port_t *fcport)
{ {
int cnt, que, id; int cnt;
unsigned long flags; unsigned long flags;
srb_t *sp; srb_t *sp;
scsi_qla_host_t *vha = fcport->vha; scsi_qla_host_t *vha = fcport->vha;
...@@ -620,32 +626,27 @@ qla2x00_abort_fcport_cmds(fc_port_t *fcport) ...@@ -620,32 +626,27 @@ qla2x00_abort_fcport_cmds(fc_port_t *fcport)
struct req_que *req; struct req_que *req;
spin_lock_irqsave(&ha->hardware_lock, flags); spin_lock_irqsave(&ha->hardware_lock, flags);
for (que = 0; que < QLA_MAX_HOST_QUES; que++) { req = vha->req;
id = vha->req_ques[que]; for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) {
req = ha->req_q_map[id]; sp = req->outstanding_cmds[cnt];
if (!req) if (!sp)
continue;
if (sp->fcport != fcport)
continue; continue;
for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) {
sp = req->outstanding_cmds[cnt];
if (!sp)
continue;
if (sp->fcport != fcport)
continue;
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&ha->hardware_lock, flags);
if (ha->isp_ops->abort_command(vha, sp, req)) { if (ha->isp_ops->abort_command(sp)) {
DEBUG2(qla_printk(KERN_WARNING, ha,
"Abort failed -- %lx\n",
sp->cmd->serial_number));
} else {
if (qla2x00_eh_wait_on_command(sp->cmd) !=
QLA_SUCCESS)
DEBUG2(qla_printk(KERN_WARNING, ha, DEBUG2(qla_printk(KERN_WARNING, ha,
"Abort failed -- %lx\n", "Abort failed while waiting -- %lx\n",
sp->cmd->serial_number)); sp->cmd->serial_number));
} else {
if (qla2x00_eh_wait_on_command(sp->cmd) !=
QLA_SUCCESS)
DEBUG2(qla_printk(KERN_WARNING, ha,
"Abort failed while waiting -- %lx\n",
sp->cmd->serial_number));
}
spin_lock_irqsave(&ha->hardware_lock, flags);
} }
spin_lock_irqsave(&ha->hardware_lock, flags);
} }
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&ha->hardware_lock, flags);
} }
...@@ -726,7 +727,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) ...@@ -726,7 +727,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
" pid=%ld.\n", __func__, vha->host_no, sp, serial)); " pid=%ld.\n", __func__, vha->host_no, sp, serial));
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&ha->hardware_lock, flags);
if (ha->isp_ops->abort_command(vha, sp, req)) { if (ha->isp_ops->abort_command(sp)) {
DEBUG2(printk("%s(%ld): abort_command " DEBUG2(printk("%s(%ld): abort_command "
"mbx failed.\n", __func__, vha->host_no)); "mbx failed.\n", __func__, vha->host_no));
ret = FAILED; ret = FAILED;
...@@ -820,7 +821,7 @@ static char *reset_errors[] = { ...@@ -820,7 +821,7 @@ static char *reset_errors[] = {
static int static int
__qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type, __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type,
struct scsi_cmnd *cmd, int (*do_reset)(struct fc_port *, unsigned int)) struct scsi_cmnd *cmd, int (*do_reset)(struct fc_port *, unsigned int, int))
{ {
scsi_qla_host_t *vha = shost_priv(cmd->device->host); scsi_qla_host_t *vha = shost_priv(cmd->device->host);
fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
...@@ -841,7 +842,8 @@ __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type, ...@@ -841,7 +842,8 @@ __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type,
if (qla2x00_wait_for_loop_ready(vha) != QLA_SUCCESS) if (qla2x00_wait_for_loop_ready(vha) != QLA_SUCCESS)
goto eh_reset_failed; goto eh_reset_failed;
err = 2; err = 2;
if (do_reset(fcport, cmd->device->lun) != QLA_SUCCESS) if (do_reset(fcport, cmd->device->lun, cmd->request->cpu + 1)
!= QLA_SUCCESS)
goto eh_reset_failed; goto eh_reset_failed;
err = 3; err = 3;
if (qla2x00_eh_wait_for_pending_commands(vha, cmd->device->id, if (qla2x00_eh_wait_for_pending_commands(vha, cmd->device->id,
...@@ -1065,7 +1067,7 @@ qla2x00_loop_reset(scsi_qla_host_t *vha) ...@@ -1065,7 +1067,7 @@ qla2x00_loop_reset(scsi_qla_host_t *vha)
if (fcport->port_type != FCT_TARGET) if (fcport->port_type != FCT_TARGET)
continue; continue;
ret = ha->isp_ops->target_reset(fcport, 0); ret = ha->isp_ops->target_reset(fcport, 0, 0);
if (ret != QLA_SUCCESS) { if (ret != QLA_SUCCESS) {
DEBUG2_3(printk("%s(%ld): bus_reset failed: " DEBUG2_3(printk("%s(%ld): bus_reset failed: "
"target_reset=%d d_id=%x.\n", __func__, "target_reset=%d d_id=%x.\n", __func__,
...@@ -1089,7 +1091,7 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res) ...@@ -1089,7 +1091,7 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
struct req_que *req; struct req_que *req;
spin_lock_irqsave(&ha->hardware_lock, flags); spin_lock_irqsave(&ha->hardware_lock, flags);
for (que = 0; que < ha->max_queues; que++) { for (que = 0; que < ha->max_req_queues; que++) {
req = ha->req_q_map[que]; req = ha->req_q_map[que];
if (!req) if (!req)
continue; continue;
...@@ -1124,7 +1126,7 @@ qla2xxx_slave_configure(struct scsi_device *sdev) ...@@ -1124,7 +1126,7 @@ qla2xxx_slave_configure(struct scsi_device *sdev)
scsi_qla_host_t *vha = shost_priv(sdev->host); scsi_qla_host_t *vha = shost_priv(sdev->host);
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
struct fc_rport *rport = starget_to_rport(sdev->sdev_target); struct fc_rport *rport = starget_to_rport(sdev->sdev_target);
struct req_que *req = ha->req_q_map[vha->req_ques[0]]; struct req_que *req = vha->req;
if (sdev->tagged_supported) if (sdev->tagged_supported)
scsi_activate_tcq(sdev, req->max_q_depth); scsi_activate_tcq(sdev, req->max_q_depth);
...@@ -1572,8 +1574,9 @@ qla2x00_iospace_config(struct qla_hw_data *ha) ...@@ -1572,8 +1574,9 @@ qla2x00_iospace_config(struct qla_hw_data *ha)
} }
/* Determine queue resources */ /* Determine queue resources */
ha->max_queues = 1; ha->max_req_queues = ha->max_rsp_queues = 1;
if (ql2xmaxqueues <= 1 || (!IS_QLA25XX(ha) && !IS_QLA81XX(ha))) if (ql2xmaxqueues <= 1 &&
(!IS_QLA25XX(ha) && !IS_QLA81XX(ha)))
goto mqiobase_exit; goto mqiobase_exit;
ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 3), ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 3),
pci_resource_len(ha->pdev, 3)); pci_resource_len(ha->pdev, 3));
...@@ -1581,20 +1584,17 @@ qla2x00_iospace_config(struct qla_hw_data *ha) ...@@ -1581,20 +1584,17 @@ qla2x00_iospace_config(struct qla_hw_data *ha)
/* Read MSIX vector size of the board */ /* Read MSIX vector size of the board */
pci_read_config_word(ha->pdev, QLA_PCI_MSIX_CONTROL, &msix); pci_read_config_word(ha->pdev, QLA_PCI_MSIX_CONTROL, &msix);
ha->msix_count = msix; ha->msix_count = msix;
/* Max queues are bounded by available msix vectors */ if (ql2xmaxqueues > 1) {
/* queue 0 uses two msix vectors */ ha->max_req_queues = ql2xmaxqueues > QLA_MQ_SIZE ?
if (ha->msix_count - 1 < ql2xmaxqueues) QLA_MQ_SIZE : ql2xmaxqueues;
ha->max_queues = ha->msix_count - 1; DEBUG2(qla_printk(KERN_INFO, ha, "QoS mode set, max no"
else if (ql2xmaxqueues > QLA_MQ_SIZE) " of request queues:%d\n", ha->max_req_queues));
ha->max_queues = QLA_MQ_SIZE; }
else } else
ha->max_queues = ql2xmaxqueues; qla_printk(KERN_INFO, ha, "BAR 3 not enabled\n");
qla_printk(KERN_INFO, ha,
"MSI-X vector count: %d\n", msix);
}
mqiobase_exit: mqiobase_exit:
ha->msix_count = ha->max_queues + 1; ha->msix_count = ha->max_rsp_queues + 1;
return (0); return (0);
iospace_error_exit: iospace_error_exit:
...@@ -1804,14 +1804,15 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1804,14 +1804,15 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
ret = -ENOMEM; ret = -ENOMEM;
qla2x00_mem_free(ha); qla2x00_mem_free(ha);
qla2x00_free_que(ha, req, rsp); qla2x00_free_req_que(ha, req);
qla2x00_free_rsp_que(ha, rsp);
goto probe_hw_failed; goto probe_hw_failed;
} }
pci_set_drvdata(pdev, base_vha); pci_set_drvdata(pdev, base_vha);
host = base_vha->host; host = base_vha->host;
base_vha->req_ques[0] = req->id; base_vha->req = req;
host->can_queue = req->length + 128; host->can_queue = req->length + 128;
if (IS_QLA2XXX_MIDTYPE(ha)) if (IS_QLA2XXX_MIDTYPE(ha))
base_vha->mgmt_svr_loop_id = 10 + base_vha->vp_idx; base_vha->mgmt_svr_loop_id = 10 + base_vha->vp_idx;
...@@ -1842,7 +1843,10 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1842,7 +1843,10 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
} }
ha->rsp_q_map[0] = rsp; ha->rsp_q_map[0] = rsp;
ha->req_q_map[0] = req; ha->req_q_map[0] = req;
rsp->req = req;
req->rsp = rsp;
set_bit(0, ha->req_qid_map);
set_bit(0, ha->rsp_qid_map);
/* FWI2-capable only. */ /* FWI2-capable only. */
req->req_q_in = &ha->iobase->isp24.req_q_in; req->req_q_in = &ha->iobase->isp24.req_q_in;
req->req_q_out = &ha->iobase->isp24.req_q_out; req->req_q_out = &ha->iobase->isp24.req_q_out;
...@@ -1918,8 +1922,9 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1918,8 +1922,9 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
return 0; return 0;
probe_init_failed: probe_init_failed:
qla2x00_free_que(ha, req, rsp); qla2x00_free_req_que(ha, req);
ha->max_queues = 0; qla2x00_free_rsp_que(ha, rsp);
ha->max_req_queues = ha->max_rsp_queues = 0;
probe_failed: probe_failed:
if (base_vha->timer_active) if (base_vha->timer_active)
...@@ -2018,6 +2023,8 @@ qla2x00_free_device(scsi_qla_host_t *vha) ...@@ -2018,6 +2023,8 @@ qla2x00_free_device(scsi_qla_host_t *vha)
{ {
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
qla25xx_delete_queues(vha);
if (ha->flags.fce_enabled) if (ha->flags.fce_enabled)
qla2x00_disable_fce_trace(vha, NULL, NULL); qla2x00_disable_fce_trace(vha, NULL, NULL);
......
...@@ -920,6 +920,7 @@ qla2xxx_flash_npiv_conf(scsi_qla_host_t *vha) ...@@ -920,6 +920,7 @@ qla2xxx_flash_npiv_conf(scsi_qla_host_t *vha)
entry = data + sizeof(struct qla_npiv_header); entry = data + sizeof(struct qla_npiv_header);
cnt = le16_to_cpu(hdr.entries); cnt = le16_to_cpu(hdr.entries);
ha->flex_port_count = cnt;
for (i = 0; cnt; cnt--, entry++, i++) { for (i = 0; cnt; cnt--, entry++, i++) {
uint16_t flags; uint16_t flags;
struct fc_vport_identifiers vid; struct fc_vport_identifiers vid;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment