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