tcm_qla2xxx.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. };
  29. struct tcm_qla2xxx_tpg {
  30. /* FC lport target portal group tag for TCM */
  31. u16 lport_tpgt;
  32. /* Atomic bit to determine TPG active status */
  33. atomic_t lport_tpg_enabled;
  34. /* Pointer back to tcm_qla2xxx_lport */
  35. struct tcm_qla2xxx_lport *lport;
  36. /* Used by tcm_qla2xxx_tpg_attrib_cit */
  37. struct tcm_qla2xxx_tpg_attrib tpg_attrib;
  38. /* Returned by tcm_qla2xxx_make_tpg() */
  39. struct se_portal_group se_tpg;
  40. };
  41. #define QLA_TPG_ATTRIB(tpg) (&(tpg)->tpg_attrib)
  42. struct tcm_qla2xxx_fc_loopid {
  43. struct se_node_acl *se_nacl;
  44. };
  45. struct tcm_qla2xxx_lport {
  46. /* SCSI protocol the lport is providing */
  47. u8 lport_proto_id;
  48. /* Binary World Wide unique Port Name for FC Target Lport */
  49. u64 lport_wwpn;
  50. /* Binary World Wide unique Port Name for FC NPIV Target Lport */
  51. u64 lport_npiv_wwpn;
  52. /* Binary World Wide unique Node Name for FC NPIV Target Lport */
  53. u64 lport_npiv_wwnn;
  54. /* ASCII formatted WWPN for FC Target Lport */
  55. char lport_name[TCM_QLA2XXX_NAMELEN];
  56. /* ASCII formatted WWPN+WWNN for NPIV FC Target Lport */
  57. char lport_npiv_name[TCM_QLA2XXX_NPIV_NAMELEN];
  58. /* map for fc_port pointers in 24-bit FC Port ID space */
  59. struct btree_head32 lport_fcport_map;
  60. /* vmalloc-ed memory for fc_port pointers for 16-bit FC loop ID */
  61. struct tcm_qla2xxx_fc_loopid *lport_loopid_map;
  62. /* Pointer to struct scsi_qla_host from qla2xxx LLD */
  63. struct scsi_qla_host *qla_vha;
  64. /* Pointer to struct scsi_qla_host for NPIV VP from qla2xxx LLD */
  65. struct scsi_qla_host *qla_npiv_vp;
  66. /* Pointer to struct qla_tgt pointer */
  67. struct qla_tgt lport_qla_tgt;
  68. /* Pointer to struct fc_vport for NPIV vport from libfc */
  69. struct fc_vport *npiv_vport;
  70. /* Pointer to TPG=1 for non NPIV mode */
  71. struct tcm_qla2xxx_tpg *tpg_1;
  72. /* Returned by tcm_qla2xxx_make_lport() */
  73. struct se_wwn lport_wwn;
  74. };