aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_scsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_scsi.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c178
1 files changed, 126 insertions, 52 deletions
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index b1b7dd22af09..2e65168d8723 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -1314,6 +1314,8 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1314 struct scatterlist *sgde; /* s/g data entry */ 1314 struct scatterlist *sgde; /* s/g data entry */
1315 struct lpfc_scsi_buf *lpfc_cmd = NULL; 1315 struct lpfc_scsi_buf *lpfc_cmd = NULL;
1316 struct scsi_dif_tuple *src = NULL; 1316 struct scsi_dif_tuple *src = NULL;
1317 struct lpfc_nodelist *ndlp;
1318 struct lpfc_rport_data *rdata;
1317 uint32_t op = scsi_get_prot_op(sc); 1319 uint32_t op = scsi_get_prot_op(sc);
1318 uint32_t blksize; 1320 uint32_t blksize;
1319 uint32_t numblks; 1321 uint32_t numblks;
@@ -1326,8 +1328,9 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1326 1328
1327 sgpe = scsi_prot_sglist(sc); 1329 sgpe = scsi_prot_sglist(sc);
1328 sgde = scsi_sglist(sc); 1330 sgde = scsi_sglist(sc);
1329
1330 lba = scsi_get_lba(sc); 1331 lba = scsi_get_lba(sc);
1332
1333 /* First check if we need to match the LBA */
1331 if (phba->lpfc_injerr_lba != LPFC_INJERR_LBA_OFF) { 1334 if (phba->lpfc_injerr_lba != LPFC_INJERR_LBA_OFF) {
1332 blksize = lpfc_cmd_blksize(sc); 1335 blksize = lpfc_cmd_blksize(sc);
1333 numblks = (scsi_bufflen(sc) + blksize - 1) / blksize; 1336 numblks = (scsi_bufflen(sc) + blksize - 1) / blksize;
@@ -1342,12 +1345,36 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1342 sizeof(struct scsi_dif_tuple); 1345 sizeof(struct scsi_dif_tuple);
1343 if (numblks < blockoff) 1346 if (numblks < blockoff)
1344 blockoff = numblks; 1347 blockoff = numblks;
1345 src = (struct scsi_dif_tuple *)sg_virt(sgpe);
1346 src += blockoff;
1347 lpfc_cmd = (struct lpfc_scsi_buf *)sc->host_scribble;
1348 } 1348 }
1349 } 1349 }
1350 1350
1351 /* Next check if we need to match the remote NPortID or WWPN */
1352 rdata = sc->device->hostdata;
1353 if (rdata && rdata->pnode) {
1354 ndlp = rdata->pnode;
1355
1356 /* Make sure we have the right NPortID if one is specified */
1357 if (phba->lpfc_injerr_nportid &&
1358 (phba->lpfc_injerr_nportid != ndlp->nlp_DID))
1359 return 0;
1360
1361 /*
1362 * Make sure we have the right WWPN if one is specified.
1363 * wwn[0] should be a non-zero NAA in a good WWPN.
1364 */
1365 if (phba->lpfc_injerr_wwpn.u.wwn[0] &&
1366 (memcmp(&ndlp->nlp_portname, &phba->lpfc_injerr_wwpn,
1367 sizeof(struct lpfc_name)) != 0))
1368 return 0;
1369 }
1370
1371 /* Setup a ptr to the protection data if the SCSI host provides it */
1372 if (sgpe) {
1373 src = (struct scsi_dif_tuple *)sg_virt(sgpe);
1374 src += blockoff;
1375 lpfc_cmd = (struct lpfc_scsi_buf *)sc->host_scribble;
1376 }
1377
1351 /* Should we change the Reference Tag */ 1378 /* Should we change the Reference Tag */
1352 if (reftag) { 1379 if (reftag) {
1353 if (phba->lpfc_injerr_wref_cnt) { 1380 if (phba->lpfc_injerr_wref_cnt) {
@@ -1382,8 +1409,13 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1382 } 1409 }
1383 src->ref_tag = cpu_to_be32(0xDEADBEEF); 1410 src->ref_tag = cpu_to_be32(0xDEADBEEF);
1384 phba->lpfc_injerr_wref_cnt--; 1411 phba->lpfc_injerr_wref_cnt--;
1385 phba->lpfc_injerr_lba = 1412 if (phba->lpfc_injerr_wref_cnt == 0) {
1386 LPFC_INJERR_LBA_OFF; 1413 phba->lpfc_injerr_nportid = 0;
1414 phba->lpfc_injerr_lba =
1415 LPFC_INJERR_LBA_OFF;
1416 memset(&phba->lpfc_injerr_wwpn,
1417 0, sizeof(struct lpfc_name));
1418 }
1387 rc = BG_ERR_TGT | BG_ERR_CHECK; 1419 rc = BG_ERR_TGT | BG_ERR_CHECK;
1388 1420
1389 break; 1421 break;
@@ -1398,7 +1430,13 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1398 /* DEADBEEF will be the reftag on the wire */ 1430 /* DEADBEEF will be the reftag on the wire */
1399 *reftag = 0xDEADBEEF; 1431 *reftag = 0xDEADBEEF;
1400 phba->lpfc_injerr_wref_cnt--; 1432 phba->lpfc_injerr_wref_cnt--;
1401 phba->lpfc_injerr_lba = LPFC_INJERR_LBA_OFF; 1433 if (phba->lpfc_injerr_wref_cnt == 0) {
1434 phba->lpfc_injerr_nportid = 0;
1435 phba->lpfc_injerr_lba =
1436 LPFC_INJERR_LBA_OFF;
1437 memset(&phba->lpfc_injerr_wwpn,
1438 0, sizeof(struct lpfc_name));
1439 }
1402 rc = BG_ERR_TGT | BG_ERR_CHECK; 1440 rc = BG_ERR_TGT | BG_ERR_CHECK;
1403 1441
1404 lpfc_printf_log(phba, KERN_ERR, LOG_BG, 1442 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
@@ -1413,7 +1451,13 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1413 */ 1451 */
1414 *reftag = 0xDEADBEEF; 1452 *reftag = 0xDEADBEEF;
1415 phba->lpfc_injerr_wref_cnt--; 1453 phba->lpfc_injerr_wref_cnt--;
1416 phba->lpfc_injerr_lba = LPFC_INJERR_LBA_OFF; 1454 if (phba->lpfc_injerr_wref_cnt == 0) {
1455 phba->lpfc_injerr_nportid = 0;
1456 phba->lpfc_injerr_lba =
1457 LPFC_INJERR_LBA_OFF;
1458 memset(&phba->lpfc_injerr_wwpn,
1459 0, sizeof(struct lpfc_name));
1460 }
1417 rc = BG_ERR_INIT; 1461 rc = BG_ERR_INIT;
1418 1462
1419 lpfc_printf_log(phba, KERN_ERR, LOG_BG, 1463 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
@@ -1425,11 +1469,6 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1425 if (phba->lpfc_injerr_rref_cnt) { 1469 if (phba->lpfc_injerr_rref_cnt) {
1426 switch (op) { 1470 switch (op) {
1427 case SCSI_PROT_READ_INSERT: 1471 case SCSI_PROT_READ_INSERT:
1428 /*
1429 * For READ_INSERT, it doesn't make sense
1430 * to change the reftag.
1431 */
1432 break;
1433 case SCSI_PROT_READ_STRIP: 1472 case SCSI_PROT_READ_STRIP:
1434 case SCSI_PROT_READ_PASS: 1473 case SCSI_PROT_READ_PASS:
1435 /* 1474 /*
@@ -1439,7 +1478,13 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1439 */ 1478 */
1440 *reftag = 0xDEADBEEF; 1479 *reftag = 0xDEADBEEF;
1441 phba->lpfc_injerr_rref_cnt--; 1480 phba->lpfc_injerr_rref_cnt--;
1442 phba->lpfc_injerr_lba = LPFC_INJERR_LBA_OFF; 1481 if (phba->lpfc_injerr_rref_cnt == 0) {
1482 phba->lpfc_injerr_nportid = 0;
1483 phba->lpfc_injerr_lba =
1484 LPFC_INJERR_LBA_OFF;
1485 memset(&phba->lpfc_injerr_wwpn,
1486 0, sizeof(struct lpfc_name));
1487 }
1443 rc = BG_ERR_INIT; 1488 rc = BG_ERR_INIT;
1444 1489
1445 lpfc_printf_log(phba, KERN_ERR, LOG_BG, 1490 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
@@ -1455,7 +1500,7 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1455 if (phba->lpfc_injerr_wapp_cnt) { 1500 if (phba->lpfc_injerr_wapp_cnt) {
1456 switch (op) { 1501 switch (op) {
1457 case SCSI_PROT_WRITE_PASS: 1502 case SCSI_PROT_WRITE_PASS:
1458 if (blockoff && src) { 1503 if (src) {
1459 /* 1504 /*
1460 * For WRITE_PASS, force the error 1505 * For WRITE_PASS, force the error
1461 * to be sent on the wire. It should 1506 * to be sent on the wire. It should
@@ -1464,7 +1509,6 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1464 * inserted in middle of the IO. 1509 * inserted in middle of the IO.
1465 */ 1510 */
1466 1511
1467
1468 lpfc_printf_log(phba, KERN_ERR, LOG_BG, 1512 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
1469 "9080 BLKGRD: Injecting apptag error: " 1513 "9080 BLKGRD: Injecting apptag error: "
1470 "write lba x%lx + x%x oldappTag x%x\n", 1514 "write lba x%lx + x%x oldappTag x%x\n",
@@ -1485,8 +1529,13 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1485 } 1529 }
1486 src->app_tag = cpu_to_be16(0xDEAD); 1530 src->app_tag = cpu_to_be16(0xDEAD);
1487 phba->lpfc_injerr_wapp_cnt--; 1531 phba->lpfc_injerr_wapp_cnt--;
1488 phba->lpfc_injerr_lba = 1532 if (phba->lpfc_injerr_wapp_cnt == 0) {
1489 LPFC_INJERR_LBA_OFF; 1533 phba->lpfc_injerr_nportid = 0;
1534 phba->lpfc_injerr_lba =
1535 LPFC_INJERR_LBA_OFF;
1536 memset(&phba->lpfc_injerr_wwpn,
1537 0, sizeof(struct lpfc_name));
1538 }
1490 rc = BG_ERR_TGT | BG_ERR_CHECK; 1539 rc = BG_ERR_TGT | BG_ERR_CHECK;
1491 break; 1540 break;
1492 } 1541 }
@@ -1500,8 +1549,13 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1500 /* DEAD will be the apptag on the wire */ 1549 /* DEAD will be the apptag on the wire */
1501 *apptag = 0xDEAD; 1550 *apptag = 0xDEAD;
1502 phba->lpfc_injerr_wapp_cnt--; 1551 phba->lpfc_injerr_wapp_cnt--;
1503 phba->lpfc_injerr_lba = LPFC_INJERR_LBA_OFF; 1552 if (phba->lpfc_injerr_wapp_cnt == 0) {
1504 rc = BG_ERR_TGT; 1553 phba->lpfc_injerr_nportid = 0;
1554 phba->lpfc_injerr_lba =
1555 LPFC_INJERR_LBA_OFF;
1556 memset(&phba->lpfc_injerr_wwpn,
1557 0, sizeof(struct lpfc_name));
1558 }
1505 rc = BG_ERR_TGT | BG_ERR_CHECK; 1559 rc = BG_ERR_TGT | BG_ERR_CHECK;
1506 1560
1507 lpfc_printf_log(phba, KERN_ERR, LOG_BG, 1561 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
@@ -1516,7 +1570,13 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1516 */ 1570 */
1517 *apptag = 0xDEAD; 1571 *apptag = 0xDEAD;
1518 phba->lpfc_injerr_wapp_cnt--; 1572 phba->lpfc_injerr_wapp_cnt--;
1519 phba->lpfc_injerr_lba = LPFC_INJERR_LBA_OFF; 1573 if (phba->lpfc_injerr_wapp_cnt == 0) {
1574 phba->lpfc_injerr_nportid = 0;
1575 phba->lpfc_injerr_lba =
1576 LPFC_INJERR_LBA_OFF;
1577 memset(&phba->lpfc_injerr_wwpn,
1578 0, sizeof(struct lpfc_name));
1579 }
1520 rc = BG_ERR_INIT; 1580 rc = BG_ERR_INIT;
1521 1581
1522 lpfc_printf_log(phba, KERN_ERR, LOG_BG, 1582 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
@@ -1528,11 +1588,6 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1528 if (phba->lpfc_injerr_rapp_cnt) { 1588 if (phba->lpfc_injerr_rapp_cnt) {
1529 switch (op) { 1589 switch (op) {
1530 case SCSI_PROT_READ_INSERT: 1590 case SCSI_PROT_READ_INSERT:
1531 /*
1532 * For READ_INSERT, it doesn't make sense
1533 * to change the apptag.
1534 */
1535 break;
1536 case SCSI_PROT_READ_STRIP: 1591 case SCSI_PROT_READ_STRIP:
1537 case SCSI_PROT_READ_PASS: 1592 case SCSI_PROT_READ_PASS:
1538 /* 1593 /*
@@ -1542,7 +1597,13 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1542 */ 1597 */
1543 *apptag = 0xDEAD; 1598 *apptag = 0xDEAD;
1544 phba->lpfc_injerr_rapp_cnt--; 1599 phba->lpfc_injerr_rapp_cnt--;
1545 phba->lpfc_injerr_lba = LPFC_INJERR_LBA_OFF; 1600 if (phba->lpfc_injerr_rapp_cnt == 0) {
1601 phba->lpfc_injerr_nportid = 0;
1602 phba->lpfc_injerr_lba =
1603 LPFC_INJERR_LBA_OFF;
1604 memset(&phba->lpfc_injerr_wwpn,
1605 0, sizeof(struct lpfc_name));
1606 }
1546 rc = BG_ERR_INIT; 1607 rc = BG_ERR_INIT;
1547 1608
1548 lpfc_printf_log(phba, KERN_ERR, LOG_BG, 1609 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
@@ -1569,7 +1630,13 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1569 * detected by the Target. 1630 * detected by the Target.
1570 */ 1631 */
1571 phba->lpfc_injerr_wgrd_cnt--; 1632 phba->lpfc_injerr_wgrd_cnt--;
1572 phba->lpfc_injerr_lba = LPFC_INJERR_LBA_OFF; 1633 if (phba->lpfc_injerr_wgrd_cnt == 0) {
1634 phba->lpfc_injerr_nportid = 0;
1635 phba->lpfc_injerr_lba =
1636 LPFC_INJERR_LBA_OFF;
1637 memset(&phba->lpfc_injerr_wwpn,
1638 0, sizeof(struct lpfc_name));
1639 }
1573 1640
1574 rc |= BG_ERR_TGT | BG_ERR_SWAP; 1641 rc |= BG_ERR_TGT | BG_ERR_SWAP;
1575 /* Signals the caller to swap CRC->CSUM */ 1642 /* Signals the caller to swap CRC->CSUM */
@@ -1585,7 +1652,13 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1585 * being copied from SLI-Host to SLI-Port. 1652 * being copied from SLI-Host to SLI-Port.
1586 */ 1653 */
1587 phba->lpfc_injerr_wgrd_cnt--; 1654 phba->lpfc_injerr_wgrd_cnt--;
1588 phba->lpfc_injerr_lba = LPFC_INJERR_LBA_OFF; 1655 if (phba->lpfc_injerr_wgrd_cnt == 0) {
1656 phba->lpfc_injerr_nportid = 0;
1657 phba->lpfc_injerr_lba =
1658 LPFC_INJERR_LBA_OFF;
1659 memset(&phba->lpfc_injerr_wwpn,
1660 0, sizeof(struct lpfc_name));
1661 }
1589 1662
1590 rc = BG_ERR_INIT | BG_ERR_SWAP; 1663 rc = BG_ERR_INIT | BG_ERR_SWAP;
1591 /* Signals the caller to swap CRC->CSUM */ 1664 /* Signals the caller to swap CRC->CSUM */
@@ -1599,11 +1672,6 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1599 if (phba->lpfc_injerr_rgrd_cnt) { 1672 if (phba->lpfc_injerr_rgrd_cnt) {
1600 switch (op) { 1673 switch (op) {
1601 case SCSI_PROT_READ_INSERT: 1674 case SCSI_PROT_READ_INSERT:
1602 /*
1603 * For READ_INSERT, it doesn't make sense
1604 * to change the guard tag.
1605 */
1606 break;
1607 case SCSI_PROT_READ_STRIP: 1675 case SCSI_PROT_READ_STRIP:
1608 case SCSI_PROT_READ_PASS: 1676 case SCSI_PROT_READ_PASS:
1609 /* 1677 /*
@@ -1612,7 +1680,13 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1612 * should force an IO error to the driver. 1680 * should force an IO error to the driver.
1613 */ 1681 */
1614 phba->lpfc_injerr_rgrd_cnt--; 1682 phba->lpfc_injerr_rgrd_cnt--;
1615 phba->lpfc_injerr_lba = LPFC_INJERR_LBA_OFF; 1683 if (phba->lpfc_injerr_rgrd_cnt == 0) {
1684 phba->lpfc_injerr_nportid = 0;
1685 phba->lpfc_injerr_lba =
1686 LPFC_INJERR_LBA_OFF;
1687 memset(&phba->lpfc_injerr_wwpn,
1688 0, sizeof(struct lpfc_name));
1689 }
1616 1690
1617 rc = BG_ERR_INIT | BG_ERR_SWAP; 1691 rc = BG_ERR_INIT | BG_ERR_SWAP;
1618 /* Signals the caller to swap CRC->CSUM */ 1692 /* Signals the caller to swap CRC->CSUM */
@@ -1650,20 +1724,20 @@ lpfc_sc_to_bg_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1650 switch (scsi_get_prot_op(sc)) { 1724 switch (scsi_get_prot_op(sc)) {
1651 case SCSI_PROT_READ_INSERT: 1725 case SCSI_PROT_READ_INSERT:
1652 case SCSI_PROT_WRITE_STRIP: 1726 case SCSI_PROT_WRITE_STRIP:
1653 *txop = BG_OP_IN_CSUM_OUT_NODIF;
1654 *rxop = BG_OP_IN_NODIF_OUT_CSUM; 1727 *rxop = BG_OP_IN_NODIF_OUT_CSUM;
1728 *txop = BG_OP_IN_CSUM_OUT_NODIF;
1655 break; 1729 break;
1656 1730
1657 case SCSI_PROT_READ_STRIP: 1731 case SCSI_PROT_READ_STRIP:
1658 case SCSI_PROT_WRITE_INSERT: 1732 case SCSI_PROT_WRITE_INSERT:
1659 *txop = BG_OP_IN_NODIF_OUT_CRC;
1660 *rxop = BG_OP_IN_CRC_OUT_NODIF; 1733 *rxop = BG_OP_IN_CRC_OUT_NODIF;
1734 *txop = BG_OP_IN_NODIF_OUT_CRC;
1661 break; 1735 break;
1662 1736
1663 case SCSI_PROT_READ_PASS: 1737 case SCSI_PROT_READ_PASS:
1664 case SCSI_PROT_WRITE_PASS: 1738 case SCSI_PROT_WRITE_PASS:
1665 *txop = BG_OP_IN_CSUM_OUT_CRC;
1666 *rxop = BG_OP_IN_CRC_OUT_CSUM; 1739 *rxop = BG_OP_IN_CRC_OUT_CSUM;
1740 *txop = BG_OP_IN_CSUM_OUT_CRC;
1667 break; 1741 break;
1668 1742
1669 case SCSI_PROT_NORMAL: 1743 case SCSI_PROT_NORMAL:
@@ -1679,20 +1753,20 @@ lpfc_sc_to_bg_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1679 switch (scsi_get_prot_op(sc)) { 1753 switch (scsi_get_prot_op(sc)) {
1680 case SCSI_PROT_READ_STRIP: 1754 case SCSI_PROT_READ_STRIP:
1681 case SCSI_PROT_WRITE_INSERT: 1755 case SCSI_PROT_WRITE_INSERT:
1682 *txop = BG_OP_IN_NODIF_OUT_CRC;
1683 *rxop = BG_OP_IN_CRC_OUT_NODIF; 1756 *rxop = BG_OP_IN_CRC_OUT_NODIF;
1757 *txop = BG_OP_IN_NODIF_OUT_CRC;
1684 break; 1758 break;
1685 1759
1686 case SCSI_PROT_READ_PASS: 1760 case SCSI_PROT_READ_PASS:
1687 case SCSI_PROT_WRITE_PASS: 1761 case SCSI_PROT_WRITE_PASS:
1688 *txop = BG_OP_IN_CRC_OUT_CRC;
1689 *rxop = BG_OP_IN_CRC_OUT_CRC; 1762 *rxop = BG_OP_IN_CRC_OUT_CRC;
1763 *txop = BG_OP_IN_CRC_OUT_CRC;
1690 break; 1764 break;
1691 1765
1692 case SCSI_PROT_READ_INSERT: 1766 case SCSI_PROT_READ_INSERT:
1693 case SCSI_PROT_WRITE_STRIP: 1767 case SCSI_PROT_WRITE_STRIP:
1694 *txop = BG_OP_IN_CRC_OUT_NODIF;
1695 *rxop = BG_OP_IN_NODIF_OUT_CRC; 1768 *rxop = BG_OP_IN_NODIF_OUT_CRC;
1769 *txop = BG_OP_IN_CRC_OUT_NODIF;
1696 break; 1770 break;
1697 1771
1698 case SCSI_PROT_NORMAL: 1772 case SCSI_PROT_NORMAL:
@@ -1731,20 +1805,20 @@ lpfc_bg_err_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1731 switch (scsi_get_prot_op(sc)) { 1805 switch (scsi_get_prot_op(sc)) {
1732 case SCSI_PROT_READ_INSERT: 1806 case SCSI_PROT_READ_INSERT:
1733 case SCSI_PROT_WRITE_STRIP: 1807 case SCSI_PROT_WRITE_STRIP:
1734 *txop = BG_OP_IN_CRC_OUT_NODIF;
1735 *rxop = BG_OP_IN_NODIF_OUT_CRC; 1808 *rxop = BG_OP_IN_NODIF_OUT_CRC;
1809 *txop = BG_OP_IN_CRC_OUT_NODIF;
1736 break; 1810 break;
1737 1811
1738 case SCSI_PROT_READ_STRIP: 1812 case SCSI_PROT_READ_STRIP:
1739 case SCSI_PROT_WRITE_INSERT: 1813 case SCSI_PROT_WRITE_INSERT:
1740 *txop = BG_OP_IN_NODIF_OUT_CSUM;
1741 *rxop = BG_OP_IN_CSUM_OUT_NODIF; 1814 *rxop = BG_OP_IN_CSUM_OUT_NODIF;
1815 *txop = BG_OP_IN_NODIF_OUT_CSUM;
1742 break; 1816 break;
1743 1817
1744 case SCSI_PROT_READ_PASS: 1818 case SCSI_PROT_READ_PASS:
1745 case SCSI_PROT_WRITE_PASS: 1819 case SCSI_PROT_WRITE_PASS:
1820 *rxop = BG_OP_IN_CSUM_OUT_CRC;
1746 *txop = BG_OP_IN_CRC_OUT_CSUM; 1821 *txop = BG_OP_IN_CRC_OUT_CSUM;
1747 *rxop = BG_OP_IN_CRC_OUT_CRC;
1748 break; 1822 break;
1749 1823
1750 case SCSI_PROT_NORMAL: 1824 case SCSI_PROT_NORMAL:
@@ -1756,20 +1830,20 @@ lpfc_bg_err_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1756 switch (scsi_get_prot_op(sc)) { 1830 switch (scsi_get_prot_op(sc)) {
1757 case SCSI_PROT_READ_STRIP: 1831 case SCSI_PROT_READ_STRIP:
1758 case SCSI_PROT_WRITE_INSERT: 1832 case SCSI_PROT_WRITE_INSERT:
1759 *txop = BG_OP_IN_NODIF_OUT_CSUM;
1760 *rxop = BG_OP_IN_CSUM_OUT_NODIF; 1833 *rxop = BG_OP_IN_CSUM_OUT_NODIF;
1834 *txop = BG_OP_IN_NODIF_OUT_CSUM;
1761 break; 1835 break;
1762 1836
1763 case SCSI_PROT_READ_PASS: 1837 case SCSI_PROT_READ_PASS:
1764 case SCSI_PROT_WRITE_PASS: 1838 case SCSI_PROT_WRITE_PASS:
1839 *rxop = BG_OP_IN_CSUM_OUT_CSUM;
1765 *txop = BG_OP_IN_CSUM_OUT_CSUM; 1840 *txop = BG_OP_IN_CSUM_OUT_CSUM;
1766 *rxop = BG_OP_IN_CRC_OUT_CSUM;
1767 break; 1841 break;
1768 1842
1769 case SCSI_PROT_READ_INSERT: 1843 case SCSI_PROT_READ_INSERT:
1770 case SCSI_PROT_WRITE_STRIP: 1844 case SCSI_PROT_WRITE_STRIP:
1771 *txop = BG_OP_IN_CSUM_OUT_NODIF;
1772 *rxop = BG_OP_IN_NODIF_OUT_CSUM; 1845 *rxop = BG_OP_IN_NODIF_OUT_CSUM;
1846 *txop = BG_OP_IN_CSUM_OUT_NODIF;
1773 break; 1847 break;
1774 1848
1775 case SCSI_PROT_NORMAL: 1849 case SCSI_PROT_NORMAL:
@@ -1838,7 +1912,7 @@ lpfc_bg_setup_bpl(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1838 reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */ 1912 reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
1839 1913
1840#ifdef CONFIG_SCSI_LPFC_DEBUG_FS 1914#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
1841 rc = lpfc_bg_err_inject(phba, sc, &reftag, 0, 1); 1915 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1);
1842 if (rc) { 1916 if (rc) {
1843 if (rc & BG_ERR_SWAP) 1917 if (rc & BG_ERR_SWAP)
1844 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); 1918 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop);
@@ -1985,7 +2059,7 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1985 reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */ 2059 reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
1986 2060
1987#ifdef CONFIG_SCSI_LPFC_DEBUG_FS 2061#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
1988 rc = lpfc_bg_err_inject(phba, sc, &reftag, 0, 1); 2062 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1);
1989 if (rc) { 2063 if (rc) {
1990 if (rc & BG_ERR_SWAP) 2064 if (rc & BG_ERR_SWAP)
1991 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); 2065 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop);
@@ -2193,7 +2267,7 @@ lpfc_bg_setup_sgl(struct lpfc_hba *phba, struct scsi_cmnd *sc,
2193 reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */ 2267 reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
2194 2268
2195#ifdef CONFIG_SCSI_LPFC_DEBUG_FS 2269#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
2196 rc = lpfc_bg_err_inject(phba, sc, &reftag, 0, 1); 2270 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1);
2197 if (rc) { 2271 if (rc) {
2198 if (rc & BG_ERR_SWAP) 2272 if (rc & BG_ERR_SWAP)
2199 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); 2273 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop);
@@ -2333,7 +2407,7 @@ lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
2333 reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */ 2407 reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
2334 2408
2335#ifdef CONFIG_SCSI_LPFC_DEBUG_FS 2409#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
2336 rc = lpfc_bg_err_inject(phba, sc, &reftag, 0, 1); 2410 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1);
2337 if (rc) { 2411 if (rc) {
2338 if (rc & BG_ERR_SWAP) 2412 if (rc & BG_ERR_SWAP)
2339 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); 2413 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop);
@@ -2809,7 +2883,7 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd,
2809 /* No error was reported - problem in FW? */ 2883 /* No error was reported - problem in FW? */
2810 cmd->result = ScsiResult(DID_ERROR, 0); 2884 cmd->result = ScsiResult(DID_ERROR, 0);
2811 lpfc_printf_log(phba, KERN_ERR, LOG_BG, 2885 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
2812 "9057 BLKGRD: no errors reported!\n"); 2886 "9057 BLKGRD: Unknown error reported!\n");
2813 } 2887 }
2814 2888
2815out: 2889out: