diff options
author | Joe Carnuccio <joe.carnuccio@qlogic.com> | 2013-02-08 01:57:48 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-02-22 07:31:36 -0500 |
commit | 61e1b269be20f2bd81d0e6a2ccdc42eca3a6f059 (patch) | |
tree | 2a66ac61225f309d0c96849860e40914c41cea70 | |
parent | e9454a883b3a26a63c3810f8e4f33c71e218728c (diff) |
[SCSI] qla2xxx: Do link initialization on get loop id failure.
To avoid continually doing ISP resets when get loop id fails to
obtain the adapter loop id, first try to do a link initialization.
Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r-- | drivers/scsi/qla2xxx/qla_dbg.c | 2 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_def.h | 1 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_gbl.h | 3 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_init.c | 8 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_mbx.c | 48 |
5 files changed, 61 insertions, 1 deletions
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index c1d2310c615e..65e95bdce704 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c | |||
@@ -12,7 +12,7 @@ | |||
12 | * | Level | Last Value Used | Holes | | 12 | * | Level | Last Value Used | Holes | |
13 | * ---------------------------------------------------------------------- | 13 | * ---------------------------------------------------------------------- |
14 | * | Module Init and Probe | 0x0126 | 0x4b,0xba,0xfa | | 14 | * | Module Init and Probe | 0x0126 | 0x4b,0xba,0xfa | |
15 | * | Mailbox commands | 0x1150 | 0x111a-0x111b | | 15 | * | Mailbox commands | 0x1154 | 0x111a-0x111b | |
16 | * | | | 0x112c-0x112e | | 16 | * | | | 0x112c-0x112e | |
17 | * | | | 0x113a | | 17 | * | | | 0x113a | |
18 | * | Device Discovery | 0x2087 | 0x2020-0x2022, | | 18 | * | Device Discovery | 0x2087 | 0x2020-0x2022, | |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 5c42c9162026..e96abfc069e6 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h | |||
@@ -814,6 +814,7 @@ typedef struct { | |||
814 | #define MBC_HOST_MEMORY_COPY 0x53 /* Host Memory Copy. */ | 814 | #define MBC_HOST_MEMORY_COPY 0x53 /* Host Memory Copy. */ |
815 | #define MBC_SEND_RNFT_ELS 0x5e /* Send RNFT ELS request */ | 815 | #define MBC_SEND_RNFT_ELS 0x5e /* Send RNFT ELS request */ |
816 | #define MBC_GET_LINK_PRIV_STATS 0x6d /* Get link & private data. */ | 816 | #define MBC_GET_LINK_PRIV_STATS 0x6d /* Get link & private data. */ |
817 | #define MBC_LINK_INITIALIZATION 0x72 /* Do link initialization. */ | ||
817 | #define MBC_SET_VENDOR_ID 0x76 /* Set Vendor ID. */ | 818 | #define MBC_SET_VENDOR_ID 0x76 /* Set Vendor ID. */ |
818 | #define MBC_PORT_RESET 0x120 /* Port Reset */ | 819 | #define MBC_PORT_RESET 0x120 /* Port Reset */ |
819 | #define MBC_SET_PORT_CONFIG 0x122 /* Set port configuration */ | 820 | #define MBC_SET_PORT_CONFIG 0x122 /* Set port configuration */ |
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 1732713e80cc..ee8ea952ed24 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h | |||
@@ -282,6 +282,9 @@ extern int | |||
282 | qla2x00_get_port_name(scsi_qla_host_t *, uint16_t, uint8_t *, uint8_t); | 282 | qla2x00_get_port_name(scsi_qla_host_t *, uint16_t, uint8_t *, uint8_t); |
283 | 283 | ||
284 | extern int | 284 | extern int |
285 | qla24xx_link_initialize(scsi_qla_host_t *); | ||
286 | |||
287 | extern int | ||
285 | qla2x00_lip_reset(scsi_qla_host_t *); | 288 | qla2x00_lip_reset(scsi_qla_host_t *); |
286 | 289 | ||
287 | extern int | 290 | extern int |
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index bbf5688885f1..97f268433b9f 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -2207,6 +2207,7 @@ qla2x00_configure_hba(scsi_qla_host_t *vha) | |||
2207 | char connect_type[22]; | 2207 | char connect_type[22]; |
2208 | struct qla_hw_data *ha = vha->hw; | 2208 | struct qla_hw_data *ha = vha->hw; |
2209 | unsigned long flags; | 2209 | unsigned long flags; |
2210 | scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); | ||
2210 | 2211 | ||
2211 | /* Get host addresses. */ | 2212 | /* Get host addresses. */ |
2212 | rval = qla2x00_get_adapter_id(vha, | 2213 | rval = qla2x00_get_adapter_id(vha, |
@@ -2220,6 +2221,13 @@ qla2x00_configure_hba(scsi_qla_host_t *vha) | |||
2220 | } else { | 2221 | } else { |
2221 | ql_log(ql_log_warn, vha, 0x2009, | 2222 | ql_log(ql_log_warn, vha, 0x2009, |
2222 | "Unable to get host loop ID.\n"); | 2223 | "Unable to get host loop ID.\n"); |
2224 | if (IS_FWI2_CAPABLE(ha) && (vha == base_vha) && | ||
2225 | (rval == QLA_COMMAND_ERROR && loop_id == 0x1b)) { | ||
2226 | ql_log(ql_log_warn, vha, 0x1151, | ||
2227 | "Doing link init.\n"); | ||
2228 | if (qla24xx_link_initialize(vha) == QLA_SUCCESS) | ||
2229 | return rval; | ||
2230 | } | ||
2223 | set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); | 2231 | set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); |
2224 | } | 2232 | } |
2225 | return (rval); | 2233 | return (rval); |
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 92d51fc78c08..550f75a3269b 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c | |||
@@ -1633,6 +1633,54 @@ qla2x00_get_port_name(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t *name, | |||
1633 | } | 1633 | } |
1634 | 1634 | ||
1635 | /* | 1635 | /* |
1636 | * qla24xx_link_initialization | ||
1637 | * Issue link initialization mailbox command. | ||
1638 | * | ||
1639 | * Input: | ||
1640 | * ha = adapter block pointer. | ||
1641 | * TARGET_QUEUE_LOCK must be released. | ||
1642 | * ADAPTER_STATE_LOCK must be released. | ||
1643 | * | ||
1644 | * Returns: | ||
1645 | * qla2x00 local function return status code. | ||
1646 | * | ||
1647 | * Context: | ||
1648 | * Kernel context. | ||
1649 | */ | ||
1650 | int | ||
1651 | qla24xx_link_initialize(scsi_qla_host_t *vha) | ||
1652 | { | ||
1653 | int rval; | ||
1654 | mbx_cmd_t mc; | ||
1655 | mbx_cmd_t *mcp = &mc; | ||
1656 | |||
1657 | ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1152, | ||
1658 | "Entered %s.\n", __func__); | ||
1659 | |||
1660 | if (!IS_FWI2_CAPABLE(vha->hw) || IS_CNA_CAPABLE(vha->hw)) | ||
1661 | return QLA_FUNCTION_FAILED; | ||
1662 | |||
1663 | mcp->mb[0] = MBC_LINK_INITIALIZATION; | ||
1664 | mcp->mb[1] = BIT_6|BIT_4; | ||
1665 | mcp->mb[2] = 0; | ||
1666 | mcp->mb[3] = 0; | ||
1667 | mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; | ||
1668 | mcp->in_mb = MBX_0; | ||
1669 | mcp->tov = MBX_TOV_SECONDS; | ||
1670 | mcp->flags = 0; | ||
1671 | rval = qla2x00_mailbox_command(vha, mcp); | ||
1672 | |||
1673 | if (rval != QLA_SUCCESS) { | ||
1674 | ql_dbg(ql_dbg_mbx, vha, 0x1153, "Failed=%x.\n", rval); | ||
1675 | } else { | ||
1676 | ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1154, | ||
1677 | "Done %s.\n", __func__); | ||
1678 | } | ||
1679 | |||
1680 | return rval; | ||
1681 | } | ||
1682 | |||
1683 | /* | ||
1636 | * qla2x00_lip_reset | 1684 | * qla2x00_lip_reset |
1637 | * Issue LIP reset mailbox command. | 1685 | * Issue LIP reset mailbox command. |
1638 | * | 1686 | * |