device.h 25 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202
  1. /*
  2. * Copyright (c) 2013-2015, Mellanox Technologies. 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_DEVICE_H
  33. #define MLX5_DEVICE_H
  34. #include <linux/types.h>
  35. #include <rdma/ib_verbs.h>
  36. #include <linux/mlx5/mlx5_ifc.h>
  37. #if defined(__LITTLE_ENDIAN)
  38. #define MLX5_SET_HOST_ENDIANNESS 0
  39. #elif defined(__BIG_ENDIAN)
  40. #define MLX5_SET_HOST_ENDIANNESS 0x80
  41. #else
  42. #error Host endianness not defined
  43. #endif
  44. /* helper macros */
  45. #define __mlx5_nullp(typ) ((struct mlx5_ifc_##typ##_bits *)0)
  46. #define __mlx5_bit_sz(typ, fld) sizeof(__mlx5_nullp(typ)->fld)
  47. #define __mlx5_bit_off(typ, fld) ((unsigned)(unsigned long)(&(__mlx5_nullp(typ)->fld)))
  48. #define __mlx5_dw_off(typ, fld) (__mlx5_bit_off(typ, fld) / 32)
  49. #define __mlx5_64_off(typ, fld) (__mlx5_bit_off(typ, fld) / 64)
  50. #define __mlx5_dw_bit_off(typ, fld) (32 - __mlx5_bit_sz(typ, fld) - (__mlx5_bit_off(typ, fld) & 0x1f))
  51. #define __mlx5_mask(typ, fld) ((u32)((1ull << __mlx5_bit_sz(typ, fld)) - 1))
  52. #define __mlx5_dw_mask(typ, fld) (__mlx5_mask(typ, fld) << __mlx5_dw_bit_off(typ, fld))
  53. #define __mlx5_st_sz_bits(typ) sizeof(struct mlx5_ifc_##typ##_bits)
  54. #define MLX5_FLD_SZ_BYTES(typ, fld) (__mlx5_bit_sz(typ, fld) / 8)
  55. #define MLX5_ST_SZ_BYTES(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 8)
  56. #define MLX5_ST_SZ_DW(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 32)
  57. #define MLX5_UN_SZ_BYTES(typ) (sizeof(union mlx5_ifc_##typ##_bits) / 8)
  58. #define MLX5_UN_SZ_DW(typ) (sizeof(union mlx5_ifc_##typ##_bits) / 32)
  59. #define MLX5_BYTE_OFF(typ, fld) (__mlx5_bit_off(typ, fld) / 8)
  60. #define MLX5_ADDR_OF(typ, p, fld) ((char *)(p) + MLX5_BYTE_OFF(typ, fld))
  61. /* insert a value to a struct */
  62. #define MLX5_SET(typ, p, fld, v) do { \
  63. BUILD_BUG_ON(__mlx5_st_sz_bits(typ) % 32); \
  64. *((__be32 *)(p) + __mlx5_dw_off(typ, fld)) = \
  65. cpu_to_be32((be32_to_cpu(*((__be32 *)(p) + __mlx5_dw_off(typ, fld))) & \
  66. (~__mlx5_dw_mask(typ, fld))) | (((v) & __mlx5_mask(typ, fld)) \
  67. << __mlx5_dw_bit_off(typ, fld))); \
  68. } while (0)
  69. #define MLX5_SET_TO_ONES(typ, p, fld) do { \
  70. BUILD_BUG_ON(__mlx5_st_sz_bits(typ) % 32); \
  71. *((__be32 *)(p) + __mlx5_dw_off(typ, fld)) = \
  72. cpu_to_be32((be32_to_cpu(*((__be32 *)(p) + __mlx5_dw_off(typ, fld))) & \
  73. (~__mlx5_dw_mask(typ, fld))) | ((__mlx5_mask(typ, fld)) \
  74. << __mlx5_dw_bit_off(typ, fld))); \
  75. } while (0)
  76. #define MLX5_GET(typ, p, fld) ((be32_to_cpu(*((__be32 *)(p) +\
  77. __mlx5_dw_off(typ, fld))) >> __mlx5_dw_bit_off(typ, fld)) & \
  78. __mlx5_mask(typ, fld))
  79. #define MLX5_GET_PR(typ, p, fld) ({ \
  80. u32 ___t = MLX5_GET(typ, p, fld); \
  81. pr_debug(#fld " = 0x%x\n", ___t); \
  82. ___t; \
  83. })
  84. #define MLX5_SET64(typ, p, fld, v) do { \
  85. BUILD_BUG_ON(__mlx5_bit_sz(typ, fld) != 64); \
  86. BUILD_BUG_ON(__mlx5_bit_off(typ, fld) % 64); \
  87. *((__be64 *)(p) + __mlx5_64_off(typ, fld)) = cpu_to_be64(v); \
  88. } while (0)
  89. #define MLX5_GET64(typ, p, fld) be64_to_cpu(*((__be64 *)(p) + __mlx5_64_off(typ, fld)))
  90. #define MLX5_GET64_PR(typ, p, fld) ({ \
  91. u64 ___t = MLX5_GET64(typ, p, fld); \
  92. pr_debug(#fld " = 0x%llx\n", ___t); \
  93. ___t; \
  94. })
  95. enum {
  96. MLX5_MAX_COMMANDS = 32,
  97. MLX5_CMD_DATA_BLOCK_SIZE = 512,
  98. MLX5_PCI_CMD_XPORT = 7,
  99. MLX5_MKEY_BSF_OCTO_SIZE = 4,
  100. MLX5_MAX_PSVS = 4,
  101. };
  102. enum {
  103. MLX5_EXTENDED_UD_AV = 0x80000000,
  104. };
  105. enum {
  106. MLX5_CQ_STATE_ARMED = 9,
  107. MLX5_CQ_STATE_ALWAYS_ARMED = 0xb,
  108. MLX5_CQ_STATE_FIRED = 0xa,
  109. };
  110. enum {
  111. MLX5_STAT_RATE_OFFSET = 5,
  112. };
  113. enum {
  114. MLX5_INLINE_SEG = 0x80000000,
  115. };
  116. enum {
  117. MLX5_HW_START_PADDING = MLX5_INLINE_SEG,
  118. };
  119. enum {
  120. MLX5_MIN_PKEY_TABLE_SIZE = 128,
  121. MLX5_MAX_LOG_PKEY_TABLE = 5,
  122. };
  123. enum {
  124. MLX5_MKEY_INBOX_PG_ACCESS = 1 << 31
  125. };
  126. enum {
  127. MLX5_PFAULT_SUBTYPE_WQE = 0,
  128. MLX5_PFAULT_SUBTYPE_RDMA = 1,
  129. };
  130. enum {
  131. MLX5_PERM_LOCAL_READ = 1 << 2,
  132. MLX5_PERM_LOCAL_WRITE = 1 << 3,
  133. MLX5_PERM_REMOTE_READ = 1 << 4,
  134. MLX5_PERM_REMOTE_WRITE = 1 << 5,
  135. MLX5_PERM_ATOMIC = 1 << 6,
  136. MLX5_PERM_UMR_EN = 1 << 7,
  137. };
  138. enum {
  139. MLX5_PCIE_CTRL_SMALL_FENCE = 1 << 0,
  140. MLX5_PCIE_CTRL_RELAXED_ORDERING = 1 << 2,
  141. MLX5_PCIE_CTRL_NO_SNOOP = 1 << 3,
  142. MLX5_PCIE_CTRL_TLP_PROCE_EN = 1 << 6,
  143. MLX5_PCIE_CTRL_TPH_MASK = 3 << 4,
  144. };
  145. enum {
  146. MLX5_ACCESS_MODE_PA = 0,
  147. MLX5_ACCESS_MODE_MTT = 1,
  148. MLX5_ACCESS_MODE_KLM = 2
  149. };
  150. enum {
  151. MLX5_MKEY_REMOTE_INVAL = 1 << 24,
  152. MLX5_MKEY_FLAG_SYNC_UMR = 1 << 29,
  153. MLX5_MKEY_BSF_EN = 1 << 30,
  154. MLX5_MKEY_LEN64 = 1 << 31,
  155. };
  156. enum {
  157. MLX5_EN_RD = (u64)1,
  158. MLX5_EN_WR = (u64)2
  159. };
  160. enum {
  161. MLX5_BF_REGS_PER_PAGE = 4,
  162. MLX5_MAX_UAR_PAGES = 1 << 8,
  163. MLX5_NON_FP_BF_REGS_PER_PAGE = 2,
  164. MLX5_MAX_UUARS = MLX5_MAX_UAR_PAGES * MLX5_NON_FP_BF_REGS_PER_PAGE,
  165. };
  166. enum {
  167. MLX5_MKEY_MASK_LEN = 1ull << 0,
  168. MLX5_MKEY_MASK_PAGE_SIZE = 1ull << 1,
  169. MLX5_MKEY_MASK_START_ADDR = 1ull << 6,
  170. MLX5_MKEY_MASK_PD = 1ull << 7,
  171. MLX5_MKEY_MASK_EN_RINVAL = 1ull << 8,
  172. MLX5_MKEY_MASK_EN_SIGERR = 1ull << 9,
  173. MLX5_MKEY_MASK_BSF_EN = 1ull << 12,
  174. MLX5_MKEY_MASK_KEY = 1ull << 13,
  175. MLX5_MKEY_MASK_QPN = 1ull << 14,
  176. MLX5_MKEY_MASK_LR = 1ull << 17,
  177. MLX5_MKEY_MASK_LW = 1ull << 18,
  178. MLX5_MKEY_MASK_RR = 1ull << 19,
  179. MLX5_MKEY_MASK_RW = 1ull << 20,
  180. MLX5_MKEY_MASK_A = 1ull << 21,
  181. MLX5_MKEY_MASK_SMALL_FENCE = 1ull << 23,
  182. MLX5_MKEY_MASK_FREE = 1ull << 29,
  183. };
  184. enum {
  185. MLX5_UMR_TRANSLATION_OFFSET_EN = (1 << 4),
  186. MLX5_UMR_CHECK_NOT_FREE = (1 << 5),
  187. MLX5_UMR_CHECK_FREE = (2 << 5),
  188. MLX5_UMR_INLINE = (1 << 7),
  189. };
  190. #define MLX5_UMR_MTT_ALIGNMENT 0x40
  191. #define MLX5_UMR_MTT_MASK (MLX5_UMR_MTT_ALIGNMENT - 1)
  192. #define MLX5_UMR_MTT_MIN_CHUNK_SIZE MLX5_UMR_MTT_ALIGNMENT
  193. enum mlx5_event {
  194. MLX5_EVENT_TYPE_COMP = 0x0,
  195. MLX5_EVENT_TYPE_PATH_MIG = 0x01,
  196. MLX5_EVENT_TYPE_COMM_EST = 0x02,
  197. MLX5_EVENT_TYPE_SQ_DRAINED = 0x03,
  198. MLX5_EVENT_TYPE_SRQ_LAST_WQE = 0x13,
  199. MLX5_EVENT_TYPE_SRQ_RQ_LIMIT = 0x14,
  200. MLX5_EVENT_TYPE_CQ_ERROR = 0x04,
  201. MLX5_EVENT_TYPE_WQ_CATAS_ERROR = 0x05,
  202. MLX5_EVENT_TYPE_PATH_MIG_FAILED = 0x07,
  203. MLX5_EVENT_TYPE_WQ_INVAL_REQ_ERROR = 0x10,
  204. MLX5_EVENT_TYPE_WQ_ACCESS_ERROR = 0x11,
  205. MLX5_EVENT_TYPE_SRQ_CATAS_ERROR = 0x12,
  206. MLX5_EVENT_TYPE_INTERNAL_ERROR = 0x08,
  207. MLX5_EVENT_TYPE_PORT_CHANGE = 0x09,
  208. MLX5_EVENT_TYPE_GPIO_EVENT = 0x15,
  209. MLX5_EVENT_TYPE_REMOTE_CONFIG = 0x19,
  210. MLX5_EVENT_TYPE_DB_BF_CONGESTION = 0x1a,
  211. MLX5_EVENT_TYPE_STALL_EVENT = 0x1b,
  212. MLX5_EVENT_TYPE_CMD = 0x0a,
  213. MLX5_EVENT_TYPE_PAGE_REQUEST = 0xb,
  214. MLX5_EVENT_TYPE_PAGE_FAULT = 0xc,
  215. };
  216. enum {
  217. MLX5_PORT_CHANGE_SUBTYPE_DOWN = 1,
  218. MLX5_PORT_CHANGE_SUBTYPE_ACTIVE = 4,
  219. MLX5_PORT_CHANGE_SUBTYPE_INITIALIZED = 5,
  220. MLX5_PORT_CHANGE_SUBTYPE_LID = 6,
  221. MLX5_PORT_CHANGE_SUBTYPE_PKEY = 7,
  222. MLX5_PORT_CHANGE_SUBTYPE_GUID = 8,
  223. MLX5_PORT_CHANGE_SUBTYPE_CLIENT_REREG = 9,
  224. };
  225. enum {
  226. MLX5_DEV_CAP_FLAG_XRC = 1LL << 3,
  227. MLX5_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1LL << 8,
  228. MLX5_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1LL << 9,
  229. MLX5_DEV_CAP_FLAG_APM = 1LL << 17,
  230. MLX5_DEV_CAP_FLAG_ATOMIC = 1LL << 18,
  231. MLX5_DEV_CAP_FLAG_BLOCK_MCAST = 1LL << 23,
  232. MLX5_DEV_CAP_FLAG_ON_DMND_PG = 1LL << 24,
  233. MLX5_DEV_CAP_FLAG_CQ_MODER = 1LL << 29,
  234. MLX5_DEV_CAP_FLAG_RESIZE_CQ = 1LL << 30,
  235. MLX5_DEV_CAP_FLAG_DCT = 1LL << 37,
  236. MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40,
  237. MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 3LL << 46,
  238. };
  239. enum {
  240. MLX5_OPCODE_NOP = 0x00,
  241. MLX5_OPCODE_SEND_INVAL = 0x01,
  242. MLX5_OPCODE_RDMA_WRITE = 0x08,
  243. MLX5_OPCODE_RDMA_WRITE_IMM = 0x09,
  244. MLX5_OPCODE_SEND = 0x0a,
  245. MLX5_OPCODE_SEND_IMM = 0x0b,
  246. MLX5_OPCODE_LSO = 0x0e,
  247. MLX5_OPCODE_RDMA_READ = 0x10,
  248. MLX5_OPCODE_ATOMIC_CS = 0x11,
  249. MLX5_OPCODE_ATOMIC_FA = 0x12,
  250. MLX5_OPCODE_ATOMIC_MASKED_CS = 0x14,
  251. MLX5_OPCODE_ATOMIC_MASKED_FA = 0x15,
  252. MLX5_OPCODE_BIND_MW = 0x18,
  253. MLX5_OPCODE_CONFIG_CMD = 0x1f,
  254. MLX5_RECV_OPCODE_RDMA_WRITE_IMM = 0x00,
  255. MLX5_RECV_OPCODE_SEND = 0x01,
  256. MLX5_RECV_OPCODE_SEND_IMM = 0x02,
  257. MLX5_RECV_OPCODE_SEND_INVAL = 0x03,
  258. MLX5_CQE_OPCODE_ERROR = 0x1e,
  259. MLX5_CQE_OPCODE_RESIZE = 0x16,
  260. MLX5_OPCODE_SET_PSV = 0x20,
  261. MLX5_OPCODE_GET_PSV = 0x21,
  262. MLX5_OPCODE_CHECK_PSV = 0x22,
  263. MLX5_OPCODE_RGET_PSV = 0x26,
  264. MLX5_OPCODE_RCHECK_PSV = 0x27,
  265. MLX5_OPCODE_UMR = 0x25,
  266. };
  267. enum {
  268. MLX5_SET_PORT_RESET_QKEY = 0,
  269. MLX5_SET_PORT_GUID0 = 16,
  270. MLX5_SET_PORT_NODE_GUID = 17,
  271. MLX5_SET_PORT_SYS_GUID = 18,
  272. MLX5_SET_PORT_GID_TABLE = 19,
  273. MLX5_SET_PORT_PKEY_TABLE = 20,
  274. };
  275. enum {
  276. MLX5_MAX_PAGE_SHIFT = 31
  277. };
  278. enum {
  279. MLX5_ADAPTER_PAGE_SHIFT = 12,
  280. MLX5_ADAPTER_PAGE_SIZE = 1 << MLX5_ADAPTER_PAGE_SHIFT,
  281. };
  282. enum {
  283. MLX5_CAP_OFF_CMDIF_CSUM = 46,
  284. };
  285. struct mlx5_inbox_hdr {
  286. __be16 opcode;
  287. u8 rsvd[4];
  288. __be16 opmod;
  289. };
  290. struct mlx5_outbox_hdr {
  291. u8 status;
  292. u8 rsvd[3];
  293. __be32 syndrome;
  294. };
  295. struct mlx5_cmd_query_adapter_mbox_in {
  296. struct mlx5_inbox_hdr hdr;
  297. u8 rsvd[8];
  298. };
  299. struct mlx5_cmd_query_adapter_mbox_out {
  300. struct mlx5_outbox_hdr hdr;
  301. u8 rsvd0[24];
  302. u8 intapin;
  303. u8 rsvd1[13];
  304. __be16 vsd_vendor_id;
  305. u8 vsd[208];
  306. u8 vsd_psid[16];
  307. };
  308. enum mlx5_odp_transport_cap_bits {
  309. MLX5_ODP_SUPPORT_SEND = 1 << 31,
  310. MLX5_ODP_SUPPORT_RECV = 1 << 30,
  311. MLX5_ODP_SUPPORT_WRITE = 1 << 29,
  312. MLX5_ODP_SUPPORT_READ = 1 << 28,
  313. };
  314. struct mlx5_odp_caps {
  315. char reserved[0x10];
  316. struct {
  317. __be32 rc_odp_caps;
  318. __be32 uc_odp_caps;
  319. __be32 ud_odp_caps;
  320. } per_transport_caps;
  321. char reserved2[0xe4];
  322. };
  323. struct mlx5_cmd_init_hca_mbox_in {
  324. struct mlx5_inbox_hdr hdr;
  325. u8 rsvd0[2];
  326. __be16 profile;
  327. u8 rsvd1[4];
  328. };
  329. struct mlx5_cmd_init_hca_mbox_out {
  330. struct mlx5_outbox_hdr hdr;
  331. u8 rsvd[8];
  332. };
  333. struct mlx5_cmd_teardown_hca_mbox_in {
  334. struct mlx5_inbox_hdr hdr;
  335. u8 rsvd0[2];
  336. __be16 profile;
  337. u8 rsvd1[4];
  338. };
  339. struct mlx5_cmd_teardown_hca_mbox_out {
  340. struct mlx5_outbox_hdr hdr;
  341. u8 rsvd[8];
  342. };
  343. struct mlx5_cmd_layout {
  344. u8 type;
  345. u8 rsvd0[3];
  346. __be32 inlen;
  347. __be64 in_ptr;
  348. __be32 in[4];
  349. __be32 out[4];
  350. __be64 out_ptr;
  351. __be32 outlen;
  352. u8 token;
  353. u8 sig;
  354. u8 rsvd1;
  355. u8 status_own;
  356. };
  357. struct health_buffer {
  358. __be32 assert_var[5];
  359. __be32 rsvd0[3];
  360. __be32 assert_exit_ptr;
  361. __be32 assert_callra;
  362. __be32 rsvd1[2];
  363. __be32 fw_ver;
  364. __be32 hw_id;
  365. __be32 rsvd2;
  366. u8 irisc_index;
  367. u8 synd;
  368. __be16 ext_sync;
  369. };
  370. struct mlx5_init_seg {
  371. __be32 fw_rev;
  372. __be32 cmdif_rev_fw_sub;
  373. __be32 rsvd0[2];
  374. __be32 cmdq_addr_h;
  375. __be32 cmdq_addr_l_sz;
  376. __be32 cmd_dbell;
  377. __be32 rsvd1[121];
  378. struct health_buffer health;
  379. __be32 rsvd2[884];
  380. __be32 health_counter;
  381. __be32 rsvd3[1019];
  382. __be64 ieee1588_clk;
  383. __be32 ieee1588_clk_type;
  384. __be32 clr_intx;
  385. };
  386. struct mlx5_eqe_comp {
  387. __be32 reserved[6];
  388. __be32 cqn;
  389. };
  390. struct mlx5_eqe_qp_srq {
  391. __be32 reserved[6];
  392. __be32 qp_srq_n;
  393. };
  394. struct mlx5_eqe_cq_err {
  395. __be32 cqn;
  396. u8 reserved1[7];
  397. u8 syndrome;
  398. };
  399. struct mlx5_eqe_port_state {
  400. u8 reserved0[8];
  401. u8 port;
  402. };
  403. struct mlx5_eqe_gpio {
  404. __be32 reserved0[2];
  405. __be64 gpio_event;
  406. };
  407. struct mlx5_eqe_congestion {
  408. u8 type;
  409. u8 rsvd0;
  410. u8 congestion_level;
  411. };
  412. struct mlx5_eqe_stall_vl {
  413. u8 rsvd0[3];
  414. u8 port_vl;
  415. };
  416. struct mlx5_eqe_cmd {
  417. __be32 vector;
  418. __be32 rsvd[6];
  419. };
  420. struct mlx5_eqe_page_req {
  421. u8 rsvd0[2];
  422. __be16 func_id;
  423. __be32 num_pages;
  424. __be32 rsvd1[5];
  425. };
  426. struct mlx5_eqe_page_fault {
  427. __be32 bytes_committed;
  428. union {
  429. struct {
  430. u16 reserved1;
  431. __be16 wqe_index;
  432. u16 reserved2;
  433. __be16 packet_length;
  434. u8 reserved3[12];
  435. } __packed wqe;
  436. struct {
  437. __be32 r_key;
  438. u16 reserved1;
  439. __be16 packet_length;
  440. __be32 rdma_op_len;
  441. __be64 rdma_va;
  442. } __packed rdma;
  443. } __packed;
  444. __be32 flags_qpn;
  445. } __packed;
  446. union ev_data {
  447. __be32 raw[7];
  448. struct mlx5_eqe_cmd cmd;
  449. struct mlx5_eqe_comp comp;
  450. struct mlx5_eqe_qp_srq qp_srq;
  451. struct mlx5_eqe_cq_err cq_err;
  452. struct mlx5_eqe_port_state port;
  453. struct mlx5_eqe_gpio gpio;
  454. struct mlx5_eqe_congestion cong;
  455. struct mlx5_eqe_stall_vl stall_vl;
  456. struct mlx5_eqe_page_req req_pages;
  457. struct mlx5_eqe_page_fault page_fault;
  458. } __packed;
  459. struct mlx5_eqe {
  460. u8 rsvd0;
  461. u8 type;
  462. u8 rsvd1;
  463. u8 sub_type;
  464. __be32 rsvd2[7];
  465. union ev_data data;
  466. __be16 rsvd3;
  467. u8 signature;
  468. u8 owner;
  469. } __packed;
  470. struct mlx5_cmd_prot_block {
  471. u8 data[MLX5_CMD_DATA_BLOCK_SIZE];
  472. u8 rsvd0[48];
  473. __be64 next;
  474. __be32 block_num;
  475. u8 rsvd1;
  476. u8 token;
  477. u8 ctrl_sig;
  478. u8 sig;
  479. };
  480. enum {
  481. MLX5_CQE_SYND_FLUSHED_IN_ERROR = 5,
  482. };
  483. struct mlx5_err_cqe {
  484. u8 rsvd0[32];
  485. __be32 srqn;
  486. u8 rsvd1[18];
  487. u8 vendor_err_synd;
  488. u8 syndrome;
  489. __be32 s_wqe_opcode_qpn;
  490. __be16 wqe_counter;
  491. u8 signature;
  492. u8 op_own;
  493. };
  494. struct mlx5_cqe64 {
  495. u8 rsvd0[4];
  496. u8 lro_tcppsh_abort_dupack;
  497. u8 lro_min_ttl;
  498. __be16 lro_tcp_win;
  499. __be32 lro_ack_seq_num;
  500. __be32 rss_hash_result;
  501. u8 rss_hash_type;
  502. u8 ml_path;
  503. u8 rsvd20[2];
  504. __be16 check_sum;
  505. __be16 slid;
  506. __be32 flags_rqpn;
  507. u8 hds_ip_ext;
  508. u8 l4_hdr_type_etc;
  509. __be16 vlan_info;
  510. __be32 srqn; /* [31:24]: lro_num_seg, [23:0]: srqn */
  511. __be32 imm_inval_pkey;
  512. u8 rsvd40[4];
  513. __be32 byte_cnt;
  514. __be64 timestamp;
  515. __be32 sop_drop_qpn;
  516. __be16 wqe_counter;
  517. u8 signature;
  518. u8 op_own;
  519. };
  520. static inline int get_cqe_lro_tcppsh(struct mlx5_cqe64 *cqe)
  521. {
  522. return (cqe->lro_tcppsh_abort_dupack >> 6) & 1;
  523. }
  524. static inline u8 get_cqe_l4_hdr_type(struct mlx5_cqe64 *cqe)
  525. {
  526. return (cqe->l4_hdr_type_etc >> 4) & 0x7;
  527. }
  528. static inline int cqe_has_vlan(struct mlx5_cqe64 *cqe)
  529. {
  530. return !!(cqe->l4_hdr_type_etc & 0x1);
  531. }
  532. enum {
  533. CQE_L4_HDR_TYPE_NONE = 0x0,
  534. CQE_L4_HDR_TYPE_TCP_NO_ACK = 0x1,
  535. CQE_L4_HDR_TYPE_UDP = 0x2,
  536. CQE_L4_HDR_TYPE_TCP_ACK_NO_DATA = 0x3,
  537. CQE_L4_HDR_TYPE_TCP_ACK_AND_DATA = 0x4,
  538. };
  539. enum {
  540. CQE_RSS_HTYPE_IP = 0x3 << 6,
  541. CQE_RSS_HTYPE_L4 = 0x3 << 2,
  542. };
  543. enum {
  544. CQE_L2_OK = 1 << 0,
  545. CQE_L3_OK = 1 << 1,
  546. CQE_L4_OK = 1 << 2,
  547. };
  548. struct mlx5_sig_err_cqe {
  549. u8 rsvd0[16];
  550. __be32 expected_trans_sig;
  551. __be32 actual_trans_sig;
  552. __be32 expected_reftag;
  553. __be32 actual_reftag;
  554. __be16 syndrome;
  555. u8 rsvd22[2];
  556. __be32 mkey;
  557. __be64 err_offset;
  558. u8 rsvd30[8];
  559. __be32 qpn;
  560. u8 rsvd38[2];
  561. u8 signature;
  562. u8 op_own;
  563. };
  564. struct mlx5_wqe_srq_next_seg {
  565. u8 rsvd0[2];
  566. __be16 next_wqe_index;
  567. u8 signature;
  568. u8 rsvd1[11];
  569. };
  570. union mlx5_ext_cqe {
  571. struct ib_grh grh;
  572. u8 inl[64];
  573. };
  574. struct mlx5_cqe128 {
  575. union mlx5_ext_cqe inl_grh;
  576. struct mlx5_cqe64 cqe64;
  577. };
  578. struct mlx5_srq_ctx {
  579. u8 state_log_sz;
  580. u8 rsvd0[3];
  581. __be32 flags_xrcd;
  582. __be32 pgoff_cqn;
  583. u8 rsvd1[4];
  584. u8 log_pg_sz;
  585. u8 rsvd2[7];
  586. __be32 pd;
  587. __be16 lwm;
  588. __be16 wqe_cnt;
  589. u8 rsvd3[8];
  590. __be64 db_record;
  591. };
  592. struct mlx5_create_srq_mbox_in {
  593. struct mlx5_inbox_hdr hdr;
  594. __be32 input_srqn;
  595. u8 rsvd0[4];
  596. struct mlx5_srq_ctx ctx;
  597. u8 rsvd1[208];
  598. __be64 pas[0];
  599. };
  600. struct mlx5_create_srq_mbox_out {
  601. struct mlx5_outbox_hdr hdr;
  602. __be32 srqn;
  603. u8 rsvd[4];
  604. };
  605. struct mlx5_destroy_srq_mbox_in {
  606. struct mlx5_inbox_hdr hdr;
  607. __be32 srqn;
  608. u8 rsvd[4];
  609. };
  610. struct mlx5_destroy_srq_mbox_out {
  611. struct mlx5_outbox_hdr hdr;
  612. u8 rsvd[8];
  613. };
  614. struct mlx5_query_srq_mbox_in {
  615. struct mlx5_inbox_hdr hdr;
  616. __be32 srqn;
  617. u8 rsvd0[4];
  618. };
  619. struct mlx5_query_srq_mbox_out {
  620. struct mlx5_outbox_hdr hdr;
  621. u8 rsvd0[8];
  622. struct mlx5_srq_ctx ctx;
  623. u8 rsvd1[32];
  624. __be64 pas[0];
  625. };
  626. struct mlx5_arm_srq_mbox_in {
  627. struct mlx5_inbox_hdr hdr;
  628. __be32 srqn;
  629. __be16 rsvd;
  630. __be16 lwm;
  631. };
  632. struct mlx5_arm_srq_mbox_out {
  633. struct mlx5_outbox_hdr hdr;
  634. u8 rsvd[8];
  635. };
  636. struct mlx5_cq_context {
  637. u8 status;
  638. u8 cqe_sz_flags;
  639. u8 st;
  640. u8 rsvd3;
  641. u8 rsvd4[6];
  642. __be16 page_offset;
  643. __be32 log_sz_usr_page;
  644. __be16 cq_period;
  645. __be16 cq_max_count;
  646. __be16 rsvd20;
  647. __be16 c_eqn;
  648. u8 log_pg_sz;
  649. u8 rsvd25[7];
  650. __be32 last_notified_index;
  651. __be32 solicit_producer_index;
  652. __be32 consumer_counter;
  653. __be32 producer_counter;
  654. u8 rsvd48[8];
  655. __be64 db_record_addr;
  656. };
  657. struct mlx5_create_cq_mbox_in {
  658. struct mlx5_inbox_hdr hdr;
  659. __be32 input_cqn;
  660. u8 rsvdx[4];
  661. struct mlx5_cq_context ctx;
  662. u8 rsvd6[192];
  663. __be64 pas[0];
  664. };
  665. struct mlx5_create_cq_mbox_out {
  666. struct mlx5_outbox_hdr hdr;
  667. __be32 cqn;
  668. u8 rsvd0[4];
  669. };
  670. struct mlx5_destroy_cq_mbox_in {
  671. struct mlx5_inbox_hdr hdr;
  672. __be32 cqn;
  673. u8 rsvd0[4];
  674. };
  675. struct mlx5_destroy_cq_mbox_out {
  676. struct mlx5_outbox_hdr hdr;
  677. u8 rsvd0[8];
  678. };
  679. struct mlx5_query_cq_mbox_in {
  680. struct mlx5_inbox_hdr hdr;
  681. __be32 cqn;
  682. u8 rsvd0[4];
  683. };
  684. struct mlx5_query_cq_mbox_out {
  685. struct mlx5_outbox_hdr hdr;
  686. u8 rsvd0[8];
  687. struct mlx5_cq_context ctx;
  688. u8 rsvd6[16];
  689. __be64 pas[0];
  690. };
  691. struct mlx5_modify_cq_mbox_in {
  692. struct mlx5_inbox_hdr hdr;
  693. __be32 cqn;
  694. __be32 field_select;
  695. struct mlx5_cq_context ctx;
  696. u8 rsvd[192];
  697. __be64 pas[0];
  698. };
  699. struct mlx5_modify_cq_mbox_out {
  700. struct mlx5_outbox_hdr hdr;
  701. u8 rsvd[8];
  702. };
  703. struct mlx5_enable_hca_mbox_in {
  704. struct mlx5_inbox_hdr hdr;
  705. u8 rsvd[8];
  706. };
  707. struct mlx5_enable_hca_mbox_out {
  708. struct mlx5_outbox_hdr hdr;
  709. u8 rsvd[8];
  710. };
  711. struct mlx5_disable_hca_mbox_in {
  712. struct mlx5_inbox_hdr hdr;
  713. u8 rsvd[8];
  714. };
  715. struct mlx5_disable_hca_mbox_out {
  716. struct mlx5_outbox_hdr hdr;
  717. u8 rsvd[8];
  718. };
  719. struct mlx5_eq_context {
  720. u8 status;
  721. u8 ec_oi;
  722. u8 st;
  723. u8 rsvd2[7];
  724. __be16 page_pffset;
  725. __be32 log_sz_usr_page;
  726. u8 rsvd3[7];
  727. u8 intr;
  728. u8 log_page_size;
  729. u8 rsvd4[15];
  730. __be32 consumer_counter;
  731. __be32 produser_counter;
  732. u8 rsvd5[16];
  733. };
  734. struct mlx5_create_eq_mbox_in {
  735. struct mlx5_inbox_hdr hdr;
  736. u8 rsvd0[3];
  737. u8 input_eqn;
  738. u8 rsvd1[4];
  739. struct mlx5_eq_context ctx;
  740. u8 rsvd2[8];
  741. __be64 events_mask;
  742. u8 rsvd3[176];
  743. __be64 pas[0];
  744. };
  745. struct mlx5_create_eq_mbox_out {
  746. struct mlx5_outbox_hdr hdr;
  747. u8 rsvd0[3];
  748. u8 eq_number;
  749. u8 rsvd1[4];
  750. };
  751. struct mlx5_destroy_eq_mbox_in {
  752. struct mlx5_inbox_hdr hdr;
  753. u8 rsvd0[3];
  754. u8 eqn;
  755. u8 rsvd1[4];
  756. };
  757. struct mlx5_destroy_eq_mbox_out {
  758. struct mlx5_outbox_hdr hdr;
  759. u8 rsvd[8];
  760. };
  761. struct mlx5_map_eq_mbox_in {
  762. struct mlx5_inbox_hdr hdr;
  763. __be64 mask;
  764. u8 mu;
  765. u8 rsvd0[2];
  766. u8 eqn;
  767. u8 rsvd1[24];
  768. };
  769. struct mlx5_map_eq_mbox_out {
  770. struct mlx5_outbox_hdr hdr;
  771. u8 rsvd[8];
  772. };
  773. struct mlx5_query_eq_mbox_in {
  774. struct mlx5_inbox_hdr hdr;
  775. u8 rsvd0[3];
  776. u8 eqn;
  777. u8 rsvd1[4];
  778. };
  779. struct mlx5_query_eq_mbox_out {
  780. struct mlx5_outbox_hdr hdr;
  781. u8 rsvd[8];
  782. struct mlx5_eq_context ctx;
  783. };
  784. enum {
  785. MLX5_MKEY_STATUS_FREE = 1 << 6,
  786. };
  787. struct mlx5_mkey_seg {
  788. /* This is a two bit field occupying bits 31-30.
  789. * bit 31 is always 0,
  790. * bit 30 is zero for regular MRs and 1 (e.g free) for UMRs that do not have tanslation
  791. */
  792. u8 status;
  793. u8 pcie_control;
  794. u8 flags;
  795. u8 version;
  796. __be32 qpn_mkey7_0;
  797. u8 rsvd1[4];
  798. __be32 flags_pd;
  799. __be64 start_addr;
  800. __be64 len;
  801. __be32 bsfs_octo_size;
  802. u8 rsvd2[16];
  803. __be32 xlt_oct_size;
  804. u8 rsvd3[3];
  805. u8 log2_page_size;
  806. u8 rsvd4[4];
  807. };
  808. struct mlx5_query_special_ctxs_mbox_in {
  809. struct mlx5_inbox_hdr hdr;
  810. u8 rsvd[8];
  811. };
  812. struct mlx5_query_special_ctxs_mbox_out {
  813. struct mlx5_outbox_hdr hdr;
  814. __be32 dump_fill_mkey;
  815. __be32 reserved_lkey;
  816. };
  817. struct mlx5_create_mkey_mbox_in {
  818. struct mlx5_inbox_hdr hdr;
  819. __be32 input_mkey_index;
  820. __be32 flags;
  821. struct mlx5_mkey_seg seg;
  822. u8 rsvd1[16];
  823. __be32 xlat_oct_act_size;
  824. __be32 rsvd2;
  825. u8 rsvd3[168];
  826. __be64 pas[0];
  827. };
  828. struct mlx5_create_mkey_mbox_out {
  829. struct mlx5_outbox_hdr hdr;
  830. __be32 mkey;
  831. u8 rsvd[4];
  832. };
  833. struct mlx5_destroy_mkey_mbox_in {
  834. struct mlx5_inbox_hdr hdr;
  835. __be32 mkey;
  836. u8 rsvd[4];
  837. };
  838. struct mlx5_destroy_mkey_mbox_out {
  839. struct mlx5_outbox_hdr hdr;
  840. u8 rsvd[8];
  841. };
  842. struct mlx5_query_mkey_mbox_in {
  843. struct mlx5_inbox_hdr hdr;
  844. __be32 mkey;
  845. };
  846. struct mlx5_query_mkey_mbox_out {
  847. struct mlx5_outbox_hdr hdr;
  848. __be64 pas[0];
  849. };
  850. struct mlx5_modify_mkey_mbox_in {
  851. struct mlx5_inbox_hdr hdr;
  852. __be32 mkey;
  853. __be64 pas[0];
  854. };
  855. struct mlx5_modify_mkey_mbox_out {
  856. struct mlx5_outbox_hdr hdr;
  857. u8 rsvd[8];
  858. };
  859. struct mlx5_dump_mkey_mbox_in {
  860. struct mlx5_inbox_hdr hdr;
  861. };
  862. struct mlx5_dump_mkey_mbox_out {
  863. struct mlx5_outbox_hdr hdr;
  864. __be32 mkey;
  865. };
  866. struct mlx5_mad_ifc_mbox_in {
  867. struct mlx5_inbox_hdr hdr;
  868. __be16 remote_lid;
  869. u8 rsvd0;
  870. u8 port;
  871. u8 rsvd1[4];
  872. u8 data[256];
  873. };
  874. struct mlx5_mad_ifc_mbox_out {
  875. struct mlx5_outbox_hdr hdr;
  876. u8 rsvd[8];
  877. u8 data[256];
  878. };
  879. struct mlx5_access_reg_mbox_in {
  880. struct mlx5_inbox_hdr hdr;
  881. u8 rsvd0[2];
  882. __be16 register_id;
  883. __be32 arg;
  884. __be32 data[0];
  885. };
  886. struct mlx5_access_reg_mbox_out {
  887. struct mlx5_outbox_hdr hdr;
  888. u8 rsvd[8];
  889. __be32 data[0];
  890. };
  891. #define MLX5_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90)
  892. enum {
  893. MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO = 1 << 0
  894. };
  895. struct mlx5_allocate_psv_in {
  896. struct mlx5_inbox_hdr hdr;
  897. __be32 npsv_pd;
  898. __be32 rsvd_psv0;
  899. };
  900. struct mlx5_allocate_psv_out {
  901. struct mlx5_outbox_hdr hdr;
  902. u8 rsvd[8];
  903. __be32 psv_idx[4];
  904. };
  905. struct mlx5_destroy_psv_in {
  906. struct mlx5_inbox_hdr hdr;
  907. __be32 psv_number;
  908. u8 rsvd[4];
  909. };
  910. struct mlx5_destroy_psv_out {
  911. struct mlx5_outbox_hdr hdr;
  912. u8 rsvd[8];
  913. };
  914. #define MLX5_CMD_OP_MAX 0x920
  915. enum {
  916. VPORT_STATE_DOWN = 0x0,
  917. VPORT_STATE_UP = 0x1,
  918. };
  919. enum {
  920. MLX5_L3_PROT_TYPE_IPV4 = 0,
  921. MLX5_L3_PROT_TYPE_IPV6 = 1,
  922. };
  923. enum {
  924. MLX5_L4_PROT_TYPE_TCP = 0,
  925. MLX5_L4_PROT_TYPE_UDP = 1,
  926. };
  927. enum {
  928. MLX5_HASH_FIELD_SEL_SRC_IP = 1 << 0,
  929. MLX5_HASH_FIELD_SEL_DST_IP = 1 << 1,
  930. MLX5_HASH_FIELD_SEL_L4_SPORT = 1 << 2,
  931. MLX5_HASH_FIELD_SEL_L4_DPORT = 1 << 3,
  932. MLX5_HASH_FIELD_SEL_IPSEC_SPI = 1 << 4,
  933. };
  934. enum {
  935. MLX5_MATCH_OUTER_HEADERS = 1 << 0,
  936. MLX5_MATCH_MISC_PARAMETERS = 1 << 1,
  937. MLX5_MATCH_INNER_HEADERS = 1 << 2,
  938. };
  939. enum {
  940. MLX5_FLOW_TABLE_TYPE_NIC_RCV = 0,
  941. MLX5_FLOW_TABLE_TYPE_ESWITCH = 4,
  942. };
  943. enum {
  944. MLX5_FLOW_CONTEXT_DEST_TYPE_VPORT = 0,
  945. MLX5_FLOW_CONTEXT_DEST_TYPE_FLOW_TABLE = 1,
  946. MLX5_FLOW_CONTEXT_DEST_TYPE_TIR = 2,
  947. };
  948. enum {
  949. MLX5_RQC_RQ_TYPE_MEMORY_RQ_INLINE = 0x0,
  950. MLX5_RQC_RQ_TYPE_MEMORY_RQ_RPM = 0x1,
  951. };
  952. /* MLX5 DEV CAPs */
  953. /* TODO: EAT.ME */
  954. enum mlx5_cap_mode {
  955. HCA_CAP_OPMOD_GET_MAX = 0,
  956. HCA_CAP_OPMOD_GET_CUR = 1,
  957. };
  958. enum mlx5_cap_type {
  959. MLX5_CAP_GENERAL = 0,
  960. MLX5_CAP_ETHERNET_OFFLOADS,
  961. MLX5_CAP_ODP,
  962. MLX5_CAP_ATOMIC,
  963. MLX5_CAP_ROCE,
  964. MLX5_CAP_IPOIB_OFFLOADS,
  965. MLX5_CAP_EOIB_OFFLOADS,
  966. MLX5_CAP_FLOW_TABLE,
  967. /* NUM OF CAP Types */
  968. MLX5_CAP_NUM
  969. };
  970. /* GET Dev Caps macros */
  971. #define MLX5_CAP_GEN(mdev, cap) \
  972. MLX5_GET(cmd_hca_cap, mdev->hca_caps_cur[MLX5_CAP_GENERAL], cap)
  973. #define MLX5_CAP_GEN_MAX(mdev, cap) \
  974. MLX5_GET(cmd_hca_cap, mdev->hca_caps_max[MLX5_CAP_GENERAL], cap)
  975. #define MLX5_CAP_ETH(mdev, cap) \
  976. MLX5_GET(per_protocol_networking_offload_caps,\
  977. mdev->hca_caps_cur[MLX5_CAP_ETHERNET_OFFLOADS], cap)
  978. #define MLX5_CAP_ETH_MAX(mdev, cap) \
  979. MLX5_GET(per_protocol_networking_offload_caps,\
  980. mdev->hca_caps_max[MLX5_CAP_ETHERNET_OFFLOADS], cap)
  981. #define MLX5_CAP_ROCE(mdev, cap) \
  982. MLX5_GET(roce_cap, mdev->hca_caps_cur[MLX5_CAP_ROCE], cap)
  983. #define MLX5_CAP_ROCE_MAX(mdev, cap) \
  984. MLX5_GET(roce_cap, mdev->hca_caps_max[MLX5_CAP_ROCE], cap)
  985. #define MLX5_CAP_ATOMIC(mdev, cap) \
  986. MLX5_GET(atomic_caps, mdev->hca_caps_cur[MLX5_CAP_ATOMIC], cap)
  987. #define MLX5_CAP_ATOMIC_MAX(mdev, cap) \
  988. MLX5_GET(atomic_caps, mdev->hca_caps_max[MLX5_CAP_ATOMIC], cap)
  989. #define MLX5_CAP_FLOWTABLE(mdev, cap) \
  990. MLX5_GET(flow_table_nic_cap, mdev->hca_caps_cur[MLX5_CAP_FLOW_TABLE], cap)
  991. #define MLX5_CAP_FLOWTABLE_MAX(mdev, cap) \
  992. MLX5_GET(flow_table_nic_cap, mdev->hca_caps_max[MLX5_CAP_FLOW_TABLE], cap)
  993. #define MLX5_CAP_ODP(mdev, cap)\
  994. MLX5_GET(odp_cap, mdev->hca_caps_cur[MLX5_CAP_ODP], cap)
  995. enum {
  996. MLX5_CMD_STAT_OK = 0x0,
  997. MLX5_CMD_STAT_INT_ERR = 0x1,
  998. MLX5_CMD_STAT_BAD_OP_ERR = 0x2,
  999. MLX5_CMD_STAT_BAD_PARAM_ERR = 0x3,
  1000. MLX5_CMD_STAT_BAD_SYS_STATE_ERR = 0x4,
  1001. MLX5_CMD_STAT_BAD_RES_ERR = 0x5,
  1002. MLX5_CMD_STAT_RES_BUSY = 0x6,
  1003. MLX5_CMD_STAT_LIM_ERR = 0x8,
  1004. MLX5_CMD_STAT_BAD_RES_STATE_ERR = 0x9,
  1005. MLX5_CMD_STAT_IX_ERR = 0xa,
  1006. MLX5_CMD_STAT_NO_RES_ERR = 0xf,
  1007. MLX5_CMD_STAT_BAD_INP_LEN_ERR = 0x50,
  1008. MLX5_CMD_STAT_BAD_OUTP_LEN_ERR = 0x51,
  1009. MLX5_CMD_STAT_BAD_QP_STATE_ERR = 0x10,
  1010. MLX5_CMD_STAT_BAD_PKT_ERR = 0x30,
  1011. MLX5_CMD_STAT_BAD_SIZE_OUTS_CQES_ERR = 0x40,
  1012. };
  1013. enum {
  1014. MLX5_IEEE_802_3_COUNTERS_GROUP = 0x0,
  1015. MLX5_RFC_2863_COUNTERS_GROUP = 0x1,
  1016. MLX5_RFC_2819_COUNTERS_GROUP = 0x2,
  1017. MLX5_RFC_3635_COUNTERS_GROUP = 0x3,
  1018. MLX5_ETHERNET_EXTENDED_COUNTERS_GROUP = 0x5,
  1019. MLX5_PER_PRIORITY_COUNTERS_GROUP = 0x10,
  1020. MLX5_PER_TRAFFIC_CLASS_COUNTERS_GROUP = 0x11
  1021. };
  1022. static inline u16 mlx5_to_sw_pkey_sz(int pkey_sz)
  1023. {
  1024. if (pkey_sz > MLX5_MAX_LOG_PKEY_TABLE)
  1025. return 0;
  1026. return MLX5_MIN_PKEY_TABLE_SIZE << pkey_sz;
  1027. }
  1028. #endif /* MLX5_DEVICE_H */