target: move node ACL allocation to core code
[linux-2.6-block.git] / drivers / scsi / qla2xxx / tcm_qla2xxx.h
CommitLineData
75f8c1f6
NB
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
51a07f84
NB
7/*
8 * Number of pre-allocated per-session tags, based upon the worst-case
9 * per port number of iocbs
10 */
11#define TCM_QLA2XXX_DEFAULT_TAGS 2088
75f8c1f6
NB
12
13#include "qla_target.h"
14
15struct tcm_qla2xxx_nacl {
144bc4c2
CH
16 struct se_node_acl se_node_acl;
17
75f8c1f6
NB
18 /* From libfc struct fc_rport->port_id */
19 u32 nport_id;
20 /* Binary World Wide unique Node Name for remote FC Initiator Nport */
21 u64 nport_wwnn;
22 /* ASCII formatted WWPN for FC Initiator Nport */
23 char nport_name[TCM_QLA2XXX_NAMELEN];
24 /* Pointer to qla_tgt_sess */
25 struct qla_tgt_sess *qla_tgt_sess;
26 /* Pointer to TCM FC nexus */
27 struct se_session *nport_nexus;
75f8c1f6
NB
28};
29
30struct tcm_qla2xxx_tpg_attrib {
31 int generate_node_acls;
32 int cache_dynamic_acls;
33 int demo_mode_write_protect;
34 int prod_mode_write_protect;
de04a8aa 35 int demo_mode_login_only;
64b16887 36 int fabric_prot_type;
75f8c1f6
NB
37};
38
39struct 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;
7474f52a
NB
50 /* Items for dealing with configfs_depend_item */
51 struct completion tpg_base_comp;
52 struct work_struct tpg_base_work;
75f8c1f6
NB
53};
54
75f8c1f6
NB
55struct tcm_qla2xxx_fc_loopid {
56 struct se_node_acl *se_nacl;
57};
58
59struct tcm_qla2xxx_lport {
60 /* SCSI protocol the lport is providing */
61 u8 lport_proto_id;
62 /* Binary World Wide unique Port Name for FC Target Lport */
63 u64 lport_wwpn;
64 /* Binary World Wide unique Port Name for FC NPIV Target Lport */
65 u64 lport_npiv_wwpn;
66 /* Binary World Wide unique Node Name for FC NPIV Target Lport */
67 u64 lport_npiv_wwnn;
68 /* ASCII formatted WWPN for FC Target Lport */
69 char lport_name[TCM_QLA2XXX_NAMELEN];
c046aa0f
RD
70 /* ASCII formatted naa WWPN for VPD page 83 etc */
71 char lport_naa_name[TCM_QLA2XXX_NAMELEN];
75f8c1f6
NB
72 /* map for fc_port pointers in 24-bit FC Port ID space */
73 struct btree_head32 lport_fcport_map;
74 /* vmalloc-ed memory for fc_port pointers for 16-bit FC loop ID */
75 struct tcm_qla2xxx_fc_loopid *lport_loopid_map;
76 /* Pointer to struct scsi_qla_host from qla2xxx LLD */
77 struct scsi_qla_host *qla_vha;
75f8c1f6
NB
78 /* Pointer to struct qla_tgt pointer */
79 struct qla_tgt lport_qla_tgt;
75f8c1f6
NB
80 /* Pointer to TPG=1 for non NPIV mode */
81 struct tcm_qla2xxx_tpg *tpg_1;
82 /* Returned by tcm_qla2xxx_make_lport() */
83 struct se_wwn lport_wwn;
84};