aboutsummaryrefslogtreecommitdiffstats
path: root/sys/linux/dev_infiniband_rdma.txt
blob: 7cd367acd02a043df84531d3fc1119dcb5dcd9ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
# Copyright 2019 syzkaller project authors. All rights reserved.
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

# TODO: This needs some fixups according to PR review:
# https://github.com/google/syzkaller/pull/1053
# In the meantime, add it as is.

include <uapi/linux/fcntl.h>
include <rdma/ib_verbs.h>
include <rdma/rdma_user_ioctl.h>
include <rdma/ib_user_ioctl_verbs.h>
include <rdma/mlx5-abi.h>
include <uapi/rdma/ib_user_ioctl_cmds.h>
include <uapi/rdma/mlx5_user_ioctl_cmds.h>

# resources
resource fd_rdma[fd]
resource pd_handle[int32]
resource mr_handle[int32]
resource mr_rkey[int32]
resource cq_handle[int32]
resource qp_handle[int32]
resource mw_handle[int32]
resource srq_handle[int32]
resource xrcd_handle[int32]
resource wq_handle[int32]
resource ind_tbl_handle[int32]
resource flow_handle[int32]

type ah_handle int32
type mr_lkey int32
type qp_number int32

define IB_USER_VERBS_EX_CMD_QUERY_DEVICE	0x80000001
define IB_USER_VERBS_EX_CMD_CREATE_FLOW	0x80000032
define IB_USER_VERBS_EX_CMD_DESTROY_FLOW	0x80000033
define MLX5_CREATE_DCT	0x8
define MLX5_CREATE_DCI	0x16
define IB_USER_VERBS_CMD_FLAG_EXTENDED	0x80000000
define IB_USER_VERBS_CMD_FLAGS_SHIFT	24
define IB_USER_VERBS_CMD_THRESHOLD	50
define IB_USER_VERBS_CMD_CREATE_CQ	0x12
define IB_USER_VERBS_CMD_CREATE_QP	0x18
define EX_CREATE_CQ_CMD	IB_USER_VERBS_CMD_FLAG_EXTENDED | IB_USER_VERBS_CMD_CREATE_CQ
define EX_CREATE_QP_CMD	IB_USER_VERBS_CMD_FLAG_EXTENDED | IB_USER_VERBS_CMD_CREATE_QP

# flags
ib_access_flags = IB_ACCESS_LOCAL_WRITE, IB_ACCESS_REMOTE_WRITE, IB_ACCESS_REMOTE_READ, IB_ACCESS_REMOTE_ATOMIC, IB_ACCESS_MW_BIND, IB_ZERO_BASED, IB_ACCESS_ON_DEMAND
ib_mr_rereg_flags = IB_MR_REREG_TRANS, IB_MR_REREG_PD, IB_MR_REREG_ACCESS, IB_MR_REREG_SUPPORTED
ib_qp_type = IB_QPT_SMI, IB_QPT_GSI, IB_QPT_RC, IB_QPT_UC, IB_QPT_UD, IB_QPT_RAW_IPV6, IB_QPT_RAW_ETHERTYPE, IB_QPT_RAW_PACKET, IB_QPT_XRC_INI, IB_QPT_XRC_TGT
ib_qp_create_flags = IB_QP_CREATE_IPOIB_UD_LSO, IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK, IB_QP_CREATE_CROSS_CHANNEL, IB_QP_CREATE_MANAGED_SEND, IB_QP_CREATE_MANAGED_RECV, IB_QP_CREATE_NETIF_QP, IB_QP_CREATE_INTEGRITY_EN, IB_QP_CREATE_SCATTER_FCS
ib_send_flags = IB_SEND_FENCE, IB_SEND_SIGNALED, IB_SEND_SOLICITED, IB_SEND_INLINE, IB_SEND_IP_CSUM
ib_flow_flags = IB_FLOW_ATTR_FLAGS_DONT_TRAP
ib_ipv4_flags = IB_IPV4_DONT_FRAG, IB_IPV4_MORE_FRAG
mlx5_create_qp_flags = MLX5_QP_FLAG_SIGNATURE, MLX5_QP_FLAG_SCATTER_CQE, MLX5_QP_FLAG_TUNNEL_OFFLOADS, MLX5_QP_FLAG_BFREG_INDEX, MLX5_CREATE_DCT, MLX5_CREATE_DCI
mlx5_create_cq_flags = 0
create_cq_ex_flags = IB_UVERBS_CQ_FLAGS_TIMESTAMP_COMPLETION, IB_UVERBS_CQ_FLAGS_IGNORE_OVERRUN
create_cq_ex_mask = 0x0, 0x1
mlx5_comp_cqe_res_format = MLX5_IB_CQE_RES_FORMAT_HASH, MLX5_IB_CQE_RES_FORMAT_CSUM
wq_type = IB_WQT_RQ
create_wq_flags = IB_WQ_FLAGS_CVLAN_STRIPPING, IB_WQ_FLAGS_SCATTER_FCS, IB_WQ_FLAGS_DELAY_DROP, IB_WQ_FLAGS_PCI_WRITE_END_PADDING
modify_wq_attr_flags = IB_WQ_STATE, IB_WQ_CUR_STATE, IB_WQ_FLAGS
modify_wq_flags = IB_WQ_FLAGS_CVLAN_STRIPPING, IB_WQ_FLAGS_SCATTER_FCS, IB_WQ_FLAGS_DELAY_DROP, IB_WQ_FLAGS_PCI_WRITE_END_PADDING
srq_type = IB_SRQT_BASIC, IB_SRQT_XRC, IB_SRQT_TM
create_srq_ex_flags = MLX5_SRQ_FLAG_SIGNATURE

# structs
# =======

# context
# ===========

mlx5_get_context_cmd_resp {
	async_fd			fd
	num_comp_vectors		int32
	qp_tab_size			int32
	bf_reg_size			int32
	tot_uuars			int32
	cache_line_size			int32
	max_sq_desc_sz			int16
	max_rq_desc_sz			int16
	max_send_wqebb			int32
	max_recv_wr			int32
	max_srq_recv_wr			int32
	num_ports			int16
	reserved1			const[0x0, int16]
	comp_mask			int32[0:1]
	response_length			int32
	cqe_version_cmds_supp_uhw	int16
	reserved2			const[0x0, int16]
	hca_core_clock_offset		int64
	log_uar_size			int32
	num_uars_per_page		int32
	num_dyn_bfregs			int32
	reserved3			const[0x0, int32]
}

