[SCSI] bxn2i: Added support for other TMFs besides ABORT_TASK

Expanded the TMF request routine to support other TMFs such as LUN
RESET, etc.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Anil Veerabhadrappa <anilgv@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
This commit is contained in:
Eddie Wai 2010-08-13 09:33:27 -07:00 committed by James Bottomley
parent 39304072ac
commit c47b401230

View file

@ -385,7 +385,6 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn,
struct bnx2i_cmd *bnx2i_cmd; struct bnx2i_cmd *bnx2i_cmd;
struct bnx2i_tmf_request *tmfabort_wqe; struct bnx2i_tmf_request *tmfabort_wqe;
u32 dword; u32 dword;
u32 scsi_lun[2];
bnx2i_cmd = (struct bnx2i_cmd *)mtask->dd_data; bnx2i_cmd = (struct bnx2i_cmd *)mtask->dd_data;
tmfabort_hdr = (struct iscsi_tm *)mtask->hdr; tmfabort_hdr = (struct iscsi_tm *)mtask->hdr;
@ -393,38 +392,41 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn,
bnx2i_conn->ep->qp.sq_prod_qe; bnx2i_conn->ep->qp.sq_prod_qe;
tmfabort_wqe->op_code = tmfabort_hdr->opcode; tmfabort_wqe->op_code = tmfabort_hdr->opcode;
tmfabort_wqe->op_attr = 0; tmfabort_wqe->op_attr = tmfabort_hdr->flags;
tmfabort_wqe->op_attr =
ISCSI_TMF_REQUEST_ALWAYS_ONE | ISCSI_TM_FUNC_ABORT_TASK;
tmfabort_wqe->itt = (mtask->itt | (ISCSI_TASK_TYPE_MPATH << 14)); tmfabort_wqe->itt = (mtask->itt | (ISCSI_TASK_TYPE_MPATH << 14));
tmfabort_wqe->reserved2 = 0; tmfabort_wqe->reserved2 = 0;
tmfabort_wqe->cmd_sn = be32_to_cpu(tmfabort_hdr->cmdsn); tmfabort_wqe->cmd_sn = be32_to_cpu(tmfabort_hdr->cmdsn);
ctask = iscsi_itt_to_task(conn, tmfabort_hdr->rtt); switch (tmfabort_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) {
if (!ctask || !ctask->sc) case ISCSI_TM_FUNC_ABORT_TASK:
/* case ISCSI_TM_FUNC_TASK_REASSIGN:
* the iscsi layer must have completed the cmd while this ctask = iscsi_itt_to_task(conn, tmfabort_hdr->rtt);
* was starting up. if (!ctask || !ctask->sc)
* /*
* Note: In the case of a SCSI cmd timeout, the task's sc * the iscsi layer must have completed the cmd while
* is still active; hence ctask->sc != 0 * was starting up.
* In this case, the task must be aborted *
*/ * Note: In the case of a SCSI cmd timeout, the task's
return 0; * sc is still active; hence ctask->sc != 0
* In this case, the task must be aborted
*/
return 0;
ref_sc = ctask->sc; ref_sc = ctask->sc;
if (ref_sc->sc_data_direction == DMA_TO_DEVICE)
/* Retrieve LUN directly from the ref_sc */ dword = (ISCSI_TASK_TYPE_WRITE <<
int_to_scsilun(ref_sc->device->lun, (struct scsi_lun *) scsi_lun); ISCSI_CMD_REQUEST_TYPE_SHIFT);
tmfabort_wqe->lun[0] = be32_to_cpu(scsi_lun[0]); else
tmfabort_wqe->lun[1] = be32_to_cpu(scsi_lun[1]); dword = (ISCSI_TASK_TYPE_READ <<
ISCSI_CMD_REQUEST_TYPE_SHIFT);
if (ref_sc->sc_data_direction == DMA_TO_DEVICE) tmfabort_wqe->ref_itt = (dword |
dword = (ISCSI_TASK_TYPE_WRITE << ISCSI_CMD_REQUEST_TYPE_SHIFT); (tmfabort_hdr->rtt & ISCSI_ITT_MASK));
else break;
dword = (ISCSI_TASK_TYPE_READ << ISCSI_CMD_REQUEST_TYPE_SHIFT); default:
tmfabort_wqe->ref_itt = (dword | (tmfabort_hdr->rtt & ISCSI_ITT_MASK)); tmfabort_wqe->ref_itt = RESERVED_ITT;
}
memcpy(tmfabort_wqe->lun, tmfabort_hdr->lun, sizeof(struct scsi_lun));
tmfabort_wqe->ref_cmd_sn = be32_to_cpu(tmfabort_hdr->refcmdsn); tmfabort_wqe->ref_cmd_sn = be32_to_cpu(tmfabort_hdr->refcmdsn);
tmfabort_wqe->bd_list_addr_lo = (u32) bnx2i_conn->hba->mp_bd_dma; tmfabort_wqe->bd_list_addr_lo = (u32) bnx2i_conn->hba->mp_bd_dma;