Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 1 | #ifndef _UAPI_MSM_IPA_H_ |
| 2 | #define _UAPI_MSM_IPA_H_ |
| 3 | |
| 4 | #ifndef __KERNEL__ |
| 5 | #include <stdint.h> |
| 6 | #include <stddef.h> |
| 7 | #include <sys/stat.h> |
| 8 | #endif |
| 9 | #include <linux/ioctl.h> |
| 10 | #include <linux/types.h> |
| 11 | #include <linux/if_ether.h> |
| 12 | |
| 13 | /** |
| 14 | * unique magic number of the IPA device |
| 15 | */ |
| 16 | #define IPA_IOC_MAGIC 0xCF |
| 17 | |
| 18 | /** |
| 19 | * name of the default routing tables for v4 and v6 |
| 20 | */ |
| 21 | #define IPA_DFLT_RT_TBL_NAME "ipa_dflt_rt" |
| 22 | |
| 23 | /** |
| 24 | * the commands supported by IPA driver |
| 25 | */ |
| 26 | #define IPA_IOCTL_ADD_HDR 0 |
| 27 | #define IPA_IOCTL_DEL_HDR 1 |
| 28 | #define IPA_IOCTL_ADD_RT_RULE 2 |
| 29 | #define IPA_IOCTL_DEL_RT_RULE 3 |
| 30 | #define IPA_IOCTL_ADD_FLT_RULE 4 |
| 31 | #define IPA_IOCTL_DEL_FLT_RULE 5 |
| 32 | #define IPA_IOCTL_COMMIT_HDR 6 |
| 33 | #define IPA_IOCTL_RESET_HDR 7 |
| 34 | #define IPA_IOCTL_COMMIT_RT 8 |
| 35 | #define IPA_IOCTL_RESET_RT 9 |
| 36 | #define IPA_IOCTL_COMMIT_FLT 10 |
| 37 | #define IPA_IOCTL_RESET_FLT 11 |
| 38 | #define IPA_IOCTL_DUMP 12 |
| 39 | #define IPA_IOCTL_GET_RT_TBL 13 |
| 40 | #define IPA_IOCTL_PUT_RT_TBL 14 |
| 41 | #define IPA_IOCTL_COPY_HDR 15 |
| 42 | #define IPA_IOCTL_QUERY_INTF 16 |
| 43 | #define IPA_IOCTL_QUERY_INTF_TX_PROPS 17 |
| 44 | #define IPA_IOCTL_QUERY_INTF_RX_PROPS 18 |
| 45 | #define IPA_IOCTL_GET_HDR 19 |
| 46 | #define IPA_IOCTL_PUT_HDR 20 |
| 47 | #define IPA_IOCTL_SET_FLT 21 |
| 48 | #define IPA_IOCTL_ALLOC_NAT_MEM 22 |
| 49 | #define IPA_IOCTL_V4_INIT_NAT 23 |
| 50 | #define IPA_IOCTL_NAT_DMA 24 |
| 51 | #define IPA_IOCTL_V4_DEL_NAT 26 |
| 52 | #define IPA_IOCTL_PULL_MSG 27 |
| 53 | #define IPA_IOCTL_GET_NAT_OFFSET 28 |
| 54 | #define IPA_IOCTL_RM_ADD_DEPENDENCY 29 |
| 55 | #define IPA_IOCTL_RM_DEL_DEPENDENCY 30 |
| 56 | #define IPA_IOCTL_GENERATE_FLT_EQ 31 |
| 57 | #define IPA_IOCTL_QUERY_INTF_EXT_PROPS 32 |
| 58 | #define IPA_IOCTL_QUERY_EP_MAPPING 33 |
| 59 | #define IPA_IOCTL_QUERY_RT_TBL_INDEX 34 |
| 60 | #define IPA_IOCTL_WRITE_QMAPID 35 |
| 61 | #define IPA_IOCTL_MDFY_FLT_RULE 36 |
| 62 | #define IPA_IOCTL_NOTIFY_WAN_UPSTREAM_ROUTE_ADD 37 |
| 63 | #define IPA_IOCTL_NOTIFY_WAN_UPSTREAM_ROUTE_DEL 38 |
| 64 | #define IPA_IOCTL_NOTIFY_WAN_EMBMS_CONNECTED 39 |
| 65 | #define IPA_IOCTL_ADD_HDR_PROC_CTX 40 |
| 66 | #define IPA_IOCTL_DEL_HDR_PROC_CTX 41 |
| 67 | #define IPA_IOCTL_MDFY_RT_RULE 42 |
| 68 | #define IPA_IOCTL_ADD_RT_RULE_AFTER 43 |
| 69 | #define IPA_IOCTL_ADD_FLT_RULE_AFTER 44 |
| 70 | #define IPA_IOCTL_GET_HW_VERSION 45 |
Amir Levy | 05fccd0 | 2017-06-13 16:25:45 +0300 | [diff] [blame] | 71 | #define IPA_IOCTL_ADD_RT_RULE_EXT 46 |
| 72 | #define IPA_IOCTL_NAT_MODIFY_PDN 47 |
| 73 | #define IPA_IOCTL_MAX 48 |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 74 | |
| 75 | /** |
| 76 | * max size of the header to be inserted |
| 77 | */ |
| 78 | #define IPA_HDR_MAX_SIZE 64 |
| 79 | |
| 80 | /** |
| 81 | * max size of the name of the resource (routing table, header) |
| 82 | */ |
| 83 | #define IPA_RESOURCE_NAME_MAX 32 |
| 84 | |
| 85 | /** |
| 86 | * max number of interface properties |
| 87 | */ |
| 88 | #define IPA_NUM_PROPS_MAX 35 |
| 89 | |
| 90 | /** |
| 91 | * size of the mac address |
| 92 | */ |
| 93 | #define IPA_MAC_ADDR_SIZE 6 |
| 94 | |
| 95 | /** |
| 96 | * max number of mbim streams |
| 97 | */ |
| 98 | #define IPA_MBIM_MAX_STREAM_NUM 8 |
| 99 | |
| 100 | /** |
| 101 | * size of the ipv6 address |
| 102 | */ |
| 103 | #define IPA_WAN_MSG_IPv6_ADDR_GW_LEN 4 |
| 104 | |
| 105 | /** |
| 106 | * the attributes of the rule (routing or filtering) |
| 107 | */ |
| 108 | #define IPA_FLT_TOS (1ul << 0) |
| 109 | #define IPA_FLT_PROTOCOL (1ul << 1) |
| 110 | #define IPA_FLT_SRC_ADDR (1ul << 2) |
| 111 | #define IPA_FLT_DST_ADDR (1ul << 3) |
| 112 | #define IPA_FLT_SRC_PORT_RANGE (1ul << 4) |
| 113 | #define IPA_FLT_DST_PORT_RANGE (1ul << 5) |
| 114 | #define IPA_FLT_TYPE (1ul << 6) |
| 115 | #define IPA_FLT_CODE (1ul << 7) |
| 116 | #define IPA_FLT_SPI (1ul << 8) |
| 117 | #define IPA_FLT_SRC_PORT (1ul << 9) |
| 118 | #define IPA_FLT_DST_PORT (1ul << 10) |
| 119 | #define IPA_FLT_TC (1ul << 11) |
| 120 | #define IPA_FLT_FLOW_LABEL (1ul << 12) |
| 121 | #define IPA_FLT_NEXT_HDR (1ul << 13) |
| 122 | #define IPA_FLT_META_DATA (1ul << 14) |
| 123 | #define IPA_FLT_FRAGMENT (1ul << 15) |
| 124 | #define IPA_FLT_TOS_MASKED (1ul << 16) |
| 125 | #define IPA_FLT_MAC_SRC_ADDR_ETHER_II (1ul << 17) |
| 126 | #define IPA_FLT_MAC_DST_ADDR_ETHER_II (1ul << 18) |
| 127 | #define IPA_FLT_MAC_SRC_ADDR_802_3 (1ul << 19) |
| 128 | #define IPA_FLT_MAC_DST_ADDR_802_3 (1ul << 20) |
| 129 | #define IPA_FLT_MAC_ETHER_TYPE (1ul << 21) |
Shihuan Liu | 65a4a41 | 2017-05-22 18:30:28 -0700 | [diff] [blame] | 130 | #define IPA_FLT_MAC_DST_ADDR_L2TP (1ul << 22) |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 131 | |
| 132 | /** |
Amir Levy | 05fccd0 | 2017-06-13 16:25:45 +0300 | [diff] [blame] | 133 | * maximal number of NAT PDNs in the PDN config table |
| 134 | */ |
| 135 | #define IPA_MAX_PDN_NUM 5 |
| 136 | |
| 137 | /** |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 138 | * enum ipa_client_type - names for the various IPA "clients" |
| 139 | * these are from the perspective of the clients, for e.g. |
| 140 | * HSIC1_PROD means HSIC client is the producer and IPA is the |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 141 | * consumer. |
| 142 | * PROD clients are always even, and CONS clients are always odd. |
| 143 | * Add new clients in the end of the list and update IPA_CLIENT_MAX |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 144 | */ |
| 145 | enum ipa_client_type { |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 146 | IPA_CLIENT_HSIC1_PROD = 0, |
| 147 | IPA_CLIENT_HSIC1_CONS = 1, |
| 148 | |
| 149 | IPA_CLIENT_HSIC2_PROD = 2, |
| 150 | IPA_CLIENT_HSIC2_CONS = 3, |
| 151 | |
| 152 | IPA_CLIENT_HSIC3_PROD = 4, |
| 153 | IPA_CLIENT_HSIC3_CONS = 5, |
| 154 | |
| 155 | IPA_CLIENT_HSIC4_PROD = 6, |
| 156 | IPA_CLIENT_HSIC4_CONS = 7, |
| 157 | |
| 158 | IPA_CLIENT_HSIC5_PROD = 8, |
| 159 | IPA_CLIENT_HSIC5_CONS = 9, |
| 160 | |
| 161 | IPA_CLIENT_WLAN1_PROD = 10, |
| 162 | IPA_CLIENT_WLAN1_CONS = 11, |
| 163 | |
| 164 | IPA_CLIENT_A5_WLAN_AMPDU_PROD = 12, |
| 165 | IPA_CLIENT_WLAN2_CONS = 13, |
| 166 | |
| 167 | /* RESERVERD PROD = 14, */ |
| 168 | IPA_CLIENT_WLAN3_CONS = 15, |
| 169 | |
| 170 | /* RESERVERD PROD = 16, */ |
| 171 | IPA_CLIENT_WLAN4_CONS = 17, |
| 172 | |
| 173 | IPA_CLIENT_USB_PROD = 18, |
| 174 | IPA_CLIENT_USB_CONS = 19, |
| 175 | |
| 176 | IPA_CLIENT_USB2_PROD = 20, |
| 177 | IPA_CLIENT_USB2_CONS = 21, |
| 178 | |
| 179 | IPA_CLIENT_USB3_PROD = 22, |
| 180 | IPA_CLIENT_USB3_CONS = 23, |
| 181 | |
| 182 | IPA_CLIENT_USB4_PROD = 24, |
| 183 | IPA_CLIENT_USB4_CONS = 25, |
| 184 | |
| 185 | IPA_CLIENT_UC_USB_PROD = 26, |
| 186 | IPA_CLIENT_USB_DPL_CONS = 27, |
| 187 | |
| 188 | IPA_CLIENT_A2_EMBEDDED_PROD = 28, |
| 189 | IPA_CLIENT_A2_EMBEDDED_CONS = 29, |
| 190 | |
| 191 | IPA_CLIENT_A2_TETHERED_PROD = 30, |
| 192 | IPA_CLIENT_A2_TETHERED_CONS = 31, |
| 193 | |
| 194 | IPA_CLIENT_APPS_LAN_PROD = 32, |
| 195 | IPA_CLIENT_APPS_LAN_CONS = 33, |
| 196 | |
| 197 | IPA_CLIENT_APPS_WAN_PROD = 34, |
Ghanim Fodi | c6b6749 | 2017-03-15 14:19:56 +0200 | [diff] [blame] | 198 | IPA_CLIENT_APPS_LAN_WAN_PROD = IPA_CLIENT_APPS_WAN_PROD, |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 199 | IPA_CLIENT_APPS_WAN_CONS = 35, |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 200 | |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 201 | IPA_CLIENT_APPS_CMD_PROD = 36, |
| 202 | IPA_CLIENT_A5_LAN_WAN_CONS = 37, |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 203 | |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 204 | IPA_CLIENT_ODU_PROD = 38, |
| 205 | IPA_CLIENT_ODU_EMB_CONS = 39, |
Sunil Paidimarri | 5139aa2 | 2017-02-13 11:07:32 -0800 | [diff] [blame] | 206 | |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 207 | /* RESERVERD PROD = 40, */ |
| 208 | IPA_CLIENT_ODU_TETH_CONS = 41, |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 209 | |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 210 | IPA_CLIENT_MHI_PROD = 42, |
| 211 | IPA_CLIENT_MHI_CONS = 43, |
| 212 | |
| 213 | IPA_CLIENT_MEMCPY_DMA_SYNC_PROD = 44, |
| 214 | IPA_CLIENT_MEMCPY_DMA_SYNC_CONS = 45, |
| 215 | |
| 216 | IPA_CLIENT_MEMCPY_DMA_ASYNC_PROD = 46, |
| 217 | IPA_CLIENT_MEMCPY_DMA_ASYNC_CONS = 47, |
| 218 | |
| 219 | IPA_CLIENT_ETHERNET_PROD = 48, |
| 220 | IPA_CLIENT_ETHERNET_CONS = 49, |
| 221 | |
| 222 | IPA_CLIENT_Q6_LAN_PROD = 50, |
| 223 | IPA_CLIENT_Q6_LAN_CONS = 51, |
| 224 | |
| 225 | IPA_CLIENT_Q6_WAN_PROD = 52, |
| 226 | IPA_CLIENT_Q6_WAN_CONS = 53, |
| 227 | |
| 228 | IPA_CLIENT_Q6_CMD_PROD = 54, |
| 229 | IPA_CLIENT_Q6_DUN_CONS = 55, |
| 230 | |
| 231 | IPA_CLIENT_Q6_DECOMP_PROD = 56, |
| 232 | IPA_CLIENT_Q6_DECOMP_CONS = 57, |
| 233 | |
| 234 | IPA_CLIENT_Q6_DECOMP2_PROD = 58, |
| 235 | IPA_CLIENT_Q6_DECOMP2_CONS = 59, |
| 236 | |
| 237 | /* RESERVERD PROD = 60, */ |
| 238 | IPA_CLIENT_Q6_LTE_WIFI_AGGR_CONS = 61, |
| 239 | |
| 240 | IPA_CLIENT_TEST_PROD = 62, |
| 241 | IPA_CLIENT_TEST_CONS = 63, |
| 242 | |
| 243 | IPA_CLIENT_TEST1_PROD = 64, |
| 244 | IPA_CLIENT_TEST1_CONS = 65, |
| 245 | |
| 246 | IPA_CLIENT_TEST2_PROD = 66, |
| 247 | IPA_CLIENT_TEST2_CONS = 67, |
| 248 | |
| 249 | IPA_CLIENT_TEST3_PROD = 68, |
| 250 | IPA_CLIENT_TEST3_CONS = 69, |
| 251 | |
| 252 | IPA_CLIENT_TEST4_PROD = 70, |
| 253 | IPA_CLIENT_TEST4_CONS = 71, |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 254 | }; |
| 255 | |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 256 | #define IPA_CLIENT_MAX (IPA_CLIENT_TEST4_CONS + 1) |
| 257 | |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 258 | #define IPA_CLIENT_IS_APPS_CONS(client) \ |
| 259 | ((client) == IPA_CLIENT_APPS_LAN_CONS || \ |
| 260 | (client) == IPA_CLIENT_APPS_WAN_CONS) |
| 261 | |
| 262 | #define IPA_CLIENT_IS_USB_CONS(client) \ |
| 263 | ((client) == IPA_CLIENT_USB_CONS || \ |
| 264 | (client) == IPA_CLIENT_USB2_CONS || \ |
| 265 | (client) == IPA_CLIENT_USB3_CONS || \ |
| 266 | (client) == IPA_CLIENT_USB_DPL_CONS || \ |
| 267 | (client) == IPA_CLIENT_USB4_CONS) |
| 268 | |
| 269 | #define IPA_CLIENT_IS_WLAN_CONS(client) \ |
| 270 | ((client) == IPA_CLIENT_WLAN1_CONS || \ |
| 271 | (client) == IPA_CLIENT_WLAN2_CONS || \ |
| 272 | (client) == IPA_CLIENT_WLAN3_CONS || \ |
| 273 | (client) == IPA_CLIENT_WLAN4_CONS) |
| 274 | |
| 275 | #define IPA_CLIENT_IS_ODU_CONS(client) \ |
| 276 | ((client) == IPA_CLIENT_ODU_EMB_CONS || \ |
| 277 | (client) == IPA_CLIENT_ODU_TETH_CONS) |
| 278 | |
| 279 | #define IPA_CLIENT_IS_Q6_CONS(client) \ |
| 280 | ((client) == IPA_CLIENT_Q6_LAN_CONS || \ |
| 281 | (client) == IPA_CLIENT_Q6_WAN_CONS || \ |
| 282 | (client) == IPA_CLIENT_Q6_DUN_CONS || \ |
| 283 | (client) == IPA_CLIENT_Q6_DECOMP_CONS || \ |
| 284 | (client) == IPA_CLIENT_Q6_DECOMP2_CONS || \ |
| 285 | (client) == IPA_CLIENT_Q6_LTE_WIFI_AGGR_CONS) |
| 286 | |
| 287 | #define IPA_CLIENT_IS_Q6_PROD(client) \ |
| 288 | ((client) == IPA_CLIENT_Q6_LAN_PROD || \ |
| 289 | (client) == IPA_CLIENT_Q6_WAN_PROD || \ |
| 290 | (client) == IPA_CLIENT_Q6_CMD_PROD || \ |
| 291 | (client) == IPA_CLIENT_Q6_DECOMP_PROD || \ |
| 292 | (client) == IPA_CLIENT_Q6_DECOMP2_PROD) |
| 293 | |
| 294 | #define IPA_CLIENT_IS_Q6_NON_ZIP_CONS(client) \ |
| 295 | ((client) == IPA_CLIENT_Q6_LAN_CONS || \ |
| 296 | (client) == IPA_CLIENT_Q6_WAN_CONS || \ |
| 297 | (client) == IPA_CLIENT_Q6_DUN_CONS || \ |
| 298 | (client) == IPA_CLIENT_Q6_LTE_WIFI_AGGR_CONS) |
| 299 | |
| 300 | #define IPA_CLIENT_IS_Q6_ZIP_CONS(client) \ |
| 301 | ((client) == IPA_CLIENT_Q6_DECOMP_CONS || \ |
| 302 | (client) == IPA_CLIENT_Q6_DECOMP2_CONS) |
| 303 | |
| 304 | #define IPA_CLIENT_IS_Q6_NON_ZIP_PROD(client) \ |
| 305 | ((client) == IPA_CLIENT_Q6_LAN_PROD || \ |
| 306 | (client) == IPA_CLIENT_Q6_WAN_PROD || \ |
| 307 | (client) == IPA_CLIENT_Q6_CMD_PROD) |
| 308 | |
| 309 | #define IPA_CLIENT_IS_Q6_ZIP_PROD(client) \ |
| 310 | ((client) == IPA_CLIENT_Q6_DECOMP_PROD || \ |
| 311 | (client) == IPA_CLIENT_Q6_DECOMP2_PROD) |
| 312 | |
| 313 | #define IPA_CLIENT_IS_MEMCPY_DMA_CONS(client) \ |
| 314 | ((client) == IPA_CLIENT_MEMCPY_DMA_SYNC_CONS || \ |
| 315 | (client) == IPA_CLIENT_MEMCPY_DMA_ASYNC_CONS) |
| 316 | |
| 317 | #define IPA_CLIENT_IS_MEMCPY_DMA_PROD(client) \ |
| 318 | ((client) == IPA_CLIENT_MEMCPY_DMA_SYNC_PROD || \ |
| 319 | (client) == IPA_CLIENT_MEMCPY_DMA_ASYNC_PROD) |
| 320 | |
| 321 | #define IPA_CLIENT_IS_MHI_CONS(client) \ |
| 322 | ((client) == IPA_CLIENT_MHI_CONS) |
| 323 | |
| 324 | #define IPA_CLIENT_IS_MHI(client) \ |
| 325 | ((client) == IPA_CLIENT_MHI_CONS || \ |
| 326 | (client) == IPA_CLIENT_MHI_PROD) |
| 327 | |
| 328 | #define IPA_CLIENT_IS_TEST_PROD(client) \ |
| 329 | ((client) == IPA_CLIENT_TEST_PROD || \ |
| 330 | (client) == IPA_CLIENT_TEST1_PROD || \ |
| 331 | (client) == IPA_CLIENT_TEST2_PROD || \ |
| 332 | (client) == IPA_CLIENT_TEST3_PROD || \ |
| 333 | (client) == IPA_CLIENT_TEST4_PROD) |
| 334 | |
| 335 | #define IPA_CLIENT_IS_TEST_CONS(client) \ |
| 336 | ((client) == IPA_CLIENT_TEST_CONS || \ |
| 337 | (client) == IPA_CLIENT_TEST1_CONS || \ |
| 338 | (client) == IPA_CLIENT_TEST2_CONS || \ |
| 339 | (client) == IPA_CLIENT_TEST3_CONS || \ |
| 340 | (client) == IPA_CLIENT_TEST4_CONS) |
| 341 | |
| 342 | #define IPA_CLIENT_IS_TEST(client) \ |
| 343 | (IPA_CLIENT_IS_TEST_PROD(client) || IPA_CLIENT_IS_TEST_CONS(client)) |
| 344 | |
| 345 | /** |
| 346 | * enum ipa_ip_type - Address family: IPv4 or IPv6 |
| 347 | */ |
| 348 | enum ipa_ip_type { |
| 349 | IPA_IP_v4, |
| 350 | IPA_IP_v6, |
| 351 | IPA_IP_MAX |
| 352 | }; |
| 353 | |
| 354 | /** |
| 355 | * enum ipa_rule_type - Type of routing or filtering rule |
| 356 | * Hashable: Rule will be located at the hashable tables |
| 357 | * Non_Hashable: Rule will be located at the non-hashable tables |
| 358 | */ |
| 359 | enum ipa_rule_type { |
| 360 | IPA_RULE_HASHABLE, |
| 361 | IPA_RULE_NON_HASHABLE, |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 362 | }; |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 363 | #define IPA_RULE_TYPE_MAX (IPA_RULE_NON_HASHABLE + 1) |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 364 | |
| 365 | /** |
| 366 | * enum ipa_flt_action - action field of filtering rule |
| 367 | * |
| 368 | * Pass to routing: 5'd0 |
| 369 | * Pass to source NAT: 5'd1 |
| 370 | * Pass to destination NAT: 5'd2 |
| 371 | * Pass to default output pipe (e.g., Apps or Modem): 5'd3 |
| 372 | */ |
| 373 | enum ipa_flt_action { |
| 374 | IPA_PASS_TO_ROUTING, |
| 375 | IPA_PASS_TO_SRC_NAT, |
| 376 | IPA_PASS_TO_DST_NAT, |
| 377 | IPA_PASS_TO_EXCEPTION |
| 378 | }; |
| 379 | |
| 380 | /** |
| 381 | * enum ipa_wlan_event - Events for wlan client |
| 382 | * |
| 383 | * wlan client connect: New wlan client connected |
| 384 | * wlan client disconnect: wlan client disconnected |
| 385 | * wlan client power save: wlan client moved to power save |
| 386 | * wlan client normal: wlan client moved out of power save |
| 387 | * sw routing enable: ipa routing is disabled |
| 388 | * sw routing disable: ipa routing is enabled |
| 389 | * wlan ap connect: wlan AP(access point) is up |
| 390 | * wlan ap disconnect: wlan AP(access point) is down |
| 391 | * wlan sta connect: wlan STA(station) is up |
| 392 | * wlan sta disconnect: wlan STA(station) is down |
| 393 | * wlan client connect ex: new wlan client connected |
| 394 | * wlan scc switch: wlan interfaces in scc mode |
| 395 | * wlan mcc switch: wlan interfaces in mcc mode |
| 396 | * wlan wdi enable: wdi data path completed |
| 397 | * wlan wdi disable: wdi data path teardown |
| 398 | */ |
| 399 | enum ipa_wlan_event { |
| 400 | WLAN_CLIENT_CONNECT, |
| 401 | WLAN_CLIENT_DISCONNECT, |
| 402 | WLAN_CLIENT_POWER_SAVE_MODE, |
| 403 | WLAN_CLIENT_NORMAL_MODE, |
| 404 | SW_ROUTING_ENABLE, |
| 405 | SW_ROUTING_DISABLE, |
| 406 | WLAN_AP_CONNECT, |
| 407 | WLAN_AP_DISCONNECT, |
| 408 | WLAN_STA_CONNECT, |
| 409 | WLAN_STA_DISCONNECT, |
| 410 | WLAN_CLIENT_CONNECT_EX, |
| 411 | WLAN_SWITCH_TO_SCC, |
| 412 | WLAN_SWITCH_TO_MCC, |
| 413 | WLAN_WDI_ENABLE, |
| 414 | WLAN_WDI_DISABLE, |
| 415 | IPA_WLAN_EVENT_MAX |
| 416 | }; |
| 417 | |
| 418 | /** |
| 419 | * enum ipa_wan_event - Events for wan client |
| 420 | * |
| 421 | * wan default route add/del |
| 422 | * wan embms connect: New wan embms interface connected |
| 423 | */ |
| 424 | enum ipa_wan_event { |
| 425 | WAN_UPSTREAM_ROUTE_ADD = IPA_WLAN_EVENT_MAX, |
| 426 | WAN_UPSTREAM_ROUTE_DEL, |
| 427 | WAN_EMBMS_CONNECT, |
| 428 | WAN_XLAT_CONNECT, |
| 429 | IPA_WAN_EVENT_MAX |
| 430 | }; |
| 431 | |
| 432 | enum ipa_ecm_event { |
| 433 | ECM_CONNECT = IPA_WAN_EVENT_MAX, |
| 434 | ECM_DISCONNECT, |
| 435 | IPA_ECM_EVENT_MAX, |
| 436 | }; |
| 437 | |
| 438 | enum ipa_tethering_stats_event { |
| 439 | IPA_TETHERING_STATS_UPDATE_STATS = IPA_ECM_EVENT_MAX, |
| 440 | IPA_TETHERING_STATS_UPDATE_NETWORK_STATS, |
| 441 | IPA_TETHERING_STATS_EVENT_MAX, |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 442 | }; |
| 443 | |
Skylar Chang | 09e0e25 | 2017-03-20 14:51:29 -0700 | [diff] [blame] | 444 | enum ipa_quota_event { |
| 445 | IPA_QUOTA_REACH = IPA_TETHERING_STATS_EVENT_MAX, |
| 446 | IPA_QUOTA_EVENT_MAX, |
| 447 | }; |
| 448 | |
| 449 | enum ipa_ssr_event { |
| 450 | IPA_SSR_BEFORE_SHUTDOWN = IPA_QUOTA_EVENT_MAX, |
| 451 | IPA_SSR_AFTER_POWERUP, |
| 452 | IPA_SSR_EVENT_MAX |
| 453 | }; |
| 454 | |
| 455 | #define IPA_EVENT_MAX_NUM ((int)IPA_SSR_EVENT_MAX) |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 456 | |
| 457 | /** |
| 458 | * enum ipa_rm_resource_name - IPA RM clients identification names |
| 459 | * |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 460 | * PROD resources are always even, and CONS resources are always odd. |
| 461 | * Add new clients in the end of the list and update IPA_RM_RESOURCE_MAX |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 462 | */ |
| 463 | enum ipa_rm_resource_name { |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 464 | IPA_RM_RESOURCE_Q6_PROD = 0, |
| 465 | IPA_RM_RESOURCE_Q6_CONS = 1, |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 466 | |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 467 | IPA_RM_RESOURCE_USB_PROD = 2, |
| 468 | IPA_RM_RESOURCE_USB_CONS = 3, |
| 469 | |
| 470 | IPA_RM_RESOURCE_USB_DPL_DUMMY_PROD = 4, |
| 471 | IPA_RM_RESOURCE_USB_DPL_CONS = 5, |
| 472 | |
| 473 | IPA_RM_RESOURCE_HSIC_PROD = 6, |
| 474 | IPA_RM_RESOURCE_HSIC_CONS = 7, |
| 475 | |
| 476 | IPA_RM_RESOURCE_STD_ECM_PROD = 8, |
| 477 | IPA_RM_RESOURCE_APPS_CONS = 9, |
| 478 | |
| 479 | IPA_RM_RESOURCE_RNDIS_PROD = 10, |
| 480 | /* RESERVED CONS = 11, */ |
| 481 | |
| 482 | IPA_RM_RESOURCE_WWAN_0_PROD = 12, |
| 483 | /* RESERVED CONS = 13, */ |
| 484 | |
| 485 | IPA_RM_RESOURCE_WLAN_PROD = 14, |
| 486 | IPA_RM_RESOURCE_WLAN_CONS = 15, |
| 487 | |
| 488 | IPA_RM_RESOURCE_ODU_ADAPT_PROD = 16, |
| 489 | IPA_RM_RESOURCE_ODU_ADAPT_CONS = 17, |
| 490 | |
| 491 | IPA_RM_RESOURCE_MHI_PROD = 18, |
| 492 | IPA_RM_RESOURCE_MHI_CONS = 19, |
| 493 | |
| 494 | IPA_RM_RESOURCE_ETHERNET_PROD = 20, |
| 495 | IPA_RM_RESOURCE_ETHERNET_CONS = 21, |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 496 | }; |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 497 | #define IPA_RM_RESOURCE_MAX (IPA_RM_RESOURCE_ETHERNET_CONS + 1) |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 498 | |
| 499 | /** |
| 500 | * enum ipa_hw_type - IPA hardware version type |
| 501 | * @IPA_HW_None: IPA hardware version not defined |
| 502 | * @IPA_HW_v1_0: IPA hardware version 1.0 |
| 503 | * @IPA_HW_v1_1: IPA hardware version 1.1 |
| 504 | * @IPA_HW_v2_0: IPA hardware version 2.0 |
| 505 | * @IPA_HW_v2_1: IPA hardware version 2.1 |
| 506 | * @IPA_HW_v2_5: IPA hardware version 2.5 |
| 507 | * @IPA_HW_v2_6: IPA hardware version 2.6 |
| 508 | * @IPA_HW_v2_6L: IPA hardware version 2.6L |
| 509 | * @IPA_HW_v3_0: IPA hardware version 3.0 |
| 510 | * @IPA_HW_v3_1: IPA hardware version 3.1 |
| 511 | * @IPA_HW_v3_5: IPA hardware version 3.5 |
| 512 | * @IPA_HW_v3_5_1: IPA hardware version 3.5.1 |
Michael Adisumarta | 891a4ff | 2017-05-16 16:40:06 -0700 | [diff] [blame] | 513 | * @IPA_HW_v4_0: IPA hardware version 4.0 |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 514 | */ |
| 515 | enum ipa_hw_type { |
| 516 | IPA_HW_None = 0, |
| 517 | IPA_HW_v1_0 = 1, |
| 518 | IPA_HW_v1_1 = 2, |
| 519 | IPA_HW_v2_0 = 3, |
| 520 | IPA_HW_v2_1 = 4, |
| 521 | IPA_HW_v2_5 = 5, |
| 522 | IPA_HW_v2_6 = IPA_HW_v2_5, |
| 523 | IPA_HW_v2_6L = 6, |
| 524 | IPA_HW_v3_0 = 10, |
| 525 | IPA_HW_v3_1 = 11, |
| 526 | IPA_HW_v3_5 = 12, |
| 527 | IPA_HW_v3_5_1 = 13, |
Michael Adisumarta | 891a4ff | 2017-05-16 16:40:06 -0700 | [diff] [blame] | 528 | IPA_HW_v4_0 = 14, |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 529 | }; |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 530 | #define IPA_HW_MAX (IPA_HW_v4_0 + 1) |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 531 | |
Michael Adisumarta | 891a4ff | 2017-05-16 16:40:06 -0700 | [diff] [blame] | 532 | #define IPA_HW_v4_0 IPA_HW_v4_0 |
| 533 | |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 534 | /** |
| 535 | * struct ipa_rule_attrib - attributes of a routing/filtering |
| 536 | * rule, all in LE |
| 537 | * @attrib_mask: what attributes are valid |
| 538 | * @src_port_lo: low port of src port range |
| 539 | * @src_port_hi: high port of src port range |
| 540 | * @dst_port_lo: low port of dst port range |
| 541 | * @dst_port_hi: high port of dst port range |
| 542 | * @type: ICMP/IGMP type |
| 543 | * @code: ICMP/IGMP code |
| 544 | * @spi: IPSec SPI |
| 545 | * @src_port: exact src port |
| 546 | * @dst_port: exact dst port |
| 547 | * @meta_data: meta-data val |
| 548 | * @meta_data_mask: meta-data mask |
| 549 | * @u.v4.tos: type of service |
| 550 | * @u.v4.protocol: protocol |
| 551 | * @u.v4.src_addr: src address value |
| 552 | * @u.v4.src_addr_mask: src address mask |
| 553 | * @u.v4.dst_addr: dst address value |
| 554 | * @u.v4.dst_addr_mask: dst address mask |
| 555 | * @u.v6.tc: traffic class |
| 556 | * @u.v6.flow_label: flow label |
| 557 | * @u.v6.next_hdr: next header |
| 558 | * @u.v6.src_addr: src address val |
| 559 | * @u.v6.src_addr_mask: src address mask |
| 560 | * @u.v6.dst_addr: dst address val |
| 561 | * @u.v6.dst_addr_mask: dst address mask |
| 562 | */ |
| 563 | struct ipa_rule_attrib { |
| 564 | uint32_t attrib_mask; |
| 565 | uint16_t src_port_lo; |
| 566 | uint16_t src_port_hi; |
| 567 | uint16_t dst_port_lo; |
| 568 | uint16_t dst_port_hi; |
| 569 | uint8_t type; |
| 570 | uint8_t code; |
| 571 | uint8_t tos_value; |
| 572 | uint8_t tos_mask; |
| 573 | uint32_t spi; |
| 574 | uint16_t src_port; |
| 575 | uint16_t dst_port; |
| 576 | uint32_t meta_data; |
| 577 | uint32_t meta_data_mask; |
| 578 | uint8_t src_mac_addr[ETH_ALEN]; |
| 579 | uint8_t src_mac_addr_mask[ETH_ALEN]; |
| 580 | uint8_t dst_mac_addr[ETH_ALEN]; |
| 581 | uint8_t dst_mac_addr_mask[ETH_ALEN]; |
| 582 | uint16_t ether_type; |
| 583 | union { |
| 584 | struct { |
| 585 | uint8_t tos; |
| 586 | uint8_t protocol; |
| 587 | uint32_t src_addr; |
| 588 | uint32_t src_addr_mask; |
| 589 | uint32_t dst_addr; |
| 590 | uint32_t dst_addr_mask; |
| 591 | } v4; |
| 592 | struct { |
| 593 | uint8_t tc; |
| 594 | uint32_t flow_label; |
| 595 | uint8_t next_hdr; |
| 596 | uint32_t src_addr[4]; |
| 597 | uint32_t src_addr_mask[4]; |
| 598 | uint32_t dst_addr[4]; |
| 599 | uint32_t dst_addr_mask[4]; |
| 600 | } v6; |
| 601 | } u; |
| 602 | }; |
| 603 | |
| 604 | /*! @brief The maximum number of Mask Equal 32 Eqns */ |
| 605 | #define IPA_IPFLTR_NUM_MEQ_32_EQNS 2 |
| 606 | |
| 607 | /*! @brief The maximum number of IHL offset Mask Equal 32 Eqns */ |
| 608 | #define IPA_IPFLTR_NUM_IHL_MEQ_32_EQNS 2 |
| 609 | |
| 610 | /*! @brief The maximum number of Mask Equal 128 Eqns */ |
| 611 | #define IPA_IPFLTR_NUM_MEQ_128_EQNS 2 |
| 612 | |
| 613 | /*! @brief The maximum number of IHL offset Range Check 16 Eqns */ |
| 614 | #define IPA_IPFLTR_NUM_IHL_RANGE_16_EQNS 2 |
| 615 | |
| 616 | /*! @brief Offset and 16 bit comparison equation */ |
| 617 | struct ipa_ipfltr_eq_16 { |
| 618 | int8_t offset; |
| 619 | uint16_t value; |
| 620 | }; |
| 621 | |
| 622 | /*! @brief Offset and 32 bit comparison equation */ |
| 623 | struct ipa_ipfltr_eq_32 { |
| 624 | int8_t offset; |
| 625 | uint32_t value; |
| 626 | }; |
| 627 | |
| 628 | /*! @brief Offset and 128 bit masked comparison equation */ |
| 629 | struct ipa_ipfltr_mask_eq_128 { |
| 630 | int8_t offset; |
| 631 | uint8_t mask[16]; |
| 632 | uint8_t value[16]; |
| 633 | }; |
| 634 | |
| 635 | /*! @brief Offset and 32 bit masked comparison equation */ |
| 636 | struct ipa_ipfltr_mask_eq_32 { |
| 637 | int8_t offset; |
| 638 | uint32_t mask; |
| 639 | uint32_t value; |
| 640 | }; |
| 641 | |
| 642 | /*! @brief Equation for identifying a range. Ranges are inclusive */ |
| 643 | struct ipa_ipfltr_range_eq_16 { |
| 644 | int8_t offset; |
| 645 | uint16_t range_low; |
| 646 | uint16_t range_high; |
| 647 | }; |
| 648 | |
| 649 | /*! @brief Rule equations which are set according to DS filter installation */ |
| 650 | struct ipa_ipfltri_rule_eq { |
| 651 | /*! 16-bit Bitmask to indicate how many eqs are valid in this rule */ |
| 652 | uint16_t rule_eq_bitmap; |
| 653 | /*! Specifies if a type of service check rule is present */ |
| 654 | uint8_t tos_eq_present; |
| 655 | /*! The value to check against the type of service (ipv4) field */ |
| 656 | uint8_t tos_eq; |
| 657 | /*! Specifies if a protocol check rule is present */ |
| 658 | uint8_t protocol_eq_present; |
| 659 | /*! The value to check against the protocol (ipv6) field */ |
| 660 | uint8_t protocol_eq; |
| 661 | /*! The number of ip header length offset 16 bit range check |
| 662 | * rules in this rule |
| 663 | */ |
| 664 | uint8_t num_ihl_offset_range_16; |
| 665 | /*! An array of the registered ip header length offset 16 bit |
| 666 | * range check rules |
| 667 | */ |
| 668 | struct ipa_ipfltr_range_eq_16 |
| 669 | ihl_offset_range_16[IPA_IPFLTR_NUM_IHL_RANGE_16_EQNS]; |
| 670 | /*! The number of mask equal 32 rules present in this rule */ |
| 671 | uint8_t num_offset_meq_32; |
| 672 | /*! An array of all the possible mask equal 32 rules in this rule */ |
| 673 | struct ipa_ipfltr_mask_eq_32 |
| 674 | offset_meq_32[IPA_IPFLTR_NUM_MEQ_32_EQNS]; |
| 675 | /*! Specifies if the traffic class rule is present in this rule */ |
| 676 | uint8_t tc_eq_present; |
| 677 | /*! The value to check the traffic class (ipv4) field against */ |
| 678 | uint8_t tc_eq; |
| 679 | /*! Specifies if the flow equals rule is present in this rule */ |
| 680 | uint8_t fl_eq_present; |
| 681 | /*! The value to check the flow (ipv6) field against */ |
| 682 | uint32_t fl_eq; |
| 683 | /*! The number of ip header length offset 16 bit equations in this |
| 684 | * rule |
| 685 | */ |
| 686 | uint8_t ihl_offset_eq_16_present; |
| 687 | /*! The ip header length offset 16 bit equation */ |
| 688 | struct ipa_ipfltr_eq_16 ihl_offset_eq_16; |
| 689 | /*! The number of ip header length offset 32 bit equations in this |
| 690 | * rule |
| 691 | */ |
| 692 | uint8_t ihl_offset_eq_32_present; |
| 693 | /*! The ip header length offset 32 bit equation */ |
| 694 | struct ipa_ipfltr_eq_32 ihl_offset_eq_32; |
| 695 | /*! The number of ip header length offset 32 bit mask equations in |
| 696 | * this rule |
| 697 | */ |
| 698 | uint8_t num_ihl_offset_meq_32; |
| 699 | /*! The ip header length offset 32 bit mask equation */ |
| 700 | struct ipa_ipfltr_mask_eq_32 |
| 701 | ihl_offset_meq_32[IPA_IPFLTR_NUM_IHL_MEQ_32_EQNS]; |
| 702 | /*! The number of ip header length offset 128 bit equations in this |
| 703 | * rule |
| 704 | */ |
| 705 | uint8_t num_offset_meq_128; |
| 706 | /*! The ip header length offset 128 bit equation */ |
| 707 | struct ipa_ipfltr_mask_eq_128 |
| 708 | offset_meq_128[IPA_IPFLTR_NUM_MEQ_128_EQNS]; |
| 709 | /*! The metadata 32 bit masked comparison equation present or not */ |
| 710 | /* Metadata based rules are added internally by IPA driver */ |
| 711 | uint8_t metadata_meq32_present; |
| 712 | /*! The metadata 32 bit masked comparison equation */ |
| 713 | struct ipa_ipfltr_mask_eq_32 metadata_meq32; |
| 714 | /*! Specifies if the Fragment equation is present in this rule */ |
| 715 | uint8_t ipv4_frag_eq_present; |
| 716 | }; |
| 717 | |
| 718 | /** |
| 719 | * struct ipa_flt_rule - attributes of a filtering rule |
| 720 | * @retain_hdr: bool switch to instruct IPA core to add back to the packet |
| 721 | * the header removed as part of header removal |
| 722 | * @to_uc: bool switch to pass packet to micro-controller |
| 723 | * @action: action field |
| 724 | * @rt_tbl_hdl: handle of table from "get" |
| 725 | * @attrib: attributes of the rule |
| 726 | * @eq_attrib: attributes of the rule in equation form (valid when |
| 727 | * eq_attrib_type is true) |
| 728 | * @rt_tbl_idx: index of RT table referred to by filter rule (valid when |
| 729 | * eq_attrib_type is true and non-exception action) |
| 730 | * @eq_attrib_type: true if equation level form used to specify attributes |
| 731 | * @max_prio: bool switch. is this rule with Max priority? meaning on rule hit, |
| 732 | * IPA will use the rule and will not look for other rules that may have |
| 733 | * higher priority |
| 734 | * @hashable: bool switch. is this rule hashable or not? |
| 735 | * ipa uses hashable rules to cache their hit results to be used in |
| 736 | * consecutive packets |
| 737 | * @rule_id: rule_id to be assigned to the filter rule. In case client specifies |
| 738 | * rule_id as 0 the driver will assign a new rule_id |
Amir Levy | 05fccd0 | 2017-06-13 16:25:45 +0300 | [diff] [blame] | 739 | * @set_metadata: bool switch. should metadata replacement at the NAT block |
| 740 | * take place? |
| 741 | * @pdn_idx: if action is "pass to source\destination NAT" then a comparison |
| 742 | * against the PDN index in the matching PDN entry will take place as an |
| 743 | * additional condition for NAT hit. |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 744 | */ |
| 745 | struct ipa_flt_rule { |
| 746 | uint8_t retain_hdr; |
| 747 | uint8_t to_uc; |
| 748 | enum ipa_flt_action action; |
| 749 | uint32_t rt_tbl_hdl; |
| 750 | struct ipa_rule_attrib attrib; |
| 751 | struct ipa_ipfltri_rule_eq eq_attrib; |
| 752 | uint32_t rt_tbl_idx; |
| 753 | uint8_t eq_attrib_type; |
| 754 | uint8_t max_prio; |
| 755 | uint8_t hashable; |
| 756 | uint16_t rule_id; |
Amir Levy | 05fccd0 | 2017-06-13 16:25:45 +0300 | [diff] [blame] | 757 | uint8_t set_metadata; |
| 758 | uint8_t pdn_idx; |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 759 | }; |
| 760 | |
| 761 | /** |
| 762 | * enum ipa_hdr_l2_type - L2 header type |
| 763 | * IPA_HDR_L2_NONE: L2 header which isn't Ethernet II and isn't 802_3 |
| 764 | * IPA_HDR_L2_ETHERNET_II: L2 header of type Ethernet II |
| 765 | * IPA_HDR_L2_802_3: L2 header of type 802_3 |
| 766 | */ |
| 767 | enum ipa_hdr_l2_type { |
| 768 | IPA_HDR_L2_NONE, |
| 769 | IPA_HDR_L2_ETHERNET_II, |
| 770 | IPA_HDR_L2_802_3, |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 771 | }; |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 772 | #define IPA_HDR_L2_MAX (IPA_HDR_L2_802_3 + 1) |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 773 | |
| 774 | /** |
| 775 | * enum ipa_hdr_l2_type - Processing context type |
| 776 | * IPA_HDR_PROC_NONE: No processing context |
| 777 | * IPA_HDR_PROC_ETHII_TO_ETHII: Process Ethernet II to Ethernet II |
| 778 | * IPA_HDR_PROC_ETHII_TO_802_3: Process Ethernet II to 802_3 |
| 779 | * IPA_HDR_PROC_802_3_TO_ETHII: Process 802_3 to Ethernet II |
| 780 | * IPA_HDR_PROC_802_3_TO_802_3: Process 802_3 to 802_3 |
| 781 | */ |
| 782 | enum ipa_hdr_proc_type { |
| 783 | IPA_HDR_PROC_NONE, |
| 784 | IPA_HDR_PROC_ETHII_TO_ETHII, |
| 785 | IPA_HDR_PROC_ETHII_TO_802_3, |
| 786 | IPA_HDR_PROC_802_3_TO_ETHII, |
| 787 | IPA_HDR_PROC_802_3_TO_802_3, |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 788 | }; |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 789 | #define IPA_HDR_PROC_MAX (IPA_HDR_PROC_802_3_TO_802_3 + 1) |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 790 | |
| 791 | /** |
| 792 | * struct ipa_rt_rule - attributes of a routing rule |
| 793 | * @dst: dst "client" |
| 794 | * @hdr_hdl: handle to the dynamic header |
| 795 | it is not an index or an offset |
| 796 | * @hdr_proc_ctx_hdl: handle to header processing context. if it is provided |
| 797 | hdr_hdl shall be 0 |
| 798 | * @attrib: attributes of the rule |
| 799 | * @max_prio: bool switch. is this rule with Max priority? meaning on rule hit, |
| 800 | * IPA will use the rule and will not look for other rules that may have |
| 801 | * higher priority |
| 802 | * @hashable: bool switch. is this rule hashable or not? |
| 803 | * ipa uses hashable rules to cache their hit results to be used in |
| 804 | * consecutive packets |
| 805 | * @retain_hdr: bool switch to instruct IPA core to add back to the packet |
| 806 | * the header removed as part of header removal |
| 807 | */ |
| 808 | struct ipa_rt_rule { |
| 809 | enum ipa_client_type dst; |
| 810 | uint32_t hdr_hdl; |
| 811 | uint32_t hdr_proc_ctx_hdl; |
| 812 | struct ipa_rule_attrib attrib; |
| 813 | uint8_t max_prio; |
| 814 | uint8_t hashable; |
| 815 | uint8_t retain_hdr; |
| 816 | }; |
| 817 | |
| 818 | /** |
| 819 | * struct ipa_hdr_add - header descriptor includes in and out |
| 820 | * parameters |
| 821 | * @name: name of the header |
| 822 | * @hdr: actual header to be inserted |
| 823 | * @hdr_len: size of above header |
| 824 | * @type: l2 header type |
| 825 | * @is_partial: header not fully specified |
| 826 | * @hdr_hdl: out parameter, handle to header, valid when status is 0 |
| 827 | * @status: out parameter, status of header add operation, |
| 828 | * 0 for success, |
| 829 | * -1 for failure |
| 830 | * @is_eth2_ofst_valid: is eth2_ofst field valid? |
| 831 | * @eth2_ofst: offset to start of Ethernet-II/802.3 header |
| 832 | */ |
| 833 | struct ipa_hdr_add { |
| 834 | char name[IPA_RESOURCE_NAME_MAX]; |
| 835 | uint8_t hdr[IPA_HDR_MAX_SIZE]; |
| 836 | uint8_t hdr_len; |
| 837 | enum ipa_hdr_l2_type type; |
| 838 | uint8_t is_partial; |
| 839 | uint32_t hdr_hdl; |
| 840 | int status; |
| 841 | uint8_t is_eth2_ofst_valid; |
| 842 | uint16_t eth2_ofst; |
| 843 | }; |
| 844 | |
| 845 | /** |
| 846 | * struct ipa_ioc_add_hdr - header addition parameters (support |
| 847 | * multiple headers and commit) |
| 848 | * @commit: should headers be written to IPA HW also? |
| 849 | * @num_hdrs: num of headers that follow |
| 850 | * @ipa_hdr_add hdr: all headers need to go here back to |
| 851 | * back, no pointers |
| 852 | */ |
| 853 | struct ipa_ioc_add_hdr { |
| 854 | uint8_t commit; |
| 855 | uint8_t num_hdrs; |
| 856 | struct ipa_hdr_add hdr[0]; |
| 857 | }; |
| 858 | |
| 859 | /** |
| 860 | * struct ipa_hdr_proc_ctx_add - processing context descriptor includes |
| 861 | * in and out parameters |
| 862 | * @type: processing context type |
| 863 | * @hdr_hdl: in parameter, handle to header |
| 864 | * @proc_ctx_hdl: out parameter, handle to proc_ctx, valid when status is 0 |
| 865 | * @status: out parameter, status of header add operation, |
| 866 | * 0 for success, |
| 867 | * -1 for failure |
| 868 | */ |
| 869 | struct ipa_hdr_proc_ctx_add { |
| 870 | enum ipa_hdr_proc_type type; |
| 871 | uint32_t hdr_hdl; |
| 872 | uint32_t proc_ctx_hdl; |
| 873 | int status; |
| 874 | }; |
| 875 | |
| 876 | /** |
| 877 | * struct ipa_ioc_add_hdr - processing context addition parameters (support |
| 878 | * multiple processing context and commit) |
| 879 | * @commit: should processing context be written to IPA HW also? |
| 880 | * @num_proc_ctxs: num of processing context that follow |
| 881 | * @proc_ctx: all processing context need to go here back to |
| 882 | * back, no pointers |
| 883 | */ |
| 884 | struct ipa_ioc_add_hdr_proc_ctx { |
| 885 | uint8_t commit; |
| 886 | uint8_t num_proc_ctxs; |
| 887 | struct ipa_hdr_proc_ctx_add proc_ctx[0]; |
| 888 | }; |
| 889 | |
| 890 | /** |
| 891 | * struct ipa_ioc_copy_hdr - retrieve a copy of the specified |
| 892 | * header - caller can then derive the complete header |
| 893 | * @name: name of the header resource |
| 894 | * @hdr: out parameter, contents of specified header, |
| 895 | * valid only when ioctl return val is non-negative |
| 896 | * @hdr_len: out parameter, size of above header |
| 897 | * valid only when ioctl return val is non-negative |
| 898 | * @type: l2 header type |
| 899 | * valid only when ioctl return val is non-negative |
| 900 | * @is_partial: out parameter, indicates whether specified header is partial |
| 901 | * valid only when ioctl return val is non-negative |
| 902 | * @is_eth2_ofst_valid: is eth2_ofst field valid? |
| 903 | * @eth2_ofst: offset to start of Ethernet-II/802.3 header |
| 904 | */ |
| 905 | struct ipa_ioc_copy_hdr { |
| 906 | char name[IPA_RESOURCE_NAME_MAX]; |
| 907 | uint8_t hdr[IPA_HDR_MAX_SIZE]; |
| 908 | uint8_t hdr_len; |
| 909 | enum ipa_hdr_l2_type type; |
| 910 | uint8_t is_partial; |
| 911 | uint8_t is_eth2_ofst_valid; |
| 912 | uint16_t eth2_ofst; |
| 913 | }; |
| 914 | |
| 915 | /** |
| 916 | * struct ipa_ioc_get_hdr - header entry lookup parameters, if lookup was |
| 917 | * successful caller must call put to release the reference count when done |
| 918 | * @name: name of the header resource |
| 919 | * @hdl: out parameter, handle of header entry |
| 920 | * valid only when ioctl return val is non-negative |
| 921 | */ |
| 922 | struct ipa_ioc_get_hdr { |
| 923 | char name[IPA_RESOURCE_NAME_MAX]; |
| 924 | uint32_t hdl; |
| 925 | }; |
| 926 | |
| 927 | /** |
| 928 | * struct ipa_hdr_del - header descriptor includes in and out |
| 929 | * parameters |
| 930 | * |
| 931 | * @hdl: handle returned from header add operation |
| 932 | * @status: out parameter, status of header remove operation, |
| 933 | * 0 for success, |
| 934 | * -1 for failure |
| 935 | */ |
| 936 | struct ipa_hdr_del { |
| 937 | uint32_t hdl; |
| 938 | int status; |
| 939 | }; |
| 940 | |
| 941 | /** |
| 942 | * struct ipa_ioc_del_hdr - header deletion parameters (support |
| 943 | * multiple headers and commit) |
| 944 | * @commit: should headers be removed from IPA HW also? |
| 945 | * @num_hdls: num of headers being removed |
| 946 | * @ipa_hdr_del hdl: all handles need to go here back to back, no pointers |
| 947 | */ |
| 948 | struct ipa_ioc_del_hdr { |
| 949 | uint8_t commit; |
| 950 | uint8_t num_hdls; |
| 951 | struct ipa_hdr_del hdl[0]; |
| 952 | }; |
| 953 | |
| 954 | /** |
| 955 | * struct ipa_hdr_proc_ctx_del - processing context descriptor includes |
| 956 | * in and out parameters |
| 957 | * @hdl: handle returned from processing context add operation |
| 958 | * @status: out parameter, status of header remove operation, |
| 959 | * 0 for success, |
| 960 | * -1 for failure |
| 961 | */ |
| 962 | struct ipa_hdr_proc_ctx_del { |
| 963 | uint32_t hdl; |
| 964 | int status; |
| 965 | }; |
| 966 | |
| 967 | /** |
| 968 | * ipa_ioc_del_hdr_proc_ctx - processing context deletion parameters (support |
| 969 | * multiple headers and commit) |
| 970 | * @commit: should processing contexts be removed from IPA HW also? |
| 971 | * @num_hdls: num of processing contexts being removed |
| 972 | * @ipa_hdr_proc_ctx_del hdl: all handles need to go here back to back, |
| 973 | * no pointers |
| 974 | */ |
| 975 | struct ipa_ioc_del_hdr_proc_ctx { |
| 976 | uint8_t commit; |
| 977 | uint8_t num_hdls; |
| 978 | struct ipa_hdr_proc_ctx_del hdl[0]; |
| 979 | }; |
| 980 | |
| 981 | /** |
| 982 | * struct ipa_rt_rule_add - routing rule descriptor includes in |
| 983 | * and out parameters |
| 984 | * @rule: actual rule to be added |
| 985 | * @at_rear: add at back of routing table, it is NOT possible to add rules at |
| 986 | * the rear of the "default" routing tables |
| 987 | * @rt_rule_hdl: output parameter, handle to rule, valid when status is 0 |
| 988 | * @status: output parameter, status of routing rule add operation, |
| 989 | * 0 for success, |
| 990 | * -1 for failure |
| 991 | */ |
| 992 | struct ipa_rt_rule_add { |
| 993 | struct ipa_rt_rule rule; |
| 994 | uint8_t at_rear; |
| 995 | uint32_t rt_rule_hdl; |
| 996 | int status; |
| 997 | }; |
| 998 | |
| 999 | /** |
| 1000 | * struct ipa_ioc_add_rt_rule - routing rule addition parameters (supports |
| 1001 | * multiple rules and commit); |
| 1002 | * |
| 1003 | * all rules MUST be added to same table |
| 1004 | * @commit: should rules be written to IPA HW also? |
| 1005 | * @ip: IP family of rule |
| 1006 | * @rt_tbl_name: name of routing table resource |
| 1007 | * @num_rules: number of routing rules that follow |
| 1008 | * @ipa_rt_rule_add rules: all rules need to go back to back here, no pointers |
| 1009 | */ |
| 1010 | struct ipa_ioc_add_rt_rule { |
| 1011 | uint8_t commit; |
| 1012 | enum ipa_ip_type ip; |
| 1013 | char rt_tbl_name[IPA_RESOURCE_NAME_MAX]; |
| 1014 | uint8_t num_rules; |
| 1015 | struct ipa_rt_rule_add rules[0]; |
| 1016 | }; |
| 1017 | |
| 1018 | /** |
| 1019 | * struct ipa_ioc_add_rt_rule_after - routing rule addition after a specific |
| 1020 | * rule parameters(supports multiple rules and commit); |
| 1021 | * |
| 1022 | * all rules MUST be added to same table |
| 1023 | * @commit: should rules be written to IPA HW also? |
| 1024 | * @ip: IP family of rule |
| 1025 | * @rt_tbl_name: name of routing table resource |
| 1026 | * @num_rules: number of routing rules that follow |
| 1027 | * @add_after_hdl: the rules will be added after this specific rule |
| 1028 | * @ipa_rt_rule_add rules: all rules need to go back to back here, no pointers |
| 1029 | * at_rear field will be ignored when using this IOCTL |
| 1030 | */ |
| 1031 | struct ipa_ioc_add_rt_rule_after { |
| 1032 | uint8_t commit; |
| 1033 | enum ipa_ip_type ip; |
| 1034 | char rt_tbl_name[IPA_RESOURCE_NAME_MAX]; |
| 1035 | uint8_t num_rules; |
| 1036 | uint32_t add_after_hdl; |
| 1037 | struct ipa_rt_rule_add rules[0]; |
| 1038 | }; |
| 1039 | |
| 1040 | /** |
| 1041 | * struct ipa_rt_rule_mdfy - routing rule descriptor includes |
| 1042 | * in and out parameters |
| 1043 | * @rule: actual rule to be added |
| 1044 | * @rt_rule_hdl: handle to rule which supposed to modify |
| 1045 | * @status: output parameter, status of routing rule modify operation, |
| 1046 | * 0 for success, |
| 1047 | * -1 for failure |
| 1048 | * |
| 1049 | */ |
| 1050 | struct ipa_rt_rule_mdfy { |
| 1051 | struct ipa_rt_rule rule; |
| 1052 | uint32_t rt_rule_hdl; |
| 1053 | int status; |
| 1054 | }; |
| 1055 | |
| 1056 | /** |
| 1057 | * struct ipa_ioc_mdfy_rt_rule - routing rule modify parameters (supports |
| 1058 | * multiple rules and commit) |
| 1059 | * @commit: should rules be written to IPA HW also? |
| 1060 | * @ip: IP family of rule |
| 1061 | * @num_rules: number of routing rules that follow |
| 1062 | * @rules: all rules need to go back to back here, no pointers |
| 1063 | */ |
| 1064 | struct ipa_ioc_mdfy_rt_rule { |
| 1065 | uint8_t commit; |
| 1066 | enum ipa_ip_type ip; |
| 1067 | uint8_t num_rules; |
| 1068 | struct ipa_rt_rule_mdfy rules[0]; |
| 1069 | }; |
| 1070 | |
| 1071 | /** |
| 1072 | * struct ipa_rt_rule_del - routing rule descriptor includes in |
| 1073 | * and out parameters |
| 1074 | * @hdl: handle returned from route rule add operation |
| 1075 | * @status: output parameter, status of route rule delete operation, |
| 1076 | * 0 for success, |
| 1077 | * -1 for failure |
| 1078 | */ |
| 1079 | struct ipa_rt_rule_del { |
| 1080 | uint32_t hdl; |
| 1081 | int status; |
| 1082 | }; |
| 1083 | |
| 1084 | /** |
| 1085 | * struct ipa_ioc_del_rt_rule - routing rule deletion parameters (supports |
| 1086 | * multiple headers and commit) |
| 1087 | * @commit: should rules be removed from IPA HW also? |
| 1088 | * @ip: IP family of rules |
| 1089 | * @num_hdls: num of rules being removed |
| 1090 | * @ipa_rt_rule_del hdl: all handles need to go back to back here, no pointers |
| 1091 | */ |
| 1092 | struct ipa_ioc_del_rt_rule { |
| 1093 | uint8_t commit; |
| 1094 | enum ipa_ip_type ip; |
| 1095 | uint8_t num_hdls; |
| 1096 | struct ipa_rt_rule_del hdl[0]; |
| 1097 | }; |
| 1098 | |
| 1099 | /** |
| 1100 | * struct ipa_ioc_get_rt_tbl_indx - routing table index lookup parameters |
| 1101 | * @ip: IP family of table |
| 1102 | * @name: name of routing table resource |
| 1103 | * @index: output parameter, routing table index, valid only when ioctl |
| 1104 | * return val is non-negative |
| 1105 | */ |
| 1106 | struct ipa_ioc_get_rt_tbl_indx { |
| 1107 | enum ipa_ip_type ip; |
| 1108 | char name[IPA_RESOURCE_NAME_MAX]; |
| 1109 | uint32_t idx; |
| 1110 | }; |
| 1111 | |
| 1112 | /** |
| 1113 | * struct ipa_flt_rule_add - filtering rule descriptor includes |
| 1114 | * in and out parameters |
| 1115 | * @rule: actual rule to be added |
| 1116 | * @at_rear: add at back of filtering table? |
| 1117 | * @flt_rule_hdl: out parameter, handle to rule, valid when status is 0 |
| 1118 | * @status: output parameter, status of filtering rule add operation, |
| 1119 | * 0 for success, |
| 1120 | * -1 for failure |
| 1121 | * |
| 1122 | */ |
| 1123 | struct ipa_flt_rule_add { |
| 1124 | struct ipa_flt_rule rule; |
| 1125 | uint8_t at_rear; |
| 1126 | uint32_t flt_rule_hdl; |
| 1127 | int status; |
| 1128 | }; |
| 1129 | |
| 1130 | /** |
| 1131 | * struct ipa_ioc_add_flt_rule - filtering rule addition parameters (supports |
| 1132 | * multiple rules and commit) |
| 1133 | * all rules MUST be added to same table |
| 1134 | * @commit: should rules be written to IPA HW also? |
| 1135 | * @ip: IP family of rule |
| 1136 | * @ep: which "clients" pipe does this rule apply to? |
| 1137 | * valid only when global is 0 |
| 1138 | * @global: does this apply to global filter table of specific IP family |
| 1139 | * @num_rules: number of filtering rules that follow |
| 1140 | * @rules: all rules need to go back to back here, no pointers |
| 1141 | */ |
| 1142 | struct ipa_ioc_add_flt_rule { |
| 1143 | uint8_t commit; |
| 1144 | enum ipa_ip_type ip; |
| 1145 | enum ipa_client_type ep; |
| 1146 | uint8_t global; |
| 1147 | uint8_t num_rules; |
| 1148 | struct ipa_flt_rule_add rules[0]; |
| 1149 | }; |
| 1150 | |
| 1151 | /** |
| 1152 | * struct ipa_ioc_add_flt_rule_after - filtering rule addition after specific |
| 1153 | * rule parameters (supports multiple rules and commit) |
| 1154 | * all rules MUST be added to same table |
| 1155 | * @commit: should rules be written to IPA HW also? |
| 1156 | * @ip: IP family of rule |
| 1157 | * @ep: which "clients" pipe does this rule apply to? |
| 1158 | * @num_rules: number of filtering rules that follow |
| 1159 | * @add_after_hdl: rules will be added after the rule with this handle |
| 1160 | * @rules: all rules need to go back to back here, no pointers. at rear field |
| 1161 | * is ignored when using this IOCTL |
| 1162 | */ |
| 1163 | struct ipa_ioc_add_flt_rule_after { |
| 1164 | uint8_t commit; |
| 1165 | enum ipa_ip_type ip; |
| 1166 | enum ipa_client_type ep; |
| 1167 | uint8_t num_rules; |
| 1168 | uint32_t add_after_hdl; |
| 1169 | struct ipa_flt_rule_add rules[0]; |
| 1170 | }; |
| 1171 | |
| 1172 | /** |
| 1173 | * struct ipa_flt_rule_mdfy - filtering rule descriptor includes |
| 1174 | * in and out parameters |
| 1175 | * @rule: actual rule to be added |
| 1176 | * @flt_rule_hdl: handle to rule |
| 1177 | * @status: output parameter, status of filtering rule modify operation, |
| 1178 | * 0 for success, |
| 1179 | * -1 for failure |
| 1180 | * |
| 1181 | */ |
| 1182 | struct ipa_flt_rule_mdfy { |
| 1183 | struct ipa_flt_rule rule; |
| 1184 | uint32_t rule_hdl; |
| 1185 | int status; |
| 1186 | }; |
| 1187 | |
| 1188 | /** |
| 1189 | * struct ipa_ioc_mdfy_flt_rule - filtering rule modify parameters (supports |
| 1190 | * multiple rules and commit) |
| 1191 | * @commit: should rules be written to IPA HW also? |
| 1192 | * @ip: IP family of rule |
| 1193 | * @num_rules: number of filtering rules that follow |
| 1194 | * @rules: all rules need to go back to back here, no pointers |
| 1195 | */ |
| 1196 | struct ipa_ioc_mdfy_flt_rule { |
| 1197 | uint8_t commit; |
| 1198 | enum ipa_ip_type ip; |
| 1199 | uint8_t num_rules; |
| 1200 | struct ipa_flt_rule_mdfy rules[0]; |
| 1201 | }; |
| 1202 | |
| 1203 | /** |
| 1204 | * struct ipa_flt_rule_del - filtering rule descriptor includes |
| 1205 | * in and out parameters |
| 1206 | * |
| 1207 | * @hdl: handle returned from filtering rule add operation |
| 1208 | * @status: output parameter, status of filtering rule delete operation, |
| 1209 | * 0 for success, |
| 1210 | * -1 for failure |
| 1211 | */ |
| 1212 | struct ipa_flt_rule_del { |
| 1213 | uint32_t hdl; |
| 1214 | int status; |
| 1215 | }; |
| 1216 | |
| 1217 | /** |
| 1218 | * struct ipa_ioc_del_flt_rule - filtering rule deletion parameters (supports |
| 1219 | * multiple headers and commit) |
| 1220 | * @commit: should rules be removed from IPA HW also? |
| 1221 | * @ip: IP family of rules |
| 1222 | * @num_hdls: num of rules being removed |
| 1223 | * @hdl: all handles need to go back to back here, no pointers |
| 1224 | */ |
| 1225 | struct ipa_ioc_del_flt_rule { |
| 1226 | uint8_t commit; |
| 1227 | enum ipa_ip_type ip; |
| 1228 | uint8_t num_hdls; |
| 1229 | struct ipa_flt_rule_del hdl[0]; |
| 1230 | }; |
| 1231 | |
| 1232 | /** |
| 1233 | * struct ipa_ioc_get_rt_tbl - routing table lookup parameters, if lookup was |
| 1234 | * successful caller must call put to release the reference |
| 1235 | * count when done |
| 1236 | * @ip: IP family of table |
| 1237 | * @name: name of routing table resource |
| 1238 | * @htl: output parameter, handle of routing table, valid only when ioctl |
| 1239 | * return val is non-negative |
| 1240 | */ |
| 1241 | struct ipa_ioc_get_rt_tbl { |
| 1242 | enum ipa_ip_type ip; |
| 1243 | char name[IPA_RESOURCE_NAME_MAX]; |
| 1244 | uint32_t hdl; |
| 1245 | }; |
| 1246 | |
| 1247 | /** |
| 1248 | * struct ipa_ioc_query_intf - used to lookup number of tx and |
| 1249 | * rx properties of interface |
| 1250 | * @name: name of interface |
| 1251 | * @num_tx_props: output parameter, number of tx properties |
| 1252 | * valid only when ioctl return val is non-negative |
| 1253 | * @num_rx_props: output parameter, number of rx properties |
| 1254 | * valid only when ioctl return val is non-negative |
| 1255 | * @num_ext_props: output parameter, number of ext properties |
| 1256 | * valid only when ioctl return val is non-negative |
| 1257 | * @excp_pipe: exception packets of this interface should be |
| 1258 | * routed to this pipe |
| 1259 | */ |
| 1260 | struct ipa_ioc_query_intf { |
| 1261 | char name[IPA_RESOURCE_NAME_MAX]; |
| 1262 | uint32_t num_tx_props; |
| 1263 | uint32_t num_rx_props; |
| 1264 | uint32_t num_ext_props; |
| 1265 | enum ipa_client_type excp_pipe; |
| 1266 | }; |
| 1267 | |
| 1268 | /** |
| 1269 | * struct ipa_ioc_tx_intf_prop - interface tx property |
| 1270 | * @ip: IP family of routing rule |
| 1271 | * @attrib: routing rule |
| 1272 | * @dst_pipe: routing output pipe |
| 1273 | * @alt_dst_pipe: alternate routing output pipe |
| 1274 | * @hdr_name: name of associated header if any, empty string when no header |
| 1275 | * @hdr_l2_type: type of associated header if any, use NONE when no header |
| 1276 | */ |
| 1277 | struct ipa_ioc_tx_intf_prop { |
| 1278 | enum ipa_ip_type ip; |
| 1279 | struct ipa_rule_attrib attrib; |
| 1280 | enum ipa_client_type dst_pipe; |
| 1281 | enum ipa_client_type alt_dst_pipe; |
| 1282 | char hdr_name[IPA_RESOURCE_NAME_MAX]; |
| 1283 | enum ipa_hdr_l2_type hdr_l2_type; |
| 1284 | }; |
| 1285 | |
| 1286 | /** |
| 1287 | * struct ipa_ioc_query_intf_tx_props - interface tx propertie |
| 1288 | * @name: name of interface |
| 1289 | * @num_tx_props: number of TX properties |
| 1290 | * @tx[0]: output parameter, the tx properties go here back to back |
| 1291 | */ |
| 1292 | struct ipa_ioc_query_intf_tx_props { |
| 1293 | char name[IPA_RESOURCE_NAME_MAX]; |
| 1294 | uint32_t num_tx_props; |
| 1295 | struct ipa_ioc_tx_intf_prop tx[0]; |
| 1296 | }; |
| 1297 | |
| 1298 | /** |
| 1299 | * struct ipa_ioc_ext_intf_prop - interface extended property |
| 1300 | * @ip: IP family of routing rule |
| 1301 | * @eq_attrib: attributes of the rule in equation form |
| 1302 | * @action: action field |
| 1303 | * @rt_tbl_idx: index of RT table referred to by filter rule |
| 1304 | * @mux_id: MUX_ID |
| 1305 | * @filter_hdl: handle of filter (as specified by provider of filter rule) |
| 1306 | * @is_xlat_rule: it is xlat flt rule or not |
| 1307 | */ |
| 1308 | struct ipa_ioc_ext_intf_prop { |
| 1309 | enum ipa_ip_type ip; |
| 1310 | struct ipa_ipfltri_rule_eq eq_attrib; |
| 1311 | enum ipa_flt_action action; |
| 1312 | uint32_t rt_tbl_idx; |
| 1313 | uint8_t mux_id; |
| 1314 | uint32_t filter_hdl; |
| 1315 | uint8_t is_xlat_rule; |
| 1316 | uint32_t rule_id; |
| 1317 | uint8_t is_rule_hashable; |
| 1318 | }; |
| 1319 | |
| 1320 | /** |
| 1321 | * struct ipa_ioc_query_intf_ext_props - interface ext propertie |
| 1322 | * @name: name of interface |
| 1323 | * @num_ext_props: number of EXT properties |
| 1324 | * @ext[0]: output parameter, the ext properties go here back to back |
| 1325 | */ |
| 1326 | struct ipa_ioc_query_intf_ext_props { |
| 1327 | char name[IPA_RESOURCE_NAME_MAX]; |
| 1328 | uint32_t num_ext_props; |
| 1329 | struct ipa_ioc_ext_intf_prop ext[0]; |
| 1330 | }; |
| 1331 | |
| 1332 | /** |
| 1333 | * struct ipa_ioc_rx_intf_prop - interface rx property |
| 1334 | * @ip: IP family of filtering rule |
| 1335 | * @attrib: filtering rule |
| 1336 | * @src_pipe: input pipe |
| 1337 | * @hdr_l2_type: type of associated header if any, use NONE when no header |
| 1338 | */ |
| 1339 | struct ipa_ioc_rx_intf_prop { |
| 1340 | enum ipa_ip_type ip; |
| 1341 | struct ipa_rule_attrib attrib; |
| 1342 | enum ipa_client_type src_pipe; |
| 1343 | enum ipa_hdr_l2_type hdr_l2_type; |
| 1344 | }; |
| 1345 | |
| 1346 | /** |
| 1347 | * struct ipa_ioc_query_intf_rx_props - interface rx propertie |
| 1348 | * @name: name of interface |
| 1349 | * @num_rx_props: number of RX properties |
| 1350 | * @rx: output parameter, the rx properties go here back to back |
| 1351 | */ |
| 1352 | struct ipa_ioc_query_intf_rx_props { |
| 1353 | char name[IPA_RESOURCE_NAME_MAX]; |
| 1354 | uint32_t num_rx_props; |
| 1355 | struct ipa_ioc_rx_intf_prop rx[0]; |
| 1356 | }; |
| 1357 | |
| 1358 | /** |
| 1359 | * struct ipa_ioc_nat_alloc_mem - nat table memory allocation |
| 1360 | * properties |
| 1361 | * @dev_name: input parameter, the name of table |
| 1362 | * @size: input parameter, size of table in bytes |
| 1363 | * @offset: output parameter, offset into page in case of system memory |
| 1364 | */ |
| 1365 | struct ipa_ioc_nat_alloc_mem { |
| 1366 | char dev_name[IPA_RESOURCE_NAME_MAX]; |
| 1367 | size_t size; |
| 1368 | off_t offset; |
| 1369 | }; |
| 1370 | |
| 1371 | /** |
| 1372 | * struct ipa_ioc_v4_nat_init - nat table initialization |
| 1373 | * parameters |
| 1374 | * @tbl_index: input parameter, index of the table |
| 1375 | * @ipv4_rules_offset: input parameter, ipv4 rules address offset |
| 1376 | * @expn_rules_offset: input parameter, ipv4 expansion rules address offset |
| 1377 | * @index_offset: input parameter, index rules offset |
| 1378 | * @index_expn_offset: input parameter, index expansion rules offset |
| 1379 | * @table_entries: input parameter, ipv4 rules table size in entries |
| 1380 | * @expn_table_entries: input parameter, ipv4 expansion rules table size |
| 1381 | * @ip_addr: input parameter, public ip address |
| 1382 | */ |
| 1383 | struct ipa_ioc_v4_nat_init { |
| 1384 | uint8_t tbl_index; |
| 1385 | uint32_t ipv4_rules_offset; |
| 1386 | uint32_t expn_rules_offset; |
| 1387 | |
| 1388 | uint32_t index_offset; |
| 1389 | uint32_t index_expn_offset; |
| 1390 | |
| 1391 | uint16_t table_entries; |
| 1392 | uint16_t expn_table_entries; |
| 1393 | uint32_t ip_addr; |
| 1394 | }; |
| 1395 | |
| 1396 | /** |
| 1397 | * struct ipa_ioc_v4_nat_del - nat table delete parameter |
| 1398 | * @table_index: input parameter, index of the table |
| 1399 | * @public_ip_addr: input parameter, public ip address |
| 1400 | */ |
| 1401 | struct ipa_ioc_v4_nat_del { |
| 1402 | uint8_t table_index; |
| 1403 | uint32_t public_ip_addr; |
| 1404 | }; |
| 1405 | |
| 1406 | /** |
| 1407 | * struct ipa_ioc_nat_dma_one - nat dma command parameter |
| 1408 | * @table_index: input parameter, index of the table |
| 1409 | * @base_addr: type of table, from which the base address of the table |
| 1410 | * can be inferred |
| 1411 | * @offset: destination offset within the NAT table |
| 1412 | * @data: data to be written. |
| 1413 | */ |
| 1414 | struct ipa_ioc_nat_dma_one { |
| 1415 | uint8_t table_index; |
| 1416 | uint8_t base_addr; |
| 1417 | |
| 1418 | uint32_t offset; |
| 1419 | uint16_t data; |
| 1420 | |
| 1421 | }; |
| 1422 | |
| 1423 | /** |
| 1424 | * struct ipa_ioc_nat_dma_cmd - To hold multiple nat dma commands |
| 1425 | * @entries: number of dma commands in use |
| 1426 | * @dma: data pointer to the dma commands |
| 1427 | */ |
| 1428 | struct ipa_ioc_nat_dma_cmd { |
| 1429 | uint8_t entries; |
| 1430 | struct ipa_ioc_nat_dma_one dma[0]; |
| 1431 | |
| 1432 | }; |
| 1433 | |
| 1434 | /** |
Amir Levy | 05fccd0 | 2017-06-13 16:25:45 +0300 | [diff] [blame] | 1435 | * struct ipa_ioc_nat_pdn_entry - PDN entry modification data |
| 1436 | * @pdn_index: index of the entry in the PDN config table to be changed |
| 1437 | * @public_ip: PDN's public ip |
| 1438 | * @src_metadata: PDN's source NAT metadata for metadata replacement |
| 1439 | * @dst_metadata: PDN's destination NAT metadata for metadata replacement |
| 1440 | */ |
| 1441 | struct ipa_ioc_nat_pdn_entry { |
| 1442 | uint8_t pdn_index; |
| 1443 | uint32_t public_ip; |
| 1444 | uint32_t src_metadata; |
| 1445 | uint32_t dst_metadata; |
| 1446 | }; |
| 1447 | |
| 1448 | /** |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 1449 | * struct ipa_msg_meta - Format of the message meta-data. |
| 1450 | * @msg_type: the type of the message |
| 1451 | * @rsvd: reserved bits for future use. |
| 1452 | * @msg_len: the length of the message in bytes |
| 1453 | * |
| 1454 | * For push model: |
| 1455 | * Client in user-space should issue a read on the device (/dev/ipa) with a |
| 1456 | * sufficiently large buffer in a continuous loop, call will block when there is |
| 1457 | * no message to read. Upon return, client can read the ipa_msg_meta from start |
| 1458 | * of buffer to find out type and length of message |
| 1459 | * size of buffer supplied >= (size of largest message + size of metadata) |
| 1460 | * |
| 1461 | * For pull model: |
| 1462 | * Client in user-space can also issue a pull msg IOCTL to device (/dev/ipa) |
| 1463 | * with a payload containing space for the ipa_msg_meta and the message specific |
| 1464 | * payload length. |
| 1465 | * size of buffer supplied == (len of specific message + size of metadata) |
| 1466 | */ |
| 1467 | struct ipa_msg_meta { |
| 1468 | uint8_t msg_type; |
| 1469 | uint8_t rsvd; |
| 1470 | uint16_t msg_len; |
| 1471 | }; |
| 1472 | |
| 1473 | /** |
| 1474 | * struct ipa_wlan_msg - To hold information about wlan client |
| 1475 | * @name: name of the wlan interface |
| 1476 | * @mac_addr: mac address of wlan client |
| 1477 | * |
| 1478 | * wlan drivers need to pass name of wlan iface and mac address of |
| 1479 | * wlan client along with ipa_wlan_event, whenever a wlan client is |
| 1480 | * connected/disconnected/moved to power save/come out of power save |
| 1481 | */ |
| 1482 | struct ipa_wlan_msg { |
| 1483 | char name[IPA_RESOURCE_NAME_MAX]; |
| 1484 | uint8_t mac_addr[IPA_MAC_ADDR_SIZE]; |
| 1485 | }; |
| 1486 | |
| 1487 | /** |
| 1488 | * enum ipa_wlan_hdr_attrib_type - attribute type |
| 1489 | * in wlan client header |
| 1490 | * |
| 1491 | * WLAN_HDR_ATTRIB_MAC_ADDR: attrib type mac address |
| 1492 | * WLAN_HDR_ATTRIB_STA_ID: attrib type station id |
| 1493 | */ |
| 1494 | enum ipa_wlan_hdr_attrib_type { |
| 1495 | WLAN_HDR_ATTRIB_MAC_ADDR, |
| 1496 | WLAN_HDR_ATTRIB_STA_ID |
| 1497 | }; |
| 1498 | |
| 1499 | /** |
| 1500 | * struct ipa_wlan_hdr_attrib_val - header attribute value |
| 1501 | * @attrib_type: type of attribute |
| 1502 | * @offset: offset of attribute within header |
| 1503 | * @u.mac_addr: mac address |
| 1504 | * @u.sta_id: station id |
| 1505 | */ |
| 1506 | struct ipa_wlan_hdr_attrib_val { |
| 1507 | enum ipa_wlan_hdr_attrib_type attrib_type; |
| 1508 | uint8_t offset; |
| 1509 | union { |
| 1510 | uint8_t mac_addr[IPA_MAC_ADDR_SIZE]; |
| 1511 | uint8_t sta_id; |
| 1512 | } u; |
| 1513 | }; |
| 1514 | |
| 1515 | /** |
| 1516 | * struct ipa_wlan_msg_ex - To hold information about wlan client |
| 1517 | * @name: name of the wlan interface |
| 1518 | * @num_of_attribs: number of attributes |
| 1519 | * @attrib_val: holds attribute values |
| 1520 | * |
| 1521 | * wlan drivers need to pass name of wlan iface and mac address |
| 1522 | * of wlan client or station id along with ipa_wlan_event, |
| 1523 | * whenever a wlan client is connected/disconnected/moved to |
| 1524 | * power save/come out of power save |
| 1525 | */ |
| 1526 | struct ipa_wlan_msg_ex { |
| 1527 | char name[IPA_RESOURCE_NAME_MAX]; |
| 1528 | uint8_t num_of_attribs; |
| 1529 | struct ipa_wlan_hdr_attrib_val attribs[0]; |
| 1530 | }; |
| 1531 | |
| 1532 | struct ipa_ecm_msg { |
| 1533 | char name[IPA_RESOURCE_NAME_MAX]; |
| 1534 | int ifindex; |
| 1535 | }; |
| 1536 | |
| 1537 | /** |
| 1538 | * struct ipa_wan_msg - To hold information about wan client |
| 1539 | * @name: name of the wan interface |
| 1540 | * |
| 1541 | * CnE need to pass the name of default wan iface when connected/disconnected. |
| 1542 | * CNE need to pass the gw info in wlan AP+STA mode. |
| 1543 | * netmgr need to pass the name of wan eMBMS iface when connected. |
| 1544 | */ |
| 1545 | struct ipa_wan_msg { |
| 1546 | char upstream_ifname[IPA_RESOURCE_NAME_MAX]; |
| 1547 | char tethered_ifname[IPA_RESOURCE_NAME_MAX]; |
| 1548 | enum ipa_ip_type ip; |
| 1549 | uint32_t ipv4_addr_gw; |
| 1550 | uint32_t ipv6_addr_gw[IPA_WAN_MSG_IPv6_ADDR_GW_LEN]; |
| 1551 | }; |
| 1552 | |
| 1553 | /** |
| 1554 | * struct ipa_ioc_rm_dependency - parameters for add/delete dependency |
| 1555 | * @resource_name: name of dependent resource |
| 1556 | * @depends_on_name: name of its dependency |
| 1557 | */ |
| 1558 | struct ipa_ioc_rm_dependency { |
| 1559 | enum ipa_rm_resource_name resource_name; |
| 1560 | enum ipa_rm_resource_name depends_on_name; |
| 1561 | }; |
| 1562 | |
| 1563 | struct ipa_ioc_generate_flt_eq { |
| 1564 | enum ipa_ip_type ip; |
| 1565 | struct ipa_rule_attrib attrib; |
| 1566 | struct ipa_ipfltri_rule_eq eq_attrib; |
| 1567 | }; |
| 1568 | |
| 1569 | /** |
| 1570 | * struct ipa_ioc_write_qmapid - to write mux id to endpoint meta register |
| 1571 | * @mux_id: mux id of wan |
| 1572 | */ |
| 1573 | struct ipa_ioc_write_qmapid { |
| 1574 | enum ipa_client_type client; |
| 1575 | uint8_t qmap_id; |
| 1576 | }; |
| 1577 | |
| 1578 | enum ipacm_client_enum { |
| 1579 | IPACM_CLIENT_USB = 1, |
| 1580 | IPACM_CLIENT_WLAN, |
| 1581 | IPACM_CLIENT_MAX |
| 1582 | }; |
| 1583 | /** |
| 1584 | * actual IOCTLs supported by IPA driver |
| 1585 | */ |
| 1586 | #define IPA_IOC_ADD_HDR _IOWR(IPA_IOC_MAGIC, \ |
| 1587 | IPA_IOCTL_ADD_HDR, \ |
| 1588 | struct ipa_ioc_add_hdr *) |
| 1589 | #define IPA_IOC_DEL_HDR _IOWR(IPA_IOC_MAGIC, \ |
| 1590 | IPA_IOCTL_DEL_HDR, \ |
| 1591 | struct ipa_ioc_del_hdr *) |
| 1592 | #define IPA_IOC_ADD_RT_RULE _IOWR(IPA_IOC_MAGIC, \ |
| 1593 | IPA_IOCTL_ADD_RT_RULE, \ |
| 1594 | struct ipa_ioc_add_rt_rule *) |
| 1595 | #define IPA_IOC_ADD_RT_RULE_AFTER _IOWR(IPA_IOC_MAGIC, \ |
| 1596 | IPA_IOCTL_ADD_RT_RULE_AFTER, \ |
| 1597 | struct ipa_ioc_add_rt_rule_after *) |
| 1598 | #define IPA_IOC_DEL_RT_RULE _IOWR(IPA_IOC_MAGIC, \ |
| 1599 | IPA_IOCTL_DEL_RT_RULE, \ |
| 1600 | struct ipa_ioc_del_rt_rule *) |
| 1601 | #define IPA_IOC_ADD_FLT_RULE _IOWR(IPA_IOC_MAGIC, \ |
| 1602 | IPA_IOCTL_ADD_FLT_RULE, \ |
| 1603 | struct ipa_ioc_add_flt_rule *) |
| 1604 | #define IPA_IOC_ADD_FLT_RULE_AFTER _IOWR(IPA_IOC_MAGIC, \ |
| 1605 | IPA_IOCTL_ADD_FLT_RULE_AFTER, \ |
| 1606 | struct ipa_ioc_add_flt_rule_after *) |
| 1607 | #define IPA_IOC_DEL_FLT_RULE _IOWR(IPA_IOC_MAGIC, \ |
| 1608 | IPA_IOCTL_DEL_FLT_RULE, \ |
| 1609 | struct ipa_ioc_del_flt_rule *) |
| 1610 | #define IPA_IOC_COMMIT_HDR _IO(IPA_IOC_MAGIC,\ |
| 1611 | IPA_IOCTL_COMMIT_HDR) |
| 1612 | #define IPA_IOC_RESET_HDR _IO(IPA_IOC_MAGIC,\ |
| 1613 | IPA_IOCTL_RESET_HDR) |
| 1614 | #define IPA_IOC_COMMIT_RT _IOW(IPA_IOC_MAGIC, \ |
| 1615 | IPA_IOCTL_COMMIT_RT, \ |
| 1616 | enum ipa_ip_type) |
| 1617 | #define IPA_IOC_RESET_RT _IOW(IPA_IOC_MAGIC, \ |
| 1618 | IPA_IOCTL_RESET_RT, \ |
| 1619 | enum ipa_ip_type) |
| 1620 | #define IPA_IOC_COMMIT_FLT _IOW(IPA_IOC_MAGIC, \ |
| 1621 | IPA_IOCTL_COMMIT_FLT, \ |
| 1622 | enum ipa_ip_type) |
| 1623 | #define IPA_IOC_RESET_FLT _IOW(IPA_IOC_MAGIC, \ |
| 1624 | IPA_IOCTL_RESET_FLT, \ |
| 1625 | enum ipa_ip_type) |
| 1626 | #define IPA_IOC_DUMP _IO(IPA_IOC_MAGIC, \ |
| 1627 | IPA_IOCTL_DUMP) |
| 1628 | #define IPA_IOC_GET_RT_TBL _IOWR(IPA_IOC_MAGIC, \ |
| 1629 | IPA_IOCTL_GET_RT_TBL, \ |
| 1630 | struct ipa_ioc_get_rt_tbl *) |
| 1631 | #define IPA_IOC_PUT_RT_TBL _IOW(IPA_IOC_MAGIC, \ |
| 1632 | IPA_IOCTL_PUT_RT_TBL, \ |
| 1633 | uint32_t) |
| 1634 | #define IPA_IOC_COPY_HDR _IOWR(IPA_IOC_MAGIC, \ |
| 1635 | IPA_IOCTL_COPY_HDR, \ |
| 1636 | struct ipa_ioc_copy_hdr *) |
| 1637 | #define IPA_IOC_QUERY_INTF _IOWR(IPA_IOC_MAGIC, \ |
| 1638 | IPA_IOCTL_QUERY_INTF, \ |
| 1639 | struct ipa_ioc_query_intf *) |
| 1640 | #define IPA_IOC_QUERY_INTF_TX_PROPS _IOWR(IPA_IOC_MAGIC, \ |
| 1641 | IPA_IOCTL_QUERY_INTF_TX_PROPS, \ |
| 1642 | struct ipa_ioc_query_intf_tx_props *) |
| 1643 | #define IPA_IOC_QUERY_INTF_RX_PROPS _IOWR(IPA_IOC_MAGIC, \ |
| 1644 | IPA_IOCTL_QUERY_INTF_RX_PROPS, \ |
| 1645 | struct ipa_ioc_query_intf_rx_props *) |
| 1646 | #define IPA_IOC_QUERY_INTF_EXT_PROPS _IOWR(IPA_IOC_MAGIC, \ |
| 1647 | IPA_IOCTL_QUERY_INTF_EXT_PROPS, \ |
| 1648 | struct ipa_ioc_query_intf_ext_props *) |
| 1649 | #define IPA_IOC_GET_HDR _IOWR(IPA_IOC_MAGIC, \ |
| 1650 | IPA_IOCTL_GET_HDR, \ |
| 1651 | struct ipa_ioc_get_hdr *) |
| 1652 | #define IPA_IOC_PUT_HDR _IOW(IPA_IOC_MAGIC, \ |
| 1653 | IPA_IOCTL_PUT_HDR, \ |
| 1654 | uint32_t) |
| 1655 | #define IPA_IOC_ALLOC_NAT_MEM _IOWR(IPA_IOC_MAGIC, \ |
| 1656 | IPA_IOCTL_ALLOC_NAT_MEM, \ |
| 1657 | struct ipa_ioc_nat_alloc_mem *) |
| 1658 | #define IPA_IOC_V4_INIT_NAT _IOWR(IPA_IOC_MAGIC, \ |
| 1659 | IPA_IOCTL_V4_INIT_NAT, \ |
| 1660 | struct ipa_ioc_v4_nat_init *) |
| 1661 | #define IPA_IOC_NAT_DMA _IOWR(IPA_IOC_MAGIC, \ |
| 1662 | IPA_IOCTL_NAT_DMA, \ |
| 1663 | struct ipa_ioc_nat_dma_cmd *) |
| 1664 | #define IPA_IOC_V4_DEL_NAT _IOWR(IPA_IOC_MAGIC, \ |
| 1665 | IPA_IOCTL_V4_DEL_NAT, \ |
| 1666 | struct ipa_ioc_v4_nat_del *) |
| 1667 | #define IPA_IOC_GET_NAT_OFFSET _IOWR(IPA_IOC_MAGIC, \ |
| 1668 | IPA_IOCTL_GET_NAT_OFFSET, \ |
| 1669 | uint32_t *) |
Amir Levy | 05fccd0 | 2017-06-13 16:25:45 +0300 | [diff] [blame] | 1670 | #define IPA_IOC_NAT_MODIFY_PDN _IOWR(IPA_IOC_MAGIC, \ |
| 1671 | IPA_IOCTL_NAT_MODIFY_PDN, \ |
| 1672 | struct ipa_ioc_nat_pdn_entry *) |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 1673 | #define IPA_IOC_SET_FLT _IOW(IPA_IOC_MAGIC, \ |
| 1674 | IPA_IOCTL_SET_FLT, \ |
| 1675 | uint32_t) |
| 1676 | #define IPA_IOC_PULL_MSG _IOWR(IPA_IOC_MAGIC, \ |
| 1677 | IPA_IOCTL_PULL_MSG, \ |
| 1678 | struct ipa_msg_meta *) |
| 1679 | #define IPA_IOC_RM_ADD_DEPENDENCY _IOWR(IPA_IOC_MAGIC, \ |
| 1680 | IPA_IOCTL_RM_ADD_DEPENDENCY, \ |
| 1681 | struct ipa_ioc_rm_dependency *) |
| 1682 | #define IPA_IOC_RM_DEL_DEPENDENCY _IOWR(IPA_IOC_MAGIC, \ |
| 1683 | IPA_IOCTL_RM_DEL_DEPENDENCY, \ |
| 1684 | struct ipa_ioc_rm_dependency *) |
| 1685 | #define IPA_IOC_GENERATE_FLT_EQ _IOWR(IPA_IOC_MAGIC, \ |
| 1686 | IPA_IOCTL_GENERATE_FLT_EQ, \ |
| 1687 | struct ipa_ioc_generate_flt_eq *) |
| 1688 | #define IPA_IOC_QUERY_EP_MAPPING _IOR(IPA_IOC_MAGIC, \ |
| 1689 | IPA_IOCTL_QUERY_EP_MAPPING, \ |
| 1690 | uint32_t) |
| 1691 | #define IPA_IOC_QUERY_RT_TBL_INDEX _IOWR(IPA_IOC_MAGIC, \ |
| 1692 | IPA_IOCTL_QUERY_RT_TBL_INDEX, \ |
| 1693 | struct ipa_ioc_get_rt_tbl_indx *) |
| 1694 | #define IPA_IOC_WRITE_QMAPID _IOWR(IPA_IOC_MAGIC, \ |
| 1695 | IPA_IOCTL_WRITE_QMAPID, \ |
| 1696 | struct ipa_ioc_write_qmapid *) |
| 1697 | #define IPA_IOC_MDFY_FLT_RULE _IOWR(IPA_IOC_MAGIC, \ |
| 1698 | IPA_IOCTL_MDFY_FLT_RULE, \ |
| 1699 | struct ipa_ioc_mdfy_flt_rule *) |
| 1700 | #define IPA_IOC_MDFY_RT_RULE _IOWR(IPA_IOC_MAGIC, \ |
| 1701 | IPA_IOCTL_MDFY_RT_RULE, \ |
| 1702 | struct ipa_ioc_mdfy_rt_rule *) |
| 1703 | |
| 1704 | #define IPA_IOC_NOTIFY_WAN_UPSTREAM_ROUTE_ADD _IOWR(IPA_IOC_MAGIC, \ |
| 1705 | IPA_IOCTL_NOTIFY_WAN_UPSTREAM_ROUTE_ADD, \ |
| 1706 | struct ipa_wan_msg *) |
| 1707 | |
| 1708 | #define IPA_IOC_NOTIFY_WAN_UPSTREAM_ROUTE_DEL _IOWR(IPA_IOC_MAGIC, \ |
| 1709 | IPA_IOCTL_NOTIFY_WAN_UPSTREAM_ROUTE_DEL, \ |
| 1710 | struct ipa_wan_msg *) |
| 1711 | #define IPA_IOC_NOTIFY_WAN_EMBMS_CONNECTED _IOWR(IPA_IOC_MAGIC, \ |
| 1712 | IPA_IOCTL_NOTIFY_WAN_EMBMS_CONNECTED, \ |
| 1713 | struct ipa_wan_msg *) |
| 1714 | #define IPA_IOC_ADD_HDR_PROC_CTX _IOWR(IPA_IOC_MAGIC, \ |
| 1715 | IPA_IOCTL_ADD_HDR_PROC_CTX, \ |
| 1716 | struct ipa_ioc_add_hdr_proc_ctx *) |
| 1717 | #define IPA_IOC_DEL_HDR_PROC_CTX _IOWR(IPA_IOC_MAGIC, \ |
| 1718 | IPA_IOCTL_DEL_HDR_PROC_CTX, \ |
| 1719 | struct ipa_ioc_del_hdr_proc_ctx *) |
| 1720 | |
| 1721 | #define IPA_IOC_GET_HW_VERSION _IOWR(IPA_IOC_MAGIC, \ |
| 1722 | IPA_IOCTL_GET_HW_VERSION, \ |
| 1723 | enum ipa_hw_type *) |
| 1724 | |
| 1725 | /* |
| 1726 | * unique magic number of the Tethering bridge ioctls |
| 1727 | */ |
| 1728 | #define TETH_BRIDGE_IOC_MAGIC 0xCE |
| 1729 | |
| 1730 | /* |
| 1731 | * Ioctls supported by Tethering bridge driver |
| 1732 | */ |
| 1733 | #define TETH_BRIDGE_IOCTL_SET_BRIDGE_MODE 0 |
| 1734 | #define TETH_BRIDGE_IOCTL_SET_AGGR_PARAMS 1 |
| 1735 | #define TETH_BRIDGE_IOCTL_GET_AGGR_PARAMS 2 |
| 1736 | #define TETH_BRIDGE_IOCTL_GET_AGGR_CAPABILITIES 3 |
| 1737 | #define TETH_BRIDGE_IOCTL_MAX 4 |
| 1738 | |
| 1739 | |
| 1740 | /** |
| 1741 | * enum teth_link_protocol_type - link protocol (IP / Ethernet) |
| 1742 | */ |
| 1743 | enum teth_link_protocol_type { |
| 1744 | TETH_LINK_PROTOCOL_IP, |
| 1745 | TETH_LINK_PROTOCOL_ETHERNET, |
| 1746 | TETH_LINK_PROTOCOL_MAX, |
| 1747 | }; |
| 1748 | |
| 1749 | /** |
| 1750 | * enum teth_aggr_protocol_type - Aggregation protocol (MBIM / TLP) |
| 1751 | */ |
| 1752 | enum teth_aggr_protocol_type { |
| 1753 | TETH_AGGR_PROTOCOL_NONE, |
| 1754 | TETH_AGGR_PROTOCOL_MBIM, |
| 1755 | TETH_AGGR_PROTOCOL_TLP, |
| 1756 | TETH_AGGR_PROTOCOL_MAX, |
| 1757 | }; |
| 1758 | |
| 1759 | /** |
| 1760 | * struct teth_aggr_params_link - Aggregation parameters for uplink/downlink |
| 1761 | * @aggr_prot: Aggregation protocol (MBIM / TLP) |
| 1762 | * @max_transfer_size_byte: Maximal size of aggregated packet in bytes. |
| 1763 | * Default value is 16*1024. |
| 1764 | * @max_datagrams: Maximal number of IP packets in an aggregated |
| 1765 | * packet. Default value is 16 |
| 1766 | */ |
| 1767 | struct teth_aggr_params_link { |
| 1768 | enum teth_aggr_protocol_type aggr_prot; |
| 1769 | uint32_t max_transfer_size_byte; |
| 1770 | uint32_t max_datagrams; |
| 1771 | }; |
| 1772 | |
| 1773 | |
| 1774 | /** |
| 1775 | * struct teth_aggr_params - Aggregation parmeters |
| 1776 | * @ul: Uplink parameters |
| 1777 | * @dl: Downlink parmaeters |
| 1778 | */ |
| 1779 | struct teth_aggr_params { |
| 1780 | struct teth_aggr_params_link ul; |
| 1781 | struct teth_aggr_params_link dl; |
| 1782 | }; |
| 1783 | |
| 1784 | /** |
| 1785 | * struct teth_aggr_capabilities - Aggregation capabilities |
| 1786 | * @num_protocols: Number of protocols described in the array |
| 1787 | * @prot_caps[]: Array of aggregation capabilities per protocol |
| 1788 | */ |
| 1789 | struct teth_aggr_capabilities { |
| 1790 | uint16_t num_protocols; |
| 1791 | struct teth_aggr_params_link prot_caps[0]; |
| 1792 | }; |
| 1793 | |
| 1794 | /** |
| 1795 | * struct teth_ioc_set_bridge_mode |
| 1796 | * @link_protocol: link protocol (IP / Ethernet) |
| 1797 | * @lcid: logical channel number |
| 1798 | */ |
| 1799 | struct teth_ioc_set_bridge_mode { |
| 1800 | enum teth_link_protocol_type link_protocol; |
| 1801 | uint16_t lcid; |
| 1802 | }; |
| 1803 | |
| 1804 | /** |
| 1805 | * struct teth_ioc_set_aggr_params |
| 1806 | * @aggr_params: Aggregation parmeters |
| 1807 | * @lcid: logical channel number |
| 1808 | */ |
| 1809 | struct teth_ioc_aggr_params { |
| 1810 | struct teth_aggr_params aggr_params; |
| 1811 | uint16_t lcid; |
| 1812 | }; |
| 1813 | |
| 1814 | |
| 1815 | #define TETH_BRIDGE_IOC_SET_BRIDGE_MODE _IOW(TETH_BRIDGE_IOC_MAGIC, \ |
| 1816 | TETH_BRIDGE_IOCTL_SET_BRIDGE_MODE, \ |
| 1817 | struct teth_ioc_set_bridge_mode *) |
| 1818 | #define TETH_BRIDGE_IOC_SET_AGGR_PARAMS _IOW(TETH_BRIDGE_IOC_MAGIC, \ |
| 1819 | TETH_BRIDGE_IOCTL_SET_AGGR_PARAMS, \ |
| 1820 | struct teth_ioc_aggr_params *) |
| 1821 | #define TETH_BRIDGE_IOC_GET_AGGR_PARAMS _IOR(TETH_BRIDGE_IOC_MAGIC, \ |
| 1822 | TETH_BRIDGE_IOCTL_GET_AGGR_PARAMS, \ |
| 1823 | struct teth_ioc_aggr_params *) |
| 1824 | #define TETH_BRIDGE_IOC_GET_AGGR_CAPABILITIES _IOWR(TETH_BRIDGE_IOC_MAGIC, \ |
| 1825 | TETH_BRIDGE_IOCTL_GET_AGGR_CAPABILITIES, \ |
| 1826 | struct teth_aggr_capabilities *) |
| 1827 | |
| 1828 | /* |
| 1829 | * unique magic number of the ODU bridge ioctls |
| 1830 | */ |
| 1831 | #define ODU_BRIDGE_IOC_MAGIC 0xCD |
| 1832 | |
| 1833 | /* |
| 1834 | * Ioctls supported by ODU bridge driver |
| 1835 | */ |
| 1836 | #define ODU_BRIDGE_IOCTL_SET_MODE 0 |
| 1837 | #define ODU_BRIDGE_IOCTL_SET_LLV6_ADDR 1 |
| 1838 | #define ODU_BRIDGE_IOCTL_MAX 2 |
| 1839 | |
| 1840 | /** |
| 1841 | * enum odu_bridge_mode - bridge mode |
| 1842 | * (ROUTER MODE / BRIDGE MODE) |
| 1843 | */ |
| 1844 | enum odu_bridge_mode { |
| 1845 | ODU_BRIDGE_MODE_ROUTER, |
| 1846 | ODU_BRIDGE_MODE_BRIDGE, |
| 1847 | ODU_BRIDGE_MODE_MAX, |
| 1848 | }; |
| 1849 | |
| 1850 | #define ODU_BRIDGE_IOC_SET_MODE _IOW(ODU_BRIDGE_IOC_MAGIC, \ |
| 1851 | ODU_BRIDGE_IOCTL_SET_MODE, \ |
| 1852 | enum odu_bridge_mode) |
| 1853 | |
| 1854 | #define ODU_BRIDGE_IOC_SET_LLV6_ADDR _IOW(ODU_BRIDGE_IOC_MAGIC, \ |
| 1855 | ODU_BRIDGE_IOCTL_SET_LLV6_ADDR, \ |
| 1856 | struct in6_addr *) |
| 1857 | |
| 1858 | #endif /* _UAPI_MSM_IPA_H_ */ |