github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/dev_infiniband_rdma.txt (about)

     1  # Copyright 2019 syzkaller project authors. All rights reserved.
     2  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  # TODO: This needs some fixups according to PR review:
     5  # https://github.com/google/syzkaller/pull/1053
     6  # In the meantime, add it as is.
     7  
     8  include <uapi/linux/fcntl.h>
     9  include <rdma/ib_verbs.h>
    10  include <rdma/rdma_user_ioctl.h>
    11  include <rdma/ib_user_ioctl_verbs.h>
    12  include <rdma/mlx5-abi.h>
    13  include <uapi/rdma/ib_user_ioctl_cmds.h>
    14  include <uapi/rdma/mlx5_user_ioctl_cmds.h>
    15  
    16  # resources
    17  resource fd_rdma[fd]
    18  resource pd_handle[int32]
    19  resource mr_handle[int32]
    20  resource mr_rkey[int32]
    21  resource cq_handle[int32]
    22  resource qp_handle[int32]
    23  resource mw_handle[int32]
    24  resource srq_handle[int32]
    25  resource xrcd_handle[int32]
    26  resource wq_handle[int32]
    27  resource ind_tbl_handle[int32]
    28  resource flow_handle[int32]
    29  
    30  type ah_handle int32
    31  type mr_lkey int32
    32  type qp_number int32
    33  
    34  define IB_USER_VERBS_EX_CMD_QUERY_DEVICE	0x80000001
    35  define IB_USER_VERBS_EX_CMD_CREATE_FLOW	0x80000032
    36  define IB_USER_VERBS_EX_CMD_DESTROY_FLOW	0x80000033
    37  define MLX5_CREATE_DCT	0x8
    38  define MLX5_CREATE_DCI	0x16
    39  define IB_USER_VERBS_CMD_FLAG_EXTENDED	0x80000000
    40  define IB_USER_VERBS_CMD_FLAGS_SHIFT	24
    41  define IB_USER_VERBS_CMD_THRESHOLD	50
    42  define IB_USER_VERBS_CMD_CREATE_CQ	0x12
    43  define IB_USER_VERBS_CMD_CREATE_QP	0x18
    44  define EX_CREATE_CQ_CMD	IB_USER_VERBS_CMD_FLAG_EXTENDED | IB_USER_VERBS_CMD_CREATE_CQ
    45  define EX_CREATE_QP_CMD	IB_USER_VERBS_CMD_FLAG_EXTENDED | IB_USER_VERBS_CMD_CREATE_QP
    46  
    47  # flags
    48  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
    49  ib_mr_rereg_flags = IB_MR_REREG_TRANS, IB_MR_REREG_PD, IB_MR_REREG_ACCESS, IB_MR_REREG_SUPPORTED
    50  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
    51  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
    52  ib_send_flags = IB_SEND_FENCE, IB_SEND_SIGNALED, IB_SEND_SOLICITED, IB_SEND_INLINE, IB_SEND_IP_CSUM
    53  ib_flow_flags = IB_FLOW_ATTR_FLAGS_DONT_TRAP
    54  ib_ipv4_flags = IB_IPV4_DONT_FRAG, IB_IPV4_MORE_FRAG
    55  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
    56  mlx5_create_cq_flags = 0
    57  create_cq_ex_flags = IB_UVERBS_CQ_FLAGS_TIMESTAMP_COMPLETION, IB_UVERBS_CQ_FLAGS_IGNORE_OVERRUN
    58  create_cq_ex_mask = 0x0, 0x1
    59  mlx5_comp_cqe_res_format = MLX5_IB_CQE_RES_FORMAT_HASH, MLX5_IB_CQE_RES_FORMAT_CSUM
    60  wq_type = IB_WQT_RQ
    61  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
    62  modify_wq_attr_flags = IB_WQ_STATE, IB_WQ_CUR_STATE, IB_WQ_FLAGS
    63  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
    64  srq_type = IB_SRQT_BASIC, IB_SRQT_XRC, IB_SRQT_TM
    65  create_srq_ex_flags = MLX5_SRQ_FLAG_SIGNATURE
    66  
    67  # structs
    68  # =======
    69  
    70  # context
    71  # ===========
    72  
    73  mlx5_get_context_cmd_resp {
    74  	async_fd			fd
    75  	num_comp_vectors		int32
    76  	qp_tab_size			int32
    77  	bf_reg_size			int32
    78  	tot_uuars			int32
    79  	cache_line_size			int32
    80  	max_sq_desc_sz			int16
    81  	max_rq_desc_sz			int16
    82  	max_send_wqebb			int32
    83  	max_recv_wr			int32
    84  	max_srq_recv_wr			int32
    85  	num_ports			int16
    86  	reserved1			const[0x0, int16]
    87  	comp_mask			int32[0:1]
    88  	response_length			int32
    89  	cqe_version_cmds_supp_uhw	int16
    90  	reserved2			const[0x0, int16]
    91  	hca_core_clock_offset		int64
    92  	log_uar_size			int32
    93  	num_uars_per_page		int32
    94  	num_dyn_bfregs			int32
    95  	reserved3			const[0x0, int32]
    96  }
    97  
    98  mlx5_get_context_cmd {
    99  # TODO: are there named consts for commands?
   100  	command			const[0x0, int32]
   101  # TODO: these probably should be replaced with bytesize8 of something.
   102  	in_words		const[0xc, int16]
   103  	out_words		const[0x12, int16]
   104  	response		ptr[out, mlx5_get_context_cmd_resp]
   105  	total_num_uuars		int32
   106  	num_low_latency_uuars	int32
   107  	flags			int32
   108  	comp_mask		int32
   109  	cqe_version		int16
   110  	reserved1		const[0x0, int16]
   111  	reserved2		const[0x0, int32]
   112  	lib_caps		int64
   113  }
   114  
   115  # query_device
   116  # ================
   117  
   118  query_device_resp_ex {
   119  	fw_ver				int64
   120  	node_guid			int64
   121  	sys_image_guid			int64
   122  	max_mr_size			int64
   123  	page_size_cap			int64
   124  	vendor_id			int32
   125  	vendor_part_id			int32
   126  	hw_ver				int32
   127  	max_qp				int32
   128  	max_qp_wr			int32
   129  	device_cap_flags		int32
   130  	max_sge				int32
   131  	max_sge_rd			int32
   132  	max_cq				int32
   133  	max_cqe				int32
   134  	max_mr				int32
   135  	max_qp_rd_atom			int32
   136  	max_ee_rd_atom			int32
   137  	max_res_rd_atom			int32
   138  	max_qp_init_rd_atom		int32
   139  	max_ee_init_rd_atom		int32
   140  	atomic_cap			int32
   141  	max_ee				int32
   142  	max_rdd				int32
   143  	max_mw				int32
   144  	max_raw_ipv6_qp			int32
   145  	max_raw_ethy_qp			int32
   146  	max_mcast_grp			int32
   147  	max_mcast_qp_attach		int32
   148  	max_total_mcast_qp_attach	int32
   149  	max_ah				int32
   150  	max_fmr				int32
   151  	max_map_per_fmr			int32
   152  	max_srq				int32
   153  	max_srq_wr			int32
   154  	max_srq_sge			int32
   155  	max_pkeys			int16
   156  	local_ca_ack_delay		int8
   157  	phys_port_cnt			int8
   158  	reserved			const[0x0, int32]
   159  	comp_mask			const[0x0, int32]
   160  	response_length			int32
   161  	general_caps			int64
   162  	rc_odp_caps			int32
   163  	uc_odp_caps			int32
   164  	ud_odp_caps			int32
   165  	reserved_odp			const[0x0, int32]
   166  	timestamp_mask			int64
   167  	hca_core_clock			int64
   168  	device_cap_flags_ex		int64
   169  	supported_qpts			int32
   170  	max_rwq_indirection_tables	int32
   171  	max_rwq_indirection_table_size	int32
   172  	reserved_rss			const[0x0, int32]
   173  	max_wq_type_rq			int32
   174  	raw_packet_caps			int32
   175  	max_rndv_hdr_size		int32
   176  	max_num_tags			int32
   177  	flags				int32
   178  	max_ops				int32
   179  	max_sge_tm			int32
   180  	reserved_tm			int32
   181  	max_cq_moderation_count		int16
   182  	max_cq_moderation_period	int16
   183  	reserved_cq_mod			int32
   184  	max_dm_size			int64
   185  }
   186  
   187  query_device_cmd_ex {
   188  	command			const[IB_USER_VERBS_EX_CMD_QUERY_DEVICE, int32]
   189  	in_words		const[0x1, int16]
   190  	out_words		bytesize4[response, int16]
   191  	response		ptr[out, query_device_resp_ex]
   192  	provider_in_words	const[0x0, int16]
   193  	provider_out_words	const[0x8, int16]
   194  	reserved		const[0x0, int32]
   195  	comp_mask		const[0x0, int32]
   196  	reserved1		const[0x0, int32]
   197  }
   198  
   199  # query_port
   200  # ==============
   201  
   202  query_port_cmd {
   203  	command		const[0x2, int32]
   204  	in_words	const[0x6, int16]
   205  	out_words	const[0xa, int16]
   206  	response	int64
   207  	port_num	const[0x1, int8]
   208  	reserved	array[int8, 7]
   209  	driver_data	array[int64]
   210  }
   211  
   212  # pd
   213  # ======
   214  
   215  alloc_pd_cmd {
   216  	command		const[0x3, int32]
   217  	in_words	bytesize4[parent, int16]
   218  	out_words	bytesize4[response, int16]
   219  	response	ptr[out, alloc_pd_cmd_resp]
   220  	driver_data	array[int64]
   221  }
   222  
   223  mlx5_alloc_pd_cmd {
   224  	command		const[0x3, int32]
   225  	in_words	bytesize4[parent, int16]
   226  	out_words	bytesize4[response, int16]
   227  	response	ptr[out, mlx5_alloc_pd_cmd_resp]
   228  	driver_data	array[int64]
   229  }
   230  
   231  alloc_pd_cmd_resp {
   232  	pd_handle	pd_handle
   233  }
   234  
   235  mlx5_alloc_pd_cmd_resp {
   236  	pd_handle	pd_handle
   237  	pdn		int32
   238  }
   239  
   240  dealloc_pd_cmd {
   241  	command		const[0x4, int32]
   242  	in_words	const[0x6, int16]
   243  	out_words	const[0, int16]
   244  	pd_handle	pd_handle
   245  }
   246  
   247  # ah
   248  # ===
   249  
   250  create_ah_cmd_resp {
   251  	ah_handle	ah_handle
   252  }
   253  
   254  create_ah_cmd {
   255  	command		const[0x5, int32]
   256  	in_words	bytesize4[parent, int16]
   257  	out_words	bytesize4[response, int16]
   258  	response	ptr[out, create_ah_cmd_resp]
   259  	user_handle	int64
   260  	pd_handle	pd_handle
   261  	reserved	const[0x0, int32]
   262  	dgid		array[int8, 16]
   263  	flow_label	int32
   264  	sgid_index	const[0x0, int8]
   265  	hop_limit	int8
   266  	traffic_class	int8
   267  	reserved1	int8
   268  	dlid		int16
   269  	sl		int8
   270  	src_path_bits	int8
   271  	static_rate	int8
   272  	is_global	int8
   273  	port_num	const[0x1, int8]
   274  	reserved2	int8
   275  }
   276  
   277  destroy_ah_cmd {
   278  	command		const[0x8, int32]
   279  	in_words	bytesize4[parent, int16]
   280  	out_words	const[0x0, int16]
   281  }
   282  
   283  # mr
   284  # ======
   285  
   286  reg_mr_resp {
   287  	mr_handle	mr_handle
   288  	lkey		mr_lkey
   289  	rkey		mr_rkey
   290  }
   291  
   292  reg_mr_cmd {
   293  	command		const[0x9, int32]
   294  	in_words	const[0xc, int16]
   295  	out_words	const[0x3, int16]
   296  	response	ptr[out, reg_mr_resp]
   297  	start		ptr[in, int64]
   298  	length		len[start, int64]
   299  	hca_va		ptr[out, int64]
   300  	pd_handle	pd_handle
   301  	access_flags	flags[ib_access_flags, int32]
   302  	driver_data	array[int64]
   303  }
   304  
   305  rereg_mr_resp {
   306  	lkey	mr_lkey
   307  	rkey	mr_rkey
   308  }
   309  
   310  rereg_mr_cmd {
   311  	command		const[0xb, int32]
   312  	in_words	const[0xe, int16]
   313  	out_words	const[0x2, int16]
   314  	response	ptr[out, rereg_mr_resp]
   315  	mr_handle	mr_handle
   316  	flags		flags[ib_mr_rereg_flags, int32]
   317  	start		ptr[in, int64]
   318  	length		len[start, int64]
   319  	hca_va		ptr[out, int64]
   320  	pd_handle	pd_handle
   321  	access_flags	flags[ib_access_flags, int32]
   322  	driver_data	array[int64]
   323  }
   324  
   325  dereg_mr_cmd {
   326  	command		const[0xd, int32]
   327  	in_words	const[0x3, int16]
   328  	out_words	const[0x0, int16]
   329  	mr_handle	mr_handle
   330  }
   331  
   332  alloc_mw_resp {
   333  	mw_handle	mw_handle
   334  	rkey		mr_rkey
   335  }
   336  
   337  alloc_mw_cmd {
   338  	command		const[0xe, int32]
   339  	in_words	const[0x6, int16]
   340  	out_words	const[0x2, int16]
   341  	response	ptr[out, alloc_mw_resp]
   342  	pd_handle	pd_handle
   343  	mw_type		int8[1:2]
   344  	reserved0	const[0x0, int8]
   345  	reserved1	const[0x0, int16]
   346  }
   347  
   348  dealloc_mw_cmd {
   349  	command		const[0x10, int32]
   350  	in_words	const[0x4, int16]
   351  	out_words	const[0x0, int16]
   352  	mw_handle	mw_handle
   353  	reserved	const[0x0, int32]
   354  }
   355  
   356  # completion channel
   357  # ==================
   358  
   359  create_comp_channel_resp {
   360  	fd	fd
   361  }
   362  
   363  create_comp_channel_cmd {
   364  	command		const[0x11, int32]
   365  	in_words	const[0x6, int16]
   366  	out_words	const[0x1, int16]
   367  	response	ptr[out, create_comp_channel_resp]
   368  }
   369  
   370  # cq
   371  # ======
   372  
   373  create_cq_resp {
   374  	cq_handle	cq_handle
   375  	cqe		int32
   376  }
   377  
   378  mlx5_create_cq_cmd {
   379  	command			const[EX_CREATE_CQ_CMD, int32]
   380  	in_words		bytesize4[parent, int16]
   381  	out_words		bytesize4[response, int16]
   382  	response		ptr[out, create_cq_resp]
   383  	provider_in_words	const[0x5, int16]
   384  	provider_out_words	const[0x1, int16]
   385  	reserved0		const[0x0, int32]
   386  	user_handle		int64
   387  	cqe			int32
   388  	comp_vector		int32
   389  	comp_channel		const[0xffffffff, int32]
   390  	comp_mask		flags[create_cq_ex_mask, int32]
   391  	reserved1		const[0x0, int32]
   392  	buf_addr		ptr[in, array[int8, 4096]]
   393  	db_addr			ptr[in, array[int8, 4096]]
   394  	cqe_size		const[0x40, int32]
   395  	cqe_comp_en		int8[0:1]
   396  	cqe_comp_res_format	flags[mlx5_comp_cqe_res_format, int8]
   397  	flags			flags[mlx5_create_cq_flags, int16]
   398  }
   399  
   400  # this fails a lot on Mellanox HW. Leaving for others providers' sake and
   401  # adding mlx5_create_cq instead, which defines driver data properly.
   402  create_cq_cmd {
   403  	command		const[0x12, int32]
   404  	in_words	const[0x10, int16]
   405  	out_words	const[0x3, int16]
   406  	reponse		ptr[out, create_cq_resp]
   407  	user_handle	int64
   408  	cqe		int32
   409  	comp_vector	int32
   410  	comp_channel	int32
   411  	reserved	const[0x0, int32]
   412  	driver_data	array[int64]
   413  }
   414  
   415  create_cq_ex_cmd {
   416  	command			const[EX_CREATE_CQ_CMD, int32]
   417  	in_words		const[0x4, int16]
   418  	out_words		const[0x2, int16]
   419  	response		ptr[out, create_cq_resp]
   420  	provider_in_words	const[0x5, int16]
   421  	provider_out_words	const[0x1, int16]
   422  	reserved0		const[0x0, int32]
   423  	user_handle		int64
   424  	cqe			int32
   425  	comp_vector		const[0x0, int32]
   426  	comp_channel		const[0xffffffff, int32]
   427  	comp_mask		flags[create_cq_ex_mask, int32]
   428  	flags			flags[create_cq_ex_flags, int32]
   429  	reserved1		const[0x0, int32]
   430  }
   431  
   432  resize_cq_resp {
   433  	cqe		int32
   434  	reserved	const[0x0, int32]
   435  	driver_data	array[int64]
   436  }
   437  
   438  resize_cq_cmd {
   439  	command		const[0x13, int32]
   440  	in_words	const[0xa, int16]
   441  	out_words	const[0x2, int16]
   442  	response	ptr[out, resize_cq_resp]
   443  	cq_handle	cq_handle
   444  	cqe		int32
   445  	driver_data	array[int64]
   446  }
   447  
   448  destroy_cq_resp {
   449  	comp_events_reported	int32
   450  	async_events_reported	int32
   451  }
   452  
   453  destroy_cq_cmd {
   454  	command		const[0x14, int32]
   455  	in_words	const[0x6, int16]
   456  	out_words	const[0x2, int16]
   457  	response	ptr[out, destroy_cq_resp]
   458  	cq_handle	cq_handle
   459  	reserved	const[0x0, int32]
   460  }
   461  
   462  kern_wc {
   463  	wr_id		int64
   464  	status		int32
   465  	opcode		int32
   466  	vendor_err	int32
   467  	byte_len	int32
   468  	imm_data	int32
   469  	qp_num		int32
   470  	src_qp		int32
   471  	wc_flags	int32
   472  	pkey_index	int16
   473  	slid		int16
   474  	sl		int8
   475  	dlid_path_bits	int8
   476  	port_num	int8
   477  	reserved	const[0x0, int8]
   478  }
   479  
   480  poll_cq_resp {
   481  	count		int32
   482  	reserved	const[0x0, int32]
   483  	wc		array[kern_wc]
   484  }
   485  
   486  poll_cq_cmd {
   487  	command		const[0x15, int32]
   488  	in_words	const[0x6, int16]
   489  	out_words	const[0x2, int16]
   490  	response	ptr[out, poll_cq_resp]
   491  	cq_handle	cq_handle
   492  	ne		int32
   493  }
   494  
   495  req_notify_cq_cmd {
   496  	command		const[0x17, int32]
   497  	in_words	const[0x4, int16]
   498  	out_words	const[0x0, int16]
   499  	cq_handle	cq_handle
   500  	solicited	int32[0x0:0x1]
   501  }
   502  
   503  # qp_ex
   504  # =========
   505  
   506  create_qp_resp {
   507  	qp_handle	qp_handle
   508  	qpn		qp_number
   509  	max_send_wr	int32
   510  	max_recv_wr	int32
   511  	max_send_sge	int32
   512  	max_recv_sge	int32
   513  	max_inline_data	int32
   514  	reserved	const[0x0, int32]
   515  }
   516  
   517  create_qp_cmd {
   518  	command		const[0x18, int32]
   519  	in_words	bytesize4[parent, int16]
   520  	out_words	bytesize4[response, int16]
   521  	response	ptr[out, create_qp_resp]
   522  	user_handle	int64
   523  	pd_handle	pd_handle
   524  	send_cq_handle	cq_handle
   525  	recv_cq_handle	cq_handle
   526  	srq_handle	srq_handle
   527  	max_send_wr	int32
   528  	max_recv_wr	int32
   529  	max_send_sge	int32
   530  	max_recv_sge	int32
   531  	max_inline_data	int32
   532  	sq_sig_all	int8
   533  	qp_type		flags[ib_qp_type, int8]
   534  	is_srq		int8[0:1]
   535  	reserved1	const[0x0, int8]
   536  	driver_data	array[int64]
   537  }
   538  
   539  mlx5_create_qp_cmd {
   540  	command		const[EX_CREATE_QP_CMD, int32]
   541  	in_words	bytesize4[parent, int16]
   542  	out_words	bytesize4[response, int16]
   543  	response	ptr[out, create_qp_resp]
   544  	user_handle	int64
   545  	pd_handle	pd_handle
   546  	send_cq_handle	cq_handle
   547  	recv_cq_handle	cq_handle
   548  	srq_handle	srq_handle
   549  	max_send_wr	int32
   550  	max_recv_wr	int32
   551  	max_send_sge	int32
   552  	max_recv_sge	int32
   553  	max_inline_data	int32
   554  	sq_sig_all	int8
   555  	qp_type		flags[ib_qp_type, int8]
   556  	is_srq		int8[0:1]
   557  	reserved0	const[0x0, int8]
   558  	buf_addr	ptr[in, array[int8, 4096]]
   559  	db_addr		ptr[in, array[int8, 4096]]
   560  	sq_wqe_count	int32
   561  	rq_wqe_count	int32
   562  	rq_wqe_shift	int32
   563  	flags		flags[mlx5_create_qp_flags, int32]
   564  	uidx		int32
   565  	bfreg_index	int32
   566  	sq_buf_addr	ptr[in, array[int8, 4096]]
   567  } [packed]
   568  
   569  mlx5_create_qp_resp {
   570  	qp_handle	qp_handle
   571  	qpn		qp_number
   572  	max_send_wr	int32
   573  	max_recv_wr	int32
   574  	max_send_sge	int32
   575  	max_recv_sge	int32
   576  	max_inline_data	int32
   577  	reserved0	const[0x0, int32]
   578  	uuar_index	int32
   579  }
   580  
   581  mlx5_create_dv_qp_cmd {
   582  	command		const[0x18, int32]
   583  	in_words	const[0x1c, int16]
   584  	out_words	const[0x9, int16]
   585  	response	ptr[out, mlx5_create_qp_resp]
   586  	user_handle	int64
   587  	pd_handle	pd_handle
   588  	send_cq_handle	cq_handle
   589  	recv_cq_handle	cq_handle
   590  	srq_handle	srq_handle
   591  	max_send_wr	int32
   592  	max_recv_wr	int32
   593  	max_send_sge	int32
   594  	max_recv_sge	int32
   595  	max_inline_data	int32
   596  	sq_sig_all	int8
   597  	qp_type		const[0xff, int8]
   598  	is_srq		int8
   599  	reserved0	const[0x0, int8]
   600  	driver_data	array[int64]
   601  	buf_addr	ptr[in, array[int8, 4096]]
   602  	db_addr		ptr[in, array[int8, 4096]]
   603  	sq_wqe_count	int32
   604  	rq_wqe_count	int32
   605  	rq_wqe_shift	int32
   606  	flags		int32
   607  	uidx		int32
   608  	reserved1	const[0x0, int32]
   609  	access_key	int64
   610  } [packed]
   611  
   612  destroy_qp_resp {
   613  	events_reported	int32
   614  }
   615  
   616  destroy_qp_cmd {
   617  	command		const[0x1b, int32]
   618  	in_words	const[0x6, int16]
   619  	out_words	const[0x1, int16]
   620  	response	ptr[out, destroy_qp_resp]
   621  	qp_handle	qp_handle
   622  	reserved	const[0x0, int32]
   623  }
   624  
   625  query_qp_resp {
   626  	dest_dgid		array[int8, 16]
   627  	dest_flow_label		int32
   628  	dest_dlid		int16
   629  	dest_reserved		const[0x0, int16]
   630  	dest_sgid_index		int8
   631  	dest_hop_limit		int8
   632  	dest_traffic_class	int8
   633  	dest_sl			int8
   634  	dest_src_path_bits	int8
   635  	dest_static_rate	int8
   636  	dest_is_global		int8
   637  	dest_port_num		int8
   638  	alt_dest_dgid		array[int8, 16]
   639  	alt_dest_flow_label	int32
   640  	alt_dest_dlid		int16
   641  	alt_dest_reserved	const[0x0, int16]
   642  	alt_dest_sgid_index	int8
   643  	alt_dest_hop_limit	int8
   644  	alt_dest_traffic_class	int8
   645  	alt_dest_sl		int8
   646  	alt_dest_src_path_bits	int8
   647  	alt_dest_static_rate	int8
   648  	alt_dest_is_global	int8
   649  	alt_dest_port_num	int8
   650  	max_send_wr		int32
   651  	max_recv_wr		int32
   652  	max_send_sge		int32
   653  	max_recv_sge		int32
   654  	max_inline_data		int32
   655  	qkey			int32
   656  	rq_psn			int32
   657  	sq_psn			int32
   658  	dest_qp_num		int32
   659  	qp_access_flags		int32
   660  	pkey_index		int16
   661  	alt_pkey_index		int16
   662  	qp_state		int8
   663  	cur_qp_state		int8
   664  	path_mtu		int8
   665  	path_mig_state		int8
   666  	sq_draining		int8
   667  	max_rd_atomic		int8
   668  	max_dest_rd_atomic	int8
   669  	min_rnr_timer		int8
   670  	port_num		int8
   671  	timeout			int8
   672  	retry_cnt		int8
   673  	rnr_retry		int8
   674  	alt_port_num		int8
   675  	alt_timeout		int8
   676  	sq_sig_all		int8
   677  	reserved0		const[0x0, int8]
   678  	reserved1		const[0x0, int32]
   679  	driver_data		array[int64]
   680  }
   681  
   682  query_qp_cmd {
   683  	command		const[0x19, int32]
   684  	in_words	const[0x6, int16]
   685  	out_words	const[0x20, int16]
   686  	response	ptr[out, query_qp_resp]
   687  	qp_handle	qp_handle
   688  	attr_mask	flags[ib_qp_create_flags, int32]
   689  	driver_data	array[int64]
   690  }
   691  
   692  modify_qp_cmd {
   693  	command			const[0x1a, int32]
   694  	in_words		const[0x1e, int16]
   695  	out_words		const[0x0, int16]
   696  	dest_dgid		array[int8, 16]
   697  	dest_flow_label		int32
   698  	dest_dlid		int16
   699  	dest_reserved		int16
   700  	dest_sgid_index		int8
   701  	dest_hop_limit		int8
   702  	dest_traffic_class	int8
   703  	dest_sl			int8
   704  	dest_src_path_bits	int8
   705  	dest_static_rate	int8
   706  	dest_is_global		int8
   707  	dest_port_num		int8
   708  	alt_dest_dgid		array[int8, 16]
   709  	alt_dest_flow_label	int32
   710  	alt_dest_dlid		int16
   711  	alt_dest_reserved	int16
   712  	alt_dest_sgid_index	int8
   713  	alt_dest_hop_limit	int8
   714  	alt_dest_traffic_class	int8
   715  	alt_dest_sl		int8
   716  	alt_dest_src_path_bits	int8
   717  	alt_dest_static_rate	int8
   718  	alt_dest_is_global	int8
   719  	alt_dest_port_num	int8
   720  	qp_handle		int32
   721  	attr_mask		int32
   722  	qkey			int32
   723  	rq_psn			int32
   724  	sq_psn			int32
   725  	dest_qp_num		int32
   726  	qp_access_flags		int32
   727  	pkey_index		int16
   728  	alt_pkey_index		int16
   729  	qp_state		int8
   730  	cur_qp_state		int8
   731  	path_mtu		int8
   732  	path_mig_state		int8
   733  	en_sqd_async_notify	int8
   734  	max_rd_atomic		int8
   735  	max_dest_rd_atomic	int8
   736  	min_rnr_timer		int8
   737  	port_num		int8
   738  	timeout			int8
   739  	retry_cnt		int8
   740  	rnr_retry		int8
   741  	alt_port_num		int8
   742  	alt_timeout		int8
   743  	reserved		const[0x0, int16]
   744  }
   745  
   746  # wq
   747  #====
   748  
   749  create_wq_resp {
   750  	comp_mask	int32
   751  	response_length	int32
   752  	wq_handle	wq_handle
   753  	max_wr		int32
   754  	max_sge		int32
   755  	wqn		int32
   756  }
   757  
   758  create_wq_cmd {
   759  	command			const[0x80000034, int32]
   760  	in_words		const[0x5, int16]
   761  	out_words		bytesize4[response, int16]
   762  	response		ptr[out, create_wq_resp]
   763  	provider_in_words	const[0x6, int16]
   764  	provider_out_words	const[0x1, int16]
   765  	cmd_hdr_reserved	const[0x0, int32]
   766  	comp_mask		const[0x0, int32]
   767  	wq_type			flags[wq_type, int32]
   768  	user_handle		int64
   769  	pd_handle		pd_handle
   770  	cq_handle		cq_handle
   771  	max_wr			int32
   772  	max_sge			int32
   773  	create_flags		flags[create_wq_flags, int32]
   774  	reserved		const[0x0, int32]
   775  }
   776  
   777  mlx5_create_wq_resp {
   778  	comp_mask		int32
   779  	response_length		const[0x6, int32]
   780  	wq_handle		wq_handle
   781  	max_wr			int32
   782  	max_sge			int32
   783  	wqn			int32
   784  	mlx5_response_length	bytesize4[parent, int32]
   785  	reserver		const[0x0, int32]
   786  }
   787  
   788  mlx5_create_wq_cmd {
   789  	command				const[0x80000034, int32]
   790  	in_words			const[0x5, int16]
   791  	out_words			bytesize4[response, int16]
   792  	response			ptr[out, mlx5_create_wq_resp]
   793  	provider_in_words		const[0x6, int16]
   794  	provider_out_words		const[0x1, int16]
   795  	cmd_hdr_reserved		const[0x0, int32]
   796  	comp_mask			const[0x0, int32]
   797  	wq_type				flags[wq_type, int32]
   798  	user_handle			int64
   799  	pd_handle			pd_handle
   800  	cq_handle			cq_handle
   801  	max_wr				int32
   802  	max_sge				int32
   803  	create_flags			flags[create_wq_flags, int32]
   804  	reserved			const[0x0, int32]
   805  	buf_addr			ptr[in, array[int8, 4096]]
   806  	db_addr				ptr[in, array[int8, 4096]]
   807  	rq_wqe_count			int32
   808  	rq_wqe_shift			int32
   809  	user_index			int32
   810  	flags				const[0x0, int32]
   811  	provider_comp_mask		const[0x0, int32]
   812  	single_stride_log_num_of_bytes	const[0x0, int32]
   813  	single_wqe_log_num_of_strides	const[0x0, int32]
   814  	two_byte_shift_en		int32[0:1]
   815  }
   816  
   817  destroy_wq_resp {
   818  	comp_mask	int32
   819  	response_length	int32
   820  	events_reported	int32
   821  	reserved	const[0x0, int32]
   822  }
   823  
   824  destroy_wq_cmd {
   825  	command			const[0x80000036, int32]
   826  	in_words		const[0x1, int16]
   827  	out_words		const[0x2, int16]
   828  	response		ptr[out, destroy_wq_resp]
   829  	provider_in_words	const[0x0, int16]
   830  	provider_out_words	const[0x0, int16]
   831  	cmd_hdr_reserved	const[0x0, int32]
   832  	comp_mask		int32[0x0:0xf]
   833  	wq_handle		wq_handle
   834  }
   835  
   836  mlx5_modify_wq_cmd {
   837  	command			const[0x80000035, int32]
   838  	in_words		const[0x3, int16]
   839  	out_words		const[0x0, int16]
   840  	response		const[0x0, int64]
   841  	provider_in_words	const[0x1, int16]
   842  	provider_out_words	const[0x0, int16]
   843  	cmd_hdr_reserved	const[0x0, int32]
   844  	attr_mask		flags[modify_wq_attr_flags, int32]
   845  	wq_handle		wq_handle
   846  	wq_state		int32[0:3]
   847  	current_wq_state	int32[0:3]
   848  	flags			flags[modify_wq_flags, int32]
   849  	flags_mask		flags[modify_wq_flags, int32]
   850  	comp_mask		const[0x0, int32]
   851  	reserved		const[0x0, int32]
   852  }
   853  
   854  # RSS (indirection table)
   855  #========================
   856  
   857  create_rwq_ind_table_resp {
   858  	comp_mask	int32
   859  	response_length	bytesize4[parent, int32]
   860  	ind_tbl_handle	ind_tbl_handle
   861  	ind_tbl_num	int32
   862  }
   863  
   864  # currently hard coded to use 2 WQs. Need to figure out how to
   865  # make it a variable.
   866  create_rwq_ind_table_cmd {
   867  	command			const[0x80000037, int32]
   868  	in_words		const[0x2, int16]
   869  	out_words		const[0x2, int16]
   870  	response		ptr[out, create_rwq_ind_table_resp]
   871  	provider_in_words	const[0x0, int16]
   872  	provider_out_words	const[0x0, int16]
   873  	cmd_hdr_reserved	const[0x0, int32]
   874  	comp_mask		const[0x0, int32]
   875  	log_ind_tbl_size	const[0x1, int32]
   876  	wq_handles		array[wq_handle, 2]
   877  }
   878  
   879  destroy_rwq_ind_table_cmd {
   880  	comp_mask	int32
   881  	ind_tbl_handle	ind_tbl_handle
   882  }
   883  
   884  # Send WR
   885  #========
   886  
   887  rdma {
   888  	remote_addr	int64
   889  	rkey		mr_rkey
   890  	reserved	const[0x0, int32]
   891  }
   892  
   893  atomic {
   894  	remote_addr	int64
   895  	compare_add	int64
   896  	swap		int64
   897  	rkey		mr_rkey
   898  	reserved	const[0x0, int32]
   899  }
   900  
   901  ud {
   902  	ah		int32
   903  	remote_qpn	int32
   904  	remote_qkey	int32
   905  	reserved	const[0x0, int32]
   906  }
   907  
   908  xrc {
   909  	remote_srqn	int32
   910  }
   911  
   912  wr [
   913  	rdma	rdma
   914  	atomic	atomic
   915  	ud	ud
   916  ]
   917  
   918  kern_send_wr {
   919  	wr_id		int64
   920  	num_sge		int32
   921  	opcode		int32[0:20]
   922  	send_flags	flags[ib_send_flags, int32]
   923  	imm_data	int32
   924  	wr		wr
   925  	qp_type		xrc
   926  }
   927  
   928  post_send_cmd {
   929  	command		const[0x1c, int32]
   930  	in_words	const[0x8, int16]
   931  	out_words	const[0x1, int16]
   932  	response	ptr[out, post_send_resp]
   933  	qp_handle	qp_handle
   934  	wr_count	int32
   935  	sge_count	int32
   936  	wqe_size	int32
   937  	send_wr		array[kern_send_wr]
   938  }
   939  
   940  post_send_resp {
   941  	bad_wr	int32
   942  }
   943  
   944  post_recv_cmd {
   945  	command		const[0x1d, int32]
   946  	in_words	const[0x8, int16]
   947  	out_words	const[0x1, int16]
   948  	response	ptr[out, post_recv_resp]
   949  	qp_handle	qp_handle
   950  	wr_count	int32
   951  	sge_count	int32
   952  	wqe_size	int32
   953  	recv_wr		array[kern_recv_wr]
   954  }
   955  
   956  post_recv_resp {
   957  	bad_wr	int32
   958  }
   959  
   960  attach_mcast_cmd {
   961  	command		const[0x1e, int32]
   962  	in_words	const[0x8, int16]
   963  	out_words	const[0x0, int16]
   964  	gid		array[int8, 0x10]
   965  	qp_handle	qp_handle
   966  	mlid		int16
   967  	reserved	const[0x0, int16]
   968  	driver_data	array[int64]
   969  }
   970  
   971  detach_mcast_cmd {
   972  	command		const[0x1f, int32]
   973  	in_words	const[0x8, int16]
   974  	out_words	const[0x0, int16]
   975  	gid		array[int8, 0x10]
   976  	qp_handle	qp_handle
   977  	mlid		int16
   978  	reserved	const[0x0, int16]
   979  	driver_data	array[int64]
   980  }
   981  
   982  create_srq_resp {
   983  	srq_handle	srq_handle
   984  	max_wr		int32
   985  	max_sge		int32
   986  	srqn		int32
   987  }
   988  
   989  create_srq_cmd {
   990  	command		const[0x20, int32]
   991  	in_words	const[0xa, int16]
   992  	out_words	const[0x4, int16]
   993  	response	ptr[out, create_srq_resp]
   994  	user_handle	int64
   995  	pd_handle	pd_handle
   996  	max_wr		int32
   997  	max_sge		int32
   998  	srq_limit	int32
   999  	driver_data	array[int64]
  1000  }
  1001  
  1002  mlx5_ib_create_srq_resp {
  1003  	srqn		int32
  1004  	reserved	const[0x0, int32]
  1005  }
  1006  
  1007  mlx5_create_srq_cmd {
  1008  	command		const[0x27, int32]
  1009  	in_words	const[0x16, int16]
  1010  	out_words	const[0x6, int16]
  1011  	reserved0	const[0x0, int32]
  1012  	response	ptr[out, mlx5_ib_create_srq_resp]
  1013  	user_handle	int64
  1014  	srq_type	flags[srq_type, int32]
  1015  	pd_handle	pd_handle
  1016  	max_wr		int32
  1017  	max_sge		int32
  1018  	srq_limit	int32
  1019  	max_num_tags	int32
  1020  	xrcd_handle	xrcd_handle
  1021  	cq_handle	cq_handle
  1022  	buf_addr	ptr[in, int64]
  1023  	db_addr		ptr[in, int64]
  1024  	flags		flags[create_srq_ex_flags, int32]
  1025  	reserved1	const[0x0, int32]
  1026  	uidx		int32
  1027  	reserved2	const[0x0, int32]
  1028  }
  1029  
  1030  modify_srq_cmd {
  1031  	command		const[0x21, int32]
  1032  	in_words	const[0x6, int16]
  1033  	out_words	const[0x0, int16]
  1034  	srq_handle	srq_handle
  1035  	attr_mask	int32[0x0:0x10]
  1036  	max_wr		int32
  1037  	srq_limit	int32
  1038  	driver_data	array[int64]
  1039  }
  1040  
  1041  query_srq_resp {
  1042  	max_wr		int32
  1043  	max_sge		int32
  1044  	srq_limit	int32
  1045  	reserved	const[0x0, int32]
  1046  }
  1047  
  1048  query_srq_cmd {
  1049  	command		const[0x22, int32]
  1050  	in_words	const[0x6, int16]
  1051  	out_words	const[0x4, int16]
  1052  	response	ptr[out, query_srq_resp]
  1053  	srq_handle	srq_handle
  1054  	reserved	const[0x0, int32]
  1055  	driver_data	array[int64]
  1056  }
  1057  
  1058  destroy_srq_resp {
  1059  	events_reported	int32
  1060  }
  1061  
  1062  destroy_srq_cmd {
  1063  	command		const[0x23, int32]
  1064  	in_words	const[0x6, int16]
  1065  	out_words	const[0x1, int16]
  1066  	response	ptr[out, destroy_srq_resp]
  1067  	srq_handle	srq_handle
  1068  	reserved	const[0x0, int32]
  1069  }
  1070  
  1071  kern_recv_wr {
  1072  	wr_id		int64
  1073  	num_sge		int32
  1074  	reserved	const[0x0, int32]
  1075  }
  1076  
  1077  post_srq_recv_resp {
  1078  	bad_wr	int32
  1079  }
  1080  
  1081  post_srq_recv_cmd {
  1082  	command		const[0x24, int32]
  1083  	in_words	const[0x7, int16]
  1084  	out_words	const[0x1, int16]
  1085  	response	ptr[out, post_srq_recv_resp]
  1086  	wr_count	int32
  1087  	sge_count	int32
  1088  	wqe_size	int32
  1089  	recv_wr		array[kern_recv_wr]
  1090  }
  1091  
  1092  open_xrcd_resp {
  1093  	xrcd_handle	xrcd_handle
  1094  }
  1095  
  1096  open_xrcd_cmd {
  1097  	command		const[0x25, int32]
  1098  	in_words	const[0x6, int16]
  1099  	out_words	const[0x1, int16]
  1100  	response	ptr[out, open_xrcd_resp]
  1101  	fd		fd[opt]
  1102  	oflags		flags[xrcd_flags, int32]
  1103  	driver_data	array[int64]
  1104  }
  1105  
  1106  xrcd_flags = O_CREAT, O_EXCL
  1107  
  1108  close_xrcd_cmd {
  1109  	command		const[0x26, int32]
  1110  	in_words	const[0x3, int16]
  1111  	out_words	const[0x0, int16]
  1112  	xrcd_handle	xrcd_handle
  1113  }
  1114  
  1115  # create_flow
  1116  # ===============
  1117  
  1118  ib_flow_eth_filter {
  1119  	dst_mac		mac_addr
  1120  	src_mac		mac_addr
  1121  	ether_type	flags[ether_types, int16be]
  1122  	vlan_tag	int16
  1123  }
  1124  
  1125  ib_flow_spec_eth {
  1126  	type		const[IB_FLOW_SPEC_ETH, int32]
  1127  	size		bytesize[parent, int16]
  1128  	reserved	const[0x0, int16]
  1129  	val		ib_flow_eth_filter
  1130  	mask		ib_flow_eth_filter
  1131  }
  1132  
  1133  ib_flow_ipv4_filter {
  1134  	src_ip	ipv4_addr
  1135  	dst_ip	ipv4_addr
  1136  	proto	flags[ipv4_types, int8]
  1137  	tos	int8
  1138  	ttl	int8
  1139  	flags	flags[ib_ipv4_flags, int8]
  1140  }
  1141  
  1142  ib_flow_spec_ipv4 {
  1143  	type		const[IB_FLOW_SPEC_IPV4, int32]
  1144  	size		bytesize[parent, int16]
  1145  	reserved	const[0x0, int16]
  1146  	val		ib_flow_ipv4_filter
  1147  	mask		ib_flow_ipv4_filter
  1148  }
  1149  
  1150  ib_flow_ipv6_filter {
  1151  	src_ip		ipv6_addr
  1152  	dst_ip		ipv6_addr
  1153  	flow_label	int32
  1154  	next_hdr	flags[ipv6_types, int8]
  1155  	traffic_class	int8
  1156  	hop_limit	int8
  1157  	reserved	const[0x0, int8]
  1158  }
  1159  
  1160  ib_flow_spec_ipv6 {
  1161  	type		const[IB_FLOW_SPEC_IPV6, int32]
  1162  	size		bytesize[parent, int16]
  1163  	reserved	const[0x0, int16]
  1164  	val		ib_flow_ipv6_filter
  1165  	mask		ib_flow_ipv6_filter
  1166  }
  1167  
  1168  ib_flow_tcp_udp_filter {
  1169  	dst_port	sock_port
  1170  	src_port	sock_port
  1171  }
  1172  
  1173  ib_flow_spec_tcp_udp {
  1174  	type		int32[0x40:0x41]
  1175  	size		bytesize[parent, int16]
  1176  	reserved	const[0x0, int16]
  1177  	val		ib_flow_tcp_udp_filter
  1178  	mask		ib_flow_tcp_udp_filter
  1179  }
  1180  
  1181  ib_flow_esp_filter {
  1182  	spi	int32
  1183  	seq	int32
  1184  }
  1185  
  1186  ib_flow_spec_esp {
  1187  	type		const[IB_FLOW_SPEC_ESP, int32]
  1188  	size		bytesize[parent, int16]
  1189  	reserved	const[0x0, int16]
  1190  	val		ib_flow_esp_filter
  1191  	mask		ib_flow_esp_filter
  1192  }
  1193  
  1194  ib_flow_tunnel_filter {
  1195  	tunnel_id	int32
  1196  }
  1197  
  1198  ib_flow_spec_tunnel {
  1199  	type		const[IB_FLOW_SPEC_VXLAN_TUNNEL, int32]
  1200  	size		bytesize[parent, int16]
  1201  	reserved	const[0x0, int16]
  1202  	val		ib_flow_tunnel_filter
  1203  	mask		ib_flow_tunnel_filter
  1204  }
  1205  
  1206  ib_flow_gre_filter {
  1207  	c_ks_res0_ver	int16
  1208  	protocol	int16
  1209  	key		int32
  1210  }
  1211  
  1212  ib_flow_spec_gre {
  1213  	type		const[IB_FLOW_SPEC_GRE, int32]
  1214  	size		bytesize[parent, int16]
  1215  	reserved	const[0x0, int16]
  1216  	val		ib_flow_gre_filter
  1217  	mask		ib_flow_gre_filter
  1218  }
  1219  
  1220  ib_flow_mpls_filter {
  1221  	tag	int32
  1222  }
  1223  
  1224  ib_flow_spec_mpls {
  1225  	type		const[IB_FLOW_SPEC_MPLS, int32]
  1226  	size		bytesize[parent, int16]
  1227  	reserved	const[0x0, int16]
  1228  	val		ib_flow_mpls_filter
  1229  	mask		ib_flow_mpls_filter
  1230  }
  1231  
  1232  ib_flow_spec_action_tag {
  1233  	type		const[IB_FLOW_SPEC_ACTION_TAG, int32]
  1234  	size		bytesize[parent, int16]
  1235  	reserved	const[0x0, int16]
  1236  	tag_id		int32
  1237  	reserved2	const[0x0, int32]
  1238  }
  1239  
  1240  ib_flow_spec_action_drop {
  1241  	type		const[IB_FLOW_SPEC_ACTION_DROP, int32]
  1242  	size		bytesize[parent, int16]
  1243  	reserved	const[0x0, int16]
  1244  }
  1245  
  1246  ib_uverbs_flow_spec_action_count {
  1247  	type		const[IB_FLOW_SPEC_ACTION_COUNT, int32]
  1248  	size		bytesize[parent, int16]
  1249  	reserved	const[0x0, int16]
  1250  	handle		vcontext_handle
  1251  	reserved1	const[0x0, int32]
  1252  }
  1253  
  1254  union_ib_flow_spec [
  1255  	eth	ib_flow_spec_eth
  1256  	ipv6	ib_flow_spec_ipv6
  1257  	ipv4	ib_flow_spec_ipv4
  1258  	tcp_udp	ib_flow_spec_tcp_udp
  1259  	tunnel	ib_flow_spec_tunnel
  1260  	gre	ib_flow_spec_gre
  1261  	esp	ib_flow_spec_esp
  1262  	mpls	ib_flow_spec_mpls
  1263  	tag	ib_flow_spec_action_tag
  1264  	drop	ib_flow_spec_action_drop
  1265  	count	ib_uverbs_flow_spec_action_count
  1266  ]
  1267  
  1268  ib_uverbs_flow_attr {
  1269  	type		int32[0:3]
  1270  	size		bytesize[flow_specs, int16]
  1271  	priority	int16[0:7]
  1272  	num_of_specs	len[flow_specs, int8]
  1273  	reserved	array[const[0x0, int8], 2]
  1274  	port		int8
  1275  	flags		flags[ib_flow_flags, int32]
  1276  	flow_specs	array[union_ib_flow_spec]
  1277  }
  1278  
  1279  create_flow_cmd_ex {
  1280  	comp_mask	const[0x0, int32]
  1281  	qp_handle	qp_handle	(in)
  1282  	flow_attr	ib_uverbs_flow_attr
  1283  }
  1284  
  1285  create_flow_resp {
  1286  	comp_mask	int32
  1287  	flow_handle	flow_handle
  1288  }
  1289  
  1290  create_flow_cmd {
  1291  	command			const[IB_USER_VERBS_EX_CMD_CREATE_FLOW, int32]
  1292  	in_words		bytesize8[flow_ex, int16]
  1293  	out_words		const[0x1, int16]
  1294  	response		ptr[out, create_flow_resp]
  1295  	provider_in_words	const[0x0, int16]
  1296  	provider_out_words	const[0x0, int16]
  1297  	reserved		const[0x0, int32]
  1298  	flow_ex			create_flow_cmd_ex	(in)
  1299  }
  1300  
  1301  destroy_flow_cmd {
  1302  	command			const[IB_USER_VERBS_EX_CMD_DESTROY_FLOW, int32]
  1303  	in_words		const[0x6, int16]
  1304  	out_words		const[0x0, int16]
  1305  	response		const[0x0, int64]
  1306  	provider_in_words	const[0x0, int16]
  1307  	provider_out_words	const[0x0, int16]
  1308  	reserved		const[0x0, int32]
  1309  	comp_mask		const[0x0, int32]
  1310  	flow_handle		flow_handle
  1311  }
  1312  
  1313  # ioctl interface
  1314  
  1315  ib_uverbs_attr_flags = UVERBS_ATTR_F_MANDATORY
  1316  ib_read_counters_flags = IB_UVERBS_READ_COUNTERS_PREFER_CACHED
  1317  
  1318  # This used to be a resource, but it's unclear what is supposed to create this resource,
  1319  # so for now it's downgraded to just int.
  1320  # resource vcontext_handle[int32]
  1321  type vcontext_handle int32
  1322  
  1323  ib_uverbs_create_counters_cmd {
  1324  	length		bytesize8[ib_uverbs_create_counters_cmd, int16]
  1325  	object_id	const[UVERBS_OBJECT_COUNTERS, int16]
  1326  	method_id	const[UVERBS_METHOD_COUNTERS_CREATE, int16]
  1327  	num_attrs	const[1, int16]
  1328  	reserved0	const[0x0, int64]
  1329  	driver_id	const[RDMA_DRIVER_MLX5, int32]
  1330  	reserved1	const[0x0, int32]
  1331  
  1332  	attr_id		const[UVERBS_ATTR_CREATE_COUNTERS_HANDLE, int16]
  1333  	len		int16
  1334  	flags		flags[ib_uverbs_attr_flags, int16]
  1335  	elem_id		int8
  1336  	reserved2	const[0x0, int8]
  1337  # TODO: reserved3 seems unnecessary: https://elixir.bootlin.com/linux/latest/source/include/uapi/rdma/rdma_user_ioctl_cmds.h#L58
  1338  	reserved3	const[0x0, int16]
  1339  # TODO: Is the following field really optional, or, is opt used as a workaround?
  1340  # Now that we have per-field directions, this can be fixed if it is the second case.
  1341  	vcontext_handle	vcontext_handle
  1342  	more_data	int32
  1343  }
  1344  
  1345  ib_uverbs_destroy_counters_cmd {
  1346  	length		bytesize8[ib_uverbs_destroy_counters_cmd, int16]
  1347  	object_id	const[UVERBS_OBJECT_COUNTERS, int16]
  1348  	method_id	const[UVERBS_METHOD_COUNTERS_DESTROY, int16]
  1349  	num_attrs	const[1, int16]
  1350  	reserved0	const[0x0, int64]
  1351  	driver_id	const[RDMA_DRIVER_MLX5, int32]
  1352  	reserved1	const[0x0, int32]
  1353  
  1354  	attr_id		const[UVERBS_ATTR_DESTROY_COUNTERS_HANDLE, int16]
  1355  	len		int16
  1356  	flags		flags[ib_uverbs_attr_flags, int16]
  1357  	elem_id		int8
  1358  	reserved2	const[0x0, int8]
  1359  	reserved3	const[0x0, int16]
  1360  	vcontext_handle	vcontext_handle
  1361  	more_data	int32
  1362  }
  1363  
  1364  # in UVERBS_ATTR_READ_COUNTERS_FLAGS, assuming that sizeof(uint32_t is 4)
  1365  ib_uverbs_read_counters_cmd {
  1366  	length		bytesize8[ib_uverbs_read_counters_cmd, int16]
  1367  	object_id	const[UVERBS_OBJECT_COUNTERS, int16]
  1368  	method_id	const[UVERBS_METHOD_COUNTERS_READ, int16]
  1369  	num_attrs	const[0x3, int16]
  1370  	reserved0	const[0x0, int64]
  1371  	driver_id	const[RDMA_DRIVER_MLX5, int32]
  1372  	reserved1	const[0x0, int32]
  1373  
  1374  	attr_id0	const[UVERBS_ATTR_READ_COUNTERS_HANDLE, int16]
  1375  	len0		int16
  1376  	flags0		flags[ib_uverbs_attr_flags, int16]
  1377  	reserved2	const[0x0, int16]
  1378  	vcontext_handle	vcontext_handle	(in)
  1379  	more_data0	int32
  1380  
  1381  	attr_id1	const[UVERBS_ATTR_READ_COUNTERS_BUFF, int16]
  1382  	len1		bytesize8[data, int16]
  1383  	flags1		flags[ib_uverbs_attr_flags, int16]
  1384  	reserved3	const[0x0, int16]
  1385  	data		buffer[out]
  1386  
  1387  	attr_id2	const[UVERBS_ATTR_READ_COUNTERS_FLAGS, int16]
  1388  	len2		const[0x4, int16]
  1389  	flags2		flags[ib_uverbs_attr_flags, int16]
  1390  	reserved4	const[0x0, int16]
  1391  	flags		flags[ib_read_counters_flags, int32]
  1392  	more_data1	int32
  1393  }
  1394  
  1395  # commands
  1396  ioctl$CREATE_COUNTERS(fd fd_rdma, cmd const[RDMA_VERBS_IOCTL], arg ptr[inout, ib_uverbs_create_counters_cmd])
  1397  ioctl$DESTROY_COUNTERS(fd fd_rdma, cmd const[RDMA_VERBS_IOCTL], arg ptr[in, ib_uverbs_destroy_counters_cmd])
  1398  ioctl$READ_COUNTERS(fd fd_rdma, cmd const[RDMA_VERBS_IOCTL], arg ptr[inout, ib_uverbs_read_counters_cmd])
  1399  
  1400  # device
  1401  openat$uverbs0(fd const[AT_FDCWD], file ptr[in, string["/dev/infiniband/uverbs0"]], flags const[O_RDWR], mode const[0]) fd_rdma
  1402  write$MLX5_GET_CONTEXT(fd fd_rdma, buf ptr[inout, mlx5_get_context_cmd], len len[buf])
  1403  close$ibv_device(fd fd_rdma)
  1404  write$QUERY_DEVICE_EX(fd fd_rdma, buf ptr[inout, query_device_cmd_ex], len len[buf])
  1405  
  1406  # query_port
  1407  write$QUERY_PORT(fd fd_rdma, buf ptr[inout, query_port_cmd], len len[buf])
  1408  
  1409  # pd
  1410  write$ALLOC_PD(fd fd_rdma, buf ptr[inout, alloc_pd_cmd], len len[buf])
  1411  write$MLX5_ALLOC_PD(fd fd_rdma, buf ptr[inout, mlx5_alloc_pd_cmd], len len[buf])
  1412  #dealloc_pd
  1413  write$DEALLOC_PD(fd fd_rdma, buf ptr[inout, dealloc_pd_cmd], len len[buf])
  1414  
  1415  #ah
  1416  write$CREATE_AH(fd fd_rdma, buf ptr[inout, create_ah_cmd], len len[buf])
  1417  write$DESTROY_AH(fd fd_rdma, buf ptr[inout, destroy_ah_cmd], len len[buf])
  1418  
  1419  # mr
  1420  write$REG_MR(fd fd_rdma, buf ptr[inout, reg_mr_cmd], len len[buf])
  1421  write$REREG_MR(fd fd_rdma, buf ptr[inout, rereg_mr_cmd], len len[buf])
  1422  write$DEREG_MR(fd fd_rdma, buf ptr[inout, dereg_mr_cmd], len len[buf])
  1423  
  1424  # mw
  1425  write$ALLOC_MW(fd fd_rdma, buf ptr[inout, alloc_mw_cmd], len len[buf])
  1426  write$DEALLOC_MW(fd fd_rdma, buf ptr[inout, dealloc_mw_cmd], len len[buf])
  1427  
  1428  #comp_channel
  1429  write$CREATE_COMP_CHANNEL(fd fd_rdma, buf ptr[inout, create_comp_channel_cmd], len len[buf])
  1430  
  1431  # cq
  1432  write$CREATE_CQ(fd fd_rdma, buf ptr[inout, create_cq_cmd], len len[buf])
  1433  write$MLX5_CREATE_CQ(fd fd_rdma, buf ptr[inout, mlx5_create_cq_cmd], len len[buf])
  1434  write$CREATE_CQ_EX(fd fd_rdma, buf ptr[inout, create_cq_ex_cmd], len len[buf])
  1435  write$RESIZE_CQ(fd fd_rdma, buf ptr[inout, resize_cq_cmd], len len[buf])
  1436  write$DESTROY_CQ(fd fd_rdma, buf ptr[inout, destroy_cq_cmd], len len[buf])
  1437  write$POLL_CQ(fd fd_rdma, buf ptr[inout, poll_cq_cmd], len len[buf])
  1438  write$REQ_NOTIFY_CQ(fd fd_rdma, buf ptr[inout, req_notify_cq_cmd], len len[buf])
  1439  
  1440  # qp
  1441  write$CREATE_QP(fd fd_rdma, buf ptr[inout, create_qp_cmd], len len[buf])
  1442  
  1443  # qp_ex
  1444  write$MLX5_CREATE_QP(fd fd_rdma, buf ptr[inout, mlx5_create_qp_cmd], len len[buf])
  1445  write$MLX5_CREATE_DV_QP(fd fd_rdma, buf ptr[inout, mlx5_create_dv_qp_cmd], len len[buf])
  1446  write$DESTROY_QP(fd fd_rdma, buf ptr[inout, destroy_qp_cmd], len len[buf])
  1447  write$QUERY_QP(fd fd_rdma, buf ptr[inout, query_qp_cmd], len len[buf])
  1448  write$MODIFY_QP(fd fd_rdma, buf ptr[inout, modify_qp_cmd], len len[buf])
  1449  write$POST_SEND(fd fd_rdma, buf ptr[inout, post_send_cmd], len len[buf])
  1450  write$POST_RECV(fd fd_rdma, buf ptr[inout, post_recv_cmd], len len[buf])
  1451  write$ATTACH_MCAST(fd fd_rdma, buf ptr[in, attach_mcast_cmd], len len[buf])
  1452  write$DETACH_MCAST(fd fd_rdma, buf ptr[in, detach_mcast_cmd], len len[buf])
  1453  write$CREATE_SRQ(fd fd_rdma, buf ptr[inout, create_srq_cmd], len len[buf])
  1454  write$MLX5_CREATE_SRQ(fd fd_rdma, buf ptr[inout, mlx5_create_srq_cmd], len len[buf])
  1455  write$MODIFY_SRQ(fd fd_rdma, buf ptr[in, modify_srq_cmd], len len[buf])
  1456  write$QUERY_SRQ(fd fd_rdma, buf ptr[inout, query_srq_cmd], len len[buf])
  1457  write$DESTROY_SRQ(fd fd_rdma, buf ptr[inout, destroy_srq_cmd], len len[buf])
  1458  write$POST_SRQ_RECV(fd fd_rdma, buf ptr[inout, post_srq_recv_cmd], len len[buf])
  1459  write$OPEN_XRCD(fd fd_rdma, buf ptr[inout, open_xrcd_cmd], len len[buf])
  1460  write$CLOSE_XRCD(fd fd_rdma, buf ptr[inout, close_xrcd_cmd], len len[buf])
  1461  
  1462  # wq
  1463  write$CREATE_WQ(fd fd_rdma, buf ptr[inout, create_wq_cmd], len len[buf])
  1464  write$MLX5_CREATE_WQ(fd fd_rdma, buf ptr[inout, mlx5_create_wq_cmd], len len[buf])
  1465  write$MLX5_MODIFY_WQ(fd fd_rdma, buf ptr[inout, mlx5_modify_wq_cmd], len len[buf])
  1466  write$DESTROY_WQ(fd fd_rdma, buf ptr[inout, destroy_wq_cmd], len len[buf])
  1467  
  1468  # RSS
  1469  write$CREATE_RWQ_IND_TBL(fd fd_rdma, buf ptr[inout, create_rwq_ind_table_cmd], len len[buf])
  1470  write$DESTROY_RWQ_IND_TBL(fd fd_rdma, buf ptr[inout, destroy_rwq_ind_table_cmd], len len[buf])
  1471  
  1472  # create_flow
  1473  write$CREATE_FLOW(fd fd_rdma, buf ptr[inout, create_flow_cmd], len len[buf])
  1474  write$DESTROY_FLOW(fd fd_rdma, buf ptr[in, destroy_flow_cmd], len len[buf])