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