diff options
author | Andy Grover <agrover@redhat.com> | 2012-02-09 01:42:33 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-02-25 17:37:47 -0500 |
commit | 0dccb69d42a06d438c979c933a1657cb0b4ec4fb (patch) | |
tree | 0e56f56d33907726932c9074d26d1faae60fdee8 /drivers/target/tcm_fc | |
parent | 4f26998a79b30a5c912cfa1a759fa0c3e6f6414e (diff) |
tcm_fc: Simplify ft_send_work for tmr path
Check fc_tm_flags early and call ft_send_tm() right away. Don't need to
set local vars for tm case.
data_len local var now unneeded, remove.
Signed-off-by: Andy Grover <agrover@redhat.com>
Cc: Kiran Patil <kiran.patil@intel.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/tcm_fc')
-rw-r--r-- | drivers/target/tcm_fc/tfc_cmd.c | 78 |
1 files changed, 35 insertions, 43 deletions
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index c5f5bb29a165..6b8d854cc71a 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c | |||
@@ -536,7 +536,6 @@ static void ft_send_work(struct work_struct *work) | |||
536 | struct fc_frame_header *fh = fc_frame_header_get(cmd->req_frame); | 536 | struct fc_frame_header *fh = fc_frame_header_get(cmd->req_frame); |
537 | struct fcp_cmnd *fcp; | 537 | struct fcp_cmnd *fcp; |
538 | int data_dir = 0; | 538 | int data_dir = 0; |
539 | u32 data_len; | ||
540 | int task_attr; | 539 | int task_attr; |
541 | 540 | ||
542 | fcp = fc_frame_payload_get(cmd->req_frame, sizeof(*fcp)); | 541 | fcp = fc_frame_payload_get(cmd->req_frame, sizeof(*fcp)); |
@@ -546,47 +545,6 @@ static void ft_send_work(struct work_struct *work) | |||
546 | if (fcp->fc_flags & FCP_CFL_LEN_MASK) | 545 | if (fcp->fc_flags & FCP_CFL_LEN_MASK) |
547 | goto err; /* not handling longer CDBs yet */ | 546 | goto err; /* not handling longer CDBs yet */ |
548 | 547 | ||
549 | if (fcp->fc_tm_flags) { | ||
550 | task_attr = FCP_PTA_SIMPLE; | ||
551 | data_dir = DMA_NONE; | ||
552 | data_len = 0; | ||
553 | } else { | ||
554 | switch (fcp->fc_flags & (FCP_CFL_RDDATA | FCP_CFL_WRDATA)) { | ||
555 | case 0: | ||
556 | data_dir = DMA_NONE; | ||
557 | break; | ||
558 | case FCP_CFL_RDDATA: | ||
559 | data_dir = DMA_FROM_DEVICE; | ||
560 | break; | ||
561 | case FCP_CFL_WRDATA: | ||
562 | data_dir = DMA_TO_DEVICE; | ||
563 | break; | ||
564 | case FCP_CFL_WRDATA | FCP_CFL_RDDATA: | ||
565 | goto err; /* TBD not supported by tcm_fc yet */ | ||
566 | } | ||
567 | /* | ||
568 | * Locate the SAM Task Attr from fc_pri_ta | ||
569 | */ | ||
570 | switch (fcp->fc_pri_ta & FCP_PTA_MASK) { | ||
571 | case FCP_PTA_HEADQ: | ||
572 | task_attr = MSG_HEAD_TAG; | ||
573 | break; | ||
574 | case FCP_PTA_ORDERED: | ||
575 | task_attr = MSG_ORDERED_TAG; | ||
576 | break; | ||
577 | case FCP_PTA_ACA: | ||
578 | task_attr = MSG_ACA_TAG; | ||
579 | break; | ||
580 | case FCP_PTA_SIMPLE: /* Fallthrough */ | ||
581 | default: | ||
582 | task_attr = MSG_SIMPLE_TAG; | ||
583 | } | ||
584 | |||
585 | |||
586 | task_attr = fcp->fc_pri_ta & FCP_PTA_MASK; | ||
587 | data_len = ntohl(fcp->fc_dl); | ||
588 | cmd->cdb = fcp->fc_cdb; | ||
589 | } | ||
590 | /* | 548 | /* |
591 | * Check for FCP task management flags | 549 | * Check for FCP task management flags |
592 | */ | 550 | */ |
@@ -594,6 +552,40 @@ static void ft_send_work(struct work_struct *work) | |||
594 | ft_send_tm(cmd); | 552 | ft_send_tm(cmd); |
595 | return; | 553 | return; |
596 | } | 554 | } |
555 | |||
556 | switch (fcp->fc_flags & (FCP_CFL_RDDATA | FCP_CFL_WRDATA)) { | ||
557 | case 0: | ||
558 | data_dir = DMA_NONE; | ||
559 | break; | ||
560 | case FCP_CFL_RDDATA: | ||
561 | data_dir = DMA_FROM_DEVICE; | ||
562 | break; | ||
563 | case FCP_CFL_WRDATA: | ||
564 | data_dir = DMA_TO_DEVICE; | ||
565 | break; | ||
566 | case FCP_CFL_WRDATA | FCP_CFL_RDDATA: | ||
567 | goto err; /* TBD not supported by tcm_fc yet */ | ||
568 | } | ||
569 | /* | ||
570 | * Locate the SAM Task Attr from fc_pri_ta | ||
571 | */ | ||
572 | switch (fcp->fc_pri_ta & FCP_PTA_MASK) { | ||
573 | case FCP_PTA_HEADQ: | ||
574 | task_attr = MSG_HEAD_TAG; | ||
575 | break; | ||
576 | case FCP_PTA_ORDERED: | ||
577 | task_attr = MSG_ORDERED_TAG; | ||
578 | break; | ||
579 | case FCP_PTA_ACA: | ||
580 | task_attr = MSG_ACA_TAG; | ||
581 | break; | ||
582 | case FCP_PTA_SIMPLE: /* Fallthrough */ | ||
583 | default: | ||
584 | task_attr = MSG_SIMPLE_TAG; | ||
585 | } | ||
586 | |||
587 | cmd->cdb = fcp->fc_cdb; | ||
588 | |||
597 | fc_seq_exch(cmd->seq)->lp->tt.seq_set_resp(cmd->seq, ft_recv_seq, cmd); | 589 | fc_seq_exch(cmd->seq)->lp->tt.seq_set_resp(cmd->seq, ft_recv_seq, cmd); |
598 | /* | 590 | /* |
599 | * Use a single se_cmd->cmd_kref as we expect to release se_cmd | 591 | * Use a single se_cmd->cmd_kref as we expect to release se_cmd |
@@ -601,7 +593,7 @@ static void ft_send_work(struct work_struct *work) | |||
601 | */ | 593 | */ |
602 | target_submit_cmd(&cmd->se_cmd, cmd->sess->se_sess, cmd->cdb, | 594 | target_submit_cmd(&cmd->se_cmd, cmd->sess->se_sess, cmd->cdb, |
603 | &cmd->ft_sense_buffer[0], scsilun_to_int(&fcp->fc_lun), | 595 | &cmd->ft_sense_buffer[0], scsilun_to_int(&fcp->fc_lun), |
604 | data_len, task_attr, data_dir, 0); | 596 | ntohl(fcp->fc_dl), task_attr, data_dir, 0); |
605 | pr_debug("r_ctl %x alloc target_submit_cmd\n", fh->fh_r_ctl); | 597 | pr_debug("r_ctl %x alloc target_submit_cmd\n", fh->fh_r_ctl); |
606 | return; | 598 | return; |
607 | 599 | ||