aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_mbx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_mbx.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c50
1 files changed, 39 insertions, 11 deletions
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index b6202fe118ac..05d595d9a7ef 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -2006,7 +2006,7 @@ qla2x00_get_id_list(scsi_qla_host_t *vha, void *id_list, dma_addr_t id_list_dma,
2006int 2006int
2007qla2x00_get_resource_cnts(scsi_qla_host_t *vha, uint16_t *cur_xchg_cnt, 2007qla2x00_get_resource_cnts(scsi_qla_host_t *vha, uint16_t *cur_xchg_cnt,
2008 uint16_t *orig_xchg_cnt, uint16_t *cur_iocb_cnt, 2008 uint16_t *orig_xchg_cnt, uint16_t *cur_iocb_cnt,
2009 uint16_t *orig_iocb_cnt, uint16_t *max_npiv_vports) 2009 uint16_t *orig_iocb_cnt, uint16_t *max_npiv_vports, uint16_t *max_fcfs)
2010{ 2010{
2011 int rval; 2011 int rval;
2012 mbx_cmd_t mc; 2012 mbx_cmd_t mc;
@@ -2017,6 +2017,8 @@ qla2x00_get_resource_cnts(scsi_qla_host_t *vha, uint16_t *cur_xchg_cnt,
2017 mcp->mb[0] = MBC_GET_RESOURCE_COUNTS; 2017 mcp->mb[0] = MBC_GET_RESOURCE_COUNTS;
2018 mcp->out_mb = MBX_0; 2018 mcp->out_mb = MBX_0;
2019 mcp->in_mb = MBX_11|MBX_10|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; 2019 mcp->in_mb = MBX_11|MBX_10|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0;
2020 if (IS_QLA81XX(vha->hw))
2021 mcp->in_mb |= MBX_12;
2020 mcp->tov = MBX_TOV_SECONDS; 2022 mcp->tov = MBX_TOV_SECONDS;
2021 mcp->flags = 0; 2023 mcp->flags = 0;
2022 rval = qla2x00_mailbox_command(vha, mcp); 2024 rval = qla2x00_mailbox_command(vha, mcp);
@@ -2027,9 +2029,10 @@ qla2x00_get_resource_cnts(scsi_qla_host_t *vha, uint16_t *cur_xchg_cnt,
2027 vha->host_no, mcp->mb[0])); 2029 vha->host_no, mcp->mb[0]));
2028 } else { 2030 } else {
2029 DEBUG11(printk("%s(%ld): done. mb1=%x mb2=%x mb3=%x mb6=%x " 2031 DEBUG11(printk("%s(%ld): done. mb1=%x mb2=%x mb3=%x mb6=%x "
2030 "mb7=%x mb10=%x mb11=%x.\n", __func__, vha->host_no, 2032 "mb7=%x mb10=%x mb11=%x mb12=%x.\n", __func__,
2031 mcp->mb[1], mcp->mb[2], mcp->mb[3], mcp->mb[6], mcp->mb[7], 2033 vha->host_no, mcp->mb[1], mcp->mb[2], mcp->mb[3],
2032 mcp->mb[10], mcp->mb[11])); 2034 mcp->mb[6], mcp->mb[7], mcp->mb[10], mcp->mb[11],
2035 mcp->mb[12]));
2033 2036
2034 if (cur_xchg_cnt) 2037 if (cur_xchg_cnt)
2035 *cur_xchg_cnt = mcp->mb[3]; 2038 *cur_xchg_cnt = mcp->mb[3];
@@ -2041,6 +2044,8 @@ qla2x00_get_resource_cnts(scsi_qla_host_t *vha, uint16_t *cur_xchg_cnt,
2041 *orig_iocb_cnt = mcp->mb[10]; 2044 *orig_iocb_cnt = mcp->mb[10];
2042 if (vha->hw->flags.npiv_supported && max_npiv_vports) 2045 if (vha->hw->flags.npiv_supported && max_npiv_vports)
2043 *max_npiv_vports = mcp->mb[11]; 2046 *max_npiv_vports = mcp->mb[11];
2047 if (IS_QLA81XX(vha->hw) && max_fcfs)
2048 *max_fcfs = mcp->mb[12];
2044 } 2049 }
2045 2050
2046 return (rval); 2051 return (rval);
@@ -2313,6 +2318,7 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport,
2313{ 2318{
2314 int rval, rval2; 2319 int rval, rval2;
2315 struct tsk_mgmt_cmd *tsk; 2320 struct tsk_mgmt_cmd *tsk;
2321 struct sts_entry_24xx *sts;
2316 dma_addr_t tsk_dma; 2322 dma_addr_t tsk_dma;
2317 scsi_qla_host_t *vha; 2323 scsi_qla_host_t *vha;
2318 struct qla_hw_data *ha; 2324 struct qla_hw_data *ha;
@@ -2352,20 +2358,37 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport,
2352 sizeof(tsk->p.tsk.lun)); 2358 sizeof(tsk->p.tsk.lun));
2353 } 2359 }
2354 2360
2361 sts = &tsk->p.sts;
2355 rval = qla2x00_issue_iocb(vha, tsk, tsk_dma, 0); 2362 rval = qla2x00_issue_iocb(vha, tsk, tsk_dma, 0);
2356 if (rval != QLA_SUCCESS) { 2363 if (rval != QLA_SUCCESS) {
2357 DEBUG2_3_11(printk("%s(%ld): failed to issue %s Reset IOCB " 2364 DEBUG2_3_11(printk("%s(%ld): failed to issue %s Reset IOCB "
2358 "(%x).\n", __func__, vha->host_no, name, rval)); 2365 "(%x).\n", __func__, vha->host_no, name, rval));
2359 } else if (tsk->p.sts.entry_status != 0) { 2366 } else if (sts->entry_status != 0) {
2360 DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " 2367 DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
2361 "-- error status (%x).\n", __func__, vha->host_no, 2368 "-- error status (%x).\n", __func__, vha->host_no,
2362 tsk->p.sts.entry_status)); 2369 sts->entry_status));
2363 rval = QLA_FUNCTION_FAILED; 2370 rval = QLA_FUNCTION_FAILED;
2364 } else if (tsk->p.sts.comp_status != 2371 } else if (sts->comp_status !=
2365 __constant_cpu_to_le16(CS_COMPLETE)) { 2372 __constant_cpu_to_le16(CS_COMPLETE)) {
2366 DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " 2373 DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
2367 "-- completion status (%x).\n", __func__, 2374 "-- completion status (%x).\n", __func__,
2368 vha->host_no, le16_to_cpu(tsk->p.sts.comp_status))); 2375 vha->host_no, le16_to_cpu(sts->comp_status)));
2376 rval = QLA_FUNCTION_FAILED;
2377 } else if (!(le16_to_cpu(sts->scsi_status) &
2378 SS_RESPONSE_INFO_LEN_VALID)) {
2379 DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
2380 "-- no response info (%x).\n", __func__, vha->host_no,
2381 le16_to_cpu(sts->scsi_status)));
2382 rval = QLA_FUNCTION_FAILED;
2383 } else if (le32_to_cpu(sts->rsp_data_len) < 4) {
2384 DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
2385 "-- not enough response info (%d).\n", __func__,
2386 vha->host_no, le32_to_cpu(sts->rsp_data_len)));
2387 rval = QLA_FUNCTION_FAILED;
2388 } else if (sts->data[3]) {
2389 DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
2390 "-- response (%x).\n", __func__,
2391 vha->host_no, sts->data[3]));
2369 rval = QLA_FUNCTION_FAILED; 2392 rval = QLA_FUNCTION_FAILED;
2370 } 2393 }
2371 2394
@@ -2759,8 +2782,10 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
2759 vp_idx, MSB(stat), 2782 vp_idx, MSB(stat),
2760 rptid_entry->port_id[2], rptid_entry->port_id[1], 2783 rptid_entry->port_id[2], rptid_entry->port_id[1],
2761 rptid_entry->port_id[0])); 2784 rptid_entry->port_id[0]));
2762 if (vp_idx == 0) 2785
2763 return; 2786 vp = vha;
2787 if (vp_idx == 0 && (MSB(stat) != 1))
2788 goto reg_needed;
2764 2789
2765 if (MSB(stat) == 1) { 2790 if (MSB(stat) == 1) {
2766 DEBUG2(printk("scsi(%ld): Could not acquire ID for " 2791 DEBUG2(printk("scsi(%ld): Could not acquire ID for "
@@ -2783,8 +2808,11 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
2783 * response queue. Handle it in dpc context. 2808 * response queue. Handle it in dpc context.
2784 */ 2809 */
2785 set_bit(VP_IDX_ACQUIRED, &vp->vp_flags); 2810 set_bit(VP_IDX_ACQUIRED, &vp->vp_flags);
2786 set_bit(VP_DPC_NEEDED, &vha->dpc_flags);
2787 2811
2812reg_needed:
2813 set_bit(REGISTER_FC4_NEEDED, &vp->dpc_flags);
2814 set_bit(REGISTER_FDMI_NEEDED, &vp->dpc_flags);
2815 set_bit(VP_DPC_NEEDED, &vha->dpc_flags);
2788 qla2xxx_wake_dpc(vha); 2816 qla2xxx_wake_dpc(vha);
2789 } 2817 }
2790} 2818}