mlx5_get_context_cmd {
# TODO: are there named consts for commands?
	command			const[0x0, int32]
# TODO: these probably should be replaced with bytesize8 of something.
	in_words		const[0xc, int16]
	out_words		const[0x12, int16]
	response		ptr[out, mlx5_get_context_cmd_resp]
	total_num_uuars		int32
	num_low_latency_uuars	int32
	flags			int32
	comp_mask		int32
	cqe_version		int16
	reserved1		const[0x0, int16]
	reserved2		const[0x0, int32]
	lib_caps		int64
}

# query_device
# ================

query_device_resp_ex {
	fw_ver				int64
	node_guid			int64
	sys_image_guid			int64
	max_mr_size			int64
	page_size_cap			int64
	vendor_id			int32
	vendor_part_id			int32
	hw_ver				int32
	max_qp				int32
	max_qp_wr			int32
	device_cap_flags		int32
	max_sge				int32
	max_sge_rd			int32
	max_cq				int32
	max_cqe				int32
	max_mr				int32
	max_qp_rd_atom			int32
	max_ee_rd_atom			int32
	max_res_rd_atom			int32
	max_qp_init_rd_atom		int32
	max_ee_init_rd_atom		int32
	atomic_cap			int32
	max_ee				int32
	max_rdd				int32
	max_mw				int32
	max_raw_ipv6_qp			int32
	max_raw_ethy_qp			int32
	max_mcast_grp			int32
	max_mcast_qp_attach		int32
	max_total_mcast_qp_attach	int32
	max_ah				int32
	max_fmr				int32
	max_map_per_fmr			int32
	max_srq				int32
	max_srq_wr			int32
	max_srq_sge			int32
	max_pkeys			int16
	local_ca_ack_delay		int8
	phys_port_cnt			int8
	reserved			const[0x0, int32]
	comp_mask			const[0x0, int32]
	response_length			int32
	general_caps			int64
	rc_odp_caps			int32
	uc_odp_caps			int32
	ud_odp_caps			int32
	reserved_odp			const[0x0, int32]
	timestamp_mask			int64
	hca_core_clock			int64
	device_cap_flags_ex		int64
	supported_qpts			int32
	max_rwq_indirection_tables	int32
	max_rwq_indirection_table_size	int32
	reserved_rss			const[0x0, int32]
	max_wq_type_rq			int32
	raw_packet_caps			int32
	max_rndv_hdr_size		int32
	max_num_tags			int32
	flags				int32
	max_ops				int32
	max_sge_tm			int32
	reserved_tm			int32
	max_cq_moderation_count		int16
	max_cq_moderation_period	int16
	reserved_cq_mod			int32
	max_dm_size			int64
}

query_device_cmd_ex {
	command			const[IB_USER_VERBS_EX_CMD_QUERY_DEVICE, int32]
	in_words		const[0x1, int16]
	out_words		bytesize4[response, int16]
	response		ptr[out, query_device_resp_ex]
	provider_in_words	const[0x0, int16]
	provider_out_words	const[0x8, int16]
	reserved		const[0x0, int32]
	comp_mask		const[0x0, int32]
	reserved1		const[0x0, int32]
}

# query_port
# ==============

query_port_cmd {
	command		const[0x2, int32]
	in_words	const[0x6, int16]
	out_words	const[0xa, int16]
	response	int64
	port_num	const[0x1, int8]
	reserved	array[int8, 7]
	driver_data	array[int64]
}

# pd
# ======

alloc_pd_cmd {
	command		const[0x3, int32]
	in_words	bytesize4[parent, int16]
	out_words	bytesize4[response, int16]
	response	ptr[out, alloc_pd_cmd_resp]
	driver_data	array[int64]
}

mlx5_alloc_pd_cmd {
	command		const[0x3, int32]
	in_words	bytesize4[parent, int16]
	out_words	bytesize4[response, int16]
	response	ptr[out, mlx5_alloc_pd_cmd_resp]
	driver_data	array[int64]
}

alloc_pd_cmd_resp {
	pd_handle	pd_handle
}

mlx5_alloc_pd_cmd_resp {
	pd_handle	pd_handle
	pdn		int32
}

dealloc_pd_cmd {
	command		const[0x4, int32]
	in_words	const[0x6, int16]
	out_words	const[0, int16]
	pd_handle	pd_handle
}

# ah
# ===

create_ah_cmd_resp {
	ah_handle	ah_handle
}

create_ah_cmd {
	command		const[0x5, int32]
	in_words	bytesize4[parent, int16]
	out_words	bytesize4[response, int16]
	response	ptr[out, create_ah_cmd_resp]
	user_handle	int64
	pd_handle	pd_handle
	reserved	const[0x0, int32]
	dgid		array[int8, 16]
	flow_label	int32
	sgid_index	const[0x0, int8]
	hop_limit	int8
	traffic_class	int8
	reserved1	int8
	dlid		int16
	sl		int8
	src_path_bits	int8
	static_rate	int8
	is_global	int8
	port_num	const[0x1, int8]
	reserved2	int8
}

destroy_ah_cmd {
	command		const[0x8, int32]
	in_words	bytesize4[parent, int16]
	out_words	const[0x0, int16]
}

# mr
# ======

reg_mr_resp {
	mr_handle	mr_handle
	lkey		mr_lkey
	rkey		mr_rkey
}

reg_mr_cmd {
	command		const[0x9, int32]
	in_words	const[0xc, int16]
	out_words	const[0x3, int16]
	response	ptr[out, reg_mr_resp]
	start		ptr[in, int64]
	length		len[start, int64]
	hca_va		ptr[out, int64]
	pd_handle	pd_handle
	access_flags	flags[ib_access_flags, int32]
	driver_data	array[int64]
}

rereg_mr_resp {
	lkey	mr_lkey
	rkey	mr_rkey
}

rereg_mr_cmd {
	command		const[0xb, int32]
	in_words	const[0xe, int16]
	out_words	const[0x2, int16]
	response	ptr[out, rereg_mr_resp]
	mr_handle	mr_handle
	flags		flags[ib_mr_rereg_flags, int32]
	start		ptr[in, int64]
	length		len[start, int64]
	hca_va		ptr[out, int64]
	pd_handle	pd_handle
	access_flags	flags[ib_access_flags, int32]
	driver_data	array[int64]
}

dereg_mr_cmd {
	command		const[0xd, int32]
	in_words	const[0x3, int16]
	out_words	const[0x0, int16]
	mr_handle	mr_handle
}

