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