Skip to content

Commit 2aeeafa

Browse files
Christoph HellwigNicholas Bellinger
authored andcommitted
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>
1 parent e4aae5a commit 2aeeafa

15 files changed

Lines changed: 9 additions & 212 deletions

File tree

‎Documentation/target/tcm_mod_builder.py‎

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,7 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
300300
buf += "static const struct target_core_fabric_ops " + fabric_mod_name + "_ops = {\n"
301301
buf += " .module = THIS_MODULE,\n"
302302
buf += " .name = " + fabric_mod_name + ",\n"
303-
buf += " .get_fabric_proto_ident = " + fabric_mod_name + "_get_fabric_proto_ident,\n"
304303
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"
306304
buf += " .tpg_get_wwn = " + fabric_mod_name + "_get_fabric_wwn,\n"
307305
buf += " .tpg_get_tag = " + fabric_mod_name + "_get_tag,\n"
308306
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):
461459
bufi += "char *" + fabric_mod_name + "_get_fabric_name(void);\n"
462460
continue
463461

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-
493462
if re.search('get_wwn', fo):
494463
buf += "char *" + fabric_mod_name + "_get_fabric_wwn(struct se_portal_group *se_tpg)\n"
495464
buf += "{\n"

‎drivers/infiniband/ulp/srpt/ib_srpt.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3394,11 +3394,6 @@ static char *srpt_get_fabric_name(void)
33943394
return "srpt";
33953395
}
33963396