alloc_mw_resp {
	mw_handle	mw_handle
	rkey		mr_rkey
}

alloc_mw_cmd {
	command		const[0xe, int32]
	in_words	const[0x6, int16]
	out_words	const[0x2, int16]
	response	ptr[out, alloc_mw_resp]
	pd_handle	pd_handle
	mw_type		int8[1:2]
	reserved0	const[0x0, int8]
	reserved1	const[0x0, int16]
}

dealloc_mw_cmd {
	command		const[0x10, int32]
	in_words	const[0x4, int16]
	out_words	const[0x0, int16]
	mw_handle	mw_handle
	reserved	const[0x0, int32]
}

# completion channel
# ==================

create_comp_channel_resp {
	fd	fd
}

create_comp_channel_cmd {
	command		const[0x11, int32]
	in_words	const[0x6, int16]
	out_words	const[0x1, int16]
	response	ptr[out, create_comp_channel_resp]
}

# cq
# ======

create_cq_resp {
	cq_handle	cq_handle
	cqe		int32
}

mlx5_create_cq_cmd {
	command			const[EX_CREATE_CQ_CMD, int32]
	in_words		bytesize4[parent, int16]
	out_words		bytesize4[response, int16]
	response		ptr[out, create_cq_resp]
	provider_in_words	const[0x5, int16]
	provider_out_words	const[0x1, int16]
	reserved0		const[0x0, int32]
	user_handle		int64
	cqe			int32
	comp_vector		int32
	comp_channel		const[0xffffffff, int32]
	comp_mask		flags[create_cq_ex_mask, int32]
	reserved1		const[0x0, int32]
	buf_addr		ptr[in, array[int8, 4096]]
	db_addr			ptr[in, array[int8, 4096]]
	cqe_size		const[0x40, int32]
	cqe_comp_en		int8[0:1]
	cqe_comp_res_format	flags[mlx5_comp_cqe_res_format, int8]
	flags			flags[mlx5_create_cq_flags, int16]
}

# this fails a lot on Mellanox HW. Leaving for others providers' sake and
# adding mlx5_create_cq instead, which defines driver data properly.
create_cq_cmd {
	command		const[0x12, int32]
	in_words	const[0x10, int16]
	out_words	const[0x3, int16]
	reponse		ptr[out, create_cq_resp]
	user_handle	int64
	cqe		int32
	comp_vector	int32
	comp_channel	int32
	reserved	const[0x0, int32]
	driver_data	array[int64]
}

create_cq_ex_cmd {
	command			const[EX_CREATE_CQ_CMD, int32]
	in_words		const[0x4, int16]
	out_words		const[0x2, int16]
	response		ptr[out, create_cq_resp]
	provider_in_words	const[0x5, int16]
	provider_out_words	const[0x1, int16]
	reserved0		const[0x0, int32]
	user_handle		int64
	cqe			int32
	comp_vector		const[0x0, int32]
	comp_channel		const[0xffffffff, int32]
	comp_mask		flags[create_cq_ex_mask, int32]
	flags			flags[create_cq_ex_flags, int32]
	reserved1		const[0x0, int32]
}

resize_cq_resp {
	cqe		int32
	reserved	const[0x0, int32]
	driver_data	array[int64]
}

resize_cq_cmd {
	command		const[0x13, int32]
	in_words	const[0xa, int16]
	out_words	const[0x2, int16]
	response	ptr[out, resize_cq_resp]
	cq_handle	cq_handle
	cqe		int32
	driver_data	array[int64]
}

destroy_cq_resp {
	comp_events_reported	int32
	async_events_reported	int32
}

destroy_cq_cmd {
	command		const[0x14, int32]
	in_words	const[0x6, int16]
	out_words	const[0x2, int16]
	response	ptr[out, destroy_cq_resp]
	cq_handle	cq_handle
	reserved	const[0x0, int32]
}

kern_wc {
	wr_id		int64
	status		int32
	opcode		int32
	vendor_err	int32
	byte_len	int32
	imm_data	int32
	qp_num		int32
	src_qp		int32
	wc_flags	int32
	pkey_index	int16
	slid		int16
	sl		int8
	dlid_path_bits	int8
	port_num	int8
	reserved	const[0x0, int8]
}

poll_cq_resp {
	count		int32
	reserved	const[0x0, int32]
	wc		array[kern_wc]
}

poll_cq_cmd {
	command		const[0x15, int32]
	in_words	const[0x6, int16]
	out_words	const[0x2, int16]
	response	ptr[out, poll_cq_resp]
	cq_handle	cq_handle
	ne		int32
}

req_notify_cq_cmd {
	command		const[0x17, int32]
	in_words	const[0x4, int16]
	out_words	const[0x0, int16]
	cq_handle	cq_handle
	solicited	int32[0x0:0x1]
}

# qp_ex
# =========

create_qp_resp {
	qp_handle	qp_handle
	qpn		qp_number
	max_send_wr	int32
	max_recv_wr	int32
	max_send_sge	int32
	max_recv_sge	int32
	max_inline_data	int32
	reserved	const[0x0, int32]
}

create_qp_cmd {
	command		const[0x18, int32]
	in_words	bytesize4[parent, int16]
	out_words	bytesize4[response, int16]
	response	ptr[out, create_qp_resp]
	user_handle	int64
	pd_handle	pd_handle
	send_cq_handle	cq_handle
	recv_cq_handle	cq_handle
	srq_handle	srq_handle
	max_send_wr	int32
	max_recv_wr	int32
	max_send_sge	int32
	max_recv_sge	int32
	max_inline_data	int32
	sq_sig_all	int8
	qp_type		flags[ib_qp_type, int8]
	is_srq		int8[0:1]
	reserved1	const[0x0, int8]
	driver_data	array[int64]
}

mlx5_create_qp_cmd {
	command		const[EX_CREATE_QP_CMD, int32]
	in_words	bytesize4[parent, int16]
	out_words	bytesize4[response, int16]
	response	ptr[out, create_qp_resp]
	user_handle	int64
	pd_handle	pd_handle
	send_cq_handle	cq_handle
	recv_cq_handle	cq_handle
	srq_handle	srq_handle
	max_send_wr	int32
	max_recv_wr	int32
	max_send_sge	int32
	max_recv_sge	int32
	max_inline_data	int32
	sq_sig_all	int8
	qp_type		flags[ib_qp_type, int8]
	is_srq		int8[0:1]
	reserved0	const[0x0, int8]
	buf_addr	ptr[in, array[int8, 4096]]
	db_addr		ptr[in, array[int8, 4096]]
	sq_wqe_count	int32
	rq_wqe_count	int32
	rq_wqe_shift	int32
	flags		flags[mlx5_create_qp_flags, int32]
	uidx		int32
	bfreg_index	int32
	sq_buf_addr	ptr[in, array[int8, 4096]]
} [packed]

