diff options
Diffstat (limited to 'drivers/vhost/scsi.c')
| -rw-r--r-- | drivers/vhost/scsi.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 01c01cb3933f..d695b1673ae5 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
| @@ -911,6 +911,23 @@ vhost_scsi_map_iov_to_prot(struct tcm_vhost_cmd *cmd, | |||
| 911 | return 0; | 911 | return 0; |
| 912 | } | 912 | } |
| 913 | 913 | ||
| 914 | static int vhost_scsi_to_tcm_attr(int attr) | ||
| 915 | { | ||
| 916 | switch (attr) { | ||
| 917 | case VIRTIO_SCSI_S_SIMPLE: | ||
| 918 | return TCM_SIMPLE_TAG; | ||
| 919 | case VIRTIO_SCSI_S_ORDERED: | ||
| 920 | return TCM_ORDERED_TAG; | ||
| 921 | case VIRTIO_SCSI_S_HEAD: | ||
| 922 | return TCM_HEAD_TAG; | ||
| 923 | case VIRTIO_SCSI_S_ACA: | ||
| 924 | return TCM_ACA_TAG; | ||
| 925 | default: | ||
| 926 | break; | ||
| 927 | } | ||
| 928 | return TCM_SIMPLE_TAG; | ||
| 929 | } | ||
| 930 | |||
| 914 | static void tcm_vhost_submission_work(struct work_struct *work) | 931 | static void tcm_vhost_submission_work(struct work_struct *work) |
| 915 | { | 932 | { |
| 916 | struct tcm_vhost_cmd *cmd = | 933 | struct tcm_vhost_cmd *cmd = |
| @@ -936,9 +953,10 @@ static void tcm_vhost_submission_work(struct work_struct *work) | |||
| 936 | rc = target_submit_cmd_map_sgls(se_cmd, tv_nexus->tvn_se_sess, | 953 | rc = target_submit_cmd_map_sgls(se_cmd, tv_nexus->tvn_se_sess, |
| 937 | cmd->tvc_cdb, &cmd->tvc_sense_buf[0], | 954 | cmd->tvc_cdb, &cmd->tvc_sense_buf[0], |
| 938 | cmd->tvc_lun, cmd->tvc_exp_data_len, | 955 | cmd->tvc_lun, cmd->tvc_exp_data_len, |
| 939 | cmd->tvc_task_attr, cmd->tvc_data_direction, | 956 | vhost_scsi_to_tcm_attr(cmd->tvc_task_attr), |
| 940 | TARGET_SCF_ACK_KREF, sg_ptr, cmd->tvc_sgl_count, | 957 | cmd->tvc_data_direction, TARGET_SCF_ACK_KREF, |
| 941 | NULL, 0, sg_prot_ptr, cmd->tvc_prot_sgl_count); | 958 | sg_ptr, cmd->tvc_sgl_count, NULL, 0, sg_prot_ptr, |
| 959 | cmd->tvc_prot_sgl_count); | ||
| 942 | if (rc < 0) { | 960 | if (rc < 0) { |
| 943 | transport_send_check_condition_and_sense(se_cmd, | 961 | transport_send_check_condition_and_sense(se_cmd, |
| 944 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); | 962 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); |
