Commit eba2ca450526c1aaf2bfd363dffd63b024e80ea7
1 parent
3d6d72014f
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
target: Move MAINTENANCE_[IN,OUT] from pscsi_parse_cdb -> spc_parse_cdb
The MAINTENANCE_[IN,OUT] CDB parsing required for generic ALUA emulation needs to be in spc_parse_cdb() to function for virtual TYPE_DISK exports, instead of in backend pscsi_parse_cdb() code used only for passthrough ops. Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Showing 1 changed file with 41 additions and 1 deletions Side-by-side Diff
drivers/target/target_core_spc.c
... | ... | @@ -35,6 +35,7 @@ |
35 | 35 | #include <target/target_core_fabric.h> |
36 | 36 | |
37 | 37 | #include "target_core_internal.h" |
38 | +#include "target_core_alua.h" | |
38 | 39 | #include "target_core_pr.h" |
39 | 40 | #include "target_core_ua.h" |
40 | 41 | |
... | ... | @@ -940,7 +941,8 @@ |
940 | 941 | |
941 | 942 | int spc_parse_cdb(struct se_cmd *cmd, unsigned int *size) |
942 | 943 | { |
943 | - struct se_subsystem_dev *su_dev = cmd->se_dev->se_sub_dev; | |
944 | + struct se_device *dev = cmd->se_dev; | |
945 | + struct se_subsystem_dev *su_dev = dev->se_sub_dev; | |
944 | 946 | unsigned char *cdb = cmd->t_task_cdb; |
945 | 947 | |
946 | 948 | switch (cdb[0]) { |
... | ... | @@ -1049,6 +1051,44 @@ |
1049 | 1051 | case TEST_UNIT_READY: |
1050 | 1052 | cmd->execute_cmd = spc_emulate_testunitready; |
1051 | 1053 | *size = 0; |
1054 | + break; | |
1055 | + case MAINTENANCE_IN: | |
1056 | + if (dev->transport->get_device_type(dev) != TYPE_ROM) { | |
1057 | + /* | |
1058 | + * MAINTENANCE_IN from SCC-2 | |
1059 | + * Check for emulated MI_REPORT_TARGET_PGS | |
1060 | + */ | |
1061 | + if ((cdb[1] & 0x1f) == MI_REPORT_TARGET_PGS && | |
1062 | + su_dev->t10_alua.alua_type == SPC3_ALUA_EMULATED) { | |
1063 | + cmd->execute_cmd = | |
1064 | + target_emulate_report_target_port_groups; | |
1065 | + } | |
1066 | + *size = get_unaligned_be32(&cdb[6]); | |
1067 | + } else { | |
1068 | + /* | |
1069 | + * GPCMD_SEND_KEY from multi media commands | |
1070 | + */ | |
1071 | + *size = get_unaligned_be16(&cdb[8]); | |
1072 | + } | |
1073 | + break; | |
1074 | + case MAINTENANCE_OUT: | |
1075 | + if (dev->transport->get_device_type(dev) != TYPE_ROM) { | |
1076 | + /* | |
1077 | + * MAINTENANCE_OUT from SCC-2 | |
1078 | + * Check for emulated MO_SET_TARGET_PGS. | |
1079 | + */ | |
1080 | + if (cdb[1] == MO_SET_TARGET_PGS && | |
1081 | + su_dev->t10_alua.alua_type == SPC3_ALUA_EMULATED) { | |
1082 | + cmd->execute_cmd = | |
1083 | + target_emulate_set_target_port_groups; | |
1084 | + } | |
1085 | + *size = get_unaligned_be32(&cdb[6]); | |
1086 | + } else { | |
1087 | + /* | |
1088 | + * GPCMD_SEND_KEY from multi media commands | |
1089 | + */ | |
1090 | + *size = get_unaligned_be16(&cdb[8]); | |
1091 | + } | |
1052 | 1092 | break; |
1053 | 1093 | default: |
1054 | 1094 | pr_warn("TARGET_CORE[%s]: Unsupported SCSI Opcode" |