mlx5_create_qp_resp {
	qp_handle	qp_handle
	qpn		qp_number
	max_send_wr	int32
	max_recv_wr	int32
	max_send_sge	int32
	max_recv_sge	int32
	max_inline_data	int32
	reserved0	const[0x0, int32]
	uuar_index	int32
}

mlx5_create_dv_qp_cmd {
	command		const[0x18, int32]
	in_words	const[0x1c, int16]
	out_words	const[0x9, int16]
	response	ptr[out, mlx5_create_qp_resp]
	user_handle	int64
	pd_handle	pd_handle
	send_cq_handle	cq_handle
	recv_cq_handle	cq_handle
	srq_handle	srq_handle
	max_send_wr	int32
	max_recv_wr	int32
	max_send_sge	int32
	max_recv_sge	int32
	max_inline_data	int32
	sq_sig_all	int8
	qp_type		const[0xff, int8]
	is_srq		int8
	reserved0	const[0x0, int8]
	driver_data	array[int64]
	buf_addr	ptr[in, array[int8, 4096]]
	db_addr		ptr[in, array[int8, 4096]]
	sq_wqe_count	int32
	rq_wqe_count	int32
	rq_wqe_shift	int32
	flags		int32
	uidx		int32
	reserved1	const[0x0, int32]
	access_key	int64
} [packed]

destroy_qp_resp {
	events_reported	int32
}

destroy_qp_cmd {
	command		const[0x1b, int32]
	in_words	const[0x6, int16]
	out_words	const[0x1, int16]
	response	ptr[out, destroy_qp_resp]
	qp_handle	qp_handle
	reserved	const[0x0, int32]
}

query_qp_resp {
	dest_dgid		array[int8, 16]
	dest_flow_label		int32
	dest_dlid		int16
	dest_reserved		const[0x0, int16]
	dest_sgid_index		int8
	dest_hop_limit		int8
	dest_traffic_class	int8
	dest_sl			int8
	dest_src_path_bits	int8
	dest_static_rate	int8
	dest_is_global		int8
	dest_port_num		int8
	alt_dest_dgid		array[int8, 16]
	alt_dest_flow_label	int32
	alt_dest_dlid		int16
	alt_dest_reserved	const[0x0, int16]
	alt_dest_sgid_index	int8
	alt_dest_hop_limit	int8
	alt_dest_traffic_class	int8
	alt_dest_sl		int8
	alt_dest_src_path_bits	int8
	alt_dest_static_rate	int8
	alt_dest_is_global	int8
	alt_dest_port_num	int8
	max_send_wr		int32
	max_recv_wr		int32
	max_send_sge		int32
	max_recv_sge		int32
	max_inline_data		int32
	qkey			int32
	rq_psn			int32
	sq_psn			int32
	dest_qp_num		int32
	qp_access_flags		int32
	pkey_index		int16
	alt_pkey_index		int16
	qp_state		int8
	cur_qp_state		int8
	path_mtu		int8
	path_mig_state		int8
	sq_draining		int8
	max_rd_atomic		int8
	max_dest_rd_atomic	int8
	min_rnr_timer		int8
	port_num		int8
	timeout			int8
	retry_cnt		int8
	rnr_retry		int8
	alt_port_num		int8
	alt_timeout		int8
	sq_sig_all		int8
	reserved0		const[0x0, int8]
	reserved1		const[0x0, int32]
	driver_data		array[int64]
}

query_qp_cmd {
	command		const[0x19, int32]
	in_words	const[0x6, int16]
	out_words	const[0x20, int16]
	response	ptr[out, query_qp_resp]
	qp_handle	qp_handle
	attr_mask	flags[ib_qp_create_flags, int32]
	driver_data	array[int64]
}

modify_qp_cmd {
	command			const[0x1a, int32]
	in_words		const[0x1e, int16]
	out_words		const[0x0, int16]
	dest_dgid		array[int8, 16]
	dest_flow_label		int32
	dest_dlid		int16
	dest_reserved		int16
	dest_sgid_index		int8
	dest_hop_limit		int8
	dest_traffic_class	int8
	dest_sl			int8
	dest_src_path_bits	int8
	dest_static_rate	int8
	dest_is_global		int8
	dest_port_num		int8
	alt_dest_dgid		array[int8, 16]
	alt_dest_flow_label	int32
	alt_dest_dlid		int16
	alt_dest_reserved	int16
	alt_dest_sgid_index	int8
	alt_dest_hop_limit	int8
	alt_dest_traffic_class	int8
	alt_dest_sl		int8
	alt_dest_src_path_bits	int8
	alt_dest_static_rate	int8
	alt_dest_is_global	int8
	alt_dest_port_num	int8
	qp_handle		int32
	attr_mask		int32
	qkey			int32
	rq_psn			int32
	sq_psn			int32
	dest_qp_num		int32
	qp_access_flags		int32
	pkey_index		int16
	alt_pkey_index		int16
	qp_state		int8
	cur_qp_state		int8
	path_mtu		int8
	path_mig_state		int8
	en_sqd_async_notify	int8
	max_rd_atomic		int8
	max_dest_rd_atomic	int8
	min_rnr_timer		int8
	port_num		int8
	timeout			int8
	retry_cnt		int8
	rnr_retry		int8
	alt_port_num		int8
	alt_timeout		int8
	reserved		const[0x0, int16]
}

# wq
#====

create_wq_resp {
	comp_mask	int32
	response_length	int32
	wq_handle	wq_handle
	max_wr		int32
	max_sge		int32
	wqn		int32
}

create_wq_cmd {
	command			const[0x80000034, int32]
	in_words		const[0x5, int16]
	out_words		bytesize4[response, int16]
	response		ptr[out, create_wq_resp]
	provider_in_words	const[0x6, int16]
	provider_out_words	const[0x1, int16]
	cmd_hdr_reserved	const[0x0, int32]
	comp_mask		const[0x0, int32]
	wq_type			flags[wq_type, int32]
	user_handle		int64
	pd_handle		pd_handle
	cq_handle		cq_handle
	max_wr			int32
	max_sge			int32
	create_flags		flags[create_wq_flags, int32]
	reserved		const[0x0, int32]
}

