aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorAndrew Vasquez <andrew.vasquez@qlogic.com>2010-05-04 18:01:27 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-05-16 18:21:54 -0400
commitb7d2280c153b33fc60f1a89406d2329137a8b61c (patch)
tree1b579072959644f7dd520f0dd6bbbec2c981266a /drivers/scsi
parent5ff1d58410ffb160b388d622ef0c6a0411a05559 (diff)
[SCSI] qla2xxx: Cleanup FCP-command-status processing debug statements.
Migrate to a consistent set of debug entries during status-IOCB handling: * group CS_TIMEOUT handling with CS_PORT_UNAVAILABLE and the like (more regrouping of common behaviour). * drop CS_DATA_OVERRUN handling as it now falls into the 'default' case (still returns DID_ERROR). * consolidate CS_RESET and CS_ABORTED handling, as we the only functional difference was a printk() (still returns DID_RESET). * dropped all the earlier inconsistent [qla_]printk()s sprinkled throught the needlessly large case-statement. Failure case I/Os are now logged with a 'standard' format: <command failure details> <command generic details> so, for example a dropped-frame is logged as: qla2xxx 0000:13:00.0: scsi(16:0:0) Dropped frame(s) detected (4000 of 4000 bytes). qla2xxx 0000:13:00.0: scsi(16:0:0) FCP command status: 0x15-0x18 (70018) \ oxid=78 ser=76 cdb=280000 len=4000 rsp_info=0 resid=0 fw_resid=4000 which should now convey all relevant information. Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c192
1 files changed, 63 insertions, 129 deletions
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index a1968eb5e9ce..b92f9a6ee4fb 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -1283,6 +1283,7 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
1283 struct sts_entry_24xx *sts24; 1283 struct sts_entry_24xx *sts24;
1284 uint16_t comp_status; 1284 uint16_t comp_status;
1285 uint16_t scsi_status; 1285 uint16_t scsi_status;
1286 uint16_t ox_id;
1286 uint8_t lscsi_status; 1287 uint8_t lscsi_status;
1287 int32_t resid; 1288 int32_t resid;
1288 uint32_t sense_len, rsp_info_len, resid_len, fw_resid_len; 1289 uint32_t sense_len, rsp_info_len, resid_len, fw_resid_len;
@@ -1291,6 +1292,7 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
1291 uint32_t handle; 1292 uint32_t handle;
1292 uint16_t que; 1293 uint16_t que;
1293 struct req_que *req; 1294 struct req_que *req;
1295 int logit = 1;
1294 1296
1295 sts = (sts_entry_t *) pkt; 1297 sts = (sts_entry_t *) pkt;
1296 sts24 = (struct sts_entry_24xx *) pkt; 1298 sts24 = (struct sts_entry_24xx *) pkt;
@@ -1320,9 +1322,9 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
1320 sp = NULL; 1322 sp = NULL;
1321 1323
1322 if (sp == NULL) { 1324 if (sp == NULL) {
1323 DEBUG2(printk("scsi(%ld): Status Entry invalid handle.\n", 1325 qla_printk(KERN_WARNING, ha,
1324 vha->host_no)); 1326 "scsi(%ld): Invalid status handle (0x%x).\n", vha->host_no,
1325 qla_printk(KERN_WARNING, ha, "Status Entry invalid handle.\n"); 1327 sts->handle);
1326 1328
1327 set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); 1329 set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
1328 qla2xxx_wake_dpc(vha); 1330 qla2xxx_wake_dpc(vha);
@@ -1330,10 +1332,9 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
1330 } 1332 }
1331 cp = sp->cmd; 1333 cp = sp->cmd;
1332 if (cp == NULL) { 1334 if (cp == NULL) {
1333 DEBUG2(printk("scsi(%ld): Command already returned back to OS "
1334 "pkt->handle=%d sp=%p.\n", vha->host_no, handle, sp));
1335 qla_printk(KERN_WARNING, ha, 1335 qla_printk(KERN_WARNING, ha,
1336 "Command is NULL: already returned to OS (sp=%p)\n", sp); 1336 "scsi(%ld): Command already returned (0x%x/%p).\n",
1337 vha->host_no, sts->handle, sp);
1337 1338
1338 return; 1339 return;
1339 } 1340 }
@@ -1342,6 +1343,7 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
1342 1343
1343 fcport = sp->fcport; 1344 fcport = sp->fcport;
1344 1345
1346 ox_id = 0;
1345 sense_len = rsp_info_len = resid_len = fw_resid_len = 0; 1347 sense_len = rsp_info_len = resid_len = fw_resid_len = 0;
1346 if (IS_FWI2_CAPABLE(ha)) { 1348 if (IS_FWI2_CAPABLE(ha)) {
1347 if (scsi_status & SS_SENSE_LEN_VALID) 1349 if (scsi_status & SS_SENSE_LEN_VALID)
@@ -1355,6 +1357,7 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
1355 rsp_info = sts24->data; 1357 rsp_info = sts24->data;
1356 sense_data = sts24->data; 1358 sense_data = sts24->data;
1357 host_to_fcp_swap(sts24->data, sizeof(sts24->data)); 1359 host_to_fcp_swap(sts24->data, sizeof(sts24->data));
1360 ox_id = le16_to_cpu(sts24->ox_id);
1358 } else { 1361 } else {
1359 if (scsi_status & SS_SENSE_LEN_VALID) 1362 if (scsi_status & SS_SENSE_LEN_VALID)
1360 sense_len = le16_to_cpu(sts->req_sense_length); 1363 sense_len = le16_to_cpu(sts->req_sense_length);
@@ -1371,17 +1374,13 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
1371 if (IS_FWI2_CAPABLE(ha)) 1374 if (IS_FWI2_CAPABLE(ha))
1372 sense_data += rsp_info_len; 1375 sense_data += rsp_info_len;
1373 if (rsp_info_len > 3 && rsp_info[3]) { 1376 if (rsp_info_len > 3 && rsp_info[3]) {
1374 DEBUG2(printk("scsi(%ld:%d:%d:%d) FCP I/O protocol " 1377 DEBUG2(qla_printk(KERN_INFO, ha,
1375 "failure (%x/%02x%02x%02x%02x%02x%02x%02x%02x)..." 1378 "scsi(%ld:%d:%d): FCP I/O protocol failure "
1376 "retrying command\n", vha->host_no, 1379 "(0x%x/0x%x).\n", vha->host_no, cp->device->id,
1377 cp->device->channel, cp->device->id, 1380 cp->device->lun, rsp_info_len, rsp_info[3]));
1378 cp->device->lun, rsp_info_len, rsp_info[0],
1379 rsp_info[1], rsp_info[2], rsp_info[3], rsp_info[4],
1380 rsp_info[5], rsp_info[6], rsp_info[7]));
1381 1381
1382 cp->result = DID_BUS_BUSY << 16; 1382 cp->result = DID_BUS_BUSY << 16;
1383 qla2x00_sp_compl(ha, sp); 1383 goto out;
1384 return;
1385 } 1384 }
1386 } 1385 }
1387 1386
@@ -1408,12 +1407,10 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
1408 ((unsigned)(scsi_bufflen(cp) - resid) < 1407 ((unsigned)(scsi_bufflen(cp) - resid) <
1409 cp->underflow)) { 1408 cp->underflow)) {
1410 qla_printk(KERN_INFO, ha, 1409 qla_printk(KERN_INFO, ha,
1411 "scsi(%ld:%d:%d:%d): Mid-layer underflow " 1410 "scsi(%ld:%d:%d): Mid-layer underflow "
1412 "detected (%x of %x bytes)...returning " 1411 "detected (0x%x of 0x%x bytes).\n",
1413 "error status.\n", vha->host_no, 1412 vha->host_no, cp->device->id,
1414 cp->device->channel, cp->device->id, 1413 cp->device->lun, resid, scsi_bufflen(cp));
1415 cp->device->lun, resid,
1416 scsi_bufflen(cp));
1417 1414
1418 cp->result = DID_ERROR << 16; 1415 cp->result = DID_ERROR << 16;
1419 break; 1416 break;
@@ -1422,12 +1419,12 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
1422 cp->result = DID_OK << 16 | lscsi_status; 1419 cp->result = DID_OK << 16 | lscsi_status;
1423 1420
1424 if (lscsi_status == SAM_STAT_TASK_SET_FULL) { 1421 if (lscsi_status == SAM_STAT_TASK_SET_FULL) {
1425 DEBUG2(printk(KERN_INFO 1422 DEBUG2(qla_printk(KERN_INFO, ha,
1426 "scsi(%ld): QUEUE FULL status detected " 1423 "scsi(%ld:%d:%d) QUEUE FULL detected.\n",
1427 "0x%x-0x%x.\n", vha->host_no, comp_status, 1424 vha->host_no, cp->device->id, cp->device->lun));
1428 scsi_status));
1429 break; 1425 break;
1430 } 1426 }
1427 logit = 0;
1431 if (lscsi_status != SS_CHECK_CONDITION) 1428 if (lscsi_status != SS_CHECK_CONDITION)
1432 break; 1429 break;
1433 1430
@@ -1439,23 +1436,14 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
1439 break; 1436 break;
1440 1437
1441 case CS_DATA_UNDERRUN: 1438 case CS_DATA_UNDERRUN:
1442 DEBUG2(printk(KERN_INFO
1443 "scsi(%ld:%d:%d) UNDERRUN status detected 0x%x-0x%x. "
1444 "resid=0x%x fw_resid=0x%x cdb=0x%x os_underflow=0x%x\n",
1445 vha->host_no, cp->device->id, cp->device->lun, comp_status,
1446 scsi_status, resid_len, fw_resid_len, cp->cmnd[0],
1447 cp->underflow));
1448
1449 /* Use F/W calculated residual length. */ 1439 /* Use F/W calculated residual length. */
1450 resid = IS_FWI2_CAPABLE(ha) ? fw_resid_len : resid_len; 1440 resid = IS_FWI2_CAPABLE(ha) ? fw_resid_len : resid_len;
1451 scsi_set_resid(cp, resid); 1441 scsi_set_resid(cp, resid);
1452 if (scsi_status & SS_RESIDUAL_UNDER) { 1442 if (scsi_status & SS_RESIDUAL_UNDER) {
1453 if (IS_FWI2_CAPABLE(ha) && fw_resid_len != resid_len) { 1443 if (IS_FWI2_CAPABLE(ha) && fw_resid_len != resid_len) {
1454 DEBUG2(printk( 1444 DEBUG2(qla_printk(KERN_INFO, ha,
1455 "scsi(%ld:%d:%d:%d) Dropped frame(s) " 1445 "scsi(%ld:%d:%d) Dropped frame(s) detected "
1456 "detected (%x of %x bytes)...residual " 1446 "(0x%x of 0x%x bytes).\n", vha->host_no,
1457 "length mismatch...retrying command.\n",
1458 vha->host_no, cp->device->channel,
1459 cp->device->id, cp->device->lun, resid, 1447 cp->device->id, cp->device->lun, resid,
1460 scsi_bufflen(cp))); 1448 scsi_bufflen(cp)));
1461 1449
@@ -1467,21 +1455,18 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
1467 ((unsigned)(scsi_bufflen(cp) - resid) < 1455 ((unsigned)(scsi_bufflen(cp) - resid) <
1468 cp->underflow)) { 1456 cp->underflow)) {
1469 qla_printk(KERN_INFO, ha, 1457 qla_printk(KERN_INFO, ha,
1470 "scsi(%ld:%d:%d:%d): Mid-layer underflow " 1458 "scsi(%ld:%d:%d): Mid-layer underflow "
1471 "detected (%x of %x bytes)...returning " 1459 "detected (0x%x of 0x%x bytes).\n",
1472 "error status.\n", vha->host_no, 1460 vha->host_no, cp->device->id,
1473 cp->device->channel, cp->device->id,
1474 cp->device->lun, resid, scsi_bufflen(cp)); 1461 cp->device->lun, resid, scsi_bufflen(cp));
1475 1462
1476 cp->result = DID_ERROR << 16; 1463 cp->result = DID_ERROR << 16;
1477 break; 1464 break;
1478 } 1465 }
1479 } else if (!lscsi_status) { 1466 } else if (!lscsi_status) {
1480 DEBUG2(printk( 1467 DEBUG2(qla_printk(KERN_INFO, ha,
1481 "scsi(%ld:%d:%d:%d) Dropped frame(s) detected " 1468 "scsi(%ld:%d:%d) Dropped frame(s) detected (0x%x "
1482 "(%x of %x bytes)...firmware reported underrun..." 1469 "of 0x%x bytes).\n", vha->host_no, cp->device->id,
1483 "retrying command.\n", vha->host_no,
1484 cp->device->channel, cp->device->id,
1485 cp->device->lun, resid, scsi_bufflen(cp))); 1470 cp->device->lun, resid, scsi_bufflen(cp)));
1486 1471
1487 cp->result = DID_ERROR << 16; 1472 cp->result = DID_ERROR << 16;
@@ -1489,6 +1474,7 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
1489 } 1474 }
1490 1475
1491 cp->result = DID_OK << 16 | lscsi_status; 1476 cp->result = DID_OK << 16 | lscsi_status;
1477 logit = 0;
1492 1478
1493 /* 1479 /*
1494 * Check to see if SCSI Status is non zero. If so report SCSI 1480 * Check to see if SCSI Status is non zero. If so report SCSI
@@ -1496,10 +1482,11 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
1496 */ 1482 */
1497 if (lscsi_status != 0) { 1483 if (lscsi_status != 0) {
1498 if (lscsi_status == SAM_STAT_TASK_SET_FULL) { 1484 if (lscsi_status == SAM_STAT_TASK_SET_FULL) {
1499 DEBUG2(printk(KERN_INFO 1485 DEBUG2(qla_printk(KERN_INFO, ha,
1500 "scsi(%ld): QUEUE FULL status detected " 1486 "scsi(%ld:%d:%d) QUEUE FULL detected.\n",
1501 "0x%x-0x%x.\n", vha->host_no, comp_status, 1487 vha->host_no, cp->device->id,
1502 scsi_status)); 1488 cp->device->lun));
1489 logit = 1;
1503 break; 1490 break;
1504 } 1491 }
1505 if (lscsi_status != SS_CHECK_CONDITION) 1492 if (lscsi_status != SS_CHECK_CONDITION)
@@ -1513,109 +1500,56 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
1513 } 1500 }
1514 break; 1501 break;
1515 1502
1516 case CS_DATA_OVERRUN:
1517 DEBUG2(printk(KERN_INFO
1518 "scsi(%ld:%d:%d): OVERRUN status detected 0x%x-0x%x\n",
1519 vha->host_no, cp->device->id, cp->device->lun, comp_status,
1520 scsi_status));
1521 DEBUG2(printk(KERN_INFO
1522 "CDB: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",
1523 cp->cmnd[0], cp->cmnd[1], cp->cmnd[2], cp->cmnd[3],
1524 cp->cmnd[4], cp->cmnd[5]));
1525 DEBUG2(printk(KERN_INFO
1526 "PID=0x%lx req=0x%x xtra=0x%x -- returning DID_ERROR "
1527 "status!\n",
1528 cp->serial_number, scsi_bufflen(cp), resid_len));
1529
1530 cp->result = DID_ERROR << 16;
1531 break;
1532
1533 case CS_PORT_LOGGED_OUT: 1503 case CS_PORT_LOGGED_OUT:
1534 case CS_PORT_CONFIG_CHG: 1504 case CS_PORT_CONFIG_CHG:
1535 case CS_PORT_BUSY: 1505 case CS_PORT_BUSY:
1536 case CS_INCOMPLETE: 1506 case CS_INCOMPLETE:
1537 case CS_PORT_UNAVAILABLE: 1507 case CS_PORT_UNAVAILABLE:
1538 /* 1508 case CS_TIMEOUT:
1539 * If the port is in Target Down state, return all IOs for this
1540 * Target with DID_NO_CONNECT ELSE Queue the IOs in the
1541 * retry_queue.
1542 */
1543 DEBUG2(printk("scsi(%ld:%d:%d): status_entry: Port Down "
1544 "pid=%ld, compl status=0x%x, port state=0x%x\n",
1545 vha->host_no, cp->device->id, cp->device->lun,
1546 cp->serial_number, comp_status,
1547 atomic_read(&fcport->state)));
1548
1549 /* 1509 /*
1550 * We are going to have the fc class block the rport 1510 * We are going to have the fc class block the rport
1551 * while we try to recover so instruct the mid layer 1511 * while we try to recover so instruct the mid layer
1552 * to requeue until the class decides how to handle this. 1512 * to requeue until the class decides how to handle this.
1553 */ 1513 */
1554 cp->result = DID_TRANSPORT_DISRUPTED << 16; 1514 cp->result = DID_TRANSPORT_DISRUPTED << 16;
1515
1516 if (comp_status == CS_TIMEOUT) {
1517 if (IS_FWI2_CAPABLE(ha))
1518 break;
1519 else if ((le16_to_cpu(sts->status_flags) &
1520 SF_LOGOUT_SENT) == 0)
1521 break;
1522 }
1523
1524 DEBUG2(qla_printk(KERN_INFO, ha,
1525 "scsi(%ld:%d:%d) Port down status: port-state=0x%x\n",
1526 vha->host_no, cp->device->id, cp->device->lun,
1527 atomic_read(&fcport->state)));
1528
1555 if (atomic_read(&fcport->state) == FCS_ONLINE) 1529 if (atomic_read(&fcport->state) == FCS_ONLINE)
1556 qla2x00_mark_device_lost(fcport->vha, fcport, 1, 1); 1530 qla2x00_mark_device_lost(fcport->vha, fcport, 1, 1);
1557 break; 1531 break;
1558 1532
1559 case CS_RESET: 1533 case CS_RESET:
1560 DEBUG2(printk(KERN_INFO
1561 "scsi(%ld): RESET status detected 0x%x-0x%x.\n",
1562 vha->host_no, comp_status, scsi_status));
1563
1564 cp->result = DID_RESET << 16;
1565 break;
1566
1567 case CS_ABORTED: 1534 case CS_ABORTED:
1568 /*
1569 * hv2.19.12 - DID_ABORT does not retry the request if we
1570 * aborted this request then abort otherwise it must be a
1571 * reset.
1572 */
1573 DEBUG2(printk(KERN_INFO
1574 "scsi(%ld): ABORT status detected 0x%x-0x%x.\n",
1575 vha->host_no, comp_status, scsi_status));
1576
1577 cp->result = DID_RESET << 16; 1535 cp->result = DID_RESET << 16;
1578 break; 1536 break;
1579
1580 case CS_TIMEOUT:
1581 /*
1582 * We are going to have the fc class block the rport
1583 * while we try to recover so instruct the mid layer
1584 * to requeue until the class decides how to handle this.
1585 */
1586 cp->result = DID_TRANSPORT_DISRUPTED << 16;
1587
1588 if (IS_FWI2_CAPABLE(ha)) {
1589 DEBUG2(printk(KERN_INFO
1590 "scsi(%ld:%d:%d:%d): TIMEOUT status detected "
1591 "0x%x-0x%x\n", vha->host_no, cp->device->channel,
1592 cp->device->id, cp->device->lun, comp_status,
1593 scsi_status));
1594 break;
1595 }
1596 DEBUG2(printk(KERN_INFO
1597 "scsi(%ld:%d:%d:%d): TIMEOUT status detected 0x%x-0x%x "
1598 "sflags=%x.\n", vha->host_no, cp->device->channel,
1599 cp->device->id, cp->device->lun, comp_status, scsi_status,
1600 le16_to_cpu(sts->status_flags)));
1601
1602 /* Check to see if logout occurred. */
1603 if ((le16_to_cpu(sts->status_flags) & SF_LOGOUT_SENT))
1604 qla2x00_mark_device_lost(fcport->vha, fcport, 1, 1);
1605 break;
1606
1607 default: 1537 default:
1608 DEBUG3(printk("scsi(%ld): Error detected (unknown status) "
1609 "0x%x-0x%x.\n", vha->host_no, comp_status, scsi_status));
1610 qla_printk(KERN_INFO, ha,
1611 "Unknown status detected 0x%x-0x%x.\n",
1612 comp_status, scsi_status);
1613
1614 cp->result = DID_ERROR << 16; 1538 cp->result = DID_ERROR << 16;
1615 break; 1539 break;
1616 } 1540 }
1617 1541
1618 /* Place command on done queue. */ 1542out:
1543 if (logit)
1544 DEBUG2(qla_printk(KERN_INFO, ha,
1545 "scsi(%ld:%d:%d) FCP command status: 0x%x-0x%x (0x%x) "
1546 "oxid=0x%x ser=0x%lx cdb=%02x%02x%02x len=0x%x "
1547 "rsp_info=0x%x resid=0x%x fw_resid=0x%x\n", vha->host_no,
1548 cp->device->id, cp->device->lun, comp_status, scsi_status,
1549 cp->result, ox_id, cp->serial_number, cp->cmnd[0],
1550 cp->cmnd[1], cp->cmnd[2], scsi_bufflen(cp), rsp_info_len,
1551 resid_len, fw_resid_len));
1552
1619 if (rsp->status_srb == NULL) 1553 if (rsp->status_srb == NULL)
1620 qla2x00_sp_compl(ha, sp); 1554 qla2x00_sp_compl(ha, sp);
1621} 1555}