aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2015-05-01 11:47:57 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2015-05-31 01:42:30 -0400
commit2aeeafae6bb9f04dbe17b521bcd8f0d03516c393 (patch)
treee4efb82f007a4afe684702c5983195e2403250e2
parente4aae5af810eaa61c2cd7ba79d95ebfe0d88fe9b (diff)
target: remove the get_fabric_proto_ident method
Now that we store the protocol identifier in the tpg structure we don't need this method. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rwxr-xr-xDocumentation/target/tcm_mod_builder.py31
-rw-r--r--drivers/infiniband/ulp/srpt/ib_srpt.c6
-rw-r--r--drivers/scsi/qla2xxx/tcm_qla2xxx.c19
-rw-r--r--drivers/target/iscsi/iscsi_target_configfs.c1
-rw-r--r--drivers/target/loopback/tcm_loop.c27
-rw-r--r--drivers/target/sbp/sbp_target.c13
-rw-r--r--drivers/target/target_core_configfs.c4
-rw-r--r--drivers/target/target_core_fabric_lib.c27
-rw-r--r--drivers/target/target_core_pr.c12
-rw-r--r--drivers/target/target_core_spc.c12
-rw-r--r--drivers/target/tcm_fc/tfc_conf.c1
-rw-r--r--drivers/usb/gadget/legacy/tcm_usb_gadget.c18
-rw-r--r--drivers/vhost/scsi.c23
-rw-r--r--drivers/xen/xen-scsiback.c23
-rw-r--r--include/target/target_core_fabric.h4
15 files changed, 9 insertions, 212 deletions
diff --git a/Documentation/target/tcm_mod_builder.py b/Documentation/target/tcm_mod_builder.py
index b04846e985d4..29176c29537c 100755
--- a/Documentation/target/tcm_mod_builder.py
+++ b/Documentation/target/tcm_mod_builder.py
@@ -300,9 +300,7 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
300 buf += "static const struct target_core_fabric_ops " + fabric_mod_name + "_ops = {\n" 300 buf += "static const struct target_core_fabric_ops " + fabric_mod_name + "_ops = {\n"
301 buf += " .module = THIS_MODULE,\n" 301 buf += " .module = THIS_MODULE,\n"
302 buf += " .name = " + fabric_mod_name + ",\n" 302 buf += " .name = " + fabric_mod_name + ",\n"
303 buf += " .get_fabric_proto_ident = " + fabric_mod_name + "_get_fabric_proto_ident,\n"
304 buf += " .get_fabric_name = " + fabric_mod_name + "_get_fabric_name,\n" 303 buf += " .get_fabric_name = " + fabric_mod_name + "_get_fabric_name,\n"
305 buf += " .get_fabric_proto_ident = " + fabric_mod_name + "_get_fabric_proto_ident,\n"
306 buf += " .tpg_get_wwn = " + fabric_mod_name + "_get_fabric_wwn,\n" 304 buf += " .tpg_get_wwn = " + fabric_mod_name + "_get_fabric_wwn,\n"
307 buf += " .tpg_get_tag = " + fabric_mod_name + "_get_tag,\n" 305 buf += " .tpg_get_tag = " + fabric_mod_name + "_get_tag,\n"
308 buf += " .tpg_get_pr_transport_id = " + fabric_mod_name + "_get_pr_transport_id,\n" 306 buf += " .tpg_get_pr_transport_id = " + fabric_mod_name + "_get_pr_transport_id,\n"
@@ -461,35 +459,6 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
461 bufi += "char *" + fabric_mod_name + "_get_fabric_name(void);\n" 459 bufi += "char *" + fabric_mod_name + "_get_fabric_name(void);\n"
462 continue 460 continue
463 461
464 if re.search('get_fabric_proto_ident', fo):
465 buf += "u8 " + fabric_mod_name + "_get_fabric_proto_ident(struct se_portal_group *se_tpg)\n"
466 buf += "{\n"
467 buf += " struct " + fabric_mod_name + "_tpg *tpg = container_of(se_tpg,\n"
468 buf += " struct " + fabric_mod_name + "_tpg, se_tpg);\n"
469 buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + " *" + fabric_mod_port + " = tpg->" + fabric_mod_port + ";\n"
470 buf += " u8 proto_id;\n\n"
471 buf += " switch (" + fabric_mod_port + "->" + fabric_mod_port + "_proto_id) {\n"
472 if proto_ident == "FC":
473 buf += " case SCSI_PROTOCOL_FCP:\n"
474 buf += " default:\n"
475 buf += " proto_id = fc_get_fabric_proto_ident(se_tpg);\n"
476 buf += " break;\n"
477 elif proto_ident == "SAS":
478 buf += " case SCSI_PROTOCOL_SAS:\n"
479 buf += " default:\n"
480 buf += " proto_id = sas_get_fabric_proto_ident(se_tpg);\n"
481 buf += " break;\n"
482 elif proto_ident == "iSCSI":
483 buf += " case SCSI_PROTOCOL_ISCSI:\n"
484 buf += " default:\n"
485 buf += " proto_id = iscsi_get_fabric_proto_ident(se_tpg);\n"
486 buf += " break;\n"
487
488 buf += " }\n\n"
489 buf += " return proto_id;\n"
490 buf += "}\n\n"
491 bufi += "u8 " + fabric_mod_name + "_get_fabric_proto_ident(struct se_portal_group *);\n"
492
493 if re.search('get_wwn', fo): 462 if re.search('get_wwn', fo):
494 buf += "char *" + fabric_mod_name + "_get_fabric_wwn(struct se_portal_group *se_tpg)\n" 463 buf += "char *" + fabric_mod_name + "_get_fabric_wwn(struct se_portal_group *se_tpg)\n"
495 buf += "{\n" 464 buf += "{\n"
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 8eed6089c5d7..9213c2de28fc 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -3394,11 +3394,6 @@ static char *srpt_get_fabric_name(void)
3394 return "srpt"; 3394 return "srpt";
3395} 3395}
3396 3396
3397static u8 srpt_get_fabric_proto_ident(struct se_portal_group *se_tpg)
3398{
3399 return SCSI_TRANSPORTID_PROTOCOLID_SRP;
3400}
3401
3402static char *srpt_get_fabric_wwn(struct se_portal_group *tpg) 3397static char *srpt_get_fabric_wwn(struct se_portal_group *tpg)
3403{ 3398{
3404 struct srpt_port *sport = container_of(tpg, struct srpt_port, port_tpg_1); 3399 struct srpt_port *sport = container_of(tpg, struct srpt_port, port_tpg_1);
@@ -3863,7 +3858,6 @@ static const struct target_core_fabric_ops srpt_template = {
3863 .name = "srpt", 3858 .name = "srpt",
3864 .node_acl_size = sizeof(struct srpt_node_acl), 3859 .node_acl_size = sizeof(struct srpt_node_acl),
3865 .get_fabric_name = srpt_get_fabric_name, 3860 .get_fabric_name = srpt_get_fabric_name,
3866 .get_fabric_proto_ident = srpt_get_fabric_proto_ident,
3867 .tpg_get_wwn = srpt_get_fabric_wwn, 3861 .tpg_get_wwn = srpt_get_fabric_wwn,
3868 .tpg_get_tag = srpt_get_tag, 3862 .tpg_get_tag = srpt_get_tag,
3869 .tpg_get_pr_transport_id = srpt_get_pr_transport_id, 3863 .tpg_get_pr_transport_id = srpt_get_pr_transport_id,
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
index 30cbfa6dc3e6..4566c4649751 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
@@ -190,23 +190,6 @@ static char *tcm_qla2xxx_npiv_get_fabric_name(void)
190 return "qla2xxx_npiv"; 190 return "qla2xxx_npiv";
191} 191}
192 192
193static u8 tcm_qla2xxx_get_fabric_proto_ident(struct se_portal_group *se_tpg)
194{
195 struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
196 struct tcm_qla2xxx_tpg, se_tpg);
197 struct tcm_qla2xxx_lport *lport = tpg->lport;
198 u8 proto_id;
199
200 switch (lport->lport_proto_id) {
201 case SCSI_PROTOCOL_FCP:
202 default:
203 proto_id = fc_get_fabric_proto_ident(se_tpg);
204 break;
205 }
206
207 return proto_id;
208}
209
210static char *tcm_qla2xxx_get_fabric_wwn(struct se_portal_group *se_tpg) 193static char *tcm_qla2xxx_get_fabric_wwn(struct se_portal_group *se_tpg)
211{ 194{
212 struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, 195 struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
@@ -1928,7 +1911,6 @@ static const struct target_core_fabric_ops tcm_qla2xxx_ops = {
1928 .name = "qla2xxx", 1911 .name = "qla2xxx",
1929 .node_acl_size = sizeof(struct tcm_qla2xxx_nacl), 1912 .node_acl_size = sizeof(struct tcm_qla2xxx_nacl),
1930 .get_fabric_name = tcm_qla2xxx_get_fabric_name, 1913 .get_fabric_name = tcm_qla2xxx_get_fabric_name,
1931 .get_fabric_proto_ident = tcm_qla2xxx_get_fabric_proto_ident,
1932 .tpg_get_wwn = tcm_qla2xxx_get_fabric_wwn, 1914 .tpg_get_wwn = tcm_qla2xxx_get_fabric_wwn,
1933 .tpg_get_tag = tcm_qla2xxx_get_tag, 1915 .tpg_get_tag = tcm_qla2xxx_get_tag,
1934 .tpg_get_pr_transport_id = tcm_qla2xxx_get_pr_transport_id, 1916 .tpg_get_pr_transport_id = tcm_qla2xxx_get_pr_transport_id,
@@ -1979,7 +1961,6 @@ static const struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = {
1979 .name = "qla2xxx_npiv", 1961 .name = "qla2xxx_npiv",
1980 .node_acl_size = sizeof(struct tcm_qla2xxx_nacl), 1962 .node_acl_size = sizeof(struct tcm_qla2xxx_nacl),
1981 .get_fabric_name = tcm_qla2xxx_npiv_get_fabric_name, 1963 .get_fabric_name = tcm_qla2xxx_npiv_get_fabric_name,
1982 .get_fabric_proto_ident = tcm_qla2xxx_get_fabric_proto_ident,
1983 .tpg_get_wwn = tcm_qla2xxx_get_fabric_wwn, 1964 .tpg_get_wwn = tcm_qla2xxx_get_fabric_wwn,
1984 .tpg_get_tag = tcm_qla2xxx_get_tag, 1965 .tpg_get_tag = tcm_qla2xxx_get_tag,
1985 .tpg_get_pr_transport_id = tcm_qla2xxx_get_pr_transport_id, 1966 .tpg_get_pr_transport_id = tcm_qla2xxx_get_pr_transport_id,
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c
index 0d5d88817a47..9dec9f39139f 100644
--- a/drivers/target/iscsi/iscsi_target_configfs.c
+++ b/drivers/target/iscsi/iscsi_target_configfs.c
@@ -1918,7 +1918,6 @@ const struct target_core_fabric_ops iscsi_ops = {
1918 .name = "iscsi", 1918 .name = "iscsi",
1919 .node_acl_size = sizeof(struct iscsi_node_acl), 1919 .node_acl_size = sizeof(struct iscsi_node_acl),
1920 .get_fabric_name = iscsi_get_fabric_name, 1920 .get_fabric_name = iscsi_get_fabric_name,
1921 .get_fabric_proto_ident = iscsi_get_fabric_proto_ident,
1922 .tpg_get_wwn = lio_tpg_get_endpoint_wwn, 1921 .tpg_get_wwn = lio_tpg_get_endpoint_wwn,
1923 .tpg_get_tag = lio_tpg_get_tag, 1922 .tpg_get_tag = lio_tpg_get_tag,
1924 .tpg_get_default_depth = lio_tpg_get_default_depth, 1923 .tpg_get_default_depth = lio_tpg_get_default_depth,
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index 3f264d436737..0eed0209a7f4 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -525,32 +525,6 @@ static inline struct tcm_loop_tpg *tl_tpg(struct se_portal_group *se_tpg)
525 return container_of(se_tpg, struct tcm_loop_tpg, tl_se_tpg); 525 return container_of(se_tpg, struct tcm_loop_tpg, tl_se_tpg);
526} 526}
527 527
528static u8 tcm_loop_get_fabric_proto_ident(struct se_portal_group *se_tpg)
529{
530 struct tcm_loop_hba *tl_hba = tl_tpg(se_tpg)->tl_hba;
531 /*
532 * tl_proto_id is set at tcm_loop_configfs.c:tcm_loop_make_scsi_hba()
533 * time based on the protocol dependent prefix of the passed configfs group.
534 *
535 * Based upon tl_proto_id, TCM_Loop emulates the requested fabric
536 * ProtocolID using target_core_fabric_lib.c symbols.
537 */
538 switch (tl_hba->tl_proto_id) {
539 case SCSI_PROTOCOL_SAS:
540 return sas_get_fabric_proto_ident(se_tpg);
541 case SCSI_PROTOCOL_FCP:
542 return fc_get_fabric_proto_ident(se_tpg);
543 case SCSI_PROTOCOL_ISCSI:
544 return iscsi_get_fabric_proto_ident(se_tpg);
545 default:
546 pr_err("Unknown tl_proto_id: 0x%02x, using"
547 " SAS emulation\n", tl_hba->tl_proto_id);
548 break;
549 }
550
551 return sas_get_fabric_proto_ident(se_tpg);
552}
553
554static char *tcm_loop_get_endpoint_wwn(struct se_portal_group *se_tpg) 528static char *tcm_loop_get_endpoint_wwn(struct se_portal_group *se_tpg)
555{ 529{
556 /* 530 /*
@@ -1356,7 +1330,6 @@ static const struct target_core_fabric_ops loop_ops = {
1356 .module = THIS_MODULE, 1330 .module = THIS_MODULE,
1357 .name = "loopback", 1331 .name = "loopback",
1358 .get_fabric_name = tcm_loop_get_fabric_name, 1332 .get_fabric_name = tcm_loop_get_fabric_name,
1359 .get_fabric_proto_ident = tcm_loop_get_fabric_proto_ident,
1360 .tpg_get_wwn = tcm_loop_get_endpoint_wwn, 1333 .tpg_get_wwn = tcm_loop_get_endpoint_wwn,
1361 .tpg_get_tag = tcm_loop_get_tag, 1334 .tpg_get_tag = tcm_loop_get_tag,
1362 .tpg_get_pr_transport_id = tcm_loop_get_pr_transport_id, 1335 .tpg_get_pr_transport_id = tcm_loop_get_pr_transport_id,
diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c
index 40b9f516cf9b..8acb37fd9ebc 100644
--- a/drivers/target/sbp/sbp_target.c
+++ b/drivers/target/sbp/sbp_target.c
@@ -1832,18 +1832,6 @@ static int sbp_check_stop_free(struct se_cmd *se_cmd)
1832 return 1; 1832 return 1;
1833} 1833}
1834 1834
1835/*
1836 * Handlers for Serial Bus Protocol 2/3 (SBP-2 / SBP-3)
1837 */
1838static u8 sbp_get_fabric_proto_ident(struct se_portal_group *se_tpg)
1839{
1840 /*
1841 * Return a IEEE 1394 SCSI Protocol identifier for loopback operations
1842 * This is defined in section 7.5.1 Table 362 in spc4r17
1843 */
1844 return SCSI_PROTOCOL_SBP;
1845}
1846
1847static u32 sbp_get_pr_transport_id( 1835static u32 sbp_get_pr_transport_id(
1848 struct se_portal_group *se_tpg, 1836 struct se_portal_group *se_tpg,
1849 struct se_node_acl *se_nacl, 1837 struct se_node_acl *se_nacl,
@@ -2442,7 +2430,6 @@ static const struct target_core_fabric_ops sbp_ops = {
2442 .module = THIS_MODULE, 2430 .module = THIS_MODULE,
2443 .name = "sbp", 2431 .name = "sbp",
2444 .get_fabric_name = sbp_get_fabric_name, 2432 .get_fabric_name = sbp_get_fabric_name,
2445 .get_fabric_proto_ident = sbp_get_fabric_proto_ident,
2446 .tpg_get_wwn = sbp_get_fabric_wwn, 2433 .tpg_get_wwn = sbp_get_fabric_wwn,
2447 .tpg_get_tag = sbp_get_tag, 2434 .tpg_get_tag = sbp_get_tag,
2448 .tpg_get_pr_transport_id = sbp_get_pr_transport_id, 2435 .tpg_get_pr_transport_id = sbp_get_pr_transport_id,
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index 2b10499264d3..21c9f7d79d5e 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -318,10 +318,6 @@ static int target_fabric_tf_ops_check(const struct target_core_fabric_ops *tfo)
318 pr_err("Missing tfo->get_fabric_name()\n"); 318 pr_err("Missing tfo->get_fabric_name()\n");
319 return -EINVAL; 319 return -EINVAL;
320 } 320 }
321 if (!tfo->get_fabric_proto_ident) {
322 pr_err("Missing tfo->get_fabric_proto_ident()\n");
323 return -EINVAL;
324 }
325 if (!tfo->tpg_get_wwn) { 321 if (!tfo->tpg_get_wwn) {
326 pr_err("Missing tfo->tpg_get_wwn()\n"); 322 pr_err("Missing tfo->tpg_get_wwn()\n");
327 return -EINVAL; 323 return -EINVAL;
diff --git a/drivers/target/target_core_fabric_lib.c b/drivers/target/target_core_fabric_lib.c
index 35bfe77160d8..6fed14adbe61 100644
--- a/drivers/target/target_core_fabric_lib.c
+++ b/drivers/target/target_core_fabric_lib.c
@@ -42,16 +42,6 @@
42/* 42/*
43 * Handlers for Serial Attached SCSI (SAS) 43 * Handlers for Serial Attached SCSI (SAS)
44 */ 44 */
45u8 sas_get_fabric_proto_ident(struct se_portal_group *se_tpg)
46{
47 /*
48 * Return a SAS Serial SCSI Protocol identifier for loopback operations
49 * This is defined in section 7.5.1 Table 362 in spc4r17
50 */
51 return 0x6;
52}
53EXPORT_SYMBOL(sas_get_fabric_proto_ident);
54
55u32 sas_get_pr_transport_id( 45u32 sas_get_pr_transport_id(
56 struct se_portal_group *se_tpg, 46 struct se_portal_group *se_tpg,
57 struct se_node_acl *se_nacl, 47 struct se_node_acl *se_nacl,
@@ -128,12 +118,6 @@ EXPORT_SYMBOL(sas_parse_pr_out_transport_id);
128/* 118/*
129 * Handlers for Fibre Channel Protocol (FCP) 119 * Handlers for Fibre Channel Protocol (FCP)
130 */ 120 */
131u8 fc_get_fabric_proto_ident(struct se_portal_group *se_tpg)
132{
133 return 0x0; /* 0 = fcp-2 per SPC4 section 7.5.1 */
134}
135EXPORT_SYMBOL(fc_get_fabric_proto_ident);
136
137u32 fc_get_pr_transport_id_len( 121u32 fc_get_pr_transport_id_len(
138 struct se_portal_group *se_tpg, 122 struct se_portal_group *se_tpg,
139 struct se_node_acl *se_nacl, 123 struct se_node_acl *se_nacl,
@@ -208,17 +192,6 @@ EXPORT_SYMBOL(fc_parse_pr_out_transport_id);
208/* 192/*
209 * Handlers for Internet Small Computer Systems Interface (iSCSI) 193 * Handlers for Internet Small Computer Systems Interface (iSCSI)
210 */ 194 */
211
212u8 iscsi_get_fabric_proto_ident(struct se_portal_group *se_tpg)
213{
214 /*
215 * This value is defined for "Internet SCSI (iSCSI)"
216 * in spc4r17 section 7.5.1 Table 362
217 */
218 return 0x5;
219}
220EXPORT_SYMBOL(iscsi_get_fabric_proto_ident);
221
222u32 iscsi_get_pr_transport_id( 195u32 iscsi_get_pr_transport_id(
223 struct se_portal_group *se_tpg, 196 struct se_portal_group *se_tpg,
224 struct se_node_acl *se_nacl, 197 struct se_node_acl *se_nacl,
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index a15411c79ae9..23c065f83a56 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -1447,7 +1447,7 @@ core_scsi3_decode_spec_i_port(
1447 struct pr_transport_id_holder *tidh_new, *tidh, *tidh_tmp; 1447 struct pr_transport_id_holder *tidh_new, *tidh, *tidh_tmp;
1448 const struct target_core_fabric_ops *tmp_tf_ops; 1448 const struct target_core_fabric_ops *tmp_tf_ops;
1449 unsigned char *buf; 1449 unsigned char *buf;
1450 unsigned char *ptr, *i_str = NULL, proto_ident, tmp_proto_ident; 1450 unsigned char *ptr, *i_str = NULL, proto_ident;
1451 char *iport_ptr = NULL, i_buf[PR_REG_ISID_ID_LEN]; 1451 char *iport_ptr = NULL, i_buf[PR_REG_ISID_ID_LEN];
1452 sense_reason_t ret; 1452 sense_reason_t ret;
1453 u32 tpdl, tid_len = 0; 1453 u32 tpdl, tid_len = 0;
@@ -1536,15 +1536,13 @@ core_scsi3_decode_spec_i_port(
1536 tmp_tf_ops = tmp_tpg->se_tpg_tfo; 1536 tmp_tf_ops = tmp_tpg->se_tpg_tfo;
1537 if (!tmp_tf_ops) 1537 if (!tmp_tf_ops)
1538 continue; 1538 continue;
1539 if (!tmp_tf_ops->get_fabric_proto_ident || 1539 if (!tmp_tf_ops->tpg_parse_pr_out_transport_id)
1540 !tmp_tf_ops->tpg_parse_pr_out_transport_id)
1541 continue; 1540 continue;
1542 /* 1541 /*
1543 * Look for the matching proto_ident provided by 1542 * Look for the matching proto_ident provided by
1544 * the received TransportID 1543 * the received TransportID
1545 */ 1544 */
1546 tmp_proto_ident = tmp_tf_ops->get_fabric_proto_ident(tmp_tpg); 1545 if (tmp_tpg->proto_id != proto_ident)
1547 if (tmp_proto_ident != proto_ident)
1548 continue; 1546 continue;
1549 dest_rtpi = tmp_port->sep_rtpi; 1547 dest_rtpi = tmp_port->sep_rtpi;
1550 1548
@@ -3230,11 +3228,11 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key,
3230 pr_debug("SPC-3 PR REGISTER_AND_MOVE: Extracted Protocol Identifier:" 3228 pr_debug("SPC-3 PR REGISTER_AND_MOVE: Extracted Protocol Identifier:"
3231 " 0x%02x\n", proto_ident); 3229 " 0x%02x\n", proto_ident);
3232 3230
3233 if (proto_ident != dest_tf_ops->get_fabric_proto_ident(dest_se_tpg)) { 3231 if (proto_ident != dest_se_tpg->proto_id) {
3234 pr_err("SPC-3 PR REGISTER_AND_MOVE: Received" 3232 pr_err("SPC-3 PR REGISTER_AND_MOVE: Received"
3235 " proto_ident: 0x%02x does not match ident: 0x%02x" 3233 " proto_ident: 0x%02x does not match ident: 0x%02x"
3236 " from fabric: %s\n", proto_ident, 3234 " from fabric: %s\n", proto_ident,
3237 dest_tf_ops->get_fabric_proto_ident(dest_se_tpg), 3235 dest_se_tpg->proto_id,
3238 dest_tf_ops->get_fabric_name()); 3236 dest_tf_ops->get_fabric_name());
3239 ret = TCM_INVALID_PARAMETER_LIST; 3237 ret = TCM_INVALID_PARAMETER_LIST;
3240 goto out; 3238 goto out;
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c
index 988c158cf65d..78c0b40fa5c0 100644
--- a/drivers/target/target_core_spc.c
+++ b/drivers/target/target_core_spc.c
@@ -286,8 +286,7 @@ check_t10_vend_desc:
286 * Get the PROTOCOL IDENTIFIER as defined by spc4r17 286 * Get the PROTOCOL IDENTIFIER as defined by spc4r17
287 * section 7.5.1 Table 362 287 * section 7.5.1 Table 362
288 */ 288 */
289 buf[off] = 289 buf[off] = tpg->proto_id << 4;
290 (tpg->se_tpg_tfo->get_fabric_proto_ident(tpg) << 4);
291 buf[off++] |= 0x1; /* CODE SET == Binary */ 290 buf[off++] |= 0x1; /* CODE SET == Binary */
292 buf[off] = 0x80; /* Set PIV=1 */ 291 buf[off] = 0x80; /* Set PIV=1 */
293 /* Set ASSOCIATION == target port: 01b */ 292 /* Set ASSOCIATION == target port: 01b */
@@ -322,8 +321,7 @@ check_t10_vend_desc:
322 tg_pt_gp_id = tg_pt_gp->tg_pt_gp_id; 321 tg_pt_gp_id = tg_pt_gp->tg_pt_gp_id;
323 spin_unlock(&tg_pt_gp_mem->tg_pt_gp_mem_lock); 322 spin_unlock(&tg_pt_gp_mem->tg_pt_gp_mem_lock);
324 323
325 buf[off] = 324 buf[off] = tpg->proto_id << 4;
326 (tpg->se_tpg_tfo->get_fabric_proto_ident(tpg) << 4);
327 buf[off++] |= 0x1; /* CODE SET == Binary */ 325 buf[off++] |= 0x1; /* CODE SET == Binary */
328 buf[off] = 0x80; /* Set PIV=1 */ 326 buf[off] = 0x80; /* Set PIV=1 */
329 /* Set ASSOCIATION == target port: 01b */ 327 /* Set ASSOCIATION == target port: 01b */
@@ -371,8 +369,7 @@ check_lu_gp:
371 * section 7.5.1 Table 362 369 * section 7.5.1 Table 362
372 */ 370 */
373check_scsi_name: 371check_scsi_name:
374 buf[off] = 372 buf[off] = tpg->proto_id << 4;
375 (tpg->se_tpg_tfo->get_fabric_proto_ident(tpg) << 4);
376 buf[off++] |= 0x3; /* CODE SET == UTF-8 */ 373 buf[off++] |= 0x3; /* CODE SET == UTF-8 */
377 buf[off] = 0x80; /* Set PIV=1 */ 374 buf[off] = 0x80; /* Set PIV=1 */
378 /* Set ASSOCIATION == target port: 01b */ 375 /* Set ASSOCIATION == target port: 01b */
@@ -412,8 +409,7 @@ check_scsi_name:
412 /* 409 /*
413 * Target device designator 410 * Target device designator
414 */ 411 */
415 buf[off] = 412 buf[off] = tpg->proto_id << 4;
416 (tpg->se_tpg_tfo->get_fabric_proto_ident(tpg) << 4);
417 buf[off++] |= 0x3; /* CODE SET == UTF-8 */ 413 buf[off++] |= 0x3; /* CODE SET == UTF-8 */
418 buf[off] = 0x80; /* Set PIV=1 */ 414 buf[off] = 0x80; /* Set PIV=1 */
419 /* Set ASSOCIATION == target device: 10b */ 415 /* Set ASSOCIATION == target device: 10b */
diff --git a/drivers/target/tcm_fc/tfc_conf.c b/drivers/target/tcm_fc/tfc_conf.c
index 8309c3d91387..fabc7bacf693 100644
--- a/drivers/target/tcm_fc/tfc_conf.c
+++ b/drivers/target/tcm_fc/tfc_conf.c
@@ -452,7 +452,6 @@ static const struct target_core_fabric_ops ft_fabric_ops = {
452 .name = "fc", 452 .name = "fc",
453 .node_acl_size = sizeof(struct ft_node_acl), 453 .node_acl_size = sizeof(struct ft_node_acl),
454 .get_fabric_name = ft_get_fabric_name, 454 .get_fabric_name = ft_get_fabric_name,
455 .get_fabric_proto_ident = fc_get_fabric_proto_ident,
456 .tpg_get_wwn = ft_get_fabric_wwn, 455 .tpg_get_wwn = ft_get_fabric_wwn,
457 .tpg_get_tag = ft_get_tag, 456 .tpg_get_tag = ft_get_tag,
458 .tpg_get_pr_transport_id = fc_get_pr_transport_id, 457 .tpg_get_pr_transport_id = fc_get_pr_transport_id,
diff --git a/drivers/usb/gadget/legacy/tcm_usb_gadget.c b/drivers/usb/gadget/legacy/tcm_usb_gadget.c
index 08b4f48aa49e..d6b03178262f 100644
--- a/drivers/usb/gadget/legacy/tcm_usb_gadget.c
+++ b/drivers/usb/gadget/legacy/tcm_usb_gadget.c
@@ -1274,23 +1274,6 @@ static char *usbg_get_fabric_name(void)
1274 return "usb_gadget"; 1274 return "usb_gadget";
1275} 1275}
1276 1276
1277static u8 usbg_get_fabric_proto_ident(struct se_portal_group *se_tpg)
1278{
1279 struct usbg_tpg *tpg = container_of(se_tpg,
1280 struct usbg_tpg, se_tpg);
1281 struct usbg_tport *tport = tpg->tport;
1282 u8 proto_id;
1283
1284 switch (tport->tport_proto_id) {
1285 case SCSI_PROTOCOL_SAS:
1286 default:
1287 proto_id = sas_get_fabric_proto_ident(se_tpg);
1288 break;
1289 }
1290
1291 return proto_id;
1292}
1293
1294static char *usbg_get_fabric_wwn(struct se_portal_group *se_tpg) 1277static char *usbg_get_fabric_wwn(struct se_portal_group *se_tpg)
1295{ 1278{
1296 struct usbg_tpg *tpg = container_of(se_tpg, 1279 struct usbg_tpg *tpg = container_of(se_tpg,
@@ -1803,7 +1786,6 @@ static const struct target_core_fabric_ops usbg_ops = {
1803 .module = THIS_MODULE, 1786 .module = THIS_MODULE,
1804 .name = "usb_gadget", 1787 .name = "usb_gadget",
1805 .get_fabric_name = usbg_get_fabric_name, 1788 .get_fabric_name = usbg_get_fabric_name,
1806 .get_fabric_proto_ident = usbg_get_fabric_proto_ident,
1807 .tpg_get_wwn = usbg_get_fabric_wwn, 1789 .tpg_get_wwn = usbg_get_fabric_wwn,
1808 .tpg_get_tag = usbg_get_tag, 1790 .tpg_get_tag = usbg_get_tag,
1809 .tpg_get_pr_transport_id = usbg_get_pr_transport_id, 1791 .tpg_get_pr_transport_id = usbg_get_pr_transport_id,
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 8295e7be0fcb..022860ccd008 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -288,28 +288,6 @@ static char *vhost_scsi_get_fabric_name(void)
288 return "vhost"; 288 return "vhost";
289} 289}
290 290
291static u8 vhost_scsi_get_fabric_proto_ident(struct se_portal_group *se_tpg)
292{
293 struct vhost_scsi_tpg *tpg = container_of(se_tpg,
294 struct vhost_scsi_tpg, se_tpg);
295 struct vhost_scsi_tport *tport = tpg->tport;
296
297 switch (tport->tport_proto_id) {
298 case SCSI_PROTOCOL_SAS:
299 return sas_get_fabric_proto_ident(se_tpg);
300 case SCSI_PROTOCOL_FCP:
301 return fc_get_fabric_proto_ident(se_tpg);
302 case SCSI_PROTOCOL_ISCSI:
303 return iscsi_get_fabric_proto_ident(se_tpg);
304 default:
305 pr_err("Unknown tport_proto_id: 0x%02x, using"
306 " SAS emulation\n", tport->tport_proto_id);
307 break;
308 }
309
310 return sas_get_fabric_proto_ident(se_tpg);
311}
312
313static char *vhost_scsi_get_fabric_wwn(struct se_portal_group *se_tpg) 291static char *vhost_scsi_get_fabric_wwn(struct se_portal_group *se_tpg)
314{ 292{
315 struct vhost_scsi_tpg *tpg = container_of(se_tpg, 293 struct vhost_scsi_tpg *tpg = container_of(se_tpg,
@@ -2244,7 +2222,6 @@ static struct target_core_fabric_ops vhost_scsi_ops = {
2244 .module = THIS_MODULE, 2222 .module = THIS_MODULE,
2245 .name = "vhost", 2223 .name = "vhost",
2246 .get_fabric_name = vhost_scsi_get_fabric_name, 2224 .get_fabric_name = vhost_scsi_get_fabric_name,
2247 .get_fabric_proto_ident = vhost_scsi_get_fabric_proto_ident,
2248 .tpg_get_wwn = vhost_scsi_get_fabric_wwn, 2225 .tpg_get_wwn = vhost_scsi_get_fabric_wwn,
2249 .tpg_get_tag = vhost_scsi_get_tpgt, 2226 .tpg_get_tag = vhost_scsi_get_tpgt,
2250 .tpg_get_pr_transport_id = vhost_scsi_get_pr_transport_id, 2227 .tpg_get_pr_transport_id = vhost_scsi_get_pr_transport_id,
diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
index 223d493878eb..8bf9448bd7fd 100644
--- a/drivers/xen/xen-scsiback.c
+++ b/drivers/xen/xen-scsiback.c
@@ -1254,28 +1254,6 @@ static char *scsiback_dump_proto_id(struct scsiback_tport *tport)
1254 return "Unknown"; 1254 return "Unknown";
1255} 1255}
1256 1256
1257static u8 scsiback_get_fabric_proto_ident(struct se_portal_group *se_tpg)
1258{
1259 struct scsiback_tpg *tpg = container_of(se_tpg,
1260 struct scsiback_tpg, se_tpg);
1261 struct scsiback_tport *tport = tpg->tport;
1262
1263 switch (tport->tport_proto_id) {
1264 case SCSI_PROTOCOL_SAS:
1265 return sas_get_fabric_proto_ident(se_tpg);
1266 case SCSI_PROTOCOL_FCP:
1267 return fc_get_fabric_proto_ident(se_tpg);
1268 case SCSI_PROTOCOL_ISCSI:
1269 return iscsi_get_fabric_proto_ident(se_tpg);
1270 default:
1271 pr_err("Unknown tport_proto_id: 0x%02x, using SAS emulation\n",
1272 tport->tport_proto_id);
1273 break;
1274 }
1275
1276 return sas_get_fabric_proto_ident(se_tpg);
1277}
1278
1279static char *scsiback_get_fabric_wwn(struct se_portal_group *se_tpg) 1257static char *scsiback_get_fabric_wwn(struct se_portal_group *se_tpg)
1280{ 1258{
1281 struct scsiback_tpg *tpg = container_of(se_tpg, 1259 struct scsiback_tpg *tpg = container_of(se_tpg,
@@ -1929,7 +1907,6 @@ static const struct target_core_fabric_ops scsiback_ops = {
1929 .module = THIS_MODULE, 1907 .module = THIS_MODULE,
1930 .name = "xen-pvscsi", 1908 .name = "xen-pvscsi",
1931 .get_fabric_name = scsiback_get_fabric_name, 1909 .get_fabric_name = scsiback_get_fabric_name,
1932 .get_fabric_proto_ident = scsiback_get_fabric_proto_ident,
1933 .tpg_get_wwn = scsiback_get_fabric_wwn, 1910 .tpg_get_wwn = scsiback_get_fabric_wwn,
1934 .tpg_get_tag = scsiback_get_tag, 1911 .tpg_get_tag = scsiback_get_tag,
1935 .tpg_get_pr_transport_id = scsiback_get_pr_transport_id, 1912 .tpg_get_pr_transport_id = scsiback_get_pr_transport_id,
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index e0adc141de07..495606382546 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -6,7 +6,6 @@ struct target_core_fabric_ops {
6 const char *name; 6 const char *name;
7 size_t node_acl_size; 7 size_t node_acl_size;
8 char *(*get_fabric_name)(void); 8 char *(*get_fabric_name)(void);
9 u8 (*get_fabric_proto_ident)(struct se_portal_group *);
10 char *(*tpg_get_wwn)(struct se_portal_group *); 9 char *(*tpg_get_wwn)(struct se_portal_group *);
11 u16 (*tpg_get_tag)(struct se_portal_group *); 10 u16 (*tpg_get_tag)(struct se_portal_group *);
12 u32 (*tpg_get_default_depth)(struct se_portal_group *); 11 u32 (*tpg_get_default_depth)(struct se_portal_group *);
@@ -179,7 +178,6 @@ int core_tpg_register(const struct target_core_fabric_ops *,
179int core_tpg_deregister(struct se_portal_group *); 178int core_tpg_deregister(struct se_portal_group *);
180 179
181/* SAS helpers */ 180/* SAS helpers */
182u8 sas_get_fabric_proto_ident(struct se_portal_group *);
183u32 sas_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *, 181u32 sas_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
184 struct t10_pr_registration *, int *, unsigned char *); 182 struct t10_pr_registration *, int *, unsigned char *);
185u32 sas_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *, 183u32 sas_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
@@ -188,7 +186,6 @@ char *sas_parse_pr_out_transport_id(struct se_portal_group *, const char *,
188 u32 *, char **); 186 u32 *, char **);
189 187
190/* FC helpers */ 188/* FC helpers */
191u8 fc_get_fabric_proto_ident(struct se_portal_group *);
192u32 fc_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *, 189u32 fc_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
193 struct t10_pr_registration *, int *, unsigned char *); 190 struct t10_pr_registration *, int *, unsigned char *);
194u32 fc_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *, 191u32 fc_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
@@ -197,7 +194,6 @@ char *fc_parse_pr_out_transport_id(struct se_portal_group *, const char *,
197 u32 *, char **); 194 u32 *, char **);
198 195
199/* iSCSI helpers */ 196/* iSCSI helpers */
200u8 iscsi_get_fabric_proto_ident(struct se_portal_group *);
201u32 iscsi_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *, 197u32 iscsi_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
202 struct t10_pr_registration *, int *, unsigned char *); 198 struct t10_pr_registration *, int *, unsigned char *);
203u32 iscsi_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *, 199u32 iscsi_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,