mlx5_create_wq_resp {
	comp_mask		int32
	response_length		const[0x6, int32]
	wq_handle		wq_handle
	max_wr			int32
	max_sge			int32
	wqn			int32
	mlx5_response_length	bytesize4[parent, int32]
	reserver		const[0x0, int32]
}

mlx5_create_wq_cmd {
	command				const[0x80000034, int32]
	in_words			const[0x5, int16]
	out_words			bytesize4[response, int16]
	response			ptr[out, mlx5_create_wq_resp]
	provider_in_words		const[0x6, int16]
	provider_out_words		const[0x1, int16]
	cmd_hdr_reserved		const[0x0, int32]
	comp_mask			const[0x0, int32]
	wq_type				flags[wq_type, int32]
	user_handle			int64
	pd_handle			pd_handle
	cq_handle			cq_handle
	max_wr				int32
	max_sge				int32
	create_flags			flags[create_wq_flags, int32]
	reserved			const[0x0, int32]
	buf_addr			ptr[in, array[int8, 4096]]
	db_addr				ptr[in, array[int8, 4096]]
	rq_wqe_count			int32
	rq_wqe_shift			int32
	user_index			int32
	flags				const[0x0, int32]
	provider_comp_mask		const[0x0, int32]
	single_stride_log_num_of_bytes	const[0x0, int32]
	single_wqe_log_num_of_strides	const[0x0, int32]
	two_byte_shift_en		int32[0:1]
}

destroy_wq_resp {
	comp_mask	int32
	response_length	int32
	events_reported	int32
	reserved	const[0x0, int32]
}

destroy_wq_cmd {
	command			const[0x80000036, int32]
	in_words		const[0x1, int16]
	out_words		const[0x2, int16]
	response		ptr[out, destroy_wq_resp]
	provider_in_words	const[0x0, int16]
	provider_out_words	const[0x0, int16]
	cmd_hdr_reserved	const[0x0, int32]
	comp_mask		int32[0x0:0xf]
	wq_handle		wq_handle
}

mlx5_modify_wq_cmd {
	command			const[0x80000035, int32]
	in_words		const[0x3, int16]
	out_words		const[0x0, int16]
	response		const[0x0, int64]
	provider_in_words	const[0x1, int16]
	provider_out_words	const[0x0, int16]
	cmd_hdr_reserved	const[0x0, int32]
	attr_mask		flags[modify_wq_attr_flags, int32]
	wq_handle		wq_handle
	wq_state		int32[0:3]
	current_wq_state	int32[0:3]
	flags			flags[modify_wq_flags, int32]
	flags_mask		flags[modify_wq_flags, int32]
	comp_mask		const[0x0, int32]
	reserved		const[0x0, int32]
}

# RSS (indirection table)
#========================

create_rwq_ind_table_resp {
	comp_mask	int32
	response_length	bytesize4[parent, int32]
	ind_tbl_handle	ind_tbl_handle
	ind_tbl_num	int32
}

# currently hard coded to use 2 WQs. Need to figure out how to
# make it a variable.
create_rwq_ind_table_cmd {
	command			const[0x80000037, int32]
	in_words		const[0x2, int16]
	out_words		const[0x2, int16]
	response		ptr[out, create_rwq_ind_table_resp]
	provider_in_words	const[0x0, int16]
	provider_out_words	const[0x0, int16]
	cmd_hdr_reserved	const[0x0, int32]
	comp_mask		const[0x0, int32]
	log_ind_tbl_size	const[0x1, int32]
	wq_handles		array[wq_handle, 2]
}

destroy_rwq_ind_table_cmd {
	comp_mask	int32
	ind_tbl_handle	ind_tbl_handle
}

# Send WR
#========

rdma {
	remote_addr	int64
	rkey		mr_rkey
	reserved	const[0x0, int32]
}

atomic {
	remote_addr	int64
	compare_add	int64
	swap		int64
	rkey		mr_rkey
	reserved	const[0x0, int32]
}

ud {
	ah		int32
	remote_qpn	int32
	remote_qkey	int32
	reserved	const[0x0, int32]
}

xrc {
	remote_srqn	int32
}

wr [
	rdma	rdma
	atomic	atomic
	ud	ud
]

kern_send_wr {
	wr_id		int64
	num_sge		int32
	opcode		int32[0:20]
	send_flags	flags[ib_send_flags, int32]
	imm_data	int32
	wr		wr
	qp_type		xrc
}

post_send_cmd {
	command		const[0x1c, int32]
	in_words	const[0x8, int16]
	out_words	const[0x1, int16]
	response	ptr[out, post_send_resp]
	qp_handle	qp_handle
	wr_count	int32
	sge_count	int32
	wqe_size	int32
	send_wr		array[kern_send_wr]
}

post_send_resp {
	bad_wr	int32
}

post_recv_cmd {
	command		const[0x1d, int32]
	in_words	const[0x8, int16]
	out_words	const[0x1, int16]
	response	ptr[out, post_recv_resp]
	qp_handle	qp_handle
	wr_count	int32
	sge_count	int32
	wqe_size	int32
	recv_wr		array[kern_recv_wr]
}

post_recv_resp {
	bad_wr	int32
}

attach_mcast_cmd {
	command		const[0x1e, int32]
	in_words	const[0x8, int16]
	out_words	const[0x0, int16]
	gid		array[int8, 0x10]
	qp_handle	qp_handle
	mlid		int16
	reserved	const[0x0, int16]
	driver_data	array[int64]
}

detach_mcast_cmd {
	command		const[0x1f, int32]
	in_words	const[0x8, int16]
	out_words	const[0x0, int16]
	gid		array[int8, 0x10]
	qp_handle	qp_handle
	mlid		int16
	reserved	const[0x0, int16]
	driver_data	array[int64]
}

create_srq_resp {
	srq_handle	srq_handle
	max_wr		int32
	max_sge		int32
	srqn		int32
}

create_srq_cmd {
	command		const[0x20, int32]
	in_words	const[0xa, int16]
	out_words	const[0x4, int16]
	response	ptr[out, create_srq_resp]
	user_handle	int64
	pd_handle	pd_handle
	max_wr		int32
	max_sge		int32
	srq_limit	int32
	driver_data	array[int64]
}

mlx5_ib_create_srq_resp {
	srqn		int32
	reserved	const[0x0, int32]
}

