diff options
Diffstat (limited to 'drivers/scsi/be2iscsi/be_cmds.c')
-rw-r--r-- | drivers/scsi/be2iscsi/be_cmds.c | 96 |
1 files changed, 49 insertions, 47 deletions
diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c index 771670c0682b..6f3cd82c4295 100644 --- a/drivers/scsi/be2iscsi/be_cmds.c +++ b/drivers/scsi/be2iscsi/be_cmds.c | |||
@@ -478,53 +478,6 @@ int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl, | |||
478 | return 0; | 478 | return 0; |
479 | } | 479 | } |
480 | 480 | ||
481 | /* | ||
482 | * be_mcc_compl_poll()- Wait for MBX completion | ||
483 | * @phba: driver private structure | ||
484 | * | ||
485 | * Wait till no more pending mcc requests are present | ||
486 | * | ||
487 | * return | ||
488 | * Success: 0 | ||
489 | * Failure: Non-Zero | ||
490 | * | ||
491 | **/ | ||
492 | int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag) | ||
493 | { | ||
494 | struct be_ctrl_info *ctrl = &phba->ctrl; | ||
495 | int i; | ||
496 | |||
497 | if (!test_bit(MCC_TAG_STATE_RUNNING, | ||
498 | &ctrl->ptag_state[tag].tag_state)) { | ||
499 | beiscsi_log(phba, KERN_ERR, | ||
500 | BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX, | ||
501 | "BC_%d: tag %u state not running\n", tag); | ||
502 | return 0; | ||
503 | } | ||
504 | for (i = 0; i < mcc_timeout; i++) { | ||
505 | if (beiscsi_hba_in_error(phba)) | ||
506 | return -EIO; | ||
507 | |||
508 | beiscsi_process_mcc_cq(phba); | ||
509 | /* after polling, wrb and tag need to be released */ | ||
510 | if (!test_bit(MCC_TAG_STATE_RUNNING, | ||
511 | &ctrl->ptag_state[tag].tag_state)) { | ||
512 | free_mcc_wrb(ctrl, tag); | ||
513 | break; | ||
514 | } | ||
515 | udelay(100); | ||
516 | } | ||
517 | |||
518 | if (i < mcc_timeout) | ||
519 | return 0; | ||
520 | |||
521 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX, | ||
522 | "BC_%d : FW Timed Out\n"); | ||
523 | set_bit(BEISCSI_HBA_FW_TIMEOUT, &phba->state); | ||
524 | beiscsi_ue_detect(phba); | ||
525 | return -EBUSY; | ||
526 | } | ||
527 | |||
528 | void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag) | 481 | void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag) |
529 | { | 482 | { |
530 | struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q; | 483 | struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q; |
@@ -1645,3 +1598,52 @@ int beiscsi_init_sliport(struct beiscsi_hba *phba) | |||
1645 | /* indicate driver is loading */ | 1598 | /* indicate driver is loading */ |
1646 | return beiscsi_cmd_special_wrb(&phba->ctrl, 1); | 1599 | return beiscsi_cmd_special_wrb(&phba->ctrl, 1); |
1647 | } | 1600 | } |
1601 | |||
1602 | /** | ||
1603 | * beiscsi_cmd_iscsi_cleanup()- Inform FW to cleanup EP data structures. | ||
1604 | * @phba: pointer to dev priv structure | ||
1605 | * @ulp: ULP number. | ||
1606 | * | ||
1607 | * return | ||
1608 | * Success: 0 | ||
1609 | * Failure: Non-Zero Value | ||
1610 | **/ | ||
1611 | int beiscsi_cmd_iscsi_cleanup(struct beiscsi_hba *phba, unsigned short ulp) | ||
1612 | { | ||
1613 | struct be_ctrl_info *ctrl = &phba->ctrl; | ||
1614 | struct iscsi_cleanup_req_v1 *req_v1; | ||
1615 | struct iscsi_cleanup_req *req; | ||
1616 | struct be_mcc_wrb *wrb; | ||
1617 | int status; | ||
1618 | |||
1619 | mutex_lock(&ctrl->mbox_lock); | ||
1620 | wrb = wrb_from_mbox(&ctrl->mbox_mem); | ||
1621 | req = embedded_payload(wrb); | ||
1622 | be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0); | ||
1623 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI, | ||
1624 | OPCODE_COMMON_ISCSI_CLEANUP, sizeof(*req)); | ||
1625 | |||
1626 | /** | ||
1627 | * TODO: Check with FW folks the chute value to be set. | ||
1628 | * For now, use the ULP_MASK as the chute value. | ||
1629 | */ | ||
1630 | if (is_chip_be2_be3r(phba)) { | ||
1631 | req->chute = (1 << ulp); | ||
1632 | req->hdr_ring_id = HWI_GET_DEF_HDRQ_ID(phba, ulp); | ||
1633 | req->data_ring_id = HWI_GET_DEF_BUFQ_ID(phba, ulp); | ||
1634 | } else { | ||
1635 | req_v1 = (struct iscsi_cleanup_req_v1 *)req; | ||
1636 | req_v1->hdr.version = 1; | ||
1637 | req_v1->hdr_ring_id = cpu_to_le16(HWI_GET_DEF_HDRQ_ID(phba, | ||
1638 | ulp)); | ||
1639 | req_v1->data_ring_id = cpu_to_le16(HWI_GET_DEF_BUFQ_ID(phba, | ||
1640 | ulp)); | ||
1641 | } | ||
1642 | |||
1643 | status = be_mbox_notify(ctrl); | ||
1644 | if (status) | ||
1645 | beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_INIT, | ||
1646 | "BG_%d : %s failed %d\n", __func__, ulp); | ||
1647 | mutex_unlock(&ctrl->mbox_lock); | ||
1648 | return status; | ||
1649 | } | ||