Commit c4795fb20edf2fe2c862c8fe9f8b681edeb79ac1
Committed by
Nicholas Bellinger
1 parent
e26d99aed4
Exists in
master
and in
20 other branches
target: header reshuffle, part2
This reorganized the headers under include/target into: - target_core_base.h stays as is with all target-wide data stuctures and defines - target_core_backend.h contains the whole interface to I/O backends - target_core_fabric.h contains the whole interface to fabric modules Except for those only the various configfs macro headers stay around. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Showing 45 changed files with 391 additions and 565 deletions Side-by-side Diff
- Documentation/target/tcm_mod_builder.py
- drivers/target/iscsi/iscsi_target.c
- drivers/target/iscsi/iscsi_target_configfs.c
- drivers/target/iscsi/iscsi_target_device.c
- drivers/target/iscsi/iscsi_target_erl0.c
- drivers/target/iscsi/iscsi_target_erl1.c
- drivers/target/iscsi/iscsi_target_erl2.c
- drivers/target/iscsi/iscsi_target_login.c
- drivers/target/iscsi/iscsi_target_nego.c
- drivers/target/iscsi/iscsi_target_nodeattrib.c
- drivers/target/iscsi/iscsi_target_stat.c
- drivers/target/iscsi/iscsi_target_tmr.c
- drivers/target/iscsi/iscsi_target_tpg.c
- drivers/target/iscsi/iscsi_target_util.c
- drivers/target/loopback/tcm_loop.c
- drivers/target/target_core_alua.c
- drivers/target/target_core_cdb.c
- drivers/target/target_core_configfs.c
- drivers/target/target_core_device.c
- drivers/target/target_core_fabric_configfs.c
- drivers/target/target_core_fabric_lib.c
- drivers/target/target_core_file.c
- drivers/target/target_core_hba.c
- drivers/target/target_core_iblock.c
- drivers/target/target_core_pr.c
- drivers/target/target_core_pscsi.c
- drivers/target/target_core_rd.c
- drivers/target/target_core_stat.c
- drivers/target/target_core_tmr.c
- drivers/target/target_core_tpg.c
- drivers/target/target_core_transport.c
- drivers/target/target_core_ua.c
- drivers/target/tcm_fc/tfc_cmd.c
- drivers/target/tcm_fc/tfc_conf.c
- drivers/target/tcm_fc/tfc_io.c
- drivers/target/tcm_fc/tfc_sess.c
- include/target/target_core_backend.h
- include/target/target_core_base.h
- include/target/target_core_device.h
- include/target/target_core_fabric.h
- include/target/target_core_fabric_lib.h
- include/target/target_core_fabric_ops.h
- include/target/target_core_tmr.h
- include/target/target_core_tpg.h
- include/target/target_core_transport.h
Documentation/target/tcm_mod_builder.py
... | ... | @@ -230,14 +230,9 @@ |
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" |
... | ... | @@ -514,7 +509,7 @@ |
514 | 509 | |
515 | 510 | def tcm_mod_scan_fabric_ops(tcm_dir): |
516 | 511 | |
517 | - fabric_ops_api = tcm_dir + "include/target/target_core_fabric_ops.h" | |
512 | + fabric_ops_api = tcm_dir + "include/target/target_core_fabric.h" | |
518 | 513 | |
519 | 514 | print "Using tcm_mod_scan_fabric_ops: " + fabric_ops_api |
520 | 515 | process_fo = 0; |
... | ... | @@ -579,11 +574,7 @@ |
579 | 574 | buf += "#include <scsi/scsi_cmnd.h>\n" |
580 | 575 | buf += "#include <scsi/libfc.h>\n\n" |
581 | 576 | buf += "#include <target/target_core_base.h>\n" |
582 | - buf += "#include <target/target_core_transport.h>\n" | |
583 | - buf += "#include <target/target_core_fabric_ops.h>\n" | |
584 | - buf += "#include <target/target_core_fabric_lib.h>\n" | |
585 | - buf += "#include <target/target_core_device.h>\n" | |
586 | - buf += "#include <target/target_core_tpg.h>\n" | |
577 | + buf += "#include <target/target_core_fabric.h>\n" | |
587 | 578 | buf += "#include <target/target_core_configfs.h>\n\n" |
588 | 579 | buf += "#include \"" + fabric_mod_name + "_base.h\"\n" |
589 | 580 | buf += "#include \"" + fabric_mod_name + "_fabric.h\"\n\n" |
drivers/target/iscsi/iscsi_target.c
... | ... | @@ -27,8 +27,7 @@ |
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" |
drivers/target/iscsi/iscsi_target_configfs.c
... | ... | @@ -22,12 +22,8 @@ |
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 |
drivers/target/iscsi/iscsi_target_device.c
... | ... | @@ -21,8 +21,7 @@ |
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" |
drivers/target/iscsi/iscsi_target_erl0.c
drivers/target/iscsi/iscsi_target_erl1.c
... | ... | @@ -21,7 +21,7 @@ |
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" |
drivers/target/iscsi/iscsi_target_erl2.c
drivers/target/iscsi/iscsi_target_login.c
... | ... | @@ -23,7 +23,7 @@ |
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" |
drivers/target/iscsi/iscsi_target_nego.c
... | ... | @@ -21,7 +21,7 @@ |
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" |
drivers/target/iscsi/iscsi_target_nodeattrib.c
drivers/target/iscsi/iscsi_target_stat.c
drivers/target/iscsi/iscsi_target_tmr.c
... | ... | @@ -21,7 +21,7 @@ |
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" |
drivers/target/iscsi/iscsi_target_tpg.c
... | ... | @@ -19,10 +19,8 @@ |
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" |
drivers/target/iscsi/iscsi_target_util.c
... | ... | @@ -22,9 +22,7 @@ |
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" |
drivers/target/loopback/tcm_loop.c
... | ... | @@ -33,14 +33,9 @@ |
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 |
drivers/target/target_core_alua.c
... | ... | @@ -32,9 +32,8 @@ |
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 | |
40 | 39 | #include "target_core_internal.h" |
drivers/target/target_core_cdb.c
... | ... | @@ -29,8 +29,8 @@ |
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 | 34 | |
35 | 35 | #include "target_core_internal.h" |
36 | 36 | #include "target_core_ua.h" |
drivers/target/target_core_configfs.c
... | ... | @@ -39,9 +39,8 @@ |
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> |
drivers/target/target_core_device.c
... | ... | @@ -42,10 +42,8 @@ |
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 | |
50 | 48 | #include "target_core_internal.h" |
51 | 49 | #include "target_core_alua.h" |
drivers/target/target_core_fabric_configfs.c
... | ... | @@ -36,10 +36,7 @@ |
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> |
drivers/target/target_core_fabric_lib.c
... | ... | @@ -34,10 +34,7 @@ |
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 | 40 | #include "target_core_internal.h" |
drivers/target/target_core_file.c
drivers/target/target_core_hba.c
... | ... | @@ -37,9 +37,8 @@ |
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 | 43 | #include "target_core_internal.h" |
45 | 44 |
drivers/target/target_core_iblock.c
drivers/target/target_core_pr.c
... | ... | @@ -33,11 +33,8 @@ |
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 | 40 | #include "target_core_internal.h" |
drivers/target/target_core_pscsi.c
drivers/target/target_core_rd.c
... | ... | @@ -37,9 +37,7 @@ |
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 |
drivers/target/target_core_stat.c
... | ... | @@ -43,8 +43,8 @@ |
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 |
drivers/target/target_core_tmr.c
... | ... | @@ -32,10 +32,8 @@ |
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 | |
41 | 39 | #include "target_core_internal.h" |
drivers/target/target_core_tpg.c
... | ... | @@ -39,10 +39,8 @@ |
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 | 45 | #include "target_core_internal.h" |
48 | 46 |
drivers/target/target_core_transport.c
... | ... | @@ -45,11 +45,8 @@ |
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 | |
55 | 52 | #include "target_core_internal.h" |
drivers/target/target_core_ua.c
... | ... | @@ -30,9 +30,7 @@ |
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 | |
38 | 36 | #include "target_core_internal.h" |
drivers/target/tcm_fc/tfc_cmd.c
... | ... | @@ -39,12 +39,8 @@ |
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" |
drivers/target/tcm_fc/tfc_conf.c
... | ... | @@ -41,12 +41,8 @@ |
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 |
drivers/target/tcm_fc/tfc_io.c
... | ... | @@ -48,10 +48,7 @@ |
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 |
drivers/target/tcm_fc/tfc_sess.c
... | ... | @@ -40,10 +40,7 @@ |
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 |
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 */ |
include/target/target_core_base.h
... | ... | @@ -10,6 +10,7 @@ |
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 */ |
... | ... | @@ -53,6 +54,72 @@ |
53 | 54 | /* Used by transport_get_inquiry_vpd_device_ident() */ |
54 | 55 | #define INQUIRY_VPD_DEVICE_IDENTIFIER_LEN 254 |
55 | 56 | |
57 | +/* Attempts before moving from SHORT to LONG */ | |
58 | +#define PYX_TRANSPORT_WINDOW_CLOSED_THRESHOLD 3 | |
59 | +#define PYX_TRANSPORT_WINDOW_CLOSED_WAIT_SHORT 3 /* In milliseconds */ | |
60 | +#define PYX_TRANSPORT_WINDOW_CLOSED_WAIT_LONG 10 /* In milliseconds */ | |
61 | + | |
62 | +#define PYX_TRANSPORT_STATUS_INTERVAL 5 /* In seconds */ | |
63 | + | |
64 | +/* | |
65 | + * struct se_subsystem_dev->su_dev_flags | |
66 | +*/ | |
67 | +#define SDF_FIRMWARE_VPD_UNIT_SERIAL 0x00000001 | |
68 | +#define SDF_EMULATED_VPD_UNIT_SERIAL 0x00000002 | |
69 | +#define SDF_USING_UDEV_PATH 0x00000004 | |
70 | +#define SDF_USING_ALIAS 0x00000008 | |
71 | + | |
72 | +/* | |
73 | + * struct se_device->dev_flags | |
74 | + */ | |
75 | +#define DF_READ_ONLY 0x00000001 | |
76 | +#define DF_SPC2_RESERVATIONS 0x00000002 | |
77 | +#define DF_SPC2_RESERVATIONS_WITH_ISID 0x00000004 | |
78 | + | |
79 | +/* struct se_dev_attrib sanity values */ | |
80 | +/* Default max_unmap_lba_count */ | |
81 | +#define DA_MAX_UNMAP_LBA_COUNT 0 | |
82 | +/* Default max_unmap_block_desc_count */ | |
83 | +#define DA_MAX_UNMAP_BLOCK_DESC_COUNT 0 | |
84 | +/* Default unmap_granularity */ | |
85 | +#define DA_UNMAP_GRANULARITY_DEFAULT 0 | |
86 | +/* Default unmap_granularity_alignment */ | |
87 | +#define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0 | |
88 | +/* Emulation for Direct Page Out */ | |
89 | +#define DA_EMULATE_DPO 0 | |
90 | +/* Emulation for Forced Unit Access WRITEs */ | |
91 | +#define DA_EMULATE_FUA_WRITE 1 | |
92 | +/* Emulation for Forced Unit Access READs */ | |
93 | +#define DA_EMULATE_FUA_READ 0 | |
94 | +/* Emulation for WriteCache and SYNCHRONIZE_CACHE */ | |
95 | +#define DA_EMULATE_WRITE_CACHE 0 | |
96 | +/* Emulation for UNIT ATTENTION Interlock Control */ | |
97 | +#define DA_EMULATE_UA_INTLLCK_CTRL 0 | |
98 | +/* Emulation for TASK_ABORTED status (TAS) by default */ | |
99 | +#define DA_EMULATE_TAS 1 | |
100 | +/* Emulation for Thin Provisioning UNMAP using block/blk-lib.c:blkdev_issue_discard() */ | |
101 | +#define DA_EMULATE_TPU 0 | |
102 | +/* | |
103 | + * Emulation for Thin Provisioning WRITE_SAME w/ UNMAP=1 bit using | |
104 | + * block/blk-lib.c:blkdev_issue_discard() | |
105 | + */ | |
106 | +#define DA_EMULATE_TPWS 0 | |
107 | +/* No Emulation for PSCSI by default */ | |
108 | +#define DA_EMULATE_RESERVATIONS 0 | |
109 | +/* No Emulation for PSCSI by default */ | |
110 | +#define DA_EMULATE_ALUA 0 | |
111 | +/* Enforce SCSI Initiator Port TransportID with 'ISID' for PR */ | |
112 | +#define DA_ENFORCE_PR_ISIDS 1 | |
113 | +#define DA_STATUS_MAX_SECTORS_MIN 16 | |
114 | +#define DA_STATUS_MAX_SECTORS_MAX 8192 | |
115 | +/* By default don't report non-rotating (solid state) medium */ | |
116 | +#define DA_IS_NONROT 0 | |
117 | +/* Queue Algorithm Modifier default for restricted reordering in control mode page */ | |
118 | +#define DA_EMULATE_REST_REORD 0 | |
119 | + | |
120 | +#define SE_MODE_PAGE_BUF 512 | |
121 | + | |
122 | + | |
56 | 123 | /* struct se_hba->hba_flags */ |
57 | 124 | enum hba_flags_table { |
58 | 125 | HBA_FLAGS_INTERNAL_USE = 0x01, |
... | ... | @@ -156,6 +223,30 @@ |
156 | 223 | TCM_CHECK_CONDITION_UNIT_ATTENTION = 0x0e, |
157 | 224 | TCM_CHECK_CONDITION_NOT_READY = 0x0f, |
158 | 225 | TCM_RESERVATION_CONFLICT = 0x10, |
226 | +}; | |
227 | + | |
228 | +/* fabric independent task management function values */ | |
229 | +enum tcm_tmreq_table { | |
230 | + TMR_ABORT_TASK = 1, | |
231 | + TMR_ABORT_TASK_SET = 2, | |
232 | + TMR_CLEAR_ACA = 3, | |
233 | + TMR_CLEAR_TASK_SET = 4, | |
234 | + TMR_LUN_RESET = 5, | |
235 | + TMR_TARGET_WARM_RESET = 6, | |
236 | + TMR_TARGET_COLD_RESET = 7, | |
237 | + TMR_FABRIC_TMR = 255, | |
238 | +}; | |
239 | + | |
240 | +/* fabric independent task management response values */ | |
241 | +enum tcm_tmrsp_table { | |
242 | + TMR_FUNCTION_COMPLETE = 0, | |
243 | + TMR_TASK_DOES_NOT_EXIST = 1, | |
244 | + TMR_LUN_DOES_NOT_EXIST = 2, | |
245 | + TMR_TASK_STILL_ALLEGIANT = 3, | |
246 | + TMR_TASK_FAILOVER_NOT_SUPPORTED = 4, | |
247 | + TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED = 5, | |
248 | + TMR_FUNCTION_AUTHORIZATION_FAILED = 6, | |
249 | + TMR_FUNCTION_REJECTED = 255, | |
159 | 250 | }; |
160 | 251 | |
161 | 252 | struct se_obj { |
include/target/target_core_device.h
include/target/target_core_fabric.h
1 | +#ifndef TARGET_CORE_FABRIC_H | |
2 | +#define TARGET_CORE_FABRIC_H | |
3 | + | |
4 | +struct target_core_fabric_ops { | |
5 | + struct configfs_subsystem *tf_subsys; | |
6 | + /* | |
7 | + * Optional to signal struct se_task->task_sg[] padding entries | |
8 | + * for scatterlist chaining using transport_do_task_sg_link(), | |
9 | + * disabled by default | |
10 | + */ | |
11 | + bool task_sg_chaining; | |
12 | + char *(*get_fabric_name)(void); | |
13 | + u8 (*get_fabric_proto_ident)(struct se_portal_group *); | |
14 | + char *(*tpg_get_wwn)(struct se_portal_group *); | |
15 | + u16 (*tpg_get_tag)(struct se_portal_group *); | |
16 | + u32 (*tpg_get_default_depth)(struct se_portal_group *); | |
17 | + u32 (*tpg_get_pr_transport_id)(struct se_portal_group *, | |
18 | + struct se_node_acl *, | |
19 | + struct t10_pr_registration *, int *, | |
20 | + unsigned char *); | |
21 | + u32 (*tpg_get_pr_transport_id_len)(struct se_portal_group *, | |
22 | + struct se_node_acl *, | |
23 | + struct t10_pr_registration *, int *); | |
24 | + char *(*tpg_parse_pr_out_transport_id)(struct se_portal_group *, | |
25 | + const char *, u32 *, char **); | |
26 | + int (*tpg_check_demo_mode)(struct se_portal_group *); | |
27 | + int (*tpg_check_demo_mode_cache)(struct se_portal_group *); | |
28 | + int (*tpg_check_demo_mode_write_protect)(struct se_portal_group *); | |
29 | + int (*tpg_check_prod_mode_write_protect)(struct se_portal_group *); | |
30 | + /* | |
31 | + * Optionally used by fabrics to allow demo-mode login, but not | |
32 | + * expose any TPG LUNs, and return 'not connected' in standard | |
33 | + * inquiry response | |
34 | + */ | |
35 | + int (*tpg_check_demo_mode_login_only)(struct se_portal_group *); | |
36 | + struct se_node_acl *(*tpg_alloc_fabric_acl)( | |
37 | + struct se_portal_group *); | |
38 | + void (*tpg_release_fabric_acl)(struct se_portal_group *, | |
39 | + struct se_node_acl *); | |
40 | + u32 (*tpg_get_inst_index)(struct se_portal_group *); | |
41 | + /* | |
42 | + * Optional function pointer for TCM to perform command map | |
43 | + * from TCM processing thread context, for those struct se_cmd | |
44 | + * initially allocated in interrupt context. | |
45 | + */ | |
46 | + int (*new_cmd_map)(struct se_cmd *); | |
47 | + /* | |
48 | + * Optional to release struct se_cmd and fabric dependent allocated | |
49 | + * I/O descriptor in transport_cmd_check_stop(). | |
50 | + * | |
51 | + * Returning 1 will signal a descriptor has been released. | |
52 | + * Returning 0 will signal a descriptor has not been released. | |
53 | + */ | |
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 | + void (*release_cmd)(struct se_cmd *); | |
60 | + /* | |
61 | + * Called with spin_lock_bh(struct se_portal_group->session_lock held. | |
62 | + */ | |
63 | + int (*shutdown_session)(struct se_session *); | |
64 | + void (*close_session)(struct se_session *); | |
65 | + void (*stop_session)(struct se_session *, int, int); | |
66 | + void (*fall_back_to_erl0)(struct se_session *); | |
67 | + int (*sess_logged_in)(struct se_session *); | |
68 | + u32 (*sess_get_index)(struct se_session *); | |
69 | + /* | |
70 | + * Used only for SCSI fabrics that contain multi-value TransportIDs | |
71 | + * (like iSCSI). All other SCSI fabrics should set this to NULL. | |
72 | + */ | |
73 | + u32 (*sess_get_initiator_sid)(struct se_session *, | |
74 | + unsigned char *, u32); | |
75 | + int (*write_pending)(struct se_cmd *); | |
76 | + int (*write_pending_status)(struct se_cmd *); | |
77 | + void (*set_default_node_attributes)(struct se_node_acl *); | |
78 | + u32 (*get_task_tag)(struct se_cmd *); | |
79 | + int (*get_cmd_state)(struct se_cmd *); | |
80 | + int (*queue_data_in)(struct se_cmd *); | |
81 | + int (*queue_status)(struct se_cmd *); | |
82 | + int (*queue_tm_rsp)(struct se_cmd *); | |
83 | + u16 (*set_fabric_sense_len)(struct se_cmd *, u32); | |
84 | + u16 (*get_fabric_sense_len)(void); | |
85 | + int (*is_state_remove)(struct se_cmd *); | |
86 | + /* | |
87 | + * fabric module calls for target_core_fabric_configfs.c | |
88 | + */ | |
89 | + struct se_wwn *(*fabric_make_wwn)(struct target_fabric_configfs *, | |
90 | + struct config_group *, const char *); | |
91 | + void (*fabric_drop_wwn)(struct se_wwn *); | |
92 | + struct se_portal_group *(*fabric_make_tpg)(struct se_wwn *, | |
93 | + struct config_group *, const char *); | |
94 | + void (*fabric_drop_tpg)(struct se_portal_group *); | |
95 | + int (*fabric_post_link)(struct se_portal_group *, | |
96 | + struct se_lun *); | |
97 | + void (*fabric_pre_unlink)(struct se_portal_group *, | |
98 | + struct se_lun *); | |
99 | + struct se_tpg_np *(*fabric_make_np)(struct se_portal_group *, | |
100 | + struct config_group *, const char *); | |
101 | + void (*fabric_drop_np)(struct se_tpg_np *); | |
102 | + struct se_node_acl *(*fabric_make_nodeacl)(struct se_portal_group *, | |
103 | + struct config_group *, const char *); | |
104 | + void (*fabric_drop_nodeacl)(struct se_node_acl *); | |
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 transport_handle_cdb_direct(struct se_cmd *); | |
122 | +int transport_generic_handle_cdb_map(struct se_cmd *); | |
123 | +int transport_generic_handle_data(struct se_cmd *); | |
124 | +int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, | |
125 | + struct scatterlist *, u32, struct scatterlist *, u32); | |
126 | +void transport_do_task_sg_chain(struct se_cmd *); | |
127 | +int transport_generic_new_cmd(struct se_cmd *); | |
128 | + | |
129 | +void transport_generic_process_write(struct se_cmd *); | |
130 | + | |
131 | +void transport_generic_free_cmd(struct se_cmd *, int); | |
132 | + | |
133 | +bool transport_wait_for_tasks(struct se_cmd *); | |
134 | +int transport_check_aborted_status(struct se_cmd *, int); | |
135 | +int transport_send_check_condition_and_sense(struct se_cmd *, u8, int); | |
136 | + | |
137 | +void target_get_sess_cmd(struct se_session *, struct se_cmd *); | |
138 | +int target_put_sess_cmd(struct se_session *, struct se_cmd *); | |
139 | +void target_splice_sess_cmd_list(struct se_session *); | |
140 | +void target_wait_for_sess_cmds(struct se_session *, int); | |
141 | + | |
142 | +int core_alua_check_nonop_delay(struct se_cmd *); | |
143 | + | |
144 | +struct se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t); | |
145 | +void core_tmr_release_req(struct se_tmr_req *); | |
146 | +int transport_generic_handle_tmr(struct se_cmd *); | |
147 | +int transport_lookup_tmr_lun(struct se_cmd *, u32); | |
148 | + | |
149 | +struct se_node_acl *core_tpg_check_initiator_node_acl(struct se_portal_group *, | |
150 | + unsigned char *); | |
151 | +void core_tpg_clear_object_luns(struct se_portal_group *); | |
152 | +struct se_node_acl *core_tpg_add_initiator_node_acl(struct se_portal_group *, | |
153 | + struct se_node_acl *, const char *, u32); | |
154 | +int core_tpg_del_initiator_node_acl(struct se_portal_group *, | |
155 | + struct se_node_acl *, int); | |
156 | +int core_tpg_set_initiator_node_queue_depth(struct se_portal_group *, | |
157 | + unsigned char *, u32, int); | |
158 | +int core_tpg_register(struct target_core_fabric_ops *, struct se_wwn *, | |
159 | + struct se_portal_group *, void *, int); | |
160 | +int core_tpg_deregister(struct se_portal_group *); | |
161 | + | |
162 | +/* SAS helpers */ | |
163 | +u8 sas_get_fabric_proto_ident(struct se_portal_group *); | |
164 | +u32 sas_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *, | |
165 | + struct t10_pr_registration *, int *, unsigned char *); | |
166 | +u32 sas_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *, | |
167 | + struct t10_pr_registration *, int *); | |
168 | +char *sas_parse_pr_out_transport_id(struct se_portal_group *, const char *, | |
169 | + u32 *, char **); | |
170 | + | |
171 | +/* FC helpers */ | |
172 | +u8 fc_get_fabric_proto_ident(struct se_portal_group *); | |
173 | +u32 fc_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *, | |
174 | + struct t10_pr_registration *, int *, unsigned char *); | |
175 | +u32 fc_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *, | |
176 | + struct t10_pr_registration *, int *); | |
177 | +char *fc_parse_pr_out_transport_id(struct se_portal_group *, const char *, | |
178 | + u32 *, char **); | |
179 | + | |
180 | +/* iSCSI helpers */ | |
181 | +u8 iscsi_get_fabric_proto_ident(struct se_portal_group *); | |
182 | +u32 iscsi_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *, | |
183 | + struct t10_pr_registration *, int *, unsigned char *); | |
184 | +u32 iscsi_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *, | |
185 | + struct t10_pr_registration *, int *); | |
186 | +char *iscsi_parse_pr_out_transport_id(struct se_portal_group *, const char *, | |
187 | + u32 *, char **); | |
188 | + | |
189 | +#endif /* TARGET_CORE_FABRICH */ |
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 */ |
include/target/target_core_fabric_ops.h
1 | -/* Defined in target_core_configfs.h */ | |
2 | -struct target_fabric_configfs; | |
3 | - | |
4 | -struct target_core_fabric_ops { | |
5 | - struct configfs_subsystem *tf_subsys; | |
6 | - /* | |
7 | - * Optional to signal struct se_task->task_sg[] padding entries | |
8 | - * for scatterlist chaining using transport_do_task_sg_link(), | |
9 | - * disabled by default | |
10 | - */ | |
11 | - bool task_sg_chaining; | |
12 | - char *(*get_fabric_name)(void); | |
13 | - u8 (*get_fabric_proto_ident)(struct se_portal_group *); | |
14 | - char *(*tpg_get_wwn)(struct se_portal_group *); | |
15 | - u16 (*tpg_get_tag)(struct se_portal_group *); | |
16 | - u32 (*tpg_get_default_depth)(struct se_portal_group *); | |
17 | - u32 (*tpg_get_pr_transport_id)(struct se_portal_group *, | |
18 | - struct se_node_acl *, | |
19 | - struct t10_pr_registration *, int *, | |
20 | - unsigned char *); | |
21 | - u32 (*tpg_get_pr_transport_id_len)(struct se_portal_group *, | |
22 | - struct se_node_acl *, | |
23 | - struct t10_pr_registration *, int *); | |
24 | - char *(*tpg_parse_pr_out_transport_id)(struct se_portal_group *, | |
25 | - const char *, u32 *, char **); | |
26 | - int (*tpg_check_demo_mode)(struct se_portal_group *); | |
27 | - int (*tpg_check_demo_mode_cache)(struct se_portal_group *); | |
28 | - int (*tpg_check_demo_mode_write_protect)(struct se_portal_group *); | |
29 | - int (*tpg_check_prod_mode_write_protect)(struct se_portal_group *); | |
30 | - /* | |
31 | - * Optionally used by fabrics to allow demo-mode login, but not | |
32 | - * expose any TPG LUNs, and return 'not connected' in standard | |
33 | - * inquiry response | |
34 | - */ | |
35 | - int (*tpg_check_demo_mode_login_only)(struct se_portal_group *); | |
36 | - struct se_node_acl *(*tpg_alloc_fabric_acl)( | |
37 | - struct se_portal_group *); | |
38 | - void (*tpg_release_fabric_acl)(struct se_portal_group *, | |
39 | - struct se_node_acl *); | |
40 | - u32 (*tpg_get_inst_index)(struct se_portal_group *); | |
41 | - /* | |
42 | - * Optional function pointer for TCM to perform command map | |
43 | - * from TCM processing thread context, for those struct se_cmd | |
44 | - * initially allocated in interrupt context. | |
45 | - */ | |
46 | - int (*new_cmd_map)(struct se_cmd *); | |
47 | - /* | |
48 | - * Optional to release struct se_cmd and fabric dependent allocated | |
49 | - * I/O descriptor in transport_cmd_check_stop(). | |
50 | - * | |
51 | - * Returning 1 will signal a descriptor has been released. | |
52 | - * Returning 0 will signal a descriptor has not been released. | |
53 | - */ | |
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 | - void (*release_cmd)(struct se_cmd *); | |
60 | - /* | |
61 | - * Called with spin_lock_bh(struct se_portal_group->session_lock held. | |
62 | - */ | |
63 | - int (*shutdown_session)(struct se_session *); | |
64 | - void (*close_session)(struct se_session *); | |
65 | - void (*stop_session)(struct se_session *, int, int); | |
66 | - void (*fall_back_to_erl0)(struct se_session *); | |
67 | - int (*sess_logged_in)(struct se_session *); | |
68 | - u32 (*sess_get_index)(struct se_session *); | |
69 | - /* | |
70 | - * Used only for SCSI fabrics that contain multi-value TransportIDs | |
71 | - * (like iSCSI). All other SCSI fabrics should set this to NULL. | |
72 | - */ | |
73 | - u32 (*sess_get_initiator_sid)(struct se_session *, | |
74 | - unsigned char *, u32); | |
75 | - int (*write_pending)(struct se_cmd *); | |
76 | - int (*write_pending_status)(struct se_cmd *); | |
77 | - void (*set_default_node_attributes)(struct se_node_acl *); | |
78 | - u32 (*get_task_tag)(struct se_cmd *); | |
79 | - int (*get_cmd_state)(struct se_cmd *); | |
80 | - int (*queue_data_in)(struct se_cmd *); | |
81 | - int (*queue_status)(struct se_cmd *); | |
82 | - int (*queue_tm_rsp)(struct se_cmd *); | |
83 | - u16 (*set_fabric_sense_len)(struct se_cmd *, u32); | |
84 | - u16 (*get_fabric_sense_len)(void); | |
85 | - int (*is_state_remove)(struct se_cmd *); | |
86 | - /* | |
87 | - * fabric module calls for target_core_fabric_configfs.c | |
88 | - */ | |
89 | - struct se_wwn *(*fabric_make_wwn)(struct target_fabric_configfs *, | |
90 | - struct config_group *, const char *); | |
91 | - void (*fabric_drop_wwn)(struct se_wwn *); | |
92 | - struct se_portal_group *(*fabric_make_tpg)(struct se_wwn *, | |
93 | - struct config_group *, const char *); | |
94 | - void (*fabric_drop_tpg)(struct se_portal_group *); | |
95 | - int (*fabric_post_link)(struct se_portal_group *, | |
96 | - struct se_lun *); | |
97 | - void (*fabric_pre_unlink)(struct se_portal_group *, | |
98 | - struct se_lun *); | |
99 | - struct se_tpg_np *(*fabric_make_np)(struct se_portal_group *, | |
100 | - struct config_group *, const char *); | |
101 | - void (*fabric_drop_np)(struct se_tpg_np *); | |
102 | - struct se_node_acl *(*fabric_make_nodeacl)(struct se_portal_group *, | |
103 | - struct config_group *, const char *); | |
104 | - void (*fabric_drop_nodeacl)(struct se_node_acl *); | |
105 | -}; |
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 se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t); | |
29 | -extern void core_tmr_release_req(struct se_tmr_req *); | |
30 | - | |
31 | -#endif /* TARGET_CORE_TMR_H */ |
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_check_initiator_node_acl( | |
5 | - struct se_portal_group *, | |
6 | - unsigned char *); | |
7 | -extern void core_tpg_clear_object_luns(struct se_portal_group *); | |
8 | -extern struct se_node_acl *core_tpg_add_initiator_node_acl( | |
9 | - struct se_portal_group *, | |
10 | - struct se_node_acl *, | |
11 | - const char *, u32); | |
12 | -extern int core_tpg_del_initiator_node_acl(struct se_portal_group *, | |
13 | - struct se_node_acl *, int); | |
14 | -extern int core_tpg_set_initiator_node_queue_depth(struct se_portal_group *, | |
15 | - unsigned char *, u32, int); | |
16 | -extern int core_tpg_register(struct target_core_fabric_ops *, | |
17 | - struct se_wwn *, | |
18 | - struct se_portal_group *, void *, | |
19 | - int); | |
20 | -extern int core_tpg_deregister(struct se_portal_group *); | |
21 | - | |
22 | -#endif /* TARGET_CORE_TPG_H */ |
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 transport_subsystem_register(struct se_subsystem_api *); | |
80 | -extern void transport_subsystem_release(struct se_subsystem_api *); | |
81 | -extern struct se_session *transport_init_session(void); | |
82 | -extern void __transport_register_session(struct se_portal_group *, | |
83 | - struct se_node_acl *, | |
84 | - struct se_session *, void *); | |
85 | -extern void transport_register_session(struct se_portal_group *, | |
86 | - struct se_node_acl *, | |
87 | - struct se_session *, void *); | |
88 | -extern void transport_free_session(struct se_session *); | |
89 | -extern void transport_deregister_session_configfs(struct se_session *); | |
90 | -extern void transport_deregister_session(struct se_session *); | |
91 | -extern void transport_complete_sync_cache(struct se_cmd *, int); | |
92 | -extern void transport_complete_task(struct se_task *, int); | |
93 | - | |
94 | -extern void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *); | |
95 | -extern int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *); | |
96 | -extern int transport_set_vpd_ident_type(struct t10_vpd *, unsigned char *); | |
97 | -extern int transport_set_vpd_ident(struct t10_vpd *, unsigned char *); | |
98 | - | |
99 | -extern struct se_device *transport_add_device_to_core_hba(struct se_hba *, | |
100 | - struct se_subsystem_api *, | |
101 | - struct se_subsystem_dev *, u32, | |
102 | - void *, struct se_dev_limits *, | |
103 | - const char *, const char *); | |
104 | -extern void transport_init_se_cmd(struct se_cmd *, | |
105 | - struct target_core_fabric_ops *, | |
106 | - struct se_session *, u32, int, int, | |
107 | - unsigned char *); | |
108 | -void *transport_kmap_first_data_page(struct se_cmd *cmd); | |
109 | -void transport_kunmap_first_data_page(struct se_cmd *cmd); | |
110 | -extern int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); | |
111 | -extern int transport_handle_cdb_direct(struct se_cmd *); | |
112 | -extern int transport_generic_handle_cdb_map(struct se_cmd *); | |
113 | -extern int transport_generic_handle_data(struct se_cmd *); | |
114 | -extern int transport_generic_handle_tmr(struct se_cmd *); | |
115 | -extern int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *, u32, | |
116 | - struct scatterlist *, u32); | |
117 | -extern bool transport_wait_for_tasks(struct se_cmd *); | |
118 | -extern int transport_check_aborted_status(struct se_cmd *, int); | |
119 | -extern int transport_send_check_condition_and_sense(struct se_cmd *, u8, int); | |
120 | -extern void transport_generic_free_cmd(struct se_cmd *, int); | |
121 | -extern void target_get_sess_cmd(struct se_session *, struct se_cmd *); | |
122 | -extern int target_put_sess_cmd(struct se_session *, struct se_cmd *); | |
123 | -extern void target_splice_sess_cmd_list(struct se_session *); | |
124 | -extern void target_wait_for_sess_cmds(struct se_session *, int); | |
125 | -extern void transport_do_task_sg_chain(struct se_cmd *); | |
126 | -extern void transport_generic_process_write(struct se_cmd *); | |
127 | -extern int transport_generic_new_cmd(struct se_cmd *); | |
128 | -/* From target_core_alua.c */ | |
129 | -extern int core_alua_check_nonop_delay(struct se_cmd *); | |
130 | -/* From target_core_cdb.c */ | |
131 | -extern void target_get_task_cdb(struct se_task *task, unsigned char *cdb); | |
132 | - | |
133 | -/* | |
134 | - * Each se_transport_task_t can have N number of possible struct se_task's | |
135 | - * for the storage transport(s) to possibly execute. | |
136 | - * Used primarily for splitting up CDBs that exceed the physical storage | |
137 | - * HBA's maximum sector count per task. | |
138 | - */ | |
139 | -struct se_mem { | |
140 | - struct page *se_page; | |
141 | - u32 se_len; | |
142 | - u32 se_off; | |
143 | - struct list_head se_list; | |
144 | -} ____cacheline_aligned; | |
145 | - | |
146 | -/* | |
147 | - * Each type of disk transport supported MUST have a template defined | |
148 | - * within its .h file. | |
149 | - */ | |
150 | -struct se_subsystem_api { | |
151 | - /* | |
152 | - * The Name. :-) | |
153 | - */ | |
154 | - char name[16]; | |
155 | - /* | |
156 | - * Transport Type. | |
157 | - */ | |
158 | - u8 transport_type; | |
159 | - | |
160 | - unsigned int fua_write_emulated : 1; | |
161 | - unsigned int write_cache_emulated : 1; | |
162 | - | |
163 | - /* | |
164 | - * struct module for struct se_hba references | |
165 | - */ | |
166 | - struct module *owner; | |
167 | - /* | |
168 | - * Used for global se_subsystem_api list_head | |
169 | - */ | |
170 | - struct list_head sub_api_list; | |
171 | - /* | |
172 | - * attach_hba(): | |
173 | - */ | |
174 | - int (*attach_hba)(struct se_hba *, u32); | |
175 | - /* | |
176 | - * detach_hba(): | |
177 | - */ | |
178 | - void (*detach_hba)(struct se_hba *); | |
179 | - /* | |
180 | - * pmode_hba(): Used for TCM/pSCSI subsystem plugin HBA -> | |
181 | - * Linux/SCSI struct Scsi_Host passthrough | |
182 | - */ | |
183 | - int (*pmode_enable_hba)(struct se_hba *, unsigned long); | |
184 | - /* | |
185 | - * allocate_virtdevice(): | |
186 | - */ | |
187 | - void *(*allocate_virtdevice)(struct se_hba *, const char *); | |
188 | - /* | |
189 | - * create_virtdevice(): Only for Virtual HBAs | |
190 | - */ | |
191 | - struct se_device *(*create_virtdevice)(struct se_hba *, | |
192 | - struct se_subsystem_dev *, void *); | |
193 | - /* | |
194 | - * free_device(): | |
195 | - */ | |
196 | - void (*free_device)(void *); | |
197 | - | |
198 | - /* | |
199 | - * transport_complete(): | |
200 | - * | |
201 | - * Use transport_generic_complete() for majority of DAS transport | |
202 | - * drivers. Provided out of convenience. | |
203 | - */ | |
204 | - int (*transport_complete)(struct se_task *task); | |
205 | - struct se_task *(*alloc_task)(unsigned char *cdb); | |
206 | - /* | |
207 | - * do_task(): | |
208 | - */ | |
209 | - int (*do_task)(struct se_task *); | |
210 | - /* | |
211 | - * Used by virtual subsystem plugins IBLOCK and FILEIO to emulate | |
212 | - * UNMAP and WRITE_SAME_* w/ UNMAP=1 <-> Linux/Block Discard | |
213 | - */ | |
214 | - int (*do_discard)(struct se_device *, sector_t, u32); | |
215 | - /* | |
216 | - * Used by virtual subsystem plugins IBLOCK and FILEIO to emulate | |
217 | - * SYNCHRONIZE_CACHE_* <-> Linux/Block blkdev_issue_flush() | |
218 | - */ | |
219 | - void (*do_sync_cache)(struct se_task *); | |
220 | - /* | |
221 | - * free_task(): | |
222 | - */ | |
223 | - void (*free_task)(struct se_task *); | |
224 | - /* | |
225 | - * check_configfs_dev_params(): | |
226 | - */ | |
227 | - ssize_t (*check_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *); | |
228 | - /* | |
229 | - * set_configfs_dev_params(): | |
230 | - */ | |
231 | - ssize_t (*set_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *, | |
232 | - const char *, ssize_t); | |
233 | - /* | |
234 | - * show_configfs_dev_params(): | |
235 | - */ | |
236 | - ssize_t (*show_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *, | |
237 | - char *); | |
238 | - /* | |
239 | - * get_device_rev(): | |
240 | - */ | |
241 | - u32 (*get_device_rev)(struct se_device *); | |
242 | - /* | |
243 | - * get_device_type(): | |
244 | - */ | |
245 | - u32 (*get_device_type)(struct se_device *); | |
246 | - /* | |
247 | - * Get the sector_t from a subsystem backstore.. | |
248 | - */ | |
249 | - sector_t (*get_blocks)(struct se_device *); | |
250 | - /* | |
251 | - * get_sense_buffer(): | |
252 | - */ | |
253 | - unsigned char *(*get_sense_buffer)(struct se_task *); | |
254 | -} ____cacheline_aligned; | |
255 | - | |
256 | -#endif /* TARGET_CORE_TRANSPORT_H */ |