mlx5_create_srq_cmd {
	command		const[0x27, int32]
	in_words	const[0x16, int16]
	out_words	const[0x6, int16]
	reserved0	const[0x0, int32]
	response	ptr[out, mlx5_ib_create_srq_resp]
	user_handle	int64
	srq_type	flags[srq_type, int32]
	pd_handle	pd_handle
	max_wr		int32
	max_sge		int32
	srq_limit	int32
	max_num_tags	int32
	xrcd_handle	xrcd_handle
	cq_handle	cq_handle
	buf_addr	ptr[in, int64]
	db_addr		ptr[in, int64]
	flags		flags[create_srq_ex_flags, int32]
	reserved1	const[0x0, int32]
	uidx		int32
	reserved2	const[0x0, int32]
}

modify_srq_cmd {
	command		const[0x21, int32]
	in_words	const[0x6, int16]
	out_words	const[0x0, int16]
	srq_handle	srq_handle
	attr_mask	int32[0x0:0x10]
	max_wr		int32
	srq_limit	int32
	driver_data	array[int64]
}

query_srq_resp {
	max_wr		int32
	max_sge		int32
	srq_limit	int32
	reserved	const[0x0, int32]
}

query_srq_cmd {
	command		const[0x22, int32]
	in_words	const[0x6, int16]
	out_words	const[0x4, int16]
	response	ptr[out, query_srq_resp]
	srq_handle	srq_handle
	reserved	const[0x0, int32]
	driver_data	array[int64]
}

destroy_srq_resp {
	events_reported	int32
}

destroy_srq_cmd {
	command		const[0x23, int32]
	in_words	const[0x6, int16]
	out_words	const[0x1, int16]
	response	ptr[out, destroy_srq_resp]
	srq_handle	srq_handle
	reserved	const[0x0, int32]
}

kern_recv_wr {
	wr_id		int64
	num_sge		int32
	reserved	const[0x0, int32]
}

post_srq_recv_resp {
	bad_wr	int32
}

post_srq_recv_cmd {
	command		const[0x24, int32]
	in_words	const[0x7, int16]
	out_words	const[0x1, int16]
	response	ptr[out, post_srq_recv_resp]
	wr_count	int32
	sge_count	int32
	wqe_size	int32
	recv_wr		array[kern_recv_wr]
}

open_xrcd_resp {
	xrcd_handle	xrcd_handle
}

open_xrcd_cmd {
	command		const[0x25, int32]
	in_words	const[0x6, int16]
	out_words	const[0x1, int16]
	response	ptr[out, open_xrcd_resp]
	fd		fd[opt]
	oflags		flags[xrcd_flags, int32]
	driver_data	array[int64]
}

xrcd_flags = O_CREAT, O_EXCL

close_xrcd_cmd {
	command		const[0x26, int32]
	in_words	const[0x3, int16]
	out_words	const[0x0, int16]
	xrcd_handle	xrcd_handle
}

# create_flow
# ===============

ib_flow_eth_filter {
	dst_mac		mac_addr
	src_mac		mac_addr
	ether_type	flags[ether_types, int16be]
	vlan_tag	int16
}

ib_flow_spec_eth {
	type		const[IB_FLOW_SPEC_ETH, int32]
	size		bytesize[parent, int16]
	reserved	const[0x0, int16]
	val		ib_flow_eth_filter
	mask		ib_flow_eth_filter
}

ib_flow_ipv4_filter {
	src_ip	ipv4_addr
	dst_ip	ipv4_addr
	proto	flags[ipv4_types, int8]
	tos	int8
	ttl	int8
	flags	flags[ib_ipv4_flags, int8]
}

ib_flow_spec_ipv4 {
	type		const[IB_FLOW_SPEC_IPV4, int32]
	size		bytesize[parent, int16]
	reserved	const[0x0, int16]
	val		ib_flow_ipv4_filter
	mask		ib_flow_ipv4_filter
}

ib_flow_ipv6_filter {
	src_ip		ipv6_addr
	dst_ip		ipv6_addr
	flow_label	int32
	next_hdr	flags[ipv6_types, int8]
	traffic_class	int8
	hop_limit	int8
	reserved	const[0x0, int8]
}

ib_flow_spec_ipv6 {
	type		const[IB_FLOW_SPEC_IPV6, int32]
	size		bytesize[parent, int16]
	reserved	const[0x0, int16]
	val		ib_flow_ipv6_filter
	mask		ib_flow_ipv6_filter
}

ib_flow_tcp_udp_filter {
	dst_port	sock_port
	src_port	sock_port
}

ib_flow_spec_tcp_udp {
	type		int32[0x40:0x41]
	size		bytesize[parent, int16]
	reserved	const[0x0, int16]
	val		ib_flow_tcp_udp_filter
	mask		ib_flow_tcp_udp_filter
}

ib_flow_esp_filter {
	spi	int32
	seq	int32
}

ib_flow_spec_esp {
	type		const[IB_FLOW_SPEC_ESP, int32]
	size		bytesize[parent, int16]
	reserved	const[0x0, int16]
	val		ib_flow_esp_filter
	mask		ib_flow_esp_filter
}

ib_flow_tunnel_filter {
	tunnel_id	int32
}

ib_flow_spec_tunnel {
	type		const[IB_FLOW_SPEC_VXLAN_TUNNEL, int32]
	size		bytesize[parent, int16]
	reserved	const[0x0, int16]
	val		ib_flow_tunnel_filter
	mask		ib_flow_tunnel_filter
}

ib_flow_gre_filter {
	c_ks_res0_ver	int16
	protocol	int16
	key		int32
}

ib_flow_spec_gre {
	type		const[IB_FLOW_SPEC_GRE, int32]
	size		bytesize[parent, int16]
	reserved	const[0x0, int16]
	val		ib_flow_gre_filter
	mask		ib_flow_gre_filter
}

ib_flow_mpls_filter {
	tag	int32
}

ib_flow_spec_mpls {
	type		const[IB_FLOW_SPEC_MPLS, int32]
	size		bytesize[parent, int16]
	reserved	const[0x0, int16]
	val		ib_flow_mpls_filter
	mask		ib_flow_mpls_filter
}

ib_flow_spec_action_tag {
	type		const[IB_FLOW_SPEC_ACTION_TAG, int32]
	size		bytesize[parent, int16]
	reserved	const[0x0, int16]
	tag_id		int32
	reserved2	const[0x0, int32]
}

ib_flow_spec_action_drop {
	type		const[IB_FLOW_SPEC_ACTION_DROP, int32]
	size		bytesize[parent, int16]
	reserved	const[0x0, int16]
}

