qedi_nvm_iscsi_cfg.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. /*
  2. * QLogic iSCSI Offload Driver
  3. * Copyright (c) 2016 Cavium Inc.
  4. *
  5. * This software is available under the terms of the GNU General Public License
  6. * (GPL) Version 2, available from the file COPYING in the main directory of
  7. * this source tree.
  8. */
  9. #ifndef NVM_ISCSI_CFG_H
  10. #define NVM_ISCSI_CFG_H
  11. #define NUM_OF_ISCSI_TARGET_PER_PF 4 /* Defined as per the
  12. * ISCSI IBFT constraint
  13. */
  14. #define NUM_OF_ISCSI_PF_SUPPORTED 4 /* One PF per Port -
  15. * assuming 4 port card
  16. */
  17. #define NVM_ISCSI_CFG_DHCP_NAME_MAX_LEN 256
  18. union nvm_iscsi_dhcp_vendor_id {
  19. u32 value[NVM_ISCSI_CFG_DHCP_NAME_MAX_LEN / 4];
  20. u8 byte[NVM_ISCSI_CFG_DHCP_NAME_MAX_LEN];
  21. };
  22. #define NVM_ISCSI_IPV4_ADDR_BYTE_LEN 4
  23. union nvm_iscsi_ipv4_addr {
  24. u32 addr;
  25. u8 byte[NVM_ISCSI_IPV4_ADDR_BYTE_LEN];
  26. };
  27. #define NVM_ISCSI_IPV6_ADDR_BYTE_LEN 16
  28. union nvm_iscsi_ipv6_addr {
  29. u32 addr[4];
  30. u8 byte[NVM_ISCSI_IPV6_ADDR_BYTE_LEN];
  31. };
  32. struct nvm_iscsi_initiator_ipv4 {
  33. union nvm_iscsi_ipv4_addr addr; /* 0x0 */
  34. union nvm_iscsi_ipv4_addr subnet_mask; /* 0x4 */
  35. union nvm_iscsi_ipv4_addr gateway; /* 0x8 */
  36. union nvm_iscsi_ipv4_addr primary_dns; /* 0xC */
  37. union nvm_iscsi_ipv4_addr secondary_dns; /* 0x10 */
  38. union nvm_iscsi_ipv4_addr dhcp_addr; /* 0x14 */
  39. union nvm_iscsi_ipv4_addr isns_server; /* 0x18 */
  40. union nvm_iscsi_ipv4_addr slp_server; /* 0x1C */
  41. union nvm_iscsi_ipv4_addr primay_radius_server; /* 0x20 */
  42. union nvm_iscsi_ipv4_addr secondary_radius_server; /* 0x24 */
  43. union nvm_iscsi_ipv4_addr rsvd[4]; /* 0x28 */
  44. };
  45. struct nvm_iscsi_initiator_ipv6 {
  46. union nvm_iscsi_ipv6_addr addr; /* 0x0 */
  47. union nvm_iscsi_ipv6_addr subnet_mask; /* 0x10 */
  48. union nvm_iscsi_ipv6_addr gateway; /* 0x20 */
  49. union nvm_iscsi_ipv6_addr primary_dns; /* 0x30 */
  50. union nvm_iscsi_ipv6_addr secondary_dns; /* 0x40 */
  51. union nvm_iscsi_ipv6_addr dhcp_addr; /* 0x50 */
  52. union nvm_iscsi_ipv6_addr isns_server; /* 0x60 */
  53. union nvm_iscsi_ipv6_addr slp_server; /* 0x70 */
  54. union nvm_iscsi_ipv6_addr primay_radius_server; /* 0x80 */
  55. union nvm_iscsi_ipv6_addr secondary_radius_server; /* 0x90 */
  56. union nvm_iscsi_ipv6_addr rsvd[3]; /* 0xA0 */
  57. u32 config; /* 0xD0 */
  58. #define NVM_ISCSI_CFG_INITIATOR_IPV6_SUBNET_MASK_PREFIX_MASK 0x000000FF
  59. #define NVM_ISCSI_CFG_INITIATOR_IPV6_SUBNET_MASK_PREFIX_OFFSET 0
  60. u32 rsvd_1[3];
  61. };
  62. #define NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN 256
  63. union nvm_iscsi_name {
  64. u32 value[NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN / 4];
  65. u8 byte[NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN];
  66. };
  67. #define NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN 256
  68. union nvm_iscsi_chap_name {
  69. u32 value[NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN / 4];
  70. u8 byte[NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN];
  71. };
  72. #define NVM_ISCSI_CFG_CHAP_PWD_MAX_LEN 16 /* md5 need per RFC1996
  73. * is 16 octets
  74. */
  75. union nvm_iscsi_chap_password {
  76. u32 value[NVM_ISCSI_CFG_CHAP_PWD_MAX_LEN / 4];
  77. u8 byte[NVM_ISCSI_CFG_CHAP_PWD_MAX_LEN];
  78. };
  79. union nvm_iscsi_lun {
  80. u8 byte[8];
  81. u32 value[2];
  82. };
  83. struct nvm_iscsi_generic {
  84. u32 ctrl_flags; /* 0x0 */
  85. #define NVM_ISCSI_CFG_GEN_CHAP_ENABLED BIT(0)
  86. #define NVM_ISCSI_CFG_GEN_DHCP_TCPIP_CONFIG_ENABLED BIT(1)
  87. #define NVM_ISCSI_CFG_GEN_DHCP_ISCSI_CONFIG_ENABLED BIT(2)
  88. #define NVM_ISCSI_CFG_GEN_IPV6_ENABLED BIT(3)
  89. #define NVM_ISCSI_CFG_GEN_IPV4_FALLBACK_ENABLED BIT(4)
  90. #define NVM_ISCSI_CFG_GEN_ISNS_WORLD_LOGIN BIT(5)
  91. #define NVM_ISCSI_CFG_GEN_ISNS_SELECTIVE_LOGIN BIT(6)
  92. #define NVM_ISCSI_CFG_GEN_ADDR_REDIRECT_ENABLED BIT(7)
  93. #define NVM_ISCSI_CFG_GEN_CHAP_MUTUAL_ENABLED BIT(8)
  94. u32 timeout; /* 0x4 */
  95. #define NVM_ISCSI_CFG_GEN_DHCP_REQUEST_TIMEOUT_MASK 0x0000FFFF
  96. #define NVM_ISCSI_CFG_GEN_DHCP_REQUEST_TIMEOUT_OFFSET 0
  97. #define NVM_ISCSI_CFG_GEN_PORT_LOGIN_TIMEOUT_MASK 0xFFFF0000
  98. #define NVM_ISCSI_CFG_GEN_PORT_LOGIN_TIMEOUT_OFFSET 16
  99. union nvm_iscsi_dhcp_vendor_id dhcp_vendor_id; /* 0x8 */
  100. u32 rsvd[62]; /* 0x108 */
  101. };
  102. struct nvm_iscsi_initiator {
  103. struct nvm_iscsi_initiator_ipv4 ipv4; /* 0x0 */
  104. struct nvm_iscsi_initiator_ipv6 ipv6; /* 0x38 */
  105. union nvm_iscsi_name initiator_name; /* 0x118 */
  106. union nvm_iscsi_chap_name chap_name; /* 0x218 */
  107. union nvm_iscsi_chap_password chap_password; /* 0x318 */
  108. u32 generic_cont0; /* 0x398 */
  109. #define NVM_ISCSI_CFG_INITIATOR_VLAN_MASK 0x0000FFFF
  110. #define NVM_ISCSI_CFG_INITIATOR_VLAN_OFFSET 0
  111. #define NVM_ISCSI_CFG_INITIATOR_IP_VERSION_MASK 0x00030000
  112. #define NVM_ISCSI_CFG_INITIATOR_IP_VERSION_OFFSET 16
  113. #define NVM_ISCSI_CFG_INITIATOR_IP_VERSION_4 1
  114. #define NVM_ISCSI_CFG_INITIATOR_IP_VERSION_6 2
  115. #define NVM_ISCSI_CFG_INITIATOR_IP_VERSION_4_AND_6 3
  116. u32 ctrl_flags;
  117. #define NVM_ISCSI_CFG_INITIATOR_IP_VERSION_PRIORITY_V6 BIT(0)
  118. #define NVM_ISCSI_CFG_INITIATOR_VLAN_ENABLED BIT(1)
  119. u32 rsvd[116]; /* 0x32C */
  120. };
  121. struct nvm_iscsi_target {
  122. u32 ctrl_flags; /* 0x0 */
  123. #define NVM_ISCSI_CFG_TARGET_ENABLED BIT(0)
  124. #define NVM_ISCSI_CFG_BOOT_TIME_LOGIN_STATUS BIT(1)
  125. u32 generic_cont0; /* 0x4 */
  126. #define NVM_ISCSI_CFG_TARGET_TCP_PORT_MASK 0x0000FFFF
  127. #define NVM_ISCSI_CFG_TARGET_TCP_PORT_OFFSET 0
  128. u32 ip_ver;
  129. #define NVM_ISCSI_CFG_IPv4 4
  130. #define NVM_ISCSI_CFG_IPv6 6
  131. u32 rsvd_1[7]; /* 0x24 */
  132. union nvm_iscsi_ipv4_addr ipv4_addr; /* 0x28 */
  133. union nvm_iscsi_ipv6_addr ipv6_addr; /* 0x2C */
  134. union nvm_iscsi_lun lun; /* 0x3C */
  135. union nvm_iscsi_name target_name; /* 0x44 */
  136. union nvm_iscsi_chap_name chap_name; /* 0x144 */
  137. union nvm_iscsi_chap_password chap_password; /* 0x244 */
  138. u32 rsvd_2[107]; /* 0x2C4 */
  139. };
  140. struct nvm_iscsi_block {
  141. u32 id; /* 0x0 */
  142. #define NVM_ISCSI_CFG_BLK_MAPPED_PF_ID_MASK 0x0000000F
  143. #define NVM_ISCSI_CFG_BLK_MAPPED_PF_ID_OFFSET 0
  144. #define NVM_ISCSI_CFG_BLK_CTRL_FLAG_MASK 0x00000FF0
  145. #define NVM_ISCSI_CFG_BLK_CTRL_FLAG_OFFSET 4
  146. #define NVM_ISCSI_CFG_BLK_CTRL_FLAG_IS_NOT_EMPTY BIT(0)
  147. #define NVM_ISCSI_CFG_BLK_CTRL_FLAG_PF_MAPPED BIT(1)
  148. u32 rsvd_1[5]; /* 0x4 */
  149. struct nvm_iscsi_generic generic; /* 0x18 */
  150. struct nvm_iscsi_initiator initiator; /* 0x218 */
  151. struct nvm_iscsi_target target[NUM_OF_ISCSI_TARGET_PER_PF];
  152. /* 0x718 */
  153. u32 rsvd_2[58]; /* 0x1718 */
  154. /* total size - 0x1800 - 6K block */
  155. };
  156. struct nvm_iscsi_cfg {
  157. u32 id; /* 0x0 */
  158. #define NVM_ISCSI_CFG_BLK_VERSION_MINOR_MASK 0x000000FF
  159. #define NVM_ISCSI_CFG_BLK_VERSION_MAJOR_MASK 0x0000FF00
  160. #define NVM_ISCSI_CFG_BLK_SIGNATURE_MASK 0xFFFF0000
  161. #define NVM_ISCSI_CFG_BLK_SIGNATURE 0x49430000 /* IC - Iscsi
  162. * Config
  163. */
  164. #define NVM_ISCSI_CFG_BLK_VERSION_MAJOR 0
  165. #define NVM_ISCSI_CFG_BLK_VERSION_MINOR 10
  166. #define NVM_ISCSI_CFG_BLK_VERSION ((NVM_ISCSI_CFG_BLK_VERSION_MAJOR << 8) | \
  167. NVM_ISCSI_CFG_BLK_VERSION_MINOR)
  168. struct nvm_iscsi_block block[NUM_OF_ISCSI_PF_SUPPORTED]; /* 0x4 */
  169. };
  170. #endif