aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/be2iscsi
diff options
context:
space:
mode:
authorJayamohan Kallickal <jayamohank@serverengines.com>2010-02-19 21:33:56 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-03-03 07:59:44 -0500
commitdafab8e079f432268cca5cf378b92d6acfacc393 (patch)
tree889839c1c8c42fe1602dca783e52ed0d14303ae8 /drivers/scsi/be2iscsi
parent944b2fbce26ce39555363fd092386807fa5ea08c (diff)
[SCSI] be2iscsi: cleans up abort handling
This patch cleans up abort handling when TMF is sent Signed-off-by: Jayamohan Kallickal <jayamohank@serverengines.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/be2iscsi')
-rw-r--r--drivers/scsi/be2iscsi/be_main.c62
1 files changed, 11 insertions, 51 deletions
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index eab31a515de3..aee3734d8617 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -1063,14 +1063,18 @@ static void hwi_complete_cmd(struct beiscsi_conn *beiscsi_conn,
1063 case HWH_TYPE_IO: 1063 case HWH_TYPE_IO:
1064 case HWH_TYPE_IO_RD: 1064 case HWH_TYPE_IO_RD:
1065 if ((task->hdr->opcode & ISCSI_OPCODE_MASK) == 1065 if ((task->hdr->opcode & ISCSI_OPCODE_MASK) ==
1066 ISCSI_OP_NOOP_OUT) { 1066 ISCSI_OP_NOOP_OUT)
1067 be_complete_nopin_resp(beiscsi_conn, task, psol); 1067 be_complete_nopin_resp(beiscsi_conn, task, psol);
1068 } else 1068 else
1069 be_complete_io(beiscsi_conn, task, psol); 1069 be_complete_io(beiscsi_conn, task, psol);
1070 break; 1070 break;
1071 1071
1072 case HWH_TYPE_LOGOUT: 1072 case HWH_TYPE_LOGOUT:
1073 be_complete_logout(beiscsi_conn, task, psol); 1073 if ((task->hdr->opcode & ISCSI_OPCODE_MASK) == ISCSI_OP_LOGOUT)
1074 be_complete_logout(beiscsi_conn, task, psol);
1075 else
1076 be_complete_tmf(beiscsi_conn, task, psol);
1077
1074 break; 1078 break;
1075 1079
1076 case HWH_TYPE_LOGIN: 1080 case HWH_TYPE_LOGIN:
@@ -1079,10 +1083,6 @@ static void hwi_complete_cmd(struct beiscsi_conn *beiscsi_conn,
1079 "- Solicited path \n"); 1083 "- Solicited path \n");
1080 break; 1084 break;
1081 1085
1082 case HWH_TYPE_TMF:
1083 be_complete_tmf(beiscsi_conn, task, psol);
1084 break;
1085
1086 case HWH_TYPE_NOP: 1086 case HWH_TYPE_NOP:
1087 be_complete_nopin_resp(beiscsi_conn, task, psol); 1087 be_complete_nopin_resp(beiscsi_conn, task, psol);
1088 break; 1088 break;
@@ -3593,19 +3593,13 @@ static int beiscsi_iotask(struct iscsi_task *task, struct scatterlist *sg,
3593 3593
3594static int beiscsi_mtask(struct iscsi_task *task) 3594static int beiscsi_mtask(struct iscsi_task *task)
3595{ 3595{
3596 struct beiscsi_io_task *aborted_io_task, *io_task = task->dd_data; 3596 struct beiscsi_io_task *io_task = task->dd_data;
3597 struct iscsi_conn *conn = task->conn; 3597 struct iscsi_conn *conn = task->conn;
3598 struct beiscsi_conn *beiscsi_conn = conn->dd_data; 3598 struct beiscsi_conn *beiscsi_conn = conn->dd_data;
3599 struct beiscsi_hba *phba = beiscsi_conn->phba; 3599 struct beiscsi_hba *phba = beiscsi_conn->phba;
3600 struct iscsi_session *session;
3601 struct iscsi_wrb *pwrb = NULL; 3600 struct iscsi_wrb *pwrb = NULL;
3602 struct hwi_controller *phwi_ctrlr;
3603 struct hwi_wrb_context *pwrb_context;
3604 struct wrb_handle *pwrb_handle;
3605 unsigned int doorbell = 0; 3601 unsigned int doorbell = 0;
3606 struct invalidate_command_table *inv_tbl; 3602 unsigned int cid;
3607 struct iscsi_task *aborted_task;
3608 unsigned int i, cid, tag, num_invalidate;
3609 3603
3610 cid = beiscsi_conn->beiscsi_conn_cid; 3604 cid = beiscsi_conn->beiscsi_conn_cid;
3611 pwrb = io_task->pwrb_handle->pwrb; 3605 pwrb = io_task->pwrb_handle->pwrb;
@@ -3616,6 +3610,7 @@ static int beiscsi_mtask(struct iscsi_task *task)
3616 io_task->pwrb_handle->wrb_index); 3610 io_task->pwrb_handle->wrb_index);
3617 AMAP_SET_BITS(struct amap_iscsi_wrb, sgl_icd_idx, pwrb, 3611 AMAP_SET_BITS(struct amap_iscsi_wrb, sgl_icd_idx, pwrb,
3618 io_task->psgl_handle->sgl_index); 3612 io_task->psgl_handle->sgl_index);
3613
3619 switch (task->hdr->opcode & ISCSI_OPCODE_MASK) { 3614 switch (task->hdr->opcode & ISCSI_OPCODE_MASK) {
3620 case ISCSI_OP_LOGIN: 3615 case ISCSI_OP_LOGIN:
3621 AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb, 3616 AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
@@ -3640,36 +3635,6 @@ static int beiscsi_mtask(struct iscsi_task *task)
3640 hwi_write_buffer(pwrb, task); 3635 hwi_write_buffer(pwrb, task);
3641 break; 3636 break;
3642 case ISCSI_OP_SCSI_TMFUNC: 3637 case ISCSI_OP_SCSI_TMFUNC:
3643 session = conn->session;
3644 i = ((struct iscsi_tm *)task->hdr)->rtt;
3645 phwi_ctrlr = phba->phwi_ctrlr;
3646 pwrb_context = &phwi_ctrlr->wrb_context[cid -
3647 phba->fw_config.iscsi_cid_start];
3648 pwrb_handle = pwrb_context->pwrb_handle_basestd[be32_to_cpu(i)
3649 >> 16];
3650 aborted_task = pwrb_handle->pio_handle;
3651 if (!aborted_task)
3652 return 0;
3653
3654 aborted_io_task = aborted_task->dd_data;
3655 if (!aborted_io_task->scsi_cmnd)
3656 return 0;
3657
3658 inv_tbl = phba->inv_tbl;
3659 memset(inv_tbl, 0x0, sizeof(*inv_tbl));
3660 inv_tbl->cid = cid;
3661 inv_tbl->icd = aborted_io_task->psgl_handle->sgl_index;
3662 num_invalidate = 1;
3663 tag = mgmt_invalidate_icds(phba, inv_tbl, num_invalidate, cid);
3664 if (!tag) {
3665 shost_printk(KERN_WARNING, phba->shost,
3666 "mgmt_invalidate_icds could not be"
3667 " submitted\n");
3668 } else {
3669 wait_event_interruptible(phba->ctrl.mcc_wait[tag],
3670 phba->ctrl.mcc_numtag[tag]);
3671 free_mcc_tag(&phba->ctrl, tag);
3672 }
3673 AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb, 3638 AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
3674 INI_TMF_CMD); 3639 INI_TMF_CMD);
3675 AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 0); 3640 AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 0);
@@ -3678,7 +3643,7 @@ static int beiscsi_mtask(struct iscsi_task *task)
3678 case ISCSI_OP_LOGOUT: 3643 case ISCSI_OP_LOGOUT:
3679 AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 0); 3644 AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 0);
3680 AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb, 3645 AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
3681 HWH_TYPE_LOGOUT); 3646 HWH_TYPE_LOGOUT);
3682 hwi_write_buffer(pwrb, task); 3647 hwi_write_buffer(pwrb, task);
3683 break; 3648 break;
3684 3649
@@ -3704,17 +3669,12 @@ static int beiscsi_mtask(struct iscsi_task *task)
3704 3669
3705static int beiscsi_task_xmit(struct iscsi_task *task) 3670static int beiscsi_task_xmit(struct iscsi_task *task)
3706{ 3671{
3707 struct iscsi_conn *conn = task->conn;
3708 struct beiscsi_io_task *io_task = task->dd_data; 3672 struct beiscsi_io_task *io_task = task->dd_data;
3709 struct scsi_cmnd *sc = task->sc; 3673 struct scsi_cmnd *sc = task->sc;
3710 struct beiscsi_conn *beiscsi_conn = conn->dd_data;
3711 struct scatterlist *sg; 3674 struct scatterlist *sg;
3712 int num_sg; 3675 int num_sg;
3713 unsigned int writedir = 0, xferlen = 0; 3676 unsigned int writedir = 0, xferlen = 0;
3714 3677
3715 SE_DEBUG(DBG_LVL_4, "\n cid=%d In beiscsi_task_xmit task=%p conn=%p \t"
3716 "beiscsi_conn=%p \n", beiscsi_conn->beiscsi_conn_cid,
3717 task, conn, beiscsi_conn);
3718 if (!sc) 3678 if (!sc)
3719 return beiscsi_mtask(task); 3679 return beiscsi_mtask(task);
3720 3680