ib_uverbs_flow_spec_action_count {
	type		const[IB_FLOW_SPEC_ACTION_COUNT, int32]
	size		bytesize[parent, int16]
	reserved	const[0x0, int16]
	handle		vcontext_handle
	reserved1	const[0x0, int32]
}

union_ib_flow_spec [
	eth	ib_flow_spec_eth
	ipv6	ib_flow_spec_ipv6
	ipv4	ib_flow_spec_ipv4
	tcp_udp	ib_flow_spec_tcp_udp
	tunnel	ib_flow_spec_tunnel
	gre	ib_flow_spec_gre
	esp	ib_flow_spec_esp
	mpls	ib_flow_spec_mpls
	tag	ib_flow_spec_action_tag
	drop	ib_flow_spec_action_drop
	count	ib_uverbs_flow_spec_action_count
]

ib_uverbs_flow_attr {
	type		int32[0:3]
	size		bytesize[flow_specs, int16]
	priority	int16[0:7]
	num_of_specs	len[flow_specs, int8]
	reserved	array[const[0x0, int8], 2]
	port		int8
	flags		flags[ib_flow_flags, int32]
	flow_specs	array[union_ib_flow_spec]
}

create_flow_cmd_ex {
	comp_mask	const[0x0, int32]
	qp_handle	qp_handle	(in)
	flow_attr	ib_uverbs_flow_attr
}

create_flow_resp {
	comp_mask	int32
	flow_handle	flow_handle
}

create_flow_cmd {
	command			const[IB_USER_VERBS_EX_CMD_CREATE_FLOW, int32]
	in_words		bytesize8[flow_ex, int16]
	out_words		const[0x1, int16]
	response		ptr[out, create_flow_resp]
	provider_in_words	const[0x0, int16]
	provider_out_words	const[0x0, int16]
	reserved		const[0x0, int32]
	flow_ex			create_flow_cmd_ex	(in)
}

destroy_flow_cmd {
	command			const[IB_USER_VERBS_EX_CMD_DESTROY_FLOW, int32]
	in_words		const[0x6, int16]
	out_words		const[0x0, int16]
	response		const[0x0, int64]
	provider_in_words	const[0x0, int16]
	provider_out_words	const[0x0, int16]
	reserved		const[0x0, int32]
	comp_mask		const[0x0, int32]
	flow_handle		flow_handle
}

# ioctl interface

ib_uverbs_attr_flags = UVERBS_ATTR_F_MANDATORY
ib_read_counters_flags = IB_UVERBS_READ_COUNTERS_PREFER_CACHED

# This used to be a resource, but it's unclear what is supposed to create this resource,
# so for now it's downgraded to just int.
# resource vcontext_handle[int32]
type vcontext_handle int32

ib_uverbs_create_counters_cmd {
	length		bytesize8[ib_uverbs_create_counters_cmd, int16]
	object_id	const[UVERBS_OBJECT_COUNTERS, int16]
	method_id	const[UVERBS_METHOD_COUNTERS_CREATE, int16]
	num_attrs	const[1, int16]
	reserved0	const[0x0, int64]
	driver_id	const[RDMA_DRIVER_MLX5, int32]
	reserved1	const[0x0, int32]

	attr_id		const[UVERBS_ATTR_CREATE_COUNTERS_HANDLE, int16]
	len		int16
	flags		flags[ib_uverbs_attr_flags, int16]
	elem_id		int8
	reserved2	const[0x0, int8]
# TODO: reserved3 seems unnecessary: https://elixir.bootlin.com/linux/latest/source/include/uapi/rdma/rdma_user_ioctl_cmds.h#L58
	reserved3	const[0x0, int16]
# TODO: Is the following field really optional, or, is opt used as a workaround?
# Now that we have per-field directions, this can be fixed if it is the second case.
	vcontext_handle	vcontext_handle
	more_data	int32
}

ib_uverbs_destroy_counters_cmd {
	length		bytesize8[ib_uverbs_destroy_counters_cmd, int16]
	object_id	const[UVERBS_OBJECT_COUNTERS, int16]
	method_id	const[UVERBS_METHOD_COUNTERS_DESTROY, int16]
	num_attrs	const[1, int16]
	reserved0	const[0x0, int64]
	driver_id	const[RDMA_DRIVER_MLX5, int32]
	reserved1	const[0x0, int32]

	attr_id		const[UVERBS_ATTR_DESTROY_COUNTERS_HANDLE, int16]
	len		int16
	flags		flags[ib_uverbs_attr_flags, int16]
	elem_id		int8
	reserved2	const[0x0, int8]
	reserved3	const[0x0, int16]
	vcontext_handle	vcontext_handle
	more_data	int32
}

# in UVERBS_ATTR_READ_COUNTERS_FLAGS, assuming that sizeof(uint32_t is 4)
ib_uverbs_read_counters_cmd {
	length		bytesize8[ib_uverbs_read_counters_cmd, int16]
	object_id	const[UVERBS_OBJECT_COUNTERS, int16]
	method_id	const[UVERBS_METHOD_COUNTERS_READ, int16]
	num_attrs	const[0x3, int16]
	reserved0	const[0x0, int64]
	driver_id	const[RDMA_DRIVER_MLX5, int32]
	reserved1	const[0x0, int32]

	attr_id0	const[UVERBS_ATTR_READ_COUNTERS_HANDLE, int16]
	len0		int16
	flags0		flags[ib_uverbs_attr_flags, int16]
	reserved2	const[0x0, int16]
	vcontext_handle	vcontext_handle	(in)
	more_data0	int32

	attr_id1	const[UVERBS_ATTR_READ_COUNTERS_BUFF, int16]
	len1		bytesize8[data, int16]
	flags1		flags[ib_uverbs_attr_flags, int16]
	reserved3	const[0x0, int16]
	data		buffer[out]

	attr_id2	const[UVERBS_ATTR_READ_COUNTERS_FLAGS, int16]
	len2		const[0x4, int16]
	flags2		flags[ib_uverbs_attr_flags, int16]
	reserved4	const[0x0, int16]
	flags		flags[ib_read_counters_flags, int32]
	more_data1	int32
}

