rdma_netlink.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef _UAPI_RDMA_NETLINK_H
  3. #define _UAPI_RDMA_NETLINK_H
  4. #include <linux/types.h>
  5. enum {
  6. RDMA_NL_RDMA_CM = 1,
  7. RDMA_NL_IWCM,
  8. RDMA_NL_RSVD,
  9. RDMA_NL_LS, /* RDMA Local Services */
  10. RDMA_NL_NLDEV, /* RDMA device interface */
  11. RDMA_NL_NUM_CLIENTS
  12. };
  13. enum {
  14. RDMA_NL_GROUP_CM = 1,
  15. RDMA_NL_GROUP_IWPM,
  16. RDMA_NL_GROUP_LS,
  17. RDMA_NL_NUM_GROUPS
  18. };
  19. #define RDMA_NL_GET_CLIENT(type) ((type & (((1 << 6) - 1) << 10)) >> 10)
  20. #define RDMA_NL_GET_OP(type) (type & ((1 << 10) - 1))
  21. #define RDMA_NL_GET_TYPE(client, op) ((client << 10) + op)
  22. enum {
  23. RDMA_NL_RDMA_CM_ID_STATS = 0,
  24. RDMA_NL_RDMA_CM_NUM_OPS
  25. };
  26. enum {
  27. RDMA_NL_RDMA_CM_ATTR_SRC_ADDR = 1,
  28. RDMA_NL_RDMA_CM_ATTR_DST_ADDR,
  29. RDMA_NL_RDMA_CM_NUM_ATTR,
  30. };
  31. /* iwarp port mapper op-codes */
  32. enum {
  33. RDMA_NL_IWPM_REG_PID = 0,
  34. RDMA_NL_IWPM_ADD_MAPPING,
  35. RDMA_NL_IWPM_QUERY_MAPPING,
  36. RDMA_NL_IWPM_REMOVE_MAPPING,
  37. RDMA_NL_IWPM_REMOTE_INFO,
  38. RDMA_NL_IWPM_HANDLE_ERR,
  39. RDMA_NL_IWPM_MAPINFO,
  40. RDMA_NL_IWPM_MAPINFO_NUM,
  41. RDMA_NL_IWPM_NUM_OPS
  42. };
  43. struct rdma_cm_id_stats {
  44. __u32 qp_num;
  45. __u32 bound_dev_if;
  46. __u32 port_space;
  47. __s32 pid;
  48. __u8 cm_state;
  49. __u8 node_type;
  50. __u8 port_num;
  51. __u8 qp_type;
  52. };
  53. enum {
  54. IWPM_NLA_REG_PID_UNSPEC = 0,
  55. IWPM_NLA_REG_PID_SEQ,
  56. IWPM_NLA_REG_IF_NAME,
  57. IWPM_NLA_REG_IBDEV_NAME,
  58. IWPM_NLA_REG_ULIB_NAME,
  59. IWPM_NLA_REG_PID_MAX
  60. };
  61. enum {
  62. IWPM_NLA_RREG_PID_UNSPEC = 0,
  63. IWPM_NLA_RREG_PID_SEQ,
  64. IWPM_NLA_RREG_IBDEV_NAME,
  65. IWPM_NLA_RREG_ULIB_NAME,
  66. IWPM_NLA_RREG_ULIB_VER,
  67. IWPM_NLA_RREG_PID_ERR,
  68. IWPM_NLA_RREG_PID_MAX
  69. };
  70. enum {
  71. IWPM_NLA_MANAGE_MAPPING_UNSPEC = 0,
  72. IWPM_NLA_MANAGE_MAPPING_SEQ,
  73. IWPM_NLA_MANAGE_ADDR,
  74. IWPM_NLA_MANAGE_MAPPED_LOC_ADDR,
  75. IWPM_NLA_RMANAGE_MAPPING_ERR,
  76. IWPM_NLA_RMANAGE_MAPPING_MAX
  77. };
  78. #define IWPM_NLA_MANAGE_MAPPING_MAX 3
  79. #define IWPM_NLA_QUERY_MAPPING_MAX 4
  80. #define IWPM_NLA_MAPINFO_SEND_MAX 3
  81. enum {
  82. IWPM_NLA_QUERY_MAPPING_UNSPEC = 0,
  83. IWPM_NLA_QUERY_MAPPING_SEQ,
  84. IWPM_NLA_QUERY_LOCAL_ADDR,
  85. IWPM_NLA_QUERY_REMOTE_ADDR,
  86. IWPM_NLA_RQUERY_MAPPED_LOC_ADDR,
  87. IWPM_NLA_RQUERY_MAPPED_REM_ADDR,
  88. IWPM_NLA_RQUERY_MAPPING_ERR,
  89. IWPM_NLA_RQUERY_MAPPING_MAX
  90. };
  91. enum {
  92. IWPM_NLA_MAPINFO_REQ_UNSPEC = 0,
  93. IWPM_NLA_MAPINFO_ULIB_NAME,
  94. IWPM_NLA_MAPINFO_ULIB_VER,
  95. IWPM_NLA_MAPINFO_REQ_MAX
  96. };
  97. enum {
  98. IWPM_NLA_MAPINFO_UNSPEC = 0,
  99. IWPM_NLA_MAPINFO_LOCAL_ADDR,
  100. IWPM_NLA_MAPINFO_MAPPED_ADDR,
  101. IWPM_NLA_MAPINFO_MAX
  102. };
  103. enum {
  104. IWPM_NLA_MAPINFO_NUM_UNSPEC = 0,
  105. IWPM_NLA_MAPINFO_SEQ,
  106. IWPM_NLA_MAPINFO_SEND_NUM,
  107. IWPM_NLA_MAPINFO_ACK_NUM,
  108. IWPM_NLA_MAPINFO_NUM_MAX
  109. };
  110. enum {
  111. IWPM_NLA_ERR_UNSPEC = 0,
  112. IWPM_NLA_ERR_SEQ,
  113. IWPM_NLA_ERR_CODE,
  114. IWPM_NLA_ERR_MAX
  115. };
  116. /*
  117. * Local service operations:
  118. * RESOLVE - The client requests the local service to resolve a path.
  119. * SET_TIMEOUT - The local service requests the client to set the timeout.
  120. * IP_RESOLVE - The client requests the local service to resolve an IP to GID.
  121. */
  122. enum {
  123. RDMA_NL_LS_OP_RESOLVE = 0,
  124. RDMA_NL_LS_OP_SET_TIMEOUT,
  125. RDMA_NL_LS_OP_IP_RESOLVE,
  126. RDMA_NL_LS_NUM_OPS
  127. };
  128. /* Local service netlink message flags */
  129. #define RDMA_NL_LS_F_ERR 0x0100 /* Failed response */
  130. /*
  131. * Local service resolve operation family header.
  132. * The layout for the resolve operation:
  133. * nlmsg header
  134. * family header
  135. * attributes
  136. */
  137. /*
  138. * Local service path use:
  139. * Specify how the path(s) will be used.
  140. * ALL - For connected CM operation (6 pathrecords)
  141. * UNIDIRECTIONAL - For unidirectional UD (1 pathrecord)
  142. * GMP - For miscellaneous GMP like operation (at least 1 reversible
  143. * pathrecord)
  144. */
  145. enum {
  146. LS_RESOLVE_PATH_USE_ALL = 0,
  147. LS_RESOLVE_PATH_USE_UNIDIRECTIONAL,
  148. LS_RESOLVE_PATH_USE_GMP,
  149. LS_RESOLVE_PATH_USE_MAX
  150. };
  151. #define LS_DEVICE_NAME_MAX 64
  152. struct rdma_ls_resolve_header {
  153. __u8 device_name[LS_DEVICE_NAME_MAX];
  154. __u8 port_num;
  155. __u8 path_use;
  156. };
  157. struct rdma_ls_ip_resolve_header {
  158. __u32 ifindex;
  159. };
  160. /* Local service attribute type */
  161. #define RDMA_NLA_F_MANDATORY (1 << 13)
  162. #define RDMA_NLA_TYPE_MASK (~(NLA_F_NESTED | NLA_F_NET_BYTEORDER | \
  163. RDMA_NLA_F_MANDATORY))
  164. /*
  165. * Local service attributes:
  166. * Attr Name Size Byte order
  167. * -----------------------------------------------------
  168. * PATH_RECORD struct ib_path_rec_data
  169. * TIMEOUT u32 cpu
  170. * SERVICE_ID u64 cpu
  171. * DGID u8[16] BE
  172. * SGID u8[16] BE
  173. * TCLASS u8
  174. * PKEY u16 cpu
  175. * QOS_CLASS u16 cpu
  176. * IPV4 u32 BE
  177. * IPV6 u8[16] BE
  178. */
  179. enum {
  180. LS_NLA_TYPE_UNSPEC = 0,
  181. LS_NLA_TYPE_PATH_RECORD,
  182. LS_NLA_TYPE_TIMEOUT,
  183. LS_NLA_TYPE_SERVICE_ID,
  184. LS_NLA_TYPE_DGID,
  185. LS_NLA_TYPE_SGID,
  186. LS_NLA_TYPE_TCLASS,
  187. LS_NLA_TYPE_PKEY,
  188. LS_NLA_TYPE_QOS_CLASS,
  189. LS_NLA_TYPE_IPV4,
  190. LS_NLA_TYPE_IPV6,
  191. LS_NLA_TYPE_MAX
  192. };
  193. /* Local service DGID/SGID attribute: big endian */
  194. struct rdma_nla_ls_gid {
  195. __u8 gid[16];
  196. };
  197. enum rdma_nldev_command {
  198. RDMA_NLDEV_CMD_UNSPEC,
  199. RDMA_NLDEV_CMD_GET, /* can dump */
  200. /* 2 - 4 are free to use */
  201. RDMA_NLDEV_CMD_PORT_GET = 5, /* can dump */
  202. /* 6 - 8 are free to use */
  203. RDMA_NLDEV_CMD_RES_GET = 9, /* can dump */
  204. RDMA_NLDEV_CMD_RES_QP_GET, /* can dump */
  205. RDMA_NLDEV_CMD_RES_CM_ID_GET, /* can dump */
  206. RDMA_NLDEV_CMD_RES_CQ_GET, /* can dump */
  207. RDMA_NLDEV_CMD_RES_MR_GET, /* can dump */
  208. RDMA_NLDEV_CMD_RES_PD_GET, /* can dump */
  209. RDMA_NLDEV_NUM_OPS
  210. };
  211. enum {
  212. RDMA_NLDEV_ATTR_ENTRY_STRLEN = 16,
  213. };
  214. enum rdma_nldev_print_type {
  215. RDMA_NLDEV_PRINT_TYPE_UNSPEC,
  216. RDMA_NLDEV_PRINT_TYPE_HEX,
  217. };
  218. enum rdma_nldev_attr {
  219. /* don't change the order or add anything between, this is ABI! */
  220. RDMA_NLDEV_ATTR_UNSPEC,
  221. /* Pad attribute for 64b alignment */
  222. RDMA_NLDEV_ATTR_PAD = RDMA_NLDEV_ATTR_UNSPEC,
  223. /* Identifier for ib_device */
  224. RDMA_NLDEV_ATTR_DEV_INDEX, /* u32 */
  225. RDMA_NLDEV_ATTR_DEV_NAME, /* string */
  226. /*
  227. * Device index together with port index are identifiers
  228. * for port/link properties.
  229. *
  230. * For RDMA_NLDEV_CMD_GET commamnd, port index will return number
  231. * of available ports in ib_device, while for port specific operations,
  232. * it will be real port index as it appears in sysfs. Port index follows
  233. * sysfs notation and starts from 1 for the first port.
  234. */
  235. RDMA_NLDEV_ATTR_PORT_INDEX, /* u32 */
  236. /*
  237. * Device and port capabilities
  238. */
  239. RDMA_NLDEV_ATTR_CAP_FLAGS, /* u64 */
  240. /*
  241. * FW version
  242. */
  243. RDMA_NLDEV_ATTR_FW_VERSION, /* string */
  244. /*
  245. * Node GUID (in host byte order) associated with the RDMA device.
  246. */
  247. RDMA_NLDEV_ATTR_NODE_GUID, /* u64 */
  248. /*
  249. * System image GUID (in host byte order) associated with
  250. * this RDMA device and other devices which are part of a
  251. * single system.
  252. */
  253. RDMA_NLDEV_ATTR_SYS_IMAGE_GUID, /* u64 */
  254. /*
  255. * Subnet prefix (in host byte order)
  256. */
  257. RDMA_NLDEV_ATTR_SUBNET_PREFIX, /* u64 */
  258. /*
  259. * Local Identifier (LID),
  260. * According to IB specification, It is 16-bit address assigned
  261. * by the Subnet Manager. Extended to be 32-bit for OmniPath users.
  262. */
  263. RDMA_NLDEV_ATTR_LID, /* u32 */
  264. RDMA_NLDEV_ATTR_SM_LID, /* u32 */
  265. /*
  266. * LID mask control (LMC)
  267. */
  268. RDMA_NLDEV_ATTR_LMC, /* u8 */
  269. RDMA_NLDEV_ATTR_PORT_STATE, /* u8 */
  270. RDMA_NLDEV_ATTR_PORT_PHYS_STATE, /* u8 */
  271. RDMA_NLDEV_ATTR_DEV_NODE_TYPE, /* u8 */
  272. RDMA_NLDEV_ATTR_RES_SUMMARY, /* nested table */
  273. RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY, /* nested table */
  274. RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_NAME, /* string */
  275. RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR, /* u64 */
  276. RDMA_NLDEV_ATTR_RES_QP, /* nested table */
  277. RDMA_NLDEV_ATTR_RES_QP_ENTRY, /* nested table */
  278. /*
  279. * Local QPN
  280. */
  281. RDMA_NLDEV_ATTR_RES_LQPN, /* u32 */
  282. /*
  283. * Remote QPN,
  284. * Applicable for RC and UC only IBTA 11.2.5.3 QUERY QUEUE PAIR
  285. */
  286. RDMA_NLDEV_ATTR_RES_RQPN, /* u32 */
  287. /*
  288. * Receive Queue PSN,
  289. * Applicable for RC and UC only 11.2.5.3 QUERY QUEUE PAIR
  290. */
  291. RDMA_NLDEV_ATTR_RES_RQ_PSN, /* u32 */
  292. /*
  293. * Send Queue PSN
  294. */
  295. RDMA_NLDEV_ATTR_RES_SQ_PSN, /* u32 */
  296. RDMA_NLDEV_ATTR_RES_PATH_MIG_STATE, /* u8 */
  297. /*
  298. * QP types as visible to RDMA/core, the reserved QPT
  299. * are not exported through this interface.
  300. */
  301. RDMA_NLDEV_ATTR_RES_TYPE, /* u8 */
  302. RDMA_NLDEV_ATTR_RES_STATE, /* u8 */
  303. /*
  304. * Process ID which created object,
  305. * in case of kernel origin, PID won't exist.
  306. */
  307. RDMA_NLDEV_ATTR_RES_PID, /* u32 */
  308. /*
  309. * The name of process created following resource.
  310. * It will exist only for kernel objects.
  311. * For user created objects, the user is supposed
  312. * to read /proc/PID/comm file.
  313. */
  314. RDMA_NLDEV_ATTR_RES_KERN_NAME, /* string */
  315. RDMA_NLDEV_ATTR_RES_CM_ID, /* nested table */
  316. RDMA_NLDEV_ATTR_RES_CM_ID_ENTRY, /* nested table */
  317. /*
  318. * rdma_cm_id port space.
  319. */
  320. RDMA_NLDEV_ATTR_RES_PS, /* u32 */
  321. /*
  322. * Source and destination socket addresses
  323. */
  324. RDMA_NLDEV_ATTR_RES_SRC_ADDR, /* __kernel_sockaddr_storage */
  325. RDMA_NLDEV_ATTR_RES_DST_ADDR, /* __kernel_sockaddr_storage */
  326. RDMA_NLDEV_ATTR_RES_CQ, /* nested table */
  327. RDMA_NLDEV_ATTR_RES_CQ_ENTRY, /* nested table */
  328. RDMA_NLDEV_ATTR_RES_CQE, /* u32 */
  329. RDMA_NLDEV_ATTR_RES_USECNT, /* u64 */
  330. RDMA_NLDEV_ATTR_RES_POLL_CTX, /* u8 */
  331. RDMA_NLDEV_ATTR_RES_MR, /* nested table */
  332. RDMA_NLDEV_ATTR_RES_MR_ENTRY, /* nested table */
  333. RDMA_NLDEV_ATTR_RES_RKEY, /* u32 */
  334. RDMA_NLDEV_ATTR_RES_LKEY, /* u32 */
  335. RDMA_NLDEV_ATTR_RES_IOVA, /* u64 */
  336. RDMA_NLDEV_ATTR_RES_MRLEN, /* u64 */
  337. RDMA_NLDEV_ATTR_RES_PD, /* nested table */
  338. RDMA_NLDEV_ATTR_RES_PD_ENTRY, /* nested table */
  339. RDMA_NLDEV_ATTR_RES_LOCAL_DMA_LKEY, /* u32 */
  340. RDMA_NLDEV_ATTR_RES_UNSAFE_GLOBAL_RKEY, /* u32 */
  341. /*
  342. * Provides logical name and index of netdevice which is
  343. * connected to physical port. This information is relevant
  344. * for RoCE and iWARP.
  345. *
  346. * The netdevices which are associated with containers are
  347. * supposed to be exported together with GID table once it
  348. * will be exposed through the netlink. Because the
  349. * associated netdevices are properties of GIDs.
  350. */
  351. RDMA_NLDEV_ATTR_NDEV_INDEX, /* u32 */
  352. RDMA_NLDEV_ATTR_NDEV_NAME, /* string */
  353. /*
  354. * driver-specific attributes.
  355. */
  356. RDMA_NLDEV_ATTR_DRIVER, /* nested table */
  357. RDMA_NLDEV_ATTR_DRIVER_ENTRY, /* nested table */
  358. RDMA_NLDEV_ATTR_DRIVER_STRING, /* string */
  359. /*
  360. * u8 values from enum rdma_nldev_print_type
  361. */
  362. RDMA_NLDEV_ATTR_DRIVER_PRINT_TYPE, /* u8 */
  363. RDMA_NLDEV_ATTR_DRIVER_S32, /* s32 */
  364. RDMA_NLDEV_ATTR_DRIVER_U32, /* u32 */
  365. RDMA_NLDEV_ATTR_DRIVER_S64, /* s64 */
  366. RDMA_NLDEV_ATTR_DRIVER_U64, /* u64 */
  367. /*
  368. * Always the end
  369. */
  370. RDMA_NLDEV_ATTR_MAX
  371. };
  372. #endif /* _UAPI_RDMA_NETLINK_H */