mlx5_ifc_fpga.h 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. /*
  2. * Copyright (c) 2017, Mellanox Technologies, Ltd. All rights reserved.
  3. *
  4. * This software is available to you under a choice of one of two
  5. * licenses. You may choose to be licensed under the terms of the GNU
  6. * General Public License (GPL) Version 2, available from the file
  7. * COPYING in the main directory of this source tree, or the
  8. * OpenIB.org BSD license below:
  9. *
  10. * Redistribution and use in source and binary forms, with or
  11. * without modification, are permitted provided that the following
  12. * conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above
  15. * copyright notice, this list of conditions and the following
  16. * disclaimer.
  17. *
  18. * - Redistributions in binary form must reproduce the above
  19. * copyright notice, this list of conditions and the following
  20. * disclaimer in the documentation and/or other materials
  21. * provided with the distribution.
  22. *
  23. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  24. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  27. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  28. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  29. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  30. * SOFTWARE.
  31. */
  32. #ifndef MLX5_IFC_FPGA_H
  33. #define MLX5_IFC_FPGA_H
  34. enum {
  35. MLX5_FPGA_CAP_SANDBOX_VENDOR_ID_MLNX = 0x2c9,
  36. };
  37. enum {
  38. MLX5_FPGA_CAP_SANDBOX_PRODUCT_ID_IPSEC = 0x2,
  39. };
  40. struct mlx5_ifc_fpga_shell_caps_bits {
  41. u8 max_num_qps[0x10];
  42. u8 reserved_at_10[0x8];
  43. u8 total_rcv_credits[0x8];
  44. u8 reserved_at_20[0xe];
  45. u8 qp_type[0x2];
  46. u8 reserved_at_30[0x5];
  47. u8 rae[0x1];
  48. u8 rwe[0x1];
  49. u8 rre[0x1];
  50. u8 reserved_at_38[0x4];
  51. u8 dc[0x1];
  52. u8 ud[0x1];
  53. u8 uc[0x1];
  54. u8 rc[0x1];
  55. u8 reserved_at_40[0x1a];
  56. u8 log_ddr_size[0x6];
  57. u8 max_fpga_qp_msg_size[0x20];
  58. u8 reserved_at_80[0x180];
  59. };
  60. struct mlx5_ifc_fpga_cap_bits {
  61. u8 fpga_id[0x8];
  62. u8 fpga_device[0x18];
  63. u8 register_file_ver[0x20];
  64. u8 fpga_ctrl_modify[0x1];
  65. u8 reserved_at_41[0x5];
  66. u8 access_reg_query_mode[0x2];
  67. u8 reserved_at_48[0x6];
  68. u8 access_reg_modify_mode[0x2];
  69. u8 reserved_at_50[0x10];
  70. u8 reserved_at_60[0x20];
  71. u8 image_version[0x20];
  72. u8 image_date[0x20];
  73. u8 image_time[0x20];
  74. u8 shell_version[0x20];
  75. u8 reserved_at_100[0x80];
  76. struct mlx5_ifc_fpga_shell_caps_bits shell_caps;
  77. u8 reserved_at_380[0x8];
  78. u8 ieee_vendor_id[0x18];
  79. u8 sandbox_product_version[0x10];
  80. u8 sandbox_product_id[0x10];
  81. u8 sandbox_basic_caps[0x20];
  82. u8 reserved_at_3e0[0x10];
  83. u8 sandbox_extended_caps_len[0x10];
  84. u8 sandbox_extended_caps_addr[0x40];
  85. u8 fpga_ddr_start_addr[0x40];
  86. u8 fpga_cr_space_start_addr[0x40];
  87. u8 fpga_ddr_size[0x20];
  88. u8 fpga_cr_space_size[0x20];
  89. u8 reserved_at_500[0x300];
  90. };
  91. enum {
  92. MLX5_FPGA_CTRL_OPERATION_LOAD = 0x1,
  93. MLX5_FPGA_CTRL_OPERATION_RESET = 0x2,
  94. MLX5_FPGA_CTRL_OPERATION_FLASH_SELECT = 0x3,
  95. MLX5_FPGA_CTRL_OPERATION_SANDBOX_BYPASS_ON = 0x4,
  96. MLX5_FPGA_CTRL_OPERATION_SANDBOX_BYPASS_OFF = 0x5,
  97. MLX5_FPGA_CTRL_OPERATION_RESET_SANDBOX = 0x6,
  98. };
  99. struct mlx5_ifc_fpga_ctrl_bits {
  100. u8 reserved_at_0[0x8];
  101. u8 operation[0x8];
  102. u8 reserved_at_10[0x8];
  103. u8 status[0x8];
  104. u8 reserved_at_20[0x8];
  105. u8 flash_select_admin[0x8];
  106. u8 reserved_at_30[0x8];
  107. u8 flash_select_oper[0x8];
  108. u8 reserved_at_40[0x40];
  109. };
  110. enum {
  111. MLX5_FPGA_ERROR_EVENT_SYNDROME_CORRUPTED_DDR = 0x1,
  112. MLX5_FPGA_ERROR_EVENT_SYNDROME_FLASH_TIMEOUT = 0x2,
  113. MLX5_FPGA_ERROR_EVENT_SYNDROME_INTERNAL_LINK_ERROR = 0x3,
  114. MLX5_FPGA_ERROR_EVENT_SYNDROME_WATCHDOG_FAILURE = 0x4,
  115. MLX5_FPGA_ERROR_EVENT_SYNDROME_I2C_FAILURE = 0x5,
  116. MLX5_FPGA_ERROR_EVENT_SYNDROME_IMAGE_CHANGED = 0x6,
  117. MLX5_FPGA_ERROR_EVENT_SYNDROME_TEMPERATURE_CRITICAL = 0x7,
  118. };
  119. struct mlx5_ifc_fpga_error_event_bits {
  120. u8 reserved_at_0[0x40];
  121. u8 reserved_at_40[0x18];
  122. u8 syndrome[0x8];
  123. u8 reserved_at_60[0x80];
  124. };
  125. #define MLX5_FPGA_ACCESS_REG_SIZE_MAX 64
  126. struct mlx5_ifc_fpga_access_reg_bits {
  127. u8 reserved_at_0[0x20];
  128. u8 reserved_at_20[0x10];
  129. u8 size[0x10];
  130. u8 address[0x40];
  131. u8 data[0][0x8];
  132. };
  133. enum mlx5_ifc_fpga_qp_state {
  134. MLX5_FPGA_QPC_STATE_INIT = 0x0,
  135. MLX5_FPGA_QPC_STATE_ACTIVE = 0x1,
  136. MLX5_FPGA_QPC_STATE_ERROR = 0x2,
  137. };
  138. enum mlx5_ifc_fpga_qp_type {
  139. MLX5_FPGA_QPC_QP_TYPE_SHELL_QP = 0x0,
  140. MLX5_FPGA_QPC_QP_TYPE_SANDBOX_QP = 0x1,
  141. };
  142. enum mlx5_ifc_fpga_qp_service_type {
  143. MLX5_FPGA_QPC_ST_RC = 0x0,
  144. };
  145. struct mlx5_ifc_fpga_qpc_bits {
  146. u8 state[0x4];
  147. u8 reserved_at_4[0x1b];
  148. u8 qp_type[0x1];
  149. u8 reserved_at_20[0x4];
  150. u8 st[0x4];
  151. u8 reserved_at_28[0x10];
  152. u8 traffic_class[0x8];
  153. u8 ether_type[0x10];
  154. u8 prio[0x3];
  155. u8 dei[0x1];
  156. u8 vid[0xc];
  157. u8 reserved_at_60[0x20];
  158. u8 reserved_at_80[0x8];
  159. u8 next_rcv_psn[0x18];
  160. u8 reserved_at_a0[0x8];
  161. u8 next_send_psn[0x18];
  162. u8 reserved_at_c0[0x10];
  163. u8 pkey[0x10];
  164. u8 reserved_at_e0[0x8];
  165. u8 remote_qpn[0x18];
  166. u8 reserved_at_100[0x15];
  167. u8 rnr_retry[0x3];
  168. u8 reserved_at_118[0x5];
  169. u8 retry_count[0x3];
  170. u8 reserved_at_120[0x20];
  171. u8 reserved_at_140[0x10];
  172. u8 remote_mac_47_32[0x10];
  173. u8 remote_mac_31_0[0x20];
  174. u8 remote_ip[16][0x8];
  175. u8 reserved_at_200[0x40];
  176. u8 reserved_at_240[0x10];
  177. u8 fpga_mac_47_32[0x10];
  178. u8 fpga_mac_31_0[0x20];
  179. u8 fpga_ip[16][0x8];
  180. };
  181. struct mlx5_ifc_fpga_create_qp_in_bits {
  182. u8 opcode[0x10];
  183. u8 reserved_at_10[0x10];
  184. u8 reserved_at_20[0x10];
  185. u8 op_mod[0x10];
  186. u8 reserved_at_40[0x40];
  187. struct mlx5_ifc_fpga_qpc_bits fpga_qpc;
  188. };
  189. struct mlx5_ifc_fpga_create_qp_out_bits {
  190. u8 status[0x8];
  191. u8 reserved_at_8[0x18];
  192. u8 syndrome[0x20];
  193. u8 reserved_at_40[0x8];
  194. u8 fpga_qpn[0x18];
  195. u8 reserved_at_60[0x20];
  196. struct mlx5_ifc_fpga_qpc_bits fpga_qpc;
  197. };
  198. struct mlx5_ifc_fpga_modify_qp_in_bits {
  199. u8 opcode[0x10];
  200. u8 reserved_at_10[0x10];
  201. u8 reserved_at_20[0x10];
  202. u8 op_mod[0x10];
  203. u8 reserved_at_40[0x8];
  204. u8 fpga_qpn[0x18];
  205. u8 field_select[0x20];
  206. struct mlx5_ifc_fpga_qpc_bits fpga_qpc;
  207. };
  208. struct mlx5_ifc_fpga_modify_qp_out_bits {
  209. u8 status[0x8];
  210. u8 reserved_at_8[0x18];
  211. u8 syndrome[0x20];
  212. u8 reserved_at_40[0x40];
  213. };
  214. struct mlx5_ifc_fpga_query_qp_in_bits {
  215. u8 opcode[0x10];
  216. u8 reserved_at_10[0x10];
  217. u8 reserved_at_20[0x10];
  218. u8 op_mod[0x10];
  219. u8 reserved_at_40[0x8];
  220. u8 fpga_qpn[0x18];
  221. u8 reserved_at_60[0x20];
  222. };
  223. struct mlx5_ifc_fpga_query_qp_out_bits {
  224. u8 status[0x8];
  225. u8 reserved_at_8[0x18];
  226. u8 syndrome[0x20];
  227. u8 reserved_at_40[0x40];
  228. struct mlx5_ifc_fpga_qpc_bits fpga_qpc;
  229. };
  230. struct mlx5_ifc_fpga_query_qp_counters_in_bits {
  231. u8 opcode[0x10];
  232. u8 reserved_at_10[0x10];
  233. u8 reserved_at_20[0x10];
  234. u8 op_mod[0x10];
  235. u8 clear[0x1];
  236. u8 reserved_at_41[0x7];
  237. u8 fpga_qpn[0x18];
  238. u8 reserved_at_60[0x20];
  239. };
  240. struct mlx5_ifc_fpga_query_qp_counters_out_bits {
  241. u8 status[0x8];
  242. u8 reserved_at_8[0x18];
  243. u8 syndrome[0x20];
  244. u8 reserved_at_40[0x40];
  245. u8 rx_ack_packets[0x40];
  246. u8 rx_send_packets[0x40];
  247. u8 tx_ack_packets[0x40];
  248. u8 tx_send_packets[0x40];
  249. u8 rx_total_drop[0x40];
  250. u8 reserved_at_1c0[0x1c0];
  251. };
  252. struct mlx5_ifc_fpga_destroy_qp_in_bits {
  253. u8 opcode[0x10];
  254. u8 reserved_at_10[0x10];
  255. u8 reserved_at_20[0x10];
  256. u8 op_mod[0x10];
  257. u8 reserved_at_40[0x8];
  258. u8 fpga_qpn[0x18];
  259. u8 reserved_at_60[0x20];
  260. };
  261. struct mlx5_ifc_fpga_destroy_qp_out_bits {
  262. u8 status[0x8];
  263. u8 reserved_at_8[0x18];
  264. u8 syndrome[0x20];
  265. u8 reserved_at_40[0x40];
  266. };
  267. struct mlx5_ifc_ipsec_extended_cap_bits {
  268. u8 encapsulation[0x20];
  269. u8 reserved_0[0x15];
  270. u8 ipv4_fragment[0x1];
  271. u8 ipv6[0x1];
  272. u8 esn[0x1];
  273. u8 lso[0x1];
  274. u8 transport_and_tunnel_mode[0x1];
  275. u8 tunnel_mode[0x1];
  276. u8 transport_mode[0x1];
  277. u8 ah_esp[0x1];
  278. u8 esp[0x1];
  279. u8 ah[0x1];
  280. u8 ipv4_options[0x1];
  281. u8 auth_alg[0x20];
  282. u8 enc_alg[0x20];
  283. u8 sa_cap[0x20];
  284. u8 reserved_1[0x10];
  285. u8 number_of_ipsec_counters[0x10];
  286. u8 ipsec_counters_addr_low[0x20];
  287. u8 ipsec_counters_addr_high[0x20];
  288. };
  289. struct mlx5_ifc_ipsec_counters_bits {
  290. u8 dec_in_packets[0x40];
  291. u8 dec_out_packets[0x40];
  292. u8 dec_bypass_packets[0x40];
  293. u8 enc_in_packets[0x40];
  294. u8 enc_out_packets[0x40];
  295. u8 enc_bypass_packets[0x40];
  296. u8 drop_dec_packets[0x40];
  297. u8 failed_auth_dec_packets[0x40];
  298. u8 drop_enc_packets[0x40];
  299. u8 success_add_sa[0x40];
  300. u8 fail_add_sa[0x40];
  301. u8 success_delete_sa[0x40];
  302. u8 fail_delete_sa[0x40];
  303. u8 dropped_cmd[0x40];
  304. };
  305. #endif /* MLX5_IFC_FPGA_H */