2012-05-16 02:34:29 +08:00
|
|
|
#include <target/target_core_base.h>
|
|
|
|
#include <linux/btree.h>
|
|
|
|
|
|
|
|
#define TCM_QLA2XXX_VERSION "v0.1"
|
|
|
|
/* length of ASCII WWPNs including pad */
|
|
|
|
#define TCM_QLA2XXX_NAMELEN 32
|
|
|
|
/* lenth of ASCII NPIV 'WWPN+WWNN' including pad */
|
|
|
|
#define TCM_QLA2XXX_NPIV_NAMELEN 66
|
|
|
|
|
|
|
|
#include "qla_target.h"
|
|
|
|
|
|
|
|
struct tcm_qla2xxx_nacl {
|
|
|
|
/* From libfc struct fc_rport->port_id */
|
|
|
|
u32 nport_id;
|
|
|
|
/* Binary World Wide unique Node Name for remote FC Initiator Nport */
|
|
|
|
u64 nport_wwnn;
|
|
|
|
/* ASCII formatted WWPN for FC Initiator Nport */
|
|
|
|
char nport_name[TCM_QLA2XXX_NAMELEN];
|
|
|
|
/* Pointer to qla_tgt_sess */
|
|
|
|
struct qla_tgt_sess *qla_tgt_sess;
|
|
|
|
/* Pointer to TCM FC nexus */
|
|
|
|
struct se_session *nport_nexus;
|
|
|
|
/* Returned by tcm_qla2xxx_make_nodeacl() */
|
|
|
|
struct se_node_acl se_node_acl;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct tcm_qla2xxx_tpg_attrib {
|
|
|
|
int generate_node_acls;
|
|
|
|
int cache_dynamic_acls;
|
|
|
|
int demo_mode_write_protect;
|
|
|
|
int prod_mode_write_protect;
|
2013-07-20 06:06:38 +08:00
|
|
|
int demo_mode_login_only;
|
2012-05-16 02:34:29 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct tcm_qla2xxx_tpg {
|
|
|
|
/* FC lport target portal group tag for TCM */
|
|
|
|
u16 lport_tpgt;
|
|
|
|
/* Atomic bit to determine TPG active status */
|
|
|
|
atomic_t lport_tpg_enabled;
|
|
|
|
/* Pointer back to tcm_qla2xxx_lport */
|
|
|
|
struct tcm_qla2xxx_lport *lport;
|
|
|
|
/* Used by tcm_qla2xxx_tpg_attrib_cit */
|
|
|
|
struct tcm_qla2xxx_tpg_attrib tpg_attrib;
|
|
|
|
/* Returned by tcm_qla2xxx_make_tpg() */
|
|
|
|
struct se_portal_group se_tpg;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct tcm_qla2xxx_fc_loopid {
|
|
|
|
struct se_node_acl *se_nacl;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct tcm_qla2xxx_lport {
|
|
|
|
/* SCSI protocol the lport is providing */
|
|
|
|
u8 lport_proto_id;
|
|
|
|
/* Binary World Wide unique Port Name for FC Target Lport */
|
|
|
|
u64 lport_wwpn;
|
|
|
|
/* Binary World Wide unique Port Name for FC NPIV Target Lport */
|
|
|
|
u64 lport_npiv_wwpn;
|
|
|
|
/* Binary World Wide unique Node Name for FC NPIV Target Lport */
|
|
|
|
u64 lport_npiv_wwnn;
|
|
|
|
/* ASCII formatted WWPN for FC Target Lport */
|
|
|
|
char lport_name[TCM_QLA2XXX_NAMELEN];
|
tcm_qla2xxx: Format VPD page 83h SCSI name string according to SPC
My draft of SPC-4 says the following about the SCSI name string in
inquiry VPD page 83h:
The SCSI NAME STRING field starts with either:
a) the four UTF-8 characters 'eui.' concatenated with 16, 24, or
32 hexadecimal digits (i.e., the UTF-8 characters 0 through 9
and A through F) for an EUI-64 based identifier (see
7.8.6.5). The first hexadecimal digit shall be the most
significant four bits of the first byte (i.e., most significant
byte) of the EUI-64 based identifier;
b) the four UTF-8 characters 'naa.' concatenated with 16 or 32
hexadecimal digits for an NAA identifier (see 7.8.6.6). The
first hexadecimal digit shall be the most significant four bits
of the first byte (i.e., most significant byte) of the NAA
identifier; or
c) the four UTF-8 characters 'iqn.' concatenated with an iSCSI
Name for an iSCSI-name based identifier (see iSCSI).
However, the .tpg_get_wwn method for tcm_qla2xxx formats the WWN so
the SCSI name string looks like "52:4a:93:7d:24:5f:b2:12,t,0x0001".
This patch corrects the code so that VPD 83h gives a SPC-compliant
SCSI name string like "naa.524a937d245fb212,t,0x0001" while leavig
other uses alone (so configfs will still work with ':' separated WWNs).
Signed-off-by: Roland Dreier <roland@purestorage.com>
Cc: Chad Dupuis <chad.dupuis@qlogic.com>
Cc: Arun Easi <arun.easi@qlogic.com>
Cc: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2012-10-12 04:41:31 +08:00
|
|
|
/* ASCII formatted naa WWPN for VPD page 83 etc */
|
|
|
|
char lport_naa_name[TCM_QLA2XXX_NAMELEN];
|
2012-05-16 02:34:29 +08:00
|
|
|
/* ASCII formatted WWPN+WWNN for NPIV FC Target Lport */
|
|
|
|
char lport_npiv_name[TCM_QLA2XXX_NPIV_NAMELEN];
|
|
|
|
/* map for fc_port pointers in 24-bit FC Port ID space */
|
|
|
|
struct btree_head32 lport_fcport_map;
|
|
|
|
/* vmalloc-ed memory for fc_port pointers for 16-bit FC loop ID */
|
|
|
|
struct tcm_qla2xxx_fc_loopid *lport_loopid_map;
|
|
|
|
/* Pointer to struct scsi_qla_host from qla2xxx LLD */
|
|
|
|
struct scsi_qla_host *qla_vha;
|
|
|
|
/* Pointer to struct qla_tgt pointer */
|
|
|
|
struct qla_tgt lport_qla_tgt;
|
|
|
|
/* Pointer to TPG=1 for non NPIV mode */
|
|
|
|
struct tcm_qla2xxx_tpg *tpg_1;
|
|
|
|
/* Returned by tcm_qla2xxx_make_lport() */
|
|
|
|
struct se_wwn lport_wwn;
|
|
|
|
};
|