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,
22 #define RDMA_NL_GET_CLIENT(type) ((type & (((1 << 6) - 1) << 10)) >> 10)
23 #define RDMA_NL_GET_OP(type) (type & ((1 << 10) - 1))
24 #define RDMA_NL_GET_TYPE(client, op) ((client << 10) + op)
26 /* The minimum version that the iwpm kernel supports */
27 #define IWPM_UABI_VERSION_MIN 3
29 /* The latest version that the iwpm kernel supports */
30 #define IWPM_UABI_VERSION 4
32 /* iwarp port mapper message flags */
35 /* Do not map the port for this IWPM request */
36 IWPM_FLAGS_NO_PORT_MAP
= (1 << 0),
39 /* iwarp port mapper op-codes */
41 RDMA_NL_IWPM_REG_PID
= 0,
42 RDMA_NL_IWPM_ADD_MAPPING
,
43 RDMA_NL_IWPM_QUERY_MAPPING
,
44 RDMA_NL_IWPM_REMOVE_MAPPING
,
45 RDMA_NL_IWPM_REMOTE_INFO
,
46 RDMA_NL_IWPM_HANDLE_ERR
,
48 RDMA_NL_IWPM_MAPINFO_NUM
,
54 IWPM_NLA_REG_PID_UNSPEC
= 0,
57 IWPM_NLA_REG_IBDEV_NAME
,
58 IWPM_NLA_REG_ULIB_NAME
,
63 IWPM_NLA_RREG_PID_UNSPEC
= 0,
64 IWPM_NLA_RREG_PID_SEQ
,
65 IWPM_NLA_RREG_IBDEV_NAME
,
66 IWPM_NLA_RREG_ULIB_NAME
,
67 IWPM_NLA_RREG_ULIB_VER
,
68 IWPM_NLA_RREG_PID_ERR
,
74 IWPM_NLA_MANAGE_MAPPING_UNSPEC
= 0,
75 IWPM_NLA_MANAGE_MAPPING_SEQ
,
77 IWPM_NLA_MANAGE_FLAGS
,
78 IWPM_NLA_MANAGE_MAPPING_MAX
82 IWPM_NLA_RMANAGE_MAPPING_UNSPEC
= 0,
83 IWPM_NLA_RMANAGE_MAPPING_SEQ
,
84 IWPM_NLA_RMANAGE_ADDR
,
85 IWPM_NLA_RMANAGE_MAPPED_LOC_ADDR
,
86 /* The following maintains bisectability of rdma-core */
87 IWPM_NLA_MANAGE_MAPPED_LOC_ADDR
= IWPM_NLA_RMANAGE_MAPPED_LOC_ADDR
,
88 IWPM_NLA_RMANAGE_MAPPING_ERR
,
89 IWPM_NLA_RMANAGE_MAPPING_MAX
92 #define IWPM_NLA_MAPINFO_SEND_MAX 3
93 #define IWPM_NLA_REMOVE_MAPPING_MAX 3
96 IWPM_NLA_QUERY_MAPPING_UNSPEC
= 0,
97 IWPM_NLA_QUERY_MAPPING_SEQ
,
98 IWPM_NLA_QUERY_LOCAL_ADDR
,
99 IWPM_NLA_QUERY_REMOTE_ADDR
,
100 IWPM_NLA_QUERY_FLAGS
,
101 IWPM_NLA_QUERY_MAPPING_MAX
,
105 IWPM_NLA_RQUERY_MAPPING_UNSPEC
= 0,
106 IWPM_NLA_RQUERY_MAPPING_SEQ
,
107 IWPM_NLA_RQUERY_LOCAL_ADDR
,
108 IWPM_NLA_RQUERY_REMOTE_ADDR
,
109 IWPM_NLA_RQUERY_MAPPED_LOC_ADDR
,
110 IWPM_NLA_RQUERY_MAPPED_REM_ADDR
,
111 IWPM_NLA_RQUERY_MAPPING_ERR
,
112 IWPM_NLA_RQUERY_MAPPING_MAX
116 IWPM_NLA_MAPINFO_REQ_UNSPEC
= 0,
117 IWPM_NLA_MAPINFO_ULIB_NAME
,
118 IWPM_NLA_MAPINFO_ULIB_VER
,
119 IWPM_NLA_MAPINFO_REQ_MAX
123 IWPM_NLA_MAPINFO_UNSPEC
= 0,
124 IWPM_NLA_MAPINFO_LOCAL_ADDR
,
125 IWPM_NLA_MAPINFO_MAPPED_ADDR
,
126 IWPM_NLA_MAPINFO_FLAGS
,
131 IWPM_NLA_MAPINFO_NUM_UNSPEC
= 0,
132 IWPM_NLA_MAPINFO_SEQ
,
133 IWPM_NLA_MAPINFO_SEND_NUM
,
134 IWPM_NLA_MAPINFO_ACK_NUM
,
135 IWPM_NLA_MAPINFO_NUM_MAX
139 IWPM_NLA_ERR_UNSPEC
= 0,
146 IWPM_NLA_HELLO_UNSPEC
= 0,
147 IWPM_NLA_HELLO_ABI_VERSION
,
151 /* For RDMA_NLDEV_ATTR_DEV_NODE_TYPE */
153 /* IB values map to NodeInfo:NodeType. */
160 RDMA_NODE_UNSPECIFIED
,
164 * Local service operations:
165 * RESOLVE - The client requests the local service to resolve a path.
166 * SET_TIMEOUT - The local service requests the client to set the timeout.
167 * IP_RESOLVE - The client requests the local service to resolve an IP to GID.
170 RDMA_NL_LS_OP_RESOLVE
= 0,
171 RDMA_NL_LS_OP_SET_TIMEOUT
,
172 RDMA_NL_LS_OP_IP_RESOLVE
,
176 /* Local service netlink message flags */
177 #define RDMA_NL_LS_F_ERR 0x0100 /* Failed response */
180 * Local service resolve operation family header.
181 * The layout for the resolve operation:
188 * Local service path use:
189 * Specify how the path(s) will be used.
190 * ALL - For connected CM operation (6 pathrecords)
191 * UNIDIRECTIONAL - For unidirectional UD (1 pathrecord)
192 * GMP - For miscellaneous GMP like operation (at least 1 reversible
196 LS_RESOLVE_PATH_USE_ALL
= 0,
197 LS_RESOLVE_PATH_USE_UNIDIRECTIONAL
,
198 LS_RESOLVE_PATH_USE_GMP
,
199 LS_RESOLVE_PATH_USE_MAX
202 #define LS_DEVICE_NAME_MAX 64
204 struct rdma_ls_resolve_header
{
205 __u8 device_name
[LS_DEVICE_NAME_MAX
];
210 struct rdma_ls_ip_resolve_header
{
214 /* Local service attribute type */
215 #define RDMA_NLA_F_MANDATORY (1 << 13)
216 #define RDMA_NLA_TYPE_MASK (~(NLA_F_NESTED | NLA_F_NET_BYTEORDER | \
217 RDMA_NLA_F_MANDATORY))
220 * Local service attributes:
221 * Attr Name Size Byte order
222 * -----------------------------------------------------
223 * PATH_RECORD struct ib_path_rec_data
235 LS_NLA_TYPE_UNSPEC
= 0,
236 LS_NLA_TYPE_PATH_RECORD
,
238 LS_NLA_TYPE_SERVICE_ID
,
243 LS_NLA_TYPE_QOS_CLASS
,
249 /* Local service DGID/SGID attribute: big endian */
250 struct rdma_nla_ls_gid
{
254 enum rdma_nldev_command
{
255 RDMA_NLDEV_CMD_UNSPEC
,
257 RDMA_NLDEV_CMD_GET
, /* can dump */
260 RDMA_NLDEV_CMD_NEWLINK
,
262 RDMA_NLDEV_CMD_DELLINK
,
264 RDMA_NLDEV_CMD_PORT_GET
, /* can dump */
266 RDMA_NLDEV_CMD_SYS_GET
,
267 RDMA_NLDEV_CMD_SYS_SET
,
269 /* 8 is free to use */
271 RDMA_NLDEV_CMD_RES_GET
= 9, /* can dump */
273 RDMA_NLDEV_CMD_RES_QP_GET
, /* can dump */
275 RDMA_NLDEV_CMD_RES_CM_ID_GET
, /* can dump */
277 RDMA_NLDEV_CMD_RES_CQ_GET
, /* can dump */
279 RDMA_NLDEV_CMD_RES_MR_GET
, /* can dump */
281 RDMA_NLDEV_CMD_RES_PD_GET
, /* can dump */
283 RDMA_NLDEV_CMD_GET_CHARDEV
,
285 RDMA_NLDEV_CMD_STAT_SET
,
287 RDMA_NLDEV_CMD_STAT_GET
, /* can dump */
289 RDMA_NLDEV_CMD_STAT_DEL
,
291 RDMA_NLDEV_CMD_RES_QP_GET_RAW
,
293 RDMA_NLDEV_CMD_RES_CQ_GET_RAW
,
295 RDMA_NLDEV_CMD_RES_MR_GET_RAW
,
297 RDMA_NLDEV_CMD_RES_CTX_GET
, /* can dump */
299 RDMA_NLDEV_CMD_RES_SRQ_GET
, /* can dump */
301 RDMA_NLDEV_CMD_STAT_GET_STATUS
,
303 RDMA_NLDEV_CMD_RES_SRQ_GET_RAW
,
305 RDMA_NLDEV_CMD_NEWDEV
,
307 RDMA_NLDEV_CMD_DELDEV
,
309 RDMA_NLDEV_CMD_MONITOR
,
314 enum rdma_nldev_print_type
{
315 RDMA_NLDEV_PRINT_TYPE_UNSPEC
,
316 RDMA_NLDEV_PRINT_TYPE_HEX
,
319 enum rdma_nldev_attr
{
320 /* don't change the order or add anything between, this is ABI! */
321 RDMA_NLDEV_ATTR_UNSPEC
,
323 /* Pad attribute for 64b alignment */
324 RDMA_NLDEV_ATTR_PAD
= RDMA_NLDEV_ATTR_UNSPEC
,
326 /* Identifier for ib_device */
327 RDMA_NLDEV_ATTR_DEV_INDEX
, /* u32 */
329 RDMA_NLDEV_ATTR_DEV_NAME
, /* string */
331 * Device index together with port index are identifiers
332 * for port/link properties.
334 * For RDMA_NLDEV_CMD_GET commamnd, port index will return number
335 * of available ports in ib_device, while for port specific operations,
336 * it will be real port index as it appears in sysfs. Port index follows
337 * sysfs notation and starts from 1 for the first port.
339 RDMA_NLDEV_ATTR_PORT_INDEX
, /* u32 */
342 * Device and port capabilities
344 * When used for port info, first 32-bits are CapabilityMask followed by
345 * 16-bit CapabilityMask2.
347 RDMA_NLDEV_ATTR_CAP_FLAGS
, /* u64 */
352 RDMA_NLDEV_ATTR_FW_VERSION
, /* string */
355 * Node GUID (in host byte order) associated with the RDMA device.
357 RDMA_NLDEV_ATTR_NODE_GUID
, /* u64 */
360 * System image GUID (in host byte order) associated with
361 * this RDMA device and other devices which are part of a
364 RDMA_NLDEV_ATTR_SYS_IMAGE_GUID
, /* u64 */
367 * Subnet prefix (in host byte order)
369 RDMA_NLDEV_ATTR_SUBNET_PREFIX
, /* u64 */
372 * Local Identifier (LID),
373 * According to IB specification, It is 16-bit address assigned
374 * by the Subnet Manager. Extended to be 32-bit for OmniPath users.
376 RDMA_NLDEV_ATTR_LID
, /* u32 */
377 RDMA_NLDEV_ATTR_SM_LID
, /* u32 */
380 * LID mask control (LMC)
382 RDMA_NLDEV_ATTR_LMC
, /* u8 */
384 RDMA_NLDEV_ATTR_PORT_STATE
, /* u8 */
385 RDMA_NLDEV_ATTR_PORT_PHYS_STATE
, /* u8 */
387 RDMA_NLDEV_ATTR_DEV_NODE_TYPE
, /* u8 */
389 RDMA_NLDEV_ATTR_RES_SUMMARY
, /* nested table */
390 RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY
, /* nested table */
391 RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_NAME
, /* string */
392 RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR
, /* u64 */
394 RDMA_NLDEV_ATTR_RES_QP
, /* nested table */
395 RDMA_NLDEV_ATTR_RES_QP_ENTRY
, /* nested table */
399 RDMA_NLDEV_ATTR_RES_LQPN
, /* u32 */
402 * Applicable for RC and UC only IBTA 11.2.5.3 QUERY QUEUE PAIR
404 RDMA_NLDEV_ATTR_RES_RQPN
, /* u32 */
407 * Applicable for RC and UC only 11.2.5.3 QUERY QUEUE PAIR
409 RDMA_NLDEV_ATTR_RES_RQ_PSN
, /* u32 */
413 RDMA_NLDEV_ATTR_RES_SQ_PSN
, /* u32 */
414 RDMA_NLDEV_ATTR_RES_PATH_MIG_STATE
, /* u8 */
416 * QP types as visible to RDMA/core, the reserved QPT
417 * are not exported through this interface.
419 RDMA_NLDEV_ATTR_RES_TYPE
, /* u8 */
420 RDMA_NLDEV_ATTR_RES_STATE
, /* u8 */
422 * Process ID which created object,
423 * in case of kernel origin, PID won't exist.
425 RDMA_NLDEV_ATTR_RES_PID
, /* u32 */
427 * The name of process created following resource.
428 * It will exist only for kernel objects.
429 * For user created objects, the user is supposed
430 * to read /proc/PID/comm file.
432 RDMA_NLDEV_ATTR_RES_KERN_NAME
, /* string */
434 RDMA_NLDEV_ATTR_RES_CM_ID
, /* nested table */
435 RDMA_NLDEV_ATTR_RES_CM_ID_ENTRY
, /* nested table */
437 * rdma_cm_id port space.
439 RDMA_NLDEV_ATTR_RES_PS
, /* u32 */
441 * Source and destination socket addresses
443 RDMA_NLDEV_ATTR_RES_SRC_ADDR
, /* __kernel_sockaddr_storage */
444 RDMA_NLDEV_ATTR_RES_DST_ADDR
, /* __kernel_sockaddr_storage */
446 RDMA_NLDEV_ATTR_RES_CQ
, /* nested table */
447 RDMA_NLDEV_ATTR_RES_CQ_ENTRY
, /* nested table */
448 RDMA_NLDEV_ATTR_RES_CQE
, /* u32 */
449 RDMA_NLDEV_ATTR_RES_USECNT
, /* u64 */
450 RDMA_NLDEV_ATTR_RES_POLL_CTX
, /* u8 */
452 RDMA_NLDEV_ATTR_RES_MR
, /* nested table */
453 RDMA_NLDEV_ATTR_RES_MR_ENTRY
, /* nested table */
454 RDMA_NLDEV_ATTR_RES_RKEY
, /* u32 */
455 RDMA_NLDEV_ATTR_RES_LKEY
, /* u32 */
456 RDMA_NLDEV_ATTR_RES_IOVA
, /* u64 */
457 RDMA_NLDEV_ATTR_RES_MRLEN
, /* u64 */
459 RDMA_NLDEV_ATTR_RES_PD
, /* nested table */
460 RDMA_NLDEV_ATTR_RES_PD_ENTRY
, /* nested table */
461 RDMA_NLDEV_ATTR_RES_LOCAL_DMA_LKEY
, /* u32 */
462 RDMA_NLDEV_ATTR_RES_UNSAFE_GLOBAL_RKEY
, /* u32 */
464 * Provides logical name and index of netdevice which is
465 * connected to physical port. This information is relevant
466 * for RoCE and iWARP.
468 * The netdevices which are associated with containers are
469 * supposed to be exported together with GID table once it
470 * will be exposed through the netlink. Because the
471 * associated netdevices are properties of GIDs.
473 RDMA_NLDEV_ATTR_NDEV_INDEX
, /* u32 */
474 RDMA_NLDEV_ATTR_NDEV_NAME
, /* string */
476 * driver-specific attributes.
478 RDMA_NLDEV_ATTR_DRIVER
, /* nested table */
479 RDMA_NLDEV_ATTR_DRIVER_ENTRY
, /* nested table */
480 RDMA_NLDEV_ATTR_DRIVER_STRING
, /* string */
482 * u8 values from enum rdma_nldev_print_type
484 RDMA_NLDEV_ATTR_DRIVER_PRINT_TYPE
, /* u8 */
485 RDMA_NLDEV_ATTR_DRIVER_S32
, /* s32 */
486 RDMA_NLDEV_ATTR_DRIVER_U32
, /* u32 */
487 RDMA_NLDEV_ATTR_DRIVER_S64
, /* s64 */
488 RDMA_NLDEV_ATTR_DRIVER_U64
, /* u64 */
491 * Indexes to get/set secific entry,
492 * for QP use RDMA_NLDEV_ATTR_RES_LQPN
494 RDMA_NLDEV_ATTR_RES_PDN
, /* u32 */
495 RDMA_NLDEV_ATTR_RES_CQN
, /* u32 */
496 RDMA_NLDEV_ATTR_RES_MRN
, /* u32 */
497 RDMA_NLDEV_ATTR_RES_CM_IDN
, /* u32 */
498 RDMA_NLDEV_ATTR_RES_CTXN
, /* u32 */
500 * Identifies the rdma driver. eg: "rxe" or "siw"
502 RDMA_NLDEV_ATTR_LINK_TYPE
, /* string */
505 * net namespace mode for rdma subsystem:
506 * either shared or exclusive among multiple net namespaces.
508 RDMA_NLDEV_SYS_ATTR_NETNS_MODE
, /* u8 */
510 * Device protocol, e.g. ib, iw, usnic, roce and opa
512 RDMA_NLDEV_ATTR_DEV_PROTOCOL
, /* string */
515 * File descriptor handle of the net namespace object
517 RDMA_NLDEV_NET_NS_FD
, /* u32 */
519 * Information about a chardev.
520 * CHARDEV_TYPE is the name of the chardev ABI (ie uverbs, umad, etc)
521 * CHARDEV_ABI signals the ABI revision (historical)
522 * CHARDEV_NAME is the kernel name for the /dev/ file (no directory)
523 * CHARDEV is the 64 bit dev_t for the inode
525 RDMA_NLDEV_ATTR_CHARDEV_TYPE
, /* string */
526 RDMA_NLDEV_ATTR_CHARDEV_NAME
, /* string */
527 RDMA_NLDEV_ATTR_CHARDEV_ABI
, /* u64 */
528 RDMA_NLDEV_ATTR_CHARDEV
, /* u64 */
529 RDMA_NLDEV_ATTR_UVERBS_DRIVER_ID
, /* u64 */
531 * Counter-specific attributes.
533 RDMA_NLDEV_ATTR_STAT_MODE
, /* u32 */
534 RDMA_NLDEV_ATTR_STAT_RES
, /* u32 */
535 RDMA_NLDEV_ATTR_STAT_AUTO_MODE_MASK
, /* u32 */
536 RDMA_NLDEV_ATTR_STAT_COUNTER
, /* nested table */
537 RDMA_NLDEV_ATTR_STAT_COUNTER_ENTRY
, /* nested table */
538 RDMA_NLDEV_ATTR_STAT_COUNTER_ID
, /* u32 */
539 RDMA_NLDEV_ATTR_STAT_HWCOUNTERS
, /* nested table */
540 RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY
, /* nested table */
541 RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_NAME
, /* string */
542 RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_VALUE
, /* u64 */
545 * CQ adaptive moderatio (DIM)
547 RDMA_NLDEV_ATTR_DEV_DIM
, /* u8 */
549 RDMA_NLDEV_ATTR_RES_RAW
, /* binary */
551 RDMA_NLDEV_ATTR_RES_CTX
, /* nested table */
552 RDMA_NLDEV_ATTR_RES_CTX_ENTRY
, /* nested table */
554 RDMA_NLDEV_ATTR_RES_SRQ
, /* nested table */
555 RDMA_NLDEV_ATTR_RES_SRQ_ENTRY
, /* nested table */
556 RDMA_NLDEV_ATTR_RES_SRQN
, /* u32 */
558 RDMA_NLDEV_ATTR_MIN_RANGE
, /* u32 */
559 RDMA_NLDEV_ATTR_MAX_RANGE
, /* u32 */
561 RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK
, /* u8 */
563 RDMA_NLDEV_ATTR_STAT_HWCOUNTER_INDEX
, /* u32 */
564 RDMA_NLDEV_ATTR_STAT_HWCOUNTER_DYNAMIC
, /* u8 */
566 RDMA_NLDEV_SYS_ATTR_PRIVILEGED_QKEY_MODE
, /* u8 */
568 RDMA_NLDEV_ATTR_DRIVER_DETAILS
, /* u8 */
570 * QP subtype string, used for driver QPs
572 RDMA_NLDEV_ATTR_RES_SUBTYPE
, /* string */
574 RDMA_NLDEV_ATTR_DEV_TYPE
, /* u8 */
576 RDMA_NLDEV_ATTR_PARENT_NAME
, /* string */
578 RDMA_NLDEV_ATTR_NAME_ASSIGN_TYPE
, /* u8 */
580 RDMA_NLDEV_ATTR_EVENT_TYPE
, /* u8 */
582 RDMA_NLDEV_SYS_ATTR_MONITOR_MODE
, /* u8 */
590 * Supported counter bind modes. All modes are mutual-exclusive.
592 enum rdma_nl_counter_mode
{
593 RDMA_COUNTER_MODE_NONE
,
596 * A qp is bound with a counter automatically during initialization
597 * based on the auto mode (e.g., qp type, ...)
599 RDMA_COUNTER_MODE_AUTO
,
602 * Which qp are bound with which counter is explicitly specified
605 RDMA_COUNTER_MODE_MANUAL
,
610 RDMA_COUNTER_MODE_MAX
,
614 * Supported criteria in counter auto mode.
615 * Currently only "qp type" is supported
617 enum rdma_nl_counter_mask
{
618 RDMA_COUNTER_MASK_QP_TYPE
= 1,
619 RDMA_COUNTER_MASK_PID
= 1 << 1,
622 /* Supported rdma device types. */
623 enum rdma_nl_dev_type
{
624 RDMA_DEVICE_TYPE_SMI
= 1,
627 /* RDMA device name assignment types */
628 enum rdma_nl_name_assign_type
{
629 RDMA_NAME_ASSIGN_TYPE_UNKNOWN
= 0,
630 RDMA_NAME_ASSIGN_TYPE_USER
= 1, /* Provided by user-space */
634 * Supported rdma monitoring event types.
636 enum rdma_nl_notify_event_type
{
638 RDMA_UNREGISTER_EVENT
,
639 RDMA_NETDEV_ATTACH_EVENT
,
640 RDMA_NETDEV_DETACH_EVENT
,
642 RDMA_NETDEV_RENAME_EVENT
,
645 #endif /* _UAPI_RDMA_NETLINK_H */