1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */ 2*4882a593Smuzhiyun #include <target/target_core_base.h> 3*4882a593Smuzhiyun #include <linux/btree.h> 4*4882a593Smuzhiyun 5*4882a593Smuzhiyun /* length of ASCII WWPNs including pad */ 6*4882a593Smuzhiyun #define TCM_QLA2XXX_NAMELEN 32 7*4882a593Smuzhiyun /* 8*4882a593Smuzhiyun * Number of pre-allocated per-session tags, based upon the worst-case 9*4882a593Smuzhiyun * per port number of iocbs 10*4882a593Smuzhiyun */ 11*4882a593Smuzhiyun #define TCM_QLA2XXX_DEFAULT_TAGS 2088 12*4882a593Smuzhiyun 13*4882a593Smuzhiyun #include "qla_target.h" 14*4882a593Smuzhiyun 15*4882a593Smuzhiyun struct tcm_qla2xxx_nacl { 16*4882a593Smuzhiyun struct se_node_acl se_node_acl; 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun /* From libfc struct fc_rport->port_id */ 19*4882a593Smuzhiyun u32 nport_id; 20*4882a593Smuzhiyun /* Binary World Wide unique Node Name for remote FC Initiator Nport */ 21*4882a593Smuzhiyun u64 nport_wwnn; 22*4882a593Smuzhiyun /* ASCII formatted WWPN for FC Initiator Nport */ 23*4882a593Smuzhiyun char nport_name[TCM_QLA2XXX_NAMELEN]; 24*4882a593Smuzhiyun /* Pointer to fc_port */ 25*4882a593Smuzhiyun struct fc_port *fc_port; 26*4882a593Smuzhiyun /* Pointer to TCM FC nexus */ 27*4882a593Smuzhiyun struct se_session *nport_nexus; 28*4882a593Smuzhiyun }; 29*4882a593Smuzhiyun 30*4882a593Smuzhiyun struct tcm_qla2xxx_tpg_attrib { 31*4882a593Smuzhiyun int generate_node_acls; 32*4882a593Smuzhiyun int cache_dynamic_acls; 33*4882a593Smuzhiyun int demo_mode_write_protect; 34*4882a593Smuzhiyun int prod_mode_write_protect; 35*4882a593Smuzhiyun int demo_mode_login_only; 36*4882a593Smuzhiyun int fabric_prot_type; 37*4882a593Smuzhiyun int jam_host; 38*4882a593Smuzhiyun }; 39*4882a593Smuzhiyun 40*4882a593Smuzhiyun struct tcm_qla2xxx_tpg { 41*4882a593Smuzhiyun /* FC lport target portal group tag for TCM */ 42*4882a593Smuzhiyun u16 lport_tpgt; 43*4882a593Smuzhiyun /* Atomic bit to determine TPG active status */ 44*4882a593Smuzhiyun atomic_t lport_tpg_enabled; 45*4882a593Smuzhiyun /* Pointer back to tcm_qla2xxx_lport */ 46*4882a593Smuzhiyun struct tcm_qla2xxx_lport *lport; 47*4882a593Smuzhiyun /* Used by tcm_qla2xxx_tpg_attrib_cit */ 48*4882a593Smuzhiyun struct tcm_qla2xxx_tpg_attrib tpg_attrib; 49*4882a593Smuzhiyun /* Returned by tcm_qla2xxx_make_tpg() */ 50*4882a593Smuzhiyun struct se_portal_group se_tpg; 51*4882a593Smuzhiyun }; 52*4882a593Smuzhiyun 53*4882a593Smuzhiyun struct tcm_qla2xxx_fc_loopid { 54*4882a593Smuzhiyun struct se_node_acl *se_nacl; 55*4882a593Smuzhiyun }; 56*4882a593Smuzhiyun 57*4882a593Smuzhiyun struct tcm_qla2xxx_lport { 58*4882a593Smuzhiyun /* Binary World Wide unique Port Name for FC Target Lport */ 59*4882a593Smuzhiyun u64 lport_wwpn; 60*4882a593Smuzhiyun /* Binary World Wide unique Port Name for FC NPIV Target Lport */ 61*4882a593Smuzhiyun u64 lport_npiv_wwpn; 62*4882a593Smuzhiyun /* Binary World Wide unique Node Name for FC NPIV Target Lport */ 63*4882a593Smuzhiyun u64 lport_npiv_wwnn; 64*4882a593Smuzhiyun /* ASCII formatted WWPN for FC Target Lport */ 65*4882a593Smuzhiyun char lport_name[TCM_QLA2XXX_NAMELEN]; 66*4882a593Smuzhiyun /* ASCII formatted naa WWPN for VPD page 83 etc */ 67*4882a593Smuzhiyun char lport_naa_name[TCM_QLA2XXX_NAMELEN]; 68*4882a593Smuzhiyun /* map for fc_port pointers in 24-bit FC Port ID space */ 69*4882a593Smuzhiyun struct btree_head32 lport_fcport_map; 70*4882a593Smuzhiyun /* vmalloc-ed memory for fc_port pointers for 16-bit FC loop ID */ 71*4882a593Smuzhiyun struct tcm_qla2xxx_fc_loopid *lport_loopid_map; 72*4882a593Smuzhiyun /* Pointer to struct scsi_qla_host from qla2xxx LLD */ 73*4882a593Smuzhiyun struct scsi_qla_host *qla_vha; 74*4882a593Smuzhiyun /* Pointer to struct qla_tgt pointer */ 75*4882a593Smuzhiyun struct qla_tgt lport_qla_tgt; 76*4882a593Smuzhiyun /* Pointer to TPG=1 for non NPIV mode */ 77*4882a593Smuzhiyun struct tcm_qla2xxx_tpg *tpg_1; 78*4882a593Smuzhiyun /* Returned by tcm_qla2xxx_make_lport() */ 79*4882a593Smuzhiyun struct se_wwn lport_wwn; 80*4882a593Smuzhiyun }; 81