Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6:
[SCSI] qla1280: retain firmware for error recovery
[SCSI] attirbute_container: Initialize sysfs attributes with sysfs_attr_init
[SCSI] advansys: fix regression with request_firmware change
[SCSI] qla2xxx: Updated version number to 8.03.02-k2.
[SCSI] qla2xxx: Prevent sending mbx commands from sysfs during isp reset.
[SCSI] qla2xxx: Disable MSI on qla24xx chips other than QLA2432.
[SCSI] qla2xxx: Check to make sure multique and CPU affinity support is not enabled at the same time.
[SCSI] qla2xxx: Correct vp_idx checking during PORT_UPDATE processing.
[SCSI] qla2xxx: Honour "Extended BB credits" bit for CNAs.
[SCSI] scsi_transport_fc: Make sure commands are completed when rport is offline
[SCSI] libiscsi: Fix recovery slowdown regression

+172 -84
+1
drivers/base/attribute_container.c
··· 328 328 return sysfs_create_group(&classdev->kobj, cont->grp); 329 329 330 330 for (i = 0; attrs[i]; i++) { 331 + sysfs_attr_init(&attrs[i]->attr); 331 332 error = device_create_file(classdev, attrs[i]); 332 333 if (error) 333 334 return error;
+8
drivers/scsi/advansys.c
··· 4781 4781 if (err) { 4782 4782 printk(KERN_ERR "Failed to load image \"%s\" err %d\n", 4783 4783 fwname, err); 4784 + asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM; 4784 4785 return err; 4785 4786 } 4786 4787 if (fw->size < 4) { 4787 4788 printk(KERN_ERR "Bogus length %zu in image \"%s\"\n", 4788 4789 fw->size, fwname); 4789 4790 release_firmware(fw); 4791 + asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM; 4790 4792 return -EINVAL; 4791 4793 } 4792 4794 chksum = (fw->data[3] << 24) | (fw->data[2] << 16) | ··· 5112 5110 if (err) { 5113 5111 printk(KERN_ERR "Failed to load image \"%s\" err %d\n", 5114 5112 fwname, err); 5113 + asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM; 5115 5114 return err; 5116 5115 } 5117 5116 if (fw->size < 4) { 5118 5117 printk(KERN_ERR "Bogus length %zu in image \"%s\"\n", 5119 5118 fw->size, fwname); 5120 5119 release_firmware(fw); 5120 + asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM; 5121 5121 return -EINVAL; 5122 5122 } 5123 5123 chksum = (fw->data[3] << 24) | (fw->data[2] << 16) | ··· 5628 5624 if (err) { 5629 5625 printk(KERN_ERR "Failed to load image \"%s\" err %d\n", 5630 5626 fwname, err); 5627 + asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM; 5631 5628 return err; 5632 5629 } 5633 5630 if (fw->size < 4) { 5634 5631 printk(KERN_ERR "Bogus length %zu in image \"%s\"\n", 5635 5632 fw->size, fwname); 5636 5633 release_firmware(fw); 5634 + asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM; 5637 5635 return -EINVAL; 5638 5636 } 5639 5637 chksum = (fw->data[3] << 24) | (fw->data[2] << 16) | ··· 6130 6124 if (err) { 6131 6125 printk(KERN_ERR "Failed to load image \"%s\" err %d\n", 6132 6126 fwname, err); 6127 + asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM; 6133 6128 return err; 6134 6129 } 6135 6130 if (fw->size < 4) { 6136 6131 printk(KERN_ERR "Bogus length %zu in image \"%s\"\n", 6137 6132 fw->size, fwname); 6138 6133 release_firmware(fw); 6134 + asc_dvc->err_code = ASC_IERR_MCODE_CHKSUM; 6139 6135 return -EINVAL; 6140 6136 } 6141 6137 chksum = (fw->data[3] << 24) | (fw->data[2] << 16) |
+3 -2
drivers/scsi/libiscsi.c
··· 3088 3088 session->state = ISCSI_STATE_TERMINATE; 3089 3089 else if (conn->stop_stage != STOP_CONN_RECOVER) 3090 3090 session->state = ISCSI_STATE_IN_RECOVERY; 3091 + 3092 + old_stop_stage = conn->stop_stage; 3093 + conn->stop_stage = flag; 3091 3094 spin_unlock_bh(&session->lock); 3092 3095 3093 3096 del_timer_sync(&conn->transport_timer); 3094 3097 iscsi_suspend_tx(conn); 3095 3098 3096 3099 spin_lock_bh(&session->lock); 3097 - old_stop_stage = conn->stop_stage; 3098 - conn->stop_stage = flag; 3099 3100 conn->c_stage = ISCSI_CONN_STOPPED; 3100 3101 spin_unlock_bh(&session->lock); 3101 3102
+109 -52
drivers/scsi/qla1280.c
··· 17 17 * General Public License for more details. 18 18 * 19 19 ******************************************************************************/ 20 - #define QLA1280_VERSION "3.27" 20 + #define QLA1280_VERSION "3.27.1" 21 21 /***************************************************************************** 22 22 Revision History: 23 + Rev 3.27.1, February 8, 2010, Michael Reed 24 + - Retain firmware image for error recovery. 23 25 Rev 3.27, February 10, 2009, Michael Reed 24 26 - General code cleanup. 25 27 - Improve error recovery. ··· 539 537 /*****************************************/ 540 538 541 539 struct qla_boards { 542 - unsigned char name[9]; /* Board ID String */ 540 + char *name; /* Board ID String */ 543 541 int numPorts; /* Number of SCSI ports */ 544 - char *fwname; /* firmware name */ 542 + int fw_index; /* index into qla1280_fw_tbl for firmware */ 545 543 }; 546 544 547 545 /* NOTE: the last argument in each entry is used to index ql1280_board_tbl */ ··· 562 560 }; 563 561 MODULE_DEVICE_TABLE(pci, qla1280_pci_tbl); 564 562 563 + DEFINE_MUTEX(qla1280_firmware_mutex); 564 + 565 + struct qla_fw { 566 + char *fwname; 567 + const struct firmware *fw; 568 + }; 569 + 570 + #define QL_NUM_FW_IMAGES 3 571 + 572 + struct qla_fw qla1280_fw_tbl[QL_NUM_FW_IMAGES] = { 573 + {"qlogic/1040.bin", NULL}, /* image 0 */ 574 + {"qlogic/1280.bin", NULL}, /* image 1 */ 575 + {"qlogic/12160.bin", NULL}, /* image 2 */ 576 + }; 577 + 578 + /* NOTE: Order of boards in this table must match order in qla1280_pci_tbl */ 565 579 static struct qla_boards ql1280_board_tbl[] = { 566 - /* Name , Number of ports, FW details */ 567 - {"QLA12160", 2, "qlogic/12160.bin"}, 568 - {"QLA1040", 1, "qlogic/1040.bin"}, 569 - {"QLA1080", 1, "qlogic/1280.bin"}, 570 - {"QLA1240", 2, "qlogic/1280.bin"}, 571 - {"QLA1280", 2, "qlogic/1280.bin"}, 572 - {"QLA10160", 1, "qlogic/12160.bin"}, 573 - {" ", 0, " "}, 580 + {.name = "QLA12160", .numPorts = 2, .fw_index = 2}, 581 + {.name = "QLA1040" , .numPorts = 1, .fw_index = 0}, 582 + {.name = "QLA1080" , .numPorts = 1, .fw_index = 1}, 583 + {.name = "QLA1240" , .numPorts = 2, .fw_index = 1}, 584 + {.name = "QLA1280" , .numPorts = 2, .fw_index = 1}, 585 + {.name = "QLA10160", .numPorts = 1, .fw_index = 2}, 586 + {.name = " ", .numPorts = 0, .fw_index = -1}, 574 587 }; 575 588 576 589 static int qla1280_verbose = 1; ··· 1528 1511 } 1529 1512 1530 1513 /* 1514 + * qla1280_request_firmware 1515 + * Acquire firmware for chip. Retain in memory 1516 + * for error recovery. 1517 + * 1518 + * Input: 1519 + * ha = adapter block pointer. 1520 + * 1521 + * Returns: 1522 + * Pointer to firmware image or an error code 1523 + * cast to pointer via ERR_PTR(). 1524 + */ 1525 + static const struct firmware * 1526 + qla1280_request_firmware(struct scsi_qla_host *ha) 1527 + { 1528 + const struct firmware *fw; 1529 + int err; 1530 + int index; 1531 + char *fwname; 1532 + 1533 + spin_unlock_irq(ha->host->host_lock); 1534 + mutex_lock(&qla1280_firmware_mutex); 1535 + 1536 + index = ql1280_board_tbl[ha->devnum].fw_index; 1537 + fw = qla1280_fw_tbl[index].fw; 1538 + if (fw) 1539 + goto out; 1540 + 1541 + fwname = qla1280_fw_tbl[index].fwname; 1542 + err = request_firmware(&fw, fwname, &ha->pdev->dev); 1543 + 1544 + if (err) { 1545 + printk(KERN_ERR "Failed to load image \"%s\" err %d\n", 1546 + fwname, err); 1547 + fw = ERR_PTR(err); 1548 + goto unlock; 1549 + } 1550 + if ((fw->size % 2) || (fw->size < 6)) { 1551 + printk(KERN_ERR "Invalid firmware length %zu in image \"%s\"\n", 1552 + fw->size, fwname); 1553 + release_firmware(fw); 1554 + fw = ERR_PTR(-EINVAL); 1555 + goto unlock; 1556 + } 1557 + 1558 + qla1280_fw_tbl[index].fw = fw; 1559 + 1560 + out: 1561 + ha->fwver1 = fw->data[0]; 1562 + ha->fwver2 = fw->data[1]; 1563 + ha->fwver3 = fw->data[2]; 1564 + unlock: 1565 + mutex_unlock(&qla1280_firmware_mutex); 1566 + spin_lock_irq(ha->host->host_lock); 1567 + return fw; 1568 + } 1569 + 1570 + /* 1531 1571 * Chip diagnostics 1532 1572 * Test chip for proper operation. 1533 1573 * ··· 1707 1633 static int 1708 1634 qla1280_load_firmware_pio(struct scsi_qla_host *ha) 1709 1635 { 1636 + /* enter with host_lock acquired */ 1637 + 1710 1638 const struct firmware *fw; 1711 1639 const __le16 *fw_data; 1712 1640 uint16_t risc_address, risc_code_size; 1713 1641 uint16_t mb[MAILBOX_REGISTER_COUNT], i; 1714 - int err; 1642 + int err = 0; 1715 1643 1716 - spin_unlock_irq(ha->host->host_lock); 1717 - err = request_firmware(&fw, ql1280_board_tbl[ha->devnum].fwname, 1718 - &ha->pdev->dev); 1719 - spin_lock_irq(ha->host->host_lock); 1720 - if (err) { 1721 - printk(KERN_ERR "Failed to load image \"%s\" err %d\n", 1722 - ql1280_board_tbl[ha->devnum].fwname, err); 1723 - return err; 1724 - } 1725 - if ((fw->size % 2) || (fw->size < 6)) { 1726 - printk(KERN_ERR "Bogus length %zu in image \"%s\"\n", 1727 - fw->size, ql1280_board_tbl[ha->devnum].fwname); 1728 - err = -EINVAL; 1729 - goto out; 1730 - } 1731 - ha->fwver1 = fw->data[0]; 1732 - ha->fwver2 = fw->data[1]; 1733 - ha->fwver3 = fw->data[2]; 1644 + fw = qla1280_request_firmware(ha); 1645 + if (IS_ERR(fw)) 1646 + return PTR_ERR(fw); 1647 + 1734 1648 fw_data = (const __le16 *)&fw->data[0]; 1735 1649 ha->fwstart = __le16_to_cpu(fw_data[2]); 1736 1650 ··· 1736 1674 if (err) { 1737 1675 printk(KERN_ERR "scsi(%li): Failed to load firmware\n", 1738 1676 ha->host_no); 1739 - goto out; 1677 + break; 1740 1678 } 1741 1679 } 1742 - out: 1743 - release_firmware(fw); 1680 + 1744 1681 return err; 1745 1682 } 1746 1683 ··· 1747 1686 static int 1748 1687 qla1280_load_firmware_dma(struct scsi_qla_host *ha) 1749 1688 { 1689 + /* enter with host_lock acquired */ 1750 1690 const struct firmware *fw; 1751 1691 const __le16 *fw_data; 1752 1692 uint16_t risc_address, risc_code_size; ··· 1762 1700 return -ENOMEM; 1763 1701 #endif 1764 1702 1765 - spin_unlock_irq(ha->host->host_lock); 1766 - err = request_firmware(&fw, ql1280_board_tbl[ha->devnum].fwname, 1767 - &ha->pdev->dev); 1768 - spin_lock_irq(ha->host->host_lock); 1769 - if (err) { 1770 - printk(KERN_ERR "Failed to load image \"%s\" err %d\n", 1771 - ql1280_board_tbl[ha->devnum].fwname, err); 1772 - return err; 1773 - } 1774 - if ((fw->size % 2) || (fw->size < 6)) { 1775 - printk(KERN_ERR "Bogus length %zu in image \"%s\"\n", 1776 - fw->size, ql1280_board_tbl[ha->devnum].fwname); 1777 - err = -EINVAL; 1778 - goto out; 1779 - } 1780 - ha->fwver1 = fw->data[0]; 1781 - ha->fwver2 = fw->data[1]; 1782 - ha->fwver3 = fw->data[2]; 1703 + fw = qla1280_request_firmware(ha); 1704 + if (IS_ERR(fw)) 1705 + return PTR_ERR(fw); 1706 + 1783 1707 fw_data = (const __le16 *)&fw->data[0]; 1784 1708 ha->fwstart = __le16_to_cpu(fw_data[2]); 1785 1709 ··· 1850 1802 #if DUMP_IT_BACK 1851 1803 pci_free_consistent(ha->pdev, 8000, tbuf, p_tbuf); 1852 1804 #endif 1853 - release_firmware(fw); 1854 1805 return err; 1855 1806 } 1856 1807 ··· 1888 1841 static int 1889 1842 qla1280_load_firmware(struct scsi_qla_host *ha) 1890 1843 { 1844 + /* enter with host_lock taken */ 1891 1845 int err; 1892 1846 1893 1847 err = qla1280_chip_diag(ha); ··· 4467 4419 static void __exit 4468 4420 qla1280_exit(void) 4469 4421 { 4422 + int i; 4423 + 4470 4424 pci_unregister_driver(&qla1280_pci_driver); 4425 + /* release any allocated firmware images */ 4426 + for (i = 0; i < QL_NUM_FW_IMAGES; i++) { 4427 + if (qla1280_fw_tbl[i].fw) { 4428 + release_firmware(qla1280_fw_tbl[i].fw); 4429 + qla1280_fw_tbl[i].fw = NULL; 4430 + } 4431 + } 4471 4432 } 4472 4433 4473 4434 module_init(qla1280_init);
+5 -1
drivers/scsi/qla2xxx/qla_attr.c
··· 1275 1275 int rval = QLA_FUNCTION_FAILED; 1276 1276 uint16_t state[5]; 1277 1277 1278 - if (!vha->hw->flags.eeh_busy) 1278 + if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || 1279 + test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags)) 1280 + DEBUG2_3_11(printk("%s(%ld): isp reset in progress.\n", 1281 + __func__, vha->host_no)); 1282 + else if (!vha->hw->flags.eeh_busy) 1279 1283 rval = qla2x00_get_firmware_state(vha, state); 1280 1284 if (rval != QLA_SUCCESS) 1281 1285 memset(state, -1, sizeof(state));
+15 -3
drivers/scsi/qla2xxx/qla_fw.h
··· 1592 1592 1593 1593 /* Offset 384. */ 1594 1594 uint8_t reserved_21[16]; 1595 - uint16_t reserved_22[8]; 1595 + uint16_t reserved_22[3]; 1596 + 1597 + /* 1598 + * BIT 0 = Extended BB credits for LR 1599 + * BIT 1 = Virtual Fabric Enable 1600 + * BIT 2 = Enhanced Features Unused 1601 + * BIT 3-7 = Enhanced Features Reserved 1602 + */ 1603 + /* Enhanced Features */ 1604 + uint8_t enhanced_features; 1605 + 1606 + uint8_t reserved_23; 1607 + uint16_t reserved_24[4]; 1596 1608 1597 1609 /* Offset 416. */ 1598 - uint16_t reserved_23[32]; 1610 + uint16_t reserved_25[32]; 1599 1611 1600 1612 /* Offset 480. */ 1601 1613 uint8_t model_name[16]; ··· 1615 1603 /* Offset 496. */ 1616 1604 uint16_t feature_mask_l; 1617 1605 uint16_t feature_mask_h; 1618 - uint16_t reserved_24[2]; 1606 + uint16_t reserved_26[2]; 1619 1607 1620 1608 uint16_t subsystem_vendor_id; 1621 1609 uint16_t subsystem_device_id;
+17 -20
drivers/scsi/qla2xxx/qla_isr.c
··· 621 621 * vp_idx does not match 622 622 * Event is not global, vp_idx does not match 623 623 */ 624 - if ((mb[1] == 0xffff && (mb[3] & 0xff) != 0xff) 625 - || (mb[1] != 0xffff)) { 626 - if (vha->vp_idx != (mb[3] & 0xff)) 627 - break; 628 - } 624 + if (IS_QLA2XXX_MIDTYPE(ha) && 625 + ((mb[1] == 0xffff && (mb[3] & 0xff) != 0xff) || 626 + (mb[1] != 0xffff)) && vha->vp_idx != (mb[3] & 0xff)) 627 + break; 629 628 630 629 /* Global event -- port logout or port unavailable. */ 631 630 if (mb[1] == 0xffff && mb[2] == 0x7) { ··· 2272 2273 2273 2274 /* If possible, enable MSI-X. */ 2274 2275 if (!IS_QLA2432(ha) && !IS_QLA2532(ha) && 2275 - !IS_QLA8432(ha) && !IS_QLA8001(ha)) 2276 - goto skip_msix; 2276 + !IS_QLA8432(ha) && !IS_QLA8001(ha)) 2277 + goto skip_msi; 2278 + 2279 + if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_HP && 2280 + (ha->pdev->subsystem_device == 0x7040 || 2281 + ha->pdev->subsystem_device == 0x7041 || 2282 + ha->pdev->subsystem_device == 0x1705)) { 2283 + DEBUG2(qla_printk(KERN_WARNING, ha, 2284 + "MSI-X: Unsupported ISP2432 SSVID/SSDID (0x%X,0x%X).\n", 2285 + ha->pdev->subsystem_vendor, 2286 + ha->pdev->subsystem_device)); 2287 + goto skip_msi; 2288 + } 2277 2289 2278 2290 if (IS_QLA2432(ha) && (ha->pdev->revision < QLA_MSIX_CHIP_REV_24XX || 2279 2291 !QLA_MSIX_FW_MODE_1(ha->fw_attributes))) { 2280 2292 DEBUG2(qla_printk(KERN_WARNING, ha, 2281 2293 "MSI-X: Unsupported ISP2432 (0x%X, 0x%X).\n", 2282 2294 ha->pdev->revision, ha->fw_attributes)); 2283 - 2284 2295 goto skip_msix; 2285 - } 2286 - 2287 - if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_HP && 2288 - (ha->pdev->subsystem_device == 0x7040 || 2289 - ha->pdev->subsystem_device == 0x7041 || 2290 - ha->pdev->subsystem_device == 0x1705)) { 2291 - DEBUG2(qla_printk(KERN_WARNING, ha, 2292 - "MSI-X: Unsupported ISP2432 SSVID/SSDID (0x%X, 0x%X).\n", 2293 - ha->pdev->subsystem_vendor, 2294 - ha->pdev->subsystem_device)); 2295 - 2296 - goto skip_msi; 2297 2296 } 2298 2297 2299 2298 ret = qla24xx_enable_msix(ha, rsp);
+7 -1
drivers/scsi/qla2xxx/qla_mbx.c
··· 340 340 return rval; 341 341 } 342 342 343 + #define EXTENDED_BB_CREDITS BIT_0 343 344 /* 344 345 * qla2x00_execute_fw 345 346 * Start adapter firmware. ··· 373 372 mcp->mb[1] = MSW(risc_addr); 374 373 mcp->mb[2] = LSW(risc_addr); 375 374 mcp->mb[3] = 0; 376 - mcp->mb[4] = 0; 375 + if (IS_QLA81XX(ha)) { 376 + struct nvram_81xx *nv = ha->nvram; 377 + mcp->mb[4] = (nv->enhanced_features & 378 + EXTENDED_BB_CREDITS); 379 + } else 380 + mcp->mb[4] = 0; 377 381 mcp->out_mb |= MBX_4|MBX_3|MBX_2|MBX_1; 378 382 mcp->in_mb |= MBX_1; 379 383 } else {
+3 -1
drivers/scsi/qla2xxx/qla_os.c
··· 1677 1677 1678 1678 /* Determine queue resources */ 1679 1679 ha->max_req_queues = ha->max_rsp_queues = 1; 1680 - if ((ql2xmaxqueues <= 1 || ql2xmultique_tag < 1) && 1680 + if ((ql2xmaxqueues <= 1 && !ql2xmultique_tag) || 1681 + (ql2xmaxqueues > 1 && ql2xmultique_tag) || 1681 1682 (!IS_QLA25XX(ha) && !IS_QLA81XX(ha))) 1682 1683 goto mqiobase_exit; 1684 + 1683 1685 ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 3), 1684 1686 pci_resource_len(ha->pdev, 3)); 1685 1687 if (ha->mqiobase) {
+2 -2
drivers/scsi/qla2xxx/qla_version.h
··· 7 7 /* 8 8 * Driver version 9 9 */ 10 - #define QLA2XXX_VERSION "8.03.02-k1" 10 + #define QLA2XXX_VERSION "8.03.02-k2" 11 11 12 12 #define QLA_DRIVER_MAJOR_VER 8 13 13 #define QLA_DRIVER_MINOR_VER 3 14 14 #define QLA_DRIVER_PATCH_VER 2 15 - #define QLA_DRIVER_BETA_VER 1 15 + #define QLA_DRIVER_BETA_VER 2
+2 -2
drivers/scsi/scsi_transport_fc.c
··· 3853 3853 if (rport && (rport->port_state != FC_PORTSTATE_ONLINE)) { 3854 3854 req->errors = -ENXIO; 3855 3855 spin_unlock_irq(q->queue_lock); 3856 - blk_end_request(req, -ENXIO, blk_rq_bytes(req)); 3856 + blk_end_request_all(req, -ENXIO); 3857 3857 spin_lock_irq(q->queue_lock); 3858 3858 continue; 3859 3859 } ··· 3863 3863 ret = fc_req_to_bsgjob(shost, rport, req); 3864 3864 if (ret) { 3865 3865 req->errors = ret; 3866 - blk_end_request(req, ret, blk_rq_bytes(req)); 3866 + blk_end_request_all(req, ret); 3867 3867 spin_lock_irq(q->queue_lock); 3868 3868 continue; 3869 3869 }