# commands
ioctl$CREATE_COUNTERS(fd fd_rdma, cmd const[RDMA_VERBS_IOCTL], arg ptr[inout, ib_uverbs_create_counters_cmd])
ioctl$DESTROY_COUNTERS(fd fd_rdma, cmd const[RDMA_VERBS_IOCTL], arg ptr[in, ib_uverbs_destroy_counters_cmd])
ioctl$READ_COUNTERS(fd fd_rdma, cmd const[RDMA_VERBS_IOCTL], arg ptr[inout, ib_uverbs_read_counters_cmd])

# device
openat$uverbs0(fd const[AT_FDCWD], file ptr[in, string["/dev/infiniband/uverbs0"]], flags const[O_RDWR], mode const[0]) fd_rdma
write$MLX5_GET_CONTEXT(fd fd_rdma, buf ptr[inout, mlx5_get_context_cmd], len len[buf])
close$ibv_device(fd fd_rdma)
write$QUERY_DEVICE_EX(fd fd_rdma, buf ptr[inout, query_device_cmd_ex], len len[buf])

# query_port
write$QUERY_PORT(fd fd_rdma, buf ptr[inout, query_port_cmd], len len[buf])

# pd
write$ALLOC_PD(fd fd_rdma, buf ptr[inout, alloc_pd_cmd], len len[buf])
write$MLX5_ALLOC_PD(fd fd_rdma, buf ptr[inout, mlx5_alloc_pd_cmd], len len[buf])
#dealloc_pd
write$DEALLOC_PD(fd fd_rdma, buf ptr[inout, dealloc_pd_cmd], len len[buf])

#ah
write$CREATE_AH(fd fd_rdma, buf ptr[inout, create_ah_cmd], len len[buf])
write$DESTROY_AH(fd fd_rdma, buf ptr[inout, destroy_ah_cmd], len len[buf])

# mr
write$REG_MR(fd fd_rdma, buf ptr[inout, reg_mr_cmd], len len[buf])
write$DEREG_MR(fd fd_rdma, buf ptr[inout, rereg_mr_cmd], len len[buf])
write$REREG_MR(fd fd_rdma, buf ptr[inout, dereg_mr_cmd], len len[buf])

# mw
write$ALLOC_MW(fd fd_rdma, buf ptr[inout, alloc_mw_cmd], len len[buf])
write$DEALLOC_MW(fd fd_rdma, buf ptr[inout, dealloc_mw_cmd], len len[buf])

#comp_channel
write$CREATE_COMP_CHANNEL(fd fd_rdma, buf ptr[inout, create_comp_channel_cmd], len len[buf])

# cq
write$CREATE_CQ(fd fd_rdma, buf ptr[inout, create_cq_cmd], len len[buf])
write$MLX5_CREATE_CQ(fd fd_rdma, buf ptr[inout, mlx5_create_cq_cmd], len len[buf])
write$CREATE_CQ_EX(fd fd_rdma, buf ptr[inout, create_cq_ex_cmd], len len[buf])
write$RESIZE_CQ(fd fd_rdma, buf ptr[inout, resize_cq_cmd], len len[buf])
write$DESTROY_CQ(fd fd_rdma, buf ptr[inout, destroy_cq_cmd], len len[buf])
write$POLL_CQ(fd fd_rdma, buf ptr[inout, poll_cq_cmd], len len[buf])
write$REQ_NOTIFY_CQ(fd fd_rdma, buf ptr[inout, req_notify_cq_cmd], len len[buf])

# qp
write$CREATE_QP(fd fd_rdma, buf ptr[inout, create_qp_cmd], len len[buf])

# qp_ex
write$MLX5_CREATE_QP(fd fd_rdma, buf ptr[inout, mlx5_create_qp_cmd], len len[buf])
write$MLX5_CREATE_DV_QP(fd fd_rdma, buf ptr[inout, mlx5_create_dv_qp_cmd], len len[buf])
write$DESTROY_QP(fd fd_rdma, buf ptr[inout, destroy_qp_cmd], len len[buf])
write$QUERY_QP(fd fd_rdma, buf ptr[inout, query_qp_cmd], len len[buf])
write$MODIFY_QP(fd fd_rdma, buf ptr[inout, modify_qp_cmd], len len[buf])
write$POST_SEND(fd fd_rdma, buf ptr[inout, post_send_cmd], len len[buf])
write$POST_RECV(fd fd_rdma, buf ptr[inout, post_recv_cmd], len len[buf])
write$ATTACH_MCAST(fd fd_rdma, buf ptr[in, attach_mcast_cmd], len len[buf])
write$DETACH_MCAST(fd fd_rdma, buf ptr[in, detach_mcast_cmd], len len[buf])
write$CREATE_SRQ(fd fd_rdma, buf ptr[inout, create_srq_cmd], len len[buf])
write$MLX5_CREATE_SRQ(fd fd_rdma, buf ptr[inout, mlx5_create_srq_cmd], len len[buf])
write$MODIFY_SRQ(fd fd_rdma, buf ptr[in, modify_srq_cmd], len len[buf])
write$QUERY_SRQ(fd fd_rdma, buf ptr[inout, query_srq_cmd], len len[buf])
write$DESTROY_SRQ(fd fd_rdma, buf ptr[inout, destroy_srq_cmd], len len[buf])
write$POST_SRQ_RECV(fd fd_rdma, buf ptr[inout, post_srq_recv_cmd], len len[buf])
write$OPEN_XRCD(fd fd_rdma, buf ptr[inout, open_xrcd_cmd], len len[buf])
write$CLOSE_XRCD(fd fd_rdma, buf ptr[inout, close_xrcd_cmd], len len[buf])

# wq
write$CREATE_WQ(fd fd_rdma, buf ptr[inout, create_wq_cmd], len len[buf])
write$MLX5_CREATE_WQ(fd fd_rdma, buf ptr[inout, mlx5_create_wq_cmd], len len[buf])
write$MLX5_MODIFY_WQ(fd fd_rdma, buf ptr[inout, mlx5_modify_wq_cmd], len len[buf])
write$DESTROY_WQ(fd fd_rdma, buf ptr[inout, destroy_wq_cmd], len len[buf])

# RSS
write$CREATE_RWQ_IND_TBL(fd fd_rdma, buf ptr[inout, create_rwq_ind_table_cmd], len len[buf])
write$DESTROY_RWQ_IND_TBL(fd fd_rdma, buf ptr[inout, destroy_rwq_ind_table_cmd], len len[buf])

# create_flow
write$CREATE_FLOW(fd fd_rdma, buf ptr[inout, create_flow_cmd], len len[buf])
write$DESTROY_FLOW(fd fd_rdma, buf ptr[in, destroy_flow_cmd], len len[buf])