1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef _UAPI_RDMA_NETLINK_H
3 #define _UAPI_RDMA_NETLINK_H
5 #include <linux/types.h>
10 RDMA_NL_LS, /* RDMA Local Services */
11 RDMA_NL_NLDEV, /* RDMA device interface */
16 RDMA_NL_GROUP_IWPM = 2,
21 #define RDMA_NL_GET_CLIENT(type) ((type & (((1 << 6) - 1) << 10)) >> 10)
22 #define RDMA_NL_GET_OP(type) (type & ((1 << 10) - 1))
23 #define RDMA_NL_GET_TYPE(client, op) ((client << 10) + op)
25 /* The minimum version that the iwpm kernel supports */
26 #define IWPM_UABI_VERSION_MIN 3
28 /* The latest version that the iwpm kernel supports */
29 #define IWPM_UABI_VERSION 4
31 /* iwarp port mapper message flags */
34 /* Do not map the port for this IWPM request */
35 IWPM_FLAGS_NO_PORT_MAP = (1 << 0),
38 /* iwarp port mapper op-codes */
40 RDMA_NL_IWPM_REG_PID = 0,
41 RDMA_NL_IWPM_ADD_MAPPING,
42 RDMA_NL_IWPM_QUERY_MAPPING,
43 RDMA_NL_IWPM_REMOVE_MAPPING,
44 RDMA_NL_IWPM_REMOTE_INFO,
45 RDMA_NL_IWPM_HANDLE_ERR,
47 RDMA_NL_IWPM_MAPINFO_NUM,
53 IWPM_NLA_REG_PID_UNSPEC = 0,
56 IWPM_NLA_REG_IBDEV_NAME,
57 IWPM_NLA_REG_ULIB_NAME,
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,
73 IWPM_NLA_MANAGE_MAPPING_UNSPEC = 0,
74 IWPM_NLA_MANAGE_MAPPING_SEQ,
76 IWPM_NLA_MANAGE_FLAGS,
77 IWPM_NLA_MANAGE_MAPPING_MAX
81 IWPM_NLA_RMANAGE_MAPPING_UNSPEC = 0,
82 IWPM_NLA_RMANAGE_MAPPING_SEQ,
83 IWPM_NLA_RMANAGE_ADDR,
84 IWPM_NLA_RMANAGE_MAPPED_LOC_ADDR,
85 /* The following maintains bisectability of rdma-core */
86 IWPM_NLA_MANAGE_MAPPED_LOC_ADDR = IWPM_NLA_RMANAGE_MAPPED_LOC_ADDR,
87 IWPM_NLA_RMANAGE_MAPPING_ERR,
88 IWPM_NLA_RMANAGE_MAPPING_MAX
91 #define IWPM_NLA_MAPINFO_SEND_MAX 3
92 #define IWPM_NLA_REMOVE_MAPPING_MAX 3
95 IWPM_NLA_QUERY_MAPPING_UNSPEC = 0,
96 IWPM_NLA_QUERY_MAPPING_SEQ,
97 IWPM_NLA_QUERY_LOCAL_ADDR,
98 IWPM_NLA_QUERY_REMOTE_ADDR,
100 IWPM_NLA_QUERY_MAPPING_MAX,
104 IWPM_NLA_RQUERY_MAPPING_UNSPEC = 0,
105 IWPM_NLA_RQUERY_MAPPING_SEQ,
106 IWPM_NLA_RQUERY_LOCAL_ADDR,
107 IWPM_NLA_RQUERY_REMOTE_ADDR,
108 IWPM_NLA_RQUERY_MAPPED_LOC_ADDR,
109 IWPM_NLA_RQUERY_MAPPED_REM_ADDR,
110 IWPM_NLA_RQUERY_MAPPING_ERR,
111 IWPM_NLA_RQUERY_MAPPING_MAX
115 IWPM_NLA_MAPINFO_REQ_UNSPEC = 0,
116 IWPM_NLA_MAPINFO_ULIB_NAME,
117 IWPM_NLA_MAPINFO_ULIB_VER,
118 IWPM_NLA_MAPINFO_REQ_MAX
122 IWPM_NLA_MAPINFO_UNSPEC = 0,
123 IWPM_NLA_MAPINFO_LOCAL_ADDR,
124 IWPM_NLA_MAPINFO_MAPPED_ADDR,
125 IWPM_NLA_MAPINFO_FLAGS,
130 IWPM_NLA_MAPINFO_NUM_UNSPEC = 0,
131 IWPM_NLA_MAPINFO_SEQ,
132 IWPM_NLA_MAPINFO_SEND_NUM,
133 IWPM_NLA_MAPINFO_ACK_NUM,
134 IWPM_NLA_MAPINFO_NUM_MAX
138 IWPM_NLA_ERR_UNSPEC = 0,
145 IWPM_NLA_HELLO_UNSPEC = 0,
146 IWPM_NLA_HELLO_ABI_VERSION,
151 * Local service operations:
152 * RESOLVE - The client requests the local service to resolve a path.
153 * SET_TIMEOUT - The local service requests the client to set the timeout.
154 * IP_RESOLVE - The client requests the local service to resolve an IP to GID.
157 RDMA_NL_LS_OP_RESOLVE = 0,
158 RDMA_NL_LS_OP_SET_TIMEOUT,
159 RDMA_NL_LS_OP_IP_RESOLVE,
163 /* Local service netlink message flags */
164 #define RDMA_NL_LS_F_ERR 0x0100 /* Failed response */
167 * Local service resolve operation family header.
168 * The layout for the resolve operation:
175 * Local service path use:
176 * Specify how the path(s) will be used.
177 * ALL - For connected CM operation (6 pathrecords)
178 * UNIDIRECTIONAL - For unidirectional UD (1 pathrecord)
179 * GMP - For miscellaneous GMP like operation (at least 1 reversible
183 LS_RESOLVE_PATH_USE_ALL = 0,
184 LS_RESOLVE_PATH_USE_UNIDIRECTIONAL,
185 LS_RESOLVE_PATH_USE_GMP,
186 LS_RESOLVE_PATH_USE_MAX
189 #define LS_DEVICE_NAME_MAX 64
191 struct rdma_ls_resolve_header {
192 __u8 device_name[LS_DEVICE_NAME_MAX];
197 struct rdma_ls_ip_resolve_header {
201 /* Local service attribute type */
202 #define RDMA_NLA_F_MANDATORY (1 << 13)
203 #define RDMA_NLA_TYPE_MASK (~(NLA_F_NESTED | NLA_F_NET_BYTEORDER | \
204 RDMA_NLA_F_MANDATORY))
207 * Local service attributes:
208 * Attr Name Size Byte order
209 * -----------------------------------------------------
210 * PATH_RECORD struct ib_path_rec_data
222 LS_NLA_TYPE_UNSPEC = 0,
223 LS_NLA_TYPE_PATH_RECORD,
225 LS_NLA_TYPE_SERVICE_ID,
230 LS_NLA_TYPE_QOS_CLASS,
236 /* Local service DGID/SGID attribute: big endian */
237 struct rdma_nla_ls_gid {
241 enum rdma_nldev_command {
242 RDMA_NLDEV_CMD_UNSPEC,
244 RDMA_NLDEV_CMD_GET, /* can dump */
247 RDMA_NLDEV_CMD_NEWLINK,
249 RDMA_NLDEV_CMD_DELLINK,
251 RDMA_NLDEV_CMD_PORT_GET, /* can dump */
253 RDMA_NLDEV_CMD_SYS_GET,
254 RDMA_NLDEV_CMD_SYS_SET,
256 /* 8 is free to use */
258 RDMA_NLDEV_CMD_RES_GET = 9, /* can dump */
260 RDMA_NLDEV_CMD_RES_QP_GET, /* can dump */
262 RDMA_NLDEV_CMD_RES_CM_ID_GET, /* can dump */
264 RDMA_NLDEV_CMD_RES_CQ_GET, /* can dump */
266 RDMA_NLDEV_CMD_RES_MR_GET, /* can dump */
268 RDMA_NLDEV_CMD_RES_PD_GET, /* can dump */
274 RDMA_NLDEV_ATTR_ENTRY_STRLEN = 16,
277 enum rdma_nldev_print_type {
278 RDMA_NLDEV_PRINT_TYPE_UNSPEC,
279 RDMA_NLDEV_PRINT_TYPE_HEX,
282 enum rdma_nldev_attr {
283 /* don't change the order or add anything between, this is ABI! */
284 RDMA_NLDEV_ATTR_UNSPEC,
286 /* Pad attribute for 64b alignment */
287 RDMA_NLDEV_ATTR_PAD = RDMA_NLDEV_ATTR_UNSPEC,
289 /* Identifier for ib_device */
290 RDMA_NLDEV_ATTR_DEV_INDEX, /* u32 */
292 RDMA_NLDEV_ATTR_DEV_NAME, /* string */
294 * Device index together with port index are identifiers
295 * for port/link properties.
297 * For RDMA_NLDEV_CMD_GET commamnd, port index will return number
298 * of available ports in ib_device, while for port specific operations,
299 * it will be real port index as it appears in sysfs. Port index follows
300 * sysfs notation and starts from 1 for the first port.
302 RDMA_NLDEV_ATTR_PORT_INDEX, /* u32 */
305 * Device and port capabilities
307 * When used for port info, first 32-bits are CapabilityMask followed by
308 * 16-bit CapabilityMask2.
310 RDMA_NLDEV_ATTR_CAP_FLAGS, /* u64 */
315 RDMA_NLDEV_ATTR_FW_VERSION, /* string */
318 * Node GUID (in host byte order) associated with the RDMA device.
320 RDMA_NLDEV_ATTR_NODE_GUID, /* u64 */
323 * System image GUID (in host byte order) associated with
324 * this RDMA device and other devices which are part of a
327 RDMA_NLDEV_ATTR_SYS_IMAGE_GUID, /* u64 */
330 * Subnet prefix (in host byte order)
332 RDMA_NLDEV_ATTR_SUBNET_PREFIX, /* u64 */
335 * Local Identifier (LID),
336 * According to IB specification, It is 16-bit address assigned
337 * by the Subnet Manager. Extended to be 32-bit for OmniPath users.
339 RDMA_NLDEV_ATTR_LID, /* u32 */
340 RDMA_NLDEV_ATTR_SM_LID, /* u32 */
343 * LID mask control (LMC)
345 RDMA_NLDEV_ATTR_LMC, /* u8 */
347 RDMA_NLDEV_ATTR_PORT_STATE, /* u8 */
348 RDMA_NLDEV_ATTR_PORT_PHYS_STATE, /* u8 */
350 RDMA_NLDEV_ATTR_DEV_NODE_TYPE, /* u8 */
352 RDMA_NLDEV_ATTR_RES_SUMMARY, /* nested table */
353 RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY, /* nested table */
354 RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_NAME, /* string */
355 RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR, /* u64 */
357 RDMA_NLDEV_ATTR_RES_QP, /* nested table */
358 RDMA_NLDEV_ATTR_RES_QP_ENTRY, /* nested table */
362 RDMA_NLDEV_ATTR_RES_LQPN, /* u32 */
365 * Applicable for RC and UC only IBTA 11.2.5.3 QUERY QUEUE PAIR
367 RDMA_NLDEV_ATTR_RES_RQPN, /* u32 */
370 * Applicable for RC and UC only 11.2.5.3 QUERY QUEUE PAIR
372 RDMA_NLDEV_ATTR_RES_RQ_PSN, /* u32 */
376 RDMA_NLDEV_ATTR_RES_SQ_PSN, /* u32 */
377 RDMA_NLDEV_ATTR_RES_PATH_MIG_STATE, /* u8 */
379 * QP types as visible to RDMA/core, the reserved QPT
380 * are not exported through this interface.
382 RDMA_NLDEV_ATTR_RES_TYPE, /* u8 */
383 RDMA_NLDEV_ATTR_RES_STATE, /* u8 */
385 * Process ID which created object,
386 * in case of kernel origin, PID won't exist.
388 RDMA_NLDEV_ATTR_RES_PID, /* u32 */
390 * The name of process created following resource.
391 * It will exist only for kernel objects.
392 * For user created objects, the user is supposed
393 * to read /proc/PID/comm file.
395 RDMA_NLDEV_ATTR_RES_KERN_NAME, /* string */
397 RDMA_NLDEV_ATTR_RES_CM_ID, /* nested table */
398 RDMA_NLDEV_ATTR_RES_CM_ID_ENTRY, /* nested table */
400 * rdma_cm_id port space.
402 RDMA_NLDEV_ATTR_RES_PS, /* u32 */
404 * Source and destination socket addresses
406 RDMA_NLDEV_ATTR_RES_SRC_ADDR, /* __kernel_sockaddr_storage */
407 RDMA_NLDEV_ATTR_RES_DST_ADDR, /* __kernel_sockaddr_storage */
409 RDMA_NLDEV_ATTR_RES_CQ, /* nested table */
410 RDMA_NLDEV_ATTR_RES_CQ_ENTRY, /* nested table */
411 RDMA_NLDEV_ATTR_RES_CQE, /* u32 */
412 RDMA_NLDEV_ATTR_RES_USECNT, /* u64 */
413 RDMA_NLDEV_ATTR_RES_POLL_CTX, /* u8 */
415 RDMA_NLDEV_ATTR_RES_MR, /* nested table */
416 RDMA_NLDEV_ATTR_RES_MR_ENTRY, /* nested table */
417 RDMA_NLDEV_ATTR_RES_RKEY, /* u32 */
418 RDMA_NLDEV_ATTR_RES_LKEY, /* u32 */
419 RDMA_NLDEV_ATTR_RES_IOVA, /* u64 */
420 RDMA_NLDEV_ATTR_RES_MRLEN, /* u64 */
422 RDMA_NLDEV_ATTR_RES_PD, /* nested table */
423 RDMA_NLDEV_ATTR_RES_PD_ENTRY, /* nested table */
424 RDMA_NLDEV_ATTR_RES_LOCAL_DMA_LKEY, /* u32 */
425 RDMA_NLDEV_ATTR_RES_UNSAFE_GLOBAL_RKEY, /* u32 */
427 * Provides logical name and index of netdevice which is
428 * connected to physical port. This information is relevant
429 * for RoCE and iWARP.
431 * The netdevices which are associated with containers are
432 * supposed to be exported together with GID table once it
433 * will be exposed through the netlink. Because the
434 * associated netdevices are properties of GIDs.
436 RDMA_NLDEV_ATTR_NDEV_INDEX, /* u32 */
437 RDMA_NLDEV_ATTR_NDEV_NAME, /* string */
439 * driver-specific attributes.
441 RDMA_NLDEV_ATTR_DRIVER, /* nested table */
442 RDMA_NLDEV_ATTR_DRIVER_ENTRY, /* nested table */
443 RDMA_NLDEV_ATTR_DRIVER_STRING, /* string */
445 * u8 values from enum rdma_nldev_print_type
447 RDMA_NLDEV_ATTR_DRIVER_PRINT_TYPE, /* u8 */
448 RDMA_NLDEV_ATTR_DRIVER_S32, /* s32 */
449 RDMA_NLDEV_ATTR_DRIVER_U32, /* u32 */
450 RDMA_NLDEV_ATTR_DRIVER_S64, /* s64 */
451 RDMA_NLDEV_ATTR_DRIVER_U64, /* u64 */
454 * Indexes to get/set secific entry,
455 * for QP use RDMA_NLDEV_ATTR_RES_LQPN
457 RDMA_NLDEV_ATTR_RES_PDN, /* u32 */
458 RDMA_NLDEV_ATTR_RES_CQN, /* u32 */
459 RDMA_NLDEV_ATTR_RES_MRN, /* u32 */
460 RDMA_NLDEV_ATTR_RES_CM_IDN, /* u32 */
461 RDMA_NLDEV_ATTR_RES_CTXN, /* u32 */
463 * Identifies the rdma driver. eg: "rxe" or "siw"
465 RDMA_NLDEV_ATTR_LINK_TYPE, /* string */
468 * net namespace mode for rdma subsystem:
469 * either shared or exclusive among multiple net namespaces.
471 RDMA_NLDEV_SYS_ATTR_NETNS_MODE, /* u8 */
473 * Device protocol, e.g. ib, iw, usnic, roce and opa
475 RDMA_NLDEV_ATTR_DEV_PROTOCOL, /* string */
478 * File descriptor handle of the net namespace object
480 RDMA_NLDEV_NET_NS_FD, /* u32 */
487 #endif /* _UAPI_RDMA_NETLINK_H */