summaryrefslogtreecommitdiffstats
path: root/Documentation/target
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2015-05-01 11:47:58 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2015-05-31 01:42:30 -0400
commit2650d71e244fb3637b5f58a0080682a8bf9c7091 (patch)
tree8fe28878d010df59f9b13b69b1e994270054218f /Documentation/target
parent2aeeafae6bb9f04dbe17b521bcd8f0d03516c393 (diff)
target: move transport ID handling to the core
Now that struct se_portal_group contains a protocol identifier field we can take all the code to format an parse protocol identifiers in CDBs into common code instead of leaving this to low-level drivers. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'Documentation/target')
-rwxr-xr-xDocumentation/target/tcm_mod_builder.py121
1 files changed, 0 insertions, 121 deletions
diff --git a/Documentation/target/tcm_mod_builder.py b/Documentation/target/tcm_mod_builder.py
index 29176c29537c..0dbd70cccde1 100755
--- a/Documentation/target/tcm_mod_builder.py
+++ b/Documentation/target/tcm_mod_builder.py
@@ -60,8 +60,6 @@ def tcm_mod_build_FC_include(fabric_mod_dir_var, fabric_mod_name):
60 buf += "};\n" 60 buf += "};\n"
61 buf += "\n" 61 buf += "\n"
62 buf += "struct " + fabric_mod_name + "_lport {\n" 62 buf += "struct " + fabric_mod_name + "_lport {\n"
63 buf += " /* SCSI protocol the lport is providing */\n"
64 buf += " u8 lport_proto_id;\n"
65 buf += " /* Binary World Wide unique Port Name for FC Target Lport */\n" 63 buf += " /* Binary World Wide unique Port Name for FC Target Lport */\n"
66 buf += " u64 lport_wwpn;\n" 64 buf += " u64 lport_wwpn;\n"
67 buf += " /* ASCII formatted WWPN for FC Target Lport */\n" 65 buf += " /* ASCII formatted WWPN for FC Target Lport */\n"
@@ -105,8 +103,6 @@ def tcm_mod_build_SAS_include(fabric_mod_dir_var, fabric_mod_name):
105 buf += " struct se_portal_group se_tpg;\n" 103 buf += " struct se_portal_group se_tpg;\n"
106 buf += "};\n\n" 104 buf += "};\n\n"
107 buf += "struct " + fabric_mod_name + "_tport {\n" 105 buf += "struct " + fabric_mod_name + "_tport {\n"
108 buf += " /* SCSI protocol the tport is providing */\n"
109 buf += " u8 tport_proto_id;\n"
110 buf += " /* Binary World Wide unique Port Name for SAS Target port */\n" 106 buf += " /* Binary World Wide unique Port Name for SAS Target port */\n"
111 buf += " u64 tport_wwpn;\n" 107 buf += " u64 tport_wwpn;\n"
112 buf += " /* ASCII formatted WWPN for SAS Target port */\n" 108 buf += " /* ASCII formatted WWPN for SAS Target port */\n"
@@ -150,8 +146,6 @@ def tcm_mod_build_iSCSI_include(fabric_mod_dir_var, fabric_mod_name):
150 buf += " struct se_portal_group se_tpg;\n" 146 buf += " struct se_portal_group se_tpg;\n"
151 buf += "};\n\n" 147 buf += "};\n\n"
152 buf += "struct " + fabric_mod_name + "_tport {\n" 148 buf += "struct " + fabric_mod_name + "_tport {\n"
153 buf += " /* SCSI protocol the tport is providing */\n"
154 buf += " u8 tport_proto_id;\n"
155 buf += " /* ASCII formatted TargetName for IQN */\n" 149 buf += " /* ASCII formatted TargetName for IQN */\n"
156 buf += " char tport_name[" + fabric_mod_name.upper() + "_NAMELEN];\n" 150 buf += " char tport_name[" + fabric_mod_name.upper() + "_NAMELEN];\n"
157 buf += " /* Returned by " + fabric_mod_name + "_make_tport() */\n" 151 buf += " /* Returned by " + fabric_mod_name + "_make_tport() */\n"
@@ -303,9 +297,6 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
303 buf += " .get_fabric_name = " + fabric_mod_name + "_get_fabric_name,\n" 297 buf += " .get_fabric_name = " + fabric_mod_name + "_get_fabric_name,\n"
304 buf += " .tpg_get_wwn = " + fabric_mod_name + "_get_fabric_wwn,\n" 298 buf += " .tpg_get_wwn = " + fabric_mod_name + "_get_fabric_wwn,\n"
305 buf += " .tpg_get_tag = " + fabric_mod_name + "_get_tag,\n" 299 buf += " .tpg_get_tag = " + fabric_mod_name + "_get_tag,\n"
306 buf += " .tpg_get_pr_transport_id = " + fabric_mod_name + "_get_pr_transport_id,\n"
307 buf += " .tpg_get_pr_transport_id_len = " + fabric_mod_name + "_get_pr_transport_id_len,\n"
308 buf += " .tpg_parse_pr_out_transport_id = " + fabric_mod_name + "_parse_pr_out_transport_id,\n"
309 buf += " .tpg_check_demo_mode = " + fabric_mod_name + "_check_false,\n" 300 buf += " .tpg_check_demo_mode = " + fabric_mod_name + "_check_false,\n"
310 buf += " .tpg_check_demo_mode_cache = " + fabric_mod_name + "_check_true,\n" 301 buf += " .tpg_check_demo_mode_cache = " + fabric_mod_name + "_check_true,\n"
311 buf += " .tpg_check_demo_mode_write_protect = " + fabric_mod_name + "_check_true,\n" 302 buf += " .tpg_check_demo_mode_write_protect = " + fabric_mod_name + "_check_true,\n"
@@ -478,118 +469,6 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
478 buf += "}\n\n" 469 buf += "}\n\n"
479 bufi += "u16 " + fabric_mod_name + "_get_tag(struct se_portal_group *);\n" 470 bufi += "u16 " + fabric_mod_name + "_get_tag(struct se_portal_group *);\n"
480 471
481 if re.search('get_pr_transport_id\)\(', fo):
482 buf += "u32 " + fabric_mod_name + "_get_pr_transport_id(\n"
483 buf += " struct se_portal_group *se_tpg,\n"
484 buf += " struct se_node_acl *se_nacl,\n"
485 buf += " struct t10_pr_registration *pr_reg,\n"
486 buf += " int *format_code,\n"
487 buf += " unsigned char *buf)\n"
488 buf += "{\n"
489 buf += " struct " + fabric_mod_name + "_tpg *tpg = container_of(se_tpg,\n"
490 buf += " struct " + fabric_mod_name + "_tpg, se_tpg);\n"
491 buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + " *" + fabric_mod_port + " = tpg->" + fabric_mod_port + ";\n"
492 buf += " int ret = 0;\n\n"
493 buf += " switch (" + fabric_mod_port + "->" + fabric_mod_port + "_proto_id) {\n"
494 if proto_ident == "FC":
495 buf += " case SCSI_PROTOCOL_FCP:\n"
496 buf += " default:\n"
497 buf += " ret = fc_get_pr_transport_id(se_tpg, se_nacl, pr_reg,\n"
498 buf += " format_code, buf);\n"
499 buf += " break;\n"
500 elif proto_ident == "SAS":
501 buf += " case SCSI_PROTOCOL_SAS:\n"
502 buf += " default:\n"
503 buf += " ret = sas_get_pr_transport_id(se_tpg, se_nacl, pr_reg,\n"
504 buf += " format_code, buf);\n"
505 buf += " break;\n"
506 elif proto_ident == "iSCSI":
507 buf += " case SCSI_PROTOCOL_ISCSI:\n"
508 buf += " default:\n"
509 buf += " ret = iscsi_get_pr_transport_id(se_tpg, se_nacl, pr_reg,\n"
510 buf += " format_code, buf);\n"
511 buf += " break;\n"
512
513 buf += " }\n\n"
514 buf += " return ret;\n"
515 buf += "}\n\n"
516 bufi += "u32 " + fabric_mod_name + "_get_pr_transport_id(struct se_portal_group *,\n"
517 bufi += " struct se_node_acl *, struct t10_pr_registration *,\n"
518 bufi += " int *, unsigned char *);\n"
519
520 if re.search('get_pr_transport_id_len\)\(', fo):
521 buf += "u32 " + fabric_mod_name + "_get_pr_transport_id_len(\n"
522 buf += " struct se_portal_group *se_tpg,\n"
523 buf += " struct se_node_acl *se_nacl,\n"
524 buf += " struct t10_pr_registration *pr_reg,\n"
525 buf += " int *format_code)\n"
526 buf += "{\n"
527 buf += " struct " + fabric_mod_name + "_tpg *tpg = container_of(se_tpg,\n"
528 buf += " struct " + fabric_mod_name + "_tpg, se_tpg);\n"
529 buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + " *" + fabric_mod_port + " = tpg->" + fabric_mod_port + ";\n"
530 buf += " int ret = 0;\n\n"
531 buf += " switch (" + fabric_mod_port + "->" + fabric_mod_port + "_proto_id) {\n"
532 if proto_ident == "FC":
533 buf += " case SCSI_PROTOCOL_FCP:\n"
534 buf += " default:\n"
535 buf += " ret = fc_get_pr_transport_id_len(se_tpg, se_nacl, pr_reg,\n"
536 buf += " format_code);\n"
537 buf += " break;\n"
538 elif proto_ident == "SAS":
539 buf += " case SCSI_PROTOCOL_SAS:\n"
540 buf += " default:\n"
541 buf += " ret = sas_get_pr_transport_id_len(se_tpg, se_nacl, pr_reg,\n"
542 buf += " format_code);\n"
543 buf += " break;\n"
544 elif proto_ident == "iSCSI":
545 buf += " case SCSI_PROTOCOL_ISCSI:\n"
546 buf += " default:\n"
547 buf += " ret = iscsi_get_pr_transport_id_len(se_tpg, se_nacl, pr_reg,\n"
548 buf += " format_code);\n"
549 buf += " break;\n"
550
551
552 buf += " }\n\n"
553 buf += " return ret;\n"
554 buf += "}\n\n"
555 bufi += "u32 " + fabric_mod_name + "_get_pr_transport_id_len(struct se_portal_group *,\n"
556 bufi += " struct se_node_acl *, struct t10_pr_registration *,\n"
557 bufi += " int *);\n"
558
559 if re.search('parse_pr_out_transport_id\)\(', fo):
560 buf += "char *" + fabric_mod_name + "_parse_pr_out_transport_id(\n"
561 buf += " struct se_portal_group *se_tpg,\n"
562 buf += " const char *buf,\n"
563 buf += " u32 *out_tid_len,\n"
564 buf += " char **port_nexus_ptr)\n"
565 buf += "{\n"
566 buf += " struct " + fabric_mod_name + "_tpg *tpg = container_of(se_tpg,\n"
567 buf += " struct " + fabric_mod_name + "_tpg, se_tpg);\n"
568 buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + " *" + fabric_mod_port + " = tpg->" + fabric_mod_port + ";\n"
569 buf += " char *tid = NULL;\n\n"
570 buf += " switch (" + fabric_mod_port + "->" + fabric_mod_port + "_proto_id) {\n"
571 if proto_ident == "FC":
572 buf += " case SCSI_PROTOCOL_FCP:\n"
573 buf += " default:\n"
574 buf += " tid = fc_parse_pr_out_transport_id(se_tpg, buf, out_tid_len,\n"
575 buf += " port_nexus_ptr);\n"
576 elif proto_ident == "SAS":
577 buf += " case SCSI_PROTOCOL_SAS:\n"
578 buf += " default:\n"
579 buf += " tid = sas_parse_pr_out_transport_id(se_tpg, buf, out_tid_len,\n"
580 buf += " port_nexus_ptr);\n"
581 elif proto_ident == "iSCSI":
582 buf += " case SCSI_PROTOCOL_ISCSI:\n"
583 buf += " default:\n"
584 buf += " tid = iscsi_parse_pr_out_transport_id(se_tpg, buf, out_tid_len,\n"
585 buf += " port_nexus_ptr);\n"
586
587 buf += " }\n\n"
588 buf += " return tid;\n"
589 buf += "}\n\n"
590 bufi += "char *" + fabric_mod_name + "_parse_pr_out_transport_id(struct se_portal_group *,\n"
591 bufi += " const char *, u32 *, char **);\n"
592
593 if re.search('tpg_get_inst_index\)\(', fo): 472 if re.search('tpg_get_inst_index\)\(', fo):
594 buf += "u32 " + fabric_mod_name + "_tpg_get_inst_index(struct se_portal_group *se_tpg)\n" 473 buf += "u32 " + fabric_mod_name + "_tpg_get_inst_index(struct se_portal_group *se_tpg)\n"
595 buf += "{\n" 474 buf += "{\n"