aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bnx2i
diff options
context:
space:
mode:
authorEddie Wai <eddie.wai@broadcom.com>2010-08-13 12:33:27 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-09-05 13:43:55 -0400
commitc47b401230895edc94abe2c342811a2171375dbe (patch)
treedb19a7acf83253ff5dec77047bb64235a852141b /drivers/scsi/bnx2i
parent39304072ac401015ee3c0fbfa724574dbedb46b5 (diff)
[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>
Diffstat (limited to 'drivers/scsi/bnx2i')
-rw-r--r--drivers/scsi/bnx2i/bnx2i_hwi.c58
1 files changed, 30 insertions, 28 deletions
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index 015efb579384..90cef716b796 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -385,7 +385,6 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn,
385 struct bnx2i_cmd *bnx2i_cmd; 385 struct bnx2i_cmd *bnx2i_cmd;
386 struct bnx2i_tmf_request *tmfabort_wqe; 386 struct bnx2i_tmf_request *tmfabort_wqe;
387 u32 dword; 387 u32 dword;
388 u32 scsi_lun[2];
389 388
390 bnx2i_cmd = (struct bnx2i_cmd *)mtask->dd_data; 389 bnx2i_cmd = (struct bnx2i_cmd *)mtask->dd_data;
391 tmfabort_hdr = (struct iscsi_tm *)mtask->hdr; 390 tmfabort_hdr = (struct iscsi_tm *)mtask->hdr;
@@ -393,38 +392,41 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn,
393 bnx2i_conn->ep->qp.sq_prod_qe; 392 bnx2i_conn->ep->qp.sq_prod_qe;
394 393
395 tmfabort_wqe->op_code = tmfabort_hdr->opcode; 394 tmfabort_wqe->op_code = tmfabort_hdr->opcode;
396 tmfabort_wqe->op_attr = 0; 395 tmfabort_wqe->op_attr = tmfabort_hdr->flags;
397 tmfabort_wqe->op_attr =
398 ISCSI_TMF_REQUEST_ALWAYS_ONE | ISCSI_TM_FUNC_ABORT_TASK;
399 396
400 tmfabort_wqe->itt = (mtask->itt | (ISCSI_TASK_TYPE_MPATH << 14)); 397 tmfabort_wqe->itt = (mtask->itt | (ISCSI_TASK_TYPE_MPATH << 14));
401 tmfabort_wqe->reserved2 = 0; 398 tmfabort_wqe->reserved2 = 0;
402 tmfabort_wqe->cmd_sn = be32_to_cpu(tmfabort_hdr->cmdsn); 399 tmfabort_wqe->cmd_sn = be32_to_cpu(tmfabort_hdr->cmdsn);
403 400
404 ctask = iscsi_itt_to_task(conn, tmfabort_hdr->rtt); 401 switch (tmfabort_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) {
405 if (!ctask || !ctask->sc) 402 case ISCSI_TM_FUNC_ABORT_TASK:
406 /* 403 case ISCSI_TM_FUNC_TASK_REASSIGN:
407 * the iscsi layer must have completed the cmd while this 404 ctask = iscsi_itt_to_task(conn, tmfabort_hdr->rtt);
408 * was starting up. 405 if (!ctask || !ctask->sc)
409 * 406 /*
410 * Note: In the case of a SCSI cmd timeout, the task's sc 407 * the iscsi layer must have completed the cmd while
411 * is still active; hence ctask->sc != 0 408 * was starting up.
412 * In this case, the task must be aborted 409 *
413 */ 410 * Note: In the case of a SCSI cmd timeout, the task's
414 return 0; 411 * sc is still active; hence ctask->sc != 0
415 412 * In this case, the task must be aborted
416 ref_sc = ctask->sc; 413 */
417 414 return 0;
418 /* Retrieve LUN directly from the ref_sc */ 415
419 int_to_scsilun(ref_sc->device->lun, (struct scsi_lun *) scsi_lun); 416 ref_sc = ctask->sc;
420 tmfabort_wqe->lun[0] = be32_to_cpu(scsi_lun[0]); 417 if (ref_sc->sc_data_direction == DMA_TO_DEVICE)
421 tmfabort_wqe->lun[1] = be32_to_cpu(scsi_lun[1]); 418 dword = (ISCSI_TASK_TYPE_WRITE <<
422 419 ISCSI_CMD_REQUEST_TYPE_SHIFT);
423 if (ref_sc->sc_data_direction == DMA_TO_DEVICE) 420 else
424 dword = (ISCSI_TASK_TYPE_WRITE << ISCSI_CMD_REQUEST_TYPE_SHIFT); 421 dword = (ISCSI_TASK_TYPE_READ <<
425 else 422 ISCSI_CMD_REQUEST_TYPE_SHIFT);
426 dword = (ISCSI_TASK_TYPE_READ << ISCSI_CMD_REQUEST_TYPE_SHIFT); 423 tmfabort_wqe->ref_itt = (dword |
427 tmfabort_wqe->ref_itt = (dword | (tmfabort_hdr->rtt & ISCSI_ITT_MASK)); 424 (tmfabort_hdr->rtt & ISCSI_ITT_MASK));
425 break;
426 default:
427 tmfabort_wqe->ref_itt = RESERVED_ITT;
428 }
429 memcpy(tmfabort_wqe->lun, tmfabort_hdr->lun, sizeof(struct scsi_lun));
428 tmfabort_wqe->ref_cmd_sn = be32_to_cpu(tmfabort_hdr->refcmdsn); 430 tmfabort_wqe->ref_cmd_sn = be32_to_cpu(tmfabort_hdr->refcmdsn);
429 431
430 tmfabort_wqe->bd_list_addr_lo = (u32) bnx2i_conn->hba->mp_bd_dma; 432 tmfabort_wqe->bd_list_addr_lo = (u32) bnx2i_conn->hba->mp_bd_dma;