diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-05-19 23:19:14 -0400 |
---|---|---|
committer | James Bottomley <jbottomley@parallels.com> | 2011-05-24 13:03:56 -0400 |
commit | e66ecd505addaaf40e7d352796ba8d344f6359dd (patch) | |
tree | 3a97bb4ff8936ae73150a499acd73119cb7dca04 | |
parent | d60b7a0fc918245c6fb8cc2b15e570e040d8f38b (diff) |
[SCSI] target: Convert TASK_ATTR to scsi_tcq.h definitions
This patch converts target core and follwing scsi-misc upstream fabric
modules to use include/scsi/scsi_tcq.h includes for SIMPLE, HEAD_OF_QUEUE
and ORDERED SCSI tasks instead of scsi/libsas.h with TASK_ATTR*
*) tcm_loop: Convert tcm_loop_allocate_core_cmd() + tcm_loop_device_reset() to
scsi_tcq.h
*) tcm_fc: Convert ft_send_cmd() from FCP_PTA_* to scsi_tcq.h
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <jbottomley@parallels.com>
-rw-r--r-- | drivers/target/loopback/tcm_loop.c | 12 | ||||
-rw-r--r-- | drivers/target/target_core_pscsi.c | 4 | ||||
-rw-r--r-- | drivers/target/target_core_transport.c | 22 | ||||
-rw-r--r-- | drivers/target/tcm_fc/tfc_cmd.c | 20 | ||||
-rw-r--r-- | include/scsi/scsi_tcq.h | 1 |
5 files changed, 39 insertions, 20 deletions
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 09681bafe10d..dee2a2c909f5 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <scsi/scsi_host.h> | 31 | #include <scsi/scsi_host.h> |
32 | #include <scsi/scsi_device.h> | 32 | #include <scsi/scsi_device.h> |
33 | #include <scsi/scsi_cmnd.h> | 33 | #include <scsi/scsi_cmnd.h> |
34 | #include <scsi/libsas.h> /* For TASK_ATTR_* */ | 34 | #include <scsi/scsi_tcq.h> |
35 | 35 | ||
36 | #include <target/target_core_base.h> | 36 | #include <target/target_core_base.h> |
37 | #include <target/target_core_transport.h> | 37 | #include <target/target_core_transport.h> |
@@ -95,17 +95,17 @@ static struct se_cmd *tcm_loop_allocate_core_cmd( | |||
95 | if (sc->device->tagged_supported) { | 95 | if (sc->device->tagged_supported) { |
96 | switch (sc->tag) { | 96 | switch (sc->tag) { |
97 | case HEAD_OF_QUEUE_TAG: | 97 | case HEAD_OF_QUEUE_TAG: |
98 | sam_task_attr = TASK_ATTR_HOQ; | 98 | sam_task_attr = MSG_HEAD_TAG; |
99 | break; | 99 | break; |
100 | case ORDERED_QUEUE_TAG: | 100 | case ORDERED_QUEUE_TAG: |
101 | sam_task_attr = TASK_ATTR_ORDERED; | 101 | sam_task_attr = MSG_ORDERED_TAG; |
102 | break; | 102 | break; |
103 | default: | 103 | default: |
104 | sam_task_attr = TASK_ATTR_SIMPLE; | 104 | sam_task_attr = MSG_SIMPLE_TAG; |
105 | break; | 105 | break; |
106 | } | 106 | } |
107 | } else | 107 | } else |
108 | sam_task_attr = TASK_ATTR_SIMPLE; | 108 | sam_task_attr = MSG_SIMPLE_TAG; |
109 | 109 | ||
110 | /* | 110 | /* |
111 | * Initialize struct se_cmd descriptor from target_core_mod infrastructure | 111 | * Initialize struct se_cmd descriptor from target_core_mod infrastructure |
@@ -379,7 +379,7 @@ static int tcm_loop_device_reset(struct scsi_cmnd *sc) | |||
379 | * Initialize struct se_cmd descriptor from target_core_mod infrastructure | 379 | * Initialize struct se_cmd descriptor from target_core_mod infrastructure |
380 | */ | 380 | */ |
381 | transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, 0, | 381 | transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, 0, |
382 | DMA_NONE, TASK_ATTR_SIMPLE, | 382 | DMA_NONE, MSG_SIMPLE_TAG, |
383 | &tl_cmd->tl_sense_buf[0]); | 383 | &tl_cmd->tl_sense_buf[0]); |
384 | /* | 384 | /* |
385 | * Allocate the LUN_RESET TMR | 385 | * Allocate the LUN_RESET TMR |
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 7ff6a35f26ac..331d423fd0e0 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include <scsi/scsi_device.h> | 41 | #include <scsi/scsi_device.h> |
42 | #include <scsi/scsi_cmnd.h> | 42 | #include <scsi/scsi_cmnd.h> |
43 | #include <scsi/scsi_host.h> | 43 | #include <scsi/scsi_host.h> |
44 | #include <scsi/libsas.h> /* For TASK_ATTR_* */ | 44 | #include <scsi/scsi_tcq.h> |
45 | 45 | ||
46 | #include <target/target_core_base.h> | 46 | #include <target/target_core_base.h> |
47 | #include <target/target_core_device.h> | 47 | #include <target/target_core_device.h> |
@@ -911,7 +911,7 @@ static int pscsi_do_task(struct se_task *task) | |||
911 | * descriptor | 911 | * descriptor |
912 | */ | 912 | */ |
913 | blk_execute_rq_nowait(pdv->pdv_sd->request_queue, NULL, pt->pscsi_req, | 913 | blk_execute_rq_nowait(pdv->pdv_sd->request_queue, NULL, pt->pscsi_req, |
914 | (task->task_se_cmd->sam_task_attr == TASK_ATTR_HOQ), | 914 | (task->task_se_cmd->sam_task_attr == MSG_HEAD_TAG), |
915 | pscsi_req_done); | 915 | pscsi_req_done); |
916 | 916 | ||
917 | return PYX_TRANSPORT_SENT_TO_TRANSPORT; | 917 | return PYX_TRANSPORT_SENT_TO_TRANSPORT; |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 623963b8c1b7..4dafeb8b5638 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -42,7 +42,7 @@ | |||
42 | #include <net/tcp.h> | 42 | #include <net/tcp.h> |
43 | #include <scsi/scsi.h> | 43 | #include <scsi/scsi.h> |
44 | #include <scsi/scsi_cmnd.h> | 44 | #include <scsi/scsi_cmnd.h> |
45 | #include <scsi/libsas.h> /* For TASK_ATTR_* */ | 45 | #include <scsi/scsi_tcq.h> |
46 | 46 | ||
47 | #include <target/target_core_base.h> | 47 | #include <target/target_core_base.h> |
48 | #include <target/target_core_device.h> | 48 | #include <target/target_core_device.h> |
@@ -1074,7 +1074,7 @@ static inline int transport_add_task_check_sam_attr( | |||
1074 | * head of the struct se_device->execute_task_list, and task_prev | 1074 | * head of the struct se_device->execute_task_list, and task_prev |
1075 | * after that for each subsequent task | 1075 | * after that for each subsequent task |
1076 | */ | 1076 | */ |
1077 | if (task->task_se_cmd->sam_task_attr == TASK_ATTR_HOQ) { | 1077 | if (task->task_se_cmd->sam_task_attr == MSG_HEAD_TAG) { |
1078 | list_add(&task->t_execute_list, | 1078 | list_add(&task->t_execute_list, |
1079 | (task_prev != NULL) ? | 1079 | (task_prev != NULL) ? |
1080 | &task_prev->t_execute_list : | 1080 | &task_prev->t_execute_list : |
@@ -1873,7 +1873,7 @@ static int transport_check_alloc_task_attr(struct se_cmd *cmd) | |||
1873 | if (SE_DEV(cmd)->dev_task_attr_type != SAM_TASK_ATTR_EMULATED) | 1873 | if (SE_DEV(cmd)->dev_task_attr_type != SAM_TASK_ATTR_EMULATED) |
1874 | return 0; | 1874 | return 0; |
1875 | 1875 | ||
1876 | if (cmd->sam_task_attr == TASK_ATTR_ACA) { | 1876 | if (cmd->sam_task_attr == MSG_ACA_TAG) { |
1877 | DEBUG_STA("SAM Task Attribute ACA" | 1877 | DEBUG_STA("SAM Task Attribute ACA" |
1878 | " emulation is not supported\n"); | 1878 | " emulation is not supported\n"); |
1879 | return -1; | 1879 | return -1; |
@@ -2517,7 +2517,7 @@ static inline int transport_execute_task_attr(struct se_cmd *cmd) | |||
2517 | * Check for the existence of HEAD_OF_QUEUE, and if true return 1 | 2517 | * Check for the existence of HEAD_OF_QUEUE, and if true return 1 |
2518 | * to allow the passed struct se_cmd list of tasks to the front of the list. | 2518 | * to allow the passed struct se_cmd list of tasks to the front of the list. |
2519 | */ | 2519 | */ |
2520 | if (cmd->sam_task_attr == TASK_ATTR_HOQ) { | 2520 | if (cmd->sam_task_attr == MSG_HEAD_TAG) { |
2521 | atomic_inc(&SE_DEV(cmd)->dev_hoq_count); | 2521 | atomic_inc(&SE_DEV(cmd)->dev_hoq_count); |
2522 | smp_mb__after_atomic_inc(); | 2522 | smp_mb__after_atomic_inc(); |
2523 | DEBUG_STA("Added HEAD_OF_QUEUE for CDB:" | 2523 | DEBUG_STA("Added HEAD_OF_QUEUE for CDB:" |
@@ -2525,7 +2525,7 @@ static inline int transport_execute_task_attr(struct se_cmd *cmd) | |||
2525 | T_TASK(cmd)->t_task_cdb[0], | 2525 | T_TASK(cmd)->t_task_cdb[0], |
2526 | cmd->se_ordered_id); | 2526 | cmd->se_ordered_id); |
2527 | return 1; | 2527 | return 1; |
2528 | } else if (cmd->sam_task_attr == TASK_ATTR_ORDERED) { | 2528 | } else if (cmd->sam_task_attr == MSG_ORDERED_TAG) { |
2529 | spin_lock(&SE_DEV(cmd)->ordered_cmd_lock); | 2529 | spin_lock(&SE_DEV(cmd)->ordered_cmd_lock); |
2530 | list_add_tail(&cmd->se_ordered_list, | 2530 | list_add_tail(&cmd->se_ordered_list, |
2531 | &SE_DEV(cmd)->ordered_cmd_list); | 2531 | &SE_DEV(cmd)->ordered_cmd_list); |
@@ -3424,7 +3424,7 @@ static int transport_generic_cmd_sequencer( | |||
3424 | * See spc4r17 section 5.3 | 3424 | * See spc4r17 section 5.3 |
3425 | */ | 3425 | */ |
3426 | if (SE_DEV(cmd)->dev_task_attr_type == SAM_TASK_ATTR_EMULATED) | 3426 | if (SE_DEV(cmd)->dev_task_attr_type == SAM_TASK_ATTR_EMULATED) |
3427 | cmd->sam_task_attr = TASK_ATTR_HOQ; | 3427 | cmd->sam_task_attr = MSG_HEAD_TAG; |
3428 | cmd->se_cmd_flags |= SCF_SCSI_CONTROL_NONSG_IO_CDB; | 3428 | cmd->se_cmd_flags |= SCF_SCSI_CONTROL_NONSG_IO_CDB; |
3429 | break; | 3429 | break; |
3430 | case READ_BUFFER: | 3430 | case READ_BUFFER: |
@@ -3632,7 +3632,7 @@ static int transport_generic_cmd_sequencer( | |||
3632 | * See spc4r17 section 5.3 | 3632 | * See spc4r17 section 5.3 |
3633 | */ | 3633 | */ |
3634 | if (SE_DEV(cmd)->dev_task_attr_type == SAM_TASK_ATTR_EMULATED) | 3634 | if (SE_DEV(cmd)->dev_task_attr_type == SAM_TASK_ATTR_EMULATED) |
3635 | cmd->sam_task_attr = TASK_ATTR_HOQ; | 3635 | cmd->sam_task_attr = MSG_HEAD_TAG; |
3636 | cmd->se_cmd_flags |= SCF_SCSI_CONTROL_NONSG_IO_CDB; | 3636 | cmd->se_cmd_flags |= SCF_SCSI_CONTROL_NONSG_IO_CDB; |
3637 | break; | 3637 | break; |
3638 | default: | 3638 | default: |
@@ -3790,21 +3790,21 @@ static void transport_complete_task_attr(struct se_cmd *cmd) | |||
3790 | struct se_cmd *cmd_p, *cmd_tmp; | 3790 | struct se_cmd *cmd_p, *cmd_tmp; |
3791 | int new_active_tasks = 0; | 3791 | int new_active_tasks = 0; |
3792 | 3792 | ||
3793 | if (cmd->sam_task_attr == TASK_ATTR_SIMPLE) { | 3793 | if (cmd->sam_task_attr == MSG_SIMPLE_TAG) { |
3794 | atomic_dec(&dev->simple_cmds); | 3794 | atomic_dec(&dev->simple_cmds); |
3795 | smp_mb__after_atomic_dec(); | 3795 | smp_mb__after_atomic_dec(); |
3796 | dev->dev_cur_ordered_id++; | 3796 | dev->dev_cur_ordered_id++; |
3797 | DEBUG_STA("Incremented dev->dev_cur_ordered_id: %u for" | 3797 | DEBUG_STA("Incremented dev->dev_cur_ordered_id: %u for" |
3798 | " SIMPLE: %u\n", dev->dev_cur_ordered_id, | 3798 | " SIMPLE: %u\n", dev->dev_cur_ordered_id, |
3799 | cmd->se_ordered_id); | 3799 | cmd->se_ordered_id); |
3800 | } else if (cmd->sam_task_attr == TASK_ATTR_HOQ) { | 3800 | } else if (cmd->sam_task_attr == MSG_HEAD_TAG) { |
3801 | atomic_dec(&dev->dev_hoq_count); | 3801 | atomic_dec(&dev->dev_hoq_count); |
3802 | smp_mb__after_atomic_dec(); | 3802 | smp_mb__after_atomic_dec(); |
3803 | dev->dev_cur_ordered_id++; | 3803 | dev->dev_cur_ordered_id++; |
3804 | DEBUG_STA("Incremented dev_cur_ordered_id: %u for" | 3804 | DEBUG_STA("Incremented dev_cur_ordered_id: %u for" |
3805 | " HEAD_OF_QUEUE: %u\n", dev->dev_cur_ordered_id, | 3805 | " HEAD_OF_QUEUE: %u\n", dev->dev_cur_ordered_id, |
3806 | cmd->se_ordered_id); | 3806 | cmd->se_ordered_id); |
3807 | } else if (cmd->sam_task_attr == TASK_ATTR_ORDERED) { | 3807 | } else if (cmd->sam_task_attr == MSG_ORDERED_TAG) { |
3808 | spin_lock(&dev->ordered_cmd_lock); | 3808 | spin_lock(&dev->ordered_cmd_lock); |
3809 | list_del(&cmd->se_ordered_list); | 3809 | list_del(&cmd->se_ordered_list); |
3810 | atomic_dec(&dev->dev_ordered_sync); | 3810 | atomic_dec(&dev->dev_ordered_sync); |
@@ -3837,7 +3837,7 @@ static void transport_complete_task_attr(struct se_cmd *cmd) | |||
3837 | new_active_tasks++; | 3837 | new_active_tasks++; |
3838 | 3838 | ||
3839 | spin_lock(&dev->delayed_cmd_lock); | 3839 | spin_lock(&dev->delayed_cmd_lock); |
3840 | if (cmd_p->sam_task_attr == TASK_ATTR_ORDERED) | 3840 | if (cmd_p->sam_task_attr == MSG_ORDERED_TAG) |
3841 | break; | 3841 | break; |
3842 | } | 3842 | } |
3843 | spin_unlock(&dev->delayed_cmd_lock); | 3843 | spin_unlock(&dev->delayed_cmd_lock); |
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index 49e51778f733..c056a1132ae1 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <scsi/scsi_host.h> | 35 | #include <scsi/scsi_host.h> |
36 | #include <scsi/scsi_device.h> | 36 | #include <scsi/scsi_device.h> |
37 | #include <scsi/scsi_cmnd.h> | 37 | #include <scsi/scsi_cmnd.h> |
38 | #include <scsi/scsi_tcq.h> | ||
38 | #include <scsi/libfc.h> | 39 | #include <scsi/libfc.h> |
39 | #include <scsi/fc_encode.h> | 40 | #include <scsi/fc_encode.h> |
40 | 41 | ||
@@ -592,8 +593,25 @@ static void ft_send_cmd(struct ft_cmd *cmd) | |||
592 | case FCP_CFL_WRDATA | FCP_CFL_RDDATA: | 593 | case FCP_CFL_WRDATA | FCP_CFL_RDDATA: |
593 | goto err; /* TBD not supported by tcm_fc yet */ | 594 | goto err; /* TBD not supported by tcm_fc yet */ |
594 | } | 595 | } |
596 | /* | ||
597 | * Locate the SAM Task Attr from fc_pri_ta | ||
598 | */ | ||
599 | switch (fcp->fc_pri_ta & FCP_PTA_MASK) { | ||
600 | case FCP_PTA_HEADQ: | ||
601 | task_attr = MSG_HEAD_TAG; | ||
602 | break; | ||
603 | case FCP_PTA_ORDERED: | ||
604 | task_attr = MSG_ORDERED_TAG; | ||
605 | break; | ||
606 | case FCP_PTA_ACA: | ||
607 | task_attr = MSG_ACA_TAG; | ||
608 | break; | ||
609 | case FCP_PTA_SIMPLE: /* Fallthrough */ | ||
610 | default: | ||
611 | task_attr = MSG_SIMPLE_TAG; | ||
612 | } | ||
613 | |||
595 | 614 | ||
596 | /* FCP_PTA_ maps 1:1 to TASK_ATTR_ */ | ||
597 | task_attr = fcp->fc_pri_ta & FCP_PTA_MASK; | 615 | task_attr = fcp->fc_pri_ta & FCP_PTA_MASK; |
598 | data_len = ntohl(fcp->fc_dl); | 616 | data_len = ntohl(fcp->fc_dl); |
599 | cmd->cdb = fcp->fc_cdb; | 617 | cmd->cdb = fcp->fc_cdb; |
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h index d6e7994aa634..81dd12edc38c 100644 --- a/include/scsi/scsi_tcq.h +++ b/include/scsi/scsi_tcq.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #define MSG_SIMPLE_TAG 0x20 | 9 | #define MSG_SIMPLE_TAG 0x20 |
10 | #define MSG_HEAD_TAG 0x21 | 10 | #define MSG_HEAD_TAG 0x21 |
11 | #define MSG_ORDERED_TAG 0x22 | 11 | #define MSG_ORDERED_TAG 0x22 |
12 | #define MSG_ACA_TAG 0x24 /* unsupported */ | ||
12 | 13 | ||
13 | #define SCSI_NO_TAG (-1) /* identify no tag in use */ | 14 | #define SCSI_NO_TAG (-1) /* identify no tag in use */ |
14 | 15 | ||