Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Nicholas Bellinger | 75f8c1f | 2012-05-15 14:34:29 -0400 | [diff] [blame] | 2 | #include <target/target_core_base.h> |
| 3 | #include <linux/btree.h> |
| 4 | |
Nicholas Bellinger | 75f8c1f | 2012-05-15 14:34:29 -0400 | [diff] [blame] | 5 | /* length of ASCII WWPNs including pad */ |
| 6 | #define TCM_QLA2XXX_NAMELEN 32 |
Nicholas Bellinger | 51a07f8 | 2014-05-23 02:00:56 -0700 | [diff] [blame] | 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 |
Nicholas Bellinger | 75f8c1f | 2012-05-15 14:34:29 -0400 | [diff] [blame] | 12 | |
| 13 | #include "qla_target.h" |
| 14 | |
| 15 | struct tcm_qla2xxx_nacl { |
Christoph Hellwig | 144bc4c | 2015-04-13 19:51:16 +0200 | [diff] [blame] | 16 | struct se_node_acl se_node_acl; |
| 17 | |
Nicholas Bellinger | 75f8c1f | 2012-05-15 14:34:29 -0400 | [diff] [blame] | 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]; |
Quinn Tran | 5d96483 | 2017-01-19 22:27:59 -0800 | [diff] [blame] | 24 | /* Pointer to fc_port */ |
| 25 | struct fc_port *fc_port; |
Nicholas Bellinger | 75f8c1f | 2012-05-15 14:34:29 -0400 | [diff] [blame] | 26 | /* Pointer to TCM FC nexus */ |
| 27 | struct se_session *nport_nexus; |
Nicholas Bellinger | 75f8c1f | 2012-05-15 14:34:29 -0400 | [diff] [blame] | 28 | }; |
| 29 | |
| 30 | struct 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 Grover | de04a8a | 2013-07-19 15:06:38 -0700 | [diff] [blame] | 35 | int demo_mode_login_only; |
Nicholas Bellinger | 64b1688 | 2015-03-27 23:30:57 -0700 | [diff] [blame] | 36 | int fabric_prot_type; |
Laurence Oberman | 54a5e73 | 2016-05-10 01:23:17 -0700 | [diff] [blame] | 37 | int jam_host; |
Nicholas Bellinger | 75f8c1f | 2012-05-15 14:34:29 -0400 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | struct 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; |
| 51 | }; |
| 52 | |
Nicholas Bellinger | 75f8c1f | 2012-05-15 14:34:29 -0400 | [diff] [blame] | 53 | struct tcm_qla2xxx_fc_loopid { |
| 54 | struct se_node_acl *se_nacl; |
| 55 | }; |
| 56 | |
| 57 | struct tcm_qla2xxx_lport { |
Nicholas Bellinger | 75f8c1f | 2012-05-15 14:34:29 -0400 | [diff] [blame] | 58 | /* Binary World Wide unique Port Name for FC Target Lport */ |
| 59 | u64 lport_wwpn; |
| 60 | /* Binary World Wide unique Port Name for FC NPIV Target Lport */ |
| 61 | u64 lport_npiv_wwpn; |
| 62 | /* Binary World Wide unique Node Name for FC NPIV Target Lport */ |
| 63 | u64 lport_npiv_wwnn; |
| 64 | /* ASCII formatted WWPN for FC Target Lport */ |
| 65 | char lport_name[TCM_QLA2XXX_NAMELEN]; |
Roland Dreier | c046aa0 | 2012-10-11 13:41:31 -0700 | [diff] [blame] | 66 | /* ASCII formatted naa WWPN for VPD page 83 etc */ |
| 67 | char lport_naa_name[TCM_QLA2XXX_NAMELEN]; |
Nicholas Bellinger | 75f8c1f | 2012-05-15 14:34:29 -0400 | [diff] [blame] | 68 | /* map for fc_port pointers in 24-bit FC Port ID space */ |
| 69 | struct btree_head32 lport_fcport_map; |
| 70 | /* vmalloc-ed memory for fc_port pointers for 16-bit FC loop ID */ |
| 71 | struct tcm_qla2xxx_fc_loopid *lport_loopid_map; |
| 72 | /* Pointer to struct scsi_qla_host from qla2xxx LLD */ |
| 73 | struct scsi_qla_host *qla_vha; |
Nicholas Bellinger | 75f8c1f | 2012-05-15 14:34:29 -0400 | [diff] [blame] | 74 | /* Pointer to struct qla_tgt pointer */ |
| 75 | struct qla_tgt lport_qla_tgt; |
Nicholas Bellinger | 75f8c1f | 2012-05-15 14:34:29 -0400 | [diff] [blame] | 76 | /* Pointer to TPG=1 for non NPIV mode */ |
| 77 | struct tcm_qla2xxx_tpg *tpg_1; |
| 78 | /* Returned by tcm_qla2xxx_make_lport() */ |
| 79 | struct se_wwn lport_wwn; |
| 80 | }; |