Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending

* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (26 commits)
target: Set additional sense length field in sense data
target: Remove legacy device status check from transport_execute_tasks
target: Remove __transport_execute_tasks() for each processing context
target: Remove extra se_device->execute_task_lock access in fast path
target: Drop se_device TCQ queue_depth usage from I/O path
target: Fix possible NULL pointer with __transport_execute_tasks
target: Remove TFO->check_release_cmd() fabric API caller
tcm_fc: Convert ft_send_work to use target_submit_cmd
target: Add target_submit_cmd() for process context fabric submission
target: Make target_put_sess_cmd use target_release_cmd_kref
target: Set response format in INQUIRY response
target: tcm_mod_builder: small fixups
Documentation/target: Fix tcm_mod_builder.py build breakage
target: remove overagressive ____cacheline_aligned annoations
tcm_loop: bump max_sectors
target/configs: remove trailing newline from udev_path and alias
iscsi-target: fix chap identifier simple_strtoul usage
target: remove useless casts
target: simplify target_check_cdb_and_preempt
target: Move core_scsi3_check_cdb_abort_and_preempt
...

+828 -1013
+15 -45
Documentation/target/tcm_mod_builder.py
··· 230 230 buf += "#include <linux/ctype.h>\n" 231 231 buf += "#include <asm/unaligned.h>\n\n" 232 232 buf += "#include <target/target_core_base.h>\n" 233 - buf += "#include <target/target_core_transport.h>\n" 234 - buf += "#include <target/target_core_fabric_ops.h>\n" 233 + buf += "#include <target/target_core_fabric.h>\n" 235 234 buf += "#include <target/target_core_fabric_configfs.h>\n" 236 - buf += "#include <target/target_core_fabric_lib.h>\n" 237 - buf += "#include <target/target_core_device.h>\n" 238 - buf += "#include <target/target_core_tpg.h>\n" 239 235 buf += "#include <target/target_core_configfs.h>\n" 240 - buf += "#include <target/target_core_base.h>\n" 241 236 buf += "#include <target/configfs_macros.h>\n\n" 242 237 buf += "#include \"" + fabric_mod_name + "_base.h\"\n" 243 238 buf += "#include \"" + fabric_mod_name + "_fabric.h\"\n\n" ··· 255 260 buf += " /* " + fabric_mod_name + "_parse_wwn(name, &wwpn, 1) < 0)\n" 256 261 buf += " return ERR_PTR(-EINVAL); */\n" 257 262 buf += " se_nacl_new = " + fabric_mod_name + "_alloc_fabric_acl(se_tpg);\n" 258 - buf += " if (!(se_nacl_new))\n" 263 + buf += " if (!se_nacl_new)\n" 259 264 buf += " return ERR_PTR(-ENOMEM);\n" 260 265 buf += "//#warning FIXME: Hardcoded nexus depth in " + fabric_mod_name + "_make_nodeacl()\n" 261 266 buf += " nexus_depth = 1;\n" ··· 303 308 buf += " if (strict_strtoul(name + 5, 10, &tpgt) || tpgt > UINT_MAX)\n" 304 309 buf += " return ERR_PTR(-EINVAL);\n\n" 305 310 buf += " tpg = kzalloc(sizeof(struct " + fabric_mod_name + "_tpg), GFP_KERNEL);\n" 306 - buf += " if (!(tpg)) {\n" 311 + buf += " if (!tpg) {\n" 307 312 buf += " printk(KERN_ERR \"Unable to allocate struct " + fabric_mod_name + "_tpg\");\n" 308 313 buf += " return ERR_PTR(-ENOMEM);\n" 309 314 buf += " }\n" ··· 339 344 buf += " /* if (" + fabric_mod_name + "_parse_wwn(name, &wwpn, 1) < 0)\n" 340 345 buf += " return ERR_PTR(-EINVAL); */\n\n" 341 346 buf += " " + fabric_mod_port + " = kzalloc(sizeof(struct " + fabric_mod_name + "_" + fabric_mod_port + "), GFP_KERNEL);\n" 342 - buf += " if (!(" + fabric_mod_port + ")) {\n" 347 + buf += " if (!" + fabric_mod_port + ") {\n" 343 348 buf += " printk(KERN_ERR \"Unable to allocate struct " + fabric_mod_name + "_" + fabric_mod_port + "\");\n" 344 349 buf += " return ERR_PTR(-ENOMEM);\n" 345 350 buf += " }\n" ··· 347 352 if proto_ident == "FC" or proto_ident == "SAS": 348 353 buf += " " + fabric_mod_port + "->" + fabric_mod_port + "_wwpn = wwpn;\n" 349 354 350 - buf += " /* " + fabric_mod_name + "_format_wwn(&" + fabric_mod_port + "->" + fabric_mod_port + "_name[0], " + fabric_mod_name.upper() + "__NAMELEN, wwpn); */\n\n" 355 + buf += " /* " + fabric_mod_name + "_format_wwn(&" + fabric_mod_port + "->" + fabric_mod_port + "_name[0], " + fabric_mod_name.upper() + "_NAMELEN, wwpn); */\n\n" 351 356 buf += " return &" + fabric_mod_port + "->" + fabric_mod_port + "_wwn;\n" 352 357 buf += "}\n\n" 353 358 buf += "static void " + fabric_mod_name + "_drop_" + fabric_mod_port + "(struct se_wwn *wwn)\n" ··· 386 391 buf += " .tpg_alloc_fabric_acl = " + fabric_mod_name + "_alloc_fabric_acl,\n" 387 392 buf += " .tpg_release_fabric_acl = " + fabric_mod_name + "_release_fabric_acl,\n" 388 393 buf += " .tpg_get_inst_index = " + fabric_mod_name + "_tpg_get_inst_index,\n" 389 - buf += " .release_cmd_to_pool = " + fabric_mod_name + "_release_cmd,\n" 390 - buf += " .release_cmd_direct = " + fabric_mod_name + "_release_cmd,\n" 394 + buf += " .release_cmd = " + fabric_mod_name + "_release_cmd,\n" 391 395 buf += " .shutdown_session = " + fabric_mod_name + "_shutdown_session,\n" 392 396 buf += " .close_session = " + fabric_mod_name + "_close_session,\n" 393 397 buf += " .stop_session = " + fabric_mod_name + "_stop_session,\n" ··· 399 405 buf += " .set_default_node_attributes = " + fabric_mod_name + "_set_default_node_attrs,\n" 400 406 buf += " .get_task_tag = " + fabric_mod_name + "_get_task_tag,\n" 401 407 buf += " .get_cmd_state = " + fabric_mod_name + "_get_cmd_state,\n" 402 - buf += " .new_cmd_failure = " + fabric_mod_name + "_new_cmd_failure,\n" 403 408 buf += " .queue_data_in = " + fabric_mod_name + "_queue_data_in,\n" 404 409 buf += " .queue_status = " + fabric_mod_name + "_queue_status,\n" 405 410 buf += " .queue_tm_rsp = " + fabric_mod_name + "_queue_tm_rsp,\n" 406 411 buf += " .get_fabric_sense_len = " + fabric_mod_name + "_get_fabric_sense_len,\n" 407 412 buf += " .set_fabric_sense_len = " + fabric_mod_name + "_set_fabric_sense_len,\n" 408 413 buf += " .is_state_remove = " + fabric_mod_name + "_is_state_remove,\n" 409 - buf += " .pack_lun = " + fabric_mod_name + "_pack_lun,\n" 410 414 buf += " /*\n" 411 415 buf += " * Setup function pointers for generic logic in target_core_fabric_configfs.c\n" 412 416 buf += " */\n" ··· 431 439 buf += " * Register the top level struct config_item_type with TCM core\n" 432 440 buf += " */\n" 433 441 buf += " fabric = target_fabric_configfs_init(THIS_MODULE, \"" + fabric_mod_name[4:] + "\");\n" 434 - buf += " if (!(fabric)) {\n" 442 + buf += " if (IS_ERR(fabric)) {\n" 435 443 buf += " printk(KERN_ERR \"target_fabric_configfs_init() failed\\n\");\n" 436 - buf += " return -ENOMEM;\n" 444 + buf += " return PTR_ERR(fabric);\n" 437 445 buf += " }\n" 438 446 buf += " /*\n" 439 447 buf += " * Setup fabric->tf_ops from our local " + fabric_mod_name + "_ops\n" ··· 467 475 buf += " printk(KERN_INFO \"" + fabric_mod_name.upper() + "[0] - Set fabric -> " + fabric_mod_name + "_fabric_configfs\\n\");\n" 468 476 buf += " return 0;\n" 469 477 buf += "};\n\n" 470 - buf += "static void " + fabric_mod_name + "_deregister_configfs(void)\n" 478 + buf += "static void __exit " + fabric_mod_name + "_deregister_configfs(void)\n" 471 479 buf += "{\n" 472 - buf += " if (!(" + fabric_mod_name + "_fabric_configfs))\n" 480 + buf += " if (!" + fabric_mod_name + "_fabric_configfs)\n" 473 481 buf += " return;\n\n" 474 482 buf += " target_fabric_configfs_deregister(" + fabric_mod_name + "_fabric_configfs);\n" 475 483 buf += " " + fabric_mod_name + "_fabric_configfs = NULL;\n" ··· 484 492 buf += " return ret;\n\n" 485 493 buf += " return 0;\n" 486 494 buf += "};\n\n" 487 - buf += "static void " + fabric_mod_name + "_exit(void)\n" 495 + buf += "static void __exit " + fabric_mod_name + "_exit(void)\n" 488 496 buf += "{\n" 489 497 buf += " " + fabric_mod_name + "_deregister_configfs();\n" 490 498 buf += "};\n\n" 491 499 492 - buf += "#ifdef MODULE\n" 493 500 buf += "MODULE_DESCRIPTION(\"" + fabric_mod_name.upper() + " series fabric driver\");\n" 494 501 buf += "MODULE_LICENSE(\"GPL\");\n" 495 502 buf += "module_init(" + fabric_mod_name + "_init);\n" 496 503 buf += "module_exit(" + fabric_mod_name + "_exit);\n" 497 - buf += "#endif\n" 498 504 499 505 ret = p.write(buf) 500 506 if ret: ··· 504 514 505 515 def tcm_mod_scan_fabric_ops(tcm_dir): 506 516 507 - fabric_ops_api = tcm_dir + "include/target/target_core_fabric_ops.h" 517 + fabric_ops_api = tcm_dir + "include/target/target_core_fabric.h" 508 518 509 519 print "Using tcm_mod_scan_fabric_ops: " + fabric_ops_api 510 520 process_fo = 0; ··· 569 579 buf += "#include <scsi/scsi_cmnd.h>\n" 570 580 buf += "#include <scsi/libfc.h>\n\n" 571 581 buf += "#include <target/target_core_base.h>\n" 572 - buf += "#include <target/target_core_transport.h>\n" 573 - buf += "#include <target/target_core_fabric_ops.h>\n" 574 - buf += "#include <target/target_core_fabric_lib.h>\n" 575 - buf += "#include <target/target_core_device.h>\n" 576 - buf += "#include <target/target_core_tpg.h>\n" 582 + buf += "#include <target/target_core_fabric.h>\n" 577 583 buf += "#include <target/target_core_configfs.h>\n\n" 578 584 buf += "#include \"" + fabric_mod_name + "_base.h\"\n" 579 585 buf += "#include \"" + fabric_mod_name + "_fabric.h\"\n\n" ··· 774 788 buf += "{\n" 775 789 buf += " struct " + fabric_mod_name + "_nacl *nacl;\n\n" 776 790 buf += " nacl = kzalloc(sizeof(struct " + fabric_mod_name + "_nacl), GFP_KERNEL);\n" 777 - buf += " if (!(nacl)) {\n" 791 + buf += " if (!nacl) {\n" 778 792 buf += " printk(KERN_ERR \"Unable to alocate struct " + fabric_mod_name + "_nacl\\n\");\n" 779 793 buf += " return NULL;\n" 780 794 buf += " }\n\n" ··· 801 815 buf += "}\n\n" 802 816 bufi += "u32 " + fabric_mod_name + "_tpg_get_inst_index(struct se_portal_group *);\n" 803 817 804 - if re.search('release_cmd_to_pool', fo): 818 + if re.search('\*release_cmd\)\(', fo): 805 819 buf += "void " + fabric_mod_name + "_release_cmd(struct se_cmd *se_cmd)\n" 806 820 buf += "{\n" 807 821 buf += " return;\n" ··· 885 899 buf += "}\n\n" 886 900 bufi += "int " + fabric_mod_name + "_get_cmd_state(struct se_cmd *);\n" 887 901 888 - if re.search('new_cmd_failure\)\(', fo): 889 - buf += "void " + fabric_mod_name + "_new_cmd_failure(struct se_cmd *se_cmd)\n" 890 - buf += "{\n" 891 - buf += " return;\n" 892 - buf += "}\n\n" 893 - bufi += "void " + fabric_mod_name + "_new_cmd_failure(struct se_cmd *);\n" 894 - 895 902 if re.search('queue_data_in\)\(', fo): 896 903 buf += "int " + fabric_mod_name + "_queue_data_in(struct se_cmd *se_cmd)\n" 897 904 buf += "{\n" ··· 926 947 buf += " return 0;\n" 927 948 buf += "}\n\n" 928 949 bufi += "int " + fabric_mod_name + "_is_state_remove(struct se_cmd *);\n" 929 - 930 - if re.search('pack_lun\)\(', fo): 931 - buf += "u64 " + fabric_mod_name + "_pack_lun(unsigned int lun)\n" 932 - buf += "{\n" 933 - buf += " WARN_ON(lun >= 256);\n" 934 - buf += " /* Caller wants this byte-swapped */\n" 935 - buf += " return cpu_to_le64((lun & 0xff) << 8);\n" 936 - buf += "}\n\n" 937 - bufi += "u64 " + fabric_mod_name + "_pack_lun(unsigned int);\n" 938 950 939 951 940 952 ret = p.write(buf)
+9 -10
drivers/target/iscsi/iscsi_target.c
··· 27 27 #include <scsi/scsi_device.h> 28 28 #include <scsi/iscsi_proto.h> 29 29 #include <target/target_core_base.h> 30 - #include <target/target_core_tmr.h> 31 - #include <target/target_core_transport.h> 30 + #include <target/target_core_fabric.h> 32 31 33 32 #include "iscsi_target_core.h" 34 33 #include "iscsi_target_parameters.h" ··· 283 284 sock_in6 = (struct sockaddr_in6 *)sockaddr; 284 285 sock_in6_e = (struct sockaddr_in6 *)&np->np_sockaddr; 285 286 286 - if (!memcmp((void *)&sock_in6->sin6_addr.in6_u, 287 - (void *)&sock_in6_e->sin6_addr.in6_u, 287 + if (!memcmp(&sock_in6->sin6_addr.in6_u, 288 + &sock_in6_e->sin6_addr.in6_u, 288 289 sizeof(struct in6_addr))) 289 290 ip_match = 1; 290 291 ··· 1224 1225 1225 1226 crypto_hash_init(hash); 1226 1227 1227 - sg_init_one(&sg, (u8 *)buf, payload_length); 1228 + sg_init_one(&sg, buf, payload_length); 1228 1229 crypto_hash_update(hash, &sg, payload_length); 1229 1230 1230 1231 if (padding) { ··· 1602 1603 /* 1603 1604 * Attach ping data to struct iscsi_cmd->buf_ptr. 1604 1605 */ 1605 - cmd->buf_ptr = (void *)ping_data; 1606 + cmd->buf_ptr = ping_data; 1606 1607 cmd->buf_ptr_size = payload_length; 1607 1608 1608 1609 pr_debug("Got %u bytes of NOPOUT ping" ··· 3196 3197 end_of_buf = 1; 3197 3198 goto eob; 3198 3199 } 3199 - memcpy((void *)payload + payload_len, buf, len); 3200 + memcpy(payload + payload_len, buf, len); 3200 3201 payload_len += len; 3201 3202 3202 3203 spin_lock(&tiqn->tiqn_tpg_lock); ··· 3228 3229 end_of_buf = 1; 3229 3230 goto eob; 3230 3231 } 3231 - memcpy((void *)payload + payload_len, buf, len); 3232 + memcpy(payload + payload_len, buf, len); 3232 3233 payload_len += len; 3233 3234 } 3234 3235 spin_unlock(&tpg->tpg_np_lock); ··· 3485 3486 struct iscsi_conn *conn; 3486 3487 struct iscsi_queue_req *qr = NULL; 3487 3488 struct se_cmd *se_cmd; 3488 - struct iscsi_thread_set *ts = (struct iscsi_thread_set *)arg; 3489 + struct iscsi_thread_set *ts = arg; 3489 3490 /* 3490 3491 * Allow ourselves to be interrupted by SIGINT so that a 3491 3492 * connection recovery / failure event can be triggered externally. ··· 3774 3775 u8 buffer[ISCSI_HDR_LEN], opcode; 3775 3776 u32 checksum = 0, digest = 0; 3776 3777 struct iscsi_conn *conn = NULL; 3777 - struct iscsi_thread_set *ts = (struct iscsi_thread_set *)arg; 3778 + struct iscsi_thread_set *ts = arg; 3778 3779 struct kvec iov; 3779 3780 /* 3780 3781 * Allow ourselves to be interrupted by SIGINT so that a
+20 -16
drivers/target/iscsi/iscsi_target_auth.c
··· 82 82 unsigned int *c_len) 83 83 { 84 84 unsigned char challenge_asciihex[CHAP_CHALLENGE_LENGTH * 2 + 1]; 85 - struct iscsi_chap *chap = (struct iscsi_chap *) conn->auth_protocol; 85 + struct iscsi_chap *chap = conn->auth_protocol; 86 86 87 87 memset(challenge_asciihex, 0, CHAP_CHALLENGE_LENGTH * 2 + 1); 88 88 ··· 120 120 if (!conn->auth_protocol) 121 121 return NULL; 122 122 123 - chap = (struct iscsi_chap *) conn->auth_protocol; 123 + chap = conn->auth_protocol; 124 124 /* 125 125 * We only support MD5 MDA presently. 126 126 */ ··· 165 165 unsigned int *nr_out_len) 166 166 { 167 167 char *endptr; 168 - unsigned char id, digest[MD5_SIGNATURE_SIZE]; 168 + unsigned long id; 169 + unsigned char digest[MD5_SIGNATURE_SIZE]; 169 170 unsigned char type, response[MD5_SIGNATURE_SIZE * 2 + 2]; 170 171 unsigned char identifier[10], *challenge = NULL; 171 172 unsigned char *challenge_binhex = NULL; 172 173 unsigned char client_digest[MD5_SIGNATURE_SIZE]; 173 174 unsigned char server_digest[MD5_SIGNATURE_SIZE]; 174 175 unsigned char chap_n[MAX_CHAP_N_SIZE], chap_r[MAX_RESPONSE_LENGTH]; 175 - struct iscsi_chap *chap = (struct iscsi_chap *) conn->auth_protocol; 176 + struct iscsi_chap *chap = conn->auth_protocol; 176 177 struct crypto_hash *tfm; 177 178 struct hash_desc desc; 178 179 struct scatterlist sg; ··· 247 246 goto out; 248 247 } 249 248 250 - sg_init_one(&sg, (void *)&chap->id, 1); 249 + sg_init_one(&sg, &chap->id, 1); 251 250 ret = crypto_hash_update(&desc, &sg, 1); 252 251 if (ret < 0) { 253 252 pr_err("crypto_hash_update() failed for id\n"); ··· 255 254 goto out; 256 255 } 257 256 258 - sg_init_one(&sg, (void *)&auth->password, strlen(auth->password)); 257 + sg_init_one(&sg, &auth->password, strlen(auth->password)); 259 258 ret = crypto_hash_update(&desc, &sg, strlen(auth->password)); 260 259 if (ret < 0) { 261 260 pr_err("crypto_hash_update() failed for password\n"); ··· 263 262 goto out; 264 263 } 265 264 266 - sg_init_one(&sg, (void *)chap->challenge, CHAP_CHALLENGE_LENGTH); 265 + sg_init_one(&sg, chap->challenge, CHAP_CHALLENGE_LENGTH); 267 266 ret = crypto_hash_update(&desc, &sg, CHAP_CHALLENGE_LENGTH); 268 267 if (ret < 0) { 269 268 pr_err("crypto_hash_update() failed for challenge\n"); ··· 306 305 } 307 306 308 307 if (type == HEX) 309 - id = (unsigned char)simple_strtoul((char *)&identifier[2], 310 - &endptr, 0); 308 + id = simple_strtoul(&identifier[2], &endptr, 0); 311 309 else 312 - id = (unsigned char)simple_strtoul(identifier, &endptr, 0); 310 + id = simple_strtoul(identifier, &endptr, 0); 311 + if (id > 255) { 312 + pr_err("chap identifier: %lu greater than 255\n", id); 313 + goto out; 314 + } 313 315 /* 314 316 * RFC 1994 says Identifier is no more than octet (8 bits). 315 317 */ 316 - pr_debug("[server] Got CHAP_I=%d\n", id); 318 + pr_debug("[server] Got CHAP_I=%lu\n", id); 317 319 /* 318 320 * Get CHAP_C. 319 321 */ ··· 355 351 goto out; 356 352 } 357 353 358 - sg_init_one(&sg, (void *)&id, 1); 354 + sg_init_one(&sg, &id, 1); 359 355 ret = crypto_hash_update(&desc, &sg, 1); 360 356 if (ret < 0) { 361 357 pr_err("crypto_hash_update() failed for id\n"); ··· 363 359 goto out; 364 360 } 365 361 366 - sg_init_one(&sg, (void *)auth->password_mutual, 362 + sg_init_one(&sg, auth->password_mutual, 367 363 strlen(auth->password_mutual)); 368 364 ret = crypto_hash_update(&desc, &sg, strlen(auth->password_mutual)); 369 365 if (ret < 0) { ··· 375 371 /* 376 372 * Convert received challenge to binary hex. 377 373 */ 378 - sg_init_one(&sg, (void *)challenge_binhex, challenge_len); 374 + sg_init_one(&sg, challenge_binhex, challenge_len); 379 375 ret = crypto_hash_update(&desc, &sg, challenge_len); 380 376 if (ret < 0) { 381 377 pr_err("crypto_hash_update() failed for ma challenge\n"); ··· 418 414 char *nr_out_ptr, 419 415 unsigned int *nr_out_len) 420 416 { 421 - struct iscsi_chap *chap = (struct iscsi_chap *) conn->auth_protocol; 417 + struct iscsi_chap *chap = conn->auth_protocol; 422 418 423 419 switch (chap->digest_type) { 424 420 case CHAP_DIGEST_MD5: ··· 441 437 int *in_len, 442 438 int *out_len) 443 439 { 444 - struct iscsi_chap *chap = (struct iscsi_chap *) conn->auth_protocol; 440 + struct iscsi_chap *chap = conn->auth_protocol; 445 441 446 442 if (!chap) { 447 443 chap = chap_server_open(conn, auth, in_text, out_text, out_len);
+3 -8
drivers/target/iscsi/iscsi_target_configfs.c
··· 22 22 #include <linux/configfs.h> 23 23 #include <linux/export.h> 24 24 #include <target/target_core_base.h> 25 - #include <target/target_core_transport.h> 26 - #include <target/target_core_fabric_ops.h> 25 + #include <target/target_core_fabric.h> 27 26 #include <target/target_core_fabric_configfs.h> 28 - #include <target/target_core_fabric_lib.h> 29 - #include <target/target_core_device.h> 30 - #include <target/target_core_tpg.h> 31 27 #include <target/target_core_configfs.h> 32 28 #include <target/configfs_macros.h> 33 29 ··· 52 56 { 53 57 struct se_portal_group *se_tpg = container_of(to_config_group(item), 54 58 struct se_portal_group, tpg_group); 55 - struct iscsi_portal_group *tpg = 56 - (struct iscsi_portal_group *)se_tpg->se_tpg_fabric_ptr; 59 + struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr; 57 60 int ret; 58 61 59 62 if (!tpg) { ··· 1220 1225 1221 1226 ret = core_tpg_register( 1222 1227 &lio_target_fabric_configfs->tf_ops, 1223 - wwn, &tpg->tpg_se_tpg, (void *)tpg, 1228 + wwn, &tpg->tpg_se_tpg, tpg, 1224 1229 TRANSPORT_TPG_TYPE_NORMAL); 1225 1230 if (ret < 0) 1226 1231 return NULL;
+1 -2
drivers/target/iscsi/iscsi_target_device.c
··· 21 21 22 22 #include <scsi/scsi_device.h> 23 23 #include <target/target_core_base.h> 24 - #include <target/target_core_device.h> 25 - #include <target/target_core_transport.h> 24 + #include <target/target_core_fabric.h> 26 25 27 26 #include "iscsi_target_core.h" 28 27 #include "iscsi_target_device.h"
+1 -1
drivers/target/iscsi/iscsi_target_erl0.c
··· 21 21 22 22 #include <scsi/iscsi_proto.h> 23 23 #include <target/target_core_base.h> 24 - #include <target/target_core_transport.h> 24 + #include <target/target_core_fabric.h> 25 25 26 26 #include "iscsi_target_core.h" 27 27 #include "iscsi_target_seq_pdu_list.h"
+1 -1
drivers/target/iscsi/iscsi_target_erl1.c
··· 21 21 #include <linux/list.h> 22 22 #include <scsi/iscsi_proto.h> 23 23 #include <target/target_core_base.h> 24 - #include <target/target_core_transport.h> 24 + #include <target/target_core_fabric.h> 25 25 26 26 #include "iscsi_target_core.h" 27 27 #include "iscsi_target_seq_pdu_list.h"
+1 -1
drivers/target/iscsi/iscsi_target_erl2.c
··· 21 21 22 22 #include <scsi/iscsi_proto.h> 23 23 #include <target/target_core_base.h> 24 - #include <target/target_core_transport.h> 24 + #include <target/target_core_fabric.h> 25 25 26 26 #include "iscsi_target_core.h" 27 27 #include "iscsi_target_datain_values.h"
+12 -11
drivers/target/iscsi/iscsi_target_login.c
··· 23 23 #include <linux/crypto.h> 24 24 #include <scsi/iscsi_proto.h> 25 25 #include <target/target_core_base.h> 26 - #include <target/target_core_transport.h> 26 + #include <target/target_core_fabric.h> 27 27 28 28 #include "iscsi_target_core.h" 29 29 #include "iscsi_target_tq.h" ··· 143 143 list_for_each_entry_safe(se_sess, se_sess_tmp, &se_tpg->tpg_sess_list, 144 144 sess_list) { 145 145 146 - sess_p = (struct iscsi_session *)se_sess->fabric_sess_ptr; 146 + sess_p = se_sess->fabric_sess_ptr; 147 147 spin_lock(&sess_p->conn_lock); 148 148 if (atomic_read(&sess_p->session_fall_back_to_erl0) || 149 149 atomic_read(&sess_p->session_logout) || ··· 151 151 spin_unlock(&sess_p->conn_lock); 152 152 continue; 153 153 } 154 - if (!memcmp((void *)sess_p->isid, (void *)conn->sess->isid, 6) && 155 - (!strcmp((void *)sess_p->sess_ops->InitiatorName, 156 - (void *)initiatorname_param->value) && 154 + if (!memcmp(sess_p->isid, conn->sess->isid, 6) && 155 + (!strcmp(sess_p->sess_ops->InitiatorName, 156 + initiatorname_param->value) && 157 157 (sess_p->sess_ops->SessionType == sessiontype))) { 158 158 atomic_set(&sess_p->session_reinstatement, 1); 159 159 spin_unlock(&sess_p->conn_lock); ··· 229 229 230 230 iscsi_login_set_conn_values(sess, conn, pdu->cid); 231 231 sess->init_task_tag = pdu->itt; 232 - memcpy((void *)&sess->isid, (void *)pdu->isid, 6); 232 + memcpy(&sess->isid, pdu->isid, 6); 233 233 sess->exp_cmd_sn = pdu->cmdsn; 234 234 INIT_LIST_HEAD(&sess->sess_conn_list); 235 235 INIT_LIST_HEAD(&sess->sess_ooo_cmdsn_list); ··· 440 440 atomic_read(&sess_p->session_logout) || 441 441 (sess_p->time2retain_timer_flags & ISCSI_TF_EXPIRED)) 442 442 continue; 443 - if (!memcmp((const void *)sess_p->isid, 444 - (const void *)pdu->isid, 6) && 443 + if (!memcmp(sess_p->isid, pdu->isid, 6) && 445 444 (sess_p->tsih == pdu->tsih)) { 446 445 iscsit_inc_session_usage_count(sess_p); 447 446 iscsit_stop_time2retain_timer(sess_p); ··· 653 654 654 655 spin_lock_bh(&se_tpg->session_lock); 655 656 __transport_register_session(&sess->tpg->tpg_se_tpg, 656 - se_sess->se_node_acl, se_sess, (void *)sess); 657 + se_sess->se_node_acl, se_sess, sess); 657 658 pr_debug("Moving to TARG_SESS_STATE_LOGGED_IN.\n"); 658 659 sess->session_state = TARG_SESS_STATE_LOGGED_IN; 659 660 ··· 810 811 * Setup the np->np_sockaddr from the passed sockaddr setup 811 812 * in iscsi_target_configfs.c code.. 812 813 */ 813 - memcpy((void *)&np->np_sockaddr, (void *)sockaddr, 814 + memcpy(&np->np_sockaddr, sockaddr, 814 815 sizeof(struct __kernel_sockaddr_storage)); 815 816 816 817 if (sockaddr->ss_family == AF_INET6) ··· 820 821 /* 821 822 * Set SO_REUSEADDR, and disable Nagel Algorithm with TCP_NODELAY. 822 823 */ 824 + /* FIXME: Someone please explain why this is endian-safe */ 823 825 opt = 1; 824 826 if (np->np_network_transport == ISCSI_TCP) { 825 827 ret = kernel_setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, ··· 832 832 } 833 833 } 834 834 835 + /* FIXME: Someone please explain why this is endian-safe */ 835 836 ret = kernel_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, 836 837 (char *)&opt, sizeof(opt)); 837 838 if (ret < 0) { ··· 1207 1206 1208 1207 int iscsi_target_login_thread(void *arg) 1209 1208 { 1210 - struct iscsi_np *np = (struct iscsi_np *)arg; 1209 + struct iscsi_np *np = arg; 1211 1210 int ret; 1212 1211 1213 1212 allow_signal(SIGINT);
+2 -2
drivers/target/iscsi/iscsi_target_nego.c
··· 21 21 #include <linux/ctype.h> 22 22 #include <scsi/iscsi_proto.h> 23 23 #include <target/target_core_base.h> 24 - #include <target/target_core_tpg.h> 24 + #include <target/target_core_fabric.h> 25 25 26 26 #include "iscsi_target_core.h" 27 27 #include "iscsi_target_parameters.h" ··· 732 732 u32 iqn_size = strlen(param_buf), i; 733 733 734 734 for (i = 0; i < iqn_size; i++) { 735 - c = (char *)&param_buf[i]; 735 + c = &param_buf[i]; 736 736 if (!isupper(*c)) 737 737 continue; 738 738
+1 -2
drivers/target/iscsi/iscsi_target_nodeattrib.c
··· 19 19 ******************************************************************************/ 20 20 21 21 #include <target/target_core_base.h> 22 - #include <target/target_core_transport.h> 23 22 24 23 #include "iscsi_target_core.h" 25 24 #include "iscsi_target_device.h" ··· 134 135 spin_lock_bh(&se_nacl->nacl_sess_lock); 135 136 se_sess = se_nacl->nacl_sess; 136 137 if (se_sess) { 137 - sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; 138 + sess = se_sess->fabric_sess_ptr; 138 139 139 140 spin_lock(&sess->conn_lock); 140 141 list_for_each_entry(conn, &sess->sess_conn_list,
+8 -9
drivers/target/iscsi/iscsi_target_stat.c
··· 23 23 #include <linux/export.h> 24 24 #include <scsi/iscsi_proto.h> 25 25 #include <target/target_core_base.h> 26 - #include <target/target_core_transport.h> 27 26 #include <target/configfs_macros.h> 28 27 29 28 #include "iscsi_target_core.h" ··· 745 746 spin_lock_bh(&se_nacl->nacl_sess_lock); 746 747 se_sess = se_nacl->nacl_sess; 747 748 if (se_sess) { 748 - sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; 749 + sess = se_sess->fabric_sess_ptr; 749 750 if (sess) 750 751 ret = snprintf(page, PAGE_SIZE, "%u\n", 751 752 sess->sess_ops->SessionType ? 0 : ISCSI_NODE_INDEX); ··· 769 770 spin_lock_bh(&se_nacl->nacl_sess_lock); 770 771 se_sess = se_nacl->nacl_sess; 771 772 if (se_sess) { 772 - sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; 773 + sess = se_sess->fabric_sess_ptr; 773 774 if (sess) 774 775 ret = snprintf(page, PAGE_SIZE, "%u\n", 775 776 sess->session_index); ··· 793 794 spin_lock_bh(&se_nacl->nacl_sess_lock); 794 795 se_sess = se_nacl->nacl_sess; 795 796 if (se_sess) { 796 - sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; 797 + sess = se_sess->fabric_sess_ptr; 797 798 if (sess) 798 799 ret = snprintf(page, PAGE_SIZE, "%u\n", sess->cmd_pdus); 799 800 } ··· 816 817 spin_lock_bh(&se_nacl->nacl_sess_lock); 817 818 se_sess = se_nacl->nacl_sess; 818 819 if (se_sess) { 819 - sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; 820 + sess = se_sess->fabric_sess_ptr; 820 821 if (sess) 821 822 ret = snprintf(page, PAGE_SIZE, "%u\n", sess->rsp_pdus); 822 823 } ··· 839 840 spin_lock_bh(&se_nacl->nacl_sess_lock); 840 841 se_sess = se_nacl->nacl_sess; 841 842 if (se_sess) { 842 - sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; 843 + sess = se_sess->fabric_sess_ptr; 843 844 if (sess) 844 845 ret = snprintf(page, PAGE_SIZE, "%llu\n", 845 846 (unsigned long long)sess->tx_data_octets); ··· 863 864 spin_lock_bh(&se_nacl->nacl_sess_lock); 864 865 se_sess = se_nacl->nacl_sess; 865 866 if (se_sess) { 866 - sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; 867 + sess = se_sess->fabric_sess_ptr; 867 868 if (sess) 868 869 ret = snprintf(page, PAGE_SIZE, "%llu\n", 869 870 (unsigned long long)sess->rx_data_octets); ··· 887 888 spin_lock_bh(&se_nacl->nacl_sess_lock); 888 889 se_sess = se_nacl->nacl_sess; 889 890 if (se_sess) { 890 - sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; 891 + sess = se_sess->fabric_sess_ptr; 891 892 if (sess) 892 893 ret = snprintf(page, PAGE_SIZE, "%u\n", 893 894 sess->conn_digest_errors); ··· 911 912 spin_lock_bh(&se_nacl->nacl_sess_lock); 912 913 se_sess = se_nacl->nacl_sess; 913 914 if (se_sess) { 914 - sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; 915 + sess = se_sess->fabric_sess_ptr; 915 916 if (sess) 916 917 ret = snprintf(page, PAGE_SIZE, "%u\n", 917 918 sess->conn_timeout_errors);
+1 -1
drivers/target/iscsi/iscsi_target_tmr.c
··· 21 21 #include <asm/unaligned.h> 22 22 #include <scsi/iscsi_proto.h> 23 23 #include <target/target_core_base.h> 24 - #include <target/target_core_transport.h> 24 + #include <target/target_core_fabric.h> 25 25 26 26 #include "iscsi_target_core.h" 27 27 #include "iscsi_target_seq_pdu_list.h"
+2 -4
drivers/target/iscsi/iscsi_target_tpg.c
··· 19 19 ******************************************************************************/ 20 20 21 21 #include <target/target_core_base.h> 22 - #include <target/target_core_transport.h> 23 - #include <target/target_core_fabric_ops.h> 22 + #include <target/target_core_fabric.h> 24 23 #include <target/target_core_configfs.h> 25 - #include <target/target_core_tpg.h> 26 24 27 25 #include "iscsi_target_core.h" 28 26 #include "iscsi_target_erl0.h" ··· 70 72 71 73 ret = core_tpg_register( 72 74 &lio_target_fabric_configfs->tf_ops, 73 - NULL, &tpg->tpg_se_tpg, (void *)tpg, 75 + NULL, &tpg->tpg_se_tpg, tpg, 74 76 TRANSPORT_TPG_TYPE_DISCOVERY); 75 77 if (ret < 0) { 76 78 kfree(tpg);
+3 -5
drivers/target/iscsi/iscsi_target_util.c
··· 22 22 #include <scsi/scsi_tcq.h> 23 23 #include <scsi/iscsi_proto.h> 24 24 #include <target/target_core_base.h> 25 - #include <target/target_core_transport.h> 26 - #include <target/target_core_tmr.h> 27 - #include <target/target_core_fabric_ops.h> 25 + #include <target/target_core_fabric.h> 28 26 #include <target/target_core_configfs.h> 29 27 30 28 #include "iscsi_target_core.h" ··· 287 289 } 288 290 289 291 se_cmd->se_tmr_req = core_tmr_alloc_req(se_cmd, 290 - (void *)cmd->tmr_req, tcm_function, 292 + cmd->tmr_req, tcm_function, 291 293 GFP_KERNEL); 292 294 if (!se_cmd->se_tmr_req) 293 295 goto out; ··· 1064 1066 if (tiqn) { 1065 1067 spin_lock_bh(&tiqn->sess_err_stats.lock); 1066 1068 strcpy(tiqn->sess_err_stats.last_sess_fail_rem_name, 1067 - (void *)conn->sess->sess_ops->InitiatorName); 1069 + conn->sess->sess_ops->InitiatorName); 1068 1070 tiqn->sess_err_stats.last_sess_failure_type = 1069 1071 ISCSI_SESS_ERR_CXN_TIMEOUT; 1070 1072 tiqn->sess_err_stats.cxn_timeout_errors++;
+11 -22
drivers/target/loopback/tcm_loop.c
··· 33 33 #include <scsi/scsi_cmnd.h> 34 34 35 35 #include <target/target_core_base.h> 36 - #include <target/target_core_transport.h> 37 - #include <target/target_core_fabric_ops.h> 36 + #include <target/target_core_fabric.h> 38 37 #include <target/target_core_fabric_configfs.h> 39 - #include <target/target_core_fabric_lib.h> 40 38 #include <target/target_core_configfs.h> 41 - #include <target/target_core_device.h> 42 - #include <target/target_core_tpg.h> 43 - #include <target/target_core_tmr.h> 44 39 45 40 #include "tcm_loop.h" 46 41 ··· 416 421 .queuecommand = tcm_loop_queuecommand, 417 422 .change_queue_depth = tcm_loop_change_queue_depth, 418 423 .eh_device_reset_handler = tcm_loop_device_reset, 419 - .can_queue = TL_SCSI_CAN_QUEUE, 424 + .can_queue = 1024, 420 425 .this_id = -1, 421 - .sg_tablesize = TL_SCSI_SG_TABLESIZE, 422 - .cmd_per_lun = TL_SCSI_CMD_PER_LUN, 423 - .max_sectors = TL_SCSI_MAX_SECTORS, 426 + .sg_tablesize = 256, 427 + .cmd_per_lun = 1024, 428 + .max_sectors = 0xFFFF, 424 429 .use_clustering = DISABLE_CLUSTERING, 425 430 .slave_alloc = tcm_loop_slave_alloc, 426 431 .slave_configure = tcm_loop_slave_configure, ··· 559 564 560 565 static u8 tcm_loop_get_fabric_proto_ident(struct se_portal_group *se_tpg) 561 566 { 562 - struct tcm_loop_tpg *tl_tpg = 563 - (struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr; 567 + struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr; 564 568 struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; 565 569 /* 566 570 * tl_proto_id is set at tcm_loop_configfs.c:tcm_loop_make_scsi_hba() ··· 586 592 587 593 static char *tcm_loop_get_endpoint_wwn(struct se_portal_group *se_tpg) 588 594 { 589 - struct tcm_loop_tpg *tl_tpg = 590 - (struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr; 595 + struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr; 591 596 /* 592 597 * Return the passed NAA identifier for the SAS Target Port 593 598 */ ··· 595 602 596 603 static u16 tcm_loop_get_tag(struct se_portal_group *se_tpg) 597 604 { 598 - struct tcm_loop_tpg *tl_tpg = 599 - (struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr; 605 + struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr; 600 606 /* 601 607 * This Tag is used when forming SCSI Name identifier in EVPD=1 0x83 602 608 * to represent the SCSI Target Port. ··· 615 623 int *format_code, 616 624 unsigned char *buf) 617 625 { 618 - struct tcm_loop_tpg *tl_tpg = 619 - (struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr; 626 + struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr; 620 627 struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; 621 628 622 629 switch (tl_hba->tl_proto_id) { ··· 644 653 struct t10_pr_registration *pr_reg, 645 654 int *format_code) 646 655 { 647 - struct tcm_loop_tpg *tl_tpg = 648 - (struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr; 656 + struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr; 649 657 struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; 650 658 651 659 switch (tl_hba->tl_proto_id) { ··· 677 687 u32 *out_tid_len, 678 688 char **port_nexus_ptr) 679 689 { 680 - struct tcm_loop_tpg *tl_tpg = 681 - (struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr; 690 + struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr; 682 691 struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; 683 692 684 693 switch (tl_hba->tl_proto_id) {
+1 -10
drivers/target/loopback/tcm_loop.h
··· 1 1 #define TCM_LOOP_VERSION "v2.1-rc1" 2 2 #define TL_WWN_ADDR_LEN 256 3 3 #define TL_TPGS_PER_HBA 32 4 - /* 5 - * Defaults for struct scsi_host_template tcm_loop_driver_template 6 - * 7 - * We use large can_queue and cmd_per_lun here and let TCM enforce 8 - * the underlying se_device_t->queue_depth. 9 - */ 10 - #define TL_SCSI_CAN_QUEUE 1024 11 - #define TL_SCSI_CMD_PER_LUN 1024 12 - #define TL_SCSI_MAX_SECTORS 1024 13 - #define TL_SCSI_SG_TABLESIZE 256 4 + 14 5 /* 15 6 * Used in tcm_loop_driver_probe() for struct Scsi_Host->max_cmd_len 16 7 */
+3 -4
drivers/target/target_core_alua.c
··· 32 32 #include <scsi/scsi_cmnd.h> 33 33 34 34 #include <target/target_core_base.h> 35 - #include <target/target_core_device.h> 36 - #include <target/target_core_transport.h> 37 - #include <target/target_core_fabric_ops.h> 35 + #include <target/target_core_backend.h> 36 + #include <target/target_core_fabric.h> 38 37 #include <target/target_core_configfs.h> 39 38 39 + #include "target_core_internal.h" 40 40 #include "target_core_alua.h" 41 - #include "target_core_hba.h" 42 41 #include "target_core_ua.h" 43 42 44 43 static int core_alua_check_transition(int state, int *primary);
+24 -15
drivers/target/target_core_cdb.c
··· 29 29 #include <scsi/scsi.h> 30 30 31 31 #include <target/target_core_base.h> 32 - #include <target/target_core_transport.h> 33 - #include <target/target_core_fabric_ops.h> 32 + #include <target/target_core_backend.h> 33 + #include <target/target_core_fabric.h> 34 + 35 + #include "target_core_internal.h" 34 36 #include "target_core_ua.h" 35 - #include "target_core_cdb.h" 36 37 37 38 static void 38 39 target_fill_alua_data(struct se_port *port, unsigned char *buf) ··· 95 94 buf[2] = dev->transport->get_device_rev(dev); 96 95 97 96 /* 97 + * NORMACA and HISUP = 0, RESPONSE DATA FORMAT = 2 98 + * 99 + * SPC4 says: 100 + * A RESPONSE DATA FORMAT field set to 2h indicates that the 101 + * standard INQUIRY data is in the format defined in this 102 + * standard. Response data format values less than 2h are 103 + * obsolete. Response data format values greater than 2h are 104 + * reserved. 105 + */ 106 + buf[3] = 2; 107 + 108 + /* 98 109 * Enable SCCS and TPGS fields for Emulated ALUA 99 110 */ 100 111 if (dev->se_sub_dev->t10_alua.alua_type == SPC3_ALUA_EMULATED) ··· 128 115 goto out; 129 116 } 130 117 131 - snprintf((unsigned char *)&buf[8], 8, "LIO-ORG"); 132 - snprintf((unsigned char *)&buf[16], 16, "%s", 133 - &dev->se_sub_dev->t10_wwn.model[0]); 134 - snprintf((unsigned char *)&buf[32], 4, "%s", 135 - &dev->se_sub_dev->t10_wwn.revision[0]); 118 + snprintf(&buf[8], 8, "LIO-ORG"); 119 + snprintf(&buf[16], 16, "%s", dev->se_sub_dev->t10_wwn.model); 120 + snprintf(&buf[32], 4, "%s", dev->se_sub_dev->t10_wwn.revision); 136 121 buf[4] = 31; /* Set additional length to 31 */ 137 122 138 123 out: ··· 149 138 SDF_EMULATED_VPD_UNIT_SERIAL) { 150 139 u32 unit_serial_len; 151 140 152 - unit_serial_len = 153 - strlen(&dev->se_sub_dev->t10_wwn.unit_serial[0]); 141 + unit_serial_len = strlen(dev->se_sub_dev->t10_wwn.unit_serial); 154 142 unit_serial_len++; /* For NULL Terminator */ 155 143 156 144 if (((len + 4) + unit_serial_len) > cmd->data_length) { ··· 158 148 buf[3] = (len & 0xff); 159 149 return 0; 160 150 } 161 - len += sprintf((unsigned char *)&buf[4], "%s", 162 - &dev->se_sub_dev->t10_wwn.unit_serial[0]); 151 + len += sprintf(&buf[4], "%s", 152 + dev->se_sub_dev->t10_wwn.unit_serial); 163 153 len++; /* Extra Byte for NULL Terminator */ 164 154 buf[3] = len; 165 155 } ··· 289 279 len += (prod_len + unit_serial_len); 290 280 goto check_port; 291 281 } 292 - id_len += sprintf((unsigned char *)&buf[off+12], 293 - "%s:%s", prod, 282 + id_len += sprintf(&buf[off+12], "%s:%s", prod, 294 283 &dev->se_sub_dev->t10_wwn.unit_serial[0]); 295 284 } 296 285 buf[off] = 0x2; /* ASCII */ 297 286 buf[off+1] = 0x1; /* T10 Vendor ID */ 298 287 buf[off+2] = 0x0; 299 - memcpy((unsigned char *)&buf[off+4], "LIO-ORG", 8); 288 + memcpy(&buf[off+4], "LIO-ORG", 8); 300 289 /* Extra Byte for NULL Terminator */ 301 290 id_len++; 302 291 /* Identifier Length */
-14
drivers/target/target_core_cdb.h
··· 1 - #ifndef TARGET_CORE_CDB_H 2 - #define TARGET_CORE_CDB_H 3 - 4 - int target_emulate_inquiry(struct se_task *task); 5 - int target_emulate_readcapacity(struct se_task *task); 6 - int target_emulate_readcapacity_16(struct se_task *task); 7 - int target_emulate_modesense(struct se_task *task); 8 - int target_emulate_request_sense(struct se_task *task); 9 - int target_emulate_unmap(struct se_task *task); 10 - int target_emulate_write_same(struct se_task *task); 11 - int target_emulate_synchronize_cache(struct se_task *task); 12 - int target_emulate_noop(struct se_task *task); 13 - 14 - #endif /* TARGET_CORE_CDB_H */
+19 -15
drivers/target/target_core_configfs.c
··· 39 39 #include <linux/spinlock.h> 40 40 41 41 #include <target/target_core_base.h> 42 - #include <target/target_core_device.h> 43 - #include <target/target_core_transport.h> 44 - #include <target/target_core_fabric_ops.h> 42 + #include <target/target_core_backend.h> 43 + #include <target/target_core_fabric.h> 45 44 #include <target/target_core_fabric_configfs.h> 46 45 #include <target/target_core_configfs.h> 47 46 #include <target/configfs_macros.h> 48 47 48 + #include "target_core_internal.h" 49 49 #include "target_core_alua.h" 50 - #include "target_core_hba.h" 51 50 #include "target_core_pr.h" 52 51 #include "target_core_rd.h" 53 - #include "target_core_stat.h" 54 52 55 53 extern struct t10_alua_lu_gp *default_lu_gp; 56 54 ··· 1450 1452 return -ENOMEM; 1451 1453 1452 1454 orig = opts; 1453 - while ((ptr = strsep(&opts, ",")) != NULL) { 1455 + while ((ptr = strsep(&opts, ",\n")) != NULL) { 1454 1456 if (!*ptr) 1455 1457 continue; 1456 1458 ··· 1629 1631 1630 1632 static ssize_t target_core_show_dev_info(void *p, char *page) 1631 1633 { 1632 - struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; 1634 + struct se_subsystem_dev *se_dev = p; 1633 1635 struct se_hba *hba = se_dev->se_dev_hba; 1634 1636 struct se_subsystem_api *t = hba->transport; 1635 1637 int bl = 0; ··· 1657 1659 const char *page, 1658 1660 size_t count) 1659 1661 { 1660 - struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; 1662 + struct se_subsystem_dev *se_dev = p; 1661 1663 struct se_hba *hba = se_dev->se_dev_hba; 1662 1664 struct se_subsystem_api *t = hba->transport; 1663 1665 ··· 1680 1682 1681 1683 static ssize_t target_core_show_dev_alias(void *p, char *page) 1682 1684 { 1683 - struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; 1685 + struct se_subsystem_dev *se_dev = p; 1684 1686 1685 1687 if (!(se_dev->su_dev_flags & SDF_USING_ALIAS)) 1686 1688 return 0; ··· 1693 1695 const char *page, 1694 1696 size_t count) 1695 1697 { 1696 - struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; 1698 + struct se_subsystem_dev *se_dev = p; 1697 1699 struct se_hba *hba = se_dev->se_dev_hba; 1698 1700 ssize_t read_bytes; 1699 1701 ··· 1707 1709 se_dev->su_dev_flags |= SDF_USING_ALIAS; 1708 1710 read_bytes = snprintf(&se_dev->se_dev_alias[0], SE_DEV_ALIAS_LEN, 1709 1711 "%s", page); 1712 + 1713 + if (se_dev->se_dev_alias[read_bytes - 1] == '\n') 1714 + se_dev->se_dev_alias[read_bytes - 1] = '\0'; 1710 1715 1711 1716 pr_debug("Target_Core_ConfigFS: %s/%s set alias: %s\n", 1712 1717 config_item_name(&hba->hba_group.cg_item), ··· 1729 1728 1730 1729 static ssize_t target_core_show_dev_udev_path(void *p, char *page) 1731 1730 { 1732 - struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; 1731 + struct se_subsystem_dev *se_dev = p; 1733 1732 1734 1733 if (!(se_dev->su_dev_flags & SDF_USING_UDEV_PATH)) 1735 1734 return 0; ··· 1742 1741 const char *page, 1743 1742 size_t count) 1744 1743 { 1745 - struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; 1744 + struct se_subsystem_dev *se_dev = p; 1746 1745 struct se_hba *hba = se_dev->se_dev_hba; 1747 1746 ssize_t read_bytes; 1748 1747 ··· 1756 1755 se_dev->su_dev_flags |= SDF_USING_UDEV_PATH; 1757 1756 read_bytes = snprintf(&se_dev->se_dev_udev_path[0], SE_UDEV_PATH_LEN, 1758 1757 "%s", page); 1758 + 1759 + if (se_dev->se_dev_udev_path[read_bytes - 1] == '\n') 1760 + se_dev->se_dev_udev_path[read_bytes - 1] = '\0'; 1759 1761 1760 1762 pr_debug("Target_Core_ConfigFS: %s/%s set udev_path: %s\n", 1761 1763 config_item_name(&hba->hba_group.cg_item), ··· 1781 1777 const char *page, 1782 1778 size_t count) 1783 1779 { 1784 - struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; 1780 + struct se_subsystem_dev *se_dev = p; 1785 1781 struct se_device *dev; 1786 1782 struct se_hba *hba = se_dev->se_dev_hba; 1787 1783 struct se_subsystem_api *t = hba->transport; ··· 1826 1822 static ssize_t target_core_show_alua_lu_gp(void *p, char *page) 1827 1823 { 1828 1824 struct se_device *dev; 1829 - struct se_subsystem_dev *su_dev = (struct se_subsystem_dev *)p; 1825 + struct se_subsystem_dev *su_dev = p; 1830 1826 struct config_item *lu_ci; 1831 1827 struct t10_alua_lu_gp *lu_gp; 1832 1828 struct t10_alua_lu_gp_member *lu_gp_mem; ··· 1864 1860 size_t count) 1865 1861 { 1866 1862 struct se_device *dev; 1867 - struct se_subsystem_dev *su_dev = (struct se_subsystem_dev *)p; 1863 + struct se_subsystem_dev *su_dev = p; 1868 1864 struct se_hba *hba = su_dev->se_dev_hba; 1869 1865 struct t10_alua_lu_gp *lu_gp = NULL, *lu_gp_new = NULL; 1870 1866 struct t10_alua_lu_gp_member *lu_gp_mem;
+3 -12
drivers/target/target_core_device.c
··· 42 42 #include <scsi/scsi_device.h> 43 43 44 44 #include <target/target_core_base.h> 45 - #include <target/target_core_device.h> 46 - #include <target/target_core_tpg.h> 47 - #include <target/target_core_transport.h> 48 - #include <target/target_core_fabric_ops.h> 45 + #include <target/target_core_backend.h> 46 + #include <target/target_core_fabric.h> 49 47 48 + #include "target_core_internal.h" 50 49 #include "target_core_alua.h" 51 - #include "target_core_hba.h" 52 50 #include "target_core_pr.h" 53 51 #include "target_core_ua.h" 54 52 ··· 1132 1134 */ 1133 1135 int se_dev_set_queue_depth(struct se_device *dev, u32 queue_depth) 1134 1136 { 1135 - u32 orig_queue_depth = dev->queue_depth; 1136 - 1137 1137 if (atomic_read(&dev->dev_export_obj.obj_access_count)) { 1138 1138 pr_err("dev[%p]: Unable to change SE Device TCQ while" 1139 1139 " dev_export_obj: %d count exists\n", dev, ··· 1165 1169 } 1166 1170 1167 1171 dev->se_sub_dev->se_dev_attrib.queue_depth = dev->queue_depth = queue_depth; 1168 - if (queue_depth > orig_queue_depth) 1169 - atomic_add(queue_depth - orig_queue_depth, &dev->depth_left); 1170 - else if (queue_depth < orig_queue_depth) 1171 - atomic_sub(orig_queue_depth - queue_depth, &dev->depth_left); 1172 - 1173 1172 pr_debug("dev[%p]: SE Device TCQ Depth changed to: %u\n", 1174 1173 dev, queue_depth); 1175 1174 return 0;
+2 -6
drivers/target/target_core_fabric_configfs.c
··· 36 36 #include <linux/configfs.h> 37 37 38 38 #include <target/target_core_base.h> 39 - #include <target/target_core_device.h> 40 - #include <target/target_core_tpg.h> 41 - #include <target/target_core_transport.h> 42 - #include <target/target_core_fabric_ops.h> 39 + #include <target/target_core_fabric.h> 43 40 #include <target/target_core_fabric_configfs.h> 44 41 #include <target/target_core_configfs.h> 45 42 #include <target/configfs_macros.h> 46 43 44 + #include "target_core_internal.h" 47 45 #include "target_core_alua.h" 48 - #include "target_core_hba.h" 49 46 #include "target_core_pr.h" 50 - #include "target_core_stat.h" 51 47 52 48 #define TF_CIT_SETUP(_name, _item_ops, _group_ops, _attrs) \ 53 49 static void target_fabric_setup_##_name##_cit(struct target_fabric_configfs *tf) \
+5 -8
drivers/target/target_core_fabric_lib.c
··· 34 34 #include <scsi/scsi_cmnd.h> 35 35 36 36 #include <target/target_core_base.h> 37 - #include <target/target_core_device.h> 38 - #include <target/target_core_transport.h> 39 - #include <target/target_core_fabric_lib.h> 40 - #include <target/target_core_fabric_ops.h> 37 + #include <target/target_core_fabric.h> 41 38 #include <target/target_core_configfs.h> 42 39 43 - #include "target_core_hba.h" 40 + #include "target_core_internal.h" 44 41 #include "target_core_pr.h" 45 42 46 43 /* ··· 399 402 add_len = ((buf[2] >> 8) & 0xff); 400 403 add_len |= (buf[3] & 0xff); 401 404 402 - tid_len = strlen((char *)&buf[4]); 405 + tid_len = strlen(&buf[4]); 403 406 tid_len += 4; /* Add four bytes for iSCSI Transport ID header */ 404 407 tid_len += 1; /* Add one byte for NULL terminator */ 405 408 padding = ((-tid_len) & 3); ··· 420 423 * format. 421 424 */ 422 425 if (format_code == 0x40) { 423 - p = strstr((char *)&buf[4], ",i,0x"); 426 + p = strstr(&buf[4], ",i,0x"); 424 427 if (!p) { 425 428 pr_err("Unable to locate \",i,0x\" seperator" 426 429 " for Initiator port identifier: %s\n", 427 - (char *)&buf[4]); 430 + &buf[4]); 428 431 return NULL; 429 432 } 430 433 *p = '\0'; /* Terminate iSCSI Name */
+7 -8
drivers/target/target_core_file.c
··· 37 37 #include <scsi/scsi_host.h> 38 38 39 39 #include <target/target_core_base.h> 40 - #include <target/target_core_device.h> 41 - #include <target/target_core_transport.h> 40 + #include <target/target_core_backend.h> 42 41 43 42 #include "target_core_file.h" 44 43 ··· 85 86 static void *fd_allocate_virtdevice(struct se_hba *hba, const char *name) 86 87 { 87 88 struct fd_dev *fd_dev; 88 - struct fd_host *fd_host = (struct fd_host *) hba->hba_ptr; 89 + struct fd_host *fd_host = hba->hba_ptr; 89 90 90 91 fd_dev = kzalloc(sizeof(struct fd_dev), GFP_KERNEL); 91 92 if (!fd_dev) { ··· 113 114 struct se_device *dev; 114 115 struct se_dev_limits dev_limits; 115 116 struct queue_limits *limits; 116 - struct fd_dev *fd_dev = (struct fd_dev *) p; 117 - struct fd_host *fd_host = (struct fd_host *) hba->hba_ptr; 117 + struct fd_dev *fd_dev = p; 118 + struct fd_host *fd_host = hba->hba_ptr; 118 119 mm_segment_t old_fs; 119 120 struct file *file; 120 121 struct inode *inode = NULL; ··· 239 240 */ 240 241 static void fd_free_device(void *p) 241 242 { 242 - struct fd_dev *fd_dev = (struct fd_dev *) p; 243 + struct fd_dev *fd_dev = p; 243 244 244 245 if (fd_dev->fd_file) { 245 246 filp_close(fd_dev->fd_file, NULL); ··· 497 498 498 499 orig = opts; 499 500 500 - while ((ptr = strsep(&opts, ",")) != NULL) { 501 + while ((ptr = strsep(&opts, ",\n")) != NULL) { 501 502 if (!*ptr) 502 503 continue; 503 504 ··· 558 559 559 560 static ssize_t fd_check_configfs_dev_params(struct se_hba *hba, struct se_subsystem_dev *se_dev) 560 561 { 561 - struct fd_dev *fd_dev = (struct fd_dev *) se_dev->se_dev_su_ptr; 562 + struct fd_dev *fd_dev = se_dev->se_dev_su_ptr; 562 563 563 564 if (!(fd_dev->fbd_flags & FBDF_HAS_PATH)) { 564 565 pr_err("Missing fd_dev_name=\n");
+3 -4
drivers/target/target_core_hba.c
··· 37 37 #include <net/tcp.h> 38 38 39 39 #include <target/target_core_base.h> 40 - #include <target/target_core_device.h> 41 - #include <target/target_core_tpg.h> 42 - #include <target/target_core_transport.h> 40 + #include <target/target_core_backend.h> 41 + #include <target/target_core_fabric.h> 43 42 44 - #include "target_core_hba.h" 43 + #include "target_core_internal.h" 45 44 46 45 static LIST_HEAD(subsystem_list); 47 46 static DEFINE_MUTEX(subsystem_mutex);
-7
drivers/target/target_core_hba.h
··· 1 - #ifndef TARGET_CORE_HBA_H 2 - #define TARGET_CORE_HBA_H 3 - 4 - extern struct se_hba *core_alloc_hba(const char *, u32, u32); 5 - extern int core_delete_hba(struct se_hba *); 6 - 7 - #endif /* TARGET_CORE_HBA_H */
+3 -4
drivers/target/target_core_iblock.c
··· 42 42 #include <scsi/scsi_host.h> 43 43 44 44 #include <target/target_core_base.h> 45 - #include <target/target_core_device.h> 46 - #include <target/target_core_transport.h> 45 + #include <target/target_core_backend.h> 47 46 48 47 #include "target_core_iblock.h" 49 48 ··· 390 391 391 392 orig = opts; 392 393 393 - while ((ptr = strsep(&opts, ",")) != NULL) { 394 + while ((ptr = strsep(&opts, ",\n")) != NULL) { 394 395 if (!*ptr) 395 396 continue; 396 397 ··· 464 465 if (bd) { 465 466 bl += sprintf(b + bl, "Major: %d Minor: %d %s\n", 466 467 MAJOR(bd->bd_dev), MINOR(bd->bd_dev), (!bd->bd_contains) ? 467 - "" : (bd->bd_holder == (struct iblock_dev *)ibd) ? 468 + "" : (bd->bd_holder == ibd) ? 468 469 "CLAIMED: IBLOCK" : "CLAIMED: OS"); 469 470 } else { 470 471 bl += sprintf(b + bl, "Major: 0 Minor: 0\n");
+123
drivers/target/target_core_internal.h
··· 1 + #ifndef TARGET_CORE_INTERNAL_H 2 + #define TARGET_CORE_INTERNAL_H 3 + 4 + /* target_core_alua.c */ 5 + extern struct t10_alua_lu_gp *default_lu_gp; 6 + 7 + /* target_core_cdb.c */ 8 + int target_emulate_inquiry(struct se_task *task); 9 + int target_emulate_readcapacity(struct se_task *task); 10 + int target_emulate_readcapacity_16(struct se_task *task); 11 + int target_emulate_modesense(struct se_task *task); 12 + int target_emulate_request_sense(struct se_task *task); 13 + int target_emulate_unmap(struct se_task *task); 14 + int target_emulate_write_same(struct se_task *task); 15 + int target_emulate_synchronize_cache(struct se_task *task); 16 + int target_emulate_noop(struct se_task *task); 17 + 18 + /* target_core_device.c */ 19 + struct se_dev_entry *core_get_se_deve_from_rtpi(struct se_node_acl *, u16); 20 + int core_free_device_list_for_node(struct se_node_acl *, 21 + struct se_portal_group *); 22 + void core_dec_lacl_count(struct se_node_acl *, struct se_cmd *); 23 + void core_update_device_list_access(u32, u32, struct se_node_acl *); 24 + int core_update_device_list_for_node(struct se_lun *, struct se_lun_acl *, 25 + u32, u32, struct se_node_acl *, struct se_portal_group *, int); 26 + void core_clear_lun_from_tpg(struct se_lun *, struct se_portal_group *); 27 + int core_dev_export(struct se_device *, struct se_portal_group *, 28 + struct se_lun *); 29 + void core_dev_unexport(struct se_device *, struct se_portal_group *, 30 + struct se_lun *); 31 + int target_report_luns(struct se_task *); 32 + void se_release_device_for_hba(struct se_device *); 33 + void se_release_vpd_for_dev(struct se_device *); 34 + int se_free_virtual_device(struct se_device *, struct se_hba *); 35 + int se_dev_check_online(struct se_device *); 36 + int se_dev_check_shutdown(struct se_device *); 37 + void se_dev_set_default_attribs(struct se_device *, struct se_dev_limits *); 38 + int se_dev_set_task_timeout(struct se_device *, u32); 39 + int se_dev_set_max_unmap_lba_count(struct se_device *, u32); 40 + int se_dev_set_max_unmap_block_desc_count(struct se_device *, u32); 41 + int se_dev_set_unmap_granularity(struct se_device *, u32); 42 + int se_dev_set_unmap_granularity_alignment(struct se_device *, u32); 43 + int se_dev_set_emulate_dpo(struct se_device *, int); 44 + int se_dev_set_emulate_fua_write(struct se_device *, int); 45 + int se_dev_set_emulate_fua_read(struct se_device *, int); 46 + int se_dev_set_emulate_write_cache(struct se_device *, int); 47 + int se_dev_set_emulate_ua_intlck_ctrl(struct se_device *, int); 48 + int se_dev_set_emulate_tas(struct se_device *, int); 49 + int se_dev_set_emulate_tpu(struct se_device *, int); 50 + int se_dev_set_emulate_tpws(struct se_device *, int); 51 + int se_dev_set_enforce_pr_isids(struct se_device *, int); 52 + int se_dev_set_is_nonrot(struct se_device *, int); 53 + int se_dev_set_emulate_rest_reord(struct se_device *dev, int); 54 + int se_dev_set_queue_depth(struct se_device *, u32); 55 + int se_dev_set_max_sectors(struct se_device *, u32); 56 + int se_dev_set_optimal_sectors(struct se_device *, u32); 57 + int se_dev_set_block_size(struct se_device *, u32); 58 + struct se_lun *core_dev_add_lun(struct se_portal_group *, struct se_hba *, 59 + struct se_device *, u32); 60 + int core_dev_del_lun(struct se_portal_group *, u32); 61 + struct se_lun *core_get_lun_from_tpg(struct se_portal_group *, u32); 62 + struct se_lun_acl *core_dev_init_initiator_node_lun_acl(struct se_portal_group *, 63 + u32, char *, int *); 64 + int core_dev_add_initiator_node_lun_acl(struct se_portal_group *, 65 + struct se_lun_acl *, u32, u32); 66 + int core_dev_del_initiator_node_lun_acl(struct se_portal_group *, 67 + struct se_lun *, struct se_lun_acl *); 68 + void core_dev_free_initiator_node_lun_acl(struct se_portal_group *, 69 + struct se_lun_acl *lacl); 70 + int core_dev_setup_virtual_lun0(void); 71 + void core_dev_release_virtual_lun0(void); 72 + 73 + /* target_core_hba.c */ 74 + struct se_hba *core_alloc_hba(const char *, u32, u32); 75 + int core_delete_hba(struct se_hba *); 76 + 77 + /* target_core_tmr.c */ 78 + int core_tmr_lun_reset(struct se_device *, struct se_tmr_req *, 79 + struct list_head *, struct se_cmd *); 80 + 81 + /* target_core_tpg.c */ 82 + extern struct se_device *g_lun0_dev; 83 + 84 + struct se_node_acl *__core_tpg_get_initiator_node_acl(struct se_portal_group *tpg, 85 + const char *); 86 + struct se_node_acl *core_tpg_get_initiator_node_acl(struct se_portal_group *tpg, 87 + unsigned char *); 88 + void core_tpg_add_node_to_devs(struct se_node_acl *, struct se_portal_group *); 89 + void core_tpg_wait_for_nacl_pr_ref(struct se_node_acl *); 90 + struct se_lun *core_tpg_pre_addlun(struct se_portal_group *, u32); 91 + int core_tpg_post_addlun(struct se_portal_group *, struct se_lun *, 92 + u32, void *); 93 + struct se_lun *core_tpg_pre_dellun(struct se_portal_group *, u32, int *); 94 + int core_tpg_post_dellun(struct se_portal_group *, struct se_lun *); 95 + 96 + /* target_core_transport.c */ 97 + extern struct kmem_cache *se_tmr_req_cache; 98 + 99 + int init_se_kmem_caches(void); 100 + void release_se_kmem_caches(void); 101 + u32 scsi_get_new_index(scsi_index_t); 102 + void transport_subsystem_check_init(void); 103 + void transport_cmd_finish_abort(struct se_cmd *, int); 104 + void __transport_remove_task_from_execute_queue(struct se_task *, 105 + struct se_device *); 106 + unsigned char *transport_dump_cmd_direction(struct se_cmd *); 107 + void transport_dump_dev_state(struct se_device *, char *, int *); 108 + void transport_dump_dev_info(struct se_device *, struct se_lun *, 109 + unsigned long long, char *, int *); 110 + void transport_dump_vpd_proto_id(struct t10_vpd *, unsigned char *, int); 111 + int transport_dump_vpd_assoc(struct t10_vpd *, unsigned char *, int); 112 + int transport_dump_vpd_ident_type(struct t10_vpd *, unsigned char *, int); 113 + int transport_dump_vpd_ident(struct t10_vpd *, unsigned char *, int); 114 + bool target_stop_task(struct se_task *task, unsigned long *flags); 115 + int transport_clear_lun_from_sessions(struct se_lun *); 116 + void transport_send_task_abort(struct se_cmd *); 117 + 118 + /* target_core_stat.c */ 119 + void target_stat_setup_dev_default_groups(struct se_subsystem_dev *); 120 + void target_stat_setup_port_default_groups(struct se_lun *); 121 + void target_stat_setup_mappedlun_default_groups(struct se_lun_acl *); 122 + 123 + #endif /* TARGET_CORE_INTERNAL_H */
+3 -21
drivers/target/target_core_pr.c
··· 33 33 #include <asm/unaligned.h> 34 34 35 35 #include <target/target_core_base.h> 36 - #include <target/target_core_device.h> 37 - #include <target/target_core_tmr.h> 38 - #include <target/target_core_tpg.h> 39 - #include <target/target_core_transport.h> 40 - #include <target/target_core_fabric_ops.h> 36 + #include <target/target_core_backend.h> 37 + #include <target/target_core_fabric.h> 41 38 #include <target/target_core_configfs.h> 42 39 43 - #include "target_core_hba.h" 40 + #include "target_core_internal.h" 44 41 #include "target_core_pr.h" 45 42 #include "target_core_ua.h" 46 43 ··· 2979 2982 kfree(pr_reg->pr_aptpl_buf); 2980 2983 kmem_cache_free(t10_pr_reg_cache, pr_reg); 2981 2984 } 2982 - } 2983 - 2984 - int core_scsi3_check_cdb_abort_and_preempt( 2985 - struct list_head *preempt_and_abort_list, 2986 - struct se_cmd *cmd) 2987 - { 2988 - struct t10_pr_registration *pr_reg, *pr_reg_tmp; 2989 - 2990 - list_for_each_entry_safe(pr_reg, pr_reg_tmp, preempt_and_abort_list, 2991 - pr_reg_abort_list) { 2992 - if (pr_reg->pr_res_key == cmd->pr_res_key) 2993 - return 0; 2994 - } 2995 - 2996 - return 1; 2997 2985 } 2998 2986 2999 2987 static int core_scsi3_pro_preempt(
-2
drivers/target/target_core_pr.h
··· 60 60 struct se_node_acl *); 61 61 extern void core_scsi3_free_all_registrations(struct se_device *); 62 62 extern unsigned char *core_scsi3_pr_dump_type(int); 63 - extern int core_scsi3_check_cdb_abort_and_preempt(struct list_head *, 64 - struct se_cmd *); 65 63 66 64 extern int target_scsi3_emulate_pr_in(struct se_task *task); 67 65 extern int target_scsi3_emulate_pr_out(struct se_task *task);
+9 -11
drivers/target/target_core_pscsi.c
··· 44 44 #include <scsi/scsi_tcq.h> 45 45 46 46 #include <target/target_core_base.h> 47 - #include <target/target_core_device.h> 48 - #include <target/target_core_transport.h> 47 + #include <target/target_core_backend.h> 49 48 50 49 #include "target_core_pscsi.h" 51 50 ··· 104 105 105 106 static int pscsi_pmode_enable_hba(struct se_hba *hba, unsigned long mode_flag) 106 107 { 107 - struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)hba->hba_ptr; 108 + struct pscsi_hba_virt *phv = hba->hba_ptr; 108 109 struct Scsi_Host *sh = phv->phv_lld_host; 109 110 /* 110 111 * Release the struct Scsi_Host ··· 350 351 * scsi_device_put() and the pdv->pdv_sd cleared. 351 352 */ 352 353 pdv->pdv_sd = sd; 353 - 354 354 dev = transport_add_device_to_core_hba(hba, &pscsi_template, 355 355 se_dev, dev_flags, pdv, 356 356 &dev_limits, NULL, NULL); ··· 404 406 __releases(sh->host_lock) 405 407 { 406 408 struct se_device *dev; 407 - struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)pdv->pdv_se_hba->hba_ptr; 409 + struct pscsi_hba_virt *phv = pdv->pdv_se_hba->hba_ptr; 408 410 struct Scsi_Host *sh = sd->host; 409 411 struct block_device *bd; 410 412 u32 dev_flags = 0; ··· 452 454 __releases(sh->host_lock) 453 455 { 454 456 struct se_device *dev; 455 - struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)pdv->pdv_se_hba->hba_ptr; 457 + struct pscsi_hba_virt *phv = pdv->pdv_se_hba->hba_ptr; 456 458 struct Scsi_Host *sh = sd->host; 457 459 u32 dev_flags = 0; 458 460 ··· 487 489 __releases(sh->host_lock) 488 490 { 489 491 struct se_device *dev; 490 - struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)pdv->pdv_se_hba->hba_ptr; 492 + struct pscsi_hba_virt *phv = pdv->pdv_se_hba->hba_ptr; 491 493 struct Scsi_Host *sh = sd->host; 492 494 u32 dev_flags = 0; 493 495 ··· 508 510 struct se_subsystem_dev *se_dev, 509 511 void *p) 510 512 { 511 - struct pscsi_dev_virt *pdv = (struct pscsi_dev_virt *)p; 513 + struct pscsi_dev_virt *pdv = p; 512 514 struct se_device *dev; 513 515 struct scsi_device *sd; 514 - struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)hba->hba_ptr; 516 + struct pscsi_hba_virt *phv = hba->hba_ptr; 515 517 struct Scsi_Host *sh = phv->phv_lld_host; 516 518 int legacy_mode_enable = 0; 517 519 ··· 816 818 817 819 orig = opts; 818 820 819 - while ((ptr = strsep(&opts, ",")) != NULL) { 821 + while ((ptr = strsep(&opts, ",\n")) != NULL) { 820 822 if (!*ptr) 821 823 continue; 822 824 ··· 1142 1144 { 1143 1145 struct pscsi_plugin_task *pt = PSCSI_TASK(task); 1144 1146 1145 - return (unsigned char *)&pt->pscsi_sense[0]; 1147 + return pt->pscsi_sense; 1146 1148 } 1147 1149 1148 1150 /* pscsi_get_device_rev():
+2 -4
drivers/target/target_core_rd.c
··· 37 37 #include <scsi/scsi_host.h> 38 38 39 39 #include <target/target_core_base.h> 40 - #include <target/target_core_device.h> 41 - #include <target/target_core_transport.h> 42 - #include <target/target_core_fabric_ops.h> 40 + #include <target/target_core_backend.h> 43 41 44 42 #include "target_core_rd.h" 45 43 ··· 472 474 473 475 orig = opts; 474 476 475 - while ((ptr = strsep(&opts, ",")) != NULL) { 477 + while ((ptr = strsep(&opts, ",\n")) != NULL) { 476 478 if (!*ptr) 477 479 continue; 478 480
+4 -5
drivers/target/target_core_stat.c
··· 43 43 #include <scsi/scsi_host.h> 44 44 45 45 #include <target/target_core_base.h> 46 - #include <target/target_core_transport.h> 47 - #include <target/target_core_fabric_ops.h> 46 + #include <target/target_core_backend.h> 47 + #include <target/target_core_fabric.h> 48 48 #include <target/target_core_configfs.h> 49 49 #include <target/configfs_macros.h> 50 50 51 - #include "target_core_hba.h" 51 + #include "target_core_internal.h" 52 52 53 53 #ifndef INITIAL_JIFFIES 54 54 #define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-300*HZ)) ··· 1755 1755 /* scsiAttIntrPortName+scsiAttIntrPortIdentifier */ 1756 1756 memset(buf, 0, 64); 1757 1757 if (tpg->se_tpg_tfo->sess_get_initiator_sid != NULL) 1758 - tpg->se_tpg_tfo->sess_get_initiator_sid(se_sess, 1759 - (unsigned char *)&buf[0], 64); 1758 + tpg->se_tpg_tfo->sess_get_initiator_sid(se_sess, buf, 64); 1760 1759 1761 1760 ret = snprintf(page, PAGE_SIZE, "%s+i+%s\n", nacl->initiatorname, buf); 1762 1761 spin_unlock_irq(&nacl->nacl_sess_lock);
-8
drivers/target/target_core_stat.h
··· 1 - #ifndef TARGET_CORE_STAT_H 2 - #define TARGET_CORE_STAT_H 3 - 4 - extern void target_stat_setup_dev_default_groups(struct se_subsystem_dev *); 5 - extern void target_stat_setup_port_default_groups(struct se_lun *); 6 - extern void target_stat_setup_mappedlun_default_groups(struct se_lun_acl *); 7 - 8 - #endif /*** TARGET_CORE_STAT_H ***/
+22 -14
drivers/target/target_core_tmr.c
··· 32 32 #include <scsi/scsi_cmnd.h> 33 33 34 34 #include <target/target_core_base.h> 35 - #include <target/target_core_device.h> 36 - #include <target/target_core_tmr.h> 37 - #include <target/target_core_transport.h> 38 - #include <target/target_core_fabric_ops.h> 35 + #include <target/target_core_backend.h> 36 + #include <target/target_core_fabric.h> 39 37 #include <target/target_core_configfs.h> 40 38 39 + #include "target_core_internal.h" 41 40 #include "target_core_alua.h" 42 41 #include "target_core_pr.h" 43 42 ··· 100 101 transport_cmd_finish_abort(cmd, 0); 101 102 } 102 103 104 + static int target_check_cdb_and_preempt(struct list_head *list, 105 + struct se_cmd *cmd) 106 + { 107 + struct t10_pr_registration *reg; 108 + 109 + if (!list) 110 + return 0; 111 + list_for_each_entry(reg, list, pr_reg_abort_list) { 112 + if (reg->pr_res_key == cmd->pr_res_key) 113 + return 0; 114 + } 115 + 116 + return 1; 117 + } 118 + 103 119 static void core_tmr_drain_tmr_list( 104 120 struct se_device *dev, 105 121 struct se_tmr_req *tmr, ··· 146 132 * parameter (eg: for PROUT PREEMPT_AND_ABORT service action 147 133 * skip non regisration key matching TMRs. 148 134 */ 149 - if (preempt_and_abort_list && 150 - (core_scsi3_check_cdb_abort_and_preempt( 151 - preempt_and_abort_list, cmd) != 0)) 135 + if (target_check_cdb_and_preempt(preempt_and_abort_list, cmd)) 152 136 continue; 153 137 154 138 spin_lock(&cmd->t_state_lock); ··· 223 211 * For PREEMPT_AND_ABORT usage, only process commands 224 212 * with a matching reservation key. 225 213 */ 226 - if (preempt_and_abort_list && 227 - (core_scsi3_check_cdb_abort_and_preempt( 228 - preempt_and_abort_list, cmd) != 0)) 214 + if (target_check_cdb_and_preempt(preempt_and_abort_list, cmd)) 229 215 continue; 230 216 /* 231 217 * Not aborting PROUT PREEMPT_AND_ABORT CDB.. ··· 232 222 continue; 233 223 234 224 list_move_tail(&task->t_state_list, &drain_task_list); 235 - atomic_set(&task->task_state_active, 0); 225 + task->t_state_active = false; 236 226 /* 237 227 * Remove from task execute list before processing drain_task_list 238 228 */ ··· 331 321 * For PREEMPT_AND_ABORT usage, only process commands 332 322 * with a matching reservation key. 333 323 */ 334 - if (preempt_and_abort_list && 335 - (core_scsi3_check_cdb_abort_and_preempt( 336 - preempt_and_abort_list, cmd) != 0)) 324 + if (target_check_cdb_and_preempt(preempt_and_abort_list, cmd)) 337 325 continue; 338 326 /* 339 327 * Not aborting PROUT PREEMPT_AND_ABORT CDB..
+3 -6
drivers/target/target_core_tpg.c
··· 39 39 #include <scsi/scsi_cmnd.h> 40 40 41 41 #include <target/target_core_base.h> 42 - #include <target/target_core_device.h> 43 - #include <target/target_core_tpg.h> 44 - #include <target/target_core_transport.h> 45 - #include <target/target_core_fabric_ops.h> 42 + #include <target/target_core_backend.h> 43 + #include <target/target_core_fabric.h> 46 44 47 - #include "target_core_hba.h" 48 - #include "target_core_stat.h" 45 + #include "target_core_internal.h" 49 46 50 47 extern struct se_device *g_lun0_dev; 51 48
+197 -144
drivers/target/target_core_transport.c
··· 45 45 #include <scsi/scsi_tcq.h> 46 46 47 47 #include <target/target_core_base.h> 48 - #include <target/target_core_device.h> 49 - #include <target/target_core_tmr.h> 50 - #include <target/target_core_tpg.h> 51 - #include <target/target_core_transport.h> 52 - #include <target/target_core_fabric_ops.h> 48 + #include <target/target_core_backend.h> 49 + #include <target/target_core_fabric.h> 53 50 #include <target/target_core_configfs.h> 54 51 52 + #include "target_core_internal.h" 55 53 #include "target_core_alua.h" 56 - #include "target_core_cdb.h" 57 - #include "target_core_hba.h" 58 54 #include "target_core_pr.h" 59 55 #include "target_core_ua.h" 60 56 ··· 68 72 69 73 static int transport_generic_write_pending(struct se_cmd *); 70 74 static int transport_processing_thread(void *param); 71 - static int __transport_execute_tasks(struct se_device *dev); 75 + static int __transport_execute_tasks(struct se_device *dev, struct se_cmd *); 72 76 static void transport_complete_task_attr(struct se_cmd *cmd); 73 77 static void transport_handle_queue_full(struct se_cmd *cmd, 74 78 struct se_device *dev); ··· 208 212 return new_index; 209 213 } 210 214 211 - void transport_init_queue_obj(struct se_queue_obj *qobj) 215 + static void transport_init_queue_obj(struct se_queue_obj *qobj) 212 216 { 213 217 atomic_set(&qobj->queue_cnt, 0); 214 218 INIT_LIST_HEAD(&qobj->qobj_list); 215 219 init_waitqueue_head(&qobj->thread_wq); 216 220 spin_lock_init(&qobj->cmd_queue_lock); 217 221 } 218 - EXPORT_SYMBOL(transport_init_queue_obj); 219 222 220 223 void transport_subsystem_check_init(void) 221 224 { ··· 421 426 if (task->task_flags & TF_ACTIVE) 422 427 continue; 423 428 424 - if (!atomic_read(&task->task_state_active)) 425 - continue; 426 - 427 429 spin_lock_irqsave(&dev->execute_task_lock, flags); 428 - list_del(&task->t_state_list); 429 - pr_debug("Removed ITT: 0x%08x dev: %p task[%p]\n", 430 - cmd->se_tfo->get_task_tag(cmd), dev, task); 431 - spin_unlock_irqrestore(&dev->execute_task_lock, flags); 430 + if (task->t_state_active) { 431 + pr_debug("Removed ITT: 0x%08x dev: %p task[%p]\n", 432 + cmd->se_tfo->get_task_tag(cmd), dev, task); 432 433 433 - atomic_set(&task->task_state_active, 0); 434 - atomic_dec(&cmd->t_task_cdbs_ex_left); 434 + list_del(&task->t_state_list); 435 + atomic_dec(&cmd->t_task_cdbs_ex_left); 436 + task->t_state_active = false; 437 + } 438 + spin_unlock_irqrestore(&dev->execute_task_lock, flags); 435 439 } 440 + 436 441 } 437 442 438 443 /* transport_cmd_check_stop(): ··· 691 696 struct se_cmd *cmd = task->task_se_cmd; 692 697 struct se_device *dev = cmd->se_dev; 693 698 unsigned long flags; 694 - #if 0 695 - pr_debug("task: %p CDB: 0x%02x obj_ptr: %p\n", task, 696 - cmd->t_task_cdb[0], dev); 697 - #endif 698 - if (dev) 699 - atomic_inc(&dev->depth_left); 700 699 701 700 spin_lock_irqsave(&cmd->t_state_lock, flags); 702 701 task->task_flags &= ~TF_ACTIVE; ··· 703 714 if (dev && dev->transport->transport_complete) { 704 715 if (dev->transport->transport_complete(task) != 0) { 705 716 cmd->se_cmd_flags |= SCF_TRANSPORT_TASK_SENSE; 706 - task->task_sense = 1; 717 + task->task_flags |= TF_HAS_SENSE; 707 718 success = 1; 708 719 } 709 720 } ··· 732 743 } 733 744 734 745 if (cmd->t_tasks_failed) { 735 - if (!task->task_error_status) { 736 - task->task_error_status = 737 - TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 738 - cmd->scsi_sense_reason = 739 - TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 740 - } 741 - 746 + cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 742 747 INIT_WORK(&cmd->work, target_complete_failure_work); 743 748 } else { 744 749 atomic_set(&cmd->t_transport_complete, 1); ··· 807 824 head_of_queue = transport_add_task_check_sam_attr(task, task_prev, dev); 808 825 atomic_inc(&dev->execute_tasks); 809 826 810 - if (atomic_read(&task->task_state_active)) 827 + if (task->t_state_active) 811 828 return; 812 829 /* 813 830 * Determine if this task needs to go to HEAD_OF_QUEUE for the ··· 821 838 else 822 839 list_add_tail(&task->t_state_list, &dev->state_task_list); 823 840 824 - atomic_set(&task->task_state_active, 1); 841 + task->t_state_active = true; 825 842 826 843 pr_debug("Added ITT: 0x%08x task[%p] to dev: %p\n", 827 844 task->task_se_cmd->se_tfo->get_task_tag(task->task_se_cmd), ··· 836 853 837 854 spin_lock_irqsave(&cmd->t_state_lock, flags); 838 855 list_for_each_entry(task, &cmd->t_task_list, t_list) { 839 - if (atomic_read(&task->task_state_active)) 840 - continue; 841 - 842 856 spin_lock(&dev->execute_task_lock); 843 - list_add_tail(&task->t_state_list, &dev->state_task_list); 844 - atomic_set(&task->task_state_active, 1); 857 + if (!task->t_state_active) { 858 + list_add_tail(&task->t_state_list, 859 + &dev->state_task_list); 860 + task->t_state_active = true; 845 861 846 - pr_debug("Added ITT: 0x%08x task[%p] to dev: %p\n", 847 - task->task_se_cmd->se_tfo->get_task_tag( 848 - task->task_se_cmd), task, dev); 849 - 862 + pr_debug("Added ITT: 0x%08x task[%p] to dev: %p\n", 863 + task->task_se_cmd->se_tfo->get_task_tag( 864 + task->task_se_cmd), task, dev); 865 + } 850 866 spin_unlock(&dev->execute_task_lock); 851 867 } 852 868 spin_unlock_irqrestore(&cmd->t_state_lock, flags); 853 869 } 854 870 855 - static void transport_add_tasks_from_cmd(struct se_cmd *cmd) 871 + static void __transport_add_tasks_from_cmd(struct se_cmd *cmd) 856 872 { 857 873 struct se_device *dev = cmd->se_dev; 858 874 struct se_task *task, *task_prev = NULL; 859 - unsigned long flags; 860 875 861 - spin_lock_irqsave(&dev->execute_task_lock, flags); 862 876 list_for_each_entry(task, &cmd->t_task_list, t_list) { 863 877 if (!list_empty(&task->t_execute_list)) 864 878 continue; ··· 866 886 __transport_add_task_to_execute_queue(task, task_prev, dev); 867 887 task_prev = task; 868 888 } 889 + } 890 + 891 + static void transport_add_tasks_from_cmd(struct se_cmd *cmd) 892 + { 893 + unsigned long flags; 894 + struct se_device *dev = cmd->se_dev; 895 + 896 + spin_lock_irqsave(&dev->execute_task_lock, flags); 897 + __transport_add_tasks_from_cmd(cmd); 869 898 spin_unlock_irqrestore(&dev->execute_task_lock, flags); 870 899 } 871 900 ··· 885 896 atomic_dec(&dev->execute_tasks); 886 897 } 887 898 888 - void transport_remove_task_from_execute_queue( 899 + static void transport_remove_task_from_execute_queue( 889 900 struct se_task *task, 890 901 struct se_device *dev) 891 902 { ··· 972 983 break; 973 984 } 974 985 975 - *bl += sprintf(b + *bl, " Execute/Left/Max Queue Depth: %d/%d/%d", 976 - atomic_read(&dev->execute_tasks), atomic_read(&dev->depth_left), 977 - dev->queue_depth); 986 + *bl += sprintf(b + *bl, " Execute/Max Queue Depth: %d/%d", 987 + atomic_read(&dev->execute_tasks), dev->queue_depth); 978 988 *bl += sprintf(b + *bl, " SectorSize: %u MaxSectors: %u\n", 979 989 dev->se_sub_dev->se_dev_attrib.block_size, dev->se_sub_dev->se_dev_attrib.max_sectors); 980 990 *bl += sprintf(b + *bl, " "); ··· 1328 1340 spin_lock_init(&dev->se_port_lock); 1329 1341 spin_lock_init(&dev->se_tmr_lock); 1330 1342 spin_lock_init(&dev->qf_cmd_lock); 1331 - 1332 - dev->queue_depth = dev_limits->queue_depth; 1333 - atomic_set(&dev->depth_left, dev->queue_depth); 1334 1343 atomic_set(&dev->dev_ordered_id, 0); 1335 1344 1336 1345 se_dev_set_default_attribs(dev, dev_limits); ··· 1639 1654 } 1640 1655 EXPORT_SYMBOL(transport_handle_cdb_direct); 1641 1656 1657 + /** 1658 + * target_submit_cmd - lookup unpacked lun and submit uninitialized se_cmd 1659 + * 1660 + * @se_cmd: command descriptor to submit 1661 + * @se_sess: associated se_sess for endpoint 1662 + * @cdb: pointer to SCSI CDB 1663 + * @sense: pointer to SCSI sense buffer 1664 + * @unpacked_lun: unpacked LUN to reference for struct se_lun 1665 + * @data_length: fabric expected data transfer length 1666 + * @task_addr: SAM task attribute 1667 + * @data_dir: DMA data direction 1668 + * @flags: flags for command submission from target_sc_flags_tables 1669 + * 1670 + * This may only be called from process context, and also currently 1671 + * assumes internal allocation of fabric payload buffer by target-core. 1672 + **/ 1673 + int target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, 1674 + unsigned char *cdb, unsigned char *sense, u32 unpacked_lun, 1675 + u32 data_length, int task_attr, int data_dir, int flags) 1676 + { 1677 + struct se_portal_group *se_tpg; 1678 + int rc; 1679 + 1680 + se_tpg = se_sess->se_tpg; 1681 + BUG_ON(!se_tpg); 1682 + BUG_ON(se_cmd->se_tfo || se_cmd->se_sess); 1683 + BUG_ON(in_interrupt()); 1684 + /* 1685 + * Initialize se_cmd for target operation. From this point 1686 + * exceptions are handled by sending exception status via 1687 + * target_core_fabric_ops->queue_status() callback 1688 + */ 1689 + transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, 1690 + data_length, data_dir, task_attr, sense); 1691 + /* 1692 + * Obtain struct se_cmd->cmd_kref reference and add new cmd to 1693 + * se_sess->sess_cmd_list. A second kref_get here is necessary 1694 + * for fabrics using TARGET_SCF_ACK_KREF that expect a second 1695 + * kref_put() to happen during fabric packet acknowledgement. 1696 + */ 1697 + target_get_sess_cmd(se_sess, se_cmd, (flags & TARGET_SCF_ACK_KREF)); 1698 + /* 1699 + * Signal bidirectional data payloads to target-core 1700 + */ 1701 + if (flags & TARGET_SCF_BIDI_OP) 1702 + se_cmd->se_cmd_flags |= SCF_BIDI; 1703 + /* 1704 + * Locate se_lun pointer and attach it to struct se_cmd 1705 + */ 1706 + if (transport_lookup_cmd_lun(se_cmd, unpacked_lun) < 0) 1707 + goto out_check_cond; 1708 + /* 1709 + * Sanitize CDBs via transport_generic_cmd_sequencer() and 1710 + * allocate the necessary tasks to complete the received CDB+data 1711 + */ 1712 + rc = transport_generic_allocate_tasks(se_cmd, cdb); 1713 + if (rc != 0) 1714 + goto out_check_cond; 1715 + /* 1716 + * Dispatch se_cmd descriptor to se_lun->lun_se_dev backend 1717 + * for immediate execution of READs, otherwise wait for 1718 + * transport_generic_handle_data() to be called for WRITEs 1719 + * when fabric has filled the incoming buffer. 1720 + */ 1721 + transport_handle_cdb_direct(se_cmd); 1722 + return 0; 1723 + 1724 + out_check_cond: 1725 + transport_send_check_condition_and_sense(se_cmd, 1726 + se_cmd->scsi_sense_reason, 0); 1727 + return 0; 1728 + } 1729 + EXPORT_SYMBOL(target_submit_cmd); 1730 + 1642 1731 /* 1643 1732 * Used by fabric module frontends defining a TFO->new_cmd_map() caller 1644 1733 * to queue up a newly setup se_cmd w/ TRANSPORT_NEW_CMD_MAP in order to ··· 1979 1920 spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); 1980 1921 } 1981 1922 1982 - static inline int transport_tcq_window_closed(struct se_device *dev) 1983 - { 1984 - if (dev->dev_tcq_window_closed++ < 1985 - PYX_TRANSPORT_WINDOW_CLOSED_THRESHOLD) { 1986 - msleep(PYX_TRANSPORT_WINDOW_CLOSED_WAIT_SHORT); 1987 - } else 1988 - msleep(PYX_TRANSPORT_WINDOW_CLOSED_WAIT_LONG); 1989 - 1990 - wake_up_interruptible(&dev->dev_queue_obj.thread_wq); 1991 - return 0; 1992 - } 1993 - 1994 1923 /* 1995 1924 * Called from Fabric Module context from transport_execute_tasks() 1996 1925 * ··· 2061 2014 static int transport_execute_tasks(struct se_cmd *cmd) 2062 2015 { 2063 2016 int add_tasks; 2064 - 2065 - if (se_dev_check_online(cmd->se_dev) != 0) { 2066 - cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 2067 - transport_generic_request_failure(cmd); 2068 - return 0; 2069 - } 2070 - 2017 + struct se_device *se_dev = cmd->se_dev; 2071 2018 /* 2072 2019 * Call transport_cmd_check_stop() to see if a fabric exception 2073 2020 * has occurred that prevents execution. ··· 2075 2034 if (!add_tasks) 2076 2035 goto execute_tasks; 2077 2036 /* 2078 - * This calls transport_add_tasks_from_cmd() to handle 2079 - * HEAD_OF_QUEUE ordering for SAM Task Attribute emulation 2080 - * (if enabled) in __transport_add_task_to_execute_queue() and 2081 - * transport_add_task_check_sam_attr(). 2037 + * __transport_execute_tasks() -> __transport_add_tasks_from_cmd() 2038 + * adds associated se_tasks while holding dev->execute_task_lock 2039 + * before I/O dispath to avoid a double spinlock access. 2082 2040 */ 2083 - transport_add_tasks_from_cmd(cmd); 2041 + __transport_execute_tasks(se_dev, cmd); 2042 + return 0; 2084 2043 } 2085 - /* 2086 - * Kick the execution queue for the cmd associated struct se_device 2087 - * storage object. 2088 - */ 2044 + 2089 2045 execute_tasks: 2090 - __transport_execute_tasks(cmd->se_dev); 2046 + __transport_execute_tasks(se_dev, NULL); 2091 2047 return 0; 2092 2048 } 2093 2049 ··· 2094 2056 * 2095 2057 * Called from transport_processing_thread() 2096 2058 */ 2097 - static int __transport_execute_tasks(struct se_device *dev) 2059 + static int __transport_execute_tasks(struct se_device *dev, struct se_cmd *new_cmd) 2098 2060 { 2099 2061 int error; 2100 2062 struct se_cmd *cmd = NULL; 2101 2063 struct se_task *task = NULL; 2102 2064 unsigned long flags; 2103 2065 2104 - /* 2105 - * Check if there is enough room in the device and HBA queue to send 2106 - * struct se_tasks to the selected transport. 2107 - */ 2108 2066 check_depth: 2109 - if (!atomic_read(&dev->depth_left)) 2110 - return transport_tcq_window_closed(dev); 2111 - 2112 - dev->dev_tcq_window_closed = 0; 2113 - 2114 2067 spin_lock_irq(&dev->execute_task_lock); 2068 + if (new_cmd != NULL) 2069 + __transport_add_tasks_from_cmd(new_cmd); 2070 + 2115 2071 if (list_empty(&dev->execute_task_list)) { 2116 2072 spin_unlock_irq(&dev->execute_task_lock); 2117 2073 return 0; ··· 2115 2083 __transport_remove_task_from_execute_queue(task, dev); 2116 2084 spin_unlock_irq(&dev->execute_task_lock); 2117 2085 2118 - atomic_dec(&dev->depth_left); 2119 - 2120 2086 cmd = task->task_se_cmd; 2121 - 2122 2087 spin_lock_irqsave(&cmd->t_state_lock, flags); 2123 2088 task->task_flags |= (TF_ACTIVE | TF_SENT); 2124 2089 atomic_inc(&cmd->t_task_cdbs_sent); ··· 2136 2107 spin_unlock_irqrestore(&cmd->t_state_lock, flags); 2137 2108 atomic_set(&cmd->t_transport_sent, 0); 2138 2109 transport_stop_tasks_for_cmd(cmd); 2139 - atomic_inc(&dev->depth_left); 2140 2110 transport_generic_request_failure(cmd); 2141 2111 } 2142 2112 2113 + new_cmd = NULL; 2143 2114 goto check_depth; 2144 2115 2145 2116 return 0; ··· 2380 2351 2381 2352 list_for_each_entry_safe(task, task_tmp, 2382 2353 &cmd->t_task_list, t_list) { 2383 - if (!task->task_sense) 2354 + if (!(task->task_flags & TF_HAS_SENSE)) 2384 2355 continue; 2385 2356 2386 2357 if (!dev->transport->get_sense_buffer) { ··· 3375 3346 } 3376 3347 3377 3348 /** 3349 + * transport_release_cmd - free a command 3350 + * @cmd: command to free 3351 + * 3352 + * This routine unconditionally frees a command, and reference counting 3353 + * or list removal must be done in the caller. 3354 + */ 3355 + static void transport_release_cmd(struct se_cmd *cmd) 3356 + { 3357 + BUG_ON(!cmd->se_tfo); 3358 + 3359 + if (cmd->se_tmr_req) 3360 + core_tmr_release_req(cmd->se_tmr_req); 3361 + if (cmd->t_task_cdb != cmd->__t_task_cdb) 3362 + kfree(cmd->t_task_cdb); 3363 + /* 3364 + * If this cmd has been setup with target_get_sess_cmd(), drop 3365 + * the kref and call ->release_cmd() in kref callback. 3366 + */ 3367 + if (cmd->check_release != 0) { 3368 + target_put_sess_cmd(cmd->se_sess, cmd); 3369 + return; 3370 + } 3371 + cmd->se_tfo->release_cmd(cmd); 3372 + } 3373 + 3374 + /** 3378 3375 * transport_put_cmd - release a reference to a command 3379 3376 * @cmd: command to release 3380 3377 * ··· 3925 3870 return 0; 3926 3871 } 3927 3872 3928 - /** 3929 - * transport_release_cmd - free a command 3930 - * @cmd: command to free 3931 - * 3932 - * This routine unconditionally frees a command, and reference counting 3933 - * or list removal must be done in the caller. 3934 - */ 3935 - void transport_release_cmd(struct se_cmd *cmd) 3936 - { 3937 - BUG_ON(!cmd->se_tfo); 3938 - 3939 - if (cmd->se_tmr_req) 3940 - core_tmr_release_req(cmd->se_tmr_req); 3941 - if (cmd->t_task_cdb != cmd->__t_task_cdb) 3942 - kfree(cmd->t_task_cdb); 3943 - /* 3944 - * Check if target_wait_for_sess_cmds() is expecting to 3945 - * release se_cmd directly here.. 3946 - */ 3947 - if (cmd->check_release != 0 && cmd->se_tfo->check_release_cmd) 3948 - if (cmd->se_tfo->check_release_cmd(cmd) != 0) 3949 - return; 3950 - 3951 - cmd->se_tfo->release_cmd(cmd); 3952 - } 3953 - EXPORT_SYMBOL(transport_release_cmd); 3954 - 3955 3873 void transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) 3956 3874 { 3957 3875 if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD)) { ··· 3951 3923 /* target_get_sess_cmd - Add command to active ->sess_cmd_list 3952 3924 * @se_sess: session to reference 3953 3925 * @se_cmd: command descriptor to add 3926 + * @ack_kref: Signal that fabric will perform an ack target_put_sess_cmd() 3954 3927 */ 3955 - void target_get_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd) 3928 + void target_get_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd, 3929 + bool ack_kref) 3956 3930 { 3957 3931 unsigned long flags; 3932 + 3933 + kref_init(&se_cmd->cmd_kref); 3934 + /* 3935 + * Add a second kref if the fabric caller is expecting to handle 3936 + * fabric acknowledgement that requires two target_put_sess_cmd() 3937 + * invocations before se_cmd descriptor release. 3938 + */ 3939 + if (ack_kref == true) 3940 + kref_get(&se_cmd->cmd_kref); 3958 3941 3959 3942 spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); 3960 3943 list_add_tail(&se_cmd->se_cmd_list, &se_sess->sess_cmd_list); ··· 3974 3935 } 3975 3936 EXPORT_SYMBOL(target_get_sess_cmd); 3976 3937 3977 - /* target_put_sess_cmd - Check for active I/O shutdown or list delete 3978 - * @se_sess: session to reference 3979 - * @se_cmd: command descriptor to drop 3980 - */ 3981 - int target_put_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd) 3938 + static void target_release_cmd_kref(struct kref *kref) 3982 3939 { 3940 + struct se_cmd *se_cmd = container_of(kref, struct se_cmd, cmd_kref); 3941 + struct se_session *se_sess = se_cmd->se_sess; 3983 3942 unsigned long flags; 3984 3943 3985 3944 spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); 3986 3945 if (list_empty(&se_cmd->se_cmd_list)) { 3987 3946 spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); 3988 3947 WARN_ON(1); 3989 - return 0; 3948 + return; 3990 3949 } 3991 - 3992 3950 if (se_sess->sess_tearing_down && se_cmd->cmd_wait_set) { 3993 3951 spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); 3994 3952 complete(&se_cmd->cmd_wait_comp); 3995 - return 1; 3953 + return; 3996 3954 } 3997 3955 list_del(&se_cmd->se_cmd_list); 3998 3956 spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); 3999 3957 4000 - return 0; 3958 + se_cmd->se_tfo->release_cmd(se_cmd); 3959 + } 3960 + 3961 + /* target_put_sess_cmd - Check for active I/O shutdown via kref_put 3962 + * @se_sess: session to reference 3963 + * @se_cmd: command descriptor to drop 3964 + */ 3965 + int target_put_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd) 3966 + { 3967 + return kref_put(&se_cmd->cmd_kref, target_release_cmd_kref); 4001 3968 } 4002 3969 EXPORT_SYMBOL(target_put_sess_cmd); 4003 3970 ··· 4219 4174 4220 4175 static int transport_clear_lun_thread(void *p) 4221 4176 { 4222 - struct se_lun *lun = (struct se_lun *)p; 4177 + struct se_lun *lun = p; 4223 4178 4224 4179 __transport_clear_lun_from_sessions(lun); 4225 4180 complete(&lun->lun_shutdown_comp); ··· 4398 4353 case TCM_NON_EXISTENT_LUN: 4399 4354 /* CURRENT ERROR */ 4400 4355 buffer[offset] = 0x70; 4356 + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10; 4401 4357 /* ILLEGAL REQUEST */ 4402 4358 buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST; 4403 4359 /* LOGICAL UNIT NOT SUPPORTED */ ··· 4408 4362 case TCM_SECTOR_COUNT_TOO_MANY: 4409 4363 /* CURRENT ERROR */ 4410 4364 buffer[offset] = 0x70; 4365 + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10; 4411 4366 /* ILLEGAL REQUEST */ 4412 4367 buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST; 4413 4368 /* INVALID COMMAND OPERATION CODE */ ··· 4417 4370 case TCM_UNKNOWN_MODE_PAGE: 4418 4371 /* CURRENT ERROR */ 4419 4372 buffer[offset] = 0x70; 4373 + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10; 4420 4374 /* ILLEGAL REQUEST */ 4421 4375 buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST; 4422 4376 /* INVALID FIELD IN CDB */ ··· 4426 4378 case TCM_CHECK_CONDITION_ABORT_CMD: 4427 4379 /* CURRENT ERROR */ 4428 4380 buffer[offset] = 0x70; 4381 + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10; 4429 4382 /* ABORTED COMMAND */ 4430 4383 buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND; 4431 4384 /* BUS DEVICE RESET FUNCTION OCCURRED */ ··· 4436 4387 case TCM_INCORRECT_AMOUNT_OF_DATA: 4437 4388 /* CURRENT ERROR */ 4438 4389 buffer[offset] = 0x70; 4390 + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10; 4439 4391 /* ABORTED COMMAND */ 4440 4392 buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND; 4441 4393 /* WRITE ERROR */ ··· 4447 4397 case TCM_INVALID_CDB_FIELD: 4448 4398 /* CURRENT ERROR */ 4449 4399 buffer[offset] = 0x70; 4400 + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10; 4450 4401 /* ABORTED COMMAND */ 4451 4402 buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND; 4452 4403 /* INVALID FIELD IN CDB */ ··· 4456 4405 case TCM_INVALID_PARAMETER_LIST: 4457 4406 /* CURRENT ERROR */ 4458 4407 buffer[offset] = 0x70; 4408 + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10; 4459 4409 /* ABORTED COMMAND */ 4460 4410 buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND; 4461 4411 /* INVALID FIELD IN PARAMETER LIST */ ··· 4465 4413 case TCM_UNEXPECTED_UNSOLICITED_DATA: 4466 4414 /* CURRENT ERROR */ 4467 4415 buffer[offset] = 0x70; 4416 + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10; 4468 4417 /* ABORTED COMMAND */ 4469 4418 buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND; 4470 4419 /* WRITE ERROR */ ··· 4476 4423 case TCM_SERVICE_CRC_ERROR: 4477 4424 /* CURRENT ERROR */ 4478 4425 buffer[offset] = 0x70; 4426 + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10; 4479 4427 /* ABORTED COMMAND */ 4480 4428 buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND; 4481 4429 /* PROTOCOL SERVICE CRC ERROR */ ··· 4487 4433 case TCM_SNACK_REJECTED: 4488 4434 /* CURRENT ERROR */ 4489 4435 buffer[offset] = 0x70; 4436 + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10; 4490 4437 /* ABORTED COMMAND */ 4491 4438 buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND; 4492 4439 /* READ ERROR */ ··· 4498 4443 case TCM_WRITE_PROTECTED: 4499 4444 /* CURRENT ERROR */ 4500 4445 buffer[offset] = 0x70; 4446 + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10; 4501 4447 /* DATA PROTECT */ 4502 4448 buffer[offset+SPC_SENSE_KEY_OFFSET] = DATA_PROTECT; 4503 4449 /* WRITE PROTECTED */ ··· 4507 4451 case TCM_CHECK_CONDITION_UNIT_ATTENTION: 4508 4452 /* CURRENT ERROR */ 4509 4453 buffer[offset] = 0x70; 4454 + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10; 4510 4455 /* UNIT ATTENTION */ 4511 4456 buffer[offset+SPC_SENSE_KEY_OFFSET] = UNIT_ATTENTION; 4512 4457 core_scsi3_ua_for_check_condition(cmd, &asc, &ascq); ··· 4517 4460 case TCM_CHECK_CONDITION_NOT_READY: 4518 4461 /* CURRENT ERROR */ 4519 4462 buffer[offset] = 0x70; 4463 + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10; 4520 4464 /* Not Ready */ 4521 4465 buffer[offset+SPC_SENSE_KEY_OFFSET] = NOT_READY; 4522 4466 transport_get_sense_codes(cmd, &asc, &ascq); ··· 4528 4470 default: 4529 4471 /* CURRENT ERROR */ 4530 4472 buffer[offset] = 0x70; 4473 + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10; 4531 4474 /* ILLEGAL REQUEST */ 4532 4475 buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST; 4533 4476 /* LOGICAL UNIT COMMUNICATION FAILURE */ ··· 4604 4545 cmd->se_tfo->queue_status(cmd); 4605 4546 } 4606 4547 4607 - /* transport_generic_do_tmr(): 4608 - * 4609 - * 4610 - */ 4611 - int transport_generic_do_tmr(struct se_cmd *cmd) 4548 + static int transport_generic_do_tmr(struct se_cmd *cmd) 4612 4549 { 4613 4550 struct se_device *dev = cmd->se_dev; 4614 4551 struct se_tmr_req *tmr = cmd->se_tmr_req; ··· 4652 4597 { 4653 4598 int ret; 4654 4599 struct se_cmd *cmd; 4655 - struct se_device *dev = (struct se_device *) param; 4600 + struct se_device *dev = param; 4656 4601 4657 4602 while (!kthread_should_stop()) { 4658 4603 ret = wait_event_interruptible(dev->dev_queue_obj.thread_wq, ··· 4662 4607 goto out; 4663 4608 4664 4609 get_cmd: 4665 - __transport_execute_tasks(dev); 4666 - 4667 4610 cmd = transport_get_cmd_from_queue(&dev->dev_queue_obj); 4668 4611 if (!cmd) 4669 4612 continue;
+2 -4
drivers/target/target_core_ua.c
··· 30 30 #include <scsi/scsi_cmnd.h> 31 31 32 32 #include <target/target_core_base.h> 33 - #include <target/target_core_device.h> 34 - #include <target/target_core_transport.h> 35 - #include <target/target_core_fabric_ops.h> 33 + #include <target/target_core_fabric.h> 36 34 #include <target/target_core_configfs.h> 37 35 36 + #include "target_core_internal.h" 38 37 #include "target_core_alua.h" 39 - #include "target_core_hba.h" 40 38 #include "target_core_pr.h" 41 39 #include "target_core_ua.h" 42 40
+14 -43
drivers/target/tcm_fc/tfc_cmd.c
··· 39 39 #include <scsi/fc_encode.h> 40 40 41 41 #include <target/target_core_base.h> 42 - #include <target/target_core_transport.h> 43 - #include <target/target_core_fabric_ops.h> 44 - #include <target/target_core_device.h> 45 - #include <target/target_core_tpg.h> 42 + #include <target/target_core_fabric.h> 46 43 #include <target/target_core_configfs.h> 47 - #include <target/target_core_tmr.h> 48 44 #include <target/configfs_macros.h> 49 45 50 46 #include "tcm_fc.h" ··· 363 367 struct ft_sess *sess; 364 368 u8 tm_func; 365 369 370 + transport_init_se_cmd(&cmd->se_cmd, &ft_configfs->tf_ops, 371 + cmd->sess->se_sess, 0, DMA_NONE, 0, 372 + &cmd->ft_sense_buffer[0]); 373 + target_get_sess_cmd(cmd->sess->se_sess, &cmd->se_cmd, false); 374 + 366 375 fcp = fc_frame_payload_get(cmd->req_frame, sizeof(*fcp)); 367 376 368 377 switch (fcp->fc_tm_flags) { ··· 421 420 sess = cmd->sess; 422 421 transport_send_check_condition_and_sense(&cmd->se_cmd, 423 422 cmd->se_cmd.scsi_sense_reason, 0); 424 - transport_generic_free_cmd(&cmd->se_cmd, 0); 425 423 ft_sess_put(sess); 426 424 return; 427 425 } ··· 536 536 { 537 537 struct ft_cmd *cmd = container_of(work, struct ft_cmd, work); 538 538 struct fc_frame_header *fh = fc_frame_header_get(cmd->req_frame); 539 - struct se_cmd *se_cmd; 540 539 struct fcp_cmnd *fcp; 541 540 int data_dir = 0; 542 541 u32 data_len; ··· 590 591 data_len = ntohl(fcp->fc_dl); 591 592 cmd->cdb = fcp->fc_cdb; 592 593 } 593 - 594 - se_cmd = &cmd->se_cmd; 595 - /* 596 - * Initialize struct se_cmd descriptor from target_core_mod 597 - * infrastructure 598 - */ 599 - transport_init_se_cmd(se_cmd, &ft_configfs->tf_ops, cmd->sess->se_sess, 600 - data_len, data_dir, task_attr, 601 - &cmd->ft_sense_buffer[0]); 602 594 /* 603 595 * Check for FCP task management flags 604 596 */ ··· 597 607 ft_send_tm(cmd); 598 608 return; 599 609 } 600 - 601 610 fc_seq_exch(cmd->seq)->lp->tt.seq_set_resp(cmd->seq, ft_recv_seq, cmd); 602 - 603 611 cmd->lun = scsilun_to_int((struct scsi_lun *)fcp->fc_lun); 604 - ret = transport_lookup_cmd_lun(&cmd->se_cmd, cmd->lun); 612 + /* 613 + * Use a single se_cmd->cmd_kref as we expect to release se_cmd 614 + * directly from ft_check_stop_free callback in response path. 615 + */ 616 + ret = target_submit_cmd(&cmd->se_cmd, cmd->sess->se_sess, cmd->cdb, 617 + &cmd->ft_sense_buffer[0], cmd->lun, data_len, 618 + task_attr, data_dir, 0); 619 + pr_debug("r_ctl %x alloc target_submit_cmd %d\n", fh->fh_r_ctl, ret); 605 620 if (ret < 0) { 606 621 ft_dump_cmd(cmd, __func__); 607 - transport_send_check_condition_and_sense(&cmd->se_cmd, 608 - cmd->se_cmd.scsi_sense_reason, 0); 609 622 return; 610 623 } 611 - 612 - ret = transport_generic_allocate_tasks(se_cmd, cmd->cdb); 613 - 614 - pr_debug("r_ctl %x alloc task ret %d\n", fh->fh_r_ctl, ret); 615 - ft_dump_cmd(cmd, __func__); 616 - 617 - if (ret == -ENOMEM) { 618 - transport_send_check_condition_and_sense(se_cmd, 619 - TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); 620 - transport_generic_free_cmd(se_cmd, 0); 621 - return; 622 - } 623 - if (ret == -EINVAL) { 624 - if (se_cmd->se_cmd_flags & SCF_SCSI_RESERVATION_CONFLICT) 625 - ft_queue_status(se_cmd); 626 - else 627 - transport_send_check_condition_and_sense(se_cmd, 628 - se_cmd->scsi_sense_reason, 0); 629 - transport_generic_free_cmd(se_cmd, 0); 630 - return; 631 - } 632 - transport_handle_cdb_direct(se_cmd); 633 624 return; 634 625 635 626 err:
+1 -5
drivers/target/tcm_fc/tfc_conf.c
··· 41 41 #include <scsi/libfc.h> 42 42 43 43 #include <target/target_core_base.h> 44 - #include <target/target_core_transport.h> 45 - #include <target/target_core_fabric_ops.h> 44 + #include <target/target_core_fabric.h> 46 45 #include <target/target_core_fabric_configfs.h> 47 - #include <target/target_core_fabric_lib.h> 48 - #include <target/target_core_device.h> 49 - #include <target/target_core_tpg.h> 50 46 #include <target/target_core_configfs.h> 51 47 #include <target/configfs_macros.h> 52 48
+1 -4
drivers/target/tcm_fc/tfc_io.c
··· 48 48 #include <scsi/fc_encode.h> 49 49 50 50 #include <target/target_core_base.h> 51 - #include <target/target_core_transport.h> 52 - #include <target/target_core_fabric_ops.h> 53 - #include <target/target_core_device.h> 54 - #include <target/target_core_tpg.h> 51 + #include <target/target_core_fabric.h> 55 52 #include <target/target_core_configfs.h> 56 53 #include <target/configfs_macros.h> 57 54
+1 -4
drivers/target/tcm_fc/tfc_sess.c
··· 40 40 #include <scsi/libfc.h> 41 41 42 42 #include <target/target_core_base.h> 43 - #include <target/target_core_transport.h> 44 - #include <target/target_core_fabric_ops.h> 45 - #include <target/target_core_device.h> 46 - #include <target/target_core_tpg.h> 43 + #include <target/target_core_fabric.h> 47 44 #include <target/target_core_configfs.h> 48 45 #include <target/configfs_macros.h> 49 46
+65
include/target/target_core_backend.h
··· 1 + #ifndef TARGET_CORE_BACKEND_H 2 + #define TARGET_CORE_BACKEND_H 3 + 4 + #define TRANSPORT_PLUGIN_PHBA_PDEV 1 5 + #define TRANSPORT_PLUGIN_VHBA_PDEV 2 6 + #define TRANSPORT_PLUGIN_VHBA_VDEV 3 7 + 8 + struct se_subsystem_api { 9 + struct list_head sub_api_list; 10 + 11 + char name[16]; 12 + struct module *owner; 13 + 14 + u8 transport_type; 15 + 16 + unsigned int fua_write_emulated : 1; 17 + unsigned int write_cache_emulated : 1; 18 + 19 + int (*attach_hba)(struct se_hba *, u32); 20 + void (*detach_hba)(struct se_hba *); 21 + int (*pmode_enable_hba)(struct se_hba *, unsigned long); 22 + void *(*allocate_virtdevice)(struct se_hba *, const char *); 23 + struct se_device *(*create_virtdevice)(struct se_hba *, 24 + struct se_subsystem_dev *, void *); 25 + void (*free_device)(void *); 26 + int (*transport_complete)(struct se_task *task); 27 + struct se_task *(*alloc_task)(unsigned char *cdb); 28 + int (*do_task)(struct se_task *); 29 + int (*do_discard)(struct se_device *, sector_t, u32); 30 + void (*do_sync_cache)(struct se_task *); 31 + void (*free_task)(struct se_task *); 32 + ssize_t (*check_configfs_dev_params)(struct se_hba *, 33 + struct se_subsystem_dev *); 34 + ssize_t (*set_configfs_dev_params)(struct se_hba *, 35 + struct se_subsystem_dev *, const char *, ssize_t); 36 + ssize_t (*show_configfs_dev_params)(struct se_hba *, 37 + struct se_subsystem_dev *, char *); 38 + u32 (*get_device_rev)(struct se_device *); 39 + u32 (*get_device_type)(struct se_device *); 40 + sector_t (*get_blocks)(struct se_device *); 41 + unsigned char *(*get_sense_buffer)(struct se_task *); 42 + }; 43 + 44 + int transport_subsystem_register(struct se_subsystem_api *); 45 + void transport_subsystem_release(struct se_subsystem_api *); 46 + 47 + struct se_device *transport_add_device_to_core_hba(struct se_hba *, 48 + struct se_subsystem_api *, struct se_subsystem_dev *, u32, 49 + void *, struct se_dev_limits *, const char *, const char *); 50 + 51 + void transport_complete_sync_cache(struct se_cmd *, int); 52 + void transport_complete_task(struct se_task *, int); 53 + 54 + void target_get_task_cdb(struct se_task *, unsigned char *); 55 + 56 + void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *); 57 + int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *); 58 + int transport_set_vpd_ident_type(struct t10_vpd *, unsigned char *); 59 + int transport_set_vpd_ident(struct t10_vpd *, unsigned char *); 60 + 61 + /* core helpers also used by command snooping in pscsi */ 62 + void *transport_kmap_first_data_page(struct se_cmd *); 63 + void transport_kunmap_first_data_page(struct se_cmd *); 64 + 65 + #endif /* TARGET_CORE_BACKEND_H */
+132 -37
include/target/target_core_base.h
··· 10 10 #include <net/tcp.h> 11 11 12 12 #define TARGET_CORE_MOD_VERSION "v4.1.0-rc1-ml" 13 + #define TARGET_CORE_VERSION TARGET_CORE_MOD_VERSION 13 14 14 15 /* Maximum Number of LUNs per Target Portal Group */ 15 16 /* Don't raise above 511 or REPORT_LUNS needs to handle >1 page */ ··· 35 34 #define TRANSPORT_SENSE_BUFFER SCSI_SENSE_BUFFERSIZE 36 35 /* Used by transport_send_check_condition_and_sense() */ 37 36 #define SPC_SENSE_KEY_OFFSET 2 37 + #define SPC_ADD_SENSE_LEN_OFFSET 7 38 38 #define SPC_ASC_KEY_OFFSET 12 39 39 #define SPC_ASCQ_KEY_OFFSET 13 40 40 #define TRANSPORT_IQN_LEN 224 ··· 55 53 /* Used by transport_get_inquiry_vpd_device_ident() */ 56 54 #define INQUIRY_VPD_DEVICE_IDENTIFIER_LEN 254 57 55 56 + /* Attempts before moving from SHORT to LONG */ 57 + #define PYX_TRANSPORT_WINDOW_CLOSED_THRESHOLD 3 58 + #define PYX_TRANSPORT_WINDOW_CLOSED_WAIT_SHORT 3 /* In milliseconds */ 59 + #define PYX_TRANSPORT_WINDOW_CLOSED_WAIT_LONG 10 /* In milliseconds */ 60 + 61 + #define PYX_TRANSPORT_STATUS_INTERVAL 5 /* In seconds */ 62 + 63 + /* 64 + * struct se_subsystem_dev->su_dev_flags 65 + */ 66 + #define SDF_FIRMWARE_VPD_UNIT_SERIAL 0x00000001 67 + #define SDF_EMULATED_VPD_UNIT_SERIAL 0x00000002 68 + #define SDF_USING_UDEV_PATH 0x00000004 69 + #define SDF_USING_ALIAS 0x00000008 70 + 71 + /* 72 + * struct se_device->dev_flags 73 + */ 74 + #define DF_READ_ONLY 0x00000001 75 + #define DF_SPC2_RESERVATIONS 0x00000002 76 + #define DF_SPC2_RESERVATIONS_WITH_ISID 0x00000004 77 + 78 + /* struct se_dev_attrib sanity values */ 79 + /* Default max_unmap_lba_count */ 80 + #define DA_MAX_UNMAP_LBA_COUNT 0 81 + /* Default max_unmap_block_desc_count */ 82 + #define DA_MAX_UNMAP_BLOCK_DESC_COUNT 0 83 + /* Default unmap_granularity */ 84 + #define DA_UNMAP_GRANULARITY_DEFAULT 0 85 + /* Default unmap_granularity_alignment */ 86 + #define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0 87 + /* Emulation for Direct Page Out */ 88 + #define DA_EMULATE_DPO 0 89 + /* Emulation for Forced Unit Access WRITEs */ 90 + #define DA_EMULATE_FUA_WRITE 1 91 + /* Emulation for Forced Unit Access READs */ 92 + #define DA_EMULATE_FUA_READ 0 93 + /* Emulation for WriteCache and SYNCHRONIZE_CACHE */ 94 + #define DA_EMULATE_WRITE_CACHE 0 95 + /* Emulation for UNIT ATTENTION Interlock Control */ 96 + #define DA_EMULATE_UA_INTLLCK_CTRL 0 97 + /* Emulation for TASK_ABORTED status (TAS) by default */ 98 + #define DA_EMULATE_TAS 1 99 + /* Emulation for Thin Provisioning UNMAP using block/blk-lib.c:blkdev_issue_discard() */ 100 + #define DA_EMULATE_TPU 0 101 + /* 102 + * Emulation for Thin Provisioning WRITE_SAME w/ UNMAP=1 bit using 103 + * block/blk-lib.c:blkdev_issue_discard() 104 + */ 105 + #define DA_EMULATE_TPWS 0 106 + /* No Emulation for PSCSI by default */ 107 + #define DA_EMULATE_RESERVATIONS 0 108 + /* No Emulation for PSCSI by default */ 109 + #define DA_EMULATE_ALUA 0 110 + /* Enforce SCSI Initiator Port TransportID with 'ISID' for PR */ 111 + #define DA_ENFORCE_PR_ISIDS 1 112 + #define DA_STATUS_MAX_SECTORS_MIN 16 113 + #define DA_STATUS_MAX_SECTORS_MAX 8192 114 + /* By default don't report non-rotating (solid state) medium */ 115 + #define DA_IS_NONROT 0 116 + /* Queue Algorithm Modifier default for restricted reordering in control mode page */ 117 + #define DA_EMULATE_REST_REORD 0 118 + 119 + #define SE_MODE_PAGE_BUF 512 120 + 121 + 58 122 /* struct se_hba->hba_flags */ 59 123 enum hba_flags_table { 60 124 HBA_FLAGS_INTERNAL_USE = 0x01, ··· 139 71 TRANSPORT_TPG_TYPE_DISCOVERY = 1, 140 72 }; 141 73 142 - /* Used for generate timer flags */ 74 + /* struct se_task->task_flags */ 143 75 enum se_task_flags { 144 76 TF_ACTIVE = (1 << 0), 145 77 TF_SENT = (1 << 1), 146 78 TF_REQUEST_STOP = (1 << 2), 79 + TF_HAS_SENSE = (1 << 3), 147 80 }; 148 81 149 82 /* Special transport agnostic struct se_cmd->t_states */ ··· 227 158 TCM_RESERVATION_CONFLICT = 0x10, 228 159 }; 229 160 161 + enum target_sc_flags_table { 162 + TARGET_SCF_BIDI_OP = 0x01, 163 + TARGET_SCF_ACK_KREF = 0x02, 164 + }; 165 + 166 + /* fabric independent task management function values */ 167 + enum tcm_tmreq_table { 168 + TMR_ABORT_TASK = 1, 169 + TMR_ABORT_TASK_SET = 2, 170 + TMR_CLEAR_ACA = 3, 171 + TMR_CLEAR_TASK_SET = 4, 172 + TMR_LUN_RESET = 5, 173 + TMR_TARGET_WARM_RESET = 6, 174 + TMR_TARGET_COLD_RESET = 7, 175 + TMR_FABRIC_TMR = 255, 176 + }; 177 + 178 + /* fabric independent task management response values */ 179 + enum tcm_tmrsp_table { 180 + TMR_FUNCTION_COMPLETE = 0, 181 + TMR_TASK_DOES_NOT_EXIST = 1, 182 + TMR_LUN_DOES_NOT_EXIST = 2, 183 + TMR_TASK_STILL_ALLEGIANT = 3, 184 + TMR_TASK_FAILOVER_NOT_SUPPORTED = 4, 185 + TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED = 5, 186 + TMR_FUNCTION_AUTHORIZATION_FAILED = 6, 187 + TMR_FUNCTION_REJECTED = 255, 188 + }; 189 + 230 190 struct se_obj { 231 191 atomic_t obj_access_count; 232 - } ____cacheline_aligned; 192 + }; 233 193 234 194 /* 235 195 * Used by TCM Core internally to signal if ALUA emulation is enabled or ··· 305 207 struct config_group alua_tg_pt_gps_group; 306 208 int (*alua_state_check)(struct se_cmd *, unsigned char *, u8 *); 307 209 struct list_head tg_pt_gps_list; 308 - } ____cacheline_aligned; 210 + }; 309 211 310 212 struct t10_alua_lu_gp { 311 213 u16 lu_gp_id; ··· 316 218 struct config_group lu_gp_group; 317 219 struct list_head lu_gp_node; 318 220 struct list_head lu_gp_mem_list; 319 - } ____cacheline_aligned; 221 + }; 320 222 321 223 struct t10_alua_lu_gp_member { 322 224 bool lu_gp_assoc; ··· 325 227 struct t10_alua_lu_gp *lu_gp; 326 228 struct se_device *lu_gp_mem_dev; 327 229 struct list_head lu_gp_mem_list; 328 - } ____cacheline_aligned; 230 + }; 329 231 330 232 struct t10_alua_tg_pt_gp { 331 233 u16 tg_pt_gp_id; ··· 348 250 struct config_group tg_pt_gp_group; 349 251 struct list_head tg_pt_gp_list; 350 252 struct list_head tg_pt_gp_mem_list; 351 - } ____cacheline_aligned; 253 + }; 352 254 353 255 struct t10_alua_tg_pt_gp_member { 354 256 bool tg_pt_gp_assoc; ··· 357 259 struct t10_alua_tg_pt_gp *tg_pt_gp; 358 260 struct se_port *tg_pt; 359 261 struct list_head tg_pt_gp_mem_list; 360 - } ____cacheline_aligned; 262 + }; 361 263 362 264 struct t10_vpd { 363 265 unsigned char device_identifier[INQUIRY_VPD_DEVICE_IDENTIFIER_LEN]; ··· 367 269 u32 association; 368 270 u32 device_identifier_type; 369 271 struct list_head vpd_list; 370 - } ____cacheline_aligned; 272 + }; 371 273 372 274 struct t10_wwn { 373 275 char vendor[8]; ··· 378 280 struct se_subsystem_dev *t10_sub_dev; 379 281 struct config_group t10_wwn_group; 380 282 struct list_head t10_vpd_list; 381 - } ____cacheline_aligned; 283 + }; 382 284 383 285 384 286 /* ··· 431 333 struct list_head pr_reg_aptpl_list; 432 334 struct list_head pr_reg_atp_list; 433 335 struct list_head pr_reg_atp_mem_list; 434 - } ____cacheline_aligned; 336 + }; 435 337 436 338 /* 437 339 * This set of function pointer ops is set based upon SPC3_PERSISTENT_RESERVATIONS, ··· 472 374 struct list_head registration_list; 473 375 struct list_head aptpl_reg_list; 474 376 struct t10_reservation_ops pr_ops; 475 - } ____cacheline_aligned; 377 + }; 476 378 477 379 struct se_queue_req { 478 380 int state; 479 381 struct se_cmd *cmd; 480 382 struct list_head qr_list; 481 - } ____cacheline_aligned; 383 + }; 482 384 483 385 struct se_queue_obj { 484 386 atomic_t queue_cnt; 485 387 spinlock_t cmd_queue_lock; 486 388 struct list_head qobj_list; 487 389 wait_queue_head_t thread_wq; 488 - } ____cacheline_aligned; 390 + }; 489 391 490 392 struct se_task { 491 393 unsigned long long task_lba; ··· 495 397 struct scatterlist *task_sg; 496 398 u32 task_sg_nents; 497 399 u16 task_flags; 498 - u8 task_sense; 499 400 u8 task_scsi_status; 500 - int task_error_status; 501 401 enum dma_data_direction task_data_direction; 502 - atomic_t task_state_active; 503 402 struct list_head t_list; 504 403 struct list_head t_execute_list; 505 404 struct list_head t_state_list; 405 + bool t_state_active; 506 406 struct completion task_stop_comp; 507 - } ____cacheline_aligned; 407 + }; 508 408 509 409 struct se_cmd { 510 410 /* SAM response code being sent to initiator */ ··· 547 451 struct list_head se_queue_node; 548 452 struct list_head se_cmd_list; 549 453 struct completion cmd_wait_comp; 454 + struct kref cmd_kref; 550 455 struct target_core_fabric_ops *se_tfo; 551 456 int (*execute_task)(struct se_task *); 552 457 void (*transport_complete_callback)(struct se_cmd *); ··· 589 492 struct list_head t_task_list; 590 493 u32 t_task_list_num; 591 494 592 - } ____cacheline_aligned; 495 + }; 593 496 594 497 struct se_tmr_req { 595 498 /* Task Management function to be preformed */ ··· 607 510 struct se_device *tmr_dev; 608 511 struct se_lun *tmr_lun; 609 512 struct list_head tmr_list; 610 - } ____cacheline_aligned; 513 + }; 611 514 612 515 struct se_ua { 613 516 u8 ua_asc; ··· 615 518 struct se_node_acl *ua_nacl; 616 519 struct list_head ua_dev_list; 617 520 struct list_head ua_nacl_list; 618 - } ____cacheline_aligned; 521 + }; 619 522 620 523 struct se_node_acl { 621 524 char initiatorname[TRANSPORT_IQN_LEN]; ··· 642 545 struct config_group *acl_default_groups[5]; 643 546 struct list_head acl_list; 644 547 struct list_head acl_sess_list; 645 - } ____cacheline_aligned; 548 + }; 646 549 647 550 struct se_session { 648 551 unsigned sess_tearing_down:1; ··· 655 558 struct list_head sess_cmd_list; 656 559 struct list_head sess_wait_list; 657 560 spinlock_t sess_cmd_lock; 658 - } ____cacheline_aligned; 561 + }; 659 562 660 563 struct se_device; 661 564 struct se_transform_info; ··· 675 578 struct list_head lacl_list; 676 579 struct config_group se_lun_group; 677 580 struct se_ml_stat_grps ml_stat_grps; 678 - } ____cacheline_aligned; 581 + }; 679 582 680 583 struct se_dev_entry { 681 584 bool def_pr_registered; ··· 700 603 struct se_lun *se_lun; 701 604 struct list_head alua_port_list; 702 605 struct list_head ua_list; 703 - } ____cacheline_aligned; 606 + }; 704 607 705 608 struct se_dev_limits { 706 609 /* Max supported HW queue depth */ ··· 709 612 u32 queue_depth; 710 613 /* From include/linux/blkdev.h for the other HW/SW limits. */ 711 614 struct queue_limits limits; 712 - } ____cacheline_aligned; 615 + }; 713 616 714 617 struct se_dev_attrib { 715 618 int emulate_dpo; ··· 738 641 u32 unmap_granularity_alignment; 739 642 struct se_subsystem_dev *da_sub_dev; 740 643 struct config_group da_group; 741 - } ____cacheline_aligned; 644 + }; 742 645 743 646 struct se_dev_stat_grps { 744 647 struct config_group stat_group; ··· 771 674 struct config_group se_dev_pr_group; 772 675 /* For target_core_stat.c groups */ 773 676 struct se_dev_stat_grps dev_stat_grps; 774 - } ____cacheline_aligned; 677 + }; 775 678 776 679 struct se_device { 777 680 /* RELATIVE TARGET PORT IDENTIFER Counter */ ··· 782 685 u32 dev_port_count; 783 686 /* See transport_device_status_table */ 784 687 u32 dev_status; 785 - u32 dev_tcq_window_closed; 786 688 /* Physical device queue depth */ 787 689 u32 queue_depth; 788 690 /* Used for SPC-2 reservations enforce of ISIDs */ ··· 798 702 spinlock_t stats_lock; 799 703 /* Active commands on this virtual SE device */ 800 704 atomic_t simple_cmds; 801 - atomic_t depth_left; 802 705 atomic_t dev_ordered_id; 803 706 atomic_t execute_tasks; 804 707 atomic_t dev_ordered_sync; ··· 835 740 struct se_subsystem_api *transport; 836 741 /* Linked list for struct se_hba struct se_device list */ 837 742 struct list_head dev_list; 838 - } ____cacheline_aligned; 743 + }; 839 744 840 745 struct se_hba { 841 746 u16 hba_tpgt; ··· 854 759 struct config_group hba_group; 855 760 struct mutex hba_access_mutex; 856 761 struct se_subsystem_api *transport; 857 - } ____cacheline_aligned; 762 + }; 858 763 859 764 struct se_port_stat_grps { 860 765 struct config_group stat_group; ··· 880 785 struct se_port *lun_sep; 881 786 struct config_group lun_group; 882 787 struct se_port_stat_grps port_stat_grps; 883 - } ____cacheline_aligned; 788 + }; 884 789 885 790 struct scsi_port_stats { 886 791 u64 cmd_pdus; 887 792 u64 tx_data_octets; 888 793 u64 rx_data_octets; 889 - } ____cacheline_aligned; 794 + }; 890 795 891 796 struct se_port { 892 797 /* RELATIVE TARGET PORT IDENTIFER */ ··· 906 811 struct se_portal_group *sep_tpg; 907 812 struct list_head sep_alua_list; 908 813 struct list_head sep_list; 909 - } ____cacheline_aligned; 814 + }; 910 815 911 816 struct se_tpg_np { 912 817 struct se_portal_group *tpg_np_parent; 913 818 struct config_group tpg_np_group; 914 - } ____cacheline_aligned; 819 + }; 915 820 916 821 struct se_portal_group { 917 822 /* Type of target portal group, see transport_tpg_type_table */ ··· 944 849 struct config_group tpg_acl_group; 945 850 struct config_group tpg_attrib_group; 946 851 struct config_group tpg_param_group; 947 - } ____cacheline_aligned; 852 + }; 948 853 949 854 struct se_wwn { 950 855 struct target_fabric_configfs *wwn_tf; 951 856 struct config_group wwn_group; 952 857 struct config_group *wwn_default_groups[2]; 953 858 struct config_group fabric_stat_group; 954 - } ____cacheline_aligned; 859 + }; 955 860 956 861 #endif /* TARGET_CORE_BASE_H */
-63
include/target/target_core_device.h
··· 1 - #ifndef TARGET_CORE_DEVICE_H 2 - #define TARGET_CORE_DEVICE_H 3 - 4 - extern int transport_lookup_cmd_lun(struct se_cmd *, u32); 5 - extern int transport_lookup_tmr_lun(struct se_cmd *, u32); 6 - extern struct se_dev_entry *core_get_se_deve_from_rtpi( 7 - struct se_node_acl *, u16); 8 - extern int core_free_device_list_for_node(struct se_node_acl *, 9 - struct se_portal_group *); 10 - extern void core_dec_lacl_count(struct se_node_acl *, struct se_cmd *); 11 - extern void core_update_device_list_access(u32, u32, struct se_node_acl *); 12 - extern int core_update_device_list_for_node(struct se_lun *, struct se_lun_acl *, u32, 13 - u32, struct se_node_acl *, 14 - struct se_portal_group *, int); 15 - extern void core_clear_lun_from_tpg(struct se_lun *, struct se_portal_group *); 16 - extern int core_dev_export(struct se_device *, struct se_portal_group *, 17 - struct se_lun *); 18 - extern void core_dev_unexport(struct se_device *, struct se_portal_group *, 19 - struct se_lun *); 20 - extern int target_report_luns(struct se_task *); 21 - extern void se_release_device_for_hba(struct se_device *); 22 - extern void se_release_vpd_for_dev(struct se_device *); 23 - extern void se_clear_dev_ports(struct se_device *); 24 - extern int se_free_virtual_device(struct se_device *, struct se_hba *); 25 - extern int se_dev_check_online(struct se_device *); 26 - extern int se_dev_check_shutdown(struct se_device *); 27 - extern void se_dev_set_default_attribs(struct se_device *, struct se_dev_limits *); 28 - extern int se_dev_set_task_timeout(struct se_device *, u32); 29 - extern int se_dev_set_max_unmap_lba_count(struct se_device *, u32); 30 - extern int se_dev_set_max_unmap_block_desc_count(struct se_device *, u32); 31 - extern int se_dev_set_unmap_granularity(struct se_device *, u32); 32 - extern int se_dev_set_unmap_granularity_alignment(struct se_device *, u32); 33 - extern int se_dev_set_emulate_dpo(struct se_device *, int); 34 - extern int se_dev_set_emulate_fua_write(struct se_device *, int); 35 - extern int se_dev_set_emulate_fua_read(struct se_device *, int); 36 - extern int se_dev_set_emulate_write_cache(struct se_device *, int); 37 - extern int se_dev_set_emulate_ua_intlck_ctrl(struct se_device *, int); 38 - extern int se_dev_set_emulate_tas(struct se_device *, int); 39 - extern int se_dev_set_emulate_tpu(struct se_device *, int); 40 - extern int se_dev_set_emulate_tpws(struct se_device *, int); 41 - extern int se_dev_set_enforce_pr_isids(struct se_device *, int); 42 - extern int se_dev_set_is_nonrot(struct se_device *, int); 43 - extern int se_dev_set_emulate_rest_reord(struct se_device *dev, int); 44 - extern int se_dev_set_queue_depth(struct se_device *, u32); 45 - extern int se_dev_set_max_sectors(struct se_device *, u32); 46 - extern int se_dev_set_optimal_sectors(struct se_device *, u32); 47 - extern int se_dev_set_block_size(struct se_device *, u32); 48 - extern struct se_lun *core_dev_add_lun(struct se_portal_group *, struct se_hba *, 49 - struct se_device *, u32); 50 - extern int core_dev_del_lun(struct se_portal_group *, u32); 51 - extern struct se_lun *core_get_lun_from_tpg(struct se_portal_group *, u32); 52 - extern struct se_lun_acl *core_dev_init_initiator_node_lun_acl(struct se_portal_group *, 53 - u32, char *, int *); 54 - extern int core_dev_add_initiator_node_lun_acl(struct se_portal_group *, 55 - struct se_lun_acl *, u32, u32); 56 - extern int core_dev_del_initiator_node_lun_acl(struct se_portal_group *, 57 - struct se_lun *, struct se_lun_acl *); 58 - extern void core_dev_free_initiator_node_lun_acl(struct se_portal_group *, 59 - struct se_lun_acl *lacl); 60 - extern int core_dev_setup_virtual_lun0(void); 61 - extern void core_dev_release_virtual_lun0(void); 62 - 63 - #endif /* TARGET_CORE_DEVICE_H */
-28
include/target/target_core_fabric_lib.h
··· 1 - #ifndef TARGET_CORE_FABRIC_LIB_H 2 - #define TARGET_CORE_FABRIC_LIB_H 3 - 4 - extern u8 sas_get_fabric_proto_ident(struct se_portal_group *); 5 - extern u32 sas_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *, 6 - struct t10_pr_registration *, int *, unsigned char *); 7 - extern u32 sas_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *, 8 - struct t10_pr_registration *, int *); 9 - extern char *sas_parse_pr_out_transport_id(struct se_portal_group *, 10 - const char *, u32 *, char **); 11 - 12 - extern u8 fc_get_fabric_proto_ident(struct se_portal_group *); 13 - extern u32 fc_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *, 14 - struct t10_pr_registration *, int *, unsigned char *); 15 - extern u32 fc_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *, 16 - struct t10_pr_registration *, int *); 17 - extern char *fc_parse_pr_out_transport_id(struct se_portal_group *, 18 - const char *, u32 *, char **); 19 - 20 - extern u8 iscsi_get_fabric_proto_ident(struct se_portal_group *); 21 - extern u32 iscsi_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *, 22 - struct t10_pr_registration *, int *, unsigned char *); 23 - extern u32 iscsi_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *, 24 - struct t10_pr_registration *, int *); 25 - extern char *iscsi_parse_pr_out_transport_id(struct se_portal_group *, 26 - const char *, u32 *, char **); 27 - 28 - #endif /* TARGET_CORE_FABRIC_LIB_H */
+88 -6
include/target/target_core_fabric_ops.h include/target/target_core_fabric.h
··· 1 - /* Defined in target_core_configfs.h */ 2 - struct target_fabric_configfs; 1 + #ifndef TARGET_CORE_FABRIC_H 2 + #define TARGET_CORE_FABRIC_H 3 3 4 4 struct target_core_fabric_ops { 5 5 struct configfs_subsystem *tf_subsys; ··· 52 52 * Returning 0 will signal a descriptor has not been released. 53 53 */ 54 54 int (*check_stop_free)(struct se_cmd *); 55 - /* 56 - * Optional check for active I/O shutdown 57 - */ 58 - int (*check_release_cmd)(struct se_cmd *); 59 55 void (*release_cmd)(struct se_cmd *); 60 56 /* 61 57 * Called with spin_lock_bh(struct se_portal_group->session_lock held. ··· 99 103 struct config_group *, const char *); 100 104 void (*fabric_drop_nodeacl)(struct se_node_acl *); 101 105 }; 106 + 107 + struct se_session *transport_init_session(void); 108 + void __transport_register_session(struct se_portal_group *, 109 + struct se_node_acl *, struct se_session *, void *); 110 + void transport_register_session(struct se_portal_group *, 111 + struct se_node_acl *, struct se_session *, void *); 112 + void transport_free_session(struct se_session *); 113 + void transport_deregister_session_configfs(struct se_session *); 114 + void transport_deregister_session(struct se_session *); 115 + 116 + 117 + void transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *, 118 + struct se_session *, u32, int, int, unsigned char *); 119 + int transport_lookup_cmd_lun(struct se_cmd *, u32); 120 + int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); 121 + int target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, 122 + unsigned char *, u32, u32, int, int, int); 123 + int transport_handle_cdb_direct(struct se_cmd *); 124 + int transport_generic_handle_cdb_map(struct se_cmd *); 125 + int transport_generic_handle_data(struct se_cmd *); 126 + int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, 127 + struct scatterlist *, u32, struct scatterlist *, u32); 128 + void transport_do_task_sg_chain(struct se_cmd *); 129 + int transport_generic_new_cmd(struct se_cmd *); 130 + 131 + void transport_generic_process_write(struct se_cmd *); 132 + 133 + void transport_generic_free_cmd(struct se_cmd *, int); 134 + 135 + bool transport_wait_for_tasks(struct se_cmd *); 136 + int transport_check_aborted_status(struct se_cmd *, int); 137 + int transport_send_check_condition_and_sense(struct se_cmd *, u8, int); 138 + 139 + void target_get_sess_cmd(struct se_session *, struct se_cmd *, bool); 140 + int target_put_sess_cmd(struct se_session *, struct se_cmd *); 141 + void target_splice_sess_cmd_list(struct se_session *); 142 + void target_wait_for_sess_cmds(struct se_session *, int); 143 + 144 + int core_alua_check_nonop_delay(struct se_cmd *); 145 + 146 + struct se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t); 147 + void core_tmr_release_req(struct se_tmr_req *); 148 + int transport_generic_handle_tmr(struct se_cmd *); 149 + int transport_lookup_tmr_lun(struct se_cmd *, u32); 150 + 151 + struct se_node_acl *core_tpg_check_initiator_node_acl(struct se_portal_group *, 152 + unsigned char *); 153 + void core_tpg_clear_object_luns(struct se_portal_group *); 154 + struct se_node_acl *core_tpg_add_initiator_node_acl(struct se_portal_group *, 155 + struct se_node_acl *, const char *, u32); 156 + int core_tpg_del_initiator_node_acl(struct se_portal_group *, 157 + struct se_node_acl *, int); 158 + int core_tpg_set_initiator_node_queue_depth(struct se_portal_group *, 159 + unsigned char *, u32, int); 160 + int core_tpg_register(struct target_core_fabric_ops *, struct se_wwn *, 161 + struct se_portal_group *, void *, int); 162 + int core_tpg_deregister(struct se_portal_group *); 163 + 164 + /* SAS helpers */ 165 + u8 sas_get_fabric_proto_ident(struct se_portal_group *); 166 + u32 sas_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *, 167 + struct t10_pr_registration *, int *, unsigned char *); 168 + u32 sas_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *, 169 + struct t10_pr_registration *, int *); 170 + char *sas_parse_pr_out_transport_id(struct se_portal_group *, const char *, 171 + u32 *, char **); 172 + 173 + /* FC helpers */ 174 + u8 fc_get_fabric_proto_ident(struct se_portal_group *); 175 + u32 fc_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *, 176 + struct t10_pr_registration *, int *, unsigned char *); 177 + u32 fc_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *, 178 + struct t10_pr_registration *, int *); 179 + char *fc_parse_pr_out_transport_id(struct se_portal_group *, const char *, 180 + u32 *, char **); 181 + 182 + /* iSCSI helpers */ 183 + u8 iscsi_get_fabric_proto_ident(struct se_portal_group *); 184 + u32 iscsi_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *, 185 + struct t10_pr_registration *, int *, unsigned char *); 186 + u32 iscsi_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *, 187 + struct t10_pr_registration *, int *); 188 + char *iscsi_parse_pr_out_transport_id(struct se_portal_group *, const char *, 189 + u32 *, char **); 190 + 191 + #endif /* TARGET_CORE_FABRICH */
-35
include/target/target_core_tmr.h
··· 1 - #ifndef TARGET_CORE_TMR_H 2 - #define TARGET_CORE_TMR_H 3 - 4 - /* fabric independent task management function values */ 5 - enum tcm_tmreq_table { 6 - TMR_ABORT_TASK = 1, 7 - TMR_ABORT_TASK_SET = 2, 8 - TMR_CLEAR_ACA = 3, 9 - TMR_CLEAR_TASK_SET = 4, 10 - TMR_LUN_RESET = 5, 11 - TMR_TARGET_WARM_RESET = 6, 12 - TMR_TARGET_COLD_RESET = 7, 13 - TMR_FABRIC_TMR = 255, 14 - }; 15 - 16 - /* fabric independent task management response values */ 17 - enum tcm_tmrsp_table { 18 - TMR_FUNCTION_COMPLETE = 0, 19 - TMR_TASK_DOES_NOT_EXIST = 1, 20 - TMR_LUN_DOES_NOT_EXIST = 2, 21 - TMR_TASK_STILL_ALLEGIANT = 3, 22 - TMR_TASK_FAILOVER_NOT_SUPPORTED = 4, 23 - TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED = 5, 24 - TMR_FUNCTION_AUTHORIZATION_FAILED = 6, 25 - TMR_FUNCTION_REJECTED = 255, 26 - }; 27 - 28 - extern struct kmem_cache *se_tmr_req_cache; 29 - 30 - extern struct se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t); 31 - extern void core_tmr_release_req(struct se_tmr_req *); 32 - extern int core_tmr_lun_reset(struct se_device *, struct se_tmr_req *, 33 - struct list_head *, struct se_cmd *); 34 - 35 - #endif /* TARGET_CORE_TMR_H */
-35
include/target/target_core_tpg.h
··· 1 - #ifndef TARGET_CORE_TPG_H 2 - #define TARGET_CORE_TPG_H 3 - 4 - extern struct se_node_acl *__core_tpg_get_initiator_node_acl(struct se_portal_group *tpg, 5 - const char *); 6 - extern struct se_node_acl *core_tpg_get_initiator_node_acl(struct se_portal_group *tpg, 7 - unsigned char *); 8 - extern void core_tpg_add_node_to_devs(struct se_node_acl *, 9 - struct se_portal_group *); 10 - extern struct se_node_acl *core_tpg_check_initiator_node_acl( 11 - struct se_portal_group *, 12 - unsigned char *); 13 - extern void core_tpg_wait_for_nacl_pr_ref(struct se_node_acl *); 14 - extern void core_tpg_wait_for_mib_ref(struct se_node_acl *); 15 - extern void core_tpg_clear_object_luns(struct se_portal_group *); 16 - extern struct se_node_acl *core_tpg_add_initiator_node_acl( 17 - struct se_portal_group *, 18 - struct se_node_acl *, 19 - const char *, u32); 20 - extern int core_tpg_del_initiator_node_acl(struct se_portal_group *, 21 - struct se_node_acl *, int); 22 - extern int core_tpg_set_initiator_node_queue_depth(struct se_portal_group *, 23 - unsigned char *, u32, int); 24 - extern int core_tpg_register(struct target_core_fabric_ops *, 25 - struct se_wwn *, 26 - struct se_portal_group *, void *, 27 - int); 28 - extern int core_tpg_deregister(struct se_portal_group *); 29 - extern struct se_lun *core_tpg_pre_addlun(struct se_portal_group *, u32); 30 - extern int core_tpg_post_addlun(struct se_portal_group *, struct se_lun *, u32, 31 - void *); 32 - extern struct se_lun *core_tpg_pre_dellun(struct se_portal_group *, u32, int *); 33 - extern int core_tpg_post_dellun(struct se_portal_group *, struct se_lun *); 34 - 35 - #endif /* TARGET_CORE_TPG_H */
-287
include/target/target_core_transport.h
··· 1 - #ifndef TARGET_CORE_TRANSPORT_H 2 - #define TARGET_CORE_TRANSPORT_H 3 - 4 - #define TARGET_CORE_VERSION TARGET_CORE_MOD_VERSION 5 - 6 - /* Attempts before moving from SHORT to LONG */ 7 - #define PYX_TRANSPORT_WINDOW_CLOSED_THRESHOLD 3 8 - #define PYX_TRANSPORT_WINDOW_CLOSED_WAIT_SHORT 3 /* In milliseconds */ 9 - #define PYX_TRANSPORT_WINDOW_CLOSED_WAIT_LONG 10 /* In milliseconds */ 10 - 11 - #define PYX_TRANSPORT_STATUS_INTERVAL 5 /* In seconds */ 12 - 13 - #define TRANSPORT_PLUGIN_PHBA_PDEV 1 14 - #define TRANSPORT_PLUGIN_VHBA_PDEV 2 15 - #define TRANSPORT_PLUGIN_VHBA_VDEV 3 16 - 17 - /* 18 - * struct se_subsystem_dev->su_dev_flags 19 - */ 20 - #define SDF_FIRMWARE_VPD_UNIT_SERIAL 0x00000001 21 - #define SDF_EMULATED_VPD_UNIT_SERIAL 0x00000002 22 - #define SDF_USING_UDEV_PATH 0x00000004 23 - #define SDF_USING_ALIAS 0x00000008 24 - 25 - /* 26 - * struct se_device->dev_flags 27 - */ 28 - #define DF_READ_ONLY 0x00000001 29 - #define DF_SPC2_RESERVATIONS 0x00000002 30 - #define DF_SPC2_RESERVATIONS_WITH_ISID 0x00000004 31 - 32 - /* struct se_dev_attrib sanity values */ 33 - /* Default max_unmap_lba_count */ 34 - #define DA_MAX_UNMAP_LBA_COUNT 0 35 - /* Default max_unmap_block_desc_count */ 36 - #define DA_MAX_UNMAP_BLOCK_DESC_COUNT 0 37 - /* Default unmap_granularity */ 38 - #define DA_UNMAP_GRANULARITY_DEFAULT 0 39 - /* Default unmap_granularity_alignment */ 40 - #define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0 41 - /* Emulation for Direct Page Out */ 42 - #define DA_EMULATE_DPO 0 43 - /* Emulation for Forced Unit Access WRITEs */ 44 - #define DA_EMULATE_FUA_WRITE 1 45 - /* Emulation for Forced Unit Access READs */ 46 - #define DA_EMULATE_FUA_READ 0 47 - /* Emulation for WriteCache and SYNCHRONIZE_CACHE */ 48 - #define DA_EMULATE_WRITE_CACHE 0 49 - /* Emulation for UNIT ATTENTION Interlock Control */ 50 - #define DA_EMULATE_UA_INTLLCK_CTRL 0 51 - /* Emulation for TASK_ABORTED status (TAS) by default */ 52 - #define DA_EMULATE_TAS 1 53 - /* Emulation for Thin Provisioning UNMAP using block/blk-lib.c:blkdev_issue_discard() */ 54 - #define DA_EMULATE_TPU 0 55 - /* 56 - * Emulation for Thin Provisioning WRITE_SAME w/ UNMAP=1 bit using 57 - * block/blk-lib.c:blkdev_issue_discard() 58 - */ 59 - #define DA_EMULATE_TPWS 0 60 - /* No Emulation for PSCSI by default */ 61 - #define DA_EMULATE_RESERVATIONS 0 62 - /* No Emulation for PSCSI by default */ 63 - #define DA_EMULATE_ALUA 0 64 - /* Enforce SCSI Initiator Port TransportID with 'ISID' for PR */ 65 - #define DA_ENFORCE_PR_ISIDS 1 66 - #define DA_STATUS_MAX_SECTORS_MIN 16 67 - #define DA_STATUS_MAX_SECTORS_MAX 8192 68 - /* By default don't report non-rotating (solid state) medium */ 69 - #define DA_IS_NONROT 0 70 - /* Queue Algorithm Modifier default for restricted reordering in control mode page */ 71 - #define DA_EMULATE_REST_REORD 0 72 - 73 - #define SE_MODE_PAGE_BUF 512 74 - 75 - #define MOD_MAX_SECTORS(ms, bs) (ms % (PAGE_SIZE / bs)) 76 - 77 - struct se_subsystem_api; 78 - 79 - extern int init_se_kmem_caches(void); 80 - extern void release_se_kmem_caches(void); 81 - extern u32 scsi_get_new_index(scsi_index_t); 82 - extern void transport_init_queue_obj(struct se_queue_obj *); 83 - extern void transport_subsystem_check_init(void); 84 - extern int transport_subsystem_register(struct se_subsystem_api *); 85 - extern void transport_subsystem_release(struct se_subsystem_api *); 86 - extern void transport_load_plugins(void); 87 - extern struct se_session *transport_init_session(void); 88 - extern void __transport_register_session(struct se_portal_group *, 89 - struct se_node_acl *, 90 - struct se_session *, void *); 91 - extern void transport_register_session(struct se_portal_group *, 92 - struct se_node_acl *, 93 - struct se_session *, void *); 94 - extern void transport_free_session(struct se_session *); 95 - extern void transport_deregister_session_configfs(struct se_session *); 96 - extern void transport_deregister_session(struct se_session *); 97 - extern void transport_cmd_finish_abort(struct se_cmd *, int); 98 - extern void transport_complete_sync_cache(struct se_cmd *, int); 99 - extern void transport_complete_task(struct se_task *, int); 100 - extern void transport_add_task_to_execute_queue(struct se_task *, 101 - struct se_task *, 102 - struct se_device *); 103 - extern void transport_remove_task_from_execute_queue(struct se_task *, 104 - struct se_device *); 105 - extern void __transport_remove_task_from_execute_queue(struct se_task *, 106 - struct se_device *); 107 - unsigned char *transport_dump_cmd_direction(struct se_cmd *); 108 - extern void transport_dump_dev_state(struct se_device *, char *, int *); 109 - extern void transport_dump_dev_info(struct se_device *, struct se_lun *, 110 - unsigned long long, char *, int *); 111 - extern void transport_dump_vpd_proto_id(struct t10_vpd *, 112 - unsigned char *, int); 113 - extern void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *); 114 - extern int transport_dump_vpd_assoc(struct t10_vpd *, 115 - unsigned char *, int); 116 - extern int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *); 117 - extern int transport_dump_vpd_ident_type(struct t10_vpd *, 118 - unsigned char *, int); 119 - extern int transport_set_vpd_ident_type(struct t10_vpd *, unsigned char *); 120 - extern int transport_dump_vpd_ident(struct t10_vpd *, 121 - unsigned char *, int); 122 - extern int transport_set_vpd_ident(struct t10_vpd *, unsigned char *); 123 - extern struct se_device *transport_add_device_to_core_hba(struct se_hba *, 124 - struct se_subsystem_api *, 125 - struct se_subsystem_dev *, u32, 126 - void *, struct se_dev_limits *, 127 - const char *, const char *); 128 - extern void transport_init_se_cmd(struct se_cmd *, 129 - struct target_core_fabric_ops *, 130 - struct se_session *, u32, int, int, 131 - unsigned char *); 132 - void *transport_kmap_first_data_page(struct se_cmd *cmd); 133 - void transport_kunmap_first_data_page(struct se_cmd *cmd); 134 - extern int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); 135 - extern int transport_handle_cdb_direct(struct se_cmd *); 136 - extern int transport_generic_handle_cdb_map(struct se_cmd *); 137 - extern int transport_generic_handle_data(struct se_cmd *); 138 - extern int transport_generic_handle_tmr(struct se_cmd *); 139 - extern bool target_stop_task(struct se_task *task, unsigned long *flags); 140 - extern int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *, u32, 141 - struct scatterlist *, u32); 142 - extern int transport_clear_lun_from_sessions(struct se_lun *); 143 - extern bool transport_wait_for_tasks(struct se_cmd *); 144 - extern int transport_check_aborted_status(struct se_cmd *, int); 145 - extern int transport_send_check_condition_and_sense(struct se_cmd *, u8, int); 146 - extern void transport_send_task_abort(struct se_cmd *); 147 - extern void transport_release_cmd(struct se_cmd *); 148 - extern void transport_generic_free_cmd(struct se_cmd *, int); 149 - extern void target_get_sess_cmd(struct se_session *, struct se_cmd *); 150 - extern int target_put_sess_cmd(struct se_session *, struct se_cmd *); 151 - extern void target_splice_sess_cmd_list(struct se_session *); 152 - extern void target_wait_for_sess_cmds(struct se_session *, int); 153 - extern void transport_generic_wait_for_cmds(struct se_cmd *, int); 154 - extern void transport_do_task_sg_chain(struct se_cmd *); 155 - extern void transport_generic_process_write(struct se_cmd *); 156 - extern int transport_generic_new_cmd(struct se_cmd *); 157 - extern int transport_generic_do_tmr(struct se_cmd *); 158 - /* From target_core_alua.c */ 159 - extern int core_alua_check_nonop_delay(struct se_cmd *); 160 - /* From target_core_cdb.c */ 161 - extern int transport_emulate_control_cdb(struct se_task *); 162 - extern void target_get_task_cdb(struct se_task *task, unsigned char *cdb); 163 - 164 - /* 165 - * Each se_transport_task_t can have N number of possible struct se_task's 166 - * for the storage transport(s) to possibly execute. 167 - * Used primarily for splitting up CDBs that exceed the physical storage 168 - * HBA's maximum sector count per task. 169 - */ 170 - struct se_mem { 171 - struct page *se_page; 172 - u32 se_len; 173 - u32 se_off; 174 - struct list_head se_list; 175 - } ____cacheline_aligned; 176 - 177 - /* 178 - * Each type of disk transport supported MUST have a template defined 179 - * within its .h file. 180 - */ 181 - struct se_subsystem_api { 182 - /* 183 - * The Name. :-) 184 - */ 185 - char name[16]; 186 - /* 187 - * Transport Type. 188 - */ 189 - u8 transport_type; 190 - 191 - unsigned int fua_write_emulated : 1; 192 - unsigned int write_cache_emulated : 1; 193 - 194 - /* 195 - * struct module for struct se_hba references 196 - */ 197 - struct module *owner; 198 - /* 199 - * Used for global se_subsystem_api list_head 200 - */ 201 - struct list_head sub_api_list; 202 - /* 203 - * attach_hba(): 204 - */ 205 - int (*attach_hba)(struct se_hba *, u32); 206 - /* 207 - * detach_hba(): 208 - */ 209 - void (*detach_hba)(struct se_hba *); 210 - /* 211 - * pmode_hba(): Used for TCM/pSCSI subsystem plugin HBA -> 212 - * Linux/SCSI struct Scsi_Host passthrough 213 - */ 214 - int (*pmode_enable_hba)(struct se_hba *, unsigned long); 215 - /* 216 - * allocate_virtdevice(): 217 - */ 218 - void *(*allocate_virtdevice)(struct se_hba *, const char *); 219 - /* 220 - * create_virtdevice(): Only for Virtual HBAs 221 - */ 222 - struct se_device *(*create_virtdevice)(struct se_hba *, 223 - struct se_subsystem_dev *, void *); 224 - /* 225 - * free_device(): 226 - */ 227 - void (*free_device)(void *); 228 - 229 - /* 230 - * transport_complete(): 231 - * 232 - * Use transport_generic_complete() for majority of DAS transport 233 - * drivers. Provided out of convenience. 234 - */ 235 - int (*transport_complete)(struct se_task *task); 236 - struct se_task *(*alloc_task)(unsigned char *cdb); 237 - /* 238 - * do_task(): 239 - */ 240 - int (*do_task)(struct se_task *); 241 - /* 242 - * Used by virtual subsystem plugins IBLOCK and FILEIO to emulate 243 - * UNMAP and WRITE_SAME_* w/ UNMAP=1 <-> Linux/Block Discard 244 - */ 245 - int (*do_discard)(struct se_device *, sector_t, u32); 246 - /* 247 - * Used by virtual subsystem plugins IBLOCK and FILEIO to emulate 248 - * SYNCHRONIZE_CACHE_* <-> Linux/Block blkdev_issue_flush() 249 - */ 250 - void (*do_sync_cache)(struct se_task *); 251 - /* 252 - * free_task(): 253 - */ 254 - void (*free_task)(struct se_task *); 255 - /* 256 - * check_configfs_dev_params(): 257 - */ 258 - ssize_t (*check_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *); 259 - /* 260 - * set_configfs_dev_params(): 261 - */ 262 - ssize_t (*set_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *, 263 - const char *, ssize_t); 264 - /* 265 - * show_configfs_dev_params(): 266 - */ 267 - ssize_t (*show_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *, 268 - char *); 269 - /* 270 - * get_device_rev(): 271 - */ 272 - u32 (*get_device_rev)(struct se_device *); 273 - /* 274 - * get_device_type(): 275 - */ 276 - u32 (*get_device_type)(struct se_device *); 277 - /* 278 - * Get the sector_t from a subsystem backstore.. 279 - */ 280 - sector_t (*get_blocks)(struct se_device *); 281 - /* 282 - * get_sense_buffer(): 283 - */ 284 - unsigned char *(*get_sense_buffer)(struct se_task *); 285 - } ____cacheline_aligned; 286 - 287 - #endif /* TARGET_CORE_TRANSPORT_H */