aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c4
-rw-r--r--drivers/scsi/qla2xxx/qla_bsg.c125
-rw-r--r--drivers/scsi/qla2xxx/qla_bsg.h2
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h3
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h1
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c28
-rw-r--r--drivers/scsi/qla2xxx/qla_iocb.c5
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c26
-rw-r--r--drivers/scsi/qla2xxx/qla_nx.c1
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c215
-rw-r--r--drivers/scsi/qla2xxx/qla_version.h4
11 files changed, 269 insertions, 145 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 2ff4342ae362..bc8194f74625 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1538,6 +1538,10 @@ qla2x00_dev_loss_tmo_callbk(struct fc_rport *rport)
1538 if (!fcport) 1538 if (!fcport)
1539 return; 1539 return;
1540 1540
1541 /* Now that the rport has been deleted, set the fcport state to
1542 FCS_DEVICE_DEAD */
1543 atomic_set(&fcport->state, FCS_DEVICE_DEAD);
1544
1541 /* 1545 /*
1542 * Transport has effectively 'deleted' the rport, clear 1546 * Transport has effectively 'deleted' the rport, clear
1543 * all local references. 1547 * all local references.
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index fdfbf83a6330..31a4121a2be1 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -1307,6 +1307,125 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job)
1307} 1307}
1308 1308
1309static int 1309static int
1310qla2x00_optrom_setup(struct fc_bsg_job *bsg_job, struct qla_hw_data *ha,
1311 uint8_t is_update)
1312{
1313 uint32_t start = 0;
1314 int valid = 0;
1315
1316 bsg_job->reply->reply_payload_rcv_len = 0;
1317
1318 if (unlikely(pci_channel_offline(ha->pdev)))
1319 return -EINVAL;
1320
1321 start = bsg_job->request->rqst_data.h_vendor.vendor_cmd[1];
1322 if (start > ha->optrom_size)
1323 return -EINVAL;
1324
1325 if (ha->optrom_state != QLA_SWAITING)
1326 return -EBUSY;
1327
1328 ha->optrom_region_start = start;
1329
1330 if (is_update) {
1331 if (ha->optrom_size == OPTROM_SIZE_2300 && start == 0)
1332 valid = 1;
1333 else if (start == (ha->flt_region_boot * 4) ||
1334 start == (ha->flt_region_fw * 4))
1335 valid = 1;
1336 else if (IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha) ||
1337 IS_QLA8XXX_TYPE(ha))
1338 valid = 1;
1339 if (!valid) {
1340 qla_printk(KERN_WARNING, ha,
1341 "Invalid start region 0x%x/0x%x.\n",
1342 start, bsg_job->request_payload.payload_len);
1343 return -EINVAL;
1344 }
1345
1346 ha->optrom_region_size = start +
1347 bsg_job->request_payload.payload_len > ha->optrom_size ?
1348 ha->optrom_size - start :
1349 bsg_job->request_payload.payload_len;
1350 ha->optrom_state = QLA_SWRITING;
1351 } else {
1352 ha->optrom_region_size = start +
1353 bsg_job->reply_payload.payload_len > ha->optrom_size ?
1354 ha->optrom_size - start :
1355 bsg_job->reply_payload.payload_len;
1356 ha->optrom_state = QLA_SREADING;
1357 }
1358
1359 ha->optrom_buffer = vmalloc(ha->optrom_region_size);
1360 if (!ha->optrom_buffer) {
1361 qla_printk(KERN_WARNING, ha,
1362 "Read: Unable to allocate memory for optrom retrieval "
1363 "(%x).\n", ha->optrom_region_size);
1364
1365 ha->optrom_state = QLA_SWAITING;
1366 return -ENOMEM;
1367 }
1368
1369 memset(ha->optrom_buffer, 0, ha->optrom_region_size);
1370 return 0;
1371}
1372
1373static int
1374qla2x00_read_optrom(struct fc_bsg_job *bsg_job)
1375{
1376 struct Scsi_Host *host = bsg_job->shost;
1377 scsi_qla_host_t *vha = shost_priv(host);
1378 struct qla_hw_data *ha = vha->hw;
1379 int rval = 0;
1380
1381 rval = qla2x00_optrom_setup(bsg_job, ha, 0);
1382 if (rval)
1383 return rval;
1384
1385 ha->isp_ops->read_optrom(vha, ha->optrom_buffer,
1386 ha->optrom_region_start, ha->optrom_region_size);
1387
1388 sg_copy_from_buffer(bsg_job->reply_payload.sg_list,
1389 bsg_job->reply_payload.sg_cnt, ha->optrom_buffer,
1390 ha->optrom_region_size);
1391
1392 bsg_job->reply->reply_payload_rcv_len = ha->optrom_region_size;
1393 bsg_job->reply->result = DID_OK;
1394 vfree(ha->optrom_buffer);
1395 ha->optrom_buffer = NULL;
1396 ha->optrom_state = QLA_SWAITING;
1397 bsg_job->job_done(bsg_job);
1398 return rval;
1399}
1400
1401static int
1402qla2x00_update_optrom(struct fc_bsg_job *bsg_job)
1403{
1404 struct Scsi_Host *host = bsg_job->shost;
1405 scsi_qla_host_t *vha = shost_priv(host);
1406 struct qla_hw_data *ha = vha->hw;
1407 int rval = 0;
1408
1409 rval = qla2x00_optrom_setup(bsg_job, ha, 1);
1410 if (rval)
1411 return rval;
1412
1413 sg_copy_to_buffer(bsg_job->request_payload.sg_list,
1414 bsg_job->request_payload.sg_cnt, ha->optrom_buffer,
1415 ha->optrom_region_size);
1416
1417 ha->isp_ops->write_optrom(vha, ha->optrom_buffer,
1418 ha->optrom_region_start, ha->optrom_region_size);
1419
1420 bsg_job->reply->result = DID_OK;
1421 vfree(ha->optrom_buffer);
1422 ha->optrom_buffer = NULL;
1423 ha->optrom_state = QLA_SWAITING;
1424 bsg_job->job_done(bsg_job);
1425 return rval;
1426}
1427
1428static int
1310qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job) 1429qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job)
1311{ 1430{
1312 switch (bsg_job->request->rqst_data.h_vendor.vendor_cmd[0]) { 1431 switch (bsg_job->request->rqst_data.h_vendor.vendor_cmd[0]) {
@@ -1328,6 +1447,12 @@ qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job)
1328 case QL_VND_FCP_PRIO_CFG_CMD: 1447 case QL_VND_FCP_PRIO_CFG_CMD:
1329 return qla24xx_proc_fcp_prio_cfg_cmd(bsg_job); 1448 return qla24xx_proc_fcp_prio_cfg_cmd(bsg_job);
1330 1449
1450 case QL_VND_READ_FLASH:
1451 return qla2x00_read_optrom(bsg_job);
1452
1453 case QL_VND_UPDATE_FLASH:
1454 return qla2x00_update_optrom(bsg_job);
1455
1331 default: 1456 default:
1332 bsg_job->reply->result = (DID_ERROR << 16); 1457 bsg_job->reply->result = (DID_ERROR << 16);
1333 bsg_job->job_done(bsg_job); 1458 bsg_job->job_done(bsg_job);
diff --git a/drivers/scsi/qla2xxx/qla_bsg.h b/drivers/scsi/qla2xxx/qla_bsg.h
index cc7c52f87a11..074a999c7017 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.h
+++ b/drivers/scsi/qla2xxx/qla_bsg.h
@@ -14,6 +14,8 @@
14#define QL_VND_A84_MGMT_CMD 0x04 14#define QL_VND_A84_MGMT_CMD 0x04
15#define QL_VND_IIDMA 0x05 15#define QL_VND_IIDMA 0x05
16#define QL_VND_FCP_PRIO_CFG_CMD 0x06 16#define QL_VND_FCP_PRIO_CFG_CMD 0x06
17#define QL_VND_READ_FLASH 0x07
18#define QL_VND_UPDATE_FLASH 0x08
17 19
18/* BSG definations for interpreting CommandSent field */ 20/* BSG definations for interpreting CommandSent field */
19#define INT_DEF_LB_LOOPBACK_CMD 0 21#define INT_DEF_LB_LOOPBACK_CMD 0
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index e1d3ad40a946..9ce539d4557e 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -1700,9 +1700,7 @@ typedef struct fc_port {
1700 atomic_t state; 1700 atomic_t state;
1701 uint32_t flags; 1701 uint32_t flags;
1702 1702
1703 int port_login_retry_count;
1704 int login_retry; 1703 int login_retry;
1705 atomic_t port_down_timer;
1706 1704
1707 struct fc_rport *rport, *drport; 1705 struct fc_rport *rport, *drport;
1708 u32 supported_classes; 1706 u32 supported_classes;
@@ -2411,7 +2409,6 @@ struct qla_hw_data {
2411 uint32_t enable_target_reset :1; 2409 uint32_t enable_target_reset :1;
2412 uint32_t enable_lip_full_login :1; 2410 uint32_t enable_lip_full_login :1;
2413 uint32_t enable_led_scheme :1; 2411 uint32_t enable_led_scheme :1;
2414 uint32_t inta_enabled :1;
2415 uint32_t msi_enabled :1; 2412 uint32_t msi_enabled :1;
2416 uint32_t msix_enabled :1; 2413 uint32_t msix_enabled :1;
2417 uint32_t disable_serdes :1; 2414 uint32_t disable_serdes :1;
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index c33dec827e1e..9382a816c133 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -92,6 +92,7 @@ extern int ql2xshiftctondsd;
92extern int ql2xdbwr; 92extern int ql2xdbwr;
93extern int ql2xdontresethba; 93extern int ql2xdontresethba;
94extern int ql2xasynctmfenable; 94extern int ql2xasynctmfenable;
95extern int ql2xgffidenable;
95extern int ql2xenabledif; 96extern int ql2xenabledif;
96extern int ql2xenablehba_err_chk; 97extern int ql2xenablehba_err_chk;
97extern int ql2xtargetreset; 98extern int ql2xtargetreset;
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 3cafbef40737..259f51137493 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -71,7 +71,7 @@ qla2x00_ctx_sp_free(srb_t *sp)
71 struct srb_iocb *iocb = ctx->u.iocb_cmd; 71 struct srb_iocb *iocb = ctx->u.iocb_cmd;
72 struct scsi_qla_host *vha = sp->fcport->vha; 72 struct scsi_qla_host *vha = sp->fcport->vha;
73 73
74 del_timer_sync(&iocb->timer); 74 del_timer(&iocb->timer);
75 kfree(iocb); 75 kfree(iocb);
76 kfree(ctx); 76 kfree(ctx);
77 mempool_free(sp, sp->fcport->vha->hw->srb_mempool); 77 mempool_free(sp, sp->fcport->vha->hw->srb_mempool);
@@ -1344,6 +1344,13 @@ cont_alloc:
1344 qla_printk(KERN_WARNING, ha, "Unable to allocate (%d KB) for " 1344 qla_printk(KERN_WARNING, ha, "Unable to allocate (%d KB) for "
1345 "firmware dump!!!\n", dump_size / 1024); 1345 "firmware dump!!!\n", dump_size / 1024);
1346 1346
1347 if (ha->fce) {
1348 dma_free_coherent(&ha->pdev->dev, FCE_SIZE, ha->fce,
1349 ha->fce_dma);
1350 ha->fce = NULL;
1351 ha->fce_dma = 0;
1352 }
1353
1347 if (ha->eft) { 1354 if (ha->eft) {
1348 dma_free_coherent(&ha->pdev->dev, eft_size, ha->eft, 1355 dma_free_coherent(&ha->pdev->dev, eft_size, ha->eft,
1349 ha->eft_dma); 1356 ha->eft_dma);
@@ -1818,14 +1825,14 @@ qla2x00_init_rings(scsi_qla_host_t *vha)
1818 qla2x00_init_response_q_entries(rsp); 1825 qla2x00_init_response_q_entries(rsp);
1819 } 1826 }
1820 1827
1821 spin_lock_irqsave(&ha->vport_slock, flags); 1828 spin_lock(&ha->vport_slock);
1822 /* Clear RSCN queue. */ 1829 /* Clear RSCN queue. */
1823 list_for_each_entry(vp, &ha->vp_list, list) { 1830 list_for_each_entry(vp, &ha->vp_list, list) {
1824 vp->rscn_in_ptr = 0; 1831 vp->rscn_in_ptr = 0;
1825 vp->rscn_out_ptr = 0; 1832 vp->rscn_out_ptr = 0;
1826 } 1833 }
1827 1834
1828 spin_unlock_irqrestore(&ha->vport_slock, flags); 1835 spin_unlock(&ha->vport_slock);
1829 1836
1830 ha->isp_ops->config_rings(vha); 1837 ha->isp_ops->config_rings(vha);
1831 1838
@@ -2916,21 +2923,13 @@ qla2x00_reg_remote_port(scsi_qla_host_t *vha, fc_port_t *fcport)
2916void 2923void
2917qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport) 2924qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
2918{ 2925{
2919 struct qla_hw_data *ha = vha->hw;
2920
2921 fcport->vha = vha; 2926 fcport->vha = vha;
2922 fcport->login_retry = 0; 2927 fcport->login_retry = 0;
2923 fcport->port_login_retry_count = ha->port_down_retry_count *
2924 PORT_RETRY_TIME;
2925 atomic_set(&fcport->port_down_timer, ha->port_down_retry_count *
2926 PORT_RETRY_TIME);
2927 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); 2928 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT);
2928 2929
2929 qla2x00_iidma_fcport(vha, fcport); 2930 qla2x00_iidma_fcport(vha, fcport);
2930
2931 atomic_set(&fcport->state, FCS_ONLINE);
2932
2933 qla2x00_reg_remote_port(vha, fcport); 2931 qla2x00_reg_remote_port(vha, fcport);
2932 atomic_set(&fcport->state, FCS_ONLINE);
2934} 2933}
2935 2934
2936/* 2935/*
@@ -3292,8 +3291,9 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha,
3292 continue; 3291 continue;
3293 3292
3294 /* Bypass ports whose FCP-4 type is not FCP_SCSI */ 3293 /* Bypass ports whose FCP-4 type is not FCP_SCSI */
3295 if (new_fcport->fc4_type != FC4_TYPE_FCP_SCSI && 3294 if (ql2xgffidenable &&
3296 new_fcport->fc4_type != FC4_TYPE_UNKNOWN) 3295 (new_fcport->fc4_type != FC4_TYPE_FCP_SCSI &&
3296 new_fcport->fc4_type != FC4_TYPE_UNKNOWN))
3297 continue; 3297 continue;
3298 3298
3299 /* Locate matching device in database. */ 3299 /* Locate matching device in database. */
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 579f02854665..4c1ba6263eb3 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -992,8 +992,8 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
992 ha = vha->hw; 992 ha = vha->hw;
993 993
994 DEBUG18(printk(KERN_DEBUG 994 DEBUG18(printk(KERN_DEBUG
995 "%s(%ld): Executing cmd sp %p, pid=%ld, prot_op=%u.\n", __func__, 995 "%s(%ld): Executing cmd sp %p, prot_op=%u.\n", __func__,
996 vha->host_no, sp, cmd->serial_number, scsi_get_prot_op(sp->cmd))); 996 vha->host_no, sp, scsi_get_prot_op(sp->cmd)));
997 997
998 cmd_pkt->vp_index = sp->fcport->vp_idx; 998 cmd_pkt->vp_index = sp->fcport->vp_idx;
999 999
@@ -1061,6 +1061,7 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
1061 fcp_cmnd->additional_cdb_len |= 2; 1061 fcp_cmnd->additional_cdb_len |= 2;
1062 1062
1063 int_to_scsilun(sp->cmd->device->lun, &fcp_cmnd->lun); 1063 int_to_scsilun(sp->cmd->device->lun, &fcp_cmnd->lun);
1064 host_to_fcp_swap((uint8_t *)&fcp_cmnd->lun, sizeof(fcp_cmnd->lun));
1064 memcpy(fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len); 1065 memcpy(fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len);
1065 cmd_pkt->fcp_cmnd_dseg_len = cpu_to_le16(fcp_cmnd_len); 1066 cmd_pkt->fcp_cmnd_dseg_len = cpu_to_le16(fcp_cmnd_len);
1066 cmd_pkt->fcp_cmnd_dseg_address[0] = cpu_to_le32( 1067 cmd_pkt->fcp_cmnd_dseg_address[0] = cpu_to_le32(
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index e0e43d9e7ed1..7f77898486a9 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -1240,12 +1240,6 @@ qla24xx_logio_entry(scsi_qla_host_t *vha, struct req_que *req,
1240 case LSC_SCODE_NPORT_USED: 1240 case LSC_SCODE_NPORT_USED:
1241 data[0] = MBS_LOOP_ID_USED; 1241 data[0] = MBS_LOOP_ID_USED;
1242 break; 1242 break;
1243 case LSC_SCODE_CMD_FAILED:
1244 if ((iop[1] & 0xff) == 0x05) {
1245 data[0] = MBS_NOT_LOGGED_IN;
1246 break;
1247 }
1248 /* Fall through. */
1249 default: 1243 default:
1250 data[0] = MBS_COMMAND_ERROR; 1244 data[0] = MBS_COMMAND_ERROR;
1251 break; 1245 break;
@@ -1431,9 +1425,8 @@ qla2x00_handle_sense(srb_t *sp, uint8_t *sense_data, uint32_t par_sense_len,
1431 rsp->status_srb = sp; 1425 rsp->status_srb = sp;
1432 1426
1433 DEBUG5(printk("%s(): Check condition Sense data, scsi(%ld:%d:%d:%d) " 1427 DEBUG5(printk("%s(): Check condition Sense data, scsi(%ld:%d:%d:%d) "
1434 "cmd=%p pid=%ld\n", __func__, sp->fcport->vha->host_no, 1428 "cmd=%p\n", __func__, sp->fcport->vha->host_no,
1435 cp->device->channel, cp->device->id, cp->device->lun, cp, 1429 cp->device->channel, cp->device->id, cp->device->lun, cp));
1436 cp->serial_number));
1437 if (sense_len) 1430 if (sense_len)
1438 DEBUG5(qla2x00_dump_buffer(cp->sense_buffer, sense_len)); 1431 DEBUG5(qla2x00_dump_buffer(cp->sense_buffer, sense_len));
1439} 1432}
@@ -1757,6 +1750,8 @@ check_scsi_status:
1757 case CS_INCOMPLETE: 1750 case CS_INCOMPLETE:
1758 case CS_PORT_UNAVAILABLE: 1751 case CS_PORT_UNAVAILABLE:
1759 case CS_TIMEOUT: 1752 case CS_TIMEOUT:
1753 case CS_RESET:
1754
1760 /* 1755 /*
1761 * We are going to have the fc class block the rport 1756 * We are going to have the fc class block the rport
1762 * while we try to recover so instruct the mid layer 1757 * while we try to recover so instruct the mid layer
@@ -1781,10 +1776,6 @@ check_scsi_status:
1781 qla2x00_mark_device_lost(fcport->vha, fcport, 1, 1); 1776 qla2x00_mark_device_lost(fcport->vha, fcport, 1, 1);
1782 break; 1777 break;
1783 1778
1784 case CS_RESET:
1785 cp->result = DID_TRANSPORT_DISRUPTED << 16;
1786 break;
1787
1788 case CS_ABORTED: 1779 case CS_ABORTED:
1789 cp->result = DID_RESET << 16; 1780 cp->result = DID_RESET << 16;
1790 break; 1781 break;
@@ -1801,10 +1792,10 @@ out:
1801 if (logit) 1792 if (logit)
1802 DEBUG2(qla_printk(KERN_INFO, ha, 1793 DEBUG2(qla_printk(KERN_INFO, ha,
1803 "scsi(%ld:%d:%d) FCP command status: 0x%x-0x%x (0x%x) " 1794 "scsi(%ld:%d:%d) FCP command status: 0x%x-0x%x (0x%x) "
1804 "oxid=0x%x ser=0x%lx cdb=%02x%02x%02x len=0x%x " 1795 "oxid=0x%x cdb=%02x%02x%02x len=0x%x "
1805 "rsp_info=0x%x resid=0x%x fw_resid=0x%x\n", vha->host_no, 1796 "rsp_info=0x%x resid=0x%x fw_resid=0x%x\n", vha->host_no,
1806 cp->device->id, cp->device->lun, comp_status, scsi_status, 1797 cp->device->id, cp->device->lun, comp_status, scsi_status,
1807 cp->result, ox_id, cp->serial_number, cp->cmnd[0], 1798 cp->result, ox_id, cp->cmnd[0],
1808 cp->cmnd[1], cp->cmnd[2], scsi_bufflen(cp), rsp_info_len, 1799 cp->cmnd[1], cp->cmnd[2], scsi_bufflen(cp), rsp_info_len,
1809 resid_len, fw_resid_len)); 1800 resid_len, fw_resid_len));
1810 1801
@@ -2500,14 +2491,15 @@ skip_msix:
2500skip_msi: 2491skip_msi:
2501 2492
2502 ret = request_irq(ha->pdev->irq, ha->isp_ops->intr_handler, 2493 ret = request_irq(ha->pdev->irq, ha->isp_ops->intr_handler,
2503 IRQF_SHARED, QLA2XXX_DRIVER_NAME, rsp); 2494 ha->flags.msi_enabled ? 0 : IRQF_SHARED,
2495 QLA2XXX_DRIVER_NAME, rsp);
2504 if (ret) { 2496 if (ret) {
2505 qla_printk(KERN_WARNING, ha, 2497 qla_printk(KERN_WARNING, ha,
2506 "Failed to reserve interrupt %d already in use.\n", 2498 "Failed to reserve interrupt %d already in use.\n",
2507 ha->pdev->irq); 2499 ha->pdev->irq);
2508 goto fail; 2500 goto fail;
2509 } 2501 }
2510 ha->flags.inta_enabled = 1; 2502
2511clear_risc_ints: 2503clear_risc_ints:
2512 2504
2513 /* 2505 /*
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
index 8d9edfb39803..ae2acacc0003 100644
--- a/drivers/scsi/qla2xxx/qla_nx.c
+++ b/drivers/scsi/qla2xxx/qla_nx.c
@@ -2749,6 +2749,7 @@ sufficient_dsds:
2749 goto queuing_error_fcp_cmnd; 2749 goto queuing_error_fcp_cmnd;
2750 2750
2751 int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun); 2751 int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun);
2752 host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun));
2752 2753
2753 /* build FCP_CMND IU */ 2754 /* build FCP_CMND IU */
2754 memset(ctx->fcp_cmnd, 0, sizeof(struct fcp_cmnd)); 2755 memset(ctx->fcp_cmnd, 0, sizeof(struct fcp_cmnd));
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 800ea9269752..2c0876c81a3f 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -160,6 +160,11 @@ MODULE_PARM_DESC(ql2xtargetreset,
160 "Enable target reset." 160 "Enable target reset."
161 "Default is 1 - use hw defaults."); 161 "Default is 1 - use hw defaults.");
162 162
163int ql2xgffidenable;
164module_param(ql2xgffidenable, int, S_IRUGO|S_IRUSR);
165MODULE_PARM_DESC(ql2xgffidenable,
166 "Enables GFF_ID checks of port type. "
167 "Default is 0 - Do not use GFF_ID information.");
163 168
164int ql2xasynctmfenable; 169int ql2xasynctmfenable;
165module_param(ql2xasynctmfenable, int, S_IRUGO|S_IRUSR); 170module_param(ql2xasynctmfenable, int, S_IRUGO|S_IRUSR);
@@ -174,8 +179,7 @@ static int qla2xxx_slave_alloc(struct scsi_device *);
174static int qla2xxx_scan_finished(struct Scsi_Host *, unsigned long time); 179static int qla2xxx_scan_finished(struct Scsi_Host *, unsigned long time);
175static void qla2xxx_scan_start(struct Scsi_Host *); 180static void qla2xxx_scan_start(struct Scsi_Host *);
176static void qla2xxx_slave_destroy(struct scsi_device *); 181static void qla2xxx_slave_destroy(struct scsi_device *);
177static int qla2xxx_queuecommand(struct scsi_cmnd *cmd, 182static int qla2xxx_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *cmd);
178 void (*fn)(struct scsi_cmnd *));
179static int qla2xxx_eh_abort(struct scsi_cmnd *); 183static int qla2xxx_eh_abort(struct scsi_cmnd *);
180static int qla2xxx_eh_device_reset(struct scsi_cmnd *); 184static int qla2xxx_eh_device_reset(struct scsi_cmnd *);
181static int qla2xxx_eh_target_reset(struct scsi_cmnd *); 185static int qla2xxx_eh_target_reset(struct scsi_cmnd *);
@@ -255,6 +259,7 @@ static void qla2x00_rst_aen(scsi_qla_host_t *);
255 259
256static int qla2x00_mem_alloc(struct qla_hw_data *, uint16_t, uint16_t, 260static int qla2x00_mem_alloc(struct qla_hw_data *, uint16_t, uint16_t,
257 struct req_que **, struct rsp_que **); 261 struct req_que **, struct rsp_que **);
262static void qla2x00_free_fw_dump(struct qla_hw_data *);
258static void qla2x00_mem_free(struct qla_hw_data *); 263static void qla2x00_mem_free(struct qla_hw_data *);
259static void qla2x00_sp_free_dma(srb_t *); 264static void qla2x00_sp_free_dma(srb_t *);
260 265
@@ -529,7 +534,7 @@ qla2x00_get_new_sp(scsi_qla_host_t *vha, fc_port_t *fcport,
529} 534}
530 535
531static int 536static int
532qla2xxx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) 537qla2xxx_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
533{ 538{
534 scsi_qla_host_t *vha = shost_priv(cmd->device->host); 539 scsi_qla_host_t *vha = shost_priv(cmd->device->host);
535 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; 540 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
@@ -539,6 +544,7 @@ qla2xxx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
539 srb_t *sp; 544 srb_t *sp;
540 int rval; 545 int rval;
541 546
547 spin_unlock_irq(vha->host->host_lock);
542 if (ha->flags.eeh_busy) { 548 if (ha->flags.eeh_busy) {
543 if (ha->flags.pci_channel_io_perm_failure) 549 if (ha->flags.pci_channel_io_perm_failure)
544 cmd->result = DID_NO_CONNECT << 16; 550 cmd->result = DID_NO_CONNECT << 16;
@@ -553,10 +559,6 @@ qla2xxx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
553 goto qc24_fail_command; 559 goto qc24_fail_command;
554 } 560 }
555 561
556 /* Close window on fcport/rport state-transitioning. */
557 if (fcport->drport)
558 goto qc24_target_busy;
559
560 if (!vha->flags.difdix_supported && 562 if (!vha->flags.difdix_supported &&
561 scsi_get_prot_op(cmd) != SCSI_PROT_NORMAL) { 563 scsi_get_prot_op(cmd) != SCSI_PROT_NORMAL) {
562 DEBUG2(qla_printk(KERN_ERR, ha, 564 DEBUG2(qla_printk(KERN_ERR, ha,
@@ -567,15 +569,14 @@ qla2xxx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
567 } 569 }
568 if (atomic_read(&fcport->state) != FCS_ONLINE) { 570 if (atomic_read(&fcport->state) != FCS_ONLINE) {
569 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || 571 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
570 atomic_read(&base_vha->loop_state) == LOOP_DEAD) { 572 atomic_read(&fcport->state) == FCS_DEVICE_LOST ||
573 atomic_read(&base_vha->loop_state) == LOOP_DEAD) {
571 cmd->result = DID_NO_CONNECT << 16; 574 cmd->result = DID_NO_CONNECT << 16;
572 goto qc24_fail_command; 575 goto qc24_fail_command;
573 } 576 }
574 goto qc24_target_busy; 577 goto qc24_target_busy;
575 } 578 }
576 579
577 spin_unlock_irq(vha->host->host_lock);
578
579 sp = qla2x00_get_new_sp(base_vha, fcport, cmd, done); 580 sp = qla2x00_get_new_sp(base_vha, fcport, cmd, done);
580 if (!sp) 581 if (!sp)
581 goto qc24_host_busy_lock; 582 goto qc24_host_busy_lock;
@@ -597,14 +598,18 @@ qc24_host_busy_lock:
597 return SCSI_MLQUEUE_HOST_BUSY; 598 return SCSI_MLQUEUE_HOST_BUSY;
598 599
599qc24_target_busy: 600qc24_target_busy:
601 spin_lock_irq(vha->host->host_lock);
600 return SCSI_MLQUEUE_TARGET_BUSY; 602 return SCSI_MLQUEUE_TARGET_BUSY;
601 603
602qc24_fail_command: 604qc24_fail_command:
605 spin_lock_irq(vha->host->host_lock);
603 done(cmd); 606 done(cmd);
604 607
605 return 0; 608 return 0;
606} 609}
607 610
611static DEF_SCSI_QCMD(qla2xxx_queuecommand)
612
608 613
609/* 614/*
610 * qla2x00_eh_wait_on_command 615 * qla2x00_eh_wait_on_command
@@ -824,81 +829,58 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
824{ 829{
825 scsi_qla_host_t *vha = shost_priv(cmd->device->host); 830 scsi_qla_host_t *vha = shost_priv(cmd->device->host);
826 srb_t *sp; 831 srb_t *sp;
827 int ret, i; 832 int ret = SUCCESS;
828 unsigned int id, lun; 833 unsigned int id, lun;
829 unsigned long serial;
830 unsigned long flags; 834 unsigned long flags;
831 int wait = 0; 835 int wait = 0;
832 struct qla_hw_data *ha = vha->hw; 836 struct qla_hw_data *ha = vha->hw;
833 struct req_que *req = vha->req;
834 srb_t *spt;
835 int got_ref = 0;
836 837
837 fc_block_scsi_eh(cmd); 838 fc_block_scsi_eh(cmd);
838 839
839 if (!CMD_SP(cmd)) 840 if (!CMD_SP(cmd))
840 return SUCCESS; 841 return SUCCESS;
841 842
842 ret = SUCCESS;
843
844 id = cmd->device->id; 843 id = cmd->device->id;
845 lun = cmd->device->lun; 844 lun = cmd->device->lun;
846 serial = cmd->serial_number;
847 spt = (srb_t *) CMD_SP(cmd);
848 if (!spt)
849 return SUCCESS;
850 845
851 /* Check active list for command command. */
852 spin_lock_irqsave(&ha->hardware_lock, flags); 846 spin_lock_irqsave(&ha->hardware_lock, flags);
853 for (i = 1; i < MAX_OUTSTANDING_COMMANDS; i++) { 847 sp = (srb_t *) CMD_SP(cmd);
854 sp = req->outstanding_cmds[i]; 848 if (!sp) {
855 849 spin_unlock_irqrestore(&ha->hardware_lock, flags);
856 if (sp == NULL) 850 return SUCCESS;
857 continue; 851 }
858 if ((sp->ctx) && !(sp->flags & SRB_FCP_CMND_DMA_VALID) &&
859 !IS_PROT_IO(sp))
860 continue;
861 if (sp->cmd != cmd)
862 continue;
863 852
864 DEBUG2(printk("%s(%ld): aborting sp %p from RISC." 853 DEBUG2(printk("%s(%ld): aborting sp %p from RISC.",
865 " pid=%ld.\n", __func__, vha->host_no, sp, serial)); 854 __func__, vha->host_no, sp));
866 855
867 /* Get a reference to the sp and drop the lock.*/ 856 /* Get a reference to the sp and drop the lock.*/
868 sp_get(sp); 857 sp_get(sp);
869 got_ref++;
870 858
871 spin_unlock_irqrestore(&ha->hardware_lock, flags);
872 if (ha->isp_ops->abort_command(sp)) {
873 DEBUG2(printk("%s(%ld): abort_command "
874 "mbx failed.\n", __func__, vha->host_no));
875 ret = FAILED;
876 } else {
877 DEBUG3(printk("%s(%ld): abort_command "
878 "mbx success.\n", __func__, vha->host_no));
879 wait = 1;
880 }
881 spin_lock_irqsave(&ha->hardware_lock, flags);
882 break;
883 }
884 spin_unlock_irqrestore(&ha->hardware_lock, flags); 859 spin_unlock_irqrestore(&ha->hardware_lock, flags);
860 if (ha->isp_ops->abort_command(sp)) {
861 DEBUG2(printk("%s(%ld): abort_command "
862 "mbx failed.\n", __func__, vha->host_no));
863 ret = FAILED;
864 } else {
865 DEBUG3(printk("%s(%ld): abort_command "
866 "mbx success.\n", __func__, vha->host_no));
867 wait = 1;
868 }
869 qla2x00_sp_compl(ha, sp);
885 870
886 /* Wait for the command to be returned. */ 871 /* Wait for the command to be returned. */
887 if (wait) { 872 if (wait) {
888 if (qla2x00_eh_wait_on_command(cmd) != QLA_SUCCESS) { 873 if (qla2x00_eh_wait_on_command(cmd) != QLA_SUCCESS) {
889 qla_printk(KERN_ERR, ha, 874 qla_printk(KERN_ERR, ha,
890 "scsi(%ld:%d:%d): Abort handler timed out -- %lx " 875 "scsi(%ld:%d:%d): Abort handler timed out -- %x.\n",
891 "%x.\n", vha->host_no, id, lun, serial, ret); 876 vha->host_no, id, lun, ret);
892 ret = FAILED; 877 ret = FAILED;
893 } 878 }
894 } 879 }
895 880
896 if (got_ref)
897 qla2x00_sp_compl(ha, sp);
898
899 qla_printk(KERN_INFO, ha, 881 qla_printk(KERN_INFO, ha,
900 "scsi(%ld:%d:%d): Abort command issued -- %d %lx %x.\n", 882 "scsi(%ld:%d:%d): Abort command issued -- %d %x.\n",
901 vha->host_no, id, lun, wait, serial, ret); 883 vha->host_no, id, lun, wait, ret);
902 884
903 return ret; 885 return ret;
904} 886}
@@ -1043,13 +1025,11 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)
1043 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; 1025 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
1044 int ret = FAILED; 1026 int ret = FAILED;
1045 unsigned int id, lun; 1027 unsigned int id, lun;
1046 unsigned long serial;
1047 1028
1048 fc_block_scsi_eh(cmd); 1029 fc_block_scsi_eh(cmd);
1049 1030
1050 id = cmd->device->id; 1031 id = cmd->device->id;
1051 lun = cmd->device->lun; 1032 lun = cmd->device->lun;
1052 serial = cmd->serial_number;
1053 1033
1054 if (!fcport) 1034 if (!fcport)
1055 return ret; 1035 return ret;
@@ -1104,14 +1084,12 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
1104 struct qla_hw_data *ha = vha->hw; 1084 struct qla_hw_data *ha = vha->hw;
1105 int ret = FAILED; 1085 int ret = FAILED;
1106 unsigned int id, lun; 1086 unsigned int id, lun;
1107 unsigned long serial;
1108 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); 1087 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
1109 1088
1110 fc_block_scsi_eh(cmd); 1089 fc_block_scsi_eh(cmd);
1111 1090
1112 id = cmd->device->id; 1091 id = cmd->device->id;
1113 lun = cmd->device->lun; 1092 lun = cmd->device->lun;
1114 serial = cmd->serial_number;
1115 1093
1116 if (!fcport) 1094 if (!fcport)
1117 return ret; 1095 return ret;
@@ -1974,6 +1952,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1974 ha->bars = bars; 1952 ha->bars = bars;
1975 ha->mem_only = mem_only; 1953 ha->mem_only = mem_only;
1976 spin_lock_init(&ha->hardware_lock); 1954 spin_lock_init(&ha->hardware_lock);
1955 spin_lock_init(&ha->vport_slock);
1977 1956
1978 /* Set ISP-type information. */ 1957 /* Set ISP-type information. */
1979 qla2x00_set_isp_flags(ha); 1958 qla2x00_set_isp_flags(ha);
@@ -2085,6 +2064,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
2085 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); 2064 ha->init_cb_size = sizeof(struct mid_init_cb_81xx);
2086 ha->gid_list_info_size = 8; 2065 ha->gid_list_info_size = 8;
2087 ha->optrom_size = OPTROM_SIZE_82XX; 2066 ha->optrom_size = OPTROM_SIZE_82XX;
2067 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX;
2088 ha->isp_ops = &qla82xx_isp_ops; 2068 ha->isp_ops = &qla82xx_isp_ops;
2089 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; 2069 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF;
2090 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; 2070 ha->flash_data_off = FARX_ACCESS_FLASH_DATA;
@@ -2342,6 +2322,42 @@ probe_out:
2342} 2322}
2343 2323
2344static void 2324static void
2325qla2x00_shutdown(struct pci_dev *pdev)
2326{
2327 scsi_qla_host_t *vha;
2328 struct qla_hw_data *ha;
2329
2330 vha = pci_get_drvdata(pdev);
2331 ha = vha->hw;
2332
2333 /* Turn-off FCE trace */
2334 if (ha->flags.fce_enabled) {
2335 qla2x00_disable_fce_trace(vha, NULL, NULL);
2336 ha->flags.fce_enabled = 0;
2337 }
2338
2339 /* Turn-off EFT trace */
2340 if (ha->eft)
2341 qla2x00_disable_eft_trace(vha);
2342
2343 /* Stop currently executing firmware. */
2344 qla2x00_try_to_stop_firmware(vha);
2345
2346 /* Turn adapter off line */
2347 vha->flags.online = 0;
2348
2349 /* turn-off interrupts on the card */
2350 if (ha->interrupts_on) {
2351 vha->flags.init_done = 0;
2352 ha->isp_ops->disable_intrs(ha);
2353 }
2354
2355 qla2x00_free_irqs(vha);
2356
2357 qla2x00_free_fw_dump(ha);
2358}
2359
2360static void
2345qla2x00_remove_one(struct pci_dev *pdev) 2361qla2x00_remove_one(struct pci_dev *pdev)
2346{ 2362{
2347 scsi_qla_host_t *base_vha, *vha; 2363 scsi_qla_host_t *base_vha, *vha;
@@ -2597,12 +2613,12 @@ qla2x00_mark_all_devices_lost(scsi_qla_host_t *vha, int defer)
2597 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD) 2613 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD)
2598 continue; 2614 continue;
2599 if (atomic_read(&fcport->state) == FCS_ONLINE) { 2615 if (atomic_read(&fcport->state) == FCS_ONLINE) {
2616 atomic_set(&fcport->state, FCS_DEVICE_LOST);
2600 if (defer) 2617 if (defer)
2601 qla2x00_schedule_rport_del(vha, fcport, defer); 2618 qla2x00_schedule_rport_del(vha, fcport, defer);
2602 else if (vha->vp_idx == fcport->vp_idx) 2619 else if (vha->vp_idx == fcport->vp_idx)
2603 qla2x00_schedule_rport_del(vha, fcport, defer); 2620 qla2x00_schedule_rport_del(vha, fcport, defer);
2604 } 2621 }
2605 atomic_set(&fcport->state, FCS_DEVICE_LOST);
2606 } 2622 }
2607} 2623}
2608 2624
@@ -2830,28 +2846,48 @@ fail:
2830} 2846}
2831 2847
2832/* 2848/*
2833* qla2x00_mem_free 2849* qla2x00_free_fw_dump
2834* Frees all adapter allocated memory. 2850* Frees fw dump stuff.
2835* 2851*
2836* Input: 2852* Input:
2837* ha = adapter block pointer. 2853* ha = adapter block pointer.
2838*/ 2854*/
2839static void 2855static void
2840qla2x00_mem_free(struct qla_hw_data *ha) 2856qla2x00_free_fw_dump(struct qla_hw_data *ha)
2841{ 2857{
2842 if (ha->srb_mempool)
2843 mempool_destroy(ha->srb_mempool);
2844
2845 if (ha->fce) 2858 if (ha->fce)
2846 dma_free_coherent(&ha->pdev->dev, FCE_SIZE, ha->fce, 2859 dma_free_coherent(&ha->pdev->dev, FCE_SIZE, ha->fce,
2847 ha->fce_dma); 2860 ha->fce_dma);
2848 2861
2849 if (ha->fw_dump) { 2862 if (ha->fw_dump) {
2850 if (ha->eft) 2863 if (ha->eft)
2851 dma_free_coherent(&ha->pdev->dev, 2864 dma_free_coherent(&ha->pdev->dev,
2852 ntohl(ha->fw_dump->eft_size), ha->eft, ha->eft_dma); 2865 ntohl(ha->fw_dump->eft_size), ha->eft, ha->eft_dma);
2853 vfree(ha->fw_dump); 2866 vfree(ha->fw_dump);
2854 } 2867 }
2868 ha->fce = NULL;
2869 ha->fce_dma = 0;
2870 ha->eft = NULL;
2871 ha->eft_dma = 0;
2872 ha->fw_dump = NULL;
2873 ha->fw_dumped = 0;
2874 ha->fw_dump_reading = 0;
2875}
2876
2877/*
2878* qla2x00_mem_free
2879* Frees all adapter allocated memory.
2880*
2881* Input:
2882* ha = adapter block pointer.
2883*/
2884static void
2885qla2x00_mem_free(struct qla_hw_data *ha)
2886{
2887 qla2x00_free_fw_dump(ha);
2888
2889 if (ha->srb_mempool)
2890 mempool_destroy(ha->srb_mempool);
2855 2891
2856 if (ha->dcbx_tlv) 2892 if (ha->dcbx_tlv)
2857 dma_free_coherent(&ha->pdev->dev, DCBX_TLV_DATA_SIZE, 2893 dma_free_coherent(&ha->pdev->dev, DCBX_TLV_DATA_SIZE,
@@ -2925,8 +2961,6 @@ qla2x00_mem_free(struct qla_hw_data *ha)
2925 2961
2926 ha->srb_mempool = NULL; 2962 ha->srb_mempool = NULL;
2927 ha->ctx_mempool = NULL; 2963 ha->ctx_mempool = NULL;
2928 ha->eft = NULL;
2929 ha->eft_dma = 0;
2930 ha->sns_cmd = NULL; 2964 ha->sns_cmd = NULL;
2931 ha->sns_cmd_dma = 0; 2965 ha->sns_cmd_dma = 0;
2932 ha->ct_sns = NULL; 2966 ha->ct_sns = NULL;
@@ -2946,10 +2980,6 @@ qla2x00_mem_free(struct qla_hw_data *ha)
2946 2980
2947 ha->gid_list = NULL; 2981 ha->gid_list = NULL;
2948 ha->gid_list_dma = 0; 2982 ha->gid_list_dma = 0;
2949
2950 ha->fw_dump = NULL;
2951 ha->fw_dumped = 0;
2952 ha->fw_dump_reading = 0;
2953} 2983}
2954 2984
2955struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *sht, 2985struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *sht,
@@ -3547,11 +3577,9 @@ void
3547qla2x00_timer(scsi_qla_host_t *vha) 3577qla2x00_timer(scsi_qla_host_t *vha)
3548{ 3578{
3549 unsigned long cpu_flags = 0; 3579 unsigned long cpu_flags = 0;
3550 fc_port_t *fcport;
3551 int start_dpc = 0; 3580 int start_dpc = 0;
3552 int index; 3581 int index;
3553 srb_t *sp; 3582 srb_t *sp;
3554 int t;
3555 uint16_t w; 3583 uint16_t w;
3556 struct qla_hw_data *ha = vha->hw; 3584 struct qla_hw_data *ha = vha->hw;
3557 struct req_que *req; 3585 struct req_que *req;
@@ -3567,34 +3595,6 @@ qla2x00_timer(scsi_qla_host_t *vha)
3567 /* Hardware read to raise pending EEH errors during mailbox waits. */ 3595 /* Hardware read to raise pending EEH errors during mailbox waits. */
3568 if (!pci_channel_offline(ha->pdev)) 3596 if (!pci_channel_offline(ha->pdev))
3569 pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w); 3597 pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w);
3570 /*
3571 * Ports - Port down timer.
3572 *
3573 * Whenever, a port is in the LOST state we start decrementing its port
3574 * down timer every second until it reaches zero. Once it reaches zero
3575 * the port it marked DEAD.
3576 */
3577 t = 0;
3578 list_for_each_entry(fcport, &vha->vp_fcports, list) {
3579 if (fcport->port_type != FCT_TARGET)
3580 continue;
3581
3582 if (atomic_read(&fcport->state) == FCS_DEVICE_LOST) {
3583
3584 if (atomic_read(&fcport->port_down_timer) == 0)
3585 continue;
3586
3587 if (atomic_dec_and_test(&fcport->port_down_timer) != 0)
3588 atomic_set(&fcport->state, FCS_DEVICE_DEAD);
3589
3590 DEBUG(printk("scsi(%ld): fcport-%d - port retry count: "
3591 "%d remaining\n",
3592 vha->host_no,
3593 t, atomic_read(&fcport->port_down_timer)));
3594 }
3595 t++;
3596 } /* End of for fcport */
3597
3598 3598
3599 /* Loop down handler. */ 3599 /* Loop down handler. */
3600 if (atomic_read(&vha->loop_down_timer) > 0 && 3600 if (atomic_read(&vha->loop_down_timer) > 0 &&
@@ -4079,6 +4079,7 @@ static struct pci_driver qla2xxx_pci_driver = {
4079 .id_table = qla2xxx_pci_tbl, 4079 .id_table = qla2xxx_pci_tbl,
4080 .probe = qla2x00_probe_one, 4080 .probe = qla2x00_probe_one,
4081 .remove = qla2x00_remove_one, 4081 .remove = qla2x00_remove_one,
4082 .shutdown = qla2x00_shutdown,
4082 .err_handler = &qla2xxx_err_handler, 4083 .err_handler = &qla2xxx_err_handler,
4083}; 4084};
4084 4085
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h
index 8edbccb3232d..cf0075a2d0c2 100644
--- a/drivers/scsi/qla2xxx/qla_version.h
+++ b/drivers/scsi/qla2xxx/qla_version.h
@@ -7,9 +7,9 @@
7/* 7/*
8 * Driver version 8 * Driver version
9 */ 9 */
10#define QLA2XXX_VERSION "8.03.04-k0" 10#define QLA2XXX_VERSION "8.03.05-k0"
11 11
12#define QLA_DRIVER_MAJOR_VER 8 12#define QLA_DRIVER_MAJOR_VER 8
13#define QLA_DRIVER_MINOR_VER 3 13#define QLA_DRIVER_MINOR_VER 3
14#define QLA_DRIVER_PATCH_VER 4 14#define QLA_DRIVER_PATCH_VER 5
15#define QLA_DRIVER_BETA_VER 0 15#define QLA_DRIVER_BETA_VER 0