mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
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 <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
This commit is contained in:
parent
2aeeafae6b
commit
2650d71e24
18 changed files with 173 additions and 875 deletions
|
|
@ -1270,97 +1270,6 @@ static u16 scsiback_get_tag(struct se_portal_group *se_tpg)
|
|||
return tpg->tport_tpgt;
|
||||
}
|
||||
|
||||
static u32
|
||||
scsiback_get_pr_transport_id(struct se_portal_group *se_tpg,
|
||||
struct se_node_acl *se_nacl,
|
||||
struct t10_pr_registration *pr_reg,
|
||||
int *format_code,
|
||||
unsigned char *buf)
|
||||
{
|
||||
struct scsiback_tpg *tpg = container_of(se_tpg,
|
||||
struct scsiback_tpg, se_tpg);
|
||||
struct scsiback_tport *tport = tpg->tport;
|
||||
|
||||
switch (tport->tport_proto_id) {
|
||||
case SCSI_PROTOCOL_SAS:
|
||||
return sas_get_pr_transport_id(se_tpg, se_nacl, pr_reg,
|
||||
format_code, buf);
|
||||
case SCSI_PROTOCOL_FCP:
|
||||
return fc_get_pr_transport_id(se_tpg, se_nacl, pr_reg,
|
||||
format_code, buf);
|
||||
case SCSI_PROTOCOL_ISCSI:
|
||||
return iscsi_get_pr_transport_id(se_tpg, se_nacl, pr_reg,
|
||||
format_code, buf);
|
||||
default:
|
||||
pr_err("Unknown tport_proto_id: 0x%02x, using SAS emulation\n",
|
||||
tport->tport_proto_id);
|
||||
break;
|
||||
}
|
||||
|
||||
return sas_get_pr_transport_id(se_tpg, se_nacl, pr_reg,
|
||||
format_code, buf);
|
||||
}
|
||||
|
||||
static u32
|
||||
scsiback_get_pr_transport_id_len(struct se_portal_group *se_tpg,
|
||||
struct se_node_acl *se_nacl,
|
||||
struct t10_pr_registration *pr_reg,
|
||||
int *format_code)
|
||||
{
|
||||
struct scsiback_tpg *tpg = container_of(se_tpg,
|
||||
struct scsiback_tpg, se_tpg);
|
||||
struct scsiback_tport *tport = tpg->tport;
|
||||
|
||||
switch (tport->tport_proto_id) {
|
||||
case SCSI_PROTOCOL_SAS:
|
||||
return sas_get_pr_transport_id_len(se_tpg, se_nacl, pr_reg,
|
||||
format_code);
|
||||
case SCSI_PROTOCOL_FCP:
|
||||
return fc_get_pr_transport_id_len(se_tpg, se_nacl, pr_reg,
|
||||
format_code);
|
||||
case SCSI_PROTOCOL_ISCSI:
|
||||
return iscsi_get_pr_transport_id_len(se_tpg, se_nacl, pr_reg,
|
||||
format_code);
|
||||
default:
|
||||
pr_err("Unknown tport_proto_id: 0x%02x, using SAS emulation\n",
|
||||
tport->tport_proto_id);
|
||||
break;
|
||||
}
|
||||
|
||||
return sas_get_pr_transport_id_len(se_tpg, se_nacl, pr_reg,
|
||||
format_code);
|
||||
}
|
||||
|
||||
static char *
|
||||
scsiback_parse_pr_out_transport_id(struct se_portal_group *se_tpg,
|
||||
const char *buf,
|
||||
u32 *out_tid_len,
|
||||
char **port_nexus_ptr)
|
||||
{
|
||||
struct scsiback_tpg *tpg = container_of(se_tpg,
|
||||
struct scsiback_tpg, se_tpg);
|
||||
struct scsiback_tport *tport = tpg->tport;
|
||||
|
||||
switch (tport->tport_proto_id) {
|
||||
case SCSI_PROTOCOL_SAS:
|
||||
return sas_parse_pr_out_transport_id(se_tpg, buf, out_tid_len,
|
||||
port_nexus_ptr);
|
||||
case SCSI_PROTOCOL_FCP:
|
||||
return fc_parse_pr_out_transport_id(se_tpg, buf, out_tid_len,
|
||||
port_nexus_ptr);
|
||||
case SCSI_PROTOCOL_ISCSI:
|
||||
return iscsi_parse_pr_out_transport_id(se_tpg, buf, out_tid_len,
|
||||
port_nexus_ptr);
|
||||
default:
|
||||
pr_err("Unknown tport_proto_id: 0x%02x, using SAS emulation\n",
|
||||
tport->tport_proto_id);
|
||||
break;
|
||||
}
|
||||
|
||||
return sas_parse_pr_out_transport_id(se_tpg, buf, out_tid_len,
|
||||
port_nexus_ptr);
|
||||
}
|
||||
|
||||
static struct se_wwn *
|
||||
scsiback_make_tport(struct target_fabric_configfs *tf,
|
||||
struct config_group *group,
|
||||
|
|
@ -1909,9 +1818,6 @@ static const struct target_core_fabric_ops scsiback_ops = {
|
|||
.get_fabric_name = scsiback_get_fabric_name,
|
||||
.tpg_get_wwn = scsiback_get_fabric_wwn,
|
||||
.tpg_get_tag = scsiback_get_tag,
|
||||
.tpg_get_pr_transport_id = scsiback_get_pr_transport_id,
|
||||
.tpg_get_pr_transport_id_len = scsiback_get_pr_transport_id_len,
|
||||
.tpg_parse_pr_out_transport_id = scsiback_parse_pr_out_transport_id,
|
||||
.tpg_check_demo_mode = scsiback_check_true,
|
||||
.tpg_check_demo_mode_cache = scsiback_check_true,
|
||||
.tpg_check_demo_mode_write_protect = scsiback_check_false,
|
||||
|
|
|
|||
Loading…
Reference in a new issue