3397-
static u8 srpt_get_fabric_proto_ident(struct se_portal_group *se_tpg)
3398-
{
3399-
return SCSI_TRANSPORTID_PROTOCOLID_SRP;
3400-
}
3401-
34023397
static char *srpt_get_fabric_wwn(struct se_portal_group *tpg)
34033398
{
34043399
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 = {
38633858
.name = "srpt",
38643859
.node_acl_size = sizeof(struct srpt_node_acl),
38653860
.get_fabric_name = srpt_get_fabric_name,
3866-
.get_fabric_proto_ident = srpt_get_fabric_proto_ident,
38673861
.tpg_get_wwn = srpt_get_fabric_wwn,
38683862
.tpg_get_tag = srpt_get_tag,
38693863
.tpg_get_pr_transport_id = srpt_get_pr_transport_id,

‎drivers/scsi/qla2xxx/tcm_qla2xxx.c‎

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -190,23 +190,6 @@ static char *tcm_qla2xxx_npiv_get_fabric_name(void)
190190
return "qla2xxx_npiv";
191191
}
192192

193-
static 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-
210193
static char *tcm_qla2xxx_get_fabric_wwn(struct se_portal_group *se_tpg)
211194
{
212195
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
@@ -1928,7 +1911,6 @@ static const struct target_core_fabric_ops tcm_qla2xxx_ops = {
19281911
.name = "qla2xxx",
19291912
.node_acl_size = sizeof(struct tcm_qla2xxx_nacl),
19301913
.get_fabric_name = tcm_qla2xxx_get_fabric_name,
1931-
.get_fabric_proto_ident = tcm_qla2xxx_get_fabric_proto_ident,
19321914
.tpg_get_wwn = tcm_qla2xxx_get_fabric_wwn,
19331915
.tpg_get_tag = tcm_qla2xxx_get_tag,
19341916
.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 = {
19791961
.name = "qla2xxx_npiv",
19801962
.node_acl_size = sizeof(struct tcm_qla2xxx_nacl),
19811963
.get_fabric_name = tcm_qla2xxx_npiv_get_fabric_name,
1982-
.get_fabric_proto_ident = tcm_qla2xxx_get_fabric_proto_ident,
19831964
.tpg_get_wwn = tcm_qla2xxx_get_fabric_wwn,
19841965
.tpg_get_tag = tcm_qla2xxx_get_tag,
19851966
.tpg_get_pr_transport_id = tcm_qla2xxx_get_pr_transport_id,

‎drivers/target/iscsi/iscsi_target_configfs.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1918,7 +1918,6 @@ const struct target_core_fabric_ops iscsi_ops = {
19181918
.name = "iscsi",
19191919
.node_acl_size = sizeof(struct iscsi_node_acl),
19201920
.get_fabric_name = iscsi_get_fabric_name,
1921-
.get_fabric_proto_ident = iscsi_get_fabric_proto_ident,
19221921
.tpg_get_wwn = lio_tpg_get_endpoint_wwn,
19231922
.tpg_get_tag = lio_tpg_get_tag,
19241923
.tpg_get_default_depth = lio_tpg_get_default_depth,

‎drivers/target/loopback/tcm_loop.c‎

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -525,32 +525,6 @@ static inline struct tcm_loop_tpg *tl_tpg(struct se_portal_group *se_tpg)
525525
return container_of(se_tpg, struct tcm_loop_tpg, tl_se_tpg);
526526
}
527527

528-
static 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-
554528
static char *tcm_loop_get_endpoint_wwn(struct se_portal_group *se_tpg)
555529
{
556530
/*
@@ -1356,7 +1330,6 @@ static const struct target_core_fabric_ops loop_ops = {
13561330
.module = THIS_MODULE,
13571331
.name = "loopback",
13581332
.get_fabric_name = tcm_loop_get_fabric_name,
1359-
.get_fabric_proto_ident = tcm_loop_get_fabric_proto_ident,
13601333
.tpg_get_wwn = tcm_loop_get_endpoint_wwn,
13611334
.tpg_get_tag = tcm_loop_get_tag,
13621335
.tpg_get_pr_transport_id = tcm_loop_get_pr_transport_id,

‎drivers/target/sbp/sbp_target.c‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,18 +1832,6 @@ static int sbp_check_stop_free(struct se_cmd *se_cmd)
18321832
return 1;
18331833
}
18341834

1835-
/*
1836-
* Handlers for Serial Bus Protocol 2/3 (SBP-2 / SBP-3)
1837-
*/
1838-
static 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-
18471835
static u32 sbp_get_pr_transport_id(
18481836
struct se_portal_group *se_tpg,
18491837
struct se_node_acl *se_nacl,
@@ -2442,7 +2430,6 @@ static const struct target_core_fabric_ops sbp_ops = {
24422430
.module = THIS_MODULE,
24432431
.name = "sbp",
24442432
.get_fabric_name = sbp_get_fabric_name,
2445-
.get_fabric_proto_ident = sbp_get_fabric_proto_ident,
24462433
.tpg_get_wwn = sbp_get_fabric_wwn,
24472434
.tpg_get_tag = sbp_get_tag,
24482435
.tpg_get_pr_transport_id = sbp_get_pr_transport_id,

‎drivers/target/target_core_configfs.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,6 @@ static int target_fabric_tf_ops_check(const struct target_core_fabric_ops *tfo)
318318
pr_err("Missing tfo->get_fabric_name()\n");
319319
return -EINVAL;
320320
}
321-
if (!tfo->get_fabric_proto_ident) {
322-
pr_err("Missing tfo->get_fabric_proto_ident()\n");
323-
return -EINVAL;
324-
}
325321
if (!tfo->tpg_get_wwn) {
326322
pr_err("Missing tfo->tpg_get_wwn()\n");
327323
return -EINVAL;

‎drivers/target/target_core_fabric_lib.c‎

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,6 @@
4242
/*
4343
* Handlers for Serial Attached SCSI (SAS)
4444
*/
45-
u8 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-
}
53-
EXPORT_SYMBOL(sas_get_fabric_proto_ident);
54-
5545
u32 sas_get_pr_transport_id(
5646
struct se_portal_group *se_tpg,
5747
struct se_node_acl *se_nacl,
@@ -128,12 +118,6 @@ EXPORT_SYMBOL(sas_parse_pr_out_transport_id);
128118
/*
129119
* Handlers for Fibre Channel Protocol (FCP)
130120
*/
131-
u8 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-
}
135-
EXPORT_SYMBOL(fc_get_fabric_proto_ident);
136-
137121
u32 fc_get_pr_transport_id_len(
138122
struct se_portal_group *se_tpg,
139123
struct se_node_acl *se_nacl,
@@ -208,17 +192,6 @@ EXPORT_SYMBOL(fc_parse_pr_out_transport_id);
208192
/*
209193
* Handlers for Internet Small Computer Systems Interface (iSCSI)
210194
*/
211-
212-
u8 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-
}
220-
EXPORT_SYMBOL(iscsi_get_fabric_proto_ident);
221-
222195
u32 iscsi_get_pr_transport_id(
223196
struct se_portal_group *se_tpg,
224197
struct se_node_acl *se_nacl,

‎drivers/target/target_core_pr.c‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,7 +1447,7 @@ core_scsi3_decode_spec_i_port(
14471447
struct pr_transport_id_holder *tidh_new, *tidh, *tidh_tmp;
14481448
const struct target_core_fabric_ops *tmp_tf_ops;
14491449
unsigned char *buf;
1450-
unsigned char *ptr, *i_str = NULL, proto_ident, tmp_proto_ident;
1450+
unsigned char *ptr, *i_str = NULL, proto_ident;
14511451
char *iport_ptr = NULL, i_buf[PR_REG_ISID_ID_LEN];
14521452
sense_reason_t ret;
14531453
u32 tpdl, tid_len = 0;
@@ -1536,15 +1536,13 @@ core_scsi3_decode_spec_i_port(
15361536
tmp_tf_ops = tmp_tpg->se_tpg_tfo;
15371537
if (!tmp_tf_ops)
15381538
continue;
1539-
if (!tmp_tf_ops->get_fabric_proto_ident ||
1540-
!tmp_tf_ops->tpg_parse_pr_out_transport_id)
1539+
if (!tmp_tf_ops->tpg_parse_pr_out_transport_id)
15411540
continue;
15421541
/*
15431542
* Look for the matching proto_ident provided by
15441543
* the received TransportID
15451544
*/
1546-
tmp_proto_ident = tmp_tf_ops->get_fabric_proto_ident(tmp_tpg);
1547-
if (tmp_proto_ident != proto_ident)
1545+
if (tmp_tpg->proto_id != proto_ident)
15481546
continue;
15491547
dest_rtpi = tmp_port->sep_rtpi;
15501548

@@ -3230,11 +3228,11 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key,
32303228
pr_debug("SPC-3 PR REGISTER_AND_MOVE: Extracted Protocol Identifier:"
32313229
" 0x%02x\n", proto_ident);
32323230

3233-
if (proto_ident != dest_tf_ops->get_fabric_proto_ident(dest_se_tpg)) {
3231+
if (proto_ident != dest_se_tpg->proto_id) {
32343232
pr_err("SPC-3 PR REGISTER_AND_MOVE: Received"
32353233
" proto_ident: 0x%02x does not match ident: 0x%02x"
32363234
" from fabric: %s\n", proto_ident,
3237-
dest_tf_ops->get_fabric_proto_ident(dest_se_tpg),
3235+
dest_se_tpg->proto_id,
32383236
dest_tf_ops->get_fabric_name());
32393237
ret = TCM_INVALID_PARAMETER_LIST;
32403238
goto out;

‎drivers/target/target_core_spc.c‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,7 @@ spc_emulate_evpd_83(struct se_cmd *cmd, unsigned char *buf)
286286
* Get the PROTOCOL IDENTIFIER as defined by spc4r17
287287
* section 7.5.1 Table 362
288288
*/
289-
buf[off] =
290-
(tpg->se_tpg_tfo->get_fabric_proto_ident(tpg) << 4);
289+
buf[off] = tpg->proto_id << 4;
291290
buf[off++] |= 0x1; /* CODE SET == Binary */
292291
buf[off] = 0x80; /* Set PIV=1 */
293292
/* Set ASSOCIATION == target port: 01b */
@@ -322,8 +321,7 @@ spc_emulate_evpd_83(struct se_cmd *cmd, unsigned char *buf)
322321
tg_pt_gp_id = tg_pt_gp->tg_pt_gp_id;
323322
spin_unlock(&tg_pt_gp_mem->tg_pt_gp_mem_lock);
324323

325-
buf[off] =
326-
(tpg->se_tpg_tfo->get_fabric_proto_ident(tpg) << 4);
324+
buf[off] = tpg->proto_id << 4;
327325
buf[off++] |= 0x1; /* CODE SET == Binary */
328326
buf[off] = 0x80; /* Set PIV=1 */
329327
/* Set ASSOCIATION == target port: 01b */
@@ -371,8 +369,7 @@ spc_emulate_evpd_83(struct se_cmd *cmd, unsigned char *buf)
371369
* section 7.5.1 Table 362
372370
*/
373371
check_scsi_name:
374-
buf[off] =
375-
(tpg->se_tpg_tfo->get_fabric_proto_ident(tpg) << 4);
372+
buf[off] = tpg->proto_id << 4;
376373
buf[off++] |= 0x3; /* CODE SET == UTF-8 */
377374
buf[off] = 0x80; /* Set PIV=1 */
378375
/* Set ASSOCIATION == target port: 01b */
@@ -412,8 +409,7 @@ spc_emulate_evpd_83(struct se_cmd *cmd, unsigned char *buf)
412409
/*
413410
* Target device designator
414411
*/
415-
buf[off] =
416-
(tpg->se_tpg_tfo->get_fabric_proto_ident(tpg) << 4);
412+
buf[off] = tpg->proto_id << 4;
417413
buf[off++] |= 0x3; /* CODE SET == UTF-8 */
418414
buf[off] = 0x80; /* Set PIV=1 */
419415
/* Set ASSOCIATION == target device: 10b */

0 commit comments

Comments
 (0)