1
2#ifndef _RDMA_NETLINK_H
3#define _RDMA_NETLINK_H
4
5#include <linux/types.h>
6
7enum {
8 RDMA_NL_IWCM = 2,
9 RDMA_NL_RSVD,
10 RDMA_NL_LS,
11 RDMA_NL_NLDEV,
12 RDMA_NL_NUM_CLIENTS
13};
14
15enum {
16 RDMA_NL_GROUP_IWPM = 2,
17 RDMA_NL_GROUP_LS,
18 RDMA_NL_NUM_GROUPS
19};
20
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)
24
25
26#define IWPM_UABI_VERSION_MIN 3
27
28
29#define IWPM_UABI_VERSION 4
30
31
32enum {
33
34
35 IWPM_FLAGS_NO_PORT_MAP = (1 << 0),
36};
37
38
39enum {
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,
46 RDMA_NL_IWPM_MAPINFO,
47 RDMA_NL_IWPM_MAPINFO_NUM,
48 RDMA_NL_IWPM_HELLO,
49 RDMA_NL_IWPM_NUM_OPS
50};
51
52enum {
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
61enum {
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};
71
72enum {
73 IWPM_NLA_MANAGE_MAPPING_UNSPEC = 0,
74 IWPM_NLA_MANAGE_MAPPING_SEQ,
75 IWPM_NLA_MANAGE_ADDR,
76 IWPM_NLA_MANAGE_FLAGS,
77 IWPM_NLA_MANAGE_MAPPING_MAX
78};
79
80enum {
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
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
89};
90
91#define IWPM_NLA_MAPINFO_SEND_MAX 3
92#define IWPM_NLA_REMOVE_MAPPING_MAX 3
93
94enum {
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,
99 IWPM_NLA_QUERY_FLAGS,
100 IWPM_NLA_QUERY_MAPPING_MAX,
101};
102
103enum {
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
112};
113
114enum {
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
119};
120
121enum {
122 IWPM_NLA_MAPINFO_UNSPEC = 0,
123 IWPM_NLA_MAPINFO_LOCAL_ADDR,
124 IWPM_NLA_MAPINFO_MAPPED_ADDR,
125 IWPM_NLA_MAPINFO_FLAGS,
126 IWPM_NLA_MAPINFO_MAX
127};
128
129enum {
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
135};
136
137enum {
138 IWPM_NLA_ERR_UNSPEC = 0,
139 IWPM_NLA_ERR_SEQ,
140 IWPM_NLA_ERR_CODE,
141 IWPM_NLA_ERR_MAX
142};
143
144enum {
145 IWPM_NLA_HELLO_UNSPEC = 0,
146 IWPM_NLA_HELLO_ABI_VERSION,
147 IWPM_NLA_HELLO_MAX
148};
149
150
151enum {
152
153 RDMA_NODE_IB_CA = 1,
154 RDMA_NODE_IB_SWITCH,
155 RDMA_NODE_IB_ROUTER,
156 RDMA_NODE_RNIC,
157 RDMA_NODE_USNIC,
158 RDMA_NODE_USNIC_UDP,
159 RDMA_NODE_UNSPECIFIED,
160};
161
162
163
164
165
166
167
168enum {
169 RDMA_NL_LS_OP_RESOLVE = 0,
170 RDMA_NL_LS_OP_SET_TIMEOUT,
171 RDMA_NL_LS_OP_IP_RESOLVE,
172 RDMA_NL_LS_NUM_OPS
173};
174
175
176#define RDMA_NL_LS_F_ERR 0x0100
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194enum {
195 LS_RESOLVE_PATH_USE_ALL = 0,
196 LS_RESOLVE_PATH_USE_UNIDIRECTIONAL,
197 LS_RESOLVE_PATH_USE_GMP,
198 LS_RESOLVE_PATH_USE_MAX
199};
200
201#define LS_DEVICE_NAME_MAX 64
202
203struct rdma_ls_resolve_header {
204 __u8 device_name[LS_DEVICE_NAME_MAX];
205 __u8 port_num;
206 __u8 path_use;
207};
208
209struct rdma_ls_ip_resolve_header {
210 __u32 ifindex;
211};
212
213
214#define RDMA_NLA_F_MANDATORY (1 << 13)
215#define RDMA_NLA_TYPE_MASK (~(NLA_F_NESTED | NLA_F_NET_BYTEORDER | \
216 RDMA_NLA_F_MANDATORY))
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233enum {
234 LS_NLA_TYPE_UNSPEC = 0,
235 LS_NLA_TYPE_PATH_RECORD,
236 LS_NLA_TYPE_TIMEOUT,
237 LS_NLA_TYPE_SERVICE_ID,
238 LS_NLA_TYPE_DGID,
239 LS_NLA_TYPE_SGID,
240 LS_NLA_TYPE_TCLASS,
241 LS_NLA_TYPE_PKEY,
242 LS_NLA_TYPE_QOS_CLASS,
243 LS_NLA_TYPE_IPV4,
244 LS_NLA_TYPE_IPV6,
245 LS_NLA_TYPE_MAX
246};
247
248
249struct rdma_nla_ls_gid {
250 __u8 gid[16];
251};
252
253enum rdma_nldev_command {
254 RDMA_NLDEV_CMD_UNSPEC,
255
256 RDMA_NLDEV_CMD_GET,
257 RDMA_NLDEV_CMD_SET,
258
259 RDMA_NLDEV_CMD_NEWLINK,
260
261 RDMA_NLDEV_CMD_DELLINK,
262
263 RDMA_NLDEV_CMD_PORT_GET,
264
265 RDMA_NLDEV_CMD_SYS_GET,
266 RDMA_NLDEV_CMD_SYS_SET,
267
268
269
270 RDMA_NLDEV_CMD_RES_GET = 9,
271
272 RDMA_NLDEV_CMD_RES_QP_GET,
273
274 RDMA_NLDEV_CMD_RES_CM_ID_GET,
275
276 RDMA_NLDEV_CMD_RES_CQ_GET,
277
278 RDMA_NLDEV_CMD_RES_MR_GET,
279
280 RDMA_NLDEV_CMD_RES_PD_GET,
281
282 RDMA_NLDEV_CMD_GET_CHARDEV,
283
284 RDMA_NLDEV_CMD_STAT_SET,
285
286 RDMA_NLDEV_CMD_STAT_GET,
287
288 RDMA_NLDEV_CMD_STAT_DEL,
289
290 RDMA_NLDEV_CMD_RES_QP_GET_RAW,
291
292 RDMA_NLDEV_CMD_RES_CQ_GET_RAW,
293
294 RDMA_NLDEV_CMD_RES_MR_GET_RAW,
295
296 RDMA_NLDEV_CMD_RES_CTX_GET,
297
298 RDMA_NLDEV_CMD_RES_SRQ_GET,
299
300 RDMA_NLDEV_CMD_STAT_GET_STATUS,
301
302 RDMA_NLDEV_NUM_OPS
303};
304
305enum rdma_nldev_print_type {
306 RDMA_NLDEV_PRINT_TYPE_UNSPEC,
307 RDMA_NLDEV_PRINT_TYPE_HEX,
308};
309
310enum rdma_nldev_attr {
311
312 RDMA_NLDEV_ATTR_UNSPEC,
313
314
315 RDMA_NLDEV_ATTR_PAD = RDMA_NLDEV_ATTR_UNSPEC,
316
317
318 RDMA_NLDEV_ATTR_DEV_INDEX,
319
320 RDMA_NLDEV_ATTR_DEV_NAME,
321
322
323
324
325
326
327
328
329
330 RDMA_NLDEV_ATTR_PORT_INDEX,
331
332
333
334
335
336
337
338 RDMA_NLDEV_ATTR_CAP_FLAGS,
339
340
341
342
343 RDMA_NLDEV_ATTR_FW_VERSION,
344
345
346
347
348 RDMA_NLDEV_ATTR_NODE_GUID,
349
350
351
352
353
354
355 RDMA_NLDEV_ATTR_SYS_IMAGE_GUID,
356
357
358
359
360 RDMA_NLDEV_ATTR_SUBNET_PREFIX,
361
362
363
364
365
366
367 RDMA_NLDEV_ATTR_LID,
368 RDMA_NLDEV_ATTR_SM_LID,
369
370
371
372
373 RDMA_NLDEV_ATTR_LMC,
374
375 RDMA_NLDEV_ATTR_PORT_STATE,
376 RDMA_NLDEV_ATTR_PORT_PHYS_STATE,
377
378 RDMA_NLDEV_ATTR_DEV_NODE_TYPE,
379
380 RDMA_NLDEV_ATTR_RES_SUMMARY,
381 RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY,
382 RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_NAME,
383 RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR,
384
385 RDMA_NLDEV_ATTR_RES_QP,
386 RDMA_NLDEV_ATTR_RES_QP_ENTRY,
387
388
389
390 RDMA_NLDEV_ATTR_RES_LQPN,
391
392
393
394
395 RDMA_NLDEV_ATTR_RES_RQPN,
396
397
398
399
400 RDMA_NLDEV_ATTR_RES_RQ_PSN,
401
402
403
404 RDMA_NLDEV_ATTR_RES_SQ_PSN,
405 RDMA_NLDEV_ATTR_RES_PATH_MIG_STATE,
406
407
408
409
410 RDMA_NLDEV_ATTR_RES_TYPE,
411 RDMA_NLDEV_ATTR_RES_STATE,
412
413
414
415
416 RDMA_NLDEV_ATTR_RES_PID,
417
418
419
420
421
422
423 RDMA_NLDEV_ATTR_RES_KERN_NAME,
424
425 RDMA_NLDEV_ATTR_RES_CM_ID,
426 RDMA_NLDEV_ATTR_RES_CM_ID_ENTRY,
427
428
429
430 RDMA_NLDEV_ATTR_RES_PS,
431
432
433
434 RDMA_NLDEV_ATTR_RES_SRC_ADDR,
435 RDMA_NLDEV_ATTR_RES_DST_ADDR,
436
437 RDMA_NLDEV_ATTR_RES_CQ,
438 RDMA_NLDEV_ATTR_RES_CQ_ENTRY,
439 RDMA_NLDEV_ATTR_RES_CQE,
440 RDMA_NLDEV_ATTR_RES_USECNT,
441 RDMA_NLDEV_ATTR_RES_POLL_CTX,
442
443 RDMA_NLDEV_ATTR_RES_MR,
444 RDMA_NLDEV_ATTR_RES_MR_ENTRY,
445 RDMA_NLDEV_ATTR_RES_RKEY,
446 RDMA_NLDEV_ATTR_RES_LKEY,
447 RDMA_NLDEV_ATTR_RES_IOVA,
448 RDMA_NLDEV_ATTR_RES_MRLEN,
449
450 RDMA_NLDEV_ATTR_RES_PD,
451 RDMA_NLDEV_ATTR_RES_PD_ENTRY,
452 RDMA_NLDEV_ATTR_RES_LOCAL_DMA_LKEY,
453 RDMA_NLDEV_ATTR_RES_UNSAFE_GLOBAL_RKEY,
454
455
456
457
458
459
460
461
462
463
464 RDMA_NLDEV_ATTR_NDEV_INDEX,
465 RDMA_NLDEV_ATTR_NDEV_NAME,
466
467
468
469 RDMA_NLDEV_ATTR_DRIVER,
470 RDMA_NLDEV_ATTR_DRIVER_ENTRY,
471 RDMA_NLDEV_ATTR_DRIVER_STRING,
472
473
474
475 RDMA_NLDEV_ATTR_DRIVER_PRINT_TYPE,
476 RDMA_NLDEV_ATTR_DRIVER_S32,
477 RDMA_NLDEV_ATTR_DRIVER_U32,
478 RDMA_NLDEV_ATTR_DRIVER_S64,
479 RDMA_NLDEV_ATTR_DRIVER_U64,
480
481
482
483
484
485 RDMA_NLDEV_ATTR_RES_PDN,
486 RDMA_NLDEV_ATTR_RES_CQN,
487 RDMA_NLDEV_ATTR_RES_MRN,
488 RDMA_NLDEV_ATTR_RES_CM_IDN,
489 RDMA_NLDEV_ATTR_RES_CTXN,
490
491
492
493 RDMA_NLDEV_ATTR_LINK_TYPE,
494
495
496
497
498
499 RDMA_NLDEV_SYS_ATTR_NETNS_MODE,
500
501
502
503 RDMA_NLDEV_ATTR_DEV_PROTOCOL,
504
505
506
507
508 RDMA_NLDEV_NET_NS_FD,
509
510
511
512
513
514
515
516 RDMA_NLDEV_ATTR_CHARDEV_TYPE,
517 RDMA_NLDEV_ATTR_CHARDEV_NAME,
518 RDMA_NLDEV_ATTR_CHARDEV_ABI,
519 RDMA_NLDEV_ATTR_CHARDEV,
520 RDMA_NLDEV_ATTR_UVERBS_DRIVER_ID,
521
522
523
524 RDMA_NLDEV_ATTR_STAT_MODE,
525 RDMA_NLDEV_ATTR_STAT_RES,
526 RDMA_NLDEV_ATTR_STAT_AUTO_MODE_MASK,
527 RDMA_NLDEV_ATTR_STAT_COUNTER,
528 RDMA_NLDEV_ATTR_STAT_COUNTER_ENTRY,
529 RDMA_NLDEV_ATTR_STAT_COUNTER_ID,
530 RDMA_NLDEV_ATTR_STAT_HWCOUNTERS,
531 RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY,
532 RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_NAME,
533 RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_VALUE,
534
535
536
537
538 RDMA_NLDEV_ATTR_DEV_DIM,
539
540 RDMA_NLDEV_ATTR_RES_RAW,
541
542 RDMA_NLDEV_ATTR_RES_CTX,
543 RDMA_NLDEV_ATTR_RES_CTX_ENTRY,
544
545 RDMA_NLDEV_ATTR_RES_SRQ,
546 RDMA_NLDEV_ATTR_RES_SRQ_ENTRY,
547 RDMA_NLDEV_ATTR_RES_SRQN,
548
549 RDMA_NLDEV_ATTR_MIN_RANGE,
550 RDMA_NLDEV_ATTR_MAX_RANGE,
551
552 RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK,
553
554 RDMA_NLDEV_ATTR_STAT_HWCOUNTER_INDEX,
555 RDMA_NLDEV_ATTR_STAT_HWCOUNTER_DYNAMIC,
556
557
558
559
560 RDMA_NLDEV_ATTR_MAX
561};
562
563
564
565
566enum rdma_nl_counter_mode {
567 RDMA_COUNTER_MODE_NONE,
568
569
570
571
572
573 RDMA_COUNTER_MODE_AUTO,
574
575
576
577
578
579 RDMA_COUNTER_MODE_MANUAL,
580
581
582
583
584 RDMA_COUNTER_MODE_MAX,
585};
586
587
588
589
590
591enum rdma_nl_counter_mask {
592 RDMA_COUNTER_MASK_QP_TYPE = 1,
593 RDMA_COUNTER_MASK_PID = 1 << 1,
594};
595#endif
596