blob: 275d8b9a7a34121d4d7d356659bfe92816219a3f [file] [log] [blame]
Nicholas Bellinger75f8c1f2012-05-15 14:34:29 -04001#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/* lenth of ASCII NPIV 'WWPN+WWNN' including pad */
8#define TCM_QLA2XXX_NPIV_NAMELEN 66
9
10#include "qla_target.h"
11
12struct tcm_qla2xxx_nacl {
13 /* From libfc struct fc_rport->port_id */
14 u32 nport_id;
15 /* Binary World Wide unique Node Name for remote FC Initiator Nport */
16 u64 nport_wwnn;
17 /* ASCII formatted WWPN for FC Initiator Nport */
18 char nport_name[TCM_QLA2XXX_NAMELEN];
19 /* Pointer to qla_tgt_sess */
20 struct qla_tgt_sess *qla_tgt_sess;
21 /* Pointer to TCM FC nexus */
22 struct se_session *nport_nexus;
23 /* Returned by tcm_qla2xxx_make_nodeacl() */
24 struct se_node_acl se_node_acl;
25};
26
27struct tcm_qla2xxx_tpg_attrib {
28 int generate_node_acls;
29 int cache_dynamic_acls;
30 int demo_mode_write_protect;
31 int prod_mode_write_protect;
Andy Groverde04a8a2013-07-19 15:06:38 -070032 int demo_mode_login_only;
Nicholas Bellinger75f8c1f2012-05-15 14:34:29 -040033};
34
35struct tcm_qla2xxx_tpg {
36 /* FC lport target portal group tag for TCM */
37 u16 lport_tpgt;
38 /* Atomic bit to determine TPG active status */
39 atomic_t lport_tpg_enabled;
40 /* Pointer back to tcm_qla2xxx_lport */
41 struct tcm_qla2xxx_lport *lport;
42 /* Used by tcm_qla2xxx_tpg_attrib_cit */
43 struct tcm_qla2xxx_tpg_attrib tpg_attrib;
44 /* Returned by tcm_qla2xxx_make_tpg() */
45 struct se_portal_group se_tpg;
46};
47
Nicholas Bellinger75f8c1f2012-05-15 14:34:29 -040048struct tcm_qla2xxx_fc_loopid {
49 struct se_node_acl *se_nacl;
50};
51
52struct tcm_qla2xxx_lport {
53 /* SCSI protocol the lport is providing */
54 u8 lport_proto_id;
55 /* Binary World Wide unique Port Name for FC Target Lport */
56 u64 lport_wwpn;
57 /* Binary World Wide unique Port Name for FC NPIV Target Lport */
58 u64 lport_npiv_wwpn;
59 /* Binary World Wide unique Node Name for FC NPIV Target Lport */
60 u64 lport_npiv_wwnn;
61 /* ASCII formatted WWPN for FC Target Lport */
62 char lport_name[TCM_QLA2XXX_NAMELEN];
Roland Dreierc046aa02012-10-11 13:41:31 -070063 /* ASCII formatted naa WWPN for VPD page 83 etc */
64 char lport_naa_name[TCM_QLA2XXX_NAMELEN];
Nicholas Bellinger75f8c1f2012-05-15 14:34:29 -040065 /* ASCII formatted WWPN+WWNN for NPIV FC Target Lport */
66 char lport_npiv_name[TCM_QLA2XXX_NPIV_NAMELEN];
67 /* map for fc_port pointers in 24-bit FC Port ID space */
68 struct btree_head32 lport_fcport_map;
69 /* vmalloc-ed memory for fc_port pointers for 16-bit FC loop ID */
70 struct tcm_qla2xxx_fc_loopid *lport_loopid_map;
71 /* Pointer to struct scsi_qla_host from qla2xxx LLD */
72 struct scsi_qla_host *qla_vha;
Nicholas Bellinger75f8c1f2012-05-15 14:34:29 -040073 /* Pointer to struct qla_tgt pointer */
74 struct qla_tgt lport_qla_tgt;
Nicholas Bellinger75f8c1f2012-05-15 14:34:29 -040075 /* Pointer to TPG=1 for non NPIV mode */
76 struct tcm_qla2xxx_tpg *tpg_1;
77 /* Returned by tcm_qla2xxx_make_lport() */
78 struct se_wwn lport_wwn;
79};