rdma_netlink.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. #ifndef _UAPI_RDMA_NETLINK_H
  2. #define _UAPI_RDMA_NETLINK_H
  3. #include <linux/types.h>
  4. enum {
  5. RDMA_NL_RDMA_CM = 1,
  6. RDMA_NL_IWCM,
  7. RDMA_NL_RSVD,
  8. RDMA_NL_LS, /* RDMA Local Services */
  9. RDMA_NL_NLDEV, /* RDMA device interface */
  10. RDMA_NL_NUM_CLIENTS
  11. };
  12. enum {
  13. RDMA_NL_GROUP_CM = 1,
  14. RDMA_NL_GROUP_IWPM,
  15. RDMA_NL_GROUP_LS,
  16. RDMA_NL_NUM_GROUPS
  17. };
  18. #define RDMA_NL_GET_CLIENT(type) ((type & (((1 << 6) - 1) << 10)) >> 10)
  19. #define RDMA_NL_GET_OP(type) (type & ((1 << 10) - 1))
  20. #define RDMA_NL_GET_TYPE(client, op) ((client << 10) + op)
  21. enum {
  22. RDMA_NL_RDMA_CM_ID_STATS = 0,
  23. RDMA_NL_RDMA_CM_NUM_OPS
  24. };
  25. enum {
  26. RDMA_NL_RDMA_CM_ATTR_SRC_ADDR = 1,
  27. RDMA_NL_RDMA_CM_ATTR_DST_ADDR,
  28. RDMA_NL_RDMA_CM_NUM_ATTR,
  29. };
  30. /* iwarp port mapper op-codes */
  31. enum {
  32. RDMA_NL_IWPM_REG_PID = 0,
  33. RDMA_NL_IWPM_ADD_MAPPING,
  34. RDMA_NL_IWPM_QUERY_MAPPING,
  35. RDMA_NL_IWPM_REMOVE_MAPPING,
  36. RDMA_NL_IWPM_REMOTE_INFO,
  37. RDMA_NL_IWPM_HANDLE_ERR,
  38. RDMA_NL_IWPM_MAPINFO,
  39. RDMA_NL_IWPM_MAPINFO_NUM,
  40. RDMA_NL_IWPM_NUM_OPS
  41. };
  42. struct rdma_cm_id_stats {
  43. __u32 qp_num;
  44. __u32 bound_dev_if;
  45. __u32 port_space;
  46. __s32 pid;
  47. __u8 cm_state;
  48. __u8 node_type;
  49. __u8 port_num;
  50. __u8 qp_type;
  51. };
  52. enum {
  53. IWPM_NLA_REG_PID_UNSPEC = 0,
  54. IWPM_NLA_REG_PID_SEQ,
  55. IWPM_NLA_REG_IF_NAME,
  56. IWPM_NLA_REG_IBDEV_NAME,
  57. IWPM_NLA_REG_ULIB_NAME,
  58. IWPM_NLA_REG_PID_MAX
  59. };
  60. enum {
  61. IWPM_NLA_RREG_PID_UNSPEC = 0,
  62. IWPM_NLA_RREG_PID_SEQ,
  63. IWPM_NLA_RREG_IBDEV_NAME,
  64. IWPM_NLA_RREG_ULIB_NAME,
  65. IWPM_NLA_RREG_ULIB_VER,
  66. IWPM_NLA_RREG_PID_ERR,
  67. IWPM_NLA_RREG_PID_MAX
  68. };
  69. enum {
  70. IWPM_NLA_MANAGE_MAPPING_UNSPEC = 0,
  71. IWPM_NLA_MANAGE_MAPPING_SEQ,
  72. IWPM_NLA_MANAGE_ADDR,
  73. IWPM_NLA_MANAGE_MAPPED_LOC_ADDR,
  74. IWPM_NLA_RMANAGE_MAPPING_ERR,
  75. IWPM_NLA_RMANAGE_MAPPING_MAX
  76. };
  77. #define IWPM_NLA_MANAGE_MAPPING_MAX 3
  78. #define IWPM_NLA_QUERY_MAPPING_MAX 4
  79. #define IWPM_NLA_MAPINFO_SEND_MAX 3
  80. enum {
  81. IWPM_NLA_QUERY_MAPPING_UNSPEC = 0,
  82. IWPM_NLA_QUERY_MAPPING_SEQ,
  83. IWPM_NLA_QUERY_LOCAL_ADDR,
  84. IWPM_NLA_QUERY_REMOTE_ADDR,
  85. IWPM_NLA_RQUERY_MAPPED_LOC_ADDR,
  86. IWPM_NLA_RQUERY_MAPPED_REM_ADDR,
  87. IWPM_NLA_RQUERY_MAPPING_ERR,
  88. IWPM_NLA_RQUERY_MAPPING_MAX
  89. };
  90. enum {
  91. IWPM_NLA_MAPINFO_REQ_UNSPEC = 0,
  92. IWPM_NLA_MAPINFO_ULIB_NAME,
  93. IWPM_NLA_MAPINFO_ULIB_VER,
  94. IWPM_NLA_MAPINFO_REQ_MAX
  95. };
  96. enum {
  97. IWPM_NLA_MAPINFO_UNSPEC = 0,
  98. IWPM_NLA_MAPINFO_LOCAL_ADDR,
  99. IWPM_NLA_MAPINFO_MAPPED_ADDR,
  100. IWPM_NLA_MAPINFO_MAX
  101. };
  102. enum {
  103. IWPM_NLA_MAPINFO_NUM_UNSPEC = 0,
  104. IWPM_NLA_MAPINFO_SEQ,
  105. IWPM_NLA_MAPINFO_SEND_NUM,
  106. IWPM_NLA_MAPINFO_ACK_NUM,
  107. IWPM_NLA_MAPINFO_NUM_MAX
  108. };
  109. enum {
  110. IWPM_NLA_ERR_UNSPEC = 0,
  111. IWPM_NLA_ERR_SEQ,
  112. IWPM_NLA_ERR_CODE,
  113. IWPM_NLA_ERR_MAX
  114. };
  115. /*
  116. * Local service operations:
  117. * RESOLVE - The client requests the local service to resolve a path.
  118. * SET_TIMEOUT - The local service requests the client to set the timeout.
  119. * IP_RESOLVE - The client requests the local service to resolve an IP to GID.
  120. */
  121. enum {
  122. RDMA_NL_LS_OP_RESOLVE = 0,
  123. RDMA_NL_LS_OP_SET_TIMEOUT,
  124. RDMA_NL_LS_OP_IP_RESOLVE,
  125. RDMA_NL_LS_NUM_OPS
  126. };
  127. /* Local service netlink message flags */
  128. #define RDMA_NL_LS_F_ERR 0x0100 /* Failed response */
  129. /*
  130. * Local service resolve operation family header.
  131. * The layout for the resolve operation:
  132. * nlmsg header
  133. * family header
  134. * attributes
  135. */
  136. /*
  137. * Local service path use:
  138. * Specify how the path(s) will be used.
  139. * ALL - For connected CM operation (6 pathrecords)
  140. * UNIDIRECTIONAL - For unidirectional UD (1 pathrecord)
  141. * GMP - For miscellaneous GMP like operation (at least 1 reversible
  142. * pathrecord)
  143. */
  144. enum {
  145. LS_RESOLVE_PATH_USE_ALL = 0,
  146. LS_RESOLVE_PATH_USE_UNIDIRECTIONAL,
  147. LS_RESOLVE_PATH_USE_GMP,
  148. LS_RESOLVE_PATH_USE_MAX
  149. };
  150. #define LS_DEVICE_NAME_MAX 64
  151. struct rdma_ls_resolve_header {
  152. __u8 device_name[LS_DEVICE_NAME_MAX];
  153. __u8 port_num;
  154. __u8 path_use;
  155. };
  156. struct rdma_ls_ip_resolve_header {
  157. __u32 ifindex;
  158. };
  159. /* Local service attribute type */
  160. #define RDMA_NLA_F_MANDATORY (1 << 13)
  161. #define RDMA_NLA_TYPE_MASK (~(NLA_F_NESTED | NLA_F_NET_BYTEORDER | \
  162. RDMA_NLA_F_MANDATORY))
  163. /*
  164. * Local service attributes:
  165. * Attr Name Size Byte order
  166. * -----------------------------------------------------
  167. * PATH_RECORD struct ib_path_rec_data
  168. * TIMEOUT u32 cpu
  169. * SERVICE_ID u64 cpu
  170. * DGID u8[16] BE
  171. * SGID u8[16] BE
  172. * TCLASS u8
  173. * PKEY u16 cpu
  174. * QOS_CLASS u16 cpu
  175. * IPV4 u32 BE
  176. * IPV6 u8[16] BE
  177. */
  178. enum {
  179. LS_NLA_TYPE_UNSPEC = 0,
  180. LS_NLA_TYPE_PATH_RECORD,
  181. LS_NLA_TYPE_TIMEOUT,
  182. LS_NLA_TYPE_SERVICE_ID,
  183. LS_NLA_TYPE_DGID,
  184. LS_NLA_TYPE_SGID,
  185. LS_NLA_TYPE_TCLASS,
  186. LS_NLA_TYPE_PKEY,
  187. LS_NLA_TYPE_QOS_CLASS,
  188. LS_NLA_TYPE_IPV4,
  189. LS_NLA_TYPE_IPV6,
  190. LS_NLA_TYPE_MAX
  191. };
  192. /* Local service DGID/SGID attribute: big endian */
  193. struct rdma_nla_ls_gid {
  194. __u8 gid[16];
  195. };
  196. enum rdma_nldev_command {
  197. RDMA_NLDEV_CMD_UNSPEC,
  198. RDMA_NLDEV_CMD_GET, /* can dump */
  199. RDMA_NLDEV_CMD_SET,
  200. RDMA_NLDEV_CMD_NEW,
  201. RDMA_NLDEV_CMD_DEL,
  202. RDMA_NLDEV_CMD_PORT_GET, /* can dump */
  203. RDMA_NLDEV_CMD_PORT_SET,
  204. RDMA_NLDEV_CMD_PORT_NEW,
  205. RDMA_NLDEV_CMD_PORT_DEL,
  206. RDMA_NLDEV_NUM_OPS
  207. };
  208. enum rdma_nldev_attr {
  209. /* don't change the order or add anything between, this is ABI! */
  210. RDMA_NLDEV_ATTR_UNSPEC,
  211. /* Identifier for ib_device */
  212. RDMA_NLDEV_ATTR_DEV_INDEX, /* u32 */
  213. RDMA_NLDEV_ATTR_DEV_NAME, /* string */
  214. /*
  215. * Device index together with port index are identifiers
  216. * for port/link properties.
  217. *
  218. * For RDMA_NLDEV_CMD_GET commamnd, port index will return number
  219. * of available ports in ib_device, while for port specific operations,
  220. * it will be real port index as it appears in sysfs. Port index follows
  221. * sysfs notation and starts from 1 for the first port.
  222. */
  223. RDMA_NLDEV_ATTR_PORT_INDEX, /* u32 */
  224. /*
  225. * Device and port capabilities
  226. */
  227. RDMA_NLDEV_ATTR_CAP_FLAGS, /* u64 */
  228. /*
  229. * FW version
  230. */
  231. RDMA_NLDEV_ATTR_FW_VERSION, /* string */
  232. /*
  233. * Node GUID (in host byte order) associated with the RDMA device.
  234. */
  235. RDMA_NLDEV_ATTR_NODE_GUID, /* u64 */
  236. /*
  237. * System image GUID (in host byte order) associated with
  238. * this RDMA device and other devices which are part of a
  239. * single system.
  240. */
  241. RDMA_NLDEV_ATTR_SYS_IMAGE_GUID, /* u64 */
  242. /*
  243. * Subnet prefix (in host byte order)
  244. */
  245. RDMA_NLDEV_ATTR_SUBNET_PREFIX, /* u64 */
  246. /*
  247. * Local Identifier (LID),
  248. * According to IB specification, It is 16-bit address assigned
  249. * by the Subnet Manager. Extended to be 32-bit for OmniPath users.
  250. */
  251. RDMA_NLDEV_ATTR_LID, /* u32 */
  252. RDMA_NLDEV_ATTR_SM_LID, /* u32 */
  253. /*
  254. * LID mask control (LMC)
  255. */
  256. RDMA_NLDEV_ATTR_LMC, /* u8 */
  257. RDMA_NLDEV_ATTR_PORT_STATE, /* u8 */
  258. RDMA_NLDEV_ATTR_PORT_PHYS_STATE, /* u8 */
  259. RDMA_NLDEV_ATTR_DEV_NODE_TYPE, /* u8 */
  260. RDMA_NLDEV_ATTR_MAX
  261. };
  262. #endif /* _UAPI_RDMA_NETLINK_H */