Lines Matching refs:cmd
64 spc_emulate_inquiry_std(struct se_cmd *cmd, unsigned char *buf) in spc_emulate_inquiry_std() argument
66 struct se_lun *lun = cmd->se_lun; in spc_emulate_inquiry_std()
67 struct se_device *dev = cmd->se_dev; in spc_emulate_inquiry_std()
68 struct se_session *sess = cmd->se_sess; in spc_emulate_inquiry_std()
105 if (dev->dev_attrib.pi_prot_type || cmd->se_sess->sess_prot_type) in spc_emulate_inquiry_std()
125 spc_emulate_evpd_80(struct se_cmd *cmd, unsigned char *buf) in spc_emulate_evpd_80() argument
127 struct se_device *dev = cmd->se_dev; in spc_emulate_evpd_80()
174 spc_emulate_evpd_83(struct se_cmd *cmd, unsigned char *buf) in spc_emulate_evpd_83() argument
176 struct se_device *dev = cmd->se_dev; in spc_emulate_evpd_83()
177 struct se_lun *lun = cmd->se_lun; in spc_emulate_evpd_83()
442 spc_emulate_evpd_86(struct se_cmd *cmd, unsigned char *buf) in spc_emulate_evpd_86() argument
444 struct se_device *dev = cmd->se_dev; in spc_emulate_evpd_86()
445 struct se_session *sess = cmd->se_sess; in spc_emulate_evpd_86()
454 cmd->se_sess->sess_prot_type == TARGET_DIF_TYPE1_PROT) in spc_emulate_evpd_86()
457 cmd->se_sess->sess_prot_type == TARGET_DIF_TYPE3_PROT) in spc_emulate_evpd_86()
464 (dev->dev_attrib.pi_prot_type || cmd->se_sess->sess_prot_type)) { in spc_emulate_evpd_86()
475 spin_lock(&cmd->se_dev->t10_alua.lba_map_lock); in spc_emulate_evpd_86()
478 spin_unlock(&cmd->se_dev->t10_alua.lba_map_lock); in spc_emulate_evpd_86()
484 spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf) in spc_emulate_evpd_b0() argument
486 struct se_device *dev = cmd->se_dev; in spc_emulate_evpd_b0()
523 if (cmd->se_tfo->max_data_sg_nents) { in spc_emulate_evpd_b0()
524 mtl = (cmd->se_tfo->max_data_sg_nents * PAGE_SIZE) / in spc_emulate_evpd_b0()
578 spc_emulate_evpd_b1(struct se_cmd *cmd, unsigned char *buf) in spc_emulate_evpd_b1() argument
580 struct se_device *dev = cmd->se_dev; in spc_emulate_evpd_b1()
591 spc_emulate_evpd_b2(struct se_cmd *cmd, unsigned char *buf) in spc_emulate_evpd_b2() argument
593 struct se_device *dev = cmd->se_dev; in spc_emulate_evpd_b2()
643 spc_emulate_evpd_b3(struct se_cmd *cmd, unsigned char *buf) in spc_emulate_evpd_b3() argument
645 struct se_device *dev = cmd->se_dev; in spc_emulate_evpd_b3()
656 spc_emulate_evpd_00(struct se_cmd *cmd, unsigned char *buf);
674 spc_emulate_evpd_00(struct se_cmd *cmd, unsigned char *buf) in spc_emulate_evpd_00() argument
683 if (cmd->se_dev->dev_flags & DF_EMULATED_VPD_UNIT_SERIAL) { in spc_emulate_evpd_00()
693 spc_emulate_inquiry(struct se_cmd *cmd) in spc_emulate_inquiry() argument
695 struct se_device *dev = cmd->se_dev; in spc_emulate_inquiry()
696 struct se_portal_group *tpg = cmd->se_lun->lun_tpg; in spc_emulate_inquiry()
698 unsigned char *cdb = cmd->t_task_cdb; in spc_emulate_inquiry()
723 ret = spc_emulate_inquiry_std(cmd, buf); in spc_emulate_inquiry()
731 ret = evpd_handlers[p].emulate(cmd, buf); in spc_emulate_inquiry()
741 rbuf = transport_kmap_data_sg(cmd); in spc_emulate_inquiry()
743 memcpy(rbuf, buf, min_t(u32, SE_INQUIRY_BUF, cmd->data_length)); in spc_emulate_inquiry()
744 transport_kunmap_data_sg(cmd); in spc_emulate_inquiry()
749 target_complete_cmd_with_length(cmd, GOOD, len); in spc_emulate_inquiry()
753 static int spc_modesense_rwrecovery(struct se_cmd *cmd, u8 pc, u8 *p) in spc_modesense_rwrecovery() argument
766 static int spc_modesense_control(struct se_cmd *cmd, u8 pc, u8 *p) in spc_modesense_control() argument
768 struct se_device *dev = cmd->se_dev; in spc_modesense_control()
769 struct se_session *sess = cmd->se_sess; in spc_modesense_control()
880 static int spc_modesense_caching(struct se_cmd *cmd, u8 pc, u8 *p) in spc_modesense_caching() argument
882 struct se_device *dev = cmd->se_dev; in spc_modesense_caching()
899 static int spc_modesense_informational_exceptions(struct se_cmd *cmd, u8 pc, unsigned char *p) in spc_modesense_informational_exceptions() argument
973 static sense_reason_t spc_emulate_modesense(struct se_cmd *cmd) in spc_emulate_modesense() argument
975 struct se_device *dev = cmd->se_dev; in spc_emulate_modesense()
976 char *cdb = cmd->t_task_cdb; in spc_emulate_modesense()
979 int ten = (cmd->t_task_cdb[0] == MODE_SENSE_10); in spc_emulate_modesense()
988 bool read_only = target_lun_is_rdonly(cmd);; in spc_emulate_modesense()
999 if ((cmd->se_lun->lun_access & TRANSPORT_LUNFLAGS_READ_ONLY) || read_only) in spc_emulate_modesense()
1056 ret = modesense_handlers[i].emulate(cmd, pc, &buf[length]); in spc_emulate_modesense()
1069 length += modesense_handlers[i].emulate(cmd, pc, &buf[length]); in spc_emulate_modesense()
1089 rbuf = transport_kmap_data_sg(cmd); in spc_emulate_modesense()
1091 memcpy(rbuf, buf, min_t(u32, SE_MODE_PAGE_BUF, cmd->data_length)); in spc_emulate_modesense()
1092 transport_kunmap_data_sg(cmd); in spc_emulate_modesense()
1095 target_complete_cmd_with_length(cmd, GOOD, length); in spc_emulate_modesense()
1099 static sense_reason_t spc_emulate_modeselect(struct se_cmd *cmd) in spc_emulate_modeselect() argument
1101 char *cdb = cmd->t_task_cdb; in spc_emulate_modeselect()
1112 if (!cmd->data_length) { in spc_emulate_modeselect()
1113 target_complete_cmd(cmd, GOOD); in spc_emulate_modeselect()
1117 if (cmd->data_length < off + 2) in spc_emulate_modeselect()
1120 buf = transport_kmap_data_sg(cmd); in spc_emulate_modeselect()
1136 length = modesense_handlers[i].emulate(cmd, 0, tbuf); in spc_emulate_modeselect()
1144 if (cmd->data_length < off + length) { in spc_emulate_modeselect()
1153 transport_kunmap_data_sg(cmd); in spc_emulate_modeselect()
1156 target_complete_cmd(cmd, GOOD); in spc_emulate_modeselect()
1160 static sense_reason_t spc_emulate_request_sense(struct se_cmd *cmd) in spc_emulate_request_sense() argument
1162 unsigned char *cdb = cmd->t_task_cdb; in spc_emulate_request_sense()
1166 bool desc_format = target_sense_desc_format(cmd->se_dev); in spc_emulate_request_sense()
1176 rbuf = transport_kmap_data_sg(cmd); in spc_emulate_request_sense()
1180 if (!core_scsi3_ua_clear_for_request_sense(cmd, &ua_asc, &ua_ascq)) in spc_emulate_request_sense()
1186 memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length)); in spc_emulate_request_sense()
1187 transport_kunmap_data_sg(cmd); in spc_emulate_request_sense()
1189 target_complete_cmd(cmd, GOOD); in spc_emulate_request_sense()
1193 sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd) in spc_emulate_report_luns() argument
1196 struct se_session *sess = cmd->se_sess; in spc_emulate_report_luns()
1203 buf = transport_kmap_data_sg(cmd); in spc_emulate_report_luns()
1204 if (cmd->data_length && !buf) in spc_emulate_report_luns()
1225 if (offset >= cmd->data_length) in spc_emulate_report_luns()
1230 min(8u, cmd->data_length - offset)); in spc_emulate_report_luns()
1244 if (cmd->data_length > 8) in spc_emulate_report_luns()
1246 min(8u, cmd->data_length - offset)); in spc_emulate_report_luns()
1252 memcpy(buf, &len, min_t(int, sizeof len, cmd->data_length)); in spc_emulate_report_luns()
1253 transport_kunmap_data_sg(cmd); in spc_emulate_report_luns()
1256 target_complete_cmd_with_length(cmd, GOOD, 8 + lun_count * 8); in spc_emulate_report_luns()
1262 spc_emulate_testunitready(struct se_cmd *cmd) in spc_emulate_testunitready() argument
1264 target_complete_cmd(cmd, GOOD); in spc_emulate_testunitready()
1269 spc_parse_cdb(struct se_cmd *cmd, unsigned int *size) in spc_parse_cdb() argument
1271 struct se_device *dev = cmd->se_dev; in spc_parse_cdb()
1272 unsigned char *cdb = cmd->t_task_cdb; in spc_parse_cdb()
1277 cmd->execute_cmd = spc_emulate_modeselect; in spc_parse_cdb()
1281 cmd->execute_cmd = spc_emulate_modeselect; in spc_parse_cdb()
1285 cmd->execute_cmd = spc_emulate_modesense; in spc_parse_cdb()
1289 cmd->execute_cmd = spc_emulate_modesense; in spc_parse_cdb()
1297 cmd->execute_cmd = target_scsi3_emulate_pr_in; in spc_parse_cdb()
1301 cmd->execute_cmd = target_scsi3_emulate_pr_out; in spc_parse_cdb()
1308 *size = cmd->data_length; in spc_parse_cdb()
1310 cmd->execute_cmd = target_scsi2_reservation_release; in spc_parse_cdb()
1321 *size = cmd->data_length; in spc_parse_cdb()
1323 cmd->execute_cmd = target_scsi2_reservation_reserve; in spc_parse_cdb()
1327 cmd->execute_cmd = spc_emulate_request_sense; in spc_parse_cdb()
1336 cmd->sam_task_attr = TCM_HEAD_TAG; in spc_parse_cdb()
1337 cmd->execute_cmd = spc_emulate_inquiry; in spc_parse_cdb()
1345 cmd->execute_cmd = target_do_xcopy; in spc_parse_cdb()
1349 cmd->execute_cmd = target_do_receive_copy_results; in spc_parse_cdb()
1364 cmd->execute_cmd = spc_emulate_report_luns; in spc_parse_cdb()
1370 cmd->sam_task_attr = TCM_HEAD_TAG; in spc_parse_cdb()
1373 cmd->execute_cmd = spc_emulate_testunitready; in spc_parse_cdb()
1383 cmd->execute_cmd = in spc_parse_cdb()
1401 cmd->execute_cmd = in spc_parse_cdb()