1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 275f8c1f6SNicholas Bellinger #include <target/target_core_base.h> 375f8c1f6SNicholas Bellinger #include <linux/btree.h> 475f8c1f6SNicholas Bellinger 575f8c1f6SNicholas Bellinger /* length of ASCII WWPNs including pad */ 675f8c1f6SNicholas Bellinger #define TCM_QLA2XXX_NAMELEN 32 751a07f84SNicholas Bellinger /* 851a07f84SNicholas Bellinger * Number of pre-allocated per-session tags, based upon the worst-case 951a07f84SNicholas Bellinger * per port number of iocbs 1051a07f84SNicholas Bellinger */ 1151a07f84SNicholas Bellinger #define TCM_QLA2XXX_DEFAULT_TAGS 2088 1275f8c1f6SNicholas Bellinger 1375f8c1f6SNicholas Bellinger #include "qla_target.h" 1475f8c1f6SNicholas Bellinger 1575f8c1f6SNicholas Bellinger struct tcm_qla2xxx_nacl { 16144bc4c2SChristoph Hellwig struct se_node_acl se_node_acl; 17144bc4c2SChristoph Hellwig 1875f8c1f6SNicholas Bellinger /* From libfc struct fc_rport->port_id */ 1975f8c1f6SNicholas Bellinger u32 nport_id; 2075f8c1f6SNicholas Bellinger /* Binary World Wide unique Node Name for remote FC Initiator Nport */ 2175f8c1f6SNicholas Bellinger u64 nport_wwnn; 2275f8c1f6SNicholas Bellinger /* ASCII formatted WWPN for FC Initiator Nport */ 2375f8c1f6SNicholas Bellinger char nport_name[TCM_QLA2XXX_NAMELEN]; 245d964837SQuinn Tran /* Pointer to fc_port */ 255d964837SQuinn Tran struct fc_port *fc_port; 2675f8c1f6SNicholas Bellinger /* Pointer to TCM FC nexus */ 2775f8c1f6SNicholas Bellinger struct se_session *nport_nexus; 2875f8c1f6SNicholas Bellinger }; 2975f8c1f6SNicholas Bellinger 3075f8c1f6SNicholas Bellinger struct tcm_qla2xxx_tpg_attrib { 3175f8c1f6SNicholas Bellinger int generate_node_acls; 3275f8c1f6SNicholas Bellinger int cache_dynamic_acls; 3375f8c1f6SNicholas Bellinger int demo_mode_write_protect; 3475f8c1f6SNicholas Bellinger int prod_mode_write_protect; 35de04a8aaSAndy Grover int demo_mode_login_only; 3664b16887SNicholas Bellinger int fabric_prot_type; 3754a5e73fSLaurence Oberman int jam_host; 3875f8c1f6SNicholas Bellinger }; 3975f8c1f6SNicholas Bellinger 4075f8c1f6SNicholas Bellinger struct tcm_qla2xxx_tpg { 4175f8c1f6SNicholas Bellinger /* FC lport target portal group tag for TCM */ 4275f8c1f6SNicholas Bellinger u16 lport_tpgt; 4375f8c1f6SNicholas Bellinger /* Atomic bit to determine TPG active status */ 4475f8c1f6SNicholas Bellinger atomic_t lport_tpg_enabled; 4575f8c1f6SNicholas Bellinger /* Pointer back to tcm_qla2xxx_lport */ 4675f8c1f6SNicholas Bellinger struct tcm_qla2xxx_lport *lport; 4775f8c1f6SNicholas Bellinger /* Used by tcm_qla2xxx_tpg_attrib_cit */ 4875f8c1f6SNicholas Bellinger struct tcm_qla2xxx_tpg_attrib tpg_attrib; 4975f8c1f6SNicholas Bellinger /* Returned by tcm_qla2xxx_make_tpg() */ 5075f8c1f6SNicholas Bellinger struct se_portal_group se_tpg; 5175f8c1f6SNicholas Bellinger }; 5275f8c1f6SNicholas Bellinger 5375f8c1f6SNicholas Bellinger struct tcm_qla2xxx_fc_loopid { 5475f8c1f6SNicholas Bellinger struct se_node_acl *se_nacl; 5575f8c1f6SNicholas Bellinger }; 5675f8c1f6SNicholas Bellinger 5775f8c1f6SNicholas Bellinger struct tcm_qla2xxx_lport { 5875f8c1f6SNicholas Bellinger /* Binary World Wide unique Port Name for FC Target Lport */ 5975f8c1f6SNicholas Bellinger u64 lport_wwpn; 6075f8c1f6SNicholas Bellinger /* Binary World Wide unique Port Name for FC NPIV Target Lport */ 6175f8c1f6SNicholas Bellinger u64 lport_npiv_wwpn; 6275f8c1f6SNicholas Bellinger /* Binary World Wide unique Node Name for FC NPIV Target Lport */ 6375f8c1f6SNicholas Bellinger u64 lport_npiv_wwnn; 6475f8c1f6SNicholas Bellinger /* ASCII formatted WWPN for FC Target Lport */ 6575f8c1f6SNicholas Bellinger char lport_name[TCM_QLA2XXX_NAMELEN]; 66c046aa0fSRoland Dreier /* ASCII formatted naa WWPN for VPD page 83 etc */ 67c046aa0fSRoland Dreier char lport_naa_name[TCM_QLA2XXX_NAMELEN]; 6875f8c1f6SNicholas Bellinger /* map for fc_port pointers in 24-bit FC Port ID space */ 6975f8c1f6SNicholas Bellinger struct btree_head32 lport_fcport_map; 7075f8c1f6SNicholas Bellinger /* vmalloc-ed memory for fc_port pointers for 16-bit FC loop ID */ 7175f8c1f6SNicholas Bellinger struct tcm_qla2xxx_fc_loopid *lport_loopid_map; 7275f8c1f6SNicholas Bellinger /* Pointer to struct scsi_qla_host from qla2xxx LLD */ 7375f8c1f6SNicholas Bellinger struct scsi_qla_host *qla_vha; 7475f8c1f6SNicholas Bellinger /* Pointer to struct qla_tgt pointer */ 7575f8c1f6SNicholas Bellinger struct qla_tgt lport_qla_tgt; 7675f8c1f6SNicholas Bellinger /* Pointer to TPG=1 for non NPIV mode */ 7775f8c1f6SNicholas Bellinger struct tcm_qla2xxx_tpg *tpg_1; 7875f8c1f6SNicholas Bellinger /* Returned by tcm_qla2xxx_make_lport() */ 7975f8c1f6SNicholas Bellinger struct se_wwn lport_wwn; 8075f8c1f6SNicholas Bellinger }; 81