tcm_qla2xxx.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #include <target/target_core_base.h>
  2. #include <linux/btree.h>
  3. #define TCM_QLA2XXX_VERSION "v0.1"
  4. /* length of ASCII WWPNs including pad */
  5. #define TCM_QLA2XXX_NAMELEN 32
  6. /* lenth of ASCII NPIV 'WWPN+WWNN' including pad */
  7. #define TCM_QLA2XXX_NPIV_NAMELEN 66
  8. #include "qla_target.h"
  9. struct tcm_qla2xxx_nacl {
  10. /* From libfc struct fc_rport->port_id */
  11. u32 nport_id;
  12. /* Binary World Wide unique Node Name for remote FC Initiator Nport */
  13. u64 nport_wwnn;
  14. /* ASCII formatted WWPN for FC Initiator Nport */
  15. char nport_name[TCM_QLA2XXX_NAMELEN];
  16. /* Pointer to qla_tgt_sess */
  17. struct qla_tgt_sess *qla_tgt_sess;
  18. /* Pointer to TCM FC nexus */
  19. struct se_session *nport_nexus;
  20. /* Returned by tcm_qla2xxx_make_nodeacl() */
  21. struct se_node_acl se_node_acl;
  22. };
  23. struct tcm_qla2xxx_tpg_attrib {
  24. int generate_node_acls;
  25. int cache_dynamic_acls;
  26. int demo_mode_write_protect;
  27. int prod_mode_write_protect;
  28. int demo_mode_login_only;
  29. };
  30. struct tcm_qla2xxx_tpg {
  31. /* FC lport target portal group tag for TCM */
  32. u16 lport_tpgt;
  33. /* Atomic bit to determine TPG active status */
  34. atomic_t lport_tpg_enabled;
  35. /* Pointer back to tcm_qla2xxx_lport */
  36. struct tcm_qla2xxx_lport *lport;
  37. /* Used by tcm_qla2xxx_tpg_attrib_cit */
  38. struct tcm_qla2xxx_tpg_attrib tpg_attrib;
  39. /* Returned by tcm_qla2xxx_make_tpg() */
  40. struct se_portal_group se_tpg;
  41. };
  42. #define QLA_TPG_ATTRIB(tpg) (&(tpg)->tpg_attrib)
  43. struct tcm_qla2xxx_fc_loopid {
  44. struct se_node_acl *se_nacl;
  45. };
  46. struct tcm_qla2xxx_lport {
  47. /* SCSI protocol the lport is providing */
  48. u8 lport_proto_id;
  49. /* Binary World Wide unique Port Name for FC Target Lport */
  50. u64 lport_wwpn;
  51. /* Binary World Wide unique Port Name for FC NPIV Target Lport */
  52. u64 lport_npiv_wwpn;
  53. /* Binary World Wide unique Node Name for FC NPIV Target Lport */
  54. u64 lport_npiv_wwnn;
  55. /* ASCII formatted WWPN for FC Target Lport */
  56. char lport_name[TCM_QLA2XXX_NAMELEN];
  57. /* ASCII formatted naa WWPN for VPD page 83 etc */
  58. char lport_naa_name[TCM_QLA2XXX_NAMELEN];
  59. /* ASCII formatted WWPN+WWNN for NPIV FC Target Lport */
  60. char lport_npiv_name[TCM_QLA2XXX_NPIV_NAMELEN];
  61. /* map for fc_port pointers in 24-bit FC Port ID space */
  62. struct btree_head32 lport_fcport_map;
  63. /* vmalloc-ed memory for fc_port pointers for 16-bit FC loop ID */
  64. struct tcm_qla2xxx_fc_loopid *lport_loopid_map;
  65. /* Pointer to struct scsi_qla_host from qla2xxx LLD */
  66. struct scsi_qla_host *qla_vha;
  67. /* Pointer to struct scsi_qla_host for NPIV VP from qla2xxx LLD */
  68. struct scsi_qla_host *qla_npiv_vp;
  69. /* Pointer to struct qla_tgt pointer */
  70. struct qla_tgt lport_qla_tgt;
  71. /* Pointer to struct fc_vport for NPIV vport from libfc */
  72. struct fc_vport *npiv_vport;
  73. /* Pointer to TPG=1 for non NPIV mode */
  74. struct tcm_qla2xxx_tpg *tpg_1;
  75. /* Returned by tcm_qla2xxx_make_lport() */
  76. struct se_wwn lport_wwn;
  77. };