blob: 078672b09c5605a6f1b5ed50d417cc00a80c457d [file] [log] [blame]
Amir Levy9659e592016-10-27 18:08:27 +03001#ifndef _UAPI_MSM_IPA_H_
2#define _UAPI_MSM_IPA_H_
3
4#ifndef __KERNEL__
Perry Randise43d92c92019-09-16 10:27:40 -04005#include <stdio.h>
Amir Levy9659e592016-10-27 18:08:27 +03006#include <stdint.h>
7#include <stddef.h>
8#include <sys/stat.h>
9#endif
10#include <linux/ioctl.h>
11#include <linux/types.h>
12#include <linux/if_ether.h>
13
14/**
15 * unique magic number of the IPA device
16 */
17#define IPA_IOC_MAGIC 0xCF
18
19/**
Amir Levy479cfdd2017-10-26 12:23:14 +030020 * IPA device full path
21 */
22#define IPA_DEV_NAME "/dev/ipa"
23
24/**
25 * IPA NAT table character device name
26 */
27#define IPA_NAT_DEV_NAME "ipaNatTable"
28
29/**
30 * IPA IPv6CT table character device name
31 */
32#define IPA_IPV6CT_DEV_NAME "ipaIpv6CTTable"
33
Perry Randise43d92c92019-09-16 10:27:40 -040034/**
Amir Levy9659e592016-10-27 18:08:27 +030035 * name of the default routing tables for v4 and v6
36 */
37#define IPA_DFLT_RT_TBL_NAME "ipa_dflt_rt"
38
39/**
Amir Levy32ffdb82019-03-12 09:07:48 +020040 * name for default value of invalid protocol of NAT
41 */
42#define IPAHAL_NAT_INVALID_PROTOCOL 0xFF
43
44/**
Amir Levy479cfdd2017-10-26 12:23:14 +030045 * commands supported by IPA driver
Amir Levy9659e592016-10-27 18:08:27 +030046 */
Amir Levy479cfdd2017-10-26 12:23:14 +030047#define IPA_IOCTL_ADD_HDR 0
48#define IPA_IOCTL_DEL_HDR 1
49#define IPA_IOCTL_ADD_RT_RULE 2
50#define IPA_IOCTL_DEL_RT_RULE 3
51#define IPA_IOCTL_ADD_FLT_RULE 4
52#define IPA_IOCTL_DEL_FLT_RULE 5
53#define IPA_IOCTL_COMMIT_HDR 6
54#define IPA_IOCTL_RESET_HDR 7
55#define IPA_IOCTL_COMMIT_RT 8
56#define IPA_IOCTL_RESET_RT 9
57#define IPA_IOCTL_COMMIT_FLT 10
58#define IPA_IOCTL_RESET_FLT 11
59#define IPA_IOCTL_DUMP 12
60#define IPA_IOCTL_GET_RT_TBL 13
61#define IPA_IOCTL_PUT_RT_TBL 14
62#define IPA_IOCTL_COPY_HDR 15
63#define IPA_IOCTL_QUERY_INTF 16
64#define IPA_IOCTL_QUERY_INTF_TX_PROPS 17
65#define IPA_IOCTL_QUERY_INTF_RX_PROPS 18
66#define IPA_IOCTL_GET_HDR 19
67#define IPA_IOCTL_PUT_HDR 20
68#define IPA_IOCTL_SET_FLT 21
69#define IPA_IOCTL_ALLOC_NAT_MEM 22
70#define IPA_IOCTL_V4_INIT_NAT 23
71#define IPA_IOCTL_TABLE_DMA_CMD 24
72#define IPA_IOCTL_NAT_DMA IPA_IOCTL_TABLE_DMA_CMD
73#define IPA_IOCTL_INIT_IPV6CT_TABLE 25
74#define IPA_IOCTL_V4_DEL_NAT 26
75#define IPA_IOCTL_PULL_MSG 27
76#define IPA_IOCTL_GET_NAT_OFFSET 28
77#define IPA_IOCTL_RM_ADD_DEPENDENCY 29
78#define IPA_IOCTL_RM_DEL_DEPENDENCY 30
79#define IPA_IOCTL_GENERATE_FLT_EQ 31
80#define IPA_IOCTL_QUERY_INTF_EXT_PROPS 32
81#define IPA_IOCTL_QUERY_EP_MAPPING 33
82#define IPA_IOCTL_QUERY_RT_TBL_INDEX 34
83#define IPA_IOCTL_WRITE_QMAPID 35
84#define IPA_IOCTL_MDFY_FLT_RULE 36
85#define IPA_IOCTL_NOTIFY_WAN_UPSTREAM_ROUTE_ADD 37
86#define IPA_IOCTL_NOTIFY_WAN_UPSTREAM_ROUTE_DEL 38
87#define IPA_IOCTL_NOTIFY_WAN_EMBMS_CONNECTED 39
88#define IPA_IOCTL_ADD_HDR_PROC_CTX 40
89#define IPA_IOCTL_DEL_HDR_PROC_CTX 41
90#define IPA_IOCTL_MDFY_RT_RULE 42
91#define IPA_IOCTL_ADD_RT_RULE_AFTER 43
92#define IPA_IOCTL_ADD_FLT_RULE_AFTER 44
93#define IPA_IOCTL_GET_HW_VERSION 45
94#define IPA_IOCTL_ADD_RT_RULE_EXT 46
95#define IPA_IOCTL_ADD_VLAN_IFACE 47
96#define IPA_IOCTL_DEL_VLAN_IFACE 48
97#define IPA_IOCTL_ADD_L2TP_VLAN_MAPPING 49
98#define IPA_IOCTL_DEL_L2TP_VLAN_MAPPING 50
99#define IPA_IOCTL_NAT_MODIFY_PDN 51
100#define IPA_IOCTL_ALLOC_NAT_TABLE 52
101#define IPA_IOCTL_ALLOC_IPV6CT_TABLE 53
102#define IPA_IOCTL_DEL_NAT_TABLE 54
103#define IPA_IOCTL_DEL_IPV6CT_TABLE 55
Skylar Chang68c37d82018-04-07 16:42:36 -0700104#define IPA_IOCTL_CLEANUP 56
105#define IPA_IOCTL_QUERY_WLAN_CLIENT 57
Amir Levya5361ab2018-05-01 13:25:37 +0300106#define IPA_IOCTL_GET_VLAN_MODE 58
Amir Levy4f8b4832018-06-05 15:48:03 +0300107#define IPA_IOCTL_ADD_BRIDGE_VLAN_MAPPING 59
108#define IPA_IOCTL_DEL_BRIDGE_VLAN_MAPPING 60
Mohammed Javida0f23d92018-09-11 10:50:28 +0530109#define IPA_IOCTL_GSB_CONNECT 61
110#define IPA_IOCTL_GSB_DISCONNECT 62
Mohammed Javidd636e0c2019-06-13 16:16:59 +0530111#define IPA_IOCTL_GET_PHERIPHERAL_EP_INFO 63
Perry Randise43d92c92019-09-16 10:27:40 -0400112#define IPA_IOCTL_GET_NAT_IN_SRAM_INFO 64
Perry Randise63610042019-12-24 14:17:59 -0500113#define IPA_IOCTL_APP_CLOCK_VOTE 65
Amir Levy9659e592016-10-27 18:08:27 +0300114
115/**
116 * max size of the header to be inserted
117 */
118#define IPA_HDR_MAX_SIZE 64
119
120/**
121 * max size of the name of the resource (routing table, header)
122 */
123#define IPA_RESOURCE_NAME_MAX 32
124
125/**
126 * max number of interface properties
127 */
128#define IPA_NUM_PROPS_MAX 35
129
130/**
131 * size of the mac address
132 */
133#define IPA_MAC_ADDR_SIZE 6
134
135/**
136 * max number of mbim streams
137 */
138#define IPA_MBIM_MAX_STREAM_NUM 8
139
140/**
141 * size of the ipv6 address
142 */
143#define IPA_WAN_MSG_IPv6_ADDR_GW_LEN 4
144
145/**
Mohammed Javidd0c2a1e2017-10-30 15:34:22 +0530146 * max number of lan clients supported per device type
147 * for LAN stats via HW.
148 */
149#define IPA_MAX_NUM_HW_PATH_CLIENTS 16
150
151/**
152 * max number of destination pipes possible for a client.
153 */
154#define QMI_IPA_MAX_CLIENT_DST_PIPES 4
155
156/**
Mohammed Javid80d0e2a2019-06-10 14:11:42 +0530157 * New feature flag for CV2X config
158 */
159#define IPA_CV2X_SUPPORT
160
161/**
Amir Levy9659e592016-10-27 18:08:27 +0300162 * the attributes of the rule (routing or filtering)
163 */
164#define IPA_FLT_TOS (1ul << 0)
165#define IPA_FLT_PROTOCOL (1ul << 1)
166#define IPA_FLT_SRC_ADDR (1ul << 2)
167#define IPA_FLT_DST_ADDR (1ul << 3)
168#define IPA_FLT_SRC_PORT_RANGE (1ul << 4)
169#define IPA_FLT_DST_PORT_RANGE (1ul << 5)
170#define IPA_FLT_TYPE (1ul << 6)
171#define IPA_FLT_CODE (1ul << 7)
172#define IPA_FLT_SPI (1ul << 8)
173#define IPA_FLT_SRC_PORT (1ul << 9)
174#define IPA_FLT_DST_PORT (1ul << 10)
175#define IPA_FLT_TC (1ul << 11)
176#define IPA_FLT_FLOW_LABEL (1ul << 12)
177#define IPA_FLT_NEXT_HDR (1ul << 13)
178#define IPA_FLT_META_DATA (1ul << 14)
179#define IPA_FLT_FRAGMENT (1ul << 15)
180#define IPA_FLT_TOS_MASKED (1ul << 16)
181#define IPA_FLT_MAC_SRC_ADDR_ETHER_II (1ul << 17)
182#define IPA_FLT_MAC_DST_ADDR_ETHER_II (1ul << 18)
183#define IPA_FLT_MAC_SRC_ADDR_802_3 (1ul << 19)
184#define IPA_FLT_MAC_DST_ADDR_802_3 (1ul << 20)
185#define IPA_FLT_MAC_ETHER_TYPE (1ul << 21)
Shihuan Liu65a4a412017-05-22 18:30:28 -0700186#define IPA_FLT_MAC_DST_ADDR_L2TP (1ul << 22)
Shihuan Liu83889ee2017-08-04 11:00:00 -0700187#define IPA_FLT_TCP_SYN (1ul << 23)
188#define IPA_FLT_TCP_SYN_L2TP (1ul << 24)
Shihuan Liuf4433442017-09-28 17:46:41 -0700189#define IPA_FLT_L2TP_INNER_IP_TYPE (1ul << 25)
190#define IPA_FLT_L2TP_INNER_IPV4_DST_ADDR (1ul << 26)
Ghanim Fodi2d559fe2018-10-18 10:28:16 +0300191#define IPA_FLT_IS_PURE_ACK (1ul << 27)
Amir Levy54954772019-10-22 10:27:12 +0300192#define IPA_FLT_VLAN_ID (1ul << 28)
Amir Levy3e184d52019-11-18 09:43:33 +0200193#define IPA_FLT_MAC_SRC_ADDR_802_1Q (1ul << 29)
194#define IPA_FLT_MAC_DST_ADDR_802_1Q (1ul << 30)
Amir Levy9659e592016-10-27 18:08:27 +0300195
196/**
Amir Levy05fccd02017-06-13 16:25:45 +0300197 * maximal number of NAT PDNs in the PDN config table
198 */
199#define IPA_MAX_PDN_NUM 5
Mohammed1f8d9612018-11-12 11:41:50 +0530200#define IPA_ADPL_MHI_OVER_PCIE
Amir Levy05fccd02017-06-13 16:25:45 +0300201
202/**
Amir Levy9659e592016-10-27 18:08:27 +0300203 * enum ipa_client_type - names for the various IPA "clients"
204 * these are from the perspective of the clients, for e.g.
205 * HSIC1_PROD means HSIC client is the producer and IPA is the
Skylar Changa9516582017-05-09 11:36:47 -0700206 * consumer.
207 * PROD clients are always even, and CONS clients are always odd.
208 * Add new clients in the end of the list and update IPA_CLIENT_MAX
Amir Levy9659e592016-10-27 18:08:27 +0300209 */
210enum ipa_client_type {
Skylar Changa9516582017-05-09 11:36:47 -0700211 IPA_CLIENT_HSIC1_PROD = 0,
212 IPA_CLIENT_HSIC1_CONS = 1,
213
214 IPA_CLIENT_HSIC2_PROD = 2,
215 IPA_CLIENT_HSIC2_CONS = 3,
216
217 IPA_CLIENT_HSIC3_PROD = 4,
218 IPA_CLIENT_HSIC3_CONS = 5,
219
220 IPA_CLIENT_HSIC4_PROD = 6,
221 IPA_CLIENT_HSIC4_CONS = 7,
222
223 IPA_CLIENT_HSIC5_PROD = 8,
224 IPA_CLIENT_HSIC5_CONS = 9,
225
226 IPA_CLIENT_WLAN1_PROD = 10,
227 IPA_CLIENT_WLAN1_CONS = 11,
228
229 IPA_CLIENT_A5_WLAN_AMPDU_PROD = 12,
230 IPA_CLIENT_WLAN2_CONS = 13,
231
232 /* RESERVERD PROD = 14, */
233 IPA_CLIENT_WLAN3_CONS = 15,
234
235 /* RESERVERD PROD = 16, */
236 IPA_CLIENT_WLAN4_CONS = 17,
237
238 IPA_CLIENT_USB_PROD = 18,
239 IPA_CLIENT_USB_CONS = 19,
240
241 IPA_CLIENT_USB2_PROD = 20,
242 IPA_CLIENT_USB2_CONS = 21,
243
244 IPA_CLIENT_USB3_PROD = 22,
245 IPA_CLIENT_USB3_CONS = 23,
246
247 IPA_CLIENT_USB4_PROD = 24,
248 IPA_CLIENT_USB4_CONS = 25,
249
250 IPA_CLIENT_UC_USB_PROD = 26,
251 IPA_CLIENT_USB_DPL_CONS = 27,
252
253 IPA_CLIENT_A2_EMBEDDED_PROD = 28,
254 IPA_CLIENT_A2_EMBEDDED_CONS = 29,
255
256 IPA_CLIENT_A2_TETHERED_PROD = 30,
257 IPA_CLIENT_A2_TETHERED_CONS = 31,
258
259 IPA_CLIENT_APPS_LAN_PROD = 32,
260 IPA_CLIENT_APPS_LAN_CONS = 33,
261
262 IPA_CLIENT_APPS_WAN_PROD = 34,
Ghanim Fodic6b67492017-03-15 14:19:56 +0200263 IPA_CLIENT_APPS_LAN_WAN_PROD = IPA_CLIENT_APPS_WAN_PROD,
Skylar Changa9516582017-05-09 11:36:47 -0700264 IPA_CLIENT_APPS_WAN_CONS = 35,
Amir Levy9659e592016-10-27 18:08:27 +0300265
Skylar Changa9516582017-05-09 11:36:47 -0700266 IPA_CLIENT_APPS_CMD_PROD = 36,
267 IPA_CLIENT_A5_LAN_WAN_CONS = 37,
Amir Levy9659e592016-10-27 18:08:27 +0300268
Skylar Changa9516582017-05-09 11:36:47 -0700269 IPA_CLIENT_ODU_PROD = 38,
270 IPA_CLIENT_ODU_EMB_CONS = 39,
Sunil Paidimarri5139aa22017-02-13 11:07:32 -0800271
Skylar Changa9516582017-05-09 11:36:47 -0700272 /* RESERVERD PROD = 40, */
273 IPA_CLIENT_ODU_TETH_CONS = 41,
Amir Levy9659e592016-10-27 18:08:27 +0300274
Skylar Changa9516582017-05-09 11:36:47 -0700275 IPA_CLIENT_MHI_PROD = 42,
276 IPA_CLIENT_MHI_CONS = 43,
277
278 IPA_CLIENT_MEMCPY_DMA_SYNC_PROD = 44,
279 IPA_CLIENT_MEMCPY_DMA_SYNC_CONS = 45,
280
281 IPA_CLIENT_MEMCPY_DMA_ASYNC_PROD = 46,
282 IPA_CLIENT_MEMCPY_DMA_ASYNC_CONS = 47,
283
284 IPA_CLIENT_ETHERNET_PROD = 48,
285 IPA_CLIENT_ETHERNET_CONS = 49,
286
287 IPA_CLIENT_Q6_LAN_PROD = 50,
288 IPA_CLIENT_Q6_LAN_CONS = 51,
289
290 IPA_CLIENT_Q6_WAN_PROD = 52,
291 IPA_CLIENT_Q6_WAN_CONS = 53,
292
293 IPA_CLIENT_Q6_CMD_PROD = 54,
294 IPA_CLIENT_Q6_DUN_CONS = 55,
295
296 IPA_CLIENT_Q6_DECOMP_PROD = 56,
297 IPA_CLIENT_Q6_DECOMP_CONS = 57,
298
299 IPA_CLIENT_Q6_DECOMP2_PROD = 58,
300 IPA_CLIENT_Q6_DECOMP2_CONS = 59,
301
302 /* RESERVERD PROD = 60, */
303 IPA_CLIENT_Q6_LTE_WIFI_AGGR_CONS = 61,
304
305 IPA_CLIENT_TEST_PROD = 62,
306 IPA_CLIENT_TEST_CONS = 63,
307
308 IPA_CLIENT_TEST1_PROD = 64,
309 IPA_CLIENT_TEST1_CONS = 65,
310
311 IPA_CLIENT_TEST2_PROD = 66,
312 IPA_CLIENT_TEST2_CONS = 67,
313
314 IPA_CLIENT_TEST3_PROD = 68,
315 IPA_CLIENT_TEST3_CONS = 69,
316
317 IPA_CLIENT_TEST4_PROD = 70,
318 IPA_CLIENT_TEST4_CONS = 71,
Skylar Chang7fa22712017-04-03 18:29:21 -0700319
Mohammed1f8d9612018-11-12 11:41:50 +0530320 /* RESERVERD PROD = 72, */
321 IPA_CLIENT_DUMMY_CONS = 73,
322
323 /* RESERVERD PROD = 74, */
324 IPA_CLIENT_MHI_DPL_CONS = 75,
Amir Levy6e8b7642019-03-26 13:04:33 +0200325 /* RESERVED PROD = 76, */
326 IPA_CLIENT_DUMMY_CONS1 = 77,
327
328 IPA_CLIENT_WIGIG_PROD = 78,
329 IPA_CLIENT_WIGIG1_CONS = 79,
330
331 /* RESERVERD PROD = 80, */
332 IPA_CLIENT_WIGIG2_CONS = 81,
333
334 /* RESERVERD PROD = 82, */
335 IPA_CLIENT_WIGIG3_CONS = 83,
336
337 /* RESERVERD PROD = 84, */
338 IPA_CLIENT_WIGIG4_CONS = 85,
Mohammed Javid80d0e2a2019-06-10 14:11:42 +0530339
340 IPA_CLIENT_MHI2_PROD = 86,
341 IPA_CLIENT_MHI2_CONS = 87,
Mohammed Javid93cdaa52019-07-31 20:37:15 +0530342
343 IPA_CLIENT_Q6_CV2X_PROD = 88,
344 IPA_CLIENT_Q6_CV2X_CONS = 89,
Amir Levy9659e592016-10-27 18:08:27 +0300345};
346
Mohammed1f8d9612018-11-12 11:41:50 +0530347#define IPA_CLIENT_DUMMY_CONS IPA_CLIENT_DUMMY_CONS1
Amir Levy6e8b7642019-03-26 13:04:33 +0200348#define IPA_CLIENT_WIGIG4_CONS IPA_CLIENT_WIGIG4_CONS
Mohammed Javid93cdaa52019-07-31 20:37:15 +0530349#define IPA_CLIENT_MAX (IPA_CLIENT_Q6_CV2X_CONS + 1)
Skylar Changa9516582017-05-09 11:36:47 -0700350
Amir Levy9659e592016-10-27 18:08:27 +0300351#define IPA_CLIENT_IS_APPS_CONS(client) \
352 ((client) == IPA_CLIENT_APPS_LAN_CONS || \
353 (client) == IPA_CLIENT_APPS_WAN_CONS)
354
355#define IPA_CLIENT_IS_USB_CONS(client) \
356 ((client) == IPA_CLIENT_USB_CONS || \
357 (client) == IPA_CLIENT_USB2_CONS || \
358 (client) == IPA_CLIENT_USB3_CONS || \
359 (client) == IPA_CLIENT_USB_DPL_CONS || \
360 (client) == IPA_CLIENT_USB4_CONS)
361
362#define IPA_CLIENT_IS_WLAN_CONS(client) \
363 ((client) == IPA_CLIENT_WLAN1_CONS || \
364 (client) == IPA_CLIENT_WLAN2_CONS || \
365 (client) == IPA_CLIENT_WLAN3_CONS || \
366 (client) == IPA_CLIENT_WLAN4_CONS)
367
368#define IPA_CLIENT_IS_ODU_CONS(client) \
369 ((client) == IPA_CLIENT_ODU_EMB_CONS || \
370 (client) == IPA_CLIENT_ODU_TETH_CONS)
371
372#define IPA_CLIENT_IS_Q6_CONS(client) \
373 ((client) == IPA_CLIENT_Q6_LAN_CONS || \
374 (client) == IPA_CLIENT_Q6_WAN_CONS || \
375 (client) == IPA_CLIENT_Q6_DUN_CONS || \
376 (client) == IPA_CLIENT_Q6_DECOMP_CONS || \
377 (client) == IPA_CLIENT_Q6_DECOMP2_CONS || \
Mohammed Javid93cdaa52019-07-31 20:37:15 +0530378 (client) == IPA_CLIENT_Q6_LTE_WIFI_AGGR_CONS || \
379 (client) == IPA_CLIENT_Q6_CV2X_CONS)
Amir Levy9659e592016-10-27 18:08:27 +0300380
381#define IPA_CLIENT_IS_Q6_PROD(client) \
382 ((client) == IPA_CLIENT_Q6_LAN_PROD || \
383 (client) == IPA_CLIENT_Q6_WAN_PROD || \
384 (client) == IPA_CLIENT_Q6_CMD_PROD || \
385 (client) == IPA_CLIENT_Q6_DECOMP_PROD || \
Mohammed Javid93cdaa52019-07-31 20:37:15 +0530386 (client) == IPA_CLIENT_Q6_DECOMP2_PROD || \
387 (client) == IPA_CLIENT_Q6_CV2X_PROD)
Amir Levy9659e592016-10-27 18:08:27 +0300388
389#define IPA_CLIENT_IS_Q6_NON_ZIP_CONS(client) \
390 ((client) == IPA_CLIENT_Q6_LAN_CONS || \
391 (client) == IPA_CLIENT_Q6_WAN_CONS || \
392 (client) == IPA_CLIENT_Q6_DUN_CONS || \
Mohammed Javid93cdaa52019-07-31 20:37:15 +0530393 (client) == IPA_CLIENT_Q6_LTE_WIFI_AGGR_CONS || \
394 (client) == IPA_CLIENT_Q6_CV2X_CONS)
Amir Levy9659e592016-10-27 18:08:27 +0300395
396#define IPA_CLIENT_IS_Q6_ZIP_CONS(client) \
397 ((client) == IPA_CLIENT_Q6_DECOMP_CONS || \
398 (client) == IPA_CLIENT_Q6_DECOMP2_CONS)
399
400#define IPA_CLIENT_IS_Q6_NON_ZIP_PROD(client) \
401 ((client) == IPA_CLIENT_Q6_LAN_PROD || \
402 (client) == IPA_CLIENT_Q6_WAN_PROD || \
Mohammed Javid93cdaa52019-07-31 20:37:15 +0530403 (client) == IPA_CLIENT_Q6_CMD_PROD || \
404 (client) == IPA_CLIENT_Q6_CV2X_PROD)
Amir Levy9659e592016-10-27 18:08:27 +0300405
406#define IPA_CLIENT_IS_Q6_ZIP_PROD(client) \
407 ((client) == IPA_CLIENT_Q6_DECOMP_PROD || \
408 (client) == IPA_CLIENT_Q6_DECOMP2_PROD)
409
410#define IPA_CLIENT_IS_MEMCPY_DMA_CONS(client) \
411 ((client) == IPA_CLIENT_MEMCPY_DMA_SYNC_CONS || \
412 (client) == IPA_CLIENT_MEMCPY_DMA_ASYNC_CONS)
413
414#define IPA_CLIENT_IS_MEMCPY_DMA_PROD(client) \
415 ((client) == IPA_CLIENT_MEMCPY_DMA_SYNC_PROD || \
416 (client) == IPA_CLIENT_MEMCPY_DMA_ASYNC_PROD)
417
418#define IPA_CLIENT_IS_MHI_CONS(client) \
Mohammed1f8d9612018-11-12 11:41:50 +0530419 ((client) == IPA_CLIENT_MHI_CONS || \
420 (client) == IPA_CLIENT_MHI_DPL_CONS)
421
Amir Levy9659e592016-10-27 18:08:27 +0300422
423#define IPA_CLIENT_IS_MHI(client) \
424 ((client) == IPA_CLIENT_MHI_CONS || \
Mohammed1f8d9612018-11-12 11:41:50 +0530425 (client) == IPA_CLIENT_MHI_PROD || \
Mohammed Javidf109cf62019-07-02 13:16:54 +0530426 (client) == IPA_CLIENT_MHI2_PROD || \
427 (client) == IPA_CLIENT_MHI2_CONS || \
Mohammed1f8d9612018-11-12 11:41:50 +0530428 (client) == IPA_CLIENT_MHI_DPL_CONS)
Amir Levy9659e592016-10-27 18:08:27 +0300429
430#define IPA_CLIENT_IS_TEST_PROD(client) \
431 ((client) == IPA_CLIENT_TEST_PROD || \
432 (client) == IPA_CLIENT_TEST1_PROD || \
433 (client) == IPA_CLIENT_TEST2_PROD || \
434 (client) == IPA_CLIENT_TEST3_PROD || \
435 (client) == IPA_CLIENT_TEST4_PROD)
436
437#define IPA_CLIENT_IS_TEST_CONS(client) \
438 ((client) == IPA_CLIENT_TEST_CONS || \
439 (client) == IPA_CLIENT_TEST1_CONS || \
440 (client) == IPA_CLIENT_TEST2_CONS || \
441 (client) == IPA_CLIENT_TEST3_CONS || \
442 (client) == IPA_CLIENT_TEST4_CONS)
443
444#define IPA_CLIENT_IS_TEST(client) \
445 (IPA_CLIENT_IS_TEST_PROD(client) || IPA_CLIENT_IS_TEST_CONS(client))
446
447/**
Perry Randise43d92c92019-09-16 10:27:40 -0400448 * The following is used to describe the types of memory NAT can
449 * reside in.
450 *
451 * PLEASE KEEP THE FOLLOWING IN SYNC WITH ipa3_nat_mem_in_as_str()
452 * BELOW.
453 */
454enum ipa3_nat_mem_in {
455 IPA_NAT_MEM_IN_DDR = 0,
456 IPA_NAT_MEM_IN_SRAM = 1,
457
458 IPA_NAT_MEM_IN_MAX
459};
460
461#define IPA_VALID_NAT_MEM_IN(t) \
462 ((t) >= IPA_NAT_MEM_IN_DDR && (t) < IPA_NAT_MEM_IN_MAX)
463
464/**
Amir Levy9659e592016-10-27 18:08:27 +0300465 * enum ipa_ip_type - Address family: IPv4 or IPv6
Perry Randise43d92c92019-09-16 10:27:40 -0400466 *
467 * PLEASE KEEP THE FOLLOWING IN SYNC WITH ipa_ip_type_as_str()
468 * BELOW.
Amir Levy9659e592016-10-27 18:08:27 +0300469 */
470enum ipa_ip_type {
471 IPA_IP_v4,
472 IPA_IP_v6,
473 IPA_IP_MAX
474};
475
Perry Randise43d92c92019-09-16 10:27:40 -0400476#define VALID_IPA_IP_TYPE(t) \
477 ((t) >= IPA_IP_v4 && (t) < IPA_IP_MAX)
478
Amir Levy9659e592016-10-27 18:08:27 +0300479/**
480 * enum ipa_rule_type - Type of routing or filtering rule
481 * Hashable: Rule will be located at the hashable tables
482 * Non_Hashable: Rule will be located at the non-hashable tables
483 */
484enum ipa_rule_type {
485 IPA_RULE_HASHABLE,
486 IPA_RULE_NON_HASHABLE,
Amir Levy9659e592016-10-27 18:08:27 +0300487};
Skylar Changa9516582017-05-09 11:36:47 -0700488#define IPA_RULE_TYPE_MAX (IPA_RULE_NON_HASHABLE + 1)
Amir Levy9659e592016-10-27 18:08:27 +0300489
490/**
491 * enum ipa_flt_action - action field of filtering rule
492 *
493 * Pass to routing: 5'd0
494 * Pass to source NAT: 5'd1
495 * Pass to destination NAT: 5'd2
496 * Pass to default output pipe (e.g., Apps or Modem): 5'd3
497 */
498enum ipa_flt_action {
499 IPA_PASS_TO_ROUTING,
500 IPA_PASS_TO_SRC_NAT,
501 IPA_PASS_TO_DST_NAT,
502 IPA_PASS_TO_EXCEPTION
503};
504
505/**
506 * enum ipa_wlan_event - Events for wlan client
507 *
508 * wlan client connect: New wlan client connected
509 * wlan client disconnect: wlan client disconnected
510 * wlan client power save: wlan client moved to power save
511 * wlan client normal: wlan client moved out of power save
512 * sw routing enable: ipa routing is disabled
513 * sw routing disable: ipa routing is enabled
514 * wlan ap connect: wlan AP(access point) is up
515 * wlan ap disconnect: wlan AP(access point) is down
516 * wlan sta connect: wlan STA(station) is up
517 * wlan sta disconnect: wlan STA(station) is down
518 * wlan client connect ex: new wlan client connected
519 * wlan scc switch: wlan interfaces in scc mode
520 * wlan mcc switch: wlan interfaces in mcc mode
521 * wlan wdi enable: wdi data path completed
522 * wlan wdi disable: wdi data path teardown
523 */
524enum ipa_wlan_event {
525 WLAN_CLIENT_CONNECT,
526 WLAN_CLIENT_DISCONNECT,
527 WLAN_CLIENT_POWER_SAVE_MODE,
528 WLAN_CLIENT_NORMAL_MODE,
529 SW_ROUTING_ENABLE,
530 SW_ROUTING_DISABLE,
531 WLAN_AP_CONNECT,
532 WLAN_AP_DISCONNECT,
533 WLAN_STA_CONNECT,
534 WLAN_STA_DISCONNECT,
535 WLAN_CLIENT_CONNECT_EX,
536 WLAN_SWITCH_TO_SCC,
537 WLAN_SWITCH_TO_MCC,
538 WLAN_WDI_ENABLE,
539 WLAN_WDI_DISABLE,
540 IPA_WLAN_EVENT_MAX
541};
542
543/**
544 * enum ipa_wan_event - Events for wan client
545 *
546 * wan default route add/del
547 * wan embms connect: New wan embms interface connected
548 */
549enum ipa_wan_event {
550 WAN_UPSTREAM_ROUTE_ADD = IPA_WLAN_EVENT_MAX,
551 WAN_UPSTREAM_ROUTE_DEL,
552 WAN_EMBMS_CONNECT,
553 WAN_XLAT_CONNECT,
554 IPA_WAN_EVENT_MAX
555};
556
557enum ipa_ecm_event {
558 ECM_CONNECT = IPA_WAN_EVENT_MAX,
559 ECM_DISCONNECT,
560 IPA_ECM_EVENT_MAX,
561};
562
563enum ipa_tethering_stats_event {
564 IPA_TETHERING_STATS_UPDATE_STATS = IPA_ECM_EVENT_MAX,
565 IPA_TETHERING_STATS_UPDATE_NETWORK_STATS,
566 IPA_TETHERING_STATS_EVENT_MAX,
Amir Levy9659e592016-10-27 18:08:27 +0300567};
568
Mohammed Javidd0c2a1e2017-10-30 15:34:22 +0530569
Skylar Chang09e0e252017-03-20 14:51:29 -0700570enum ipa_quota_event {
571 IPA_QUOTA_REACH = IPA_TETHERING_STATS_EVENT_MAX,
572 IPA_QUOTA_EVENT_MAX,
573};
574
575enum ipa_ssr_event {
576 IPA_SSR_BEFORE_SHUTDOWN = IPA_QUOTA_EVENT_MAX,
577 IPA_SSR_AFTER_POWERUP,
578 IPA_SSR_EVENT_MAX
579};
580
Shihuan Liuc3174f52017-05-04 15:59:13 -0700581enum ipa_vlan_l2tp_event {
582 ADD_VLAN_IFACE = IPA_SSR_EVENT_MAX,
583 DEL_VLAN_IFACE,
584 ADD_L2TP_VLAN_MAPPING,
585 DEL_L2TP_VLAN_MAPPING,
586 IPA_VLAN_L2TP_EVENT_MAX,
587};
588
Mohammed Javidd0c2a1e2017-10-30 15:34:22 +0530589enum ipa_per_client_stats_event {
590 IPA_PER_CLIENT_STATS_CONNECT_EVENT = IPA_VLAN_L2TP_EVENT_MAX,
591 IPA_PER_CLIENT_STATS_DISCONNECT_EVENT,
592 IPA_PER_CLIENT_STATS_EVENT_MAX
593};
594
Amir Levy4f8b4832018-06-05 15:48:03 +0300595enum ipa_vlan_bridge_event {
596 ADD_BRIDGE_VLAN_MAPPING = IPA_PER_CLIENT_STATS_EVENT_MAX,
597 DEL_BRIDGE_VLAN_MAPPING,
598 BRIDGE_VLAN_MAPPING_MAX
599};
600
Mohammed Javid1102e802018-06-25 18:58:20 +0530601enum ipa_wlan_fw_ssr_event {
602 WLAN_FWR_SSR_BEFORE_SHUTDOWN = BRIDGE_VLAN_MAPPING_MAX,
603 IPA_WLAN_FW_SSR_EVENT_MAX
604#define IPA_WLAN_FW_SSR_EVENT_MAX IPA_WLAN_FW_SSR_EVENT_MAX
605};
606
Mohammed Javida0f23d92018-09-11 10:50:28 +0530607enum ipa_gsb_event {
608 IPA_GSB_CONNECT = IPA_WLAN_FW_SSR_EVENT_MAX,
609 IPA_GSB_DISCONNECT,
610 IPA_GSB_EVENT_MAX,
611#define IPA_GSB_EVENT_MAX IPA_GSB_EVENT_MAX
612};
613
Chaitanya Pratapa5f1d58e2019-11-11 17:10:40 -0800614enum ipa_peripheral_event {
615 IPA_PERIPHERAL_CONNECT = ECM_CONNECT,
616 IPA_PERIPHERAL_DISCONNECT = ECM_DISCONNECT
617};
618
Amir Levy6e8b7642019-03-26 13:04:33 +0200619#define WIGIG_CLIENT_CONNECT (IPA_GSB_EVENT_MAX)
620#define WIGIG_FST_SWITCH (WIGIG_CLIENT_CONNECT + 1)
621#define WIGIG_EVENT_MAX (WIGIG_FST_SWITCH + 1)
622
623#define IPA_EVENT_MAX_NUM (WIGIG_EVENT_MAX)
Shihuan Liuc3174f52017-05-04 15:59:13 -0700624#define IPA_EVENT_MAX ((int)IPA_EVENT_MAX_NUM)
Amir Levy9659e592016-10-27 18:08:27 +0300625
626/**
627 * enum ipa_rm_resource_name - IPA RM clients identification names
628 *
Skylar Changa9516582017-05-09 11:36:47 -0700629 * PROD resources are always even, and CONS resources are always odd.
630 * Add new clients in the end of the list and update IPA_RM_RESOURCE_MAX
Amir Levy9659e592016-10-27 18:08:27 +0300631 */
632enum ipa_rm_resource_name {
Skylar Changa9516582017-05-09 11:36:47 -0700633 IPA_RM_RESOURCE_Q6_PROD = 0,
634 IPA_RM_RESOURCE_Q6_CONS = 1,
Amir Levy9659e592016-10-27 18:08:27 +0300635
Skylar Changa9516582017-05-09 11:36:47 -0700636 IPA_RM_RESOURCE_USB_PROD = 2,
637 IPA_RM_RESOURCE_USB_CONS = 3,
638
639 IPA_RM_RESOURCE_USB_DPL_DUMMY_PROD = 4,
640 IPA_RM_RESOURCE_USB_DPL_CONS = 5,
641
642 IPA_RM_RESOURCE_HSIC_PROD = 6,
643 IPA_RM_RESOURCE_HSIC_CONS = 7,
644
645 IPA_RM_RESOURCE_STD_ECM_PROD = 8,
646 IPA_RM_RESOURCE_APPS_CONS = 9,
647
648 IPA_RM_RESOURCE_RNDIS_PROD = 10,
649 /* RESERVED CONS = 11, */
650
651 IPA_RM_RESOURCE_WWAN_0_PROD = 12,
652 /* RESERVED CONS = 13, */
653
654 IPA_RM_RESOURCE_WLAN_PROD = 14,
655 IPA_RM_RESOURCE_WLAN_CONS = 15,
656
657 IPA_RM_RESOURCE_ODU_ADAPT_PROD = 16,
658 IPA_RM_RESOURCE_ODU_ADAPT_CONS = 17,
659
660 IPA_RM_RESOURCE_MHI_PROD = 18,
661 IPA_RM_RESOURCE_MHI_CONS = 19,
662
663 IPA_RM_RESOURCE_ETHERNET_PROD = 20,
664 IPA_RM_RESOURCE_ETHERNET_CONS = 21,
Amir Levy9659e592016-10-27 18:08:27 +0300665};
Skylar Changa9516582017-05-09 11:36:47 -0700666#define IPA_RM_RESOURCE_MAX (IPA_RM_RESOURCE_ETHERNET_CONS + 1)
Amir Levy9659e592016-10-27 18:08:27 +0300667
668/**
669 * enum ipa_hw_type - IPA hardware version type
670 * @IPA_HW_None: IPA hardware version not defined
671 * @IPA_HW_v1_0: IPA hardware version 1.0
672 * @IPA_HW_v1_1: IPA hardware version 1.1
673 * @IPA_HW_v2_0: IPA hardware version 2.0
674 * @IPA_HW_v2_1: IPA hardware version 2.1
675 * @IPA_HW_v2_5: IPA hardware version 2.5
676 * @IPA_HW_v2_6: IPA hardware version 2.6
677 * @IPA_HW_v2_6L: IPA hardware version 2.6L
678 * @IPA_HW_v3_0: IPA hardware version 3.0
679 * @IPA_HW_v3_1: IPA hardware version 3.1
680 * @IPA_HW_v3_5: IPA hardware version 3.5
681 * @IPA_HW_v3_5_1: IPA hardware version 3.5.1
Michael Adisumarta891a4ff2017-05-16 16:40:06 -0700682 * @IPA_HW_v4_0: IPA hardware version 4.0
Ghanim Fodi2f804372018-08-14 13:15:36 +0300683 * @IPA_HW_v4_1: IPA hardware version 4.1
684 * @IPA_HW_v4_2: IPA hardware version 4.2
685 * @IPA_HW_v4_5: IPA hardware version 4.5
Amir Levy9659e592016-10-27 18:08:27 +0300686 */
687enum ipa_hw_type {
688 IPA_HW_None = 0,
689 IPA_HW_v1_0 = 1,
690 IPA_HW_v1_1 = 2,
691 IPA_HW_v2_0 = 3,
692 IPA_HW_v2_1 = 4,
693 IPA_HW_v2_5 = 5,
694 IPA_HW_v2_6 = IPA_HW_v2_5,
695 IPA_HW_v2_6L = 6,
696 IPA_HW_v3_0 = 10,
697 IPA_HW_v3_1 = 11,
698 IPA_HW_v3_5 = 12,
699 IPA_HW_v3_5_1 = 13,
Michael Adisumarta891a4ff2017-05-16 16:40:06 -0700700 IPA_HW_v4_0 = 14,
Ghanim Fodi2f804372018-08-14 13:15:36 +0300701 IPA_HW_v4_1 = 15,
702 IPA_HW_v4_2 = 16,
703 IPA_HW_v4_5 = 17,
Amir Levy9659e592016-10-27 18:08:27 +0300704};
Ghanim Fodi2f804372018-08-14 13:15:36 +0300705#define IPA_HW_MAX (IPA_HW_v4_5 + 1)
Amir Levy9659e592016-10-27 18:08:27 +0300706
Michael Adisumarta891a4ff2017-05-16 16:40:06 -0700707#define IPA_HW_v4_0 IPA_HW_v4_0
Ghanim Fodi2f804372018-08-14 13:15:36 +0300708#define IPA_HW_v4_1 IPA_HW_v4_1
709#define IPA_HW_v4_2 IPA_HW_v4_2
710#define IPA_HW_v4_5 IPA_HW_v4_5
Michael Adisumarta891a4ff2017-05-16 16:40:06 -0700711
Amir Levy9659e592016-10-27 18:08:27 +0300712/**
713 * struct ipa_rule_attrib - attributes of a routing/filtering
714 * rule, all in LE
715 * @attrib_mask: what attributes are valid
716 * @src_port_lo: low port of src port range
717 * @src_port_hi: high port of src port range
718 * @dst_port_lo: low port of dst port range
719 * @dst_port_hi: high port of dst port range
720 * @type: ICMP/IGMP type
721 * @code: ICMP/IGMP code
722 * @spi: IPSec SPI
723 * @src_port: exact src port
724 * @dst_port: exact dst port
725 * @meta_data: meta-data val
726 * @meta_data_mask: meta-data mask
727 * @u.v4.tos: type of service
728 * @u.v4.protocol: protocol
729 * @u.v4.src_addr: src address value
730 * @u.v4.src_addr_mask: src address mask
731 * @u.v4.dst_addr: dst address value
732 * @u.v4.dst_addr_mask: dst address mask
733 * @u.v6.tc: traffic class
734 * @u.v6.flow_label: flow label
735 * @u.v6.next_hdr: next header
736 * @u.v6.src_addr: src address val
737 * @u.v6.src_addr_mask: src address mask
738 * @u.v6.dst_addr: dst address val
739 * @u.v6.dst_addr_mask: dst address mask
Amir Levy54954772019-10-22 10:27:12 +0300740 * @vlan_id: vlan id value
Amir Levy9659e592016-10-27 18:08:27 +0300741 */
742struct ipa_rule_attrib {
743 uint32_t attrib_mask;
744 uint16_t src_port_lo;
745 uint16_t src_port_hi;
746 uint16_t dst_port_lo;
747 uint16_t dst_port_hi;
748 uint8_t type;
749 uint8_t code;
750 uint8_t tos_value;
751 uint8_t tos_mask;
752 uint32_t spi;
753 uint16_t src_port;
754 uint16_t dst_port;
755 uint32_t meta_data;
756 uint32_t meta_data_mask;
757 uint8_t src_mac_addr[ETH_ALEN];
758 uint8_t src_mac_addr_mask[ETH_ALEN];
759 uint8_t dst_mac_addr[ETH_ALEN];
760 uint8_t dst_mac_addr_mask[ETH_ALEN];
761 uint16_t ether_type;
762 union {
763 struct {
764 uint8_t tos;
765 uint8_t protocol;
766 uint32_t src_addr;
767 uint32_t src_addr_mask;
768 uint32_t dst_addr;
769 uint32_t dst_addr_mask;
770 } v4;
771 struct {
772 uint8_t tc;
773 uint32_t flow_label;
774 uint8_t next_hdr;
775 uint32_t src_addr[4];
776 uint32_t src_addr_mask[4];
777 uint32_t dst_addr[4];
778 uint32_t dst_addr_mask[4];
779 } v6;
780 } u;
Amir Levy54954772019-10-22 10:27:12 +0300781 uint16_t vlan_id;
Amir Levy9659e592016-10-27 18:08:27 +0300782};
783
784/*! @brief The maximum number of Mask Equal 32 Eqns */
785#define IPA_IPFLTR_NUM_MEQ_32_EQNS 2
786
787/*! @brief The maximum number of IHL offset Mask Equal 32 Eqns */
788#define IPA_IPFLTR_NUM_IHL_MEQ_32_EQNS 2
789
790/*! @brief The maximum number of Mask Equal 128 Eqns */
791#define IPA_IPFLTR_NUM_MEQ_128_EQNS 2
792
793/*! @brief The maximum number of IHL offset Range Check 16 Eqns */
794#define IPA_IPFLTR_NUM_IHL_RANGE_16_EQNS 2
795
796/*! @brief Offset and 16 bit comparison equation */
797struct ipa_ipfltr_eq_16 {
798 int8_t offset;
799 uint16_t value;
800};
801
802/*! @brief Offset and 32 bit comparison equation */
803struct ipa_ipfltr_eq_32 {
804 int8_t offset;
805 uint32_t value;
806};
807
808/*! @brief Offset and 128 bit masked comparison equation */
809struct ipa_ipfltr_mask_eq_128 {
810 int8_t offset;
811 uint8_t mask[16];
812 uint8_t value[16];
813};
814
815/*! @brief Offset and 32 bit masked comparison equation */
816struct ipa_ipfltr_mask_eq_32 {
817 int8_t offset;
818 uint32_t mask;
819 uint32_t value;
820};
821
822/*! @brief Equation for identifying a range. Ranges are inclusive */
823struct ipa_ipfltr_range_eq_16 {
824 int8_t offset;
825 uint16_t range_low;
826 uint16_t range_high;
827};
828
829/*! @brief Rule equations which are set according to DS filter installation */
830struct ipa_ipfltri_rule_eq {
831 /*! 16-bit Bitmask to indicate how many eqs are valid in this rule */
832 uint16_t rule_eq_bitmap;
833 /*! Specifies if a type of service check rule is present */
834 uint8_t tos_eq_present;
835 /*! The value to check against the type of service (ipv4) field */
836 uint8_t tos_eq;
837 /*! Specifies if a protocol check rule is present */
838 uint8_t protocol_eq_present;
839 /*! The value to check against the protocol (ipv6) field */
840 uint8_t protocol_eq;
841 /*! The number of ip header length offset 16 bit range check
842 * rules in this rule
843 */
844 uint8_t num_ihl_offset_range_16;
845 /*! An array of the registered ip header length offset 16 bit
846 * range check rules
847 */
848 struct ipa_ipfltr_range_eq_16
849 ihl_offset_range_16[IPA_IPFLTR_NUM_IHL_RANGE_16_EQNS];
850 /*! The number of mask equal 32 rules present in this rule */
851 uint8_t num_offset_meq_32;
852 /*! An array of all the possible mask equal 32 rules in this rule */
853 struct ipa_ipfltr_mask_eq_32
854 offset_meq_32[IPA_IPFLTR_NUM_MEQ_32_EQNS];
855 /*! Specifies if the traffic class rule is present in this rule */
856 uint8_t tc_eq_present;
857 /*! The value to check the traffic class (ipv4) field against */
858 uint8_t tc_eq;
859 /*! Specifies if the flow equals rule is present in this rule */
860 uint8_t fl_eq_present;
861 /*! The value to check the flow (ipv6) field against */
862 uint32_t fl_eq;
863 /*! The number of ip header length offset 16 bit equations in this
864 * rule
865 */
866 uint8_t ihl_offset_eq_16_present;
867 /*! The ip header length offset 16 bit equation */
868 struct ipa_ipfltr_eq_16 ihl_offset_eq_16;
869 /*! The number of ip header length offset 32 bit equations in this
870 * rule
871 */
872 uint8_t ihl_offset_eq_32_present;
873 /*! The ip header length offset 32 bit equation */
874 struct ipa_ipfltr_eq_32 ihl_offset_eq_32;
875 /*! The number of ip header length offset 32 bit mask equations in
876 * this rule
877 */
878 uint8_t num_ihl_offset_meq_32;
879 /*! The ip header length offset 32 bit mask equation */
880 struct ipa_ipfltr_mask_eq_32
881 ihl_offset_meq_32[IPA_IPFLTR_NUM_IHL_MEQ_32_EQNS];
882 /*! The number of ip header length offset 128 bit equations in this
883 * rule
884 */
885 uint8_t num_offset_meq_128;
886 /*! The ip header length offset 128 bit equation */
887 struct ipa_ipfltr_mask_eq_128
888 offset_meq_128[IPA_IPFLTR_NUM_MEQ_128_EQNS];
889 /*! The metadata 32 bit masked comparison equation present or not */
890 /* Metadata based rules are added internally by IPA driver */
891 uint8_t metadata_meq32_present;
892 /*! The metadata 32 bit masked comparison equation */
893 struct ipa_ipfltr_mask_eq_32 metadata_meq32;
894 /*! Specifies if the Fragment equation is present in this rule */
895 uint8_t ipv4_frag_eq_present;
896};
897
898/**
899 * struct ipa_flt_rule - attributes of a filtering rule
900 * @retain_hdr: bool switch to instruct IPA core to add back to the packet
901 * the header removed as part of header removal
902 * @to_uc: bool switch to pass packet to micro-controller
903 * @action: action field
904 * @rt_tbl_hdl: handle of table from "get"
905 * @attrib: attributes of the rule
906 * @eq_attrib: attributes of the rule in equation form (valid when
907 * eq_attrib_type is true)
908 * @rt_tbl_idx: index of RT table referred to by filter rule (valid when
909 * eq_attrib_type is true and non-exception action)
910 * @eq_attrib_type: true if equation level form used to specify attributes
911 * @max_prio: bool switch. is this rule with Max priority? meaning on rule hit,
912 * IPA will use the rule and will not look for other rules that may have
913 * higher priority
914 * @hashable: bool switch. is this rule hashable or not?
915 * ipa uses hashable rules to cache their hit results to be used in
916 * consecutive packets
917 * @rule_id: rule_id to be assigned to the filter rule. In case client specifies
918 * rule_id as 0 the driver will assign a new rule_id
Amir Levy05fccd02017-06-13 16:25:45 +0300919 * @set_metadata: bool switch. should metadata replacement at the NAT block
920 * take place?
921 * @pdn_idx: if action is "pass to source\destination NAT" then a comparison
922 * against the PDN index in the matching PDN entry will take place as an
923 * additional condition for NAT hit.
Amir Levy9659e592016-10-27 18:08:27 +0300924 */
925struct ipa_flt_rule {
926 uint8_t retain_hdr;
927 uint8_t to_uc;
928 enum ipa_flt_action action;
929 uint32_t rt_tbl_hdl;
930 struct ipa_rule_attrib attrib;
931 struct ipa_ipfltri_rule_eq eq_attrib;
932 uint32_t rt_tbl_idx;
933 uint8_t eq_attrib_type;
934 uint8_t max_prio;
935 uint8_t hashable;
936 uint16_t rule_id;
Amir Levy05fccd02017-06-13 16:25:45 +0300937 uint8_t set_metadata;
938 uint8_t pdn_idx;
Amir Levy9659e592016-10-27 18:08:27 +0300939};
940
941/**
942 * enum ipa_hdr_l2_type - L2 header type
943 * IPA_HDR_L2_NONE: L2 header which isn't Ethernet II and isn't 802_3
944 * IPA_HDR_L2_ETHERNET_II: L2 header of type Ethernet II
945 * IPA_HDR_L2_802_3: L2 header of type 802_3
Amir Levy2da9d452017-12-12 10:09:46 +0200946 * IPA_HDR_L2_802_1Q: L2 header of type 802_1Q
Amir Levy9659e592016-10-27 18:08:27 +0300947 */
948enum ipa_hdr_l2_type {
949 IPA_HDR_L2_NONE,
950 IPA_HDR_L2_ETHERNET_II,
951 IPA_HDR_L2_802_3,
Amir Levy2da9d452017-12-12 10:09:46 +0200952 IPA_HDR_L2_802_1Q,
Amir Levy9659e592016-10-27 18:08:27 +0300953};
Amir Levy2da9d452017-12-12 10:09:46 +0200954#define IPA_HDR_L2_MAX (IPA_HDR_L2_802_1Q + 1)
955
956#define IPA_HDR_L2_802_1Q IPA_HDR_L2_802_1Q
Amir Levy9659e592016-10-27 18:08:27 +0300957
958/**
959 * enum ipa_hdr_l2_type - Processing context type
960 * IPA_HDR_PROC_NONE: No processing context
961 * IPA_HDR_PROC_ETHII_TO_ETHII: Process Ethernet II to Ethernet II
962 * IPA_HDR_PROC_ETHII_TO_802_3: Process Ethernet II to 802_3
963 * IPA_HDR_PROC_802_3_TO_ETHII: Process 802_3 to Ethernet II
964 * IPA_HDR_PROC_802_3_TO_802_3: Process 802_3 to 802_3
Amir Levyf2e52cc2019-11-07 09:12:38 +0200965 * IPA_HDR_PROC_ETHII_TO_ETHII_EX: Process Ethernet II to Ethernet II with
966 * generic lengths of src and dst headers
Amir Levy9659e592016-10-27 18:08:27 +0300967 */
968enum ipa_hdr_proc_type {
969 IPA_HDR_PROC_NONE,
970 IPA_HDR_PROC_ETHII_TO_ETHII,
971 IPA_HDR_PROC_ETHII_TO_802_3,
972 IPA_HDR_PROC_802_3_TO_ETHII,
973 IPA_HDR_PROC_802_3_TO_802_3,
Skylar Chang7fa22712017-04-03 18:29:21 -0700974 IPA_HDR_PROC_L2TP_HEADER_ADD,
Amir Levyf2e52cc2019-11-07 09:12:38 +0200975 IPA_HDR_PROC_L2TP_HEADER_REMOVE,
976 IPA_HDR_PROC_ETHII_TO_ETHII_EX
Amir Levy9659e592016-10-27 18:08:27 +0300977};
Amir Levyf2e52cc2019-11-07 09:12:38 +0200978#define IPA_HDR_PROC_MAX (IPA_HDR_PROC_ETHII_TO_ETHII_EX + 1)
Amir Levy9659e592016-10-27 18:08:27 +0300979
980/**
981 * struct ipa_rt_rule - attributes of a routing rule
982 * @dst: dst "client"
983 * @hdr_hdl: handle to the dynamic header
984 it is not an index or an offset
985 * @hdr_proc_ctx_hdl: handle to header processing context. if it is provided
986 hdr_hdl shall be 0
987 * @attrib: attributes of the rule
988 * @max_prio: bool switch. is this rule with Max priority? meaning on rule hit,
989 * IPA will use the rule and will not look for other rules that may have
990 * higher priority
991 * @hashable: bool switch. is this rule hashable or not?
992 * ipa uses hashable rules to cache their hit results to be used in
993 * consecutive packets
994 * @retain_hdr: bool switch to instruct IPA core to add back to the packet
995 * the header removed as part of header removal
996 */
997struct ipa_rt_rule {
998 enum ipa_client_type dst;
999 uint32_t hdr_hdl;
1000 uint32_t hdr_proc_ctx_hdl;
1001 struct ipa_rule_attrib attrib;
1002 uint8_t max_prio;
1003 uint8_t hashable;
1004 uint8_t retain_hdr;
1005};
1006
1007/**
1008 * struct ipa_hdr_add - header descriptor includes in and out
1009 * parameters
1010 * @name: name of the header
1011 * @hdr: actual header to be inserted
1012 * @hdr_len: size of above header
1013 * @type: l2 header type
1014 * @is_partial: header not fully specified
1015 * @hdr_hdl: out parameter, handle to header, valid when status is 0
1016 * @status: out parameter, status of header add operation,
1017 * 0 for success,
1018 * -1 for failure
1019 * @is_eth2_ofst_valid: is eth2_ofst field valid?
1020 * @eth2_ofst: offset to start of Ethernet-II/802.3 header
1021 */
1022struct ipa_hdr_add {
1023 char name[IPA_RESOURCE_NAME_MAX];
1024 uint8_t hdr[IPA_HDR_MAX_SIZE];
1025 uint8_t hdr_len;
1026 enum ipa_hdr_l2_type type;
1027 uint8_t is_partial;
1028 uint32_t hdr_hdl;
1029 int status;
1030 uint8_t is_eth2_ofst_valid;
1031 uint16_t eth2_ofst;
1032};
1033
1034/**
1035 * struct ipa_ioc_add_hdr - header addition parameters (support
1036 * multiple headers and commit)
1037 * @commit: should headers be written to IPA HW also?
1038 * @num_hdrs: num of headers that follow
1039 * @ipa_hdr_add hdr: all headers need to go here back to
1040 * back, no pointers
1041 */
1042struct ipa_ioc_add_hdr {
1043 uint8_t commit;
1044 uint8_t num_hdrs;
1045 struct ipa_hdr_add hdr[0];
1046};
1047
1048/**
Skylar Chang7fa22712017-04-03 18:29:21 -07001049 * struct ipa_l2tp_header_add_procparams -
1050 * @eth_hdr_retained: Specifies if Ethernet header is retained or not
1051 * @input_ip_version: Specifies if Input header is IPV4(0) or IPV6(1)
1052 * @output_ip_version: Specifies if template header is IPV4(0) or IPV6(1)
1053 */
1054struct ipa_l2tp_header_add_procparams {
1055 uint32_t eth_hdr_retained:1;
1056 uint32_t input_ip_version:1;
1057 uint32_t output_ip_version:1;
1058 uint32_t reserved:29;
1059};
1060
1061/**
1062 * struct ipa_l2tp_header_remove_procparams -
1063 * @hdr_len_remove: Specifies how much of the header needs to
1064 be removed in bytes
1065 * @eth_hdr_retained: Specifies if Ethernet header is retained or not
Shihuan Liufe2818b2017-07-03 22:14:55 -07001066 * @hdr_ofst_pkt_size_valid: Specifies if the Header offset is valid
1067 * @hdr_ofst_pkt_size: If hdr_ofst_pkt_size_valid =1, this indicates where the
1068 packet size field (2bytes) resides
1069 * @hdr_endianness: 0:little endian, 1:big endian
Skylar Chang7fa22712017-04-03 18:29:21 -07001070 */
1071struct ipa_l2tp_header_remove_procparams {
1072 uint32_t hdr_len_remove:8;
1073 uint32_t eth_hdr_retained:1;
Shihuan Liufe2818b2017-07-03 22:14:55 -07001074 /* Following fields are valid if eth_hdr_retained =1 ( bridge mode) */
1075 uint32_t hdr_ofst_pkt_size_valid:1;
1076 uint32_t hdr_ofst_pkt_size:6;
1077 uint32_t hdr_endianness:1;
1078 uint32_t reserved:15;
Skylar Chang7fa22712017-04-03 18:29:21 -07001079};
1080
1081/**
Shihuan Liufe2818b2017-07-03 22:14:55 -07001082 * struct ipa_l2tp_hdr_proc_ctx_params -
Skylar Chang7fa22712017-04-03 18:29:21 -07001083 * @hdr_add_param: parameters for header add
1084 * @hdr_remove_param: parameters for header remove
Shihuan Liufe2818b2017-07-03 22:14:55 -07001085 * @is_dst_pipe_valid: if dst pipe is valid
1086 * @dst_pipe: destination pipe
Skylar Chang7fa22712017-04-03 18:29:21 -07001087 */
Shihuan Liufe2818b2017-07-03 22:14:55 -07001088struct ipa_l2tp_hdr_proc_ctx_params {
Skylar Chang7fa22712017-04-03 18:29:21 -07001089 struct ipa_l2tp_header_add_procparams hdr_add_param;
1090 struct ipa_l2tp_header_remove_procparams hdr_remove_param;
Shihuan Liufe2818b2017-07-03 22:14:55 -07001091 uint8_t is_dst_pipe_valid;
1092 enum ipa_client_type dst_pipe;
Skylar Chang7fa22712017-04-03 18:29:21 -07001093};
Shihuan Liufe2818b2017-07-03 22:14:55 -07001094
Amir Levyf2e52cc2019-11-07 09:12:38 +02001095/**
1096 * struct ipa_eth_II_to_eth_II_ex_procparams -
1097 * @input_ethhdr_negative_offset: Specifies where the ethernet hdr offset is
1098 * (in bytes) from the start of the input IP hdr
1099 * @output_ethhdr_negative_offset: Specifies where the ethernet hdr offset is
1100 * (in bytes) from the end of the template hdr
1101 * @reserved: for future use
1102 */
1103struct ipa_eth_II_to_eth_II_ex_procparams {
1104 uint32_t input_ethhdr_negative_offset : 8;
1105 uint32_t output_ethhdr_negative_offset : 8;
1106 uint32_t reserved : 16;
1107};
1108
Shihuan Liufe2818b2017-07-03 22:14:55 -07001109#define L2TP_USER_SPACE_SPECIFY_DST_PIPE
1110
Skylar Chang7fa22712017-04-03 18:29:21 -07001111/**
Amir Levy9659e592016-10-27 18:08:27 +03001112 * struct ipa_hdr_proc_ctx_add - processing context descriptor includes
1113 * in and out parameters
1114 * @type: processing context type
1115 * @hdr_hdl: in parameter, handle to header
Skylar Chang7fa22712017-04-03 18:29:21 -07001116 * @l2tp_params: l2tp parameters
Amir Levyf2e52cc2019-11-07 09:12:38 +02001117 * @generic_params: generic proc_ctx params
Amir Levy9659e592016-10-27 18:08:27 +03001118 * @proc_ctx_hdl: out parameter, handle to proc_ctx, valid when status is 0
1119 * @status: out parameter, status of header add operation,
1120 * 0 for success,
1121 * -1 for failure
1122 */
1123struct ipa_hdr_proc_ctx_add {
1124 enum ipa_hdr_proc_type type;
1125 uint32_t hdr_hdl;
1126 uint32_t proc_ctx_hdl;
1127 int status;
Shihuan Liufe2818b2017-07-03 22:14:55 -07001128 struct ipa_l2tp_hdr_proc_ctx_params l2tp_params;
Amir Levyf2e52cc2019-11-07 09:12:38 +02001129 struct ipa_eth_II_to_eth_II_ex_procparams generic_params;
Amir Levy9659e592016-10-27 18:08:27 +03001130};
1131
Skylar Chang7fa22712017-04-03 18:29:21 -07001132#define IPA_L2TP_HDR_PROC_SUPPORT
1133
Amir Levy9659e592016-10-27 18:08:27 +03001134/**
1135 * struct ipa_ioc_add_hdr - processing context addition parameters (support
1136 * multiple processing context and commit)
1137 * @commit: should processing context be written to IPA HW also?
1138 * @num_proc_ctxs: num of processing context that follow
1139 * @proc_ctx: all processing context need to go here back to
1140 * back, no pointers
1141 */
1142struct ipa_ioc_add_hdr_proc_ctx {
1143 uint8_t commit;
1144 uint8_t num_proc_ctxs;
1145 struct ipa_hdr_proc_ctx_add proc_ctx[0];
1146};
1147
1148/**
1149 * struct ipa_ioc_copy_hdr - retrieve a copy of the specified
1150 * header - caller can then derive the complete header
1151 * @name: name of the header resource
1152 * @hdr: out parameter, contents of specified header,
1153 * valid only when ioctl return val is non-negative
1154 * @hdr_len: out parameter, size of above header
1155 * valid only when ioctl return val is non-negative
1156 * @type: l2 header type
1157 * valid only when ioctl return val is non-negative
1158 * @is_partial: out parameter, indicates whether specified header is partial
1159 * valid only when ioctl return val is non-negative
1160 * @is_eth2_ofst_valid: is eth2_ofst field valid?
1161 * @eth2_ofst: offset to start of Ethernet-II/802.3 header
1162 */
1163struct ipa_ioc_copy_hdr {
1164 char name[IPA_RESOURCE_NAME_MAX];
1165 uint8_t hdr[IPA_HDR_MAX_SIZE];
1166 uint8_t hdr_len;
1167 enum ipa_hdr_l2_type type;
1168 uint8_t is_partial;
1169 uint8_t is_eth2_ofst_valid;
1170 uint16_t eth2_ofst;
1171};
1172
1173/**
1174 * struct ipa_ioc_get_hdr - header entry lookup parameters, if lookup was
1175 * successful caller must call put to release the reference count when done
1176 * @name: name of the header resource
1177 * @hdl: out parameter, handle of header entry
1178 * valid only when ioctl return val is non-negative
1179 */
1180struct ipa_ioc_get_hdr {
1181 char name[IPA_RESOURCE_NAME_MAX];
1182 uint32_t hdl;
1183};
1184
1185/**
1186 * struct ipa_hdr_del - header descriptor includes in and out
1187 * parameters
1188 *
1189 * @hdl: handle returned from header add operation
1190 * @status: out parameter, status of header remove operation,
1191 * 0 for success,
1192 * -1 for failure
1193 */
1194struct ipa_hdr_del {
1195 uint32_t hdl;
1196 int status;
1197};
1198
1199/**
1200 * struct ipa_ioc_del_hdr - header deletion parameters (support
1201 * multiple headers and commit)
1202 * @commit: should headers be removed from IPA HW also?
1203 * @num_hdls: num of headers being removed
1204 * @ipa_hdr_del hdl: all handles need to go here back to back, no pointers
1205 */
1206struct ipa_ioc_del_hdr {
1207 uint8_t commit;
1208 uint8_t num_hdls;
1209 struct ipa_hdr_del hdl[0];
1210};
1211
1212/**
1213 * struct ipa_hdr_proc_ctx_del - processing context descriptor includes
1214 * in and out parameters
1215 * @hdl: handle returned from processing context add operation
1216 * @status: out parameter, status of header remove operation,
1217 * 0 for success,
1218 * -1 for failure
1219 */
1220struct ipa_hdr_proc_ctx_del {
1221 uint32_t hdl;
1222 int status;
1223};
1224
1225/**
1226 * ipa_ioc_del_hdr_proc_ctx - processing context deletion parameters (support
1227 * multiple headers and commit)
1228 * @commit: should processing contexts be removed from IPA HW also?
1229 * @num_hdls: num of processing contexts being removed
1230 * @ipa_hdr_proc_ctx_del hdl: all handles need to go here back to back,
1231 * no pointers
1232 */
1233struct ipa_ioc_del_hdr_proc_ctx {
1234 uint8_t commit;
1235 uint8_t num_hdls;
1236 struct ipa_hdr_proc_ctx_del hdl[0];
1237};
1238
1239/**
1240 * struct ipa_rt_rule_add - routing rule descriptor includes in
1241 * and out parameters
1242 * @rule: actual rule to be added
1243 * @at_rear: add at back of routing table, it is NOT possible to add rules at
1244 * the rear of the "default" routing tables
1245 * @rt_rule_hdl: output parameter, handle to rule, valid when status is 0
1246 * @status: output parameter, status of routing rule add operation,
1247 * 0 for success,
1248 * -1 for failure
1249 */
1250struct ipa_rt_rule_add {
1251 struct ipa_rt_rule rule;
1252 uint8_t at_rear;
1253 uint32_t rt_rule_hdl;
1254 int status;
1255};
1256
1257/**
1258 * struct ipa_ioc_add_rt_rule - routing rule addition parameters (supports
1259 * multiple rules and commit);
1260 *
1261 * all rules MUST be added to same table
1262 * @commit: should rules be written to IPA HW also?
1263 * @ip: IP family of rule
1264 * @rt_tbl_name: name of routing table resource
1265 * @num_rules: number of routing rules that follow
1266 * @ipa_rt_rule_add rules: all rules need to go back to back here, no pointers
1267 */
1268struct ipa_ioc_add_rt_rule {
1269 uint8_t commit;
1270 enum ipa_ip_type ip;
1271 char rt_tbl_name[IPA_RESOURCE_NAME_MAX];
1272 uint8_t num_rules;
1273 struct ipa_rt_rule_add rules[0];
1274};
1275
1276/**
1277 * struct ipa_ioc_add_rt_rule_after - routing rule addition after a specific
1278 * rule parameters(supports multiple rules and commit);
1279 *
1280 * all rules MUST be added to same table
1281 * @commit: should rules be written to IPA HW also?
1282 * @ip: IP family of rule
1283 * @rt_tbl_name: name of routing table resource
1284 * @num_rules: number of routing rules that follow
1285 * @add_after_hdl: the rules will be added after this specific rule
1286 * @ipa_rt_rule_add rules: all rules need to go back to back here, no pointers
1287 * at_rear field will be ignored when using this IOCTL
1288 */
1289struct ipa_ioc_add_rt_rule_after {
1290 uint8_t commit;
1291 enum ipa_ip_type ip;
1292 char rt_tbl_name[IPA_RESOURCE_NAME_MAX];
1293 uint8_t num_rules;
1294 uint32_t add_after_hdl;
1295 struct ipa_rt_rule_add rules[0];
1296};
1297
1298/**
1299 * struct ipa_rt_rule_mdfy - routing rule descriptor includes
1300 * in and out parameters
1301 * @rule: actual rule to be added
1302 * @rt_rule_hdl: handle to rule which supposed to modify
1303 * @status: output parameter, status of routing rule modify operation,
1304 * 0 for success,
1305 * -1 for failure
1306 *
1307 */
1308struct ipa_rt_rule_mdfy {
1309 struct ipa_rt_rule rule;
1310 uint32_t rt_rule_hdl;
1311 int status;
1312};
1313
1314/**
1315 * struct ipa_ioc_mdfy_rt_rule - routing rule modify parameters (supports
1316 * multiple rules and commit)
1317 * @commit: should rules be written to IPA HW also?
1318 * @ip: IP family of rule
1319 * @num_rules: number of routing rules that follow
1320 * @rules: all rules need to go back to back here, no pointers
1321 */
1322struct ipa_ioc_mdfy_rt_rule {
1323 uint8_t commit;
1324 enum ipa_ip_type ip;
1325 uint8_t num_rules;
1326 struct ipa_rt_rule_mdfy rules[0];
1327};
1328
1329/**
1330 * struct ipa_rt_rule_del - routing rule descriptor includes in
1331 * and out parameters
1332 * @hdl: handle returned from route rule add operation
1333 * @status: output parameter, status of route rule delete operation,
1334 * 0 for success,
1335 * -1 for failure
1336 */
1337struct ipa_rt_rule_del {
1338 uint32_t hdl;
1339 int status;
1340};
1341
1342/**
Mohammed Javidd0c2a1e2017-10-30 15:34:22 +05301343 * struct ipa_rt_rule_add_ext - routing rule descriptor includes in
1344 * and out parameters
1345 * @rule: actual rule to be added
1346 * @at_rear: add at back of routing table, it is NOT possible to add rules at
1347 * the rear of the "default" routing tables
1348 * @rt_rule_hdl: output parameter, handle to rule, valid when status is 0
1349 * @status: output parameter, status of routing rule add operation,
1350 * @rule_id: rule_id to be assigned to the routing rule. In case client
1351 * specifies rule_id as 0 the driver will assign a new rule_id
1352 * 0 for success,
1353 * -1 for failure
1354 */
1355struct ipa_rt_rule_add_ext {
1356 struct ipa_rt_rule rule;
1357 uint8_t at_rear;
1358 uint32_t rt_rule_hdl;
1359 int status;
1360 uint16_t rule_id;
1361};
1362
1363/**
1364 * struct ipa_ioc_add_rt_rule - routing rule addition parameters (supports
1365 * multiple rules and commit with rule_id);
1366 *
1367 * all rules MUST be added to same table
1368 * @commit: should rules be written to IPA HW also?
1369 * @ip: IP family of rule
1370 * @rt_tbl_name: name of routing table resource
1371 * @num_rules: number of routing rules that follow
1372 * @ipa_rt_rule_add_ext rules: all rules need to go back to back here,
1373 * no pointers
1374 */
1375struct ipa_ioc_add_rt_rule_ext {
1376 uint8_t commit;
1377 enum ipa_ip_type ip;
1378 char rt_tbl_name[IPA_RESOURCE_NAME_MAX];
1379 uint8_t num_rules;
1380 struct ipa_rt_rule_add_ext rules[0];
1381};
1382
1383
1384/**
Amir Levy9659e592016-10-27 18:08:27 +03001385 * struct ipa_ioc_del_rt_rule - routing rule deletion parameters (supports
1386 * multiple headers and commit)
1387 * @commit: should rules be removed from IPA HW also?
1388 * @ip: IP family of rules
1389 * @num_hdls: num of rules being removed
1390 * @ipa_rt_rule_del hdl: all handles need to go back to back here, no pointers
1391 */
1392struct ipa_ioc_del_rt_rule {
1393 uint8_t commit;
1394 enum ipa_ip_type ip;
1395 uint8_t num_hdls;
1396 struct ipa_rt_rule_del hdl[0];
1397};
1398
1399/**
1400 * struct ipa_ioc_get_rt_tbl_indx - routing table index lookup parameters
1401 * @ip: IP family of table
1402 * @name: name of routing table resource
1403 * @index: output parameter, routing table index, valid only when ioctl
1404 * return val is non-negative
1405 */
1406struct ipa_ioc_get_rt_tbl_indx {
1407 enum ipa_ip_type ip;
1408 char name[IPA_RESOURCE_NAME_MAX];
1409 uint32_t idx;
1410};
1411
1412/**
1413 * struct ipa_flt_rule_add - filtering rule descriptor includes
1414 * in and out parameters
1415 * @rule: actual rule to be added
1416 * @at_rear: add at back of filtering table?
1417 * @flt_rule_hdl: out parameter, handle to rule, valid when status is 0
1418 * @status: output parameter, status of filtering rule add operation,
1419 * 0 for success,
1420 * -1 for failure
1421 *
1422 */
1423struct ipa_flt_rule_add {
1424 struct ipa_flt_rule rule;
1425 uint8_t at_rear;
1426 uint32_t flt_rule_hdl;
1427 int status;
1428};
1429
1430/**
1431 * struct ipa_ioc_add_flt_rule - filtering rule addition parameters (supports
1432 * multiple rules and commit)
1433 * all rules MUST be added to same table
1434 * @commit: should rules be written to IPA HW also?
1435 * @ip: IP family of rule
1436 * @ep: which "clients" pipe does this rule apply to?
1437 * valid only when global is 0
1438 * @global: does this apply to global filter table of specific IP family
1439 * @num_rules: number of filtering rules that follow
1440 * @rules: all rules need to go back to back here, no pointers
1441 */
1442struct ipa_ioc_add_flt_rule {
1443 uint8_t commit;
1444 enum ipa_ip_type ip;
1445 enum ipa_client_type ep;
1446 uint8_t global;
1447 uint8_t num_rules;
1448 struct ipa_flt_rule_add rules[0];
1449};
1450
1451/**
1452 * struct ipa_ioc_add_flt_rule_after - filtering rule addition after specific
1453 * rule parameters (supports multiple rules and commit)
1454 * all rules MUST be added to same table
1455 * @commit: should rules be written to IPA HW also?
1456 * @ip: IP family of rule
1457 * @ep: which "clients" pipe does this rule apply to?
1458 * @num_rules: number of filtering rules that follow
1459 * @add_after_hdl: rules will be added after the rule with this handle
1460 * @rules: all rules need to go back to back here, no pointers. at rear field
1461 * is ignored when using this IOCTL
1462 */
1463struct ipa_ioc_add_flt_rule_after {
1464 uint8_t commit;
1465 enum ipa_ip_type ip;
1466 enum ipa_client_type ep;
1467 uint8_t num_rules;
1468 uint32_t add_after_hdl;
1469 struct ipa_flt_rule_add rules[0];
1470};
1471
1472/**
1473 * struct ipa_flt_rule_mdfy - filtering rule descriptor includes
1474 * in and out parameters
1475 * @rule: actual rule to be added
1476 * @flt_rule_hdl: handle to rule
1477 * @status: output parameter, status of filtering rule modify operation,
1478 * 0 for success,
1479 * -1 for failure
1480 *
1481 */
1482struct ipa_flt_rule_mdfy {
1483 struct ipa_flt_rule rule;
1484 uint32_t rule_hdl;
1485 int status;
1486};
1487
1488/**
1489 * struct ipa_ioc_mdfy_flt_rule - filtering rule modify parameters (supports
1490 * multiple rules and commit)
1491 * @commit: should rules be written to IPA HW also?
1492 * @ip: IP family of rule
1493 * @num_rules: number of filtering rules that follow
1494 * @rules: all rules need to go back to back here, no pointers
1495 */
1496struct ipa_ioc_mdfy_flt_rule {
1497 uint8_t commit;
1498 enum ipa_ip_type ip;
1499 uint8_t num_rules;
1500 struct ipa_flt_rule_mdfy rules[0];
1501};
1502
1503/**
1504 * struct ipa_flt_rule_del - filtering rule descriptor includes
1505 * in and out parameters
1506 *
1507 * @hdl: handle returned from filtering rule add operation
1508 * @status: output parameter, status of filtering rule delete operation,
1509 * 0 for success,
1510 * -1 for failure
1511 */
1512struct ipa_flt_rule_del {
1513 uint32_t hdl;
1514 int status;
1515};
1516
1517/**
1518 * struct ipa_ioc_del_flt_rule - filtering rule deletion parameters (supports
1519 * multiple headers and commit)
1520 * @commit: should rules be removed from IPA HW also?
1521 * @ip: IP family of rules
1522 * @num_hdls: num of rules being removed
1523 * @hdl: all handles need to go back to back here, no pointers
1524 */
1525struct ipa_ioc_del_flt_rule {
1526 uint8_t commit;
1527 enum ipa_ip_type ip;
1528 uint8_t num_hdls;
1529 struct ipa_flt_rule_del hdl[0];
1530};
1531
1532/**
1533 * struct ipa_ioc_get_rt_tbl - routing table lookup parameters, if lookup was
1534 * successful caller must call put to release the reference
1535 * count when done
1536 * @ip: IP family of table
1537 * @name: name of routing table resource
1538 * @htl: output parameter, handle of routing table, valid only when ioctl
1539 * return val is non-negative
1540 */
1541struct ipa_ioc_get_rt_tbl {
1542 enum ipa_ip_type ip;
1543 char name[IPA_RESOURCE_NAME_MAX];
1544 uint32_t hdl;
1545};
1546
1547/**
1548 * struct ipa_ioc_query_intf - used to lookup number of tx and
1549 * rx properties of interface
1550 * @name: name of interface
1551 * @num_tx_props: output parameter, number of tx properties
1552 * valid only when ioctl return val is non-negative
1553 * @num_rx_props: output parameter, number of rx properties
1554 * valid only when ioctl return val is non-negative
1555 * @num_ext_props: output parameter, number of ext properties
1556 * valid only when ioctl return val is non-negative
1557 * @excp_pipe: exception packets of this interface should be
1558 * routed to this pipe
1559 */
1560struct ipa_ioc_query_intf {
1561 char name[IPA_RESOURCE_NAME_MAX];
1562 uint32_t num_tx_props;
1563 uint32_t num_rx_props;
1564 uint32_t num_ext_props;
1565 enum ipa_client_type excp_pipe;
1566};
1567
1568/**
1569 * struct ipa_ioc_tx_intf_prop - interface tx property
1570 * @ip: IP family of routing rule
1571 * @attrib: routing rule
1572 * @dst_pipe: routing output pipe
1573 * @alt_dst_pipe: alternate routing output pipe
1574 * @hdr_name: name of associated header if any, empty string when no header
1575 * @hdr_l2_type: type of associated header if any, use NONE when no header
1576 */
1577struct ipa_ioc_tx_intf_prop {
1578 enum ipa_ip_type ip;
1579 struct ipa_rule_attrib attrib;
1580 enum ipa_client_type dst_pipe;
1581 enum ipa_client_type alt_dst_pipe;
1582 char hdr_name[IPA_RESOURCE_NAME_MAX];
1583 enum ipa_hdr_l2_type hdr_l2_type;
1584};
1585
1586/**
1587 * struct ipa_ioc_query_intf_tx_props - interface tx propertie
1588 * @name: name of interface
1589 * @num_tx_props: number of TX properties
1590 * @tx[0]: output parameter, the tx properties go here back to back
1591 */
1592struct ipa_ioc_query_intf_tx_props {
1593 char name[IPA_RESOURCE_NAME_MAX];
1594 uint32_t num_tx_props;
1595 struct ipa_ioc_tx_intf_prop tx[0];
1596};
1597
1598/**
1599 * struct ipa_ioc_ext_intf_prop - interface extended property
1600 * @ip: IP family of routing rule
1601 * @eq_attrib: attributes of the rule in equation form
1602 * @action: action field
1603 * @rt_tbl_idx: index of RT table referred to by filter rule
1604 * @mux_id: MUX_ID
1605 * @filter_hdl: handle of filter (as specified by provider of filter rule)
1606 * @is_xlat_rule: it is xlat flt rule or not
1607 */
1608struct ipa_ioc_ext_intf_prop {
1609 enum ipa_ip_type ip;
1610 struct ipa_ipfltri_rule_eq eq_attrib;
1611 enum ipa_flt_action action;
1612 uint32_t rt_tbl_idx;
1613 uint8_t mux_id;
1614 uint32_t filter_hdl;
1615 uint8_t is_xlat_rule;
1616 uint32_t rule_id;
1617 uint8_t is_rule_hashable;
1618};
1619
1620/**
1621 * struct ipa_ioc_query_intf_ext_props - interface ext propertie
1622 * @name: name of interface
1623 * @num_ext_props: number of EXT properties
1624 * @ext[0]: output parameter, the ext properties go here back to back
1625 */
1626struct ipa_ioc_query_intf_ext_props {
1627 char name[IPA_RESOURCE_NAME_MAX];
1628 uint32_t num_ext_props;
1629 struct ipa_ioc_ext_intf_prop ext[0];
1630};
1631
1632/**
1633 * struct ipa_ioc_rx_intf_prop - interface rx property
1634 * @ip: IP family of filtering rule
1635 * @attrib: filtering rule
1636 * @src_pipe: input pipe
1637 * @hdr_l2_type: type of associated header if any, use NONE when no header
1638 */
1639struct ipa_ioc_rx_intf_prop {
1640 enum ipa_ip_type ip;
1641 struct ipa_rule_attrib attrib;
1642 enum ipa_client_type src_pipe;
1643 enum ipa_hdr_l2_type hdr_l2_type;
1644};
1645
1646/**
1647 * struct ipa_ioc_query_intf_rx_props - interface rx propertie
1648 * @name: name of interface
1649 * @num_rx_props: number of RX properties
1650 * @rx: output parameter, the rx properties go here back to back
1651 */
1652struct ipa_ioc_query_intf_rx_props {
1653 char name[IPA_RESOURCE_NAME_MAX];
1654 uint32_t num_rx_props;
1655 struct ipa_ioc_rx_intf_prop rx[0];
1656};
1657
1658/**
1659 * struct ipa_ioc_nat_alloc_mem - nat table memory allocation
1660 * properties
1661 * @dev_name: input parameter, the name of table
1662 * @size: input parameter, size of table in bytes
1663 * @offset: output parameter, offset into page in case of system memory
1664 */
1665struct ipa_ioc_nat_alloc_mem {
1666 char dev_name[IPA_RESOURCE_NAME_MAX];
1667 size_t size;
1668 off_t offset;
1669};
1670
1671/**
Amir Levy479cfdd2017-10-26 12:23:14 +03001672 * struct ipa_ioc_nat_ipv6ct_table_alloc - NAT/IPv6CT table memory allocation
1673 * properties
1674 * @size: input parameter, size of table in bytes
1675 * @offset: output parameter, offset into page in case of system memory
1676 */
1677struct ipa_ioc_nat_ipv6ct_table_alloc {
1678 size_t size;
1679 off_t offset;
1680};
1681
1682/**
1683 * struct ipa_ioc_v4_nat_init - nat table initialization parameters
Amir Levy9659e592016-10-27 18:08:27 +03001684 * @tbl_index: input parameter, index of the table
1685 * @ipv4_rules_offset: input parameter, ipv4 rules address offset
1686 * @expn_rules_offset: input parameter, ipv4 expansion rules address offset
1687 * @index_offset: input parameter, index rules offset
1688 * @index_expn_offset: input parameter, index expansion rules offset
Amir Levy479cfdd2017-10-26 12:23:14 +03001689 * @table_entries: input parameter, ipv4 rules table number of entries
1690 * @expn_table_entries: input parameter, ipv4 expansion rules table number of
1691 * entries
Amir Levy9659e592016-10-27 18:08:27 +03001692 * @ip_addr: input parameter, public ip address
Perry Randise43d92c92019-09-16 10:27:40 -04001693 * @mem_type: input parameter, type of memory the table resides in
1694 * @focus_change: input parameter, are we moving to/from sram or ddr
Amir Levy9659e592016-10-27 18:08:27 +03001695 */
1696struct ipa_ioc_v4_nat_init {
Perry Randise43d92c92019-09-16 10:27:40 -04001697 uint8_t tbl_index;
Amir Levy9659e592016-10-27 18:08:27 +03001698 uint32_t ipv4_rules_offset;
1699 uint32_t expn_rules_offset;
1700
1701 uint32_t index_offset;
1702 uint32_t index_expn_offset;
1703
1704 uint16_t table_entries;
1705 uint16_t expn_table_entries;
1706 uint32_t ip_addr;
Perry Randise43d92c92019-09-16 10:27:40 -04001707
1708 uint8_t mem_type;
1709 uint8_t focus_change;
Amir Levy9659e592016-10-27 18:08:27 +03001710};
1711
1712/**
Amir Levy479cfdd2017-10-26 12:23:14 +03001713 * struct ipa_ioc_ipv6ct_init - IPv6CT table initialization parameters
1714 * @base_table_offset: input parameter, IPv6CT base table address offset
1715 * @expn_table_offset: input parameter, IPv6CT expansion table address offset
1716 * @table_entries: input parameter, IPv6CT table number of entries
1717 * @expn_table_entries: input parameter, IPv6CT expansion table number of
1718 * entries
1719 * @tbl_index: input parameter, index of the table
1720 */
1721struct ipa_ioc_ipv6ct_init {
1722 uint32_t base_table_offset;
1723 uint32_t expn_table_offset;
1724 uint16_t table_entries;
1725 uint16_t expn_table_entries;
1726 uint8_t tbl_index;
1727};
1728
1729/**
Amir Levy9659e592016-10-27 18:08:27 +03001730 * struct ipa_ioc_v4_nat_del - nat table delete parameter
1731 * @table_index: input parameter, index of the table
1732 * @public_ip_addr: input parameter, public ip address
1733 */
1734struct ipa_ioc_v4_nat_del {
1735 uint8_t table_index;
1736 uint32_t public_ip_addr;
1737};
1738
1739/**
Amir Levy479cfdd2017-10-26 12:23:14 +03001740 * struct ipa_ioc_nat_ipv6ct_table_del - NAT/IPv6CT table delete parameter
1741 * @table_index: input parameter, index of the table
Perry Randise43d92c92019-09-16 10:27:40 -04001742 * @mem_type: input parameter, type of memory the table resides in
Amir Levy479cfdd2017-10-26 12:23:14 +03001743 */
1744struct ipa_ioc_nat_ipv6ct_table_del {
1745 uint8_t table_index;
Perry Randise43d92c92019-09-16 10:27:40 -04001746 uint8_t mem_type;
Amir Levy479cfdd2017-10-26 12:23:14 +03001747};
1748
1749/**
1750 * struct ipa_ioc_nat_dma_one - nat/ipv6ct dma command parameter
Amir Levy9659e592016-10-27 18:08:27 +03001751 * @table_index: input parameter, index of the table
1752 * @base_addr: type of table, from which the base address of the table
1753 * can be inferred
1754 * @offset: destination offset within the NAT table
1755 * @data: data to be written.
1756 */
1757struct ipa_ioc_nat_dma_one {
1758 uint8_t table_index;
1759 uint8_t base_addr;
1760
1761 uint32_t offset;
1762 uint16_t data;
1763
1764};
1765
1766/**
Amir Levy479cfdd2017-10-26 12:23:14 +03001767 * struct ipa_ioc_nat_dma_cmd - To hold multiple nat/ipv6ct dma commands
Amir Levy9659e592016-10-27 18:08:27 +03001768 * @entries: number of dma commands in use
1769 * @dma: data pointer to the dma commands
Perry Randise43d92c92019-09-16 10:27:40 -04001770 * @mem_type: input parameter, type of memory the table resides in
Amir Levy9659e592016-10-27 18:08:27 +03001771 */
1772struct ipa_ioc_nat_dma_cmd {
1773 uint8_t entries;
Perry Randise43d92c92019-09-16 10:27:40 -04001774 uint8_t mem_type;
Amir Levy9659e592016-10-27 18:08:27 +03001775 struct ipa_ioc_nat_dma_one dma[0];
Amir Levy9659e592016-10-27 18:08:27 +03001776};
1777
1778/**
Amir Levy479cfdd2017-10-26 12:23:14 +03001779 * struct ipa_ioc_nat_pdn_entry - PDN entry modification data
1780 * @pdn_index: index of the entry in the PDN config table to be changed
1781 * @public_ip: PDN's public ip
1782 * @src_metadata: PDN's source NAT metadata for metadata replacement
1783 * @dst_metadata: PDN's destination NAT metadata for metadata replacement
1784 */
Amir Levy05fccd02017-06-13 16:25:45 +03001785struct ipa_ioc_nat_pdn_entry {
1786 uint8_t pdn_index;
1787 uint32_t public_ip;
1788 uint32_t src_metadata;
1789 uint32_t dst_metadata;
1790};
1791
1792/**
Shihuan Liuc3174f52017-05-04 15:59:13 -07001793 * struct ipa_ioc_vlan_iface_info - add vlan interface
1794 * @name: interface name
1795 * @vlan_id: VLAN ID
1796 */
1797struct ipa_ioc_vlan_iface_info {
1798 char name[IPA_RESOURCE_NAME_MAX];
1799 uint8_t vlan_id;
1800};
1801
1802/**
1803 * struct ipa_ioc_l2tp_vlan_mapping_info - l2tp->vlan mapping info
1804 * @iptype: l2tp tunnel IP type
1805 * @l2tp_iface_name: l2tp interface name
1806 * @l2tp_session_id: l2tp session id
1807 * @vlan_iface_name: vlan interface name
1808 */
1809struct ipa_ioc_l2tp_vlan_mapping_info {
1810 enum ipa_ip_type iptype;
1811 char l2tp_iface_name[IPA_RESOURCE_NAME_MAX];
1812 uint8_t l2tp_session_id;
1813 char vlan_iface_name[IPA_RESOURCE_NAME_MAX];
1814};
1815
1816/**
Mohammed Javida0f23d92018-09-11 10:50:28 +05301817 * struct ipa_ioc_gsb_info - connect/disconnect
1818 * @name: interface name
1819 */
1820struct ipa_ioc_gsb_info {
1821 char name[IPA_RESOURCE_NAME_MAX];
1822};
1823
Mohammed Javidd636e0c2019-06-13 16:16:59 +05301824#define QUERY_MAX_EP_PAIRS 2
1825
1826#define IPA_USB0_EP_ID 11
1827#define IPA_USB1_EP_ID 12
1828
1829#define IPA_PCIE0_EP_ID 21
1830#define IPA_PCIE1_EP_ID 22
1831
1832enum ipa_peripheral_ep_type {
1833 IPA_DATA_EP_TYP_RESERVED = 0,
1834 IPA_DATA_EP_TYP_HSIC = 1,
1835 IPA_DATA_EP_TYP_HSUSB = 2,
1836 IPA_DATA_EP_TYP_PCIE = 3,
1837 IPA_DATA_EP_TYP_EMBEDDED = 4,
1838 IPA_DATA_EP_TYP_BAM_DMUX,
1839};
1840
Akshay Pandit709d2b72020-03-26 14:48:18 +05301841enum ipa_data_ep_prot_type {
1842 IPA_PROT_RMNET = 0,
1843 IPA_PROT_RMNET_CV2X = 1,
1844 IPA_PROT_MAX
1845};
1846
Mohammed Javidd636e0c2019-06-13 16:16:59 +05301847struct ipa_ep_pair_info {
1848 uint32_t consumer_pipe_num;
1849 uint32_t producer_pipe_num;
1850 uint32_t ep_id;
1851};
1852
1853/**
1854 * struct ipa_ioc_get_ep_info - flt/rt counter id query
1855 * @ep_type: type USB/PCIE - i/p param
1856 * @max_ep_pairs: max number of ep_pairs (constant),
1857 (QUERY_MAX_EP_PAIRS)
1858 * @num_ep_pairs: number of ep_pairs - o/p param
1859 * @ep_pair_size: sizeof(ipa_ep_pair_info) * max_ep_pairs
1860 * @info: structure contains ep pair info
Akshay Pandit709d2b72020-03-26 14:48:18 +05301861 * @teth_prot : RMNET/CV2X --i/p param
1862 * @teth_prot_valid - validity of i/p param protocol
Mohammed Javidd636e0c2019-06-13 16:16:59 +05301863 */
1864struct ipa_ioc_get_ep_info {
1865 enum ipa_peripheral_ep_type ep_type;
1866 uint8_t max_ep_pairs;
1867 uint8_t num_ep_pairs;
1868 uint32_t ep_pair_size;
1869 uintptr_t info;
Akshay Pandit709d2b72020-03-26 14:48:18 +05301870 enum ipa_data_ep_prot_type teth_prot;
1871 uint8_t teth_prot_valid;
Mohammed Javidd636e0c2019-06-13 16:16:59 +05301872};
1873
Mohammed Javida0f23d92018-09-11 10:50:28 +05301874/**
Amir Levy9659e592016-10-27 18:08:27 +03001875 * struct ipa_msg_meta - Format of the message meta-data.
1876 * @msg_type: the type of the message
1877 * @rsvd: reserved bits for future use.
1878 * @msg_len: the length of the message in bytes
1879 *
1880 * For push model:
1881 * Client in user-space should issue a read on the device (/dev/ipa) with a
1882 * sufficiently large buffer in a continuous loop, call will block when there is
1883 * no message to read. Upon return, client can read the ipa_msg_meta from start
1884 * of buffer to find out type and length of message
1885 * size of buffer supplied >= (size of largest message + size of metadata)
1886 *
1887 * For pull model:
1888 * Client in user-space can also issue a pull msg IOCTL to device (/dev/ipa)
1889 * with a payload containing space for the ipa_msg_meta and the message specific
1890 * payload length.
1891 * size of buffer supplied == (len of specific message + size of metadata)
1892 */
1893struct ipa_msg_meta {
1894 uint8_t msg_type;
1895 uint8_t rsvd;
1896 uint16_t msg_len;
1897};
1898
1899/**
1900 * struct ipa_wlan_msg - To hold information about wlan client
1901 * @name: name of the wlan interface
1902 * @mac_addr: mac address of wlan client
1903 *
1904 * wlan drivers need to pass name of wlan iface and mac address of
1905 * wlan client along with ipa_wlan_event, whenever a wlan client is
1906 * connected/disconnected/moved to power save/come out of power save
1907 */
1908struct ipa_wlan_msg {
1909 char name[IPA_RESOURCE_NAME_MAX];
1910 uint8_t mac_addr[IPA_MAC_ADDR_SIZE];
1911};
1912
1913/**
Amir Levy996f7332019-04-07 16:42:56 +03001914 * struct ipa_wigig_msg- To hold information about wigig event
1915 * @name: name of the wigig interface
1916 * @client_mac_addr: the relevant wigig client mac address
1917 * @ipa_client: TX pipe associated with the wigig client in case of connect
1918 * @to_wigig: FST switch direction wlan->wigig?
1919 */
1920struct ipa_wigig_msg {
1921 char name[IPA_RESOURCE_NAME_MAX];
1922 uint8_t client_mac_addr[IPA_MAC_ADDR_SIZE];
1923 union {
1924 enum ipa_client_type ipa_client;
1925 uint8_t to_wigig;
1926 } u;
1927};
1928#define feature_ipa_wigig_msg 1
1929
1930/**
Amir Levy9659e592016-10-27 18:08:27 +03001931 * enum ipa_wlan_hdr_attrib_type - attribute type
1932 * in wlan client header
1933 *
1934 * WLAN_HDR_ATTRIB_MAC_ADDR: attrib type mac address
1935 * WLAN_HDR_ATTRIB_STA_ID: attrib type station id
1936 */
1937enum ipa_wlan_hdr_attrib_type {
1938 WLAN_HDR_ATTRIB_MAC_ADDR,
1939 WLAN_HDR_ATTRIB_STA_ID
1940};
1941
1942/**
1943 * struct ipa_wlan_hdr_attrib_val - header attribute value
1944 * @attrib_type: type of attribute
1945 * @offset: offset of attribute within header
1946 * @u.mac_addr: mac address
1947 * @u.sta_id: station id
1948 */
1949struct ipa_wlan_hdr_attrib_val {
1950 enum ipa_wlan_hdr_attrib_type attrib_type;
1951 uint8_t offset;
1952 union {
1953 uint8_t mac_addr[IPA_MAC_ADDR_SIZE];
1954 uint8_t sta_id;
1955 } u;
1956};
1957
1958/**
1959 * struct ipa_wlan_msg_ex - To hold information about wlan client
1960 * @name: name of the wlan interface
1961 * @num_of_attribs: number of attributes
1962 * @attrib_val: holds attribute values
1963 *
1964 * wlan drivers need to pass name of wlan iface and mac address
1965 * of wlan client or station id along with ipa_wlan_event,
1966 * whenever a wlan client is connected/disconnected/moved to
1967 * power save/come out of power save
1968 */
1969struct ipa_wlan_msg_ex {
1970 char name[IPA_RESOURCE_NAME_MAX];
1971 uint8_t num_of_attribs;
1972 struct ipa_wlan_hdr_attrib_val attribs[0];
1973};
1974
1975struct ipa_ecm_msg {
1976 char name[IPA_RESOURCE_NAME_MAX];
1977 int ifindex;
1978};
1979
1980/**
1981 * struct ipa_wan_msg - To hold information about wan client
1982 * @name: name of the wan interface
1983 *
1984 * CnE need to pass the name of default wan iface when connected/disconnected.
1985 * CNE need to pass the gw info in wlan AP+STA mode.
1986 * netmgr need to pass the name of wan eMBMS iface when connected.
1987 */
1988struct ipa_wan_msg {
1989 char upstream_ifname[IPA_RESOURCE_NAME_MAX];
1990 char tethered_ifname[IPA_RESOURCE_NAME_MAX];
1991 enum ipa_ip_type ip;
1992 uint32_t ipv4_addr_gw;
1993 uint32_t ipv6_addr_gw[IPA_WAN_MSG_IPv6_ADDR_GW_LEN];
1994};
1995
1996/**
1997 * struct ipa_ioc_rm_dependency - parameters for add/delete dependency
1998 * @resource_name: name of dependent resource
1999 * @depends_on_name: name of its dependency
2000 */
2001struct ipa_ioc_rm_dependency {
2002 enum ipa_rm_resource_name resource_name;
2003 enum ipa_rm_resource_name depends_on_name;
2004};
2005
2006struct ipa_ioc_generate_flt_eq {
2007 enum ipa_ip_type ip;
2008 struct ipa_rule_attrib attrib;
2009 struct ipa_ipfltri_rule_eq eq_attrib;
2010};
2011
2012/**
2013 * struct ipa_ioc_write_qmapid - to write mux id to endpoint meta register
2014 * @mux_id: mux id of wan
2015 */
2016struct ipa_ioc_write_qmapid {
2017 enum ipa_client_type client;
2018 uint8_t qmap_id;
2019};
2020
2021enum ipacm_client_enum {
2022 IPACM_CLIENT_USB = 1,
2023 IPACM_CLIENT_WLAN,
2024 IPACM_CLIENT_MAX
2025};
Mohammed Javidd0c2a1e2017-10-30 15:34:22 +05302026
Mohammed Javid363a9972018-08-31 16:23:17 +05302027#define IPACM_SUPPORT_OF_LAN_STATS_FOR_ODU_CLIENTS
2028
Mohammed Javidd0c2a1e2017-10-30 15:34:22 +05302029enum ipacm_per_client_device_type {
2030 IPACM_CLIENT_DEVICE_TYPE_USB = 0,
2031 IPACM_CLIENT_DEVICE_TYPE_WLAN = 1,
Mohammed Javid363a9972018-08-31 16:23:17 +05302032 IPACM_CLIENT_DEVICE_TYPE_ETH = 2,
2033 IPACM_CLIENT_DEVICE_TYPE_ODU = 3,
2034 IPACM_CLIENT_DEVICE_MAX
Mohammed Javidd0c2a1e2017-10-30 15:34:22 +05302035};
2036
2037/**
2038 * max number of device types supported.
2039 */
Mohammed Javid363a9972018-08-31 16:23:17 +05302040#define IPACM_MAX_CLIENT_DEVICE_TYPES IPACM_CLIENT_DEVICE_MAX
Mohammed Javidd0c2a1e2017-10-30 15:34:22 +05302041
2042/**
2043 * @lanIface - Name of the lan interface
2044 * @mac: Mac address of the client.
2045 */
2046struct ipa_lan_client_msg {
2047 char lanIface[IPA_RESOURCE_NAME_MAX];
2048 uint8_t mac[IPA_MAC_ADDR_SIZE];
2049};
2050
2051/**
2052 * struct ipa_lan_client - lan client data
2053 * @mac: MAC Address of the client.
2054 * @client_idx: Client Index.
2055 * @inited: Bool to indicate whether client info is set.
2056 */
2057struct ipa_lan_client {
2058 uint8_t mac[IPA_MAC_ADDR_SIZE];
2059 int8_t client_idx;
2060 uint8_t inited;
2061};
2062
2063/**
2064 * struct ipa_tether_device_info - tether device info indicated from IPACM
2065 * @ul_src_pipe: Source pipe of the lan client.
2066 * @hdr_len: Header length of the client.
2067 * @num_clients: Number of clients connected.
2068 */
2069struct ipa_tether_device_info {
2070 int32_t ul_src_pipe;
2071 uint8_t hdr_len;
2072 uint32_t num_clients;
2073 struct ipa_lan_client lan_client[IPA_MAX_NUM_HW_PATH_CLIENTS];
2074};
2075
Amir Levy9659e592016-10-27 18:08:27 +03002076/**
Amir Levya5361ab2018-05-01 13:25:37 +03002077 * enum ipa_vlan_ifaces - vlan interfaces types
2078 */
2079enum ipa_vlan_ifaces {
2080 IPA_VLAN_IF_ETH,
2081 IPA_VLAN_IF_RNDIS,
2082 IPA_VLAN_IF_ECM
2083};
2084
2085#define IPA_VLAN_IF_EMAC IPA_VLAN_IF_ETH
2086#define IPA_VLAN_IF_MAX (IPA_VLAN_IF_ECM + 1)
2087
2088/**
2089 * struct ipa_get_vlan_mode - get vlan mode of a Lan interface
2090 * @iface: Lan interface type to be queried.
2091 * @is_vlan_mode: output parameter, is interface in vlan mode, valid only when
2092 * ioctl return val is non-negative
2093 */
2094struct ipa_ioc_get_vlan_mode {
2095 enum ipa_vlan_ifaces iface;
2096 uint32_t is_vlan_mode;
2097};
2098
2099/**
Amir Levy4f8b4832018-06-05 15:48:03 +03002100 * struct ipa_ioc_bridge_vlan_mapping_info - vlan to bridge mapping info
2101 * @bridge_name: bridge interface name
2102 * @vlan_id: vlan ID bridge is mapped to
2103 * @bridge_ipv4: bridge interface ipv4 address
2104 * @subnet_mask: bridge interface subnet mask
2105 */
2106struct ipa_ioc_bridge_vlan_mapping_info {
2107 char bridge_name[IPA_RESOURCE_NAME_MAX];
2108 uint16_t vlan_id;
2109 uint32_t bridge_ipv4;
2110 uint32_t subnet_mask;
2111};
2112
2113/**
Amir Levy9659e592016-10-27 18:08:27 +03002114 * actual IOCTLs supported by IPA driver
2115 */
2116#define IPA_IOC_ADD_HDR _IOWR(IPA_IOC_MAGIC, \
2117 IPA_IOCTL_ADD_HDR, \
2118 struct ipa_ioc_add_hdr *)
2119#define IPA_IOC_DEL_HDR _IOWR(IPA_IOC_MAGIC, \
2120 IPA_IOCTL_DEL_HDR, \
2121 struct ipa_ioc_del_hdr *)
2122#define IPA_IOC_ADD_RT_RULE _IOWR(IPA_IOC_MAGIC, \
2123 IPA_IOCTL_ADD_RT_RULE, \
2124 struct ipa_ioc_add_rt_rule *)
Mohammed Javidd0c2a1e2017-10-30 15:34:22 +05302125#define IPA_IOC_ADD_RT_RULE_EXT _IOWR(IPA_IOC_MAGIC, \
2126 IPA_IOCTL_ADD_RT_RULE_EXT, \
2127 struct ipa_ioc_add_rt_rule_ext *)
Amir Levy9659e592016-10-27 18:08:27 +03002128#define IPA_IOC_ADD_RT_RULE_AFTER _IOWR(IPA_IOC_MAGIC, \
2129 IPA_IOCTL_ADD_RT_RULE_AFTER, \
2130 struct ipa_ioc_add_rt_rule_after *)
2131#define IPA_IOC_DEL_RT_RULE _IOWR(IPA_IOC_MAGIC, \
2132 IPA_IOCTL_DEL_RT_RULE, \
2133 struct ipa_ioc_del_rt_rule *)
2134#define IPA_IOC_ADD_FLT_RULE _IOWR(IPA_IOC_MAGIC, \
2135 IPA_IOCTL_ADD_FLT_RULE, \
2136 struct ipa_ioc_add_flt_rule *)
2137#define IPA_IOC_ADD_FLT_RULE_AFTER _IOWR(IPA_IOC_MAGIC, \
2138 IPA_IOCTL_ADD_FLT_RULE_AFTER, \
2139 struct ipa_ioc_add_flt_rule_after *)
2140#define IPA_IOC_DEL_FLT_RULE _IOWR(IPA_IOC_MAGIC, \
2141 IPA_IOCTL_DEL_FLT_RULE, \
2142 struct ipa_ioc_del_flt_rule *)
2143#define IPA_IOC_COMMIT_HDR _IO(IPA_IOC_MAGIC,\
2144 IPA_IOCTL_COMMIT_HDR)
2145#define IPA_IOC_RESET_HDR _IO(IPA_IOC_MAGIC,\
2146 IPA_IOCTL_RESET_HDR)
2147#define IPA_IOC_COMMIT_RT _IOW(IPA_IOC_MAGIC, \
2148 IPA_IOCTL_COMMIT_RT, \
2149 enum ipa_ip_type)
2150#define IPA_IOC_RESET_RT _IOW(IPA_IOC_MAGIC, \
2151 IPA_IOCTL_RESET_RT, \
2152 enum ipa_ip_type)
2153#define IPA_IOC_COMMIT_FLT _IOW(IPA_IOC_MAGIC, \
2154 IPA_IOCTL_COMMIT_FLT, \
2155 enum ipa_ip_type)
2156#define IPA_IOC_RESET_FLT _IOW(IPA_IOC_MAGIC, \
2157 IPA_IOCTL_RESET_FLT, \
2158 enum ipa_ip_type)
2159#define IPA_IOC_DUMP _IO(IPA_IOC_MAGIC, \
2160 IPA_IOCTL_DUMP)
2161#define IPA_IOC_GET_RT_TBL _IOWR(IPA_IOC_MAGIC, \
2162 IPA_IOCTL_GET_RT_TBL, \
2163 struct ipa_ioc_get_rt_tbl *)
2164#define IPA_IOC_PUT_RT_TBL _IOW(IPA_IOC_MAGIC, \
2165 IPA_IOCTL_PUT_RT_TBL, \
2166 uint32_t)
2167#define IPA_IOC_COPY_HDR _IOWR(IPA_IOC_MAGIC, \
2168 IPA_IOCTL_COPY_HDR, \
2169 struct ipa_ioc_copy_hdr *)
2170#define IPA_IOC_QUERY_INTF _IOWR(IPA_IOC_MAGIC, \
2171 IPA_IOCTL_QUERY_INTF, \
2172 struct ipa_ioc_query_intf *)
2173#define IPA_IOC_QUERY_INTF_TX_PROPS _IOWR(IPA_IOC_MAGIC, \
2174 IPA_IOCTL_QUERY_INTF_TX_PROPS, \
2175 struct ipa_ioc_query_intf_tx_props *)
2176#define IPA_IOC_QUERY_INTF_RX_PROPS _IOWR(IPA_IOC_MAGIC, \
2177 IPA_IOCTL_QUERY_INTF_RX_PROPS, \
2178 struct ipa_ioc_query_intf_rx_props *)
2179#define IPA_IOC_QUERY_INTF_EXT_PROPS _IOWR(IPA_IOC_MAGIC, \
2180 IPA_IOCTL_QUERY_INTF_EXT_PROPS, \
2181 struct ipa_ioc_query_intf_ext_props *)
2182#define IPA_IOC_GET_HDR _IOWR(IPA_IOC_MAGIC, \
2183 IPA_IOCTL_GET_HDR, \
2184 struct ipa_ioc_get_hdr *)
2185#define IPA_IOC_PUT_HDR _IOW(IPA_IOC_MAGIC, \
2186 IPA_IOCTL_PUT_HDR, \
2187 uint32_t)
2188#define IPA_IOC_ALLOC_NAT_MEM _IOWR(IPA_IOC_MAGIC, \
2189 IPA_IOCTL_ALLOC_NAT_MEM, \
2190 struct ipa_ioc_nat_alloc_mem *)
Amir Levy479cfdd2017-10-26 12:23:14 +03002191#define IPA_IOC_ALLOC_NAT_TABLE _IOWR(IPA_IOC_MAGIC, \
2192 IPA_IOCTL_ALLOC_NAT_TABLE, \
2193 struct ipa_ioc_nat_ipv6ct_table_alloc *)
2194#define IPA_IOC_ALLOC_IPV6CT_TABLE _IOWR(IPA_IOC_MAGIC, \
2195 IPA_IOCTL_ALLOC_IPV6CT_TABLE, \
2196 struct ipa_ioc_nat_ipv6ct_table_alloc *)
Amir Levy9659e592016-10-27 18:08:27 +03002197#define IPA_IOC_V4_INIT_NAT _IOWR(IPA_IOC_MAGIC, \
2198 IPA_IOCTL_V4_INIT_NAT, \
2199 struct ipa_ioc_v4_nat_init *)
Amir Levy479cfdd2017-10-26 12:23:14 +03002200#define IPA_IOC_INIT_IPV6CT_TABLE _IOWR(IPA_IOC_MAGIC, \
2201 IPA_IOCTL_INIT_IPV6CT_TABLE, \
2202 struct ipa_ioc_ipv6ct_init *)
Amir Levy9659e592016-10-27 18:08:27 +03002203#define IPA_IOC_NAT_DMA _IOWR(IPA_IOC_MAGIC, \
2204 IPA_IOCTL_NAT_DMA, \
2205 struct ipa_ioc_nat_dma_cmd *)
Amir Levy479cfdd2017-10-26 12:23:14 +03002206#define IPA_IOC_TABLE_DMA_CMD _IOWR(IPA_IOC_MAGIC, \
2207 IPA_IOCTL_TABLE_DMA_CMD, \
2208 struct ipa_ioc_nat_dma_cmd *)
Amir Levy9659e592016-10-27 18:08:27 +03002209#define IPA_IOC_V4_DEL_NAT _IOWR(IPA_IOC_MAGIC, \
2210 IPA_IOCTL_V4_DEL_NAT, \
2211 struct ipa_ioc_v4_nat_del *)
Amir Levy479cfdd2017-10-26 12:23:14 +03002212#define IPA_IOC_DEL_NAT_TABLE _IOWR(IPA_IOC_MAGIC, \
2213 IPA_IOCTL_DEL_NAT_TABLE, \
2214 struct ipa_ioc_nat_ipv6ct_table_del *)
2215#define IPA_IOC_DEL_IPV6CT_TABLE _IOWR(IPA_IOC_MAGIC, \
2216 IPA_IOCTL_DEL_IPV6CT_TABLE, \
2217 struct ipa_ioc_nat_ipv6ct_table_del *)
Amir Levy9659e592016-10-27 18:08:27 +03002218#define IPA_IOC_GET_NAT_OFFSET _IOWR(IPA_IOC_MAGIC, \
2219 IPA_IOCTL_GET_NAT_OFFSET, \
2220 uint32_t *)
Amir Levy05fccd02017-06-13 16:25:45 +03002221#define IPA_IOC_NAT_MODIFY_PDN _IOWR(IPA_IOC_MAGIC, \
2222 IPA_IOCTL_NAT_MODIFY_PDN, \
2223 struct ipa_ioc_nat_pdn_entry *)
Amir Levy9659e592016-10-27 18:08:27 +03002224#define IPA_IOC_SET_FLT _IOW(IPA_IOC_MAGIC, \
2225 IPA_IOCTL_SET_FLT, \
2226 uint32_t)
2227#define IPA_IOC_PULL_MSG _IOWR(IPA_IOC_MAGIC, \
2228 IPA_IOCTL_PULL_MSG, \
2229 struct ipa_msg_meta *)
2230#define IPA_IOC_RM_ADD_DEPENDENCY _IOWR(IPA_IOC_MAGIC, \
2231 IPA_IOCTL_RM_ADD_DEPENDENCY, \
2232 struct ipa_ioc_rm_dependency *)
2233#define IPA_IOC_RM_DEL_DEPENDENCY _IOWR(IPA_IOC_MAGIC, \
2234 IPA_IOCTL_RM_DEL_DEPENDENCY, \
2235 struct ipa_ioc_rm_dependency *)
2236#define IPA_IOC_GENERATE_FLT_EQ _IOWR(IPA_IOC_MAGIC, \
2237 IPA_IOCTL_GENERATE_FLT_EQ, \
2238 struct ipa_ioc_generate_flt_eq *)
2239#define IPA_IOC_QUERY_EP_MAPPING _IOR(IPA_IOC_MAGIC, \
2240 IPA_IOCTL_QUERY_EP_MAPPING, \
2241 uint32_t)
2242#define IPA_IOC_QUERY_RT_TBL_INDEX _IOWR(IPA_IOC_MAGIC, \
2243 IPA_IOCTL_QUERY_RT_TBL_INDEX, \
2244 struct ipa_ioc_get_rt_tbl_indx *)
2245#define IPA_IOC_WRITE_QMAPID _IOWR(IPA_IOC_MAGIC, \
2246 IPA_IOCTL_WRITE_QMAPID, \
2247 struct ipa_ioc_write_qmapid *)
2248#define IPA_IOC_MDFY_FLT_RULE _IOWR(IPA_IOC_MAGIC, \
2249 IPA_IOCTL_MDFY_FLT_RULE, \
2250 struct ipa_ioc_mdfy_flt_rule *)
2251#define IPA_IOC_MDFY_RT_RULE _IOWR(IPA_IOC_MAGIC, \
2252 IPA_IOCTL_MDFY_RT_RULE, \
2253 struct ipa_ioc_mdfy_rt_rule *)
2254
2255#define IPA_IOC_NOTIFY_WAN_UPSTREAM_ROUTE_ADD _IOWR(IPA_IOC_MAGIC, \
2256 IPA_IOCTL_NOTIFY_WAN_UPSTREAM_ROUTE_ADD, \
2257 struct ipa_wan_msg *)
2258
2259#define IPA_IOC_NOTIFY_WAN_UPSTREAM_ROUTE_DEL _IOWR(IPA_IOC_MAGIC, \
2260 IPA_IOCTL_NOTIFY_WAN_UPSTREAM_ROUTE_DEL, \
2261 struct ipa_wan_msg *)
2262#define IPA_IOC_NOTIFY_WAN_EMBMS_CONNECTED _IOWR(IPA_IOC_MAGIC, \
2263 IPA_IOCTL_NOTIFY_WAN_EMBMS_CONNECTED, \
2264 struct ipa_wan_msg *)
2265#define IPA_IOC_ADD_HDR_PROC_CTX _IOWR(IPA_IOC_MAGIC, \
2266 IPA_IOCTL_ADD_HDR_PROC_CTX, \
2267 struct ipa_ioc_add_hdr_proc_ctx *)
2268#define IPA_IOC_DEL_HDR_PROC_CTX _IOWR(IPA_IOC_MAGIC, \
2269 IPA_IOCTL_DEL_HDR_PROC_CTX, \
2270 struct ipa_ioc_del_hdr_proc_ctx *)
2271
2272#define IPA_IOC_GET_HW_VERSION _IOWR(IPA_IOC_MAGIC, \
2273 IPA_IOCTL_GET_HW_VERSION, \
2274 enum ipa_hw_type *)
2275
Shihuan Liuc3174f52017-05-04 15:59:13 -07002276#define IPA_IOC_ADD_VLAN_IFACE _IOWR(IPA_IOC_MAGIC, \
2277 IPA_IOCTL_ADD_VLAN_IFACE, \
2278 struct ipa_ioc_vlan_iface_info *)
2279
2280#define IPA_IOC_DEL_VLAN_IFACE _IOWR(IPA_IOC_MAGIC, \
2281 IPA_IOCTL_DEL_VLAN_IFACE, \
2282 struct ipa_ioc_vlan_iface_info *)
2283
2284#define IPA_IOC_ADD_L2TP_VLAN_MAPPING _IOWR(IPA_IOC_MAGIC, \
2285 IPA_IOCTL_ADD_L2TP_VLAN_MAPPING, \
2286 struct ipa_ioc_l2tp_vlan_mapping_info *)
2287
2288#define IPA_IOC_DEL_L2TP_VLAN_MAPPING _IOWR(IPA_IOC_MAGIC, \
2289 IPA_IOCTL_DEL_L2TP_VLAN_MAPPING, \
2290 struct ipa_ioc_l2tp_vlan_mapping_info *)
Skylar Chang68c37d82018-04-07 16:42:36 -07002291#define IPA_IOC_CLEANUP _IO(IPA_IOC_MAGIC,\
2292 IPA_IOCTL_CLEANUP)
2293#define IPA_IOC_QUERY_WLAN_CLIENT _IO(IPA_IOC_MAGIC,\
2294 IPA_IOCTL_QUERY_WLAN_CLIENT)
Amir Levya5361ab2018-05-01 13:25:37 +03002295#define IPA_IOC_GET_VLAN_MODE _IOWR(IPA_IOC_MAGIC, \
2296 IPA_IOCTL_GET_VLAN_MODE, \
2297 struct ipa_ioc_get_vlan_mode *)
Amir Levy4f8b4832018-06-05 15:48:03 +03002298
2299#define IPA_IOC_ADD_BRIDGE_VLAN_MAPPING _IOWR(IPA_IOC_MAGIC, \
2300 IPA_IOCTL_ADD_BRIDGE_VLAN_MAPPING, \
2301 struct ipa_ioc_bridge_vlan_mapping_info)
2302
2303#define IPA_IOC_DEL_BRIDGE_VLAN_MAPPING _IOWR(IPA_IOC_MAGIC, \
2304 IPA_IOCTL_DEL_BRIDGE_VLAN_MAPPING, \
2305 struct ipa_ioc_bridge_vlan_mapping_info)
2306
Mohammed Javida0f23d92018-09-11 10:50:28 +05302307#define IPA_IOC_GSB_CONNECT _IOWR(IPA_IOC_MAGIC, \
2308 IPA_IOCTL_GSB_CONNECT, \
2309 struct ipa_ioc_gsb_info)
2310
2311#define IPA_IOC_GSB_DISCONNECT _IOWR(IPA_IOC_MAGIC, \
2312 IPA_IOCTL_GSB_DISCONNECT, \
2313 struct ipa_ioc_gsb_info)
2314
Mohammed Javidd636e0c2019-06-13 16:16:59 +05302315#define IPA_IOC_GET_PHERIPHERAL_EP_INFO _IOWR(IPA_IOC_MAGIC, \
2316 IPA_IOCTL_GET_PHERIPHERAL_EP_INFO, \
2317 struct ipa_ioc_get_ep_info)
2318
Perry Randise43d92c92019-09-16 10:27:40 -04002319#define IPA_IOC_GET_NAT_IN_SRAM_INFO _IOWR(IPA_IOC_MAGIC, \
2320 IPA_IOCTL_GET_NAT_IN_SRAM_INFO, \
2321 struct ipa_nat_in_sram_info)
2322
Perry Randise63610042019-12-24 14:17:59 -05002323#define IPA_IOC_APP_CLOCK_VOTE _IOWR(IPA_IOC_MAGIC, \
2324 IPA_IOCTL_APP_CLOCK_VOTE, \
2325 uint32_t)
2326
Amir Levy9659e592016-10-27 18:08:27 +03002327/*
2328 * unique magic number of the Tethering bridge ioctls
2329 */
2330#define TETH_BRIDGE_IOC_MAGIC 0xCE
2331
2332/*
2333 * Ioctls supported by Tethering bridge driver
2334 */
2335#define TETH_BRIDGE_IOCTL_SET_BRIDGE_MODE 0
2336#define TETH_BRIDGE_IOCTL_SET_AGGR_PARAMS 1
2337#define TETH_BRIDGE_IOCTL_GET_AGGR_PARAMS 2
2338#define TETH_BRIDGE_IOCTL_GET_AGGR_CAPABILITIES 3
2339#define TETH_BRIDGE_IOCTL_MAX 4
2340
2341
2342/**
2343 * enum teth_link_protocol_type - link protocol (IP / Ethernet)
2344 */
2345enum teth_link_protocol_type {
2346 TETH_LINK_PROTOCOL_IP,
2347 TETH_LINK_PROTOCOL_ETHERNET,
2348 TETH_LINK_PROTOCOL_MAX,
2349};
2350
2351/**
2352 * enum teth_aggr_protocol_type - Aggregation protocol (MBIM / TLP)
2353 */
2354enum teth_aggr_protocol_type {
2355 TETH_AGGR_PROTOCOL_NONE,
2356 TETH_AGGR_PROTOCOL_MBIM,
2357 TETH_AGGR_PROTOCOL_TLP,
2358 TETH_AGGR_PROTOCOL_MAX,
2359};
2360
2361/**
2362 * struct teth_aggr_params_link - Aggregation parameters for uplink/downlink
2363 * @aggr_prot: Aggregation protocol (MBIM / TLP)
2364 * @max_transfer_size_byte: Maximal size of aggregated packet in bytes.
2365 * Default value is 16*1024.
2366 * @max_datagrams: Maximal number of IP packets in an aggregated
2367 * packet. Default value is 16
2368 */
2369struct teth_aggr_params_link {
2370 enum teth_aggr_protocol_type aggr_prot;
2371 uint32_t max_transfer_size_byte;
2372 uint32_t max_datagrams;
2373};
2374
2375
2376/**
2377 * struct teth_aggr_params - Aggregation parmeters
2378 * @ul: Uplink parameters
2379 * @dl: Downlink parmaeters
2380 */
2381struct teth_aggr_params {
2382 struct teth_aggr_params_link ul;
2383 struct teth_aggr_params_link dl;
2384};
2385
2386/**
2387 * struct teth_aggr_capabilities - Aggregation capabilities
2388 * @num_protocols: Number of protocols described in the array
2389 * @prot_caps[]: Array of aggregation capabilities per protocol
2390 */
2391struct teth_aggr_capabilities {
2392 uint16_t num_protocols;
2393 struct teth_aggr_params_link prot_caps[0];
2394};
2395
2396/**
2397 * struct teth_ioc_set_bridge_mode
2398 * @link_protocol: link protocol (IP / Ethernet)
2399 * @lcid: logical channel number
2400 */
2401struct teth_ioc_set_bridge_mode {
2402 enum teth_link_protocol_type link_protocol;
2403 uint16_t lcid;
2404};
2405
2406/**
2407 * struct teth_ioc_set_aggr_params
2408 * @aggr_params: Aggregation parmeters
2409 * @lcid: logical channel number
2410 */
2411struct teth_ioc_aggr_params {
2412 struct teth_aggr_params aggr_params;
2413 uint16_t lcid;
2414};
2415
Perry Randise43d92c92019-09-16 10:27:40 -04002416/**
2417 * struct ipa_nat_in_sram_info - query for nat in sram particulars
2418 * @sram_mem_available_for_nat: Amount SRAM available to fit nat table
2419 * @nat_table_offset_into_mmap: Offset into mmap'd vm where table will be
2420 * @best_nat_in_sram_size_rqst: The size to request for mmap
2421 *
2422 * The last two elements above are required to deal with situations
2423 * where the SRAM's physical address and size don't play nice with
2424 * mmap'ings page size and boundary attributes.
2425 */
2426struct ipa_nat_in_sram_info {
2427 uint32_t sram_mem_available_for_nat;
2428 uint32_t nat_table_offset_into_mmap;
2429 uint32_t best_nat_in_sram_size_rqst;
2430};
Amir Levy9659e592016-10-27 18:08:27 +03002431
Perry Randise63610042019-12-24 14:17:59 -05002432/**
2433 * enum ipa_app_clock_vote_type
2434 *
2435 * The types of votes that can be accepted by the
2436 * IPA_IOC_APP_CLOCK_VOTE ioctl
2437 */
2438enum ipa_app_clock_vote_type {
2439 IPA_APP_CLK_DEVOTE = 0,
2440 IPA_APP_CLK_VOTE = 1,
2441 IPA_APP_CLK_RESET_VOTE = 2,
2442};
2443
Amir Levy9659e592016-10-27 18:08:27 +03002444#define TETH_BRIDGE_IOC_SET_BRIDGE_MODE _IOW(TETH_BRIDGE_IOC_MAGIC, \
2445 TETH_BRIDGE_IOCTL_SET_BRIDGE_MODE, \
2446 struct teth_ioc_set_bridge_mode *)
2447#define TETH_BRIDGE_IOC_SET_AGGR_PARAMS _IOW(TETH_BRIDGE_IOC_MAGIC, \
2448 TETH_BRIDGE_IOCTL_SET_AGGR_PARAMS, \
2449 struct teth_ioc_aggr_params *)
2450#define TETH_BRIDGE_IOC_GET_AGGR_PARAMS _IOR(TETH_BRIDGE_IOC_MAGIC, \
2451 TETH_BRIDGE_IOCTL_GET_AGGR_PARAMS, \
2452 struct teth_ioc_aggr_params *)
2453#define TETH_BRIDGE_IOC_GET_AGGR_CAPABILITIES _IOWR(TETH_BRIDGE_IOC_MAGIC, \
2454 TETH_BRIDGE_IOCTL_GET_AGGR_CAPABILITIES, \
2455 struct teth_aggr_capabilities *)
2456
2457/*
2458 * unique magic number of the ODU bridge ioctls
2459 */
2460#define ODU_BRIDGE_IOC_MAGIC 0xCD
2461
2462/*
2463 * Ioctls supported by ODU bridge driver
2464 */
2465#define ODU_BRIDGE_IOCTL_SET_MODE 0
2466#define ODU_BRIDGE_IOCTL_SET_LLV6_ADDR 1
2467#define ODU_BRIDGE_IOCTL_MAX 2
2468
2469/**
2470 * enum odu_bridge_mode - bridge mode
2471 * (ROUTER MODE / BRIDGE MODE)
2472 */
2473enum odu_bridge_mode {
2474 ODU_BRIDGE_MODE_ROUTER,
2475 ODU_BRIDGE_MODE_BRIDGE,
2476 ODU_BRIDGE_MODE_MAX,
2477};
2478
2479#define ODU_BRIDGE_IOC_SET_MODE _IOW(ODU_BRIDGE_IOC_MAGIC, \
2480 ODU_BRIDGE_IOCTL_SET_MODE, \
2481 enum odu_bridge_mode)
2482
2483#define ODU_BRIDGE_IOC_SET_LLV6_ADDR _IOW(ODU_BRIDGE_IOC_MAGIC, \
2484 ODU_BRIDGE_IOCTL_SET_LLV6_ADDR, \
2485 struct in6_addr *)
2486
2487#endif /* _UAPI_MSM_IPA_H_ */