xref: /freebsd/sys/ofed/include/uapi/rdma/ib_user_ioctl_verbs.h (revision b633e08c705fe43180567eae26923d6f6f98c8d9)
1*b633e08cSHans Petter Selasky /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
2*b633e08cSHans Petter Selasky /*
3*b633e08cSHans Petter Selasky  * Copyright (c) 2017-2018, Mellanox Technologies inc.  All rights reserved.
4*b633e08cSHans Petter Selasky  *
5*b633e08cSHans Petter Selasky  * This software is available to you under a choice of one of two
6*b633e08cSHans Petter Selasky  * licenses.  You may choose to be licensed under the terms of the GNU
7*b633e08cSHans Petter Selasky  * General Public License (GPL) Version 2, available from the file
8*b633e08cSHans Petter Selasky  * COPYING in the main directory of this source tree, or the
9*b633e08cSHans Petter Selasky  * OpenIB.org BSD license below:
10*b633e08cSHans Petter Selasky  *
11*b633e08cSHans Petter Selasky  *     Redistribution and use in source and binary forms, with or
12*b633e08cSHans Petter Selasky  *     without modification, are permitted provided that the following
13*b633e08cSHans Petter Selasky  *     conditions are met:
14*b633e08cSHans Petter Selasky  *
15*b633e08cSHans Petter Selasky  *      - Redistributions of source code must retain the above
16*b633e08cSHans Petter Selasky  *        copyright notice, this list of conditions and the following
17*b633e08cSHans Petter Selasky  *        disclaimer.
18*b633e08cSHans Petter Selasky  *
19*b633e08cSHans Petter Selasky  *      - Redistributions in binary form must reproduce the above
20*b633e08cSHans Petter Selasky  *        copyright notice, this list of conditions and the following
21*b633e08cSHans Petter Selasky  *        disclaimer in the documentation and/or other materials
22*b633e08cSHans Petter Selasky  *        provided with the distribution.
23*b633e08cSHans Petter Selasky  *
24*b633e08cSHans Petter Selasky  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25*b633e08cSHans Petter Selasky  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26*b633e08cSHans Petter Selasky  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27*b633e08cSHans Petter Selasky  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28*b633e08cSHans Petter Selasky  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29*b633e08cSHans Petter Selasky  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30*b633e08cSHans Petter Selasky  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31*b633e08cSHans Petter Selasky  * SOFTWARE.
32*b633e08cSHans Petter Selasky  */
33*b633e08cSHans Petter Selasky 
34*b633e08cSHans Petter Selasky #ifndef IB_USER_IOCTL_VERBS_H
35*b633e08cSHans Petter Selasky #define IB_USER_IOCTL_VERBS_H
36*b633e08cSHans Petter Selasky 
37*b633e08cSHans Petter Selasky #include <linux/types.h>
38*b633e08cSHans Petter Selasky #include <rdma/ib_user_verbs.h>
39*b633e08cSHans Petter Selasky 
40*b633e08cSHans Petter Selasky #ifndef RDMA_UAPI_PTR
41*b633e08cSHans Petter Selasky #define RDMA_UAPI_PTR(_type, _name)	__aligned_u64 _name
42*b633e08cSHans Petter Selasky #endif
43*b633e08cSHans Petter Selasky 
44*b633e08cSHans Petter Selasky #define IB_UVERBS_ACCESS_OPTIONAL_FIRST (1 << 20)
45*b633e08cSHans Petter Selasky #define IB_UVERBS_ACCESS_OPTIONAL_LAST (1 << 29)
46*b633e08cSHans Petter Selasky 
47*b633e08cSHans Petter Selasky enum ib_uverbs_core_support {
48*b633e08cSHans Petter Selasky 	IB_UVERBS_CORE_SUPPORT_OPTIONAL_MR_ACCESS = 1 << 0,
49*b633e08cSHans Petter Selasky };
50*b633e08cSHans Petter Selasky 
51*b633e08cSHans Petter Selasky enum ib_uverbs_access_flags {
52*b633e08cSHans Petter Selasky 	IB_UVERBS_ACCESS_LOCAL_WRITE = 1 << 0,
53*b633e08cSHans Petter Selasky 	IB_UVERBS_ACCESS_REMOTE_WRITE = 1 << 1,
54*b633e08cSHans Petter Selasky 	IB_UVERBS_ACCESS_REMOTE_READ = 1 << 2,
55*b633e08cSHans Petter Selasky 	IB_UVERBS_ACCESS_REMOTE_ATOMIC = 1 << 3,
56*b633e08cSHans Petter Selasky 	IB_UVERBS_ACCESS_MW_BIND = 1 << 4,
57*b633e08cSHans Petter Selasky 	IB_UVERBS_ACCESS_ZERO_BASED = 1 << 5,
58*b633e08cSHans Petter Selasky 	IB_UVERBS_ACCESS_ON_DEMAND = 1 << 6,
59*b633e08cSHans Petter Selasky 	IB_UVERBS_ACCESS_HUGETLB = 1 << 7,
60*b633e08cSHans Petter Selasky 
61*b633e08cSHans Petter Selasky 	IB_UVERBS_ACCESS_RELAXED_ORDERING = IB_UVERBS_ACCESS_OPTIONAL_FIRST,
62*b633e08cSHans Petter Selasky 	IB_UVERBS_ACCESS_OPTIONAL_RANGE =
63*b633e08cSHans Petter Selasky 		((IB_UVERBS_ACCESS_OPTIONAL_LAST << 1) - 1) &
64*b633e08cSHans Petter Selasky 		~(IB_UVERBS_ACCESS_OPTIONAL_FIRST - 1)
65*b633e08cSHans Petter Selasky };
66*b633e08cSHans Petter Selasky 
67*b633e08cSHans Petter Selasky enum ib_uverbs_query_port_cap_flags {
68*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_SM = 1 << 1,
69*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_NOTICE_SUP = 1 << 2,
70*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_TRAP_SUP = 1 << 3,
71*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_OPT_IPD_SUP = 1 << 4,
72*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_AUTO_MIGR_SUP = 1 << 5,
73*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_SL_MAP_SUP = 1 << 6,
74*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_MKEY_NVRAM = 1 << 7,
75*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_PKEY_NVRAM = 1 << 8,
76*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_LED_INFO_SUP = 1 << 9,
77*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_SM_DISABLED = 1 << 10,
78*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_SYS_IMAGE_GUID_SUP = 1 << 11,
79*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_PKEY_SW_EXT_PORT_TRAP_SUP = 1 << 12,
80*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_EXTENDED_SPEEDS_SUP = 1 << 14,
81*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_CM_SUP = 1 << 16,
82*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_SNMP_TUNNEL_SUP = 1 << 17,
83*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_REINIT_SUP = 1 << 18,
84*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_DEVICE_MGMT_SUP = 1 << 19,
85*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_VENDOR_CLASS_SUP = 1 << 20,
86*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_DR_NOTICE_SUP = 1 << 21,
87*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_CAP_MASK_NOTICE_SUP = 1 << 22,
88*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_BOOT_MGMT_SUP = 1 << 23,
89*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_LINK_LATENCY_SUP = 1 << 24,
90*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_CLIENT_REG_SUP = 1 << 25,
91*b633e08cSHans Petter Selasky 	/*
92*b633e08cSHans Petter Selasky 	 * IsOtherLocalChangesNoticeSupported is aliased by IP_BASED_GIDS and
93*b633e08cSHans Petter Selasky 	 * is inaccessible
94*b633e08cSHans Petter Selasky 	 */
95*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_LINK_SPEED_WIDTH_TABLE_SUP = 1 << 27,
96*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_VENDOR_SPECIFIC_MADS_TABLE_SUP = 1 << 28,
97*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_MCAST_PKEY_TRAP_SUPPRESSION_SUP = 1 << 29,
98*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_MCAST_FDB_TOP_SUP = 1 << 30,
99*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_HIERARCHY_INFO_SUP = 1ULL << 31,
100*b633e08cSHans Petter Selasky 
101*b633e08cSHans Petter Selasky 	/* NOTE this is an internal flag, not an IBA flag */
102*b633e08cSHans Petter Selasky 	IB_UVERBS_PCF_IP_BASED_GIDS = 1 << 26,
103*b633e08cSHans Petter Selasky };
104*b633e08cSHans Petter Selasky 
105*b633e08cSHans Petter Selasky enum ib_uverbs_query_port_flags {
106*b633e08cSHans Petter Selasky 	IB_UVERBS_QPF_GRH_REQUIRED = 1 << 0,
107*b633e08cSHans Petter Selasky };
108*b633e08cSHans Petter Selasky 
109*b633e08cSHans Petter Selasky enum ib_uverbs_flow_action_esp_keymat {
110*b633e08cSHans Petter Selasky 	IB_UVERBS_FLOW_ACTION_ESP_KEYMAT_AES_GCM,
111*b633e08cSHans Petter Selasky };
112*b633e08cSHans Petter Selasky 
113*b633e08cSHans Petter Selasky enum ib_uverbs_flow_action_esp_keymat_aes_gcm_iv_algo {
114*b633e08cSHans Petter Selasky 	IB_UVERBS_FLOW_ACTION_IV_ALGO_SEQ,
115*b633e08cSHans Petter Selasky };
116*b633e08cSHans Petter Selasky 
117*b633e08cSHans Petter Selasky struct ib_uverbs_flow_action_esp_keymat_aes_gcm {
118*b633e08cSHans Petter Selasky 	__aligned_u64	iv;
119*b633e08cSHans Petter Selasky 	__u32		iv_algo; /* Use enum ib_uverbs_flow_action_esp_keymat_aes_gcm_iv_algo */
120*b633e08cSHans Petter Selasky 
121*b633e08cSHans Petter Selasky 	__u32		salt;
122*b633e08cSHans Petter Selasky 	__u32		icv_len;
123*b633e08cSHans Petter Selasky 
124*b633e08cSHans Petter Selasky 	__u32		key_len;
125*b633e08cSHans Petter Selasky 	__u32		aes_key[256 / 32];
126*b633e08cSHans Petter Selasky };
127*b633e08cSHans Petter Selasky 
128*b633e08cSHans Petter Selasky enum ib_uverbs_flow_action_esp_replay {
129*b633e08cSHans Petter Selasky 	IB_UVERBS_FLOW_ACTION_ESP_REPLAY_NONE,
130*b633e08cSHans Petter Selasky 	IB_UVERBS_FLOW_ACTION_ESP_REPLAY_BMP,
131*b633e08cSHans Petter Selasky };
132*b633e08cSHans Petter Selasky 
133*b633e08cSHans Petter Selasky struct ib_uverbs_flow_action_esp_replay_bmp {
134*b633e08cSHans Petter Selasky 	__u32	size;
135*b633e08cSHans Petter Selasky };
136*b633e08cSHans Petter Selasky 
137*b633e08cSHans Petter Selasky enum ib_uverbs_flow_action_esp_flags {
138*b633e08cSHans Petter Selasky 	IB_UVERBS_FLOW_ACTION_ESP_FLAGS_INLINE_CRYPTO	= 0UL << 0,	/* Default */
139*b633e08cSHans Petter Selasky 	IB_UVERBS_FLOW_ACTION_ESP_FLAGS_FULL_OFFLOAD	= 1UL << 0,
140*b633e08cSHans Petter Selasky 
141*b633e08cSHans Petter Selasky 	IB_UVERBS_FLOW_ACTION_ESP_FLAGS_TUNNEL		= 0UL << 1,	/* Default */
142*b633e08cSHans Petter Selasky 	IB_UVERBS_FLOW_ACTION_ESP_FLAGS_TRANSPORT	= 1UL << 1,
143*b633e08cSHans Petter Selasky 
144*b633e08cSHans Petter Selasky 	IB_UVERBS_FLOW_ACTION_ESP_FLAGS_DECRYPT		= 0UL << 2,	/* Default */
145*b633e08cSHans Petter Selasky 	IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ENCRYPT		= 1UL << 2,
146*b633e08cSHans Petter Selasky 
147*b633e08cSHans Petter Selasky 	IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ESN_NEW_WINDOW	= 1UL << 3,
148*b633e08cSHans Petter Selasky };
149*b633e08cSHans Petter Selasky 
150*b633e08cSHans Petter Selasky struct ib_uverbs_flow_action_esp_encap {
151*b633e08cSHans Petter Selasky 	/* This struct represents a list of pointers to flow_xxxx_filter that
152*b633e08cSHans Petter Selasky 	 * encapsulates the payload in ESP tunnel mode.
153*b633e08cSHans Petter Selasky 	 */
154*b633e08cSHans Petter Selasky 	RDMA_UAPI_PTR(void *, val_ptr); /* pointer to a flow_xxxx_filter */
155*b633e08cSHans Petter Selasky 	RDMA_UAPI_PTR(struct ib_uverbs_flow_action_esp_encap *, next_ptr);
156*b633e08cSHans Petter Selasky 	__u16	len;		/* Len of the filter struct val_ptr points to */
157*b633e08cSHans Petter Selasky 	__u16	type;		/* Use flow_spec_type enum */
158*b633e08cSHans Petter Selasky };
159*b633e08cSHans Petter Selasky 
160*b633e08cSHans Petter Selasky struct ib_uverbs_flow_action_esp {
161*b633e08cSHans Petter Selasky 	__u32		spi;
162*b633e08cSHans Petter Selasky 	__u32		seq;
163*b633e08cSHans Petter Selasky 	__u32		tfc_pad;
164*b633e08cSHans Petter Selasky 	__u32		flags;
165*b633e08cSHans Petter Selasky 	__aligned_u64	hard_limit_pkts;
166*b633e08cSHans Petter Selasky };
167*b633e08cSHans Petter Selasky 
168*b633e08cSHans Petter Selasky enum ib_uverbs_read_counters_flags {
169*b633e08cSHans Petter Selasky 	/* prefer read values from driver cache */
170*b633e08cSHans Petter Selasky 	IB_UVERBS_READ_COUNTERS_PREFER_CACHED = 1 << 0,
171*b633e08cSHans Petter Selasky };
172*b633e08cSHans Petter Selasky 
173*b633e08cSHans Petter Selasky enum ib_uverbs_advise_mr_advice {
174*b633e08cSHans Petter Selasky 	IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH,
175*b633e08cSHans Petter Selasky 	IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH_WRITE,
176*b633e08cSHans Petter Selasky };
177*b633e08cSHans Petter Selasky 
178*b633e08cSHans Petter Selasky enum ib_uverbs_advise_mr_flag {
179*b633e08cSHans Petter Selasky 	IB_UVERBS_ADVISE_MR_FLAG_FLUSH = 1 << 0,
180*b633e08cSHans Petter Selasky };
181*b633e08cSHans Petter Selasky 
182*b633e08cSHans Petter Selasky struct ib_uverbs_query_port_resp_ex {
183*b633e08cSHans Petter Selasky 	struct ib_uverbs_query_port_resp legacy_resp;
184*b633e08cSHans Petter Selasky 	__u16 port_cap_flags2;
185*b633e08cSHans Petter Selasky 	__u8  reserved[6];
186*b633e08cSHans Petter Selasky };
187*b633e08cSHans Petter Selasky 
188*b633e08cSHans Petter Selasky enum rdma_driver_id {
189*b633e08cSHans Petter Selasky 	RDMA_DRIVER_UNKNOWN,
190*b633e08cSHans Petter Selasky 	RDMA_DRIVER_MLX5,
191*b633e08cSHans Petter Selasky 	RDMA_DRIVER_MLX4,
192*b633e08cSHans Petter Selasky 	RDMA_DRIVER_CXGB3,
193*b633e08cSHans Petter Selasky 	RDMA_DRIVER_CXGB4,
194*b633e08cSHans Petter Selasky 	RDMA_DRIVER_MTHCA,
195*b633e08cSHans Petter Selasky 	RDMA_DRIVER_BNXT_RE,
196*b633e08cSHans Petter Selasky 	RDMA_DRIVER_OCRDMA,
197*b633e08cSHans Petter Selasky 	RDMA_DRIVER_NES,
198*b633e08cSHans Petter Selasky 	RDMA_DRIVER_I40IW,
199*b633e08cSHans Petter Selasky 	RDMA_DRIVER_VMW_PVRDMA,
200*b633e08cSHans Petter Selasky 	RDMA_DRIVER_QEDR,
201*b633e08cSHans Petter Selasky 	RDMA_DRIVER_HNS,
202*b633e08cSHans Petter Selasky 	RDMA_DRIVER_USNIC,
203*b633e08cSHans Petter Selasky 	RDMA_DRIVER_RXE,
204*b633e08cSHans Petter Selasky 	RDMA_DRIVER_HFI1,
205*b633e08cSHans Petter Selasky 	RDMA_DRIVER_QIB,
206*b633e08cSHans Petter Selasky 	RDMA_DRIVER_EFA,
207*b633e08cSHans Petter Selasky 	RDMA_DRIVER_SIW,
208*b633e08cSHans Petter Selasky 	RDMA_DRIVER_QLNXR,
209*b633e08cSHans Petter Selasky };
210*b633e08cSHans Petter Selasky 
211*b633e08cSHans Petter Selasky #endif
212