blob: 37e026a4823d6fdeb1048dd7f419f7ca253417c0 [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
Nicholas Bellinger51a07f82014-05-23 02:00:56 -07007/*
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
Nicholas Bellinger75f8c1f2012-05-15 14:34:29 -040012
13#include "qla_target.h"
14
15struct tcm_qla2xxx_nacl {
Christoph Hellwig144bc4c2015-04-13 19:51:16 +020016 struct se_node_acl se_node_acl;
17
Nicholas Bellinger75f8c1f2012-05-15 14:34:29 -040018 /* 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;
Nicholas Bellinger75f8c1f2012-05-15 14:34:29 -040028};
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;
Andy Groverde04a8a2013-07-19 15:06:38 -070035 int demo_mode_login_only;
Nicholas Bellinger64b16882015-03-27 23:30:57 -070036 int fabric_prot_type;
Laurence Oberman54a5e732016-05-10 01:23:17 -070037 int jam_host;
Nicholas Bellinger75f8c1f2012-05-15 14:34:29 -040038};
39
40struct tcm_qla2xxx_tpg {
41 /* FC lport target portal group tag for TCM */
42 u16 lport_tpgt;
43 /* Atomic bit to determine TPG active status */
44 atomic_t lport_tpg_enabled;
45 /* Pointer back to tcm_qla2xxx_lport */
46 struct tcm_qla2xxx_lport *lport;
47 /* Used by tcm_qla2xxx_tpg_attrib_cit */
48 struct tcm_qla2xxx_tpg_attrib tpg_attrib;
49 /* Returned by tcm_qla2xxx_make_tpg() */
50 struct se_portal_group se_tpg;
Nicholas Bellinger7474f522014-02-19 16:53:07 -080051 /* Items for dealing with configfs_depend_item */
52 struct completion tpg_base_comp;
53 struct work_struct tpg_base_work;
Nicholas Bellinger75f8c1f2012-05-15 14:34:29 -040054};
55
Nicholas Bellinger75f8c1f2012-05-15 14:34:29 -040056struct tcm_qla2xxx_fc_loopid {
57 struct se_node_acl *se_nacl;
58};
59
60struct tcm_qla2xxx_lport {
Nicholas Bellinger75f8c1f2012-05-15 14:34:29 -040061 /* Binary World Wide unique Port Name for FC Target Lport */
62 u64 lport_wwpn;
63 /* Binary World Wide unique Port Name for FC NPIV Target Lport */
64 u64 lport_npiv_wwpn;
65 /* Binary World Wide unique Node Name for FC NPIV Target Lport */
66 u64 lport_npiv_wwnn;
67 /* ASCII formatted WWPN for FC Target Lport */
68 char lport_name[TCM_QLA2XXX_NAMELEN];
Roland Dreierc046aa02012-10-11 13:41:31 -070069 /* ASCII formatted naa WWPN for VPD page 83 etc */
70 char lport_naa_name[TCM_QLA2XXX_NAMELEN];
Nicholas Bellinger75f8c1f2012-05-15 14:34:29 -040071 /* map for fc_port pointers in 24-bit FC Port ID space */
72 struct btree_head32 lport_fcport_map;
73 /* vmalloc-ed memory for fc_port pointers for 16-bit FC loop ID */
74 struct tcm_qla2xxx_fc_loopid *lport_loopid_map;
75 /* Pointer to struct scsi_qla_host from qla2xxx LLD */
76 struct scsi_qla_host *qla_vha;
Nicholas Bellinger75f8c1f2012-05-15 14:34:29 -040077 /* Pointer to struct qla_tgt pointer */
78 struct qla_tgt lport_qla_tgt;
Nicholas Bellinger75f8c1f2012-05-15 14:34:29 -040079 /* Pointer to TPG=1 for non NPIV mode */
80 struct tcm_qla2xxx_tpg *tpg_1;
81 /* Returned by tcm_qla2xxx_make_lport() */
82 struct se_wwn lport_wwn;
83};