diff options
author | James Smart <James.Smart@Emulex.Com> | 2009-10-02 15:16:51 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-12-04 13:01:41 -0500 |
commit | 6a9c52cf22e4ca13816bb2bd9899129cd4445de7 (patch) | |
tree | 02c44960d58fbaada692062ed96287425d0cd853 /drivers/scsi/lpfc/lpfc_scsi.c | |
parent | 6669f9bb902b8c3f5e33cb8c32c8c0eec6ed68ed (diff) |
[SCSI] lpfc 8.3.5: fix sysfs parameters, vport creation and other bugs and update logging
This patch include the following fixes and changes:
- Fix crash when "error" is echoed to board_mode sysfs parameter
- Fix FCoE Parameter parsing in regions 23
- Fix driver crash when creating vport with large number of targets on SLI4
- Fix bug with npiv message being logged when it is not supported by the adapter
- Fix a potential dereferencing mailbox structure after free bug
- Fix firmware crash after vport create with high target count
- Error out requests to set board_mode to warm restart via sysfs on SLI4 HBAs
- Fix Block guard logging
- Fix a memory corruption issue during GID_FT IO prep
- Fix crash while processing unsolicited FC frames
- Fix failed to allocate XRI message is not a critical failure
- Update and fix formatting in some log messages
- Fix missing new line characters in log messages
- Removed the use of the locally defined FC transport layer related macros
- Check the rsplen in lpfc_handle_fcp_err function before using rsplen
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_scsi.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_scsi.c | 180 |
1 files changed, 107 insertions, 73 deletions
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index e25179193a82..bcddb6c1a148 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -61,20 +61,22 @@ static void | |||
61 | lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb); | 61 | lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb); |
62 | 62 | ||
63 | static void | 63 | static void |
64 | lpfc_debug_save_data(struct scsi_cmnd *cmnd) | 64 | lpfc_debug_save_data(struct lpfc_hba *phba, struct scsi_cmnd *cmnd) |
65 | { | 65 | { |
66 | void *src, *dst; | 66 | void *src, *dst; |
67 | struct scatterlist *sgde = scsi_sglist(cmnd); | 67 | struct scatterlist *sgde = scsi_sglist(cmnd); |
68 | 68 | ||
69 | if (!_dump_buf_data) { | 69 | if (!_dump_buf_data) { |
70 | printk(KERN_ERR "BLKGRD ERROR %s _dump_buf_data is NULL\n", | 70 | lpfc_printf_log(phba, KERN_ERR, LOG_BG, |
71 | "9050 BLKGRD: ERROR %s _dump_buf_data is NULL\n", | ||
71 | __func__); | 72 | __func__); |
72 | return; | 73 | return; |
73 | } | 74 | } |
74 | 75 | ||
75 | 76 | ||
76 | if (!sgde) { | 77 | if (!sgde) { |
77 | printk(KERN_ERR "BLKGRD ERROR: data scatterlist is null\n"); | 78 | lpfc_printf_log(phba, KERN_ERR, LOG_BG, |
79 | "9051 BLKGRD: ERROR: data scatterlist is null\n"); | ||
78 | return; | 80 | return; |
79 | } | 81 | } |
80 | 82 | ||
@@ -88,19 +90,21 @@ lpfc_debug_save_data(struct scsi_cmnd *cmnd) | |||
88 | } | 90 | } |
89 | 91 | ||
90 | static void | 92 | static void |
91 | lpfc_debug_save_dif(struct scsi_cmnd *cmnd) | 93 | lpfc_debug_save_dif(struct lpfc_hba *phba, struct scsi_cmnd *cmnd) |
92 | { | 94 | { |
93 | void *src, *dst; | 95 | void *src, *dst; |
94 | struct scatterlist *sgde = scsi_prot_sglist(cmnd); | 96 | struct scatterlist *sgde = scsi_prot_sglist(cmnd); |
95 | 97 | ||
96 | if (!_dump_buf_dif) { | 98 | if (!_dump_buf_dif) { |
97 | printk(KERN_ERR "BLKGRD ERROR %s _dump_buf_data is NULL\n", | 99 | lpfc_printf_log(phba, KERN_ERR, LOG_BG, |
100 | "9052 BLKGRD: ERROR %s _dump_buf_data is NULL\n", | ||
98 | __func__); | 101 | __func__); |
99 | return; | 102 | return; |
100 | } | 103 | } |
101 | 104 | ||
102 | if (!sgde) { | 105 | if (!sgde) { |
103 | printk(KERN_ERR "BLKGRD ERROR: prot scatterlist is null\n"); | 106 | lpfc_printf_log(phba, KERN_ERR, LOG_BG, |
107 | "9053 BLKGRD: ERROR: prot scatterlist is null\n"); | ||
104 | return; | 108 | return; |
105 | } | 109 | } |
106 | 110 | ||
@@ -1024,7 +1028,8 @@ lpfc_scsi_prep_dma_buf_s3(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) | |||
1024 | 1028 | ||
1025 | lpfc_cmd->seg_cnt = nseg; | 1029 | lpfc_cmd->seg_cnt = nseg; |
1026 | if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) { | 1030 | if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) { |
1027 | printk(KERN_ERR "%s: Too many sg segments from " | 1031 | lpfc_printf_log(phba, KERN_ERR, LOG_BG, |
1032 | "9064 BLKGRD: %s: Too many sg segments from " | ||
1028 | "dma_map_sg. Config %d, seg_cnt %d\n", | 1033 | "dma_map_sg. Config %d, seg_cnt %d\n", |
1029 | __func__, phba->cfg_sg_seg_cnt, | 1034 | __func__, phba->cfg_sg_seg_cnt, |
1030 | lpfc_cmd->seg_cnt); | 1035 | lpfc_cmd->seg_cnt); |
@@ -1112,7 +1117,7 @@ lpfc_scsi_prep_dma_buf_s3(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) | |||
1112 | * with the cmd | 1117 | * with the cmd |
1113 | */ | 1118 | */ |
1114 | static int | 1119 | static int |
1115 | lpfc_sc_to_sli_prof(struct scsi_cmnd *sc) | 1120 | lpfc_sc_to_sli_prof(struct lpfc_hba *phba, struct scsi_cmnd *sc) |
1116 | { | 1121 | { |
1117 | uint8_t guard_type = scsi_host_get_guard(sc->device->host); | 1122 | uint8_t guard_type = scsi_host_get_guard(sc->device->host); |
1118 | uint8_t ret_prof = LPFC_PROF_INVALID; | 1123 | uint8_t ret_prof = LPFC_PROF_INVALID; |
@@ -1136,7 +1141,8 @@ lpfc_sc_to_sli_prof(struct scsi_cmnd *sc) | |||
1136 | 1141 | ||
1137 | case SCSI_PROT_NORMAL: | 1142 | case SCSI_PROT_NORMAL: |
1138 | default: | 1143 | default: |
1139 | printk(KERN_ERR "Bad op/guard:%d/%d combination\n", | 1144 | lpfc_printf_log(phba, KERN_ERR, LOG_BG, |
1145 | "9063 BLKGRD:Bad op/guard:%d/%d combination\n", | ||
1140 | scsi_get_prot_op(sc), guard_type); | 1146 | scsi_get_prot_op(sc), guard_type); |
1141 | break; | 1147 | break; |
1142 | 1148 | ||
@@ -1157,7 +1163,8 @@ lpfc_sc_to_sli_prof(struct scsi_cmnd *sc) | |||
1157 | case SCSI_PROT_WRITE_STRIP: | 1163 | case SCSI_PROT_WRITE_STRIP: |
1158 | case SCSI_PROT_NORMAL: | 1164 | case SCSI_PROT_NORMAL: |
1159 | default: | 1165 | default: |
1160 | printk(KERN_ERR "Bad op/guard:%d/%d combination\n", | 1166 | lpfc_printf_log(phba, KERN_ERR, LOG_BG, |
1167 | "9075 BLKGRD: Bad op/guard:%d/%d combination\n", | ||
1161 | scsi_get_prot_op(sc), guard_type); | 1168 | scsi_get_prot_op(sc), guard_type); |
1162 | break; | 1169 | break; |
1163 | } | 1170 | } |
@@ -1259,7 +1266,7 @@ lpfc_bg_setup_bpl(struct lpfc_hba *phba, struct scsi_cmnd *sc, | |||
1259 | uint16_t apptagmask, apptagval; | 1266 | uint16_t apptagmask, apptagval; |
1260 | 1267 | ||
1261 | pde1 = (struct lpfc_pde *) bpl; | 1268 | pde1 = (struct lpfc_pde *) bpl; |
1262 | prof = lpfc_sc_to_sli_prof(sc); | 1269 | prof = lpfc_sc_to_sli_prof(phba, sc); |
1263 | 1270 | ||
1264 | if (prof == LPFC_PROF_INVALID) | 1271 | if (prof == LPFC_PROF_INVALID) |
1265 | goto out; | 1272 | goto out; |
@@ -1359,7 +1366,7 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, | |||
1359 | return 0; | 1366 | return 0; |
1360 | } | 1367 | } |
1361 | 1368 | ||
1362 | prof = lpfc_sc_to_sli_prof(sc); | 1369 | prof = lpfc_sc_to_sli_prof(phba, sc); |
1363 | if (prof == LPFC_PROF_INVALID) | 1370 | if (prof == LPFC_PROF_INVALID) |
1364 | goto out; | 1371 | goto out; |
1365 | 1372 | ||
@@ -1408,7 +1415,8 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, | |||
1408 | subtotal = 0; /* total bytes processed for current prot grp */ | 1415 | subtotal = 0; /* total bytes processed for current prot grp */ |
1409 | while (!pgdone) { | 1416 | while (!pgdone) { |
1410 | if (!sgde) { | 1417 | if (!sgde) { |
1411 | printk(KERN_ERR "%s Invalid data segment\n", | 1418 | lpfc_printf_log(phba, KERN_ERR, LOG_BG, |
1419 | "9065 BLKGRD:%s Invalid data segment\n", | ||
1412 | __func__); | 1420 | __func__); |
1413 | return 0; | 1421 | return 0; |
1414 | } | 1422 | } |
@@ -1462,7 +1470,8 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, | |||
1462 | reftag += protgrp_blks; | 1470 | reftag += protgrp_blks; |
1463 | } else { | 1471 | } else { |
1464 | /* if we're here, we have a bug */ | 1472 | /* if we're here, we have a bug */ |
1465 | printk(KERN_ERR "BLKGRD: bug in %s\n", __func__); | 1473 | lpfc_printf_log(phba, KERN_ERR, LOG_BG, |
1474 | "9054 BLKGRD: bug in %s\n", __func__); | ||
1466 | } | 1475 | } |
1467 | 1476 | ||
1468 | } while (!alldone); | 1477 | } while (!alldone); |
@@ -1544,8 +1553,10 @@ lpfc_bg_scsi_prep_dma_buf(struct lpfc_hba *phba, | |||
1544 | 1553 | ||
1545 | lpfc_cmd->seg_cnt = datasegcnt; | 1554 | lpfc_cmd->seg_cnt = datasegcnt; |
1546 | if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) { | 1555 | if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) { |
1547 | printk(KERN_ERR "%s: Too many sg segments from " | 1556 | lpfc_printf_log(phba, KERN_ERR, LOG_BG, |
1548 | "dma_map_sg. Config %d, seg_cnt %d\n", | 1557 | "9067 BLKGRD: %s: Too many sg segments" |
1558 | " from dma_map_sg. Config %d, seg_cnt" | ||
1559 | " %d\n", | ||
1549 | __func__, phba->cfg_sg_seg_cnt, | 1560 | __func__, phba->cfg_sg_seg_cnt, |
1550 | lpfc_cmd->seg_cnt); | 1561 | lpfc_cmd->seg_cnt); |
1551 | scsi_dma_unmap(scsi_cmnd); | 1562 | scsi_dma_unmap(scsi_cmnd); |
@@ -1579,8 +1590,9 @@ lpfc_bg_scsi_prep_dma_buf(struct lpfc_hba *phba, | |||
1579 | lpfc_cmd->prot_seg_cnt = protsegcnt; | 1590 | lpfc_cmd->prot_seg_cnt = protsegcnt; |
1580 | if (lpfc_cmd->prot_seg_cnt | 1591 | if (lpfc_cmd->prot_seg_cnt |
1581 | > phba->cfg_prot_sg_seg_cnt) { | 1592 | > phba->cfg_prot_sg_seg_cnt) { |
1582 | printk(KERN_ERR "%s: Too many prot sg segments " | 1593 | lpfc_printf_log(phba, KERN_ERR, LOG_BG, |
1583 | "from dma_map_sg. Config %d," | 1594 | "9068 BLKGRD: %s: Too many prot sg " |
1595 | "segments from dma_map_sg. Config %d," | ||
1584 | "prot_seg_cnt %d\n", __func__, | 1596 | "prot_seg_cnt %d\n", __func__, |
1585 | phba->cfg_prot_sg_seg_cnt, | 1597 | phba->cfg_prot_sg_seg_cnt, |
1586 | lpfc_cmd->prot_seg_cnt); | 1598 | lpfc_cmd->prot_seg_cnt); |
@@ -1671,23 +1683,26 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd, | |||
1671 | uint32_t bgstat = bgf->bgstat; | 1683 | uint32_t bgstat = bgf->bgstat; |
1672 | uint64_t failing_sector = 0; | 1684 | uint64_t failing_sector = 0; |
1673 | 1685 | ||
1674 | printk(KERN_ERR "BG ERROR in cmd 0x%x lba 0x%llx blk cnt 0x%x " | 1686 | lpfc_printf_log(phba, KERN_ERR, LOG_BG, "9069 BLKGRD: BG ERROR in cmd" |
1687 | " 0x%x lba 0x%llx blk cnt 0x%x " | ||
1675 | "bgstat=0x%x bghm=0x%x\n", | 1688 | "bgstat=0x%x bghm=0x%x\n", |
1676 | cmd->cmnd[0], (unsigned long long)scsi_get_lba(cmd), | 1689 | cmd->cmnd[0], (unsigned long long)scsi_get_lba(cmd), |
1677 | blk_rq_sectors(cmd->request), bgstat, bghm); | 1690 | blk_rq_sectors(cmd->request), bgstat, bghm); |
1678 | 1691 | ||
1679 | spin_lock(&_dump_buf_lock); | 1692 | spin_lock(&_dump_buf_lock); |
1680 | if (!_dump_buf_done) { | 1693 | if (!_dump_buf_done) { |
1681 | printk(KERN_ERR "Saving Data for %u blocks to debugfs\n", | 1694 | lpfc_printf_log(phba, KERN_ERR, LOG_BG, "9070 BLKGRD: Saving" |
1695 | " Data for %u blocks to debugfs\n", | ||
1682 | (cmd->cmnd[7] << 8 | cmd->cmnd[8])); | 1696 | (cmd->cmnd[7] << 8 | cmd->cmnd[8])); |
1683 | lpfc_debug_save_data(cmd); | 1697 | lpfc_debug_save_data(phba, cmd); |
1684 | 1698 | ||
1685 | /* If we have a prot sgl, save the DIF buffer */ | 1699 | /* If we have a prot sgl, save the DIF buffer */ |
1686 | if (lpfc_prot_group_type(phba, cmd) == | 1700 | if (lpfc_prot_group_type(phba, cmd) == |
1687 | LPFC_PG_TYPE_DIF_BUF) { | 1701 | LPFC_PG_TYPE_DIF_BUF) { |
1688 | printk(KERN_ERR "Saving DIF for %u blocks to debugfs\n", | 1702 | lpfc_printf_log(phba, KERN_ERR, LOG_BG, "9071 BLKGRD: " |
1689 | (cmd->cmnd[7] << 8 | cmd->cmnd[8])); | 1703 | "Saving DIF for %u blocks to debugfs\n", |
1690 | lpfc_debug_save_dif(cmd); | 1704 | (cmd->cmnd[7] << 8 | cmd->cmnd[8])); |
1705 | lpfc_debug_save_dif(phba, cmd); | ||
1691 | } | 1706 | } |
1692 | 1707 | ||
1693 | _dump_buf_done = 1; | 1708 | _dump_buf_done = 1; |
@@ -1696,15 +1711,17 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd, | |||
1696 | 1711 | ||
1697 | if (lpfc_bgs_get_invalid_prof(bgstat)) { | 1712 | if (lpfc_bgs_get_invalid_prof(bgstat)) { |
1698 | cmd->result = ScsiResult(DID_ERROR, 0); | 1713 | cmd->result = ScsiResult(DID_ERROR, 0); |
1699 | printk(KERN_ERR "Invalid BlockGuard profile. bgstat:0x%x\n", | 1714 | lpfc_printf_log(phba, KERN_ERR, LOG_BG, "9072 BLKGRD: Invalid" |
1700 | bgstat); | 1715 | " BlockGuard profile. bgstat:0x%x\n", |
1716 | bgstat); | ||
1701 | ret = (-1); | 1717 | ret = (-1); |
1702 | goto out; | 1718 | goto out; |
1703 | } | 1719 | } |
1704 | 1720 | ||
1705 | if (lpfc_bgs_get_uninit_dif_block(bgstat)) { | 1721 | if (lpfc_bgs_get_uninit_dif_block(bgstat)) { |
1706 | cmd->result = ScsiResult(DID_ERROR, 0); | 1722 | cmd->result = ScsiResult(DID_ERROR, 0); |
1707 | printk(KERN_ERR "Invalid BlockGuard DIF Block. bgstat:0x%x\n", | 1723 | lpfc_printf_log(phba, KERN_ERR, LOG_BG, "9073 BLKGRD: " |
1724 | "Invalid BlockGuard DIF Block. bgstat:0x%x\n", | ||
1708 | bgstat); | 1725 | bgstat); |
1709 | ret = (-1); | 1726 | ret = (-1); |
1710 | goto out; | 1727 | goto out; |
@@ -1718,7 +1735,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd, | |||
1718 | cmd->result = DRIVER_SENSE << 24 | 1735 | cmd->result = DRIVER_SENSE << 24 |
1719 | | ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION); | 1736 | | ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION); |
1720 | phba->bg_guard_err_cnt++; | 1737 | phba->bg_guard_err_cnt++; |
1721 | printk(KERN_ERR "BLKGRD: guard_tag error\n"); | 1738 | lpfc_printf_log(phba, KERN_ERR, LOG_BG, |
1739 | "9055 BLKGRD: guard_tag error\n"); | ||
1722 | } | 1740 | } |
1723 | 1741 | ||
1724 | if (lpfc_bgs_get_reftag_err(bgstat)) { | 1742 | if (lpfc_bgs_get_reftag_err(bgstat)) { |
@@ -1730,7 +1748,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd, | |||
1730 | | ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION); | 1748 | | ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION); |
1731 | 1749 | ||
1732 | phba->bg_reftag_err_cnt++; | 1750 | phba->bg_reftag_err_cnt++; |
1733 | printk(KERN_ERR "BLKGRD: ref_tag error\n"); | 1751 | lpfc_printf_log(phba, KERN_ERR, LOG_BG, |
1752 | "9056 BLKGRD: ref_tag error\n"); | ||
1734 | } | 1753 | } |
1735 | 1754 | ||
1736 | if (lpfc_bgs_get_apptag_err(bgstat)) { | 1755 | if (lpfc_bgs_get_apptag_err(bgstat)) { |
@@ -1742,7 +1761,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd, | |||
1742 | | ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION); | 1761 | | ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION); |
1743 | 1762 | ||
1744 | phba->bg_apptag_err_cnt++; | 1763 | phba->bg_apptag_err_cnt++; |
1745 | printk(KERN_ERR "BLKGRD: app_tag error\n"); | 1764 | lpfc_printf_log(phba, KERN_ERR, LOG_BG, |
1765 | "9061 BLKGRD: app_tag error\n"); | ||
1746 | } | 1766 | } |
1747 | 1767 | ||
1748 | if (lpfc_bgs_get_hi_water_mark_present(bgstat)) { | 1768 | if (lpfc_bgs_get_hi_water_mark_present(bgstat)) { |
@@ -1763,7 +1783,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd, | |||
1763 | if (!ret) { | 1783 | if (!ret) { |
1764 | /* No error was reported - problem in FW? */ | 1784 | /* No error was reported - problem in FW? */ |
1765 | cmd->result = ScsiResult(DID_ERROR, 0); | 1785 | cmd->result = ScsiResult(DID_ERROR, 0); |
1766 | printk(KERN_ERR "BLKGRD: no errors reported!\n"); | 1786 | lpfc_printf_log(phba, KERN_ERR, LOG_BG, |
1787 | "9057 BLKGRD: no errors reported!\n"); | ||
1767 | } | 1788 | } |
1768 | 1789 | ||
1769 | out: | 1790 | out: |
@@ -1822,9 +1843,10 @@ lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) | |||
1822 | 1843 | ||
1823 | lpfc_cmd->seg_cnt = nseg; | 1844 | lpfc_cmd->seg_cnt = nseg; |
1824 | if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) { | 1845 | if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) { |
1825 | printk(KERN_ERR "%s: Too many sg segments from " | 1846 | lpfc_printf_log(phba, KERN_ERR, LOG_BG, "9074 BLKGRD:" |
1826 | "dma_map_sg. Config %d, seg_cnt %d\n", | 1847 | " %s: Too many sg segments from " |
1827 | __func__, phba->cfg_sg_seg_cnt, | 1848 | "dma_map_sg. Config %d, seg_cnt %d\n", |
1849 | __func__, phba->cfg_sg_seg_cnt, | ||
1828 | lpfc_cmd->seg_cnt); | 1850 | lpfc_cmd->seg_cnt); |
1829 | scsi_dma_unmap(scsi_cmnd); | 1851 | scsi_dma_unmap(scsi_cmnd); |
1830 | return 1; | 1852 | return 1; |
@@ -2050,6 +2072,21 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, | |||
2050 | goto out; | 2072 | goto out; |
2051 | } | 2073 | } |
2052 | 2074 | ||
2075 | if (resp_info & RSP_LEN_VALID) { | ||
2076 | rsplen = be32_to_cpu(fcprsp->rspRspLen); | ||
2077 | if ((rsplen != 0 && rsplen != 4 && rsplen != 8) || | ||
2078 | (fcprsp->rspInfo3 != RSP_NO_FAILURE)) { | ||
2079 | lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, | ||
2080 | "2719 Invalid response length: " | ||
2081 | "tgt x%x lun x%x cmnd x%x rsplen x%x\n", | ||
2082 | cmnd->device->id, | ||
2083 | cmnd->device->lun, cmnd->cmnd[0], | ||
2084 | rsplen); | ||
2085 | host_status = DID_ERROR; | ||
2086 | goto out; | ||
2087 | } | ||
2088 | } | ||
2089 | |||
2053 | if ((resp_info & SNS_LEN_VALID) && fcprsp->rspSnsLen) { | 2090 | if ((resp_info & SNS_LEN_VALID) && fcprsp->rspSnsLen) { |
2054 | uint32_t snslen = be32_to_cpu(fcprsp->rspSnsLen); | 2091 | uint32_t snslen = be32_to_cpu(fcprsp->rspSnsLen); |
2055 | if (snslen > SCSI_SENSE_BUFFERSIZE) | 2092 | if (snslen > SCSI_SENSE_BUFFERSIZE) |
@@ -2074,15 +2111,6 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, | |||
2074 | be32_to_cpu(fcprsp->rspRspLen), | 2111 | be32_to_cpu(fcprsp->rspRspLen), |
2075 | fcprsp->rspInfo3); | 2112 | fcprsp->rspInfo3); |
2076 | 2113 | ||
2077 | if (resp_info & RSP_LEN_VALID) { | ||
2078 | rsplen = be32_to_cpu(fcprsp->rspRspLen); | ||
2079 | if ((rsplen != 0 && rsplen != 4 && rsplen != 8) || | ||
2080 | (fcprsp->rspInfo3 != RSP_NO_FAILURE)) { | ||
2081 | host_status = DID_ERROR; | ||
2082 | goto out; | ||
2083 | } | ||
2084 | } | ||
2085 | |||
2086 | scsi_set_resid(cmnd, 0); | 2114 | scsi_set_resid(cmnd, 0); |
2087 | if (resp_info & RESID_UNDER) { | 2115 | if (resp_info & RESID_UNDER) { |
2088 | scsi_set_resid(cmnd, be32_to_cpu(fcprsp->rspResId)); | 2116 | scsi_set_resid(cmnd, be32_to_cpu(fcprsp->rspResId)); |
@@ -2264,7 +2292,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
2264 | lpfc_printf_vlog(vport, KERN_WARNING, | 2292 | lpfc_printf_vlog(vport, KERN_WARNING, |
2265 | LOG_BG, | 2293 | LOG_BG, |
2266 | "9031 non-zero BGSTAT " | 2294 | "9031 non-zero BGSTAT " |
2267 | "on unprotected cmd"); | 2295 | "on unprotected cmd\n"); |
2268 | } | 2296 | } |
2269 | } | 2297 | } |
2270 | 2298 | ||
@@ -2785,9 +2813,10 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) | |||
2785 | if (!(phba->sli3_options & LPFC_SLI3_BG_ENABLED) && | 2813 | if (!(phba->sli3_options & LPFC_SLI3_BG_ENABLED) && |
2786 | scsi_get_prot_op(cmnd) != SCSI_PROT_NORMAL) { | 2814 | scsi_get_prot_op(cmnd) != SCSI_PROT_NORMAL) { |
2787 | 2815 | ||
2788 | printk(KERN_ERR "BLKGRD ERROR: rcvd protected cmd:%02x op:%02x " | 2816 | lpfc_printf_log(phba, KERN_ERR, LOG_BG, |
2789 | "str=%s without registering for BlockGuard - " | 2817 | "9058 BLKGRD: ERROR: rcvd protected cmd:%02x" |
2790 | "Rejecting command\n", | 2818 | " op:%02x str=%s without registering for" |
2819 | " BlockGuard - Rejecting command\n", | ||
2791 | cmnd->cmnd[0], scsi_get_prot_op(cmnd), | 2820 | cmnd->cmnd[0], scsi_get_prot_op(cmnd), |
2792 | dif_op_str[scsi_get_prot_op(cmnd)]); | 2821 | dif_op_str[scsi_get_prot_op(cmnd)]); |
2793 | goto out_fail_command; | 2822 | goto out_fail_command; |
@@ -2827,61 +2856,66 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) | |||
2827 | cmnd->scsi_done = done; | 2856 | cmnd->scsi_done = done; |
2828 | 2857 | ||
2829 | if (scsi_get_prot_op(cmnd) != SCSI_PROT_NORMAL) { | 2858 | if (scsi_get_prot_op(cmnd) != SCSI_PROT_NORMAL) { |
2830 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, | 2859 | if (vport->phba->cfg_enable_bg) { |
2860 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, | ||
2831 | "9033 BLKGRD: rcvd protected cmd:%02x op:%02x " | 2861 | "9033 BLKGRD: rcvd protected cmd:%02x op:%02x " |
2832 | "str=%s\n", | 2862 | "str=%s\n", |
2833 | cmnd->cmnd[0], scsi_get_prot_op(cmnd), | 2863 | cmnd->cmnd[0], scsi_get_prot_op(cmnd), |
2834 | dif_op_str[scsi_get_prot_op(cmnd)]); | 2864 | dif_op_str[scsi_get_prot_op(cmnd)]); |
2835 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, | 2865 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, |
2836 | "9034 BLKGRD: CDB: %02x %02x %02x %02x %02x " | 2866 | "9034 BLKGRD: CDB: %02x %02x %02x %02x %02x " |
2837 | "%02x %02x %02x %02x %02x\n", | 2867 | "%02x %02x %02x %02x %02x\n", |
2838 | cmnd->cmnd[0], cmnd->cmnd[1], cmnd->cmnd[2], | 2868 | cmnd->cmnd[0], cmnd->cmnd[1], cmnd->cmnd[2], |
2839 | cmnd->cmnd[3], cmnd->cmnd[4], cmnd->cmnd[5], | 2869 | cmnd->cmnd[3], cmnd->cmnd[4], cmnd->cmnd[5], |
2840 | cmnd->cmnd[6], cmnd->cmnd[7], cmnd->cmnd[8], | 2870 | cmnd->cmnd[6], cmnd->cmnd[7], cmnd->cmnd[8], |
2841 | cmnd->cmnd[9]); | 2871 | cmnd->cmnd[9]); |
2842 | if (cmnd->cmnd[0] == READ_10) | 2872 | if (cmnd->cmnd[0] == READ_10) |
2843 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, | 2873 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, |
2844 | "9035 BLKGRD: READ @ sector %llu, " | 2874 | "9035 BLKGRD: READ @ sector %llu, " |
2845 | "count %u\n", | 2875 | "count %u\n", |
2846 | (unsigned long long)scsi_get_lba(cmnd), | 2876 | (unsigned long long)scsi_get_lba(cmnd), |
2847 | blk_rq_sectors(cmnd->request)); | 2877 | blk_rq_sectors(cmnd->request)); |
2848 | else if (cmnd->cmnd[0] == WRITE_10) | 2878 | else if (cmnd->cmnd[0] == WRITE_10) |
2849 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, | 2879 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, |
2850 | "9036 BLKGRD: WRITE @ sector %llu, " | 2880 | "9036 BLKGRD: WRITE @ sector %llu, " |
2851 | "count %u cmd=%p\n", | 2881 | "count %u cmd=%p\n", |
2852 | (unsigned long long)scsi_get_lba(cmnd), | 2882 | (unsigned long long)scsi_get_lba(cmnd), |
2853 | blk_rq_sectors(cmnd->request), | 2883 | blk_rq_sectors(cmnd->request), |
2854 | cmnd); | 2884 | cmnd); |
2885 | } | ||
2855 | 2886 | ||
2856 | err = lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd); | 2887 | err = lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd); |
2857 | } else { | 2888 | } else { |
2858 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, | 2889 | if (vport->phba->cfg_enable_bg) { |
2859 | "9038 BLKGRD: rcvd unprotected cmd:%02x op:%02x" | ||
2860 | " str=%s\n", | ||
2861 | cmnd->cmnd[0], scsi_get_prot_op(cmnd), | ||
2862 | dif_op_str[scsi_get_prot_op(cmnd)]); | ||
2863 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, | ||
2864 | "9039 BLKGRD: CDB: %02x %02x %02x %02x %02x " | ||
2865 | "%02x %02x %02x %02x %02x\n", | ||
2866 | cmnd->cmnd[0], cmnd->cmnd[1], cmnd->cmnd[2], | ||
2867 | cmnd->cmnd[3], cmnd->cmnd[4], cmnd->cmnd[5], | ||
2868 | cmnd->cmnd[6], cmnd->cmnd[7], cmnd->cmnd[8], | ||
2869 | cmnd->cmnd[9]); | ||
2870 | if (cmnd->cmnd[0] == READ_10) | ||
2871 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, | 2890 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, |
2872 | "9040 dbg: READ @ sector %llu, " | 2891 | "9038 BLKGRD: rcvd unprotected cmd:" |
2873 | "count %u\n", | 2892 | "%02x op:%02x str=%s\n", |
2874 | (unsigned long long)scsi_get_lba(cmnd), | 2893 | cmnd->cmnd[0], scsi_get_prot_op(cmnd), |
2894 | dif_op_str[scsi_get_prot_op(cmnd)]); | ||
2895 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, | ||
2896 | "9039 BLKGRD: CDB: %02x %02x %02x " | ||
2897 | "%02x %02x %02x %02x %02x %02x %02x\n", | ||
2898 | cmnd->cmnd[0], cmnd->cmnd[1], | ||
2899 | cmnd->cmnd[2], cmnd->cmnd[3], | ||
2900 | cmnd->cmnd[4], cmnd->cmnd[5], | ||
2901 | cmnd->cmnd[6], cmnd->cmnd[7], | ||
2902 | cmnd->cmnd[8], cmnd->cmnd[9]); | ||
2903 | if (cmnd->cmnd[0] == READ_10) | ||
2904 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, | ||
2905 | "9040 dbg: READ @ sector %llu, " | ||
2906 | "count %u\n", | ||
2907 | (unsigned long long)scsi_get_lba(cmnd), | ||
2875 | blk_rq_sectors(cmnd->request)); | 2908 | blk_rq_sectors(cmnd->request)); |
2876 | else if (cmnd->cmnd[0] == WRITE_10) | 2909 | else if (cmnd->cmnd[0] == WRITE_10) |
2877 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, | 2910 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, |
2878 | "9041 dbg: WRITE @ sector %llu, " | 2911 | "9041 dbg: WRITE @ sector %llu, " |
2879 | "count %u cmd=%p\n", | 2912 | "count %u cmd=%p\n", |
2880 | (unsigned long long)scsi_get_lba(cmnd), | 2913 | (unsigned long long)scsi_get_lba(cmnd), |
2881 | blk_rq_sectors(cmnd->request), cmnd); | 2914 | blk_rq_sectors(cmnd->request), cmnd); |
2882 | else | 2915 | else |
2883 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, | 2916 | lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, |
2884 | "9042 dbg: parser not implemented\n"); | 2917 | "9042 dbg: parser not implemented\n"); |
2918 | } | ||
2885 | err = lpfc_scsi_prep_dma_buf(phba, lpfc_cmd); | 2919 | err = lpfc_scsi_prep_dma_buf(phba, lpfc_cmd); |
2886 | } | 2920 | } |
2887 | 2921 | ||