xref: /openbmc/linux/include/uapi/rdma/ib_user_verbs.h (revision 1a931707ad4a46e79d4ecfee56d8f6e8cc8d4f28)
1d50e14abSJason Gunthorpe /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
27235aa79SDavid Howells /*
37235aa79SDavid Howells  * Copyright (c) 2005 Topspin Communications.  All rights reserved.
47235aa79SDavid Howells  * Copyright (c) 2005, 2006 Cisco Systems.  All rights reserved.
57235aa79SDavid Howells  * Copyright (c) 2005 PathScale, Inc.  All rights reserved.
67235aa79SDavid Howells  * Copyright (c) 2006 Mellanox Technologies.  All rights reserved.
77235aa79SDavid Howells  *
87235aa79SDavid Howells  * This software is available to you under a choice of one of two
97235aa79SDavid Howells  * licenses.  You may choose to be licensed under the terms of the GNU
107235aa79SDavid Howells  * General Public License (GPL) Version 2, available from the file
117235aa79SDavid Howells  * COPYING in the main directory of this source tree, or the
127235aa79SDavid Howells  * OpenIB.org BSD license below:
137235aa79SDavid Howells  *
147235aa79SDavid Howells  *     Redistribution and use in source and binary forms, with or
157235aa79SDavid Howells  *     without modification, are permitted provided that the following
167235aa79SDavid Howells  *     conditions are met:
177235aa79SDavid Howells  *
187235aa79SDavid Howells  *      - Redistributions of source code must retain the above
197235aa79SDavid Howells  *        copyright notice, this list of conditions and the following
207235aa79SDavid Howells  *        disclaimer.
217235aa79SDavid Howells  *
227235aa79SDavid Howells  *      - Redistributions in binary form must reproduce the above
237235aa79SDavid Howells  *        copyright notice, this list of conditions and the following
247235aa79SDavid Howells  *        disclaimer in the documentation and/or other materials
257235aa79SDavid Howells  *        provided with the distribution.
267235aa79SDavid Howells  *
277235aa79SDavid Howells  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
287235aa79SDavid Howells  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
297235aa79SDavid Howells  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
307235aa79SDavid Howells  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
317235aa79SDavid Howells  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
327235aa79SDavid Howells  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
337235aa79SDavid Howells  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
347235aa79SDavid Howells  * SOFTWARE.
357235aa79SDavid Howells  */
367235aa79SDavid Howells 
377235aa79SDavid Howells #ifndef IB_USER_VERBS_H
387235aa79SDavid Howells #define IB_USER_VERBS_H
397235aa79SDavid Howells 
407235aa79SDavid Howells #include <linux/types.h>
417235aa79SDavid Howells 
427235aa79SDavid Howells /*
437235aa79SDavid Howells  * Increment this value if any changes that break userspace ABI
447235aa79SDavid Howells  * compatibility are made.
457235aa79SDavid Howells  */
467235aa79SDavid Howells #define IB_USER_VERBS_ABI_VERSION	6
47400dbc96SIgor Ivanov #define IB_USER_VERBS_CMD_THRESHOLD    50
487235aa79SDavid Howells 
494785860eSJason Gunthorpe enum ib_uverbs_write_cmds {
507235aa79SDavid Howells 	IB_USER_VERBS_CMD_GET_CONTEXT,
517235aa79SDavid Howells 	IB_USER_VERBS_CMD_QUERY_DEVICE,
527235aa79SDavid Howells 	IB_USER_VERBS_CMD_QUERY_PORT,
537235aa79SDavid Howells 	IB_USER_VERBS_CMD_ALLOC_PD,
547235aa79SDavid Howells 	IB_USER_VERBS_CMD_DEALLOC_PD,
557235aa79SDavid Howells 	IB_USER_VERBS_CMD_CREATE_AH,
567235aa79SDavid Howells 	IB_USER_VERBS_CMD_MODIFY_AH,
577235aa79SDavid Howells 	IB_USER_VERBS_CMD_QUERY_AH,
587235aa79SDavid Howells 	IB_USER_VERBS_CMD_DESTROY_AH,
597235aa79SDavid Howells 	IB_USER_VERBS_CMD_REG_MR,
607235aa79SDavid Howells 	IB_USER_VERBS_CMD_REG_SMR,
617235aa79SDavid Howells 	IB_USER_VERBS_CMD_REREG_MR,
627235aa79SDavid Howells 	IB_USER_VERBS_CMD_QUERY_MR,
637235aa79SDavid Howells 	IB_USER_VERBS_CMD_DEREG_MR,
647235aa79SDavid Howells 	IB_USER_VERBS_CMD_ALLOC_MW,
657235aa79SDavid Howells 	IB_USER_VERBS_CMD_BIND_MW,
667235aa79SDavid Howells 	IB_USER_VERBS_CMD_DEALLOC_MW,
677235aa79SDavid Howells 	IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL,
687235aa79SDavid Howells 	IB_USER_VERBS_CMD_CREATE_CQ,
697235aa79SDavid Howells 	IB_USER_VERBS_CMD_RESIZE_CQ,
707235aa79SDavid Howells 	IB_USER_VERBS_CMD_DESTROY_CQ,
717235aa79SDavid Howells 	IB_USER_VERBS_CMD_POLL_CQ,
727235aa79SDavid Howells 	IB_USER_VERBS_CMD_PEEK_CQ,
737235aa79SDavid Howells 	IB_USER_VERBS_CMD_REQ_NOTIFY_CQ,
747235aa79SDavid Howells 	IB_USER_VERBS_CMD_CREATE_QP,
757235aa79SDavid Howells 	IB_USER_VERBS_CMD_QUERY_QP,
767235aa79SDavid Howells 	IB_USER_VERBS_CMD_MODIFY_QP,
777235aa79SDavid Howells 	IB_USER_VERBS_CMD_DESTROY_QP,
787235aa79SDavid Howells 	IB_USER_VERBS_CMD_POST_SEND,
797235aa79SDavid Howells 	IB_USER_VERBS_CMD_POST_RECV,
807235aa79SDavid Howells 	IB_USER_VERBS_CMD_ATTACH_MCAST,
817235aa79SDavid Howells 	IB_USER_VERBS_CMD_DETACH_MCAST,
827235aa79SDavid Howells 	IB_USER_VERBS_CMD_CREATE_SRQ,
837235aa79SDavid Howells 	IB_USER_VERBS_CMD_MODIFY_SRQ,
847235aa79SDavid Howells 	IB_USER_VERBS_CMD_QUERY_SRQ,
857235aa79SDavid Howells 	IB_USER_VERBS_CMD_DESTROY_SRQ,
867235aa79SDavid Howells 	IB_USER_VERBS_CMD_POST_SRQ_RECV,
877235aa79SDavid Howells 	IB_USER_VERBS_CMD_OPEN_XRCD,
887235aa79SDavid Howells 	IB_USER_VERBS_CMD_CLOSE_XRCD,
897235aa79SDavid Howells 	IB_USER_VERBS_CMD_CREATE_XSRQ,
90436f2ad0SHadar Hen Zion 	IB_USER_VERBS_CMD_OPEN_QP,
917235aa79SDavid Howells };
927235aa79SDavid Howells 
93f21519b2SYann Droneaud enum {
9402d1aa7aSEli Cohen 	IB_USER_VERBS_EX_CMD_QUERY_DEVICE = IB_USER_VERBS_CMD_QUERY_DEVICE,
95565197ddSMatan Barak 	IB_USER_VERBS_EX_CMD_CREATE_CQ = IB_USER_VERBS_CMD_CREATE_CQ,
966d8a7497SEran Ben Elisha 	IB_USER_VERBS_EX_CMD_CREATE_QP = IB_USER_VERBS_CMD_CREATE_QP,
97189aba99SBodong Wang 	IB_USER_VERBS_EX_CMD_MODIFY_QP = IB_USER_VERBS_CMD_MODIFY_QP,
98f21519b2SYann Droneaud 	IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD,
995a77abf9SEli Cohen 	IB_USER_VERBS_EX_CMD_DESTROY_FLOW,
100f213c052SYishai Hadas 	IB_USER_VERBS_EX_CMD_CREATE_WQ,
101f213c052SYishai Hadas 	IB_USER_VERBS_EX_CMD_MODIFY_WQ,
102f213c052SYishai Hadas 	IB_USER_VERBS_EX_CMD_DESTROY_WQ,
103de019a94SYishai Hadas 	IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL,
104869ddcf8SYonatan Cohen 	IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL,
105869ddcf8SYonatan Cohen 	IB_USER_VERBS_EX_CMD_MODIFY_CQ
106f21519b2SYann Droneaud };
107f21519b2SYann Droneaud 
108*0c17da49SLi Zhijian /* see IBA A19.4.1.1 Placement Types */
109*0c17da49SLi Zhijian enum ib_placement_type {
110*0c17da49SLi Zhijian 	IB_FLUSH_GLOBAL = 1U << 0,
111*0c17da49SLi Zhijian 	IB_FLUSH_PERSISTENT = 1U << 1,
112*0c17da49SLi Zhijian };
113*0c17da49SLi Zhijian 
114*0c17da49SLi Zhijian /* see IBA A19.4.1.2 Selectivity Level */
115*0c17da49SLi Zhijian enum ib_selectivity_level {
116*0c17da49SLi Zhijian 	IB_FLUSH_RANGE = 0,
117*0c17da49SLi Zhijian 	IB_FLUSH_MR,
118*0c17da49SLi Zhijian };
119*0c17da49SLi Zhijian 
1207235aa79SDavid Howells /*
1217235aa79SDavid Howells  * Make sure that all structs defined in this file remain laid out so
1227235aa79SDavid Howells  * that they pack the same way on 32-bit and 64-bit architectures (to
1237235aa79SDavid Howells  * avoid incompatibility between 32-bit userspace and 64-bit kernels).
1247235aa79SDavid Howells  * Specifically:
1257235aa79SDavid Howells  *  - Do not use pointer types -- pass pointers in __u64 instead.
1267235aa79SDavid Howells  *  - Make sure that any structure larger than 4 bytes is padded to a
1277235aa79SDavid Howells  *    multiple of 8 bytes.  Otherwise the structure size will be
1287235aa79SDavid Howells  *    different between 32-bit and 64-bit architectures.
1297235aa79SDavid Howells  */
1307235aa79SDavid Howells 
1317235aa79SDavid Howells struct ib_uverbs_async_event_desc {
13226b99066SJason Gunthorpe 	__aligned_u64 element;
1337235aa79SDavid Howells 	__u32 event_type;	/* enum ib_event_type */
1347235aa79SDavid Howells 	__u32 reserved;
1357235aa79SDavid Howells };
1367235aa79SDavid Howells 
1377235aa79SDavid Howells struct ib_uverbs_comp_event_desc {
13826b99066SJason Gunthorpe 	__aligned_u64 cq_handle;
1397235aa79SDavid Howells };
1407235aa79SDavid Howells 
14118bd9072SYonatan Cohen struct ib_uverbs_cq_moderation_caps {
14218bd9072SYonatan Cohen 	__u16     max_cq_moderation_count;
14318bd9072SYonatan Cohen 	__u16     max_cq_moderation_period;
14418bd9072SYonatan Cohen 	__u32     reserved;
14518bd9072SYonatan Cohen };
14618bd9072SYonatan Cohen 
1477235aa79SDavid Howells /*
1487235aa79SDavid Howells  * All commands from userspace should start with a __u32 command field
1497235aa79SDavid Howells  * followed by __u16 in_words and out_words fields (which give the
1507235aa79SDavid Howells  * length of the command block and response buffer if any in 32-bit
1517235aa79SDavid Howells  * words).  The kernel driver will read these fields first and read
1527235aa79SDavid Howells  * the rest of the command struct based on these value.
1537235aa79SDavid Howells  */
1547235aa79SDavid Howells 
155f21519b2SYann Droneaud #define IB_USER_VERBS_CMD_COMMAND_MASK 0xff
156372e15c5SLeon Romanovsky #define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80000000u
157f21519b2SYann Droneaud 
1587235aa79SDavid Howells struct ib_uverbs_cmd_hdr {
1597235aa79SDavid Howells 	__u32 command;
1607235aa79SDavid Howells 	__u16 in_words;
1617235aa79SDavid Howells 	__u16 out_words;
1627235aa79SDavid Howells };
1637235aa79SDavid Howells 
164f21519b2SYann Droneaud struct ib_uverbs_ex_cmd_hdr {
16526b99066SJason Gunthorpe 	__aligned_u64 response;
166400dbc96SIgor Ivanov 	__u16 provider_in_words;
167400dbc96SIgor Ivanov 	__u16 provider_out_words;
168400dbc96SIgor Ivanov 	__u32 cmd_hdr_reserved;
169400dbc96SIgor Ivanov };
170400dbc96SIgor Ivanov 
1717235aa79SDavid Howells struct ib_uverbs_get_context {
17226b99066SJason Gunthorpe 	__aligned_u64 response;
17394dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
1747235aa79SDavid Howells };
1757235aa79SDavid Howells 
1767235aa79SDavid Howells struct ib_uverbs_get_context_resp {
1777235aa79SDavid Howells 	__u32 async_fd;
1787235aa79SDavid Howells 	__u32 num_comp_vectors;
17994dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
1807235aa79SDavid Howells };
1817235aa79SDavid Howells 
1827235aa79SDavid Howells struct ib_uverbs_query_device {
18326b99066SJason Gunthorpe 	__aligned_u64 response;
18494dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
1857235aa79SDavid Howells };
1867235aa79SDavid Howells 
1877235aa79SDavid Howells struct ib_uverbs_query_device_resp {
18826b99066SJason Gunthorpe 	__aligned_u64 fw_ver;
1897235aa79SDavid Howells 	__be64 node_guid;
1907235aa79SDavid Howells 	__be64 sys_image_guid;
19126b99066SJason Gunthorpe 	__aligned_u64 max_mr_size;
19226b99066SJason Gunthorpe 	__aligned_u64 page_size_cap;
1937235aa79SDavid Howells 	__u32 vendor_id;
1947235aa79SDavid Howells 	__u32 vendor_part_id;
1957235aa79SDavid Howells 	__u32 hw_ver;
1967235aa79SDavid Howells 	__u32 max_qp;
1977235aa79SDavid Howells 	__u32 max_qp_wr;
1987235aa79SDavid Howells 	__u32 device_cap_flags;
1997235aa79SDavid Howells 	__u32 max_sge;
2007235aa79SDavid Howells 	__u32 max_sge_rd;
2017235aa79SDavid Howells 	__u32 max_cq;
2027235aa79SDavid Howells 	__u32 max_cqe;
2037235aa79SDavid Howells 	__u32 max_mr;
2047235aa79SDavid Howells 	__u32 max_pd;
2057235aa79SDavid Howells 	__u32 max_qp_rd_atom;
2067235aa79SDavid Howells 	__u32 max_ee_rd_atom;
2077235aa79SDavid Howells 	__u32 max_res_rd_atom;
2087235aa79SDavid Howells 	__u32 max_qp_init_rd_atom;
2097235aa79SDavid Howells 	__u32 max_ee_init_rd_atom;
2107235aa79SDavid Howells 	__u32 atomic_cap;
2117235aa79SDavid Howells 	__u32 max_ee;
2127235aa79SDavid Howells 	__u32 max_rdd;
2137235aa79SDavid Howells 	__u32 max_mw;
2147235aa79SDavid Howells 	__u32 max_raw_ipv6_qp;
2157235aa79SDavid Howells 	__u32 max_raw_ethy_qp;
2167235aa79SDavid Howells 	__u32 max_mcast_grp;
2177235aa79SDavid Howells 	__u32 max_mcast_qp_attach;
2187235aa79SDavid Howells 	__u32 max_total_mcast_qp_attach;
2197235aa79SDavid Howells 	__u32 max_ah;
2207235aa79SDavid Howells 	__u32 max_fmr;
2217235aa79SDavid Howells 	__u32 max_map_per_fmr;
2227235aa79SDavid Howells 	__u32 max_srq;
2237235aa79SDavid Howells 	__u32 max_srq_wr;
2247235aa79SDavid Howells 	__u32 max_srq_sge;
2257235aa79SDavid Howells 	__u16 max_pkeys;
2267235aa79SDavid Howells 	__u8  local_ca_ack_delay;
2277235aa79SDavid Howells 	__u8  phys_port_cnt;
2287235aa79SDavid Howells 	__u8  reserved[4];
2297235aa79SDavid Howells };
2307235aa79SDavid Howells 
23102d1aa7aSEli Cohen struct ib_uverbs_ex_query_device {
23202d1aa7aSEli Cohen 	__u32 comp_mask;
23302d1aa7aSEli Cohen 	__u32 reserved;
23402d1aa7aSEli Cohen };
23502d1aa7aSEli Cohen 
236f4056bfdSHaggai Eran struct ib_uverbs_odp_caps {
23726b99066SJason Gunthorpe 	__aligned_u64 general_caps;
238f4056bfdSHaggai Eran 	struct {
239f4056bfdSHaggai Eran 		__u32 rc_odp_caps;
240f4056bfdSHaggai Eran 		__u32 uc_odp_caps;
241f4056bfdSHaggai Eran 		__u32 ud_odp_caps;
242f4056bfdSHaggai Eran 	} per_transport_caps;
243f4056bfdSHaggai Eran 	__u32 reserved;
244f4056bfdSHaggai Eran };
245f4056bfdSHaggai Eran 
24647adf2f4SYishai Hadas struct ib_uverbs_rss_caps {
24747adf2f4SYishai Hadas 	/* Corresponding bit will be set if qp type from
24847adf2f4SYishai Hadas 	 * 'enum ib_qp_type' is supported, e.g.
24947adf2f4SYishai Hadas 	 * supported_qpts |= 1 << IB_QPT_UD
25047adf2f4SYishai Hadas 	 */
25147adf2f4SYishai Hadas 	__u32 supported_qpts;
25247adf2f4SYishai Hadas 	__u32 max_rwq_indirection_tables;
25347adf2f4SYishai Hadas 	__u32 max_rwq_indirection_table_size;
25447adf2f4SYishai Hadas 	__u32 reserved;
25547adf2f4SYishai Hadas };
25647adf2f4SYishai Hadas 
2578d50505aSArtemy Kovalyov struct ib_uverbs_tm_caps {
2588d50505aSArtemy Kovalyov 	/* Max size of rendezvous request message */
2598d50505aSArtemy Kovalyov 	__u32 max_rndv_hdr_size;
2608d50505aSArtemy Kovalyov 	/* Max number of entries in tag matching list */
2618d50505aSArtemy Kovalyov 	__u32 max_num_tags;
2628d50505aSArtemy Kovalyov 	/* TM flags */
2638d50505aSArtemy Kovalyov 	__u32 flags;
2648d50505aSArtemy Kovalyov 	/* Max number of outstanding list operations */
2658d50505aSArtemy Kovalyov 	__u32 max_ops;
2668d50505aSArtemy Kovalyov 	/* Max number of SGE in tag matching entry */
2678d50505aSArtemy Kovalyov 	__u32 max_sge;
2688d50505aSArtemy Kovalyov 	__u32 reserved;
2698d50505aSArtemy Kovalyov };
2708d50505aSArtemy Kovalyov 
27102d1aa7aSEli Cohen struct ib_uverbs_ex_query_device_resp {
27202d1aa7aSEli Cohen 	struct ib_uverbs_query_device_resp base;
27302d1aa7aSEli Cohen 	__u32 comp_mask;
27402d1aa7aSEli Cohen 	__u32 response_length;
275f4056bfdSHaggai Eran 	struct ib_uverbs_odp_caps odp_caps;
27626b99066SJason Gunthorpe 	__aligned_u64 timestamp_mask;
27726b99066SJason Gunthorpe 	__aligned_u64 hca_core_clock; /* in KHZ */
27826b99066SJason Gunthorpe 	__aligned_u64 device_cap_flags_ex;
27947adf2f4SYishai Hadas 	struct ib_uverbs_rss_caps rss_caps;
28047adf2f4SYishai Hadas 	__u32  max_wq_type_rq;
2815f23d426SNoa Osherovich 	__u32 raw_packet_caps;
28278b1beb0SLeon Romanovsky 	struct ib_uverbs_tm_caps tm_caps;
28318bd9072SYonatan Cohen 	struct ib_uverbs_cq_moderation_caps cq_moderation_caps;
284d41c1208SAriel Levkovich 	__aligned_u64 max_dm_size;
28552a72e2aSMoni Shoua 	__u32 xrc_odp_caps;
28652a72e2aSMoni Shoua 	__u32 reserved;
28702d1aa7aSEli Cohen };
28802d1aa7aSEli Cohen 
2897235aa79SDavid Howells struct ib_uverbs_query_port {
29026b99066SJason Gunthorpe 	__aligned_u64 response;
2917235aa79SDavid Howells 	__u8  port_num;
2927235aa79SDavid Howells 	__u8  reserved[7];
29394dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
2947235aa79SDavid Howells };
2957235aa79SDavid Howells 
2967235aa79SDavid Howells struct ib_uverbs_query_port_resp {
2972f944c0fSJason Gunthorpe 	__u32 port_cap_flags;		/* see ib_uverbs_query_port_cap_flags */
2987235aa79SDavid Howells 	__u32 max_msg_sz;
2997235aa79SDavid Howells 	__u32 bad_pkey_cntr;
3007235aa79SDavid Howells 	__u32 qkey_viol_cntr;
3017235aa79SDavid Howells 	__u32 gid_tbl_len;
3027235aa79SDavid Howells 	__u16 pkey_tbl_len;
3037235aa79SDavid Howells 	__u16 lid;
3047235aa79SDavid Howells 	__u16 sm_lid;
3057235aa79SDavid Howells 	__u8  state;
3067235aa79SDavid Howells 	__u8  max_mtu;
3077235aa79SDavid Howells 	__u8  active_mtu;
3087235aa79SDavid Howells 	__u8  lmc;
3097235aa79SDavid Howells 	__u8  max_vl_num;
3107235aa79SDavid Howells 	__u8  sm_sl;
3117235aa79SDavid Howells 	__u8  subnet_timeout;
3127235aa79SDavid Howells 	__u8  init_type_reply;
3137235aa79SDavid Howells 	__u8  active_width;
3147235aa79SDavid Howells 	__u8  active_speed;
3157235aa79SDavid Howells 	__u8  phys_state;
3167235aa79SDavid Howells 	__u8  link_layer;
3178942aceaSArtemy Kovalyov 	__u8  flags;			/* see ib_uverbs_query_port_flags */
3188942aceaSArtemy Kovalyov 	__u8  reserved;
3197235aa79SDavid Howells };
3207235aa79SDavid Howells 
3217235aa79SDavid Howells struct ib_uverbs_alloc_pd {
32226b99066SJason Gunthorpe 	__aligned_u64 response;
32394dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
3247235aa79SDavid Howells };
3257235aa79SDavid Howells 
3267235aa79SDavid Howells struct ib_uverbs_alloc_pd_resp {
3277235aa79SDavid Howells 	__u32 pd_handle;
32894dfc73eSGustavo A. R. Silva 	__u32 driver_data[];
3297235aa79SDavid Howells };
3307235aa79SDavid Howells 
3317235aa79SDavid Howells struct ib_uverbs_dealloc_pd {
3327235aa79SDavid Howells 	__u32 pd_handle;
3337235aa79SDavid Howells };
3347235aa79SDavid Howells 
3357235aa79SDavid Howells struct ib_uverbs_open_xrcd {
33626b99066SJason Gunthorpe 	__aligned_u64 response;
3377235aa79SDavid Howells 	__u32 fd;
3387235aa79SDavid Howells 	__u32 oflags;
33994dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
3407235aa79SDavid Howells };
3417235aa79SDavid Howells 
3427235aa79SDavid Howells struct ib_uverbs_open_xrcd_resp {
3437235aa79SDavid Howells 	__u32 xrcd_handle;
34494dfc73eSGustavo A. R. Silva 	__u32 driver_data[];
3457235aa79SDavid Howells };
3467235aa79SDavid Howells 
3477235aa79SDavid Howells struct ib_uverbs_close_xrcd {
3487235aa79SDavid Howells 	__u32 xrcd_handle;
3497235aa79SDavid Howells };
3507235aa79SDavid Howells 
3517235aa79SDavid Howells struct ib_uverbs_reg_mr {
35226b99066SJason Gunthorpe 	__aligned_u64 response;
35326b99066SJason Gunthorpe 	__aligned_u64 start;
35426b99066SJason Gunthorpe 	__aligned_u64 length;
35526b99066SJason Gunthorpe 	__aligned_u64 hca_va;
3567235aa79SDavid Howells 	__u32 pd_handle;
3577235aa79SDavid Howells 	__u32 access_flags;
35894dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
3597235aa79SDavid Howells };
3607235aa79SDavid Howells 
3617235aa79SDavid Howells struct ib_uverbs_reg_mr_resp {
3627235aa79SDavid Howells 	__u32 mr_handle;
3637235aa79SDavid Howells 	__u32 lkey;
3647235aa79SDavid Howells 	__u32 rkey;
36594dfc73eSGustavo A. R. Silva 	__u32 driver_data[];
3667235aa79SDavid Howells };
3677235aa79SDavid Howells 
3687e6edb9bSMatan Barak struct ib_uverbs_rereg_mr {
36926b99066SJason Gunthorpe 	__aligned_u64 response;
3707e6edb9bSMatan Barak 	__u32 mr_handle;
3717e6edb9bSMatan Barak 	__u32 flags;
37226b99066SJason Gunthorpe 	__aligned_u64 start;
37326b99066SJason Gunthorpe 	__aligned_u64 length;
37426b99066SJason Gunthorpe 	__aligned_u64 hca_va;
3757e6edb9bSMatan Barak 	__u32 pd_handle;
3767e6edb9bSMatan Barak 	__u32 access_flags;
37794dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
3787e6edb9bSMatan Barak };
3797e6edb9bSMatan Barak 
3807e6edb9bSMatan Barak struct ib_uverbs_rereg_mr_resp {
3817e6edb9bSMatan Barak 	__u32 lkey;
3827e6edb9bSMatan Barak 	__u32 rkey;
38394dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
3847e6edb9bSMatan Barak };
3857e6edb9bSMatan Barak 
3867235aa79SDavid Howells struct ib_uverbs_dereg_mr {
3877235aa79SDavid Howells 	__u32 mr_handle;
3887235aa79SDavid Howells };
3897235aa79SDavid Howells 
3906b52a12bSShani Michaeli struct ib_uverbs_alloc_mw {
39126b99066SJason Gunthorpe 	__aligned_u64 response;
3926b52a12bSShani Michaeli 	__u32 pd_handle;
3936b52a12bSShani Michaeli 	__u8  mw_type;
3946b52a12bSShani Michaeli 	__u8  reserved[3];
39594dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
3966b52a12bSShani Michaeli };
3976b52a12bSShani Michaeli 
3986b52a12bSShani Michaeli struct ib_uverbs_alloc_mw_resp {
3996b52a12bSShani Michaeli 	__u32 mw_handle;
4006b52a12bSShani Michaeli 	__u32 rkey;
40194dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
4026b52a12bSShani Michaeli };
4036b52a12bSShani Michaeli 
4046b52a12bSShani Michaeli struct ib_uverbs_dealloc_mw {
4056b52a12bSShani Michaeli 	__u32 mw_handle;
4066b52a12bSShani Michaeli };
4076b52a12bSShani Michaeli 
4087235aa79SDavid Howells struct ib_uverbs_create_comp_channel {
40926b99066SJason Gunthorpe 	__aligned_u64 response;
4107235aa79SDavid Howells };
4117235aa79SDavid Howells 
4127235aa79SDavid Howells struct ib_uverbs_create_comp_channel_resp {
4137235aa79SDavid Howells 	__u32 fd;
4147235aa79SDavid Howells };
4157235aa79SDavid Howells 
4167235aa79SDavid Howells struct ib_uverbs_create_cq {
41726b99066SJason Gunthorpe 	__aligned_u64 response;
41826b99066SJason Gunthorpe 	__aligned_u64 user_handle;
4197235aa79SDavid Howells 	__u32 cqe;
4207235aa79SDavid Howells 	__u32 comp_vector;
4217235aa79SDavid Howells 	__s32 comp_channel;
4227235aa79SDavid Howells 	__u32 reserved;
42394dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
4247235aa79SDavid Howells };
4257235aa79SDavid Howells 
426beb801acSJason Gunthorpe enum ib_uverbs_ex_create_cq_flags {
427beb801acSJason Gunthorpe 	IB_UVERBS_CQ_FLAGS_TIMESTAMP_COMPLETION = 1 << 0,
428beb801acSJason Gunthorpe 	IB_UVERBS_CQ_FLAGS_IGNORE_OVERRUN = 1 << 1,
429beb801acSJason Gunthorpe };
430beb801acSJason Gunthorpe 
431565197ddSMatan Barak struct ib_uverbs_ex_create_cq {
43226b99066SJason Gunthorpe 	__aligned_u64 user_handle;
433565197ddSMatan Barak 	__u32 cqe;
434565197ddSMatan Barak 	__u32 comp_vector;
435565197ddSMatan Barak 	__s32 comp_channel;
436565197ddSMatan Barak 	__u32 comp_mask;
437beb801acSJason Gunthorpe 	__u32 flags;  /* bitmask of ib_uverbs_ex_create_cq_flags */
438565197ddSMatan Barak 	__u32 reserved;
439565197ddSMatan Barak };
440565197ddSMatan Barak 
4417235aa79SDavid Howells struct ib_uverbs_create_cq_resp {
4427235aa79SDavid Howells 	__u32 cq_handle;
4437235aa79SDavid Howells 	__u32 cqe;
4441b09577bSJason Gunthorpe 	__aligned_u64 driver_data[0];
4457235aa79SDavid Howells };
4467235aa79SDavid Howells 
447565197ddSMatan Barak struct ib_uverbs_ex_create_cq_resp {
448565197ddSMatan Barak 	struct ib_uverbs_create_cq_resp base;
449565197ddSMatan Barak 	__u32 comp_mask;
450565197ddSMatan Barak 	__u32 response_length;
451565197ddSMatan Barak };
452565197ddSMatan Barak 
4537235aa79SDavid Howells struct ib_uverbs_resize_cq {
45426b99066SJason Gunthorpe 	__aligned_u64 response;
4557235aa79SDavid Howells 	__u32 cq_handle;
4567235aa79SDavid Howells 	__u32 cqe;
45794dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
4587235aa79SDavid Howells };
4597235aa79SDavid Howells 
4607235aa79SDavid Howells struct ib_uverbs_resize_cq_resp {
4617235aa79SDavid Howells 	__u32 cqe;
4627235aa79SDavid Howells 	__u32 reserved;
46394dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
4647235aa79SDavid Howells };
4657235aa79SDavid Howells 
4667235aa79SDavid Howells struct ib_uverbs_poll_cq {
46726b99066SJason Gunthorpe 	__aligned_u64 response;
4687235aa79SDavid Howells 	__u32 cq_handle;
4697235aa79SDavid Howells 	__u32 ne;
4707235aa79SDavid Howells };
4717235aa79SDavid Howells 
472b60b9c02SBob Pearson enum ib_uverbs_wc_opcode {
473b60b9c02SBob Pearson 	IB_UVERBS_WC_SEND = 0,
474b60b9c02SBob Pearson 	IB_UVERBS_WC_RDMA_WRITE = 1,
475b60b9c02SBob Pearson 	IB_UVERBS_WC_RDMA_READ = 2,
476b60b9c02SBob Pearson 	IB_UVERBS_WC_COMP_SWAP = 3,
477b60b9c02SBob Pearson 	IB_UVERBS_WC_FETCH_ADD = 4,
478b60b9c02SBob Pearson 	IB_UVERBS_WC_BIND_MW = 5,
479b60b9c02SBob Pearson 	IB_UVERBS_WC_LOCAL_INV = 6,
480b60b9c02SBob Pearson 	IB_UVERBS_WC_TSO = 7,
481*0c17da49SLi Zhijian 	IB_UVERBS_WC_FLUSH = 8,
482efa2afc3SXiao Yang 	IB_UVERBS_WC_ATOMIC_WRITE = 9,
483b60b9c02SBob Pearson };
484b60b9c02SBob Pearson 
4857235aa79SDavid Howells struct ib_uverbs_wc {
48626b99066SJason Gunthorpe 	__aligned_u64 wr_id;
4877235aa79SDavid Howells 	__u32 status;
4887235aa79SDavid Howells 	__u32 opcode;
4897235aa79SDavid Howells 	__u32 vendor_err;
4907235aa79SDavid Howells 	__u32 byte_len;
4917235aa79SDavid Howells 	union {
492c966ea12SJason Gunthorpe 		__be32 imm_data;
4937235aa79SDavid Howells 		__u32 invalidate_rkey;
4947235aa79SDavid Howells 	} ex;
4957235aa79SDavid Howells 	__u32 qp_num;
4967235aa79SDavid Howells 	__u32 src_qp;
4977235aa79SDavid Howells 	__u32 wc_flags;
4987235aa79SDavid Howells 	__u16 pkey_index;
4997235aa79SDavid Howells 	__u16 slid;
5007235aa79SDavid Howells 	__u8 sl;
5017235aa79SDavid Howells 	__u8 dlid_path_bits;
5027235aa79SDavid Howells 	__u8 port_num;
5037235aa79SDavid Howells 	__u8 reserved;
5047235aa79SDavid Howells };
5057235aa79SDavid Howells 
5067235aa79SDavid Howells struct ib_uverbs_poll_cq_resp {
5077235aa79SDavid Howells 	__u32 count;
5087235aa79SDavid Howells 	__u32 reserved;
50994dfc73eSGustavo A. R. Silva 	struct ib_uverbs_wc wc[];
5107235aa79SDavid Howells };
5117235aa79SDavid Howells 
5127235aa79SDavid Howells struct ib_uverbs_req_notify_cq {
5137235aa79SDavid Howells 	__u32 cq_handle;
5147235aa79SDavid Howells 	__u32 solicited_only;
5157235aa79SDavid Howells };
5167235aa79SDavid Howells 
5177235aa79SDavid Howells struct ib_uverbs_destroy_cq {
51826b99066SJason Gunthorpe 	__aligned_u64 response;
5197235aa79SDavid Howells 	__u32 cq_handle;
5207235aa79SDavid Howells 	__u32 reserved;
5217235aa79SDavid Howells };
5227235aa79SDavid Howells 
5237235aa79SDavid Howells struct ib_uverbs_destroy_cq_resp {
5247235aa79SDavid Howells 	__u32 comp_events_reported;
5257235aa79SDavid Howells 	__u32 async_events_reported;
5267235aa79SDavid Howells };
5277235aa79SDavid Howells 
5287235aa79SDavid Howells struct ib_uverbs_global_route {
5297235aa79SDavid Howells 	__u8  dgid[16];
5307235aa79SDavid Howells 	__u32 flow_label;
5317235aa79SDavid Howells 	__u8  sgid_index;
5327235aa79SDavid Howells 	__u8  hop_limit;
5337235aa79SDavid Howells 	__u8  traffic_class;
5347235aa79SDavid Howells 	__u8  reserved;
5357235aa79SDavid Howells };
5367235aa79SDavid Howells 
5377235aa79SDavid Howells struct ib_uverbs_ah_attr {
5387235aa79SDavid Howells 	struct ib_uverbs_global_route grh;
5397235aa79SDavid Howells 	__u16 dlid;
5407235aa79SDavid Howells 	__u8  sl;
5417235aa79SDavid Howells 	__u8  src_path_bits;
5427235aa79SDavid Howells 	__u8  static_rate;
5437235aa79SDavid Howells 	__u8  is_global;
5447235aa79SDavid Howells 	__u8  port_num;
5457235aa79SDavid Howells 	__u8  reserved;
5467235aa79SDavid Howells };
5477235aa79SDavid Howells 
5487235aa79SDavid Howells struct ib_uverbs_qp_attr {
5497235aa79SDavid Howells 	__u32	qp_attr_mask;
5507235aa79SDavid Howells 	__u32	qp_state;
5517235aa79SDavid Howells 	__u32	cur_qp_state;
5527235aa79SDavid Howells 	__u32	path_mtu;
5537235aa79SDavid Howells 	__u32	path_mig_state;
5547235aa79SDavid Howells 	__u32	qkey;
5557235aa79SDavid Howells 	__u32	rq_psn;
5567235aa79SDavid Howells 	__u32	sq_psn;
5577235aa79SDavid Howells 	__u32	dest_qp_num;
5587235aa79SDavid Howells 	__u32	qp_access_flags;
5597235aa79SDavid Howells 
5607235aa79SDavid Howells 	struct ib_uverbs_ah_attr ah_attr;
5617235aa79SDavid Howells 	struct ib_uverbs_ah_attr alt_ah_attr;
5627235aa79SDavid Howells 
5637235aa79SDavid Howells 	/* ib_qp_cap */
5647235aa79SDavid Howells 	__u32	max_send_wr;
5657235aa79SDavid Howells 	__u32	max_recv_wr;
5667235aa79SDavid Howells 	__u32	max_send_sge;
5677235aa79SDavid Howells 	__u32	max_recv_sge;
5687235aa79SDavid Howells 	__u32	max_inline_data;
5697235aa79SDavid Howells 
5707235aa79SDavid Howells 	__u16	pkey_index;
5717235aa79SDavid Howells 	__u16	alt_pkey_index;
5727235aa79SDavid Howells 	__u8	en_sqd_async_notify;
5737235aa79SDavid Howells 	__u8	sq_draining;
5747235aa79SDavid Howells 	__u8	max_rd_atomic;
5757235aa79SDavid Howells 	__u8	max_dest_rd_atomic;
5767235aa79SDavid Howells 	__u8	min_rnr_timer;
5777235aa79SDavid Howells 	__u8	port_num;
5787235aa79SDavid Howells 	__u8	timeout;
5797235aa79SDavid Howells 	__u8	retry_cnt;
5807235aa79SDavid Howells 	__u8	rnr_retry;
5817235aa79SDavid Howells 	__u8	alt_port_num;
5827235aa79SDavid Howells 	__u8	alt_timeout;
5837235aa79SDavid Howells 	__u8	reserved[5];
5847235aa79SDavid Howells };
5857235aa79SDavid Howells 
5867235aa79SDavid Howells struct ib_uverbs_create_qp {
58726b99066SJason Gunthorpe 	__aligned_u64 response;
58826b99066SJason Gunthorpe 	__aligned_u64 user_handle;
5897235aa79SDavid Howells 	__u32 pd_handle;
5907235aa79SDavid Howells 	__u32 send_cq_handle;
5917235aa79SDavid Howells 	__u32 recv_cq_handle;
5927235aa79SDavid Howells 	__u32 srq_handle;
5937235aa79SDavid Howells 	__u32 max_send_wr;
5947235aa79SDavid Howells 	__u32 max_recv_wr;
5957235aa79SDavid Howells 	__u32 max_send_sge;
5967235aa79SDavid Howells 	__u32 max_recv_sge;
5977235aa79SDavid Howells 	__u32 max_inline_data;
5987235aa79SDavid Howells 	__u8  sq_sig_all;
5997235aa79SDavid Howells 	__u8  qp_type;
6007235aa79SDavid Howells 	__u8  is_srq;
6017235aa79SDavid Howells 	__u8  reserved;
60294dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
6037235aa79SDavid Howells };
6047235aa79SDavid Howells 
605c70285f8SYishai Hadas enum ib_uverbs_create_qp_mask {
606c70285f8SYishai Hadas 	IB_UVERBS_CREATE_QP_MASK_IND_TABLE = 1UL << 0,
607c70285f8SYishai Hadas };
608c70285f8SYishai Hadas 
609c70285f8SYishai Hadas enum {
610c70285f8SYishai Hadas 	IB_UVERBS_CREATE_QP_SUP_COMP_MASK = IB_UVERBS_CREATE_QP_MASK_IND_TABLE,
611c70285f8SYishai Hadas };
612c70285f8SYishai Hadas 
6136d8a7497SEran Ben Elisha struct ib_uverbs_ex_create_qp {
61426b99066SJason Gunthorpe 	__aligned_u64 user_handle;
6156d8a7497SEran Ben Elisha 	__u32 pd_handle;
6166d8a7497SEran Ben Elisha 	__u32 send_cq_handle;
6176d8a7497SEran Ben Elisha 	__u32 recv_cq_handle;
6186d8a7497SEran Ben Elisha 	__u32 srq_handle;
6196d8a7497SEran Ben Elisha 	__u32 max_send_wr;
6206d8a7497SEran Ben Elisha 	__u32 max_recv_wr;
6216d8a7497SEran Ben Elisha 	__u32 max_send_sge;
6226d8a7497SEran Ben Elisha 	__u32 max_recv_sge;
6236d8a7497SEran Ben Elisha 	__u32 max_inline_data;
6246d8a7497SEran Ben Elisha 	__u8  sq_sig_all;
6256d8a7497SEran Ben Elisha 	__u8  qp_type;
6266d8a7497SEran Ben Elisha 	__u8  is_srq;
6276d8a7497SEran Ben Elisha 	__u8 reserved;
6286d8a7497SEran Ben Elisha 	__u32 comp_mask;
6296d8a7497SEran Ben Elisha 	__u32 create_flags;
630c70285f8SYishai Hadas 	__u32 rwq_ind_tbl_handle;
6312dee0e54SYishai Hadas 	__u32  source_qpn;
6326d8a7497SEran Ben Elisha };
6336d8a7497SEran Ben Elisha 
6347235aa79SDavid Howells struct ib_uverbs_open_qp {
63526b99066SJason Gunthorpe 	__aligned_u64 response;
63626b99066SJason Gunthorpe 	__aligned_u64 user_handle;
6377235aa79SDavid Howells 	__u32 pd_handle;
6387235aa79SDavid Howells 	__u32 qpn;
6397235aa79SDavid Howells 	__u8  qp_type;
6407235aa79SDavid Howells 	__u8  reserved[7];
64194dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
6427235aa79SDavid Howells };
6437235aa79SDavid Howells 
6447235aa79SDavid Howells /* also used for open response */
6457235aa79SDavid Howells struct ib_uverbs_create_qp_resp {
6467235aa79SDavid Howells 	__u32 qp_handle;
6477235aa79SDavid Howells 	__u32 qpn;
6487235aa79SDavid Howells 	__u32 max_send_wr;
6497235aa79SDavid Howells 	__u32 max_recv_wr;
6507235aa79SDavid Howells 	__u32 max_send_sge;
6517235aa79SDavid Howells 	__u32 max_recv_sge;
6527235aa79SDavid Howells 	__u32 max_inline_data;
6537235aa79SDavid Howells 	__u32 reserved;
6541b09577bSJason Gunthorpe 	__u32 driver_data[0];
6557235aa79SDavid Howells };
6567235aa79SDavid Howells 
6576d8a7497SEran Ben Elisha struct ib_uverbs_ex_create_qp_resp {
6586d8a7497SEran Ben Elisha 	struct ib_uverbs_create_qp_resp base;
6596d8a7497SEran Ben Elisha 	__u32 comp_mask;
6606d8a7497SEran Ben Elisha 	__u32 response_length;
6616d8a7497SEran Ben Elisha };
6626d8a7497SEran Ben Elisha 
6637235aa79SDavid Howells /*
6647235aa79SDavid Howells  * This struct needs to remain a multiple of 8 bytes to keep the
6657235aa79SDavid Howells  * alignment of the modify QP parameters.
6667235aa79SDavid Howells  */
6677235aa79SDavid Howells struct ib_uverbs_qp_dest {
6687235aa79SDavid Howells 	__u8  dgid[16];
6697235aa79SDavid Howells 	__u32 flow_label;
6707235aa79SDavid Howells 	__u16 dlid;
6717235aa79SDavid Howells 	__u16 reserved;
6727235aa79SDavid Howells 	__u8  sgid_index;
6737235aa79SDavid Howells 	__u8  hop_limit;
6747235aa79SDavid Howells 	__u8  traffic_class;
6757235aa79SDavid Howells 	__u8  sl;
6767235aa79SDavid Howells 	__u8  src_path_bits;
6777235aa79SDavid Howells 	__u8  static_rate;
6787235aa79SDavid Howells 	__u8  is_global;
6797235aa79SDavid Howells 	__u8  port_num;
6807235aa79SDavid Howells };
6817235aa79SDavid Howells 
6827235aa79SDavid Howells struct ib_uverbs_query_qp {
68326b99066SJason Gunthorpe 	__aligned_u64 response;
6847235aa79SDavid Howells 	__u32 qp_handle;
6857235aa79SDavid Howells 	__u32 attr_mask;
68694dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
6877235aa79SDavid Howells };
6887235aa79SDavid Howells 
6897235aa79SDavid Howells struct ib_uverbs_query_qp_resp {
6907235aa79SDavid Howells 	struct ib_uverbs_qp_dest dest;
6917235aa79SDavid Howells 	struct ib_uverbs_qp_dest alt_dest;
6927235aa79SDavid Howells 	__u32 max_send_wr;
6937235aa79SDavid Howells 	__u32 max_recv_wr;
6947235aa79SDavid Howells 	__u32 max_send_sge;
6957235aa79SDavid Howells 	__u32 max_recv_sge;
6967235aa79SDavid Howells 	__u32 max_inline_data;
6977235aa79SDavid Howells 	__u32 qkey;
6987235aa79SDavid Howells 	__u32 rq_psn;
6997235aa79SDavid Howells 	__u32 sq_psn;
7007235aa79SDavid Howells 	__u32 dest_qp_num;
7017235aa79SDavid Howells 	__u32 qp_access_flags;
7027235aa79SDavid Howells 	__u16 pkey_index;
7037235aa79SDavid Howells 	__u16 alt_pkey_index;
7047235aa79SDavid Howells 	__u8  qp_state;
7057235aa79SDavid Howells 	__u8  cur_qp_state;
7067235aa79SDavid Howells 	__u8  path_mtu;
7077235aa79SDavid Howells 	__u8  path_mig_state;
7087235aa79SDavid Howells 	__u8  sq_draining;
7097235aa79SDavid Howells 	__u8  max_rd_atomic;
7107235aa79SDavid Howells 	__u8  max_dest_rd_atomic;
7117235aa79SDavid Howells 	__u8  min_rnr_timer;
7127235aa79SDavid Howells 	__u8  port_num;
7137235aa79SDavid Howells 	__u8  timeout;
7147235aa79SDavid Howells 	__u8  retry_cnt;
7157235aa79SDavid Howells 	__u8  rnr_retry;
7167235aa79SDavid Howells 	__u8  alt_port_num;
7177235aa79SDavid Howells 	__u8  alt_timeout;
7187235aa79SDavid Howells 	__u8  sq_sig_all;
7197235aa79SDavid Howells 	__u8  reserved[5];
72094dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
7217235aa79SDavid Howells };
7227235aa79SDavid Howells 
7237235aa79SDavid Howells struct ib_uverbs_modify_qp {
7247235aa79SDavid Howells 	struct ib_uverbs_qp_dest dest;
7257235aa79SDavid Howells 	struct ib_uverbs_qp_dest alt_dest;
7267235aa79SDavid Howells 	__u32 qp_handle;
7277235aa79SDavid Howells 	__u32 attr_mask;
7287235aa79SDavid Howells 	__u32 qkey;
7297235aa79SDavid Howells 	__u32 rq_psn;
7307235aa79SDavid Howells 	__u32 sq_psn;
7317235aa79SDavid Howells 	__u32 dest_qp_num;
7327235aa79SDavid Howells 	__u32 qp_access_flags;
7337235aa79SDavid Howells 	__u16 pkey_index;
7347235aa79SDavid Howells 	__u16 alt_pkey_index;
7357235aa79SDavid Howells 	__u8  qp_state;
7367235aa79SDavid Howells 	__u8  cur_qp_state;
7377235aa79SDavid Howells 	__u8  path_mtu;
7387235aa79SDavid Howells 	__u8  path_mig_state;
7397235aa79SDavid Howells 	__u8  en_sqd_async_notify;
7407235aa79SDavid Howells 	__u8  max_rd_atomic;
7417235aa79SDavid Howells 	__u8  max_dest_rd_atomic;
7427235aa79SDavid Howells 	__u8  min_rnr_timer;
7437235aa79SDavid Howells 	__u8  port_num;
7447235aa79SDavid Howells 	__u8  timeout;
7457235aa79SDavid Howells 	__u8  retry_cnt;
7467235aa79SDavid Howells 	__u8  rnr_retry;
7477235aa79SDavid Howells 	__u8  alt_port_num;
7487235aa79SDavid Howells 	__u8  alt_timeout;
7497235aa79SDavid Howells 	__u8  reserved[2];
75026b99066SJason Gunthorpe 	__aligned_u64 driver_data[0];
7517235aa79SDavid Howells };
7527235aa79SDavid Howells 
753189aba99SBodong Wang struct ib_uverbs_ex_modify_qp {
754189aba99SBodong Wang 	struct ib_uverbs_modify_qp base;
755189aba99SBodong Wang 	__u32	rate_limit;
756189aba99SBodong Wang 	__u32	reserved;
757189aba99SBodong Wang };
758189aba99SBodong Wang 
759189aba99SBodong Wang struct ib_uverbs_ex_modify_qp_resp {
760189aba99SBodong Wang 	__u32  comp_mask;
761189aba99SBodong Wang 	__u32  response_length;
762189aba99SBodong Wang };
763189aba99SBodong Wang 
7647235aa79SDavid Howells struct ib_uverbs_destroy_qp {
76526b99066SJason Gunthorpe 	__aligned_u64 response;
7667235aa79SDavid Howells 	__u32 qp_handle;
7677235aa79SDavid Howells 	__u32 reserved;
7687235aa79SDavid Howells };
7697235aa79SDavid Howells 
7707235aa79SDavid Howells struct ib_uverbs_destroy_qp_resp {
7717235aa79SDavid Howells 	__u32 events_reported;
7727235aa79SDavid Howells };
7737235aa79SDavid Howells 
7747235aa79SDavid Howells /*
7757235aa79SDavid Howells  * The ib_uverbs_sge structure isn't used anywhere, since we assume
7767235aa79SDavid Howells  * the ib_sge structure is packed the same way on 32-bit and 64-bit
7777235aa79SDavid Howells  * architectures in both kernel and user space.  It's just here to
7787235aa79SDavid Howells  * document the ABI.
7797235aa79SDavid Howells  */
7807235aa79SDavid Howells struct ib_uverbs_sge {
78126b99066SJason Gunthorpe 	__aligned_u64 addr;
7827235aa79SDavid Howells 	__u32 length;
7837235aa79SDavid Howells 	__u32 lkey;
7847235aa79SDavid Howells };
7857235aa79SDavid Howells 
7869a59739bSJason Gunthorpe enum ib_uverbs_wr_opcode {
7879a59739bSJason Gunthorpe 	IB_UVERBS_WR_RDMA_WRITE = 0,
7889a59739bSJason Gunthorpe 	IB_UVERBS_WR_RDMA_WRITE_WITH_IMM = 1,
7899a59739bSJason Gunthorpe 	IB_UVERBS_WR_SEND = 2,
7909a59739bSJason Gunthorpe 	IB_UVERBS_WR_SEND_WITH_IMM = 3,
7919a59739bSJason Gunthorpe 	IB_UVERBS_WR_RDMA_READ = 4,
7929a59739bSJason Gunthorpe 	IB_UVERBS_WR_ATOMIC_CMP_AND_SWP = 5,
7939a59739bSJason Gunthorpe 	IB_UVERBS_WR_ATOMIC_FETCH_AND_ADD = 6,
7949a59739bSJason Gunthorpe 	IB_UVERBS_WR_LOCAL_INV = 7,
7959a59739bSJason Gunthorpe 	IB_UVERBS_WR_BIND_MW = 8,
7969a59739bSJason Gunthorpe 	IB_UVERBS_WR_SEND_WITH_INV = 9,
7979a59739bSJason Gunthorpe 	IB_UVERBS_WR_TSO = 10,
7989a59739bSJason Gunthorpe 	IB_UVERBS_WR_RDMA_READ_WITH_INV = 11,
7999a59739bSJason Gunthorpe 	IB_UVERBS_WR_MASKED_ATOMIC_CMP_AND_SWP = 12,
8009a59739bSJason Gunthorpe 	IB_UVERBS_WR_MASKED_ATOMIC_FETCH_AND_ADD = 13,
801*0c17da49SLi Zhijian 	IB_UVERBS_WR_FLUSH = 14,
802efa2afc3SXiao Yang 	IB_UVERBS_WR_ATOMIC_WRITE = 15,
8039a59739bSJason Gunthorpe 	/* Review enum ib_wr_opcode before modifying this */
8049a59739bSJason Gunthorpe };
8059a59739bSJason Gunthorpe 
8067235aa79SDavid Howells struct ib_uverbs_send_wr {
80726b99066SJason Gunthorpe 	__aligned_u64 wr_id;
8087235aa79SDavid Howells 	__u32 num_sge;
8099a59739bSJason Gunthorpe 	__u32 opcode;		/* see enum ib_uverbs_wr_opcode */
8107235aa79SDavid Howells 	__u32 send_flags;
8117235aa79SDavid Howells 	union {
812c966ea12SJason Gunthorpe 		__be32 imm_data;
8137235aa79SDavid Howells 		__u32 invalidate_rkey;
8147235aa79SDavid Howells 	} ex;
8157235aa79SDavid Howells 	union {
8167235aa79SDavid Howells 		struct {
81726b99066SJason Gunthorpe 			__aligned_u64 remote_addr;
8187235aa79SDavid Howells 			__u32 rkey;
8197235aa79SDavid Howells 			__u32 reserved;
8207235aa79SDavid Howells 		} rdma;
8217235aa79SDavid Howells 		struct {
82226b99066SJason Gunthorpe 			__aligned_u64 remote_addr;
82326b99066SJason Gunthorpe 			__aligned_u64 compare_add;
82426b99066SJason Gunthorpe 			__aligned_u64 swap;
8257235aa79SDavid Howells 			__u32 rkey;
8267235aa79SDavid Howells 			__u32 reserved;
8277235aa79SDavid Howells 		} atomic;
8287235aa79SDavid Howells 		struct {
8297235aa79SDavid Howells 			__u32 ah;
8307235aa79SDavid Howells 			__u32 remote_qpn;
8317235aa79SDavid Howells 			__u32 remote_qkey;
8327235aa79SDavid Howells 			__u32 reserved;
8337235aa79SDavid Howells 		} ud;
8347235aa79SDavid Howells 	} wr;
8357235aa79SDavid Howells };
8367235aa79SDavid Howells 
8377235aa79SDavid Howells struct ib_uverbs_post_send {
83826b99066SJason Gunthorpe 	__aligned_u64 response;
8397235aa79SDavid Howells 	__u32 qp_handle;
8407235aa79SDavid Howells 	__u32 wr_count;
8417235aa79SDavid Howells 	__u32 sge_count;
8427235aa79SDavid Howells 	__u32 wqe_size;
84394dfc73eSGustavo A. R. Silva 	struct ib_uverbs_send_wr send_wr[];
8447235aa79SDavid Howells };
8457235aa79SDavid Howells 
8467235aa79SDavid Howells struct ib_uverbs_post_send_resp {
8477235aa79SDavid Howells 	__u32 bad_wr;
8487235aa79SDavid Howells };
8497235aa79SDavid Howells 
8507235aa79SDavid Howells struct ib_uverbs_recv_wr {
85126b99066SJason Gunthorpe 	__aligned_u64 wr_id;
8527235aa79SDavid Howells 	__u32 num_sge;
8537235aa79SDavid Howells 	__u32 reserved;
8547235aa79SDavid Howells };
8557235aa79SDavid Howells 
8567235aa79SDavid Howells struct ib_uverbs_post_recv {
85726b99066SJason Gunthorpe 	__aligned_u64 response;
8587235aa79SDavid Howells 	__u32 qp_handle;
8597235aa79SDavid Howells 	__u32 wr_count;
8607235aa79SDavid Howells 	__u32 sge_count;
8617235aa79SDavid Howells 	__u32 wqe_size;
86294dfc73eSGustavo A. R. Silva 	struct ib_uverbs_recv_wr recv_wr[];
8637235aa79SDavid Howells };
8647235aa79SDavid Howells 
8657235aa79SDavid Howells struct ib_uverbs_post_recv_resp {
8667235aa79SDavid Howells 	__u32 bad_wr;
8677235aa79SDavid Howells };
8687235aa79SDavid Howells 
8697235aa79SDavid Howells struct ib_uverbs_post_srq_recv {
87026b99066SJason Gunthorpe 	__aligned_u64 response;
8717235aa79SDavid Howells 	__u32 srq_handle;
8727235aa79SDavid Howells 	__u32 wr_count;
8737235aa79SDavid Howells 	__u32 sge_count;
8747235aa79SDavid Howells 	__u32 wqe_size;
87594dfc73eSGustavo A. R. Silva 	struct ib_uverbs_recv_wr recv[];
8767235aa79SDavid Howells };
8777235aa79SDavid Howells 
8787235aa79SDavid Howells struct ib_uverbs_post_srq_recv_resp {
8797235aa79SDavid Howells 	__u32 bad_wr;
8807235aa79SDavid Howells };
8817235aa79SDavid Howells 
8827235aa79SDavid Howells struct ib_uverbs_create_ah {
88326b99066SJason Gunthorpe 	__aligned_u64 response;
88426b99066SJason Gunthorpe 	__aligned_u64 user_handle;
8857235aa79SDavid Howells 	__u32 pd_handle;
8867235aa79SDavid Howells 	__u32 reserved;
8877235aa79SDavid Howells 	struct ib_uverbs_ah_attr attr;
88894dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
8897235aa79SDavid Howells };
8907235aa79SDavid Howells 
8917235aa79SDavid Howells struct ib_uverbs_create_ah_resp {
8927235aa79SDavid Howells 	__u32 ah_handle;
89394dfc73eSGustavo A. R. Silva 	__u32 driver_data[];
8947235aa79SDavid Howells };
8957235aa79SDavid Howells 
8967235aa79SDavid Howells struct ib_uverbs_destroy_ah {
8977235aa79SDavid Howells 	__u32 ah_handle;
8987235aa79SDavid Howells };
8997235aa79SDavid Howells 
9007235aa79SDavid Howells struct ib_uverbs_attach_mcast {
9017235aa79SDavid Howells 	__u8  gid[16];
9027235aa79SDavid Howells 	__u32 qp_handle;
9037235aa79SDavid Howells 	__u16 mlid;
9047235aa79SDavid Howells 	__u16 reserved;
90594dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
9067235aa79SDavid Howells };
9077235aa79SDavid Howells 
9087235aa79SDavid Howells struct ib_uverbs_detach_mcast {
9097235aa79SDavid Howells 	__u8  gid[16];
9107235aa79SDavid Howells 	__u32 qp_handle;
9117235aa79SDavid Howells 	__u16 mlid;
9127235aa79SDavid Howells 	__u16 reserved;
91394dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
9147235aa79SDavid Howells };
9157235aa79SDavid Howells 
91658913efbSYann Droneaud struct ib_uverbs_flow_spec_hdr {
91758913efbSYann Droneaud 	__u32 type;
91858913efbSYann Droneaud 	__u16 size;
91958913efbSYann Droneaud 	__u16 reserved;
92058913efbSYann Droneaud 	/* followed by flow_spec */
92126b99066SJason Gunthorpe 	__aligned_u64 flow_spec_data[0];
92258913efbSYann Droneaud };
92358913efbSYann Droneaud 
924b68c9560SYann Droneaud struct ib_uverbs_flow_eth_filter {
925436f2ad0SHadar Hen Zion 	__u8  dst_mac[6];
926436f2ad0SHadar Hen Zion 	__u8  src_mac[6];
927436f2ad0SHadar Hen Zion 	__be16 ether_type;
928436f2ad0SHadar Hen Zion 	__be16 vlan_tag;
929436f2ad0SHadar Hen Zion };
930436f2ad0SHadar Hen Zion 
931b68c9560SYann Droneaud struct ib_uverbs_flow_spec_eth {
93258913efbSYann Droneaud 	union {
93358913efbSYann Droneaud 		struct ib_uverbs_flow_spec_hdr hdr;
93458913efbSYann Droneaud 		struct {
935436f2ad0SHadar Hen Zion 			__u32 type;
936436f2ad0SHadar Hen Zion 			__u16 size;
937436f2ad0SHadar Hen Zion 			__u16 reserved;
93858913efbSYann Droneaud 		};
93958913efbSYann Droneaud 	};
940b68c9560SYann Droneaud 	struct ib_uverbs_flow_eth_filter val;
941b68c9560SYann Droneaud 	struct ib_uverbs_flow_eth_filter mask;
942436f2ad0SHadar Hen Zion };
943436f2ad0SHadar Hen Zion 
944b68c9560SYann Droneaud struct ib_uverbs_flow_ipv4_filter {
945436f2ad0SHadar Hen Zion 	__be32 src_ip;
946436f2ad0SHadar Hen Zion 	__be32 dst_ip;
947989a3a8fSMaor Gottlieb 	__u8	proto;
948989a3a8fSMaor Gottlieb 	__u8	tos;
949989a3a8fSMaor Gottlieb 	__u8	ttl;
950989a3a8fSMaor Gottlieb 	__u8	flags;
951436f2ad0SHadar Hen Zion };
952436f2ad0SHadar Hen Zion 
953b68c9560SYann Droneaud struct ib_uverbs_flow_spec_ipv4 {
95458913efbSYann Droneaud 	union {
95558913efbSYann Droneaud 		struct ib_uverbs_flow_spec_hdr hdr;
95658913efbSYann Droneaud 		struct {
957436f2ad0SHadar Hen Zion 			__u32 type;
958436f2ad0SHadar Hen Zion 			__u16 size;
959436f2ad0SHadar Hen Zion 			__u16 reserved;
96058913efbSYann Droneaud 		};
96158913efbSYann Droneaud 	};
962b68c9560SYann Droneaud 	struct ib_uverbs_flow_ipv4_filter val;
963b68c9560SYann Droneaud 	struct ib_uverbs_flow_ipv4_filter mask;
964436f2ad0SHadar Hen Zion };
965436f2ad0SHadar Hen Zion 
966b68c9560SYann Droneaud struct ib_uverbs_flow_tcp_udp_filter {
967436f2ad0SHadar Hen Zion 	__be16 dst_port;
968436f2ad0SHadar Hen Zion 	__be16 src_port;
969436f2ad0SHadar Hen Zion };
970436f2ad0SHadar Hen Zion 
971b68c9560SYann Droneaud struct ib_uverbs_flow_spec_tcp_udp {
97258913efbSYann Droneaud 	union {
97358913efbSYann Droneaud 		struct ib_uverbs_flow_spec_hdr hdr;
97458913efbSYann Droneaud 		struct {
975436f2ad0SHadar Hen Zion 			__u32 type;
976436f2ad0SHadar Hen Zion 			__u16 size;
977436f2ad0SHadar Hen Zion 			__u16 reserved;
97858913efbSYann Droneaud 		};
97958913efbSYann Droneaud 	};
980b68c9560SYann Droneaud 	struct ib_uverbs_flow_tcp_udp_filter val;
981b68c9560SYann Droneaud 	struct ib_uverbs_flow_tcp_udp_filter mask;
982436f2ad0SHadar Hen Zion };
983436f2ad0SHadar Hen Zion 
9844c2aae71SMaor Gottlieb struct ib_uverbs_flow_ipv6_filter {
9854c2aae71SMaor Gottlieb 	__u8    src_ip[16];
9864c2aae71SMaor Gottlieb 	__u8    dst_ip[16];
987a72c6a2bSMaor Gottlieb 	__be32	flow_label;
988a72c6a2bSMaor Gottlieb 	__u8	next_hdr;
989a72c6a2bSMaor Gottlieb 	__u8	traffic_class;
990a72c6a2bSMaor Gottlieb 	__u8	hop_limit;
991a72c6a2bSMaor Gottlieb 	__u8	reserved;
9924c2aae71SMaor Gottlieb };
9934c2aae71SMaor Gottlieb 
9944c2aae71SMaor Gottlieb struct ib_uverbs_flow_spec_ipv6 {
9954c2aae71SMaor Gottlieb 	union {
9964c2aae71SMaor Gottlieb 		struct ib_uverbs_flow_spec_hdr hdr;
9974c2aae71SMaor Gottlieb 		struct {
9984c2aae71SMaor Gottlieb 			__u32 type;
9994c2aae71SMaor Gottlieb 			__u16 size;
10004c2aae71SMaor Gottlieb 			__u16 reserved;
10014c2aae71SMaor Gottlieb 		};
10024c2aae71SMaor Gottlieb 	};
10034c2aae71SMaor Gottlieb 	struct ib_uverbs_flow_ipv6_filter val;
10044c2aae71SMaor Gottlieb 	struct ib_uverbs_flow_ipv6_filter mask;
10054c2aae71SMaor Gottlieb };
10064c2aae71SMaor Gottlieb 
100794e03f11SMoses Reuben struct ib_uverbs_flow_spec_action_tag {
100894e03f11SMoses Reuben 	union {
100994e03f11SMoses Reuben 		struct ib_uverbs_flow_spec_hdr hdr;
101094e03f11SMoses Reuben 		struct {
101194e03f11SMoses Reuben 			__u32 type;
101294e03f11SMoses Reuben 			__u16 size;
101394e03f11SMoses Reuben 			__u16 reserved;
101494e03f11SMoses Reuben 		};
101594e03f11SMoses Reuben 	};
101694e03f11SMoses Reuben 	__u32			      tag_id;
101794e03f11SMoses Reuben 	__u32			      reserved1;
101894e03f11SMoses Reuben };
101994e03f11SMoses Reuben 
1020483a3966SSlava Shwartsman struct ib_uverbs_flow_spec_action_drop {
1021483a3966SSlava Shwartsman 	union {
1022483a3966SSlava Shwartsman 		struct ib_uverbs_flow_spec_hdr hdr;
1023483a3966SSlava Shwartsman 		struct {
1024483a3966SSlava Shwartsman 			__u32 type;
1025483a3966SSlava Shwartsman 			__u16 size;
1026483a3966SSlava Shwartsman 			__u16 reserved;
1027483a3966SSlava Shwartsman 		};
1028483a3966SSlava Shwartsman 	};
1029483a3966SSlava Shwartsman };
1030483a3966SSlava Shwartsman 
10319b828441SMatan Barak struct ib_uverbs_flow_spec_action_handle {
10329b828441SMatan Barak 	union {
10339b828441SMatan Barak 		struct ib_uverbs_flow_spec_hdr hdr;
10349b828441SMatan Barak 		struct {
10359b828441SMatan Barak 			__u32 type;
10369b828441SMatan Barak 			__u16 size;
10379b828441SMatan Barak 			__u16 reserved;
10389b828441SMatan Barak 		};
10399b828441SMatan Barak 	};
10409b828441SMatan Barak 	__u32			      handle;
10419b828441SMatan Barak 	__u32			      reserved1;
10429b828441SMatan Barak };
10439b828441SMatan Barak 
1044b6ba4a9aSRaed Salem struct ib_uverbs_flow_spec_action_count {
1045b6ba4a9aSRaed Salem 	union {
1046b6ba4a9aSRaed Salem 		struct ib_uverbs_flow_spec_hdr hdr;
1047b6ba4a9aSRaed Salem 		struct {
1048b6ba4a9aSRaed Salem 			__u32 type;
1049b6ba4a9aSRaed Salem 			__u16 size;
1050b6ba4a9aSRaed Salem 			__u16 reserved;
1051b6ba4a9aSRaed Salem 		};
1052b6ba4a9aSRaed Salem 	};
1053b6ba4a9aSRaed Salem 	__u32			      handle;
1054b6ba4a9aSRaed Salem 	__u32			      reserved1;
1055b6ba4a9aSRaed Salem };
1056b6ba4a9aSRaed Salem 
1057a0cb4c75SMoses Reuben struct ib_uverbs_flow_tunnel_filter {
1058a0cb4c75SMoses Reuben 	__be32 tunnel_id;
1059a0cb4c75SMoses Reuben };
1060a0cb4c75SMoses Reuben 
1061a0cb4c75SMoses Reuben struct ib_uverbs_flow_spec_tunnel {
1062a0cb4c75SMoses Reuben 	union {
1063a0cb4c75SMoses Reuben 		struct ib_uverbs_flow_spec_hdr hdr;
1064a0cb4c75SMoses Reuben 		struct {
1065a0cb4c75SMoses Reuben 			__u32 type;
1066a0cb4c75SMoses Reuben 			__u16 size;
1067a0cb4c75SMoses Reuben 			__u16 reserved;
1068a0cb4c75SMoses Reuben 		};
1069a0cb4c75SMoses Reuben 	};
1070a0cb4c75SMoses Reuben 	struct ib_uverbs_flow_tunnel_filter val;
1071a0cb4c75SMoses Reuben 	struct ib_uverbs_flow_tunnel_filter mask;
1072a0cb4c75SMoses Reuben };
1073a0cb4c75SMoses Reuben 
107456ab0b38SMatan Barak struct ib_uverbs_flow_spec_esp_filter {
107556ab0b38SMatan Barak 	__u32 spi;
107656ab0b38SMatan Barak 	__u32 seq;
107756ab0b38SMatan Barak };
107856ab0b38SMatan Barak 
107956ab0b38SMatan Barak struct ib_uverbs_flow_spec_esp {
108056ab0b38SMatan Barak 	union {
108156ab0b38SMatan Barak 		struct ib_uverbs_flow_spec_hdr hdr;
108256ab0b38SMatan Barak 		struct {
108356ab0b38SMatan Barak 			__u32 type;
108456ab0b38SMatan Barak 			__u16 size;
108556ab0b38SMatan Barak 			__u16 reserved;
108656ab0b38SMatan Barak 		};
108756ab0b38SMatan Barak 	};
108856ab0b38SMatan Barak 	struct ib_uverbs_flow_spec_esp_filter val;
108956ab0b38SMatan Barak 	struct ib_uverbs_flow_spec_esp_filter mask;
109056ab0b38SMatan Barak };
109156ab0b38SMatan Barak 
109220b6563bSAriel Levkovich struct ib_uverbs_flow_gre_filter {
109320b6563bSAriel Levkovich 	/* c_ks_res0_ver field is bits 0-15 in offset 0 of a standard GRE header:
109420b6563bSAriel Levkovich 	 * bit 0 - C - checksum bit.
109520b6563bSAriel Levkovich 	 * bit 1 - reserved. set to 0.
109620b6563bSAriel Levkovich 	 * bit 2 - key bit.
109720b6563bSAriel Levkovich 	 * bit 3 - sequence number bit.
109820b6563bSAriel Levkovich 	 * bits 4:12 - reserved. set to 0.
109920b6563bSAriel Levkovich 	 * bits 13:15 - GRE version.
110020b6563bSAriel Levkovich 	 */
110120b6563bSAriel Levkovich 	__be16 c_ks_res0_ver;
110220b6563bSAriel Levkovich 	__be16 protocol;
110320b6563bSAriel Levkovich 	__be32 key;
110420b6563bSAriel Levkovich };
110520b6563bSAriel Levkovich 
110620b6563bSAriel Levkovich struct ib_uverbs_flow_spec_gre {
110720b6563bSAriel Levkovich 	union {
110820b6563bSAriel Levkovich 		struct ib_uverbs_flow_spec_hdr hdr;
110920b6563bSAriel Levkovich 		struct {
111020b6563bSAriel Levkovich 			__u32 type;
111120b6563bSAriel Levkovich 			__u16 size;
111220b6563bSAriel Levkovich 			__u16 reserved;
111320b6563bSAriel Levkovich 		};
111420b6563bSAriel Levkovich 	};
111520b6563bSAriel Levkovich 	struct ib_uverbs_flow_gre_filter     val;
111620b6563bSAriel Levkovich 	struct ib_uverbs_flow_gre_filter     mask;
111720b6563bSAriel Levkovich };
111820b6563bSAriel Levkovich 
11190d86bbecSAriel Levkovich struct ib_uverbs_flow_mpls_filter {
11200d86bbecSAriel Levkovich 	/* The field includes the entire MPLS label:
11210d86bbecSAriel Levkovich 	 * bits 0:19 - label field.
11220d86bbecSAriel Levkovich 	 * bits 20:22 - traffic class field.
11230d86bbecSAriel Levkovich 	 * bits 23 - bottom of stack bit.
11240d86bbecSAriel Levkovich 	 * bits 24:31 - ttl field.
11250d86bbecSAriel Levkovich 	 */
11260d86bbecSAriel Levkovich 	__be32 label;
11270d86bbecSAriel Levkovich };
11280d86bbecSAriel Levkovich 
11290d86bbecSAriel Levkovich struct ib_uverbs_flow_spec_mpls {
11300d86bbecSAriel Levkovich 	union {
11310d86bbecSAriel Levkovich 		struct ib_uverbs_flow_spec_hdr hdr;
11320d86bbecSAriel Levkovich 		struct {
11330d86bbecSAriel Levkovich 			__u32 type;
11340d86bbecSAriel Levkovich 			__u16 size;
11350d86bbecSAriel Levkovich 			__u16 reserved;
11360d86bbecSAriel Levkovich 		};
11370d86bbecSAriel Levkovich 	};
11380d86bbecSAriel Levkovich 	struct ib_uverbs_flow_mpls_filter     val;
11390d86bbecSAriel Levkovich 	struct ib_uverbs_flow_mpls_filter     mask;
11400d86bbecSAriel Levkovich };
11410d86bbecSAriel Levkovich 
1142d82693daSYann Droneaud struct ib_uverbs_flow_attr {
1143436f2ad0SHadar Hen Zion 	__u32 type;
1144436f2ad0SHadar Hen Zion 	__u16 size;
1145436f2ad0SHadar Hen Zion 	__u16 priority;
1146436f2ad0SHadar Hen Zion 	__u8  num_of_specs;
1147436f2ad0SHadar Hen Zion 	__u8  reserved[2];
1148436f2ad0SHadar Hen Zion 	__u8  port;
1149436f2ad0SHadar Hen Zion 	__u32 flags;
1150436f2ad0SHadar Hen Zion 	/* Following are the optional layers according to user request
1151436f2ad0SHadar Hen Zion 	 * struct ib_flow_spec_xxx
1152436f2ad0SHadar Hen Zion 	 * struct ib_flow_spec_yyy
1153436f2ad0SHadar Hen Zion 	 */
115494dfc73eSGustavo A. R. Silva 	struct ib_uverbs_flow_spec_hdr flow_specs[];
1155436f2ad0SHadar Hen Zion };
1156436f2ad0SHadar Hen Zion 
1157436f2ad0SHadar Hen Zion struct ib_uverbs_create_flow  {
1158436f2ad0SHadar Hen Zion 	__u32 comp_mask;
1159436f2ad0SHadar Hen Zion 	__u32 qp_handle;
1160d82693daSYann Droneaud 	struct ib_uverbs_flow_attr flow_attr;
1161436f2ad0SHadar Hen Zion };
1162436f2ad0SHadar Hen Zion 
1163436f2ad0SHadar Hen Zion struct ib_uverbs_create_flow_resp {
1164436f2ad0SHadar Hen Zion 	__u32 comp_mask;
1165436f2ad0SHadar Hen Zion 	__u32 flow_handle;
1166436f2ad0SHadar Hen Zion };
1167436f2ad0SHadar Hen Zion 
1168436f2ad0SHadar Hen Zion struct ib_uverbs_destroy_flow  {
1169436f2ad0SHadar Hen Zion 	__u32 comp_mask;
1170436f2ad0SHadar Hen Zion 	__u32 flow_handle;
1171436f2ad0SHadar Hen Zion };
1172436f2ad0SHadar Hen Zion 
11737235aa79SDavid Howells struct ib_uverbs_create_srq {
117426b99066SJason Gunthorpe 	__aligned_u64 response;
117526b99066SJason Gunthorpe 	__aligned_u64 user_handle;
11767235aa79SDavid Howells 	__u32 pd_handle;
11777235aa79SDavid Howells 	__u32 max_wr;
11787235aa79SDavid Howells 	__u32 max_sge;
11797235aa79SDavid Howells 	__u32 srq_limit;
118094dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
11817235aa79SDavid Howells };
11827235aa79SDavid Howells 
11837235aa79SDavid Howells struct ib_uverbs_create_xsrq {
118426b99066SJason Gunthorpe 	__aligned_u64 response;
118526b99066SJason Gunthorpe 	__aligned_u64 user_handle;
11867235aa79SDavid Howells 	__u32 srq_type;
11877235aa79SDavid Howells 	__u32 pd_handle;
11887235aa79SDavid Howells 	__u32 max_wr;
11897235aa79SDavid Howells 	__u32 max_sge;
11907235aa79SDavid Howells 	__u32 srq_limit;
11919382d4e1SArtemy Kovalyov 	__u32 max_num_tags;
11927235aa79SDavid Howells 	__u32 xrcd_handle;
11937235aa79SDavid Howells 	__u32 cq_handle;
119494dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
11957235aa79SDavid Howells };
11967235aa79SDavid Howells 
11977235aa79SDavid Howells struct ib_uverbs_create_srq_resp {
11987235aa79SDavid Howells 	__u32 srq_handle;
11997235aa79SDavid Howells 	__u32 max_wr;
12007235aa79SDavid Howells 	__u32 max_sge;
12017235aa79SDavid Howells 	__u32 srqn;
120294dfc73eSGustavo A. R. Silva 	__u32 driver_data[];
12037235aa79SDavid Howells };
12047235aa79SDavid Howells 
12057235aa79SDavid Howells struct ib_uverbs_modify_srq {
12067235aa79SDavid Howells 	__u32 srq_handle;
12077235aa79SDavid Howells 	__u32 attr_mask;
12087235aa79SDavid Howells 	__u32 max_wr;
12097235aa79SDavid Howells 	__u32 srq_limit;
121094dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
12117235aa79SDavid Howells };
12127235aa79SDavid Howells 
12137235aa79SDavid Howells struct ib_uverbs_query_srq {
121426b99066SJason Gunthorpe 	__aligned_u64 response;
12157235aa79SDavid Howells 	__u32 srq_handle;
12167235aa79SDavid Howells 	__u32 reserved;
121794dfc73eSGustavo A. R. Silva 	__aligned_u64 driver_data[];
12187235aa79SDavid Howells };
12197235aa79SDavid Howells 
12207235aa79SDavid Howells struct ib_uverbs_query_srq_resp {
12217235aa79SDavid Howells 	__u32 max_wr;
12227235aa79SDavid Howells 	__u32 max_sge;
12237235aa79SDavid Howells 	__u32 srq_limit;
12247235aa79SDavid Howells 	__u32 reserved;
12257235aa79SDavid Howells };
12267235aa79SDavid Howells 
12277235aa79SDavid Howells struct ib_uverbs_destroy_srq {
122826b99066SJason Gunthorpe 	__aligned_u64 response;
12297235aa79SDavid Howells 	__u32 srq_handle;
12307235aa79SDavid Howells 	__u32 reserved;
12317235aa79SDavid Howells };
12327235aa79SDavid Howells 
12337235aa79SDavid Howells struct ib_uverbs_destroy_srq_resp {
12347235aa79SDavid Howells 	__u32 events_reported;
12357235aa79SDavid Howells };
12367235aa79SDavid Howells 
1237f213c052SYishai Hadas struct ib_uverbs_ex_create_wq  {
1238f213c052SYishai Hadas 	__u32 comp_mask;
1239f213c052SYishai Hadas 	__u32 wq_type;
124026b99066SJason Gunthorpe 	__aligned_u64 user_handle;
1241f213c052SYishai Hadas 	__u32 pd_handle;
1242f213c052SYishai Hadas 	__u32 cq_handle;
1243f213c052SYishai Hadas 	__u32 max_wr;
1244f213c052SYishai Hadas 	__u32 max_sge;
1245af1cb95dSNoa Osherovich 	__u32 create_flags; /* Use enum ib_wq_flags */
1246af1cb95dSNoa Osherovich 	__u32 reserved;
1247f213c052SYishai Hadas };
1248f213c052SYishai Hadas 
1249f213c052SYishai Hadas struct ib_uverbs_ex_create_wq_resp {
1250f213c052SYishai Hadas 	__u32 comp_mask;
1251f213c052SYishai Hadas 	__u32 response_length;
1252f213c052SYishai Hadas 	__u32 wq_handle;
1253f213c052SYishai Hadas 	__u32 max_wr;
1254f213c052SYishai Hadas 	__u32 max_sge;
1255f213c052SYishai Hadas 	__u32 wqn;
1256f213c052SYishai Hadas };
1257f213c052SYishai Hadas 
1258f213c052SYishai Hadas struct ib_uverbs_ex_destroy_wq  {
1259f213c052SYishai Hadas 	__u32 comp_mask;
1260f213c052SYishai Hadas 	__u32 wq_handle;
1261f213c052SYishai Hadas };
1262f213c052SYishai Hadas 
1263f213c052SYishai Hadas struct ib_uverbs_ex_destroy_wq_resp {
1264f213c052SYishai Hadas 	__u32 comp_mask;
1265f213c052SYishai Hadas 	__u32 response_length;
1266f213c052SYishai Hadas 	__u32 events_reported;
1267f213c052SYishai Hadas 	__u32 reserved;
1268f213c052SYishai Hadas };
1269f213c052SYishai Hadas 
1270f213c052SYishai Hadas struct ib_uverbs_ex_modify_wq  {
1271f213c052SYishai Hadas 	__u32 attr_mask;
1272f213c052SYishai Hadas 	__u32 wq_handle;
1273f213c052SYishai Hadas 	__u32 wq_state;
1274f213c052SYishai Hadas 	__u32 curr_wq_state;
1275af1cb95dSNoa Osherovich 	__u32 flags; /* Use enum ib_wq_flags */
1276af1cb95dSNoa Osherovich 	__u32 flags_mask; /* Use enum ib_wq_flags */
1277f213c052SYishai Hadas };
1278f213c052SYishai Hadas 
1279de019a94SYishai Hadas /* Prevent memory allocation rather than max expected size */
1280de019a94SYishai Hadas #define IB_USER_VERBS_MAX_LOG_IND_TBL_SIZE 0x0d
1281de019a94SYishai Hadas struct ib_uverbs_ex_create_rwq_ind_table  {
1282de019a94SYishai Hadas 	__u32 comp_mask;
1283de019a94SYishai Hadas 	__u32 log_ind_tbl_size;
1284de019a94SYishai Hadas 	/* Following are the wq handles according to log_ind_tbl_size
1285de019a94SYishai Hadas 	 * wq_handle1
1286de019a94SYishai Hadas 	 * wq_handle2
1287de019a94SYishai Hadas 	 */
128894dfc73eSGustavo A. R. Silva 	__u32 wq_handles[];
1289de019a94SYishai Hadas };
1290de019a94SYishai Hadas 
1291de019a94SYishai Hadas struct ib_uverbs_ex_create_rwq_ind_table_resp {
1292de019a94SYishai Hadas 	__u32 comp_mask;
1293de019a94SYishai Hadas 	__u32 response_length;
1294de019a94SYishai Hadas 	__u32 ind_tbl_handle;
1295de019a94SYishai Hadas 	__u32 ind_tbl_num;
1296de019a94SYishai Hadas };
1297de019a94SYishai Hadas 
1298de019a94SYishai Hadas struct ib_uverbs_ex_destroy_rwq_ind_table  {
1299de019a94SYishai Hadas 	__u32 comp_mask;
1300de019a94SYishai Hadas 	__u32 ind_tbl_handle;
1301de019a94SYishai Hadas };
1302de019a94SYishai Hadas 
1303869ddcf8SYonatan Cohen struct ib_uverbs_cq_moderation {
1304869ddcf8SYonatan Cohen 	__u16 cq_count;
1305869ddcf8SYonatan Cohen 	__u16 cq_period;
1306869ddcf8SYonatan Cohen };
1307869ddcf8SYonatan Cohen 
1308869ddcf8SYonatan Cohen struct ib_uverbs_ex_modify_cq {
1309869ddcf8SYonatan Cohen 	__u32 cq_handle;
1310869ddcf8SYonatan Cohen 	__u32 attr_mask;
1311869ddcf8SYonatan Cohen 	struct ib_uverbs_cq_moderation attr;
1312869ddcf8SYonatan Cohen 	__u32 reserved;
1313869ddcf8SYonatan Cohen };
1314869ddcf8SYonatan Cohen 
1315ea6819e1SNicolas Dichtel #define IB_DEVICE_NAME_MAX 64
1316ea6819e1SNicolas Dichtel 
1317e945c653SJason Gunthorpe /*
1318e945c653SJason Gunthorpe  * bits 9, 15, 16, 19, 22, 27, 30, 31, 32, 33, 35 and 37 may be set by old
1319e945c653SJason Gunthorpe  * kernels and should not be used.
1320e945c653SJason Gunthorpe  */
1321f543a3e8SXiao Yang enum ib_uverbs_device_cap_flags {
1322f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_RESIZE_MAX_WR = 1 << 0,
1323f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_BAD_PKEY_CNTR = 1 << 1,
1324f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_BAD_QKEY_CNTR = 1 << 2,
1325f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_RAW_MULTI = 1 << 3,
1326f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_AUTO_PATH_MIG = 1 << 4,
1327f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_CHANGE_PHY_PORT = 1 << 5,
1328f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_UD_AV_PORT_ENFORCE = 1 << 6,
1329f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_CURR_QP_STATE_MOD = 1 << 7,
1330f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_SHUTDOWN_PORT = 1 << 8,
1331f543a3e8SXiao Yang 	/* IB_UVERBS_DEVICE_INIT_TYPE = 1 << 9, (not in use) */
1332f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_PORT_ACTIVE_EVENT = 1 << 10,
1333f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_SYS_IMAGE_GUID = 1 << 11,
1334f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_RC_RNR_NAK_GEN = 1 << 12,
1335f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_SRQ_RESIZE = 1 << 13,
1336f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_N_NOTIFY_CQ = 1 << 14,
1337f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_MEM_WINDOW = 1 << 17,
1338f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_UD_IP_CSUM = 1 << 18,
1339f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_XRC = 1 << 20,
1340f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_MEM_MGT_EXTENSIONS = 1 << 21,
1341f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_MEM_WINDOW_TYPE_2A = 1 << 23,
1342f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_MEM_WINDOW_TYPE_2B = 1 << 24,
1343f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_RC_IP_CSUM = 1 << 25,
1344f543a3e8SXiao Yang 	/* Deprecated. Please use IB_UVERBS_RAW_PACKET_CAP_IP_CSUM. */
1345f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_RAW_IP_CSUM = 1 << 26,
1346f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_MANAGED_FLOW_STEERING = 1 << 29,
1347f543a3e8SXiao Yang 	/* Deprecated. Please use IB_UVERBS_RAW_PACKET_CAP_SCATTER_FCS. */
1348f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_RAW_SCATTER_FCS = 1ULL << 34,
1349f543a3e8SXiao Yang 	IB_UVERBS_DEVICE_PCI_WRITE_END_PADDING = 1ULL << 36,
1350*0c17da49SLi Zhijian 	/* Flush placement types */
1351*0c17da49SLi Zhijian 	IB_UVERBS_DEVICE_FLUSH_GLOBAL = 1ULL << 38,
1352*0c17da49SLi Zhijian 	IB_UVERBS_DEVICE_FLUSH_PERSISTENT = 1ULL << 39,
1353efa2afc3SXiao Yang 	/* Atomic write attributes */
1354efa2afc3SXiao Yang 	IB_UVERBS_DEVICE_ATOMIC_WRITE = 1ULL << 40,
1355f543a3e8SXiao Yang };
1356f543a3e8SXiao Yang 
135730ad63e7SXiao Yang enum ib_uverbs_raw_packet_caps {
135830ad63e7SXiao Yang 	IB_UVERBS_RAW_PACKET_CAP_CVLAN_STRIPPING = 1 << 0,
135930ad63e7SXiao Yang 	IB_UVERBS_RAW_PACKET_CAP_SCATTER_FCS = 1 << 1,
136030ad63e7SXiao Yang 	IB_UVERBS_RAW_PACKET_CAP_IP_CSUM = 1 << 2,
136130ad63e7SXiao Yang 	IB_UVERBS_RAW_PACKET_CAP_DELAY_DROP = 1 << 3,
136230ad63e7SXiao Yang };
136330ad63e7SXiao Yang 
13647235aa79SDavid Howells #endif /* IB_USER_VERBS_H */
1365