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.c488
1 files changed, 295 insertions, 193 deletions
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index efc055b6bac4..88f3a83dbd2e 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -39,8 +39,8 @@
39#include "lpfc_sli4.h" 39#include "lpfc_sli4.h"
40#include "lpfc_nl.h" 40#include "lpfc_nl.h"
41#include "lpfc_disc.h" 41#include "lpfc_disc.h"
42#include "lpfc_scsi.h"
43#include "lpfc.h" 42#include "lpfc.h"
43#include "lpfc_scsi.h"
44#include "lpfc_logmsg.h" 44#include "lpfc_logmsg.h"
45#include "lpfc_crtn.h" 45#include "lpfc_crtn.h"
46#include "lpfc_vport.h" 46#include "lpfc_vport.h"
@@ -51,13 +51,19 @@
51int _dump_buf_done; 51int _dump_buf_done;
52 52
53static char *dif_op_str[] = { 53static char *dif_op_str[] = {
54 "SCSI_PROT_NORMAL", 54 "PROT_NORMAL",
55 "SCSI_PROT_READ_INSERT", 55 "PROT_READ_INSERT",
56 "SCSI_PROT_WRITE_STRIP", 56 "PROT_WRITE_STRIP",
57 "SCSI_PROT_READ_STRIP", 57 "PROT_READ_STRIP",
58 "SCSI_PROT_WRITE_INSERT", 58 "PROT_WRITE_INSERT",
59 "SCSI_PROT_READ_PASS", 59 "PROT_READ_PASS",
60 "SCSI_PROT_WRITE_PASS", 60 "PROT_WRITE_PASS",
61};
62
63static char *dif_grd_str[] = {
64 "NO_GUARD",
65 "DIF_CRC",
66 "DIX_IP",
61}; 67};
62 68
63struct scsi_dif_tuple { 69struct scsi_dif_tuple {
@@ -1281,10 +1287,14 @@ lpfc_cmd_blksize(struct scsi_cmnd *sc)
1281 1287
1282#ifdef CONFIG_SCSI_LPFC_DEBUG_FS 1288#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
1283 1289
1284#define BG_ERR_INIT 1 1290/* Return if if error injection is detected by Initiator */
1285#define BG_ERR_TGT 2 1291#define BG_ERR_INIT 0x1
1286#define BG_ERR_SWAP 3 1292/* Return if if error injection is detected by Target */
1287#define BG_ERR_CHECK 4 1293#define BG_ERR_TGT 0x2
1294/* Return if if swapping CSUM<-->CRC is required for error injection */
1295#define BG_ERR_SWAP 0x10
1296/* Return if disabling Guard/Ref/App checking is required for error injection */
1297#define BG_ERR_CHECK 0x20
1288 1298
1289/** 1299/**
1290 * lpfc_bg_err_inject - Determine if we should inject an error 1300 * lpfc_bg_err_inject - Determine if we should inject an error
@@ -1294,10 +1304,7 @@ lpfc_cmd_blksize(struct scsi_cmnd *sc)
1294 * @apptag: (out) BlockGuard application tag for transmitted data 1304 * @apptag: (out) BlockGuard application tag for transmitted data
1295 * @new_guard (in) Value to replace CRC with if needed 1305 * @new_guard (in) Value to replace CRC with if needed
1296 * 1306 *
1297 * Returns (1) if error injection is detected by Initiator 1307 * Returns BG_ERR_* bit mask or 0 if request ignored
1298 * Returns (2) if error injection is detected by Target
1299 * Returns (3) if swapping CSUM->CRC is required for error injection
1300 * Returns (4) disabling Guard/Ref/App checking is required for error injection
1301 **/ 1308 **/
1302static int 1309static int
1303lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc, 1310lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
@@ -1305,7 +1312,10 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1305{ 1312{
1306 struct scatterlist *sgpe; /* s/g prot entry */ 1313 struct scatterlist *sgpe; /* s/g prot entry */
1307 struct scatterlist *sgde; /* s/g data entry */ 1314 struct scatterlist *sgde; /* s/g data entry */
1315 struct lpfc_scsi_buf *lpfc_cmd = NULL;
1308 struct scsi_dif_tuple *src = NULL; 1316 struct scsi_dif_tuple *src = NULL;
1317 struct lpfc_nodelist *ndlp;
1318 struct lpfc_rport_data *rdata;
1309 uint32_t op = scsi_get_prot_op(sc); 1319 uint32_t op = scsi_get_prot_op(sc);
1310 uint32_t blksize; 1320 uint32_t blksize;
1311 uint32_t numblks; 1321 uint32_t numblks;
@@ -1318,8 +1328,9 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1318 1328
1319 sgpe = scsi_prot_sglist(sc); 1329 sgpe = scsi_prot_sglist(sc);
1320 sgde = scsi_sglist(sc); 1330 sgde = scsi_sglist(sc);
1321
1322 lba = scsi_get_lba(sc); 1331 lba = scsi_get_lba(sc);
1332
1333 /* First check if we need to match the LBA */
1323 if (phba->lpfc_injerr_lba != LPFC_INJERR_LBA_OFF) { 1334 if (phba->lpfc_injerr_lba != LPFC_INJERR_LBA_OFF) {
1324 blksize = lpfc_cmd_blksize(sc); 1335 blksize = lpfc_cmd_blksize(sc);
1325 numblks = (scsi_bufflen(sc) + blksize - 1) / blksize; 1336 numblks = (scsi_bufflen(sc) + blksize - 1) / blksize;
@@ -1334,66 +1345,123 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1334 sizeof(struct scsi_dif_tuple); 1345 sizeof(struct scsi_dif_tuple);
1335 if (numblks < blockoff) 1346 if (numblks < blockoff)
1336 blockoff = numblks; 1347 blockoff = numblks;
1337 src = (struct scsi_dif_tuple *)sg_virt(sgpe);
1338 src += blockoff;
1339 } 1348 }
1340 } 1349 }
1341 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
1342 /* Should we change the Reference Tag */ 1378 /* Should we change the Reference Tag */
1343 if (reftag) { 1379 if (reftag) {
1344 if (phba->lpfc_injerr_wref_cnt) { 1380 if (phba->lpfc_injerr_wref_cnt) {
1345 switch (op) { 1381 switch (op) {
1346 case SCSI_PROT_WRITE_PASS: 1382 case SCSI_PROT_WRITE_PASS:
1347 if (blockoff && src) { 1383 if (src) {
1348 /* Insert error in middle of the IO */ 1384 /*
1385 * For WRITE_PASS, force the error
1386 * to be sent on the wire. It should
1387 * be detected by the Target.
1388 * If blockoff != 0 error will be
1389 * inserted in middle of the IO.
1390 */
1349 1391
1350 lpfc_printf_log(phba, KERN_ERR, LOG_BG, 1392 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
1351 "9076 BLKGRD: Injecting reftag error: " 1393 "9076 BLKGRD: Injecting reftag error: "
1352 "write lba x%lx + x%x oldrefTag x%x\n", 1394 "write lba x%lx + x%x oldrefTag x%x\n",
1353 (unsigned long)lba, blockoff, 1395 (unsigned long)lba, blockoff,
1354 src->ref_tag); 1396 be32_to_cpu(src->ref_tag));
1355 1397
1356 /* 1398 /*
1357 * NOTE, this will change ref tag in 1399 * Save the old ref_tag so we can
1358 * the memory location forever! 1400 * restore it on completion.
1359 */ 1401 */
1360 src->ref_tag = 0xDEADBEEF; 1402 if (lpfc_cmd) {
1403 lpfc_cmd->prot_data_type =
1404 LPFC_INJERR_REFTAG;
1405 lpfc_cmd->prot_data_segment =
1406 src;
1407 lpfc_cmd->prot_data =
1408 src->ref_tag;
1409 }
1410 src->ref_tag = cpu_to_be32(0xDEADBEEF);
1361 phba->lpfc_injerr_wref_cnt--; 1411 phba->lpfc_injerr_wref_cnt--;
1362 phba->lpfc_injerr_lba = 1412 if (phba->lpfc_injerr_wref_cnt == 0) {
1363 LPFC_INJERR_LBA_OFF; 1413 phba->lpfc_injerr_nportid = 0;
1364 rc = BG_ERR_CHECK; 1414 phba->lpfc_injerr_lba =
1415 LPFC_INJERR_LBA_OFF;
1416 memset(&phba->lpfc_injerr_wwpn,
1417 0, sizeof(struct lpfc_name));
1418 }
1419 rc = BG_ERR_TGT | BG_ERR_CHECK;
1420
1365 break; 1421 break;
1366 } 1422 }
1367 /* Drop thru */ 1423 /* Drop thru */
1368 case SCSI_PROT_WRITE_STRIP: 1424 case SCSI_PROT_WRITE_INSERT:
1369 /* 1425 /*
1370 * For WRITE_STRIP and WRITE_PASS, 1426 * For WRITE_INSERT, force the error
1371 * force the error on data 1427 * to be sent on the wire. It should be
1372 * being copied from SLI-Host to SLI-Port. 1428 * detected by the Target.
1373 */ 1429 */
1430 /* DEADBEEF will be the reftag on the wire */
1374 *reftag = 0xDEADBEEF; 1431 *reftag = 0xDEADBEEF;
1375 phba->lpfc_injerr_wref_cnt--; 1432 phba->lpfc_injerr_wref_cnt--;
1376 phba->lpfc_injerr_lba = LPFC_INJERR_LBA_OFF; 1433 if (phba->lpfc_injerr_wref_cnt == 0) {
1377 rc = BG_ERR_INIT; 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 }
1440 rc = BG_ERR_TGT | BG_ERR_CHECK;
1378 1441
1379 lpfc_printf_log(phba, KERN_ERR, LOG_BG, 1442 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
1380 "9077 BLKGRD: Injecting reftag error: " 1443 "9078 BLKGRD: Injecting reftag error: "
1381 "write lba x%lx\n", (unsigned long)lba); 1444 "write lba x%lx\n", (unsigned long)lba);
1382 break; 1445 break;
1383 case SCSI_PROT_WRITE_INSERT: 1446 case SCSI_PROT_WRITE_STRIP:
1384 /* 1447 /*
1385 * For WRITE_INSERT, force the 1448 * For WRITE_STRIP and WRITE_PASS,
1386 * error to be sent on the wire. It should be 1449 * force the error on data
1387 * detected by the Target. 1450 * being copied from SLI-Host to SLI-Port.
1388 */ 1451 */
1389 /* DEADBEEF will be the reftag on the wire */
1390 *reftag = 0xDEADBEEF; 1452 *reftag = 0xDEADBEEF;
1391 phba->lpfc_injerr_wref_cnt--; 1453 phba->lpfc_injerr_wref_cnt--;
1392 phba->lpfc_injerr_lba = LPFC_INJERR_LBA_OFF; 1454 if (phba->lpfc_injerr_wref_cnt == 0) {
1393 rc = BG_ERR_TGT; 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 }
1461 rc = BG_ERR_INIT;
1394 1462
1395 lpfc_printf_log(phba, KERN_ERR, LOG_BG, 1463 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
1396 "9078 BLKGRD: Injecting reftag error: " 1464 "9077 BLKGRD: Injecting reftag error: "
1397 "write lba x%lx\n", (unsigned long)lba); 1465 "write lba x%lx\n", (unsigned long)lba);
1398 break; 1466 break;
1399 } 1467 }
@@ -1401,11 +1469,6 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1401 if (phba->lpfc_injerr_rref_cnt) { 1469 if (phba->lpfc_injerr_rref_cnt) {
1402 switch (op) { 1470 switch (op) {
1403 case SCSI_PROT_READ_INSERT: 1471 case SCSI_PROT_READ_INSERT:
1404 /*
1405 * For READ_INSERT, it doesn't make sense
1406 * to change the reftag.
1407 */
1408 break;
1409 case SCSI_PROT_READ_STRIP: 1472 case SCSI_PROT_READ_STRIP:
1410 case SCSI_PROT_READ_PASS: 1473 case SCSI_PROT_READ_PASS:
1411 /* 1474 /*
@@ -1415,7 +1478,13 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1415 */ 1478 */
1416 *reftag = 0xDEADBEEF; 1479 *reftag = 0xDEADBEEF;
1417 phba->lpfc_injerr_rref_cnt--; 1480 phba->lpfc_injerr_rref_cnt--;
1418 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 }
1419 rc = BG_ERR_INIT; 1488 rc = BG_ERR_INIT;
1420 1489
1421 lpfc_printf_log(phba, KERN_ERR, LOG_BG, 1490 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
@@ -1431,56 +1500,87 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1431 if (phba->lpfc_injerr_wapp_cnt) { 1500 if (phba->lpfc_injerr_wapp_cnt) {
1432 switch (op) { 1501 switch (op) {
1433 case SCSI_PROT_WRITE_PASS: 1502 case SCSI_PROT_WRITE_PASS:
1434 if (blockoff && src) { 1503 if (src) {
1435 /* Insert error in middle of the IO */ 1504 /*
1505 * For WRITE_PASS, force the error
1506 * to be sent on the wire. It should
1507 * be detected by the Target.
1508 * If blockoff != 0 error will be
1509 * inserted in middle of the IO.
1510 */
1436 1511
1437 lpfc_printf_log(phba, KERN_ERR, LOG_BG, 1512 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
1438 "9080 BLKGRD: Injecting apptag error: " 1513 "9080 BLKGRD: Injecting apptag error: "
1439 "write lba x%lx + x%x oldappTag x%x\n", 1514 "write lba x%lx + x%x oldappTag x%x\n",
1440 (unsigned long)lba, blockoff, 1515 (unsigned long)lba, blockoff,
1441 src->app_tag); 1516 be16_to_cpu(src->app_tag));
1442 1517
1443 /* 1518 /*
1444 * NOTE, this will change app tag in 1519 * Save the old app_tag so we can
1445 * the memory location forever! 1520 * restore it on completion.
1446 */ 1521 */
1447 src->app_tag = 0xDEAD; 1522 if (lpfc_cmd) {
1523 lpfc_cmd->prot_data_type =
1524 LPFC_INJERR_APPTAG;
1525 lpfc_cmd->prot_data_segment =
1526 src;
1527 lpfc_cmd->prot_data =
1528 src->app_tag;
1529 }
1530 src->app_tag = cpu_to_be16(0xDEAD);
1448 phba->lpfc_injerr_wapp_cnt--; 1531 phba->lpfc_injerr_wapp_cnt--;
1449 phba->lpfc_injerr_lba = 1532 if (phba->lpfc_injerr_wapp_cnt == 0) {
1450 LPFC_INJERR_LBA_OFF; 1533 phba->lpfc_injerr_nportid = 0;
1451 rc = BG_ERR_CHECK; 1534 phba->lpfc_injerr_lba =
1535 LPFC_INJERR_LBA_OFF;
1536 memset(&phba->lpfc_injerr_wwpn,
1537 0, sizeof(struct lpfc_name));
1538 }
1539 rc = BG_ERR_TGT | BG_ERR_CHECK;
1452 break; 1540 break;
1453 } 1541 }
1454 /* Drop thru */ 1542 /* Drop thru */
1455 case SCSI_PROT_WRITE_STRIP: 1543 case SCSI_PROT_WRITE_INSERT:
1456 /* 1544 /*
1457 * For WRITE_STRIP and WRITE_PASS, 1545 * For WRITE_INSERT, force the
1458 * force the error on data 1546 * error to be sent on the wire. It should be
1459 * being copied from SLI-Host to SLI-Port. 1547 * detected by the Target.
1460 */ 1548 */
1549 /* DEAD will be the apptag on the wire */
1461 *apptag = 0xDEAD; 1550 *apptag = 0xDEAD;
1462 phba->lpfc_injerr_wapp_cnt--; 1551 phba->lpfc_injerr_wapp_cnt--;
1463 phba->lpfc_injerr_lba = LPFC_INJERR_LBA_OFF; 1552 if (phba->lpfc_injerr_wapp_cnt == 0) {
1464 rc = BG_ERR_INIT; 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 }
1559 rc = BG_ERR_TGT | BG_ERR_CHECK;
1465 1560
1466 lpfc_printf_log(phba, KERN_ERR, LOG_BG, 1561 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
1467 "0812 BLKGRD: Injecting apptag error: " 1562 "0813 BLKGRD: Injecting apptag error: "
1468 "write lba x%lx\n", (unsigned long)lba); 1563 "write lba x%lx\n", (unsigned long)lba);
1469 break; 1564 break;
1470 case SCSI_PROT_WRITE_INSERT: 1565 case SCSI_PROT_WRITE_STRIP:
1471 /* 1566 /*
1472 * For WRITE_INSERT, force the 1567 * For WRITE_STRIP and WRITE_PASS,
1473 * error to be sent on the wire. It should be 1568 * force the error on data
1474 * detected by the Target. 1569 * being copied from SLI-Host to SLI-Port.
1475 */ 1570 */
1476 /* DEAD will be the apptag on the wire */
1477 *apptag = 0xDEAD; 1571 *apptag = 0xDEAD;
1478 phba->lpfc_injerr_wapp_cnt--; 1572 phba->lpfc_injerr_wapp_cnt--;
1479 phba->lpfc_injerr_lba = LPFC_INJERR_LBA_OFF; 1573 if (phba->lpfc_injerr_wapp_cnt == 0) {
1480 rc = BG_ERR_TGT; 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 }
1580 rc = BG_ERR_INIT;
1481 1581
1482 lpfc_printf_log(phba, KERN_ERR, LOG_BG, 1582 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
1483 "0813 BLKGRD: Injecting apptag error: " 1583 "0812 BLKGRD: Injecting apptag error: "
1484 "write lba x%lx\n", (unsigned long)lba); 1584 "write lba x%lx\n", (unsigned long)lba);
1485 break; 1585 break;
1486 } 1586 }
@@ -1488,11 +1588,6 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1488 if (phba->lpfc_injerr_rapp_cnt) { 1588 if (phba->lpfc_injerr_rapp_cnt) {
1489 switch (op) { 1589 switch (op) {
1490 case SCSI_PROT_READ_INSERT: 1590 case SCSI_PROT_READ_INSERT:
1491 /*
1492 * For READ_INSERT, it doesn't make sense
1493 * to change the apptag.
1494 */
1495 break;
1496 case SCSI_PROT_READ_STRIP: 1591 case SCSI_PROT_READ_STRIP:
1497 case SCSI_PROT_READ_PASS: 1592 case SCSI_PROT_READ_PASS:
1498 /* 1593 /*
@@ -1502,7 +1597,13 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1502 */ 1597 */
1503 *apptag = 0xDEAD; 1598 *apptag = 0xDEAD;
1504 phba->lpfc_injerr_rapp_cnt--; 1599 phba->lpfc_injerr_rapp_cnt--;
1505 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 }
1506 rc = BG_ERR_INIT; 1607 rc = BG_ERR_INIT;
1507 1608
1508 lpfc_printf_log(phba, KERN_ERR, LOG_BG, 1609 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
@@ -1519,57 +1620,51 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1519 if (phba->lpfc_injerr_wgrd_cnt) { 1620 if (phba->lpfc_injerr_wgrd_cnt) {
1520 switch (op) { 1621 switch (op) {
1521 case SCSI_PROT_WRITE_PASS: 1622 case SCSI_PROT_WRITE_PASS:
1522 if (blockoff && src) { 1623 rc = BG_ERR_CHECK;
1523 /* Insert error in middle of the IO */
1524
1525 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
1526 "0815 BLKGRD: Injecting guard error: "
1527 "write lba x%lx + x%x oldgrdTag x%x\n",
1528 (unsigned long)lba, blockoff,
1529 src->guard_tag);
1530
1531 /*
1532 * NOTE, this will change guard tag in
1533 * the memory location forever!
1534 */
1535 src->guard_tag = 0xDEAD;
1536 phba->lpfc_injerr_wgrd_cnt--;
1537 phba->lpfc_injerr_lba =
1538 LPFC_INJERR_LBA_OFF;
1539 rc = BG_ERR_CHECK;
1540 break;
1541 }
1542 /* Drop thru */ 1624 /* Drop thru */
1543 case SCSI_PROT_WRITE_STRIP: 1625
1626 case SCSI_PROT_WRITE_INSERT:
1544 /* 1627 /*
1545 * For WRITE_STRIP and WRITE_PASS, 1628 * For WRITE_INSERT, force the
1546 * force the error on data 1629 * error to be sent on the wire. It should be
1547 * being copied from SLI-Host to SLI-Port. 1630 * detected by the Target.
1548 */ 1631 */
1549 phba->lpfc_injerr_wgrd_cnt--; 1632 phba->lpfc_injerr_wgrd_cnt--;
1550 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 }
1551 1640
1552 rc = BG_ERR_SWAP; 1641 rc |= BG_ERR_TGT | BG_ERR_SWAP;
1553 /* Signals the caller to swap CRC->CSUM */ 1642 /* Signals the caller to swap CRC->CSUM */
1554 1643
1555 lpfc_printf_log(phba, KERN_ERR, LOG_BG, 1644 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
1556 "0816 BLKGRD: Injecting guard error: " 1645 "0817 BLKGRD: Injecting guard error: "
1557 "write lba x%lx\n", (unsigned long)lba); 1646 "write lba x%lx\n", (unsigned long)lba);
1558 break; 1647 break;
1559 case SCSI_PROT_WRITE_INSERT: 1648 case SCSI_PROT_WRITE_STRIP:
1560 /* 1649 /*
1561 * For WRITE_INSERT, force the 1650 * For WRITE_STRIP and WRITE_PASS,
1562 * error to be sent on the wire. It should be 1651 * force the error on data
1563 * detected by the Target. 1652 * being copied from SLI-Host to SLI-Port.
1564 */ 1653 */
1565 phba->lpfc_injerr_wgrd_cnt--; 1654 phba->lpfc_injerr_wgrd_cnt--;
1566 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 }
1567 1662
1568 rc = BG_ERR_SWAP; 1663 rc = BG_ERR_INIT | BG_ERR_SWAP;
1569 /* Signals the caller to swap CRC->CSUM */ 1664 /* Signals the caller to swap CRC->CSUM */
1570 1665
1571 lpfc_printf_log(phba, KERN_ERR, LOG_BG, 1666 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
1572 "0817 BLKGRD: Injecting guard error: " 1667 "0816 BLKGRD: Injecting guard error: "
1573 "write lba x%lx\n", (unsigned long)lba); 1668 "write lba x%lx\n", (unsigned long)lba);
1574 break; 1669 break;
1575 } 1670 }
@@ -1577,11 +1672,6 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1577 if (phba->lpfc_injerr_rgrd_cnt) { 1672 if (phba->lpfc_injerr_rgrd_cnt) {
1578 switch (op) { 1673 switch (op) {
1579 case SCSI_PROT_READ_INSERT: 1674 case SCSI_PROT_READ_INSERT:
1580 /*
1581 * For READ_INSERT, it doesn't make sense
1582 * to change the guard tag.
1583 */
1584 break;
1585 case SCSI_PROT_READ_STRIP: 1675 case SCSI_PROT_READ_STRIP:
1586 case SCSI_PROT_READ_PASS: 1676 case SCSI_PROT_READ_PASS:
1587 /* 1677 /*
@@ -1589,11 +1679,16 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1589 * error on data being read off the wire. It 1679 * error on data being read off the wire. It
1590 * should force an IO error to the driver. 1680 * should force an IO error to the driver.
1591 */ 1681 */
1592 *apptag = 0xDEAD;
1593 phba->lpfc_injerr_rgrd_cnt--; 1682 phba->lpfc_injerr_rgrd_cnt--;
1594 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 }
1595 1690
1596 rc = BG_ERR_SWAP; 1691 rc = BG_ERR_INIT | BG_ERR_SWAP;
1597 /* Signals the caller to swap CRC->CSUM */ 1692 /* Signals the caller to swap CRC->CSUM */
1598 1693
1599 lpfc_printf_log(phba, KERN_ERR, LOG_BG, 1694 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
@@ -1629,20 +1724,20 @@ lpfc_sc_to_bg_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1629 switch (scsi_get_prot_op(sc)) { 1724 switch (scsi_get_prot_op(sc)) {
1630 case SCSI_PROT_READ_INSERT: 1725 case SCSI_PROT_READ_INSERT:
1631 case SCSI_PROT_WRITE_STRIP: 1726 case SCSI_PROT_WRITE_STRIP:
1632 *txop = BG_OP_IN_CSUM_OUT_NODIF;
1633 *rxop = BG_OP_IN_NODIF_OUT_CSUM; 1727 *rxop = BG_OP_IN_NODIF_OUT_CSUM;
1728 *txop = BG_OP_IN_CSUM_OUT_NODIF;
1634 break; 1729 break;
1635 1730
1636 case SCSI_PROT_READ_STRIP: 1731 case SCSI_PROT_READ_STRIP:
1637 case SCSI_PROT_WRITE_INSERT: 1732 case SCSI_PROT_WRITE_INSERT:
1638 *txop = BG_OP_IN_NODIF_OUT_CRC;
1639 *rxop = BG_OP_IN_CRC_OUT_NODIF; 1733 *rxop = BG_OP_IN_CRC_OUT_NODIF;
1734 *txop = BG_OP_IN_NODIF_OUT_CRC;
1640 break; 1735 break;
1641 1736
1642 case SCSI_PROT_READ_PASS: 1737 case SCSI_PROT_READ_PASS:
1643 case SCSI_PROT_WRITE_PASS: 1738 case SCSI_PROT_WRITE_PASS:
1644 *txop = BG_OP_IN_CSUM_OUT_CRC;
1645 *rxop = BG_OP_IN_CRC_OUT_CSUM; 1739 *rxop = BG_OP_IN_CRC_OUT_CSUM;
1740 *txop = BG_OP_IN_CSUM_OUT_CRC;
1646 break; 1741 break;
1647 1742
1648 case SCSI_PROT_NORMAL: 1743 case SCSI_PROT_NORMAL:
@@ -1658,20 +1753,20 @@ lpfc_sc_to_bg_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1658 switch (scsi_get_prot_op(sc)) { 1753 switch (scsi_get_prot_op(sc)) {
1659 case SCSI_PROT_READ_STRIP: 1754 case SCSI_PROT_READ_STRIP:
1660 case SCSI_PROT_WRITE_INSERT: 1755 case SCSI_PROT_WRITE_INSERT:
1661 *txop = BG_OP_IN_NODIF_OUT_CRC;
1662 *rxop = BG_OP_IN_CRC_OUT_NODIF; 1756 *rxop = BG_OP_IN_CRC_OUT_NODIF;
1757 *txop = BG_OP_IN_NODIF_OUT_CRC;
1663 break; 1758 break;
1664 1759
1665 case SCSI_PROT_READ_PASS: 1760 case SCSI_PROT_READ_PASS:
1666 case SCSI_PROT_WRITE_PASS: 1761 case SCSI_PROT_WRITE_PASS:
1667 *txop = BG_OP_IN_CRC_OUT_CRC;
1668 *rxop = BG_OP_IN_CRC_OUT_CRC; 1762 *rxop = BG_OP_IN_CRC_OUT_CRC;
1763 *txop = BG_OP_IN_CRC_OUT_CRC;
1669 break; 1764 break;
1670 1765
1671 case SCSI_PROT_READ_INSERT: 1766 case SCSI_PROT_READ_INSERT:
1672 case SCSI_PROT_WRITE_STRIP: 1767 case SCSI_PROT_WRITE_STRIP:
1673 *txop = BG_OP_IN_CRC_OUT_NODIF;
1674 *rxop = BG_OP_IN_NODIF_OUT_CRC; 1768 *rxop = BG_OP_IN_NODIF_OUT_CRC;
1769 *txop = BG_OP_IN_CRC_OUT_NODIF;
1675 break; 1770 break;
1676 1771
1677 case SCSI_PROT_NORMAL: 1772 case SCSI_PROT_NORMAL:
@@ -1710,20 +1805,20 @@ lpfc_bg_err_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1710 switch (scsi_get_prot_op(sc)) { 1805 switch (scsi_get_prot_op(sc)) {
1711 case SCSI_PROT_READ_INSERT: 1806 case SCSI_PROT_READ_INSERT:
1712 case SCSI_PROT_WRITE_STRIP: 1807 case SCSI_PROT_WRITE_STRIP:
1713 *txop = BG_OP_IN_CRC_OUT_NODIF;
1714 *rxop = BG_OP_IN_NODIF_OUT_CRC; 1808 *rxop = BG_OP_IN_NODIF_OUT_CRC;
1809 *txop = BG_OP_IN_CRC_OUT_NODIF;
1715 break; 1810 break;
1716 1811
1717 case SCSI_PROT_READ_STRIP: 1812 case SCSI_PROT_READ_STRIP:
1718 case SCSI_PROT_WRITE_INSERT: 1813 case SCSI_PROT_WRITE_INSERT:
1719 *txop = BG_OP_IN_NODIF_OUT_CSUM;
1720 *rxop = BG_OP_IN_CSUM_OUT_NODIF; 1814 *rxop = BG_OP_IN_CSUM_OUT_NODIF;
1815 *txop = BG_OP_IN_NODIF_OUT_CSUM;
1721 break; 1816 break;
1722 1817
1723 case SCSI_PROT_READ_PASS: 1818 case SCSI_PROT_READ_PASS:
1724 case SCSI_PROT_WRITE_PASS: 1819 case SCSI_PROT_WRITE_PASS:
1725 *txop = BG_OP_IN_CRC_OUT_CRC; 1820 *rxop = BG_OP_IN_CSUM_OUT_CRC;
1726 *rxop = BG_OP_IN_CRC_OUT_CRC; 1821 *txop = BG_OP_IN_CRC_OUT_CSUM;
1727 break; 1822 break;
1728 1823
1729 case SCSI_PROT_NORMAL: 1824 case SCSI_PROT_NORMAL:
@@ -1735,20 +1830,20 @@ lpfc_bg_err_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1735 switch (scsi_get_prot_op(sc)) { 1830 switch (scsi_get_prot_op(sc)) {
1736 case SCSI_PROT_READ_STRIP: 1831 case SCSI_PROT_READ_STRIP:
1737 case SCSI_PROT_WRITE_INSERT: 1832 case SCSI_PROT_WRITE_INSERT:
1738 *txop = BG_OP_IN_NODIF_OUT_CSUM;
1739 *rxop = BG_OP_IN_CSUM_OUT_NODIF; 1833 *rxop = BG_OP_IN_CSUM_OUT_NODIF;
1834 *txop = BG_OP_IN_NODIF_OUT_CSUM;
1740 break; 1835 break;
1741 1836
1742 case SCSI_PROT_READ_PASS: 1837 case SCSI_PROT_READ_PASS:
1743 case SCSI_PROT_WRITE_PASS: 1838 case SCSI_PROT_WRITE_PASS:
1744 *txop = BG_OP_IN_CSUM_OUT_CRC; 1839 *rxop = BG_OP_IN_CSUM_OUT_CSUM;
1745 *rxop = BG_OP_IN_CRC_OUT_CSUM; 1840 *txop = BG_OP_IN_CSUM_OUT_CSUM;
1746 break; 1841 break;
1747 1842
1748 case SCSI_PROT_READ_INSERT: 1843 case SCSI_PROT_READ_INSERT:
1749 case SCSI_PROT_WRITE_STRIP: 1844 case SCSI_PROT_WRITE_STRIP:
1750 *txop = BG_OP_IN_CSUM_OUT_NODIF;
1751 *rxop = BG_OP_IN_NODIF_OUT_CSUM; 1845 *rxop = BG_OP_IN_NODIF_OUT_CSUM;
1846 *txop = BG_OP_IN_CSUM_OUT_NODIF;
1752 break; 1847 break;
1753 1848
1754 case SCSI_PROT_NORMAL: 1849 case SCSI_PROT_NORMAL:
@@ -1817,11 +1912,11 @@ lpfc_bg_setup_bpl(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1817 reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */ 1912 reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
1818 1913
1819#ifdef CONFIG_SCSI_LPFC_DEBUG_FS 1914#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
1820 rc = lpfc_bg_err_inject(phba, sc, &reftag, 0, 1); 1915 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1);
1821 if (rc) { 1916 if (rc) {
1822 if (rc == BG_ERR_SWAP) 1917 if (rc & BG_ERR_SWAP)
1823 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); 1918 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop);
1824 if (rc == BG_ERR_CHECK) 1919 if (rc & BG_ERR_CHECK)
1825 checking = 0; 1920 checking = 0;
1826 } 1921 }
1827#endif 1922#endif
@@ -1964,11 +2059,11 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1964 reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */ 2059 reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
1965 2060
1966#ifdef CONFIG_SCSI_LPFC_DEBUG_FS 2061#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
1967 rc = lpfc_bg_err_inject(phba, sc, &reftag, 0, 1); 2062 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1);
1968 if (rc) { 2063 if (rc) {
1969 if (rc == BG_ERR_SWAP) 2064 if (rc & BG_ERR_SWAP)
1970 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); 2065 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop);
1971 if (rc == BG_ERR_CHECK) 2066 if (rc & BG_ERR_CHECK)
1972 checking = 0; 2067 checking = 0;
1973 } 2068 }
1974#endif 2069#endif
@@ -2172,11 +2267,11 @@ lpfc_bg_setup_sgl(struct lpfc_hba *phba, struct scsi_cmnd *sc,
2172 reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */ 2267 reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
2173 2268
2174#ifdef CONFIG_SCSI_LPFC_DEBUG_FS 2269#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
2175 rc = lpfc_bg_err_inject(phba, sc, &reftag, 0, 1); 2270 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1);
2176 if (rc) { 2271 if (rc) {
2177 if (rc == BG_ERR_SWAP) 2272 if (rc & BG_ERR_SWAP)
2178 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); 2273 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop);
2179 if (rc == BG_ERR_CHECK) 2274 if (rc & BG_ERR_CHECK)
2180 checking = 0; 2275 checking = 0;
2181 } 2276 }
2182#endif 2277#endif
@@ -2312,11 +2407,11 @@ lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
2312 reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */ 2407 reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
2313 2408
2314#ifdef CONFIG_SCSI_LPFC_DEBUG_FS 2409#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
2315 rc = lpfc_bg_err_inject(phba, sc, &reftag, 0, 1); 2410 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1);
2316 if (rc) { 2411 if (rc) {
2317 if (rc == BG_ERR_SWAP) 2412 if (rc & BG_ERR_SWAP)
2318 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); 2413 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop);
2319 if (rc == BG_ERR_CHECK) 2414 if (rc & BG_ERR_CHECK)
2320 checking = 0; 2415 checking = 0;
2321 } 2416 }
2322#endif 2417#endif
@@ -2788,7 +2883,7 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd,
2788 /* No error was reported - problem in FW? */ 2883 /* No error was reported - problem in FW? */
2789 cmd->result = ScsiResult(DID_ERROR, 0); 2884 cmd->result = ScsiResult(DID_ERROR, 0);
2790 lpfc_printf_log(phba, KERN_ERR, LOG_BG, 2885 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
2791 "9057 BLKGRD: no errors reported!\n"); 2886 "9057 BLKGRD: Unknown error reported!\n");
2792 } 2887 }
2793 2888
2794out: 2889out:
@@ -3460,6 +3555,37 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
3460 /* pick up SLI4 exhange busy status from HBA */ 3555 /* pick up SLI4 exhange busy status from HBA */
3461 lpfc_cmd->exch_busy = pIocbOut->iocb_flag & LPFC_EXCHANGE_BUSY; 3556 lpfc_cmd->exch_busy = pIocbOut->iocb_flag & LPFC_EXCHANGE_BUSY;
3462 3557
3558#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
3559 if (lpfc_cmd->prot_data_type) {
3560 struct scsi_dif_tuple *src = NULL;
3561
3562 src = (struct scsi_dif_tuple *)lpfc_cmd->prot_data_segment;
3563 /*
3564 * Used to restore any changes to protection
3565 * data for error injection.
3566 */
3567 switch (lpfc_cmd->prot_data_type) {
3568 case LPFC_INJERR_REFTAG:
3569 src->ref_tag =
3570 lpfc_cmd->prot_data;
3571 break;
3572 case LPFC_INJERR_APPTAG:
3573 src->app_tag =
3574 (uint16_t)lpfc_cmd->prot_data;
3575 break;
3576 case LPFC_INJERR_GUARD:
3577 src->guard_tag =
3578 (uint16_t)lpfc_cmd->prot_data;
3579 break;
3580 default:
3581 break;
3582 }
3583
3584 lpfc_cmd->prot_data = 0;
3585 lpfc_cmd->prot_data_type = 0;
3586 lpfc_cmd->prot_data_segment = NULL;
3587 }
3588#endif
3463 if (pnode && NLP_CHK_NODE_ACT(pnode)) 3589 if (pnode && NLP_CHK_NODE_ACT(pnode))
3464 atomic_dec(&pnode->cmd_pending); 3590 atomic_dec(&pnode->cmd_pending);
3465 3591
@@ -4061,15 +4187,6 @@ lpfc_queuecommand_lck(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *))
4061 cmnd->result = err; 4187 cmnd->result = err;
4062 goto out_fail_command; 4188 goto out_fail_command;
4063 } 4189 }
4064 /*
4065 * Do not let the mid-layer retry I/O too fast. If an I/O is retried
4066 * without waiting a bit then indicate that the device is busy.
4067 */
4068 if (cmnd->retries &&
4069 time_before(jiffies, (cmnd->jiffies_at_alloc +
4070 msecs_to_jiffies(LPFC_RETRY_PAUSE *
4071 cmnd->retries))))
4072 return SCSI_MLQUEUE_DEVICE_BUSY;
4073 ndlp = rdata->pnode; 4190 ndlp = rdata->pnode;
4074 4191
4075 if ((scsi_get_prot_op(cmnd) != SCSI_PROT_NORMAL) && 4192 if ((scsi_get_prot_op(cmnd) != SCSI_PROT_NORMAL) &&
@@ -4119,63 +4236,48 @@ lpfc_queuecommand_lck(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *))
4119 if (scsi_get_prot_op(cmnd) != SCSI_PROT_NORMAL) { 4236 if (scsi_get_prot_op(cmnd) != SCSI_PROT_NORMAL) {
4120 if (vport->phba->cfg_enable_bg) { 4237 if (vport->phba->cfg_enable_bg) {
4121 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, 4238 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG,
4122 "9033 BLKGRD: rcvd protected cmd:%02x op:%02x " 4239 "9033 BLKGRD: rcvd protected cmd:%02x op=%s "
4123 "str=%s\n", 4240 "guard=%s\n", cmnd->cmnd[0],
4124 cmnd->cmnd[0], scsi_get_prot_op(cmnd), 4241 dif_op_str[scsi_get_prot_op(cmnd)],
4125 dif_op_str[scsi_get_prot_op(cmnd)]); 4242 dif_grd_str[scsi_host_get_guard(shost)]);
4126 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG,
4127 "9034 BLKGRD: CDB: %02x %02x %02x %02x %02x "
4128 "%02x %02x %02x %02x %02x\n",
4129 cmnd->cmnd[0], cmnd->cmnd[1], cmnd->cmnd[2],
4130 cmnd->cmnd[3], cmnd->cmnd[4], cmnd->cmnd[5],
4131 cmnd->cmnd[6], cmnd->cmnd[7], cmnd->cmnd[8],
4132 cmnd->cmnd[9]);
4133 if (cmnd->cmnd[0] == READ_10) 4243 if (cmnd->cmnd[0] == READ_10)
4134 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, 4244 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG,
4135 "9035 BLKGRD: READ @ sector %llu, " 4245 "9035 BLKGRD: READ @ sector %llu, "
4136 "count %u\n", 4246 "cnt %u, rpt %d\n",
4137 (unsigned long long)scsi_get_lba(cmnd), 4247 (unsigned long long)scsi_get_lba(cmnd),
4138 blk_rq_sectors(cmnd->request)); 4248 blk_rq_sectors(cmnd->request),
4249 (cmnd->cmnd[1]>>5));
4139 else if (cmnd->cmnd[0] == WRITE_10) 4250 else if (cmnd->cmnd[0] == WRITE_10)
4140 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, 4251 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG,
4141 "9036 BLKGRD: WRITE @ sector %llu, " 4252 "9036 BLKGRD: WRITE @ sector %llu, "
4142 "count %u cmd=%p\n", 4253 "cnt %u, wpt %d\n",
4143 (unsigned long long)scsi_get_lba(cmnd), 4254 (unsigned long long)scsi_get_lba(cmnd),
4144 blk_rq_sectors(cmnd->request), 4255 blk_rq_sectors(cmnd->request),
4145 cmnd); 4256 (cmnd->cmnd[1]>>5));
4146 } 4257 }
4147 4258
4148 err = lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd); 4259 err = lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd);
4149 } else { 4260 } else {
4150 if (vport->phba->cfg_enable_bg) { 4261 if (vport->phba->cfg_enable_bg) {
4151 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, 4262 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG,
4152 "9038 BLKGRD: rcvd unprotected cmd:" 4263 "9038 BLKGRD: rcvd unprotected cmd:"
4153 "%02x op:%02x str=%s\n", 4264 "%02x op=%s guard=%s\n", cmnd->cmnd[0],
4154 cmnd->cmnd[0], scsi_get_prot_op(cmnd), 4265 dif_op_str[scsi_get_prot_op(cmnd)],
4155 dif_op_str[scsi_get_prot_op(cmnd)]); 4266 dif_grd_str[scsi_host_get_guard(shost)]);
4156 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG,
4157 "9039 BLKGRD: CDB: %02x %02x %02x "
4158 "%02x %02x %02x %02x %02x %02x %02x\n",
4159 cmnd->cmnd[0], cmnd->cmnd[1],
4160 cmnd->cmnd[2], cmnd->cmnd[3],
4161 cmnd->cmnd[4], cmnd->cmnd[5],
4162 cmnd->cmnd[6], cmnd->cmnd[7],
4163 cmnd->cmnd[8], cmnd->cmnd[9]);
4164 if (cmnd->cmnd[0] == READ_10) 4267 if (cmnd->cmnd[0] == READ_10)
4165 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, 4268 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG,
4166 "9040 dbg: READ @ sector %llu, " 4269 "9040 dbg: READ @ sector %llu, "
4167 "count %u\n", 4270 "cnt %u, rpt %d\n",
4168 (unsigned long long)scsi_get_lba(cmnd), 4271 (unsigned long long)scsi_get_lba(cmnd),
4169 blk_rq_sectors(cmnd->request)); 4272 blk_rq_sectors(cmnd->request),
4273 (cmnd->cmnd[1]>>5));
4170 else if (cmnd->cmnd[0] == WRITE_10) 4274 else if (cmnd->cmnd[0] == WRITE_10)
4171 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, 4275 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG,
4172 "9041 dbg: WRITE @ sector %llu, " 4276 "9041 dbg: WRITE @ sector %llu, "
4173 "count %u cmd=%p\n", 4277 "cnt %u, wpt %d\n",
4174 (unsigned long long)scsi_get_lba(cmnd), 4278 (unsigned long long)scsi_get_lba(cmnd),
4175 blk_rq_sectors(cmnd->request), cmnd); 4279 blk_rq_sectors(cmnd->request),
4176 else 4280 (cmnd->cmnd[1]>>5));
4177 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG,
4178 "9042 dbg: parser not implemented\n");
4179 } 4281 }
4180 err = lpfc_scsi_prep_dma_buf(phba, lpfc_cmd); 4282 err = lpfc_scsi_prep_dma_buf(phba, lpfc_cmd);
4181 } 4283 }