1 #ifndef _MSM_IPA_H_ 2 #define _MSM_IPA_H_ 3 4 #include <stdio.h> 5 #include <stdint.h> 6 #include <stddef.h> 7 #include <sys/stat.h> 8 #include <linux/ioctl.h> 9 #include <linux/types.h> 10 #include <linux/if_ether.h> 11 12 /** 13 * unique magic number of the IPA device 14 */ 15 #define IPA_IOC_MAGIC 0xCF 16 17 /** 18 * IPA device full path 19 */ 20 #define IPA_DEV_NAME "/dev/ipa" 21 22 /** 23 * IPA NAT table character device name 24 */ 25 #define IPA_NAT_DEV_NAME "ipaNatTable" 26 27 /** 28 * IPA IPv6CT table character device name 29 */ 30 #define IPA_IPV6CT_DEV_NAME "ipaIpv6CTTable" 31 32 /** 33 * name of the default routing tables for v4 and v6 34 */ 35 #define IPA_DFLT_RT_TBL_NAME "ipa_dflt_rt" 36 37 /** 38 * name for default value of invalid protocol of NAT 39 */ 40 #define IPAHAL_NAT_INVALID_PROTOCOL 0xFF 41 42 /** 43 * commands supported by IPA driver 44 */ 45 #define IPA_IOCTL_ADD_HDR 0 46 #define IPA_IOCTL_DEL_HDR 1 47 #define IPA_IOCTL_ADD_RT_RULE 2 48 #define IPA_IOCTL_DEL_RT_RULE 3 49 #define IPA_IOCTL_ADD_FLT_RULE 4 50 #define IPA_IOCTL_DEL_FLT_RULE 5 51 #define IPA_IOCTL_COMMIT_HDR 6 52 #define IPA_IOCTL_RESET_HDR 7 53 #define IPA_IOCTL_COMMIT_RT 8 54 #define IPA_IOCTL_RESET_RT 9 55 #define IPA_IOCTL_COMMIT_FLT 10 56 #define IPA_IOCTL_RESET_FLT 11 57 #define IPA_IOCTL_DUMP 12 58 #define IPA_IOCTL_GET_RT_TBL 13 59 #define IPA_IOCTL_PUT_RT_TBL 14 60 #define IPA_IOCTL_COPY_HDR 15 61 #define IPA_IOCTL_QUERY_INTF 16 62 #define IPA_IOCTL_QUERY_INTF_TX_PROPS 17 63 #define IPA_IOCTL_QUERY_INTF_RX_PROPS 18 64 #define IPA_IOCTL_GET_HDR 19 65 #define IPA_IOCTL_PUT_HDR 20 66 #define IPA_IOCTL_SET_FLT 21 67 #define IPA_IOCTL_ALLOC_NAT_MEM 22 68 #define IPA_IOCTL_V4_INIT_NAT 23 69 #define IPA_IOCTL_TABLE_DMA_CMD 24 70 #define IPA_IOCTL_NAT_DMA IPA_IOCTL_TABLE_DMA_CMD 71 #define IPA_IOCTL_INIT_IPV6CT_TABLE 25 72 #define IPA_IOCTL_V4_DEL_NAT 26 73 #define IPA_IOCTL_PULL_MSG 27 74 #define IPA_IOCTL_GET_NAT_OFFSET 28 75 #define IPA_IOCTL_RM_ADD_DEPENDENCY 29 76 #define IPA_IOCTL_RM_DEL_DEPENDENCY 30 77 #define IPA_IOCTL_GENERATE_FLT_EQ 31 78 #define IPA_IOCTL_QUERY_INTF_EXT_PROPS 32 79 #define IPA_IOCTL_QUERY_EP_MAPPING 33 80 #define IPA_IOCTL_QUERY_RT_TBL_INDEX 34 81 #define IPA_IOCTL_WRITE_QMAPID 35 82 #define IPA_IOCTL_MDFY_FLT_RULE 36 83 #define IPA_IOCTL_NOTIFY_WAN_UPSTREAM_ROUTE_ADD 37 84 #define IPA_IOCTL_NOTIFY_WAN_UPSTREAM_ROUTE_DEL 38 85 #define IPA_IOCTL_NOTIFY_WAN_EMBMS_CONNECTED 39 86 #define IPA_IOCTL_ADD_HDR_PROC_CTX 40 87 #define IPA_IOCTL_DEL_HDR_PROC_CTX 41 88 #define IPA_IOCTL_MDFY_RT_RULE 42 89 #define IPA_IOCTL_ADD_RT_RULE_AFTER 43 90 #define IPA_IOCTL_ADD_FLT_RULE_AFTER 44 91 #define IPA_IOCTL_GET_HW_VERSION 45 92 #define IPA_IOCTL_ADD_RT_RULE_EXT 46 93 #define IPA_IOCTL_ADD_VLAN_IFACE 47 94 #define IPA_IOCTL_DEL_VLAN_IFACE 48 95 #define IPA_IOCTL_ADD_L2TP_VLAN_MAPPING 49 96 #define IPA_IOCTL_DEL_L2TP_VLAN_MAPPING 50 97 #define IPA_IOCTL_NAT_MODIFY_PDN 51 98 #define IPA_IOCTL_ALLOC_NAT_TABLE 52 99 #define IPA_IOCTL_ALLOC_IPV6CT_TABLE 53 100 #define IPA_IOCTL_DEL_NAT_TABLE 54 101 #define IPA_IOCTL_DEL_IPV6CT_TABLE 55 102 #define IPA_IOCTL_CLEANUP 56 103 #define IPA_IOCTL_QUERY_WLAN_CLIENT 57 104 #define IPA_IOCTL_GET_VLAN_MODE 58 105 #define IPA_IOCTL_ADD_BRIDGE_VLAN_MAPPING 59 106 #define IPA_IOCTL_DEL_BRIDGE_VLAN_MAPPING 60 107 #define IPA_IOCTL_ODL_QUERY_ADAPL_EP_INFO 61 108 #define IPA_IOCTL_ODL_GET_AGG_BYTE_LIMIT 62 109 #define IPA_IOCTL_ODL_QUERY_MODEM_CONFIG 63 110 #define IPA_IOCTL_GSB_CONNECT 64 111 #define IPA_IOCTL_GSB_DISCONNECT 65 112 #define IPA_IOCTL_WIGIG_FST_SWITCH 66 113 #define IPA_IOCTL_ADD_RT_RULE_V2 67 114 #define IPA_IOCTL_ADD_RT_RULE_EXT_V2 68 115 #define IPA_IOCTL_ADD_RT_RULE_AFTER_V2 69 116 #define IPA_IOCTL_MDFY_RT_RULE_V2 70 117 #define IPA_IOCTL_ADD_FLT_RULE_V2 71 118 #define IPA_IOCTL_ADD_FLT_RULE_AFTER_V2 72 119 #define IPA_IOCTL_MDFY_FLT_RULE_V2 73 120 #define IPA_IOCTL_FNR_COUNTER_ALLOC 74 121 #define IPA_IOCTL_FNR_COUNTER_DEALLOC 75 122 #define IPA_IOCTL_FNR_COUNTER_QUERY 76 123 #define IPA_IOCTL_GET_NAT_IN_SRAM_INFO 77 124 #define IPA_IOCTL_GET_PHERIPHERAL_EP_INFO 78 125 #define IPA_IOCTL_APP_CLOCK_VOTE 79 126 #define IPA_IOCTL_PDN_CONFIG 80 127 #define IPA_IOCTL_SET_MAC_FLT 81 128 #define IPA_IOCTL_ADD_UC_ACT_ENTRY 82 129 #define IPA_IOCTL_DEL_UC_ACT_ENTRY 83 130 131 /** 132 * max size of the header to be inserted 133 */ 134 #define IPA_HDR_MAX_SIZE 128 135 136 /** 137 * max size of the name of the resource (routing table, header) 138 */ 139 #define IPA_RESOURCE_NAME_MAX 32 140 141 /** 142 * max number of interface properties 143 */ 144 #define IPA_NUM_PROPS_MAX 35 145 146 /** 147 * size of the mac address 148 */ 149 #define IPA_MAC_ADDR_SIZE 6 150 151 /** 152 * max number of mbim streams 153 */ 154 #define IPA_MBIM_MAX_STREAM_NUM 8 155 156 /** 157 * size of the ipv6 address 158 */ 159 #define IPA_WAN_MSG_IPv6_ADDR_GW_LEN 4 160 161 /** 162 * max number of lan clients supported per device type 163 * for LAN stats via HW. 164 */ 165 #define IPA_MAX_NUM_HW_PATH_CLIENTS 16 166 167 /** 168 * max number of destination pipes possible for a client. 169 */ 170 #define QMI_IPA_MAX_CLIENT_DST_PIPES 4 171 172 /** 173 * Max number of clients supported for mac based exception 174 */ 175 #define IPA_MAX_NUM_MAC_FLT 5 176 177 /** 178 * MAX number of the FLT_RT stats counter supported. 179 */ 180 #define IPA_MAX_FLT_RT_CNT_INDEX (128) 181 #define IPA_FLT_RT_HW_COUNTER (120) 182 #define IPA_FLT_RT_SW_COUNTER \ 183 (IPA_MAX_FLT_RT_CNT_INDEX - IPA_FLT_RT_HW_COUNTER) 184 #define IPA_MAX_FLT_RT_CLIENTS 60 185 186 /** 187 * New feature flag for CV2X config. 188 */ 189 190 #define IPA_CV2X_SUPPORT 191 192 /** 193 * the attributes of the rule (routing or filtering) 194 */ 195 #define IPA_FLT_TOS (1ul << 0) 196 #define IPA_FLT_PROTOCOL (1ul << 1) 197 #define IPA_FLT_SRC_ADDR (1ul << 2) 198 #define IPA_FLT_DST_ADDR (1ul << 3) 199 #define IPA_FLT_SRC_PORT_RANGE (1ul << 4) 200 #define IPA_FLT_DST_PORT_RANGE (1ul << 5) 201 #define IPA_FLT_TYPE (1ul << 6) 202 #define IPA_FLT_CODE (1ul << 7) 203 #define IPA_FLT_SPI (1ul << 8) 204 #define IPA_FLT_SRC_PORT (1ul << 9) 205 #define IPA_FLT_DST_PORT (1ul << 10) 206 #define IPA_FLT_TC (1ul << 11) 207 #define IPA_FLT_FLOW_LABEL (1ul << 12) 208 #define IPA_FLT_NEXT_HDR (1ul << 13) 209 #define IPA_FLT_META_DATA (1ul << 14) 210 #define IPA_FLT_FRAGMENT (1ul << 15) 211 #define IPA_FLT_TOS_MASKED (1ul << 16) 212 #define IPA_FLT_MAC_SRC_ADDR_ETHER_II (1ul << 17) 213 #define IPA_FLT_MAC_DST_ADDR_ETHER_II (1ul << 18) 214 #define IPA_FLT_MAC_SRC_ADDR_802_3 (1ul << 19) 215 #define IPA_FLT_MAC_DST_ADDR_802_3 (1ul << 20) 216 #define IPA_FLT_MAC_ETHER_TYPE (1ul << 21) 217 #define IPA_FLT_MAC_DST_ADDR_L2TP (1ul << 22) 218 #define IPA_FLT_TCP_SYN (1ul << 23) 219 #define IPA_FLT_TCP_SYN_L2TP (1ul << 24) 220 #define IPA_FLT_L2TP_INNER_IP_TYPE (1ul << 25) 221 #define IPA_FLT_L2TP_INNER_IPV4_DST_ADDR (1ul << 26) 222 #define IPA_FLT_IS_PURE_ACK (1ul << 27) 223 #define IPA_FLT_VLAN_ID (1ul << 28) 224 #define IPA_FLT_MAC_SRC_ADDR_802_1Q (1ul << 29) 225 #define IPA_FLT_MAC_DST_ADDR_802_1Q (1ul << 30) 226 #define IPA_FLT_L2TP_UDP_INNER_MAC_DST_ADDR (1ul << 31) 227 228 /* Extended attributes for the rule (routing or filtering) */ 229 #define IPA_FLT_EXT_L2TP_UDP_TCP_SYN (1ul << 0) 230 #define IPA_FLT_EXT_L2TP_UDP_INNER_ETHER_TYPE (1ul << 1) 231 #define IPA_FLT_EXT_MTU (1ul << 2) 232 #define IPA_FLT_EXT_L2TP_UDP_INNER_NEXT_HDR (1ul << 3) 233 #define IPA_FLT_EXT_NEXT_HDR (1ul << 4) 234 235 /** 236 * maximal number of NAT PDNs in the PDN config table 237 */ 238 #define IPA_MAX_PDN_NUM 5 239 240 /** 241 * enum ipa_client_type - names for the various IPA "clients" 242 * these are from the perspective of the clients, for e.g. 243 * HSIC1_PROD means HSIC client is the producer and IPA is the 244 * consumer. 245 * PROD clients are always even, and CONS clients are always odd. 246 * Add new clients in the end of the list or replace reserved one, 247 * update IPA_CLIENT_MAX and update the strings array ipa_clients_strings[] 248 * while keeping the ordering of the clients the same 249 */ 250 enum ipa_client_type { 251 IPA_CLIENT_HSIC1_PROD = 0, 252 IPA_CLIENT_HSIC1_CONS = 1, 253 254 IPA_CLIENT_HSIC2_PROD = 2, 255 IPA_CLIENT_HSIC2_CONS = 3, 256 257 IPA_CLIENT_HSIC3_PROD = 4, 258 IPA_CLIENT_HSIC3_CONS = 5, 259 260 IPA_CLIENT_HSIC4_PROD = 6, 261 IPA_CLIENT_HSIC4_CONS = 7, 262 263 IPA_CLIENT_HSIC5_PROD = 8, 264 IPA_CLIENT_HSIC5_CONS = 9, 265 266 IPA_CLIENT_WLAN1_PROD = 10, 267 IPA_CLIENT_WLAN1_CONS = 11, 268 269 IPA_CLIENT_A5_WLAN_AMPDU_PROD = 12, 270 IPA_CLIENT_WLAN2_CONS = 13, 271 272 /* RESERVED PROD = 14, */ 273 IPA_CLIENT_WLAN3_CONS = 15, 274 275 /* RESERVED PROD = 16, */ 276 IPA_CLIENT_WLAN4_CONS = 17, 277 278 IPA_CLIENT_USB_PROD = 18, 279 IPA_CLIENT_USB_CONS = 19, 280 281 IPA_CLIENT_USB2_PROD = 20, 282 IPA_CLIENT_USB2_CONS = 21, 283 284 IPA_CLIENT_USB3_PROD = 22, 285 IPA_CLIENT_USB3_CONS = 23, 286 287 IPA_CLIENT_USB4_PROD = 24, 288 IPA_CLIENT_USB4_CONS = 25, 289 290 IPA_CLIENT_UC_USB_PROD = 26, 291 IPA_CLIENT_USB_DPL_CONS = 27, 292 293 IPA_CLIENT_A2_EMBEDDED_PROD = 28, 294 IPA_CLIENT_A2_EMBEDDED_CONS = 29, 295 296 IPA_CLIENT_A2_TETHERED_PROD = 30, 297 IPA_CLIENT_A2_TETHERED_CONS = 31, 298 299 IPA_CLIENT_APPS_LAN_PROD = 32, 300 IPA_CLIENT_APPS_LAN_CONS = 33, 301 302 IPA_CLIENT_APPS_WAN_PROD = 34, 303 IPA_CLIENT_APPS_LAN_WAN_PROD = IPA_CLIENT_APPS_WAN_PROD, 304 IPA_CLIENT_APPS_WAN_CONS = 35, 305 306 IPA_CLIENT_APPS_CMD_PROD = 36, 307 IPA_CLIENT_A5_LAN_WAN_CONS = 37, 308 309 IPA_CLIENT_ODU_PROD = 38, 310 IPA_CLIENT_ODU_EMB_CONS = 39, 311 312 /* RESERVED PROD = 40, */ 313 IPA_CLIENT_ODU_TETH_CONS = 41, 314 315 IPA_CLIENT_MHI_PROD = 42, 316 IPA_CLIENT_MHI_CONS = 43, 317 318 IPA_CLIENT_MEMCPY_DMA_SYNC_PROD = 44, 319 IPA_CLIENT_MEMCPY_DMA_SYNC_CONS = 45, 320 321 IPA_CLIENT_MEMCPY_DMA_ASYNC_PROD = 46, 322 IPA_CLIENT_MEMCPY_DMA_ASYNC_CONS = 47, 323 324 IPA_CLIENT_ETHERNET_PROD = 48, 325 IPA_CLIENT_ETHERNET_CONS = 49, 326 327 IPA_CLIENT_Q6_LAN_PROD = 50, 328 IPA_CLIENT_Q6_LAN_CONS = 51, 329 330 IPA_CLIENT_Q6_WAN_PROD = 52, 331 IPA_CLIENT_Q6_WAN_CONS = 53, 332 333 IPA_CLIENT_Q6_CMD_PROD = 54, 334 IPA_CLIENT_Q6_DUN_CONS = 55, 335 336 IPA_CLIENT_Q6_DECOMP_PROD = 56, 337 IPA_CLIENT_Q6_DECOMP_CONS = 57, 338 339 IPA_CLIENT_Q6_DECOMP2_PROD = 58, 340 IPA_CLIENT_Q6_DECOMP2_CONS = 59, 341 342 /* RESERVED PROD = 60, */ 343 IPA_CLIENT_Q6_LTE_WIFI_AGGR_CONS = 61, 344 345 IPA_CLIENT_TEST_PROD = 62, 346 IPA_CLIENT_TEST_CONS = 63, 347 348 IPA_CLIENT_TEST1_PROD = 64, 349 IPA_CLIENT_TEST1_CONS = 65, 350 351 IPA_CLIENT_TEST2_PROD = 66, 352 IPA_CLIENT_TEST2_CONS = 67, 353 354 IPA_CLIENT_TEST3_PROD = 68, 355 IPA_CLIENT_TEST3_CONS = 69, 356 357 IPA_CLIENT_TEST4_PROD = 70, 358 IPA_CLIENT_TEST4_CONS = 71, 359 360 /* RESERVED PROD = 72, */ 361 IPA_CLIENT_DUMMY_CONS = 73, 362 363 IPA_CLIENT_Q6_DL_NLO_DATA_PROD = 74, 364 IPA_CLIENT_Q6_UL_NLO_DATA_CONS = 75, 365 366 /* RESERVERD PROD = 76, */ 367 IPA_CLIENT_Q6_UL_NLO_ACK_CONS = 77, 368 369 /* RESERVERD PROD = 78, */ 370 IPA_CLIENT_Q6_QBAP_STATUS_CONS = 79, 371 372 /* RESERVERD PROD = 80, */ 373 IPA_CLIENT_MHI_DPL_CONS = 81, 374 375 /* RESERVERD PROD = 82, */ 376 IPA_CLIENT_ODL_DPL_CONS = 83, 377 378 IPA_CLIENT_Q6_AUDIO_DMA_MHI_PROD = 84, 379 IPA_CLIENT_Q6_AUDIO_DMA_MHI_CONS = 85, 380 381 /* RESERVED PROD = 86, */ 382 IPA_CLIENT_APPS_WAN_COAL_CONS = 87, 383 384 IPA_CLIENT_WIGIG_PROD = 88, 385 IPA_CLIENT_WIGIG1_CONS = 89, 386 387 /* RESERVERD PROD = 90, */ 388 IPA_CLIENT_WIGIG2_CONS = 91, 389 390 /* RESERVERD PROD = 92, */ 391 IPA_CLIENT_WIGIG3_CONS = 93, 392 393 /* RESERVERD PROD = 94, */ 394 IPA_CLIENT_WIGIG4_CONS = 95, 395 396 IPA_CLIENT_AQC_ETHERNET_PROD = 96, 397 IPA_CLIENT_AQC_ETHERNET_CONS = 97, 398 399 IPA_CLIENT_MHI_PRIME_TETH_PROD = 98, 400 IPA_CLIENT_MHI_PRIME_TETH_CONS = 99, 401 402 IPA_CLIENT_MHI_PRIME_RMNET_PROD = 100, 403 IPA_CLIENT_MHI_PRIME_RMNET_CONS = 101, 404 405 IPA_CLIENT_MHI_PRIME_DPL_PROD = 102, 406 /* RESERVERD CONS = 103, */ 407 408 IPA_CLIENT_MHI2_PROD = 104, 409 IPA_CLIENT_MHI2_CONS = 105, 410 411 IPA_CLIENT_Q6_CV2X_PROD = 106, 412 IPA_CLIENT_Q6_CV2X_CONS = 107, 413 414 IPA_CLIENT_MHI_LOW_LAT_PROD = 108, 415 IPA_CLIENT_MHI_LOW_LAT_CONS = 109, 416 417 IPA_CLIENT_QDSS_PROD = 110, 418 IPA_CLIENT_MHI_QDSS_CONS = 111, 419 420 IPA_CLIENT_ETHERNET2_PROD = 112, 421 IPA_CLIENT_ETHERNET2_CONS = 113, 422 }; 423 424 #define IPA_CLIENT_MAX (IPA_CLIENT_ETHERNET2_CONS + 1) 425 426 #define IPA_CLIENT_WLAN2_PROD IPA_CLIENT_A5_WLAN_AMPDU_PROD 427 #define IPA_CLIENT_Q6_DL_NLO_DATA_PROD IPA_CLIENT_Q6_DL_NLO_DATA_PROD 428 #define IPA_CLIENT_Q6_UL_NLO_ACK_CONS IPA_CLIENT_Q6_UL_NLO_ACK_CONS 429 #define IPA_CLIENT_Q6_QBAP_STATUS_CONS IPA_CLIENT_Q6_QBAP_STATUS_CONS 430 #define IPA_CLIENT_MHI_DPL_CONS IPA_CLIENT_MHI_DPL_CONS 431 #define IPA_CLIENT_Q6_AUDIO_DMA_MHI_PROD IPA_CLIENT_Q6_AUDIO_DMA_MHI_PROD 432 #define IPA_CLIENT_Q6_AUDIO_DMA_MHI_CONS IPA_CLIENT_Q6_AUDIO_DMA_MHI_CONS 433 #define IPA_CLIENT_WIGIG_PROD IPA_CLIENT_WIGIG_PROD 434 #define IPA_CLIENT_WIGIG1_CONS IPA_CLIENT_WIGIG1_CONS 435 #define IPA_CLIENT_WIGIG2_CONS IPA_CLIENT_WIGIG2_CONS 436 #define IPA_CLIENT_WIGIG3_CONS IPA_CLIENT_WIGIG3_CONS 437 #define IPA_CLIENT_WIGIG4_CONS IPA_CLIENT_WIGIG4_CONS 438 #define IPA_CLIENT_AQC_ETHERNET_PROD IPA_CLIENT_AQC_ETHERNET_PROD 439 #define IPA_CLIENT_AQC_ETHERNET_CONS IPA_CLIENT_AQC_ETHERNET_CONS 440 #define IPA_CLIENT_MHI_PRIME_TETH_PROD IPA_CLIENT_MHI_PRIME_TETH_PROD 441 #define IPA_CLIENT_MHI_PRIME_TETH_CONS IPA_CLIENT_MHI_PRIME_TETH_CONS 442 #define IPA_CLIENT_MHI_PRIME_RMNET_PROD IPA_CLIENT_MHI_PRIME_RMNET_PROD 443 #define IPA_CLIENT_MHI_PRIME_RMNET_CONS IPA_CLIENT_MHI_PRIME_RMNET_CONS 444 #define IPA_CLIENT_MHI_PRIME_DPL_PROD IPA_CLIENT_MHI_PRIME_DPL_PROD 445 #define IPA_CLIENT_MHI_QDSS_CONS IPA_CLIENT_MHI_QDSS_CONS 446 #define IPA_CLIENT_QDSS_PROD IPA_CLIENT_QDSS_PROD 447 448 #define IPA_CLIENT_IS_APPS_CONS(client) \ 449 ((client) == IPA_CLIENT_APPS_LAN_CONS || \ 450 (client) == IPA_CLIENT_APPS_WAN_CONS || \ 451 (client) == IPA_CLIENT_APPS_WAN_COAL_CONS) 452 453 #define IPA_CLIENT_IS_APPS_PROD(client) \ 454 ((client) == IPA_CLIENT_APPS_LAN_PROD || \ 455 (client) == IPA_CLIENT_APPS_WAN_PROD) 456 457 #define IPA_CLIENT_IS_USB_CONS(client) \ 458 ((client) == IPA_CLIENT_USB_CONS || \ 459 (client) == IPA_CLIENT_USB2_CONS || \ 460 (client) == IPA_CLIENT_USB3_CONS || \ 461 (client) == IPA_CLIENT_USB_DPL_CONS || \ 462 (client) == IPA_CLIENT_USB4_CONS) 463 464 #define IPA_CLIENT_IS_WAN_CONS(client) \ 465 ((client) == IPA_CLIENT_APPS_WAN_CONS || \ 466 (client) == IPA_CLIENT_APPS_WAN_COAL_CONS) 467 468 #define IPA_CLIENT_IS_WLAN_CONS(client) \ 469 ((client) == IPA_CLIENT_WLAN1_CONS || \ 470 (client) == IPA_CLIENT_WLAN2_CONS || \ 471 (client) == IPA_CLIENT_WLAN3_CONS || \ 472 (client) == IPA_CLIENT_WLAN4_CONS) 473 474 #define IPA_CLIENT_IS_ODU_CONS(client) \ 475 ((client) == IPA_CLIENT_ODU_EMB_CONS || \ 476 (client) == IPA_CLIENT_ODU_TETH_CONS) 477 478 #define IPA_CLIENT_IS_Q6_CONS(client) \ 479 ((client) == IPA_CLIENT_Q6_LAN_CONS || \ 480 (client) == IPA_CLIENT_Q6_WAN_CONS || \ 481 (client) == IPA_CLIENT_Q6_DUN_CONS || \ 482 (client) == IPA_CLIENT_Q6_DECOMP_CONS || \ 483 (client) == IPA_CLIENT_Q6_DECOMP2_CONS || \ 484 (client) == IPA_CLIENT_Q6_LTE_WIFI_AGGR_CONS || \ 485 (client) == IPA_CLIENT_Q6_UL_NLO_DATA_CONS || \ 486 (client) == IPA_CLIENT_Q6_UL_NLO_ACK_CONS || \ 487 (client) == IPA_CLIENT_Q6_QBAP_STATUS_CONS || \ 488 (client) == IPA_CLIENT_Q6_CV2X_CONS || \ 489 (client) == IPA_CLIENT_Q6_AUDIO_DMA_MHI_CONS) 490 491 #define IPA_CLIENT_IS_Q6_PROD(client) \ 492 ((client) == IPA_CLIENT_Q6_LAN_PROD || \ 493 (client) == IPA_CLIENT_Q6_WAN_PROD || \ 494 (client) == IPA_CLIENT_Q6_CMD_PROD || \ 495 (client) == IPA_CLIENT_Q6_DECOMP_PROD || \ 496 (client) == IPA_CLIENT_Q6_DECOMP2_PROD || \ 497 (client) == IPA_CLIENT_Q6_DL_NLO_DATA_PROD || \ 498 (client) == IPA_CLIENT_Q6_CV2X_PROD || \ 499 (client) == IPA_CLIENT_Q6_AUDIO_DMA_MHI_PROD) 500 501 #define IPA_CLIENT_IS_Q6_NON_ZIP_CONS(client) \ 502 ((client) == IPA_CLIENT_Q6_LAN_CONS || \ 503 (client) == IPA_CLIENT_Q6_WAN_CONS || \ 504 (client) == IPA_CLIENT_Q6_DUN_CONS || \ 505 (client) == IPA_CLIENT_Q6_LTE_WIFI_AGGR_CONS || \ 506 (client) == IPA_CLIENT_Q6_UL_NLO_DATA_CONS || \ 507 (client) == IPA_CLIENT_Q6_UL_NLO_ACK_CONS || \ 508 (client) == IPA_CLIENT_Q6_QBAP_STATUS_CONS || \ 509 (client) == IPA_CLIENT_Q6_CV2X_CONS || \ 510 (client) == IPA_CLIENT_Q6_AUDIO_DMA_MHI_CONS) 511 512 #define IPA_CLIENT_IS_Q6_ZIP_CONS(client) \ 513 ((client) == IPA_CLIENT_Q6_DECOMP_CONS || \ 514 (client) == IPA_CLIENT_Q6_DECOMP2_CONS) 515 516 #define IPA_CLIENT_IS_Q6_NON_ZIP_PROD(client) \ 517 ((client) == IPA_CLIENT_Q6_LAN_PROD || \ 518 (client) == IPA_CLIENT_Q6_WAN_PROD || \ 519 (client) == IPA_CLIENT_Q6_CMD_PROD || \ 520 (client) == IPA_CLIENT_Q6_DL_NLO_DATA_PROD || \ 521 (client) == IPA_CLIENT_Q6_CV2X_PROD || \ 522 (client) == IPA_CLIENT_Q6_AUDIO_DMA_MHI_PROD) 523 524 #define IPA_CLIENT_IS_Q6_ZIP_PROD(client) \ 525 ((client) == IPA_CLIENT_Q6_DECOMP_PROD || \ 526 (client) == IPA_CLIENT_Q6_DECOMP2_PROD) 527 528 #define IPA_CLIENT_IS_MEMCPY_DMA_CONS(client) \ 529 ((client) == IPA_CLIENT_MEMCPY_DMA_SYNC_CONS || \ 530 (client) == IPA_CLIENT_MEMCPY_DMA_ASYNC_CONS) 531 532 #define IPA_CLIENT_IS_MEMCPY_DMA_PROD(client) \ 533 ((client) == IPA_CLIENT_MEMCPY_DMA_SYNC_PROD || \ 534 (client) == IPA_CLIENT_MEMCPY_DMA_ASYNC_PROD) 535 536 #define IPA_CLIENT_IS_MHI(client) \ 537 ((client) == IPA_CLIENT_MHI_CONS || \ 538 (client) == IPA_CLIENT_MHI_PROD || \ 539 (client) == IPA_CLIENT_MHI2_PROD || \ 540 (client) == IPA_CLIENT_MHI2_CONS || \ 541 (client) == IPA_CLIENT_MHI_LOW_LAT_PROD || \ 542 (client) == IPA_CLIENT_MHI_LOW_LAT_CONS || \ 543 (client) == IPA_CLIENT_MHI_DPL_CONS || \ 544 (client) == IPA_CLIENT_MHI_QDSS_CONS) 545 546 #define IPA_CLIENT_IS_TEST_PROD(client) \ 547 ((client) == IPA_CLIENT_TEST_PROD || \ 548 (client) == IPA_CLIENT_TEST1_PROD || \ 549 (client) == IPA_CLIENT_TEST2_PROD || \ 550 (client) == IPA_CLIENT_TEST3_PROD || \ 551 (client) == IPA_CLIENT_TEST4_PROD) 552 553 #define IPA_CLIENT_IS_TEST_CONS(client) \ 554 ((client) == IPA_CLIENT_TEST_CONS || \ 555 (client) == IPA_CLIENT_TEST1_CONS || \ 556 (client) == IPA_CLIENT_TEST2_CONS || \ 557 (client) == IPA_CLIENT_TEST3_CONS || \ 558 (client) == IPA_CLIENT_TEST4_CONS) 559 560 #define IPA_CLIENT_IS_TEST(client) \ 561 (IPA_CLIENT_IS_TEST_PROD(client) || IPA_CLIENT_IS_TEST_CONS(client)) 562 563 /** 564 * The following is used to describe the types of memory NAT can 565 * reside in. 566 * 567 * PLEASE KEEP THE FOLLOWING IN SYNC WITH ipa3_nat_mem_in_as_str() 568 * BELOW. 569 */ 570 enum ipa3_nat_mem_in { 571 IPA_NAT_MEM_IN_DDR = 0, 572 IPA_NAT_MEM_IN_SRAM = 1, 573 574 IPA_NAT_MEM_IN_MAX 575 }; 576 577 #define IPA_VALID_NAT_MEM_IN(t) \ 578 ((t) >= IPA_NAT_MEM_IN_DDR && (t) < IPA_NAT_MEM_IN_MAX) 579 580 /** 581 * enum ipa_ip_type - Address family: IPv4 or IPv6 582 * 583 * PLEASE KEEP THE FOLLOWING IN SYNC WITH ipa_ip_type_as_str() 584 * BELOW. 585 */ 586 enum ipa_ip_type { 587 IPA_IP_v4, 588 IPA_IP_v6, 589 IPA_IP_MAX 590 }; 591 592 #define VALID_IPA_IP_TYPE(t) \ 593 ((t) >= IPA_IP_v4 && (t) < IPA_IP_MAX) 594 595 /** 596 * enum ipa_rule_type - Type of routing or filtering rule 597 * Hashable: Rule will be located at the hashable tables 598 * Non_Hashable: Rule will be located at the non-hashable tables 599 */ 600 enum ipa_rule_type { 601 IPA_RULE_HASHABLE, 602 IPA_RULE_NON_HASHABLE, 603 }; 604 #define IPA_RULE_TYPE_MAX (IPA_RULE_NON_HASHABLE + 1) 605 606 /** 607 * enum ipa_flt_action - action field of filtering rule 608 * 609 * Pass to routing: 5'd0 610 * Pass to source NAT: 5'd1 611 * Pass to destination NAT: 5'd2 612 * Pass to default output pipe (e.g., Apps or Modem): 5'd3 613 */ 614 enum ipa_flt_action { 615 IPA_PASS_TO_ROUTING, 616 IPA_PASS_TO_SRC_NAT, 617 IPA_PASS_TO_DST_NAT, 618 IPA_PASS_TO_EXCEPTION 619 }; 620 621 /** 622 * enum ipa_wlan_event - Events for wlan client 623 * 624 * wlan client connect: New wlan client connected 625 * wlan client disconnect: wlan client disconnected 626 * wlan client power save: wlan client moved to power save 627 * wlan client normal: wlan client moved out of power save 628 * sw routing enable: ipa routing is disabled 629 * sw routing disable: ipa routing is enabled 630 * wlan ap connect: wlan AP(access point) is up 631 * wlan ap disconnect: wlan AP(access point) is down 632 * wlan sta connect: wlan STA(station) is up 633 * wlan sta disconnect: wlan STA(station) is down 634 * wlan client connect ex: new wlan client connected 635 * wlan scc switch: wlan interfaces in scc mode 636 * wlan mcc switch: wlan interfaces in mcc mode 637 * wlan wdi enable: wdi data path completed 638 * wlan wdi disable: wdi data path teardown 639 */ 640 enum ipa_wlan_event { 641 WLAN_CLIENT_CONNECT, 642 WLAN_CLIENT_DISCONNECT, 643 WLAN_CLIENT_POWER_SAVE_MODE, 644 WLAN_CLIENT_NORMAL_MODE, 645 SW_ROUTING_ENABLE, 646 SW_ROUTING_DISABLE, 647 WLAN_AP_CONNECT, 648 WLAN_AP_DISCONNECT, 649 WLAN_STA_CONNECT, 650 WLAN_STA_DISCONNECT, 651 WLAN_CLIENT_CONNECT_EX, 652 WLAN_SWITCH_TO_SCC, 653 WLAN_SWITCH_TO_MCC, 654 WLAN_WDI_ENABLE, 655 WLAN_WDI_DISABLE, 656 IPA_WLAN_EVENT_MAX 657 }; 658 659 /** 660 * enum ipa_wan_event - Events for wan client 661 * 662 * wan default route add/del 663 * wan embms connect: New wan embms interface connected 664 */ 665 enum ipa_wan_event { 666 WAN_UPSTREAM_ROUTE_ADD = IPA_WLAN_EVENT_MAX, 667 WAN_UPSTREAM_ROUTE_DEL, 668 WAN_EMBMS_CONNECT, 669 WAN_XLAT_CONNECT, 670 IPA_WAN_EVENT_MAX 671 }; 672 673 enum ipa_ecm_event { 674 ECM_CONNECT = IPA_WAN_EVENT_MAX, 675 ECM_DISCONNECT, 676 IPA_ECM_EVENT_MAX, 677 }; 678 679 enum ipa_tethering_stats_event { 680 IPA_TETHERING_STATS_UPDATE_STATS = IPA_ECM_EVENT_MAX, 681 IPA_TETHERING_STATS_UPDATE_NETWORK_STATS, 682 IPA_TETHERING_STATS_EVENT_MAX, 683 }; 684 685 686 enum ipa_quota_event { 687 IPA_QUOTA_REACH = IPA_TETHERING_STATS_EVENT_MAX, 688 IPA_QUOTA_EVENT_MAX, 689 }; 690 691 enum ipa_ssr_event { 692 IPA_SSR_BEFORE_SHUTDOWN = IPA_QUOTA_EVENT_MAX, 693 IPA_SSR_AFTER_POWERUP, 694 IPA_SSR_EVENT_MAX, 695 }; 696 697 enum ipa_vlan_l2tp_event { 698 ADD_VLAN_IFACE = IPA_SSR_EVENT_MAX, 699 DEL_VLAN_IFACE, 700 ADD_L2TP_VLAN_MAPPING, 701 DEL_L2TP_VLAN_MAPPING, 702 IPA_VLAN_L2TP_EVENT_MAX, 703 }; 704 705 enum ipa_per_client_stats_event { 706 IPA_PER_CLIENT_STATS_CONNECT_EVENT = IPA_VLAN_L2TP_EVENT_MAX, 707 IPA_PER_CLIENT_STATS_DISCONNECT_EVENT, 708 IPA_PER_CLIENT_STATS_EVENT_MAX, 709 }; 710 711 enum ipa_vlan_bridge_event { 712 ADD_BRIDGE_VLAN_MAPPING = IPA_PER_CLIENT_STATS_EVENT_MAX, 713 DEL_BRIDGE_VLAN_MAPPING, 714 BRIDGE_VLAN_MAPPING_MAX, 715 }; 716 717 enum ipa_wlan_fw_ssr_event { 718 WLAN_FWR_SSR_BEFORE_SHUTDOWN = BRIDGE_VLAN_MAPPING_MAX, 719 IPA_WLAN_FW_SSR_EVENT_MAX, 720 #define IPA_WLAN_FW_SSR_EVENT_MAX IPA_WLAN_FW_SSR_EVENT_MAX 721 }; 722 723 enum ipa_gsb_event { 724 IPA_GSB_CONNECT = IPA_WLAN_FW_SSR_EVENT_MAX, 725 IPA_GSB_DISCONNECT, 726 IPA_GSB_EVENT_MAX, 727 }; 728 729 enum ipa_coalesce_event { 730 IPA_COALESCE_ENABLE = IPA_GSB_EVENT_MAX, 731 IPA_COALESCE_DISABLE, 732 IPA_COALESCE_EVENT_MAX 733 #define IPA_COALESCE_EVENT_MAX IPA_COALESCE_EVENT_MAX 734 }; 735 736 #define WIGIG_CLIENT_CONNECT (IPA_COALESCE_EVENT_MAX) 737 738 enum ipa_peripheral_event { 739 IPA_PERIPHERAL_CONNECT = ECM_CONNECT, 740 IPA_PERIPHERAL_DISCONNECT = ECM_DISCONNECT 741 }; 742 743 #define WIGIG_FST_SWITCH (WIGIG_CLIENT_CONNECT + 1) 744 #define WIGIG_EVENT_MAX (WIGIG_FST_SWITCH + 1) 745 746 enum ipa_sockv5_event { 747 IPA_SOCKV5_ADD = WIGIG_EVENT_MAX, 748 IPA_SOCKV5_DEL, 749 IPA_SOCKV5_EVENT_MAX 750 #define IPA_SOCKV5_EVENT_MAX IPA_SOCKV5_EVENT_MAX 751 }; 752 753 enum ipa_pdn_config_event { 754 IPA_PDN_DEFAULT_MODE_CONFIG = IPA_SOCKV5_EVENT_MAX, /* Default mode. */ 755 IPA_PDN_IP_COLLISION_MODE_CONFIG, /* IP Collision detected. */ 756 IPA_PDN_IP_PASSTHROUGH_MODE_CONFIG, /* IP Passthrough mode. */ 757 IPA_PDN_CONFIG_EVENT_MAX 758 #define IPA_PDN_CONFIG_EVENT_MAX IPA_PDN_CONFIG_EVENT_MAX 759 }; 760 761 enum ipa_mac_flt_event { 762 IPA_MAC_FLT_EVENT = IPA_PDN_CONFIG_EVENT_MAX, 763 IPA_MAC_FLT_EVENT_MAX 764 #define IPA_MAC_FLT_EVENT_MAX IPA_MAC_FLT_EVENT_MAX 765 }; 766 767 #define IPA_EVENT_MAX_NUM (IPA_MAC_FLT_EVENT_MAX) 768 #define IPA_EVENT_MAX ((int)IPA_EVENT_MAX_NUM) 769 770 /** 771 * enum ipa_rm_resource_name - IPA RM clients identification names 772 * 773 * PROD resources are always even, and CONS resources are always odd. 774 * Add new clients in the end of the list and update IPA_RM_RESOURCE_MAX 775 */ 776 enum ipa_rm_resource_name { 777 IPA_RM_RESOURCE_Q6_PROD = 0, 778 IPA_RM_RESOURCE_Q6_CONS = 1, 779 780 IPA_RM_RESOURCE_USB_PROD = 2, 781 IPA_RM_RESOURCE_USB_CONS = 3, 782 783 IPA_RM_RESOURCE_USB_DPL_DUMMY_PROD = 4, 784 IPA_RM_RESOURCE_USB_DPL_CONS = 5, 785 786 IPA_RM_RESOURCE_HSIC_PROD = 6, 787 IPA_RM_RESOURCE_HSIC_CONS = 7, 788 789 IPA_RM_RESOURCE_STD_ECM_PROD = 8, 790 IPA_RM_RESOURCE_APPS_CONS = 9, 791 792 IPA_RM_RESOURCE_RNDIS_PROD = 10, 793 /* RESERVED CONS = 11, */ 794 795 IPA_RM_RESOURCE_WWAN_0_PROD = 12, 796 /* RESERVED CONS = 13, */ 797 798 IPA_RM_RESOURCE_WLAN_PROD = 14, 799 IPA_RM_RESOURCE_WLAN_CONS = 15, 800 801 IPA_RM_RESOURCE_ODU_ADAPT_PROD = 16, 802 IPA_RM_RESOURCE_ODU_ADAPT_CONS = 17, 803 804 IPA_RM_RESOURCE_MHI_PROD = 18, 805 IPA_RM_RESOURCE_MHI_CONS = 19, 806 807 IPA_RM_RESOURCE_ETHERNET_PROD = 20, 808 IPA_RM_RESOURCE_ETHERNET_CONS = 21, 809 }; 810 #define IPA_RM_RESOURCE_MAX (IPA_RM_RESOURCE_ETHERNET_CONS + 1) 811 812 /** 813 * enum ipa_hw_type - IPA hardware version type 814 * @IPA_HW_None: IPA hardware version not defined 815 * @IPA_HW_v1_0: IPA hardware version 1.0 816 * @IPA_HW_v1_1: IPA hardware version 1.1 817 * @IPA_HW_v2_0: IPA hardware version 2.0 818 * @IPA_HW_v2_1: IPA hardware version 2.1 819 * @IPA_HW_v2_5: IPA hardware version 2.5 820 * @IPA_HW_v2_6: IPA hardware version 2.6 821 * @IPA_HW_v2_6L: IPA hardware version 2.6L 822 * @IPA_HW_v3_0: IPA hardware version 3.0 823 * @IPA_HW_v3_1: IPA hardware version 3.1 824 * @IPA_HW_v3_5: IPA hardware version 3.5 825 * @IPA_HW_v3_5_1: IPA hardware version 3.5.1 826 * @IPA_HW_v4_0: IPA hardware version 4.0 827 * @IPA_HW_v4_1: IPA hardware version 4.1 828 * @IPA_HW_v4_2: IPA hardware version 4.2 829 * @IPA_HW_v4_5: IPA hardware version 4.5 830 */ 831 enum ipa_hw_type { 832 IPA_HW_None = 0, 833 IPA_HW_v1_0 = 1, 834 IPA_HW_v1_1 = 2, 835 IPA_HW_v2_0 = 3, 836 IPA_HW_v2_1 = 4, 837 IPA_HW_v2_5 = 5, 838 IPA_HW_v2_6 = IPA_HW_v2_5, 839 IPA_HW_v2_6L = 6, 840 IPA_HW_v3_0 = 10, 841 IPA_HW_v3_1 = 11, 842 IPA_HW_v3_5 = 12, 843 IPA_HW_v3_5_1 = 13, 844 IPA_HW_v4_0 = 14, 845 IPA_HW_v4_1 = 15, 846 IPA_HW_v4_2 = 16, 847 IPA_HW_v4_5 = 17, 848 }; 849 #define IPA_HW_MAX (IPA_HW_v4_5 + 1) 850 851 #define IPA_HW_v4_0 IPA_HW_v4_0 852 #define IPA_HW_v4_1 IPA_HW_v4_1 853 #define IPA_HW_v4_2 IPA_HW_v4_2 854 #define IPA_HW_v4_5 IPA_HW_v4_5 855 856 /** 857 * struct ipa_rule_attrib - attributes of a routing/filtering 858 * rule, all in LE 859 * @attrib_mask: what attributes are valid 860 * @src_port_lo: low port of src port range 861 * @src_port_hi: high port of src port range 862 * @dst_port_lo: low port of dst port range 863 * @dst_port_hi: high port of dst port range 864 * @type: ICMP/IGMP type 865 * @code: ICMP/IGMP code 866 * @spi: IPSec SPI 867 * @src_port: exact src port 868 * @dst_port: exact dst port 869 * @meta_data: meta-data val 870 * @meta_data_mask: meta-data mask 871 * @u.v4.tos: type of service 872 * @u.v4.protocol: protocol 873 * @u.v4.src_addr: src address value 874 * @u.v4.src_addr_mask: src address mask 875 * @u.v4.dst_addr: dst address value 876 * @u.v4.dst_addr_mask: dst address mask 877 * @u.v6.tc: traffic class 878 * @u.v6.flow_label: flow label 879 * @u.v6.next_hdr: next header 880 * @u.v6.src_addr: src address val 881 * @u.v6.src_addr_mask: src address mask 882 * @u.v6.dst_addr: dst address val 883 * @u.v6.dst_addr_mask: dst address mask 884 * @vlan_id: vlan id value 885 * @payload_length: Payload length. 886 * @ext_attrib_mask: Extended attributes. 887 * @l2tp_udp_next_hdr: next header in L2TP tunneling 888 */ 889 struct ipa_rule_attrib { 890 uint32_t attrib_mask; 891 uint16_t src_port_lo; 892 uint16_t src_port_hi; 893 uint16_t dst_port_lo; 894 uint16_t dst_port_hi; 895 uint8_t type; 896 uint8_t code; 897 uint8_t tos_value; 898 uint8_t tos_mask; 899 uint32_t spi; 900 uint16_t src_port; 901 uint16_t dst_port; 902 uint32_t meta_data; 903 uint32_t meta_data_mask; 904 uint8_t src_mac_addr[ETH_ALEN]; 905 uint8_t src_mac_addr_mask[ETH_ALEN]; 906 uint8_t dst_mac_addr[ETH_ALEN]; 907 uint8_t dst_mac_addr_mask[ETH_ALEN]; 908 uint16_t ether_type; 909 union { 910 struct { 911 uint8_t tos; 912 uint8_t protocol; 913 uint32_t src_addr; 914 uint32_t src_addr_mask; 915 uint32_t dst_addr; 916 uint32_t dst_addr_mask; 917 } v4; 918 struct { 919 uint8_t tc; 920 uint32_t flow_label; 921 uint8_t next_hdr; 922 uint32_t src_addr[4]; 923 uint32_t src_addr_mask[4]; 924 uint32_t dst_addr[4]; 925 uint32_t dst_addr_mask[4]; 926 } v6; 927 } u; 928 uint16_t vlan_id; 929 uint16_t payload_length; 930 uint32_t ext_attrib_mask; 931 uint8_t l2tp_udp_next_hdr; 932 }; 933 934 /*! @brief The maximum number of Mask Equal 32 Eqns */ 935 #define IPA_IPFLTR_NUM_MEQ_32_EQNS 2 936 937 /*! @brief The maximum number of IHL offset Mask Equal 32 Eqns */ 938 #define IPA_IPFLTR_NUM_IHL_MEQ_32_EQNS 2 939 940 /*! @brief The maximum number of Mask Equal 128 Eqns */ 941 #define IPA_IPFLTR_NUM_MEQ_128_EQNS 2 942 943 /*! @brief The maximum number of IHL offset Range Check 16 Eqns */ 944 #define IPA_IPFLTR_NUM_IHL_RANGE_16_EQNS 2 945 946 /*! @brief Offset and 16 bit comparison equation */ 947 struct ipa_ipfltr_eq_16 { 948 int8_t offset; 949 uint16_t value; 950 }; 951 952 /*! @brief Offset and 32 bit comparison equation */ 953 struct ipa_ipfltr_eq_32 { 954 int8_t offset; 955 uint32_t value; 956 }; 957 958 /*! @brief Offset and 128 bit masked comparison equation */ 959 struct ipa_ipfltr_mask_eq_128 { 960 int8_t offset; 961 uint8_t mask[16]; 962 uint8_t value[16]; 963 }; 964 965 /*! @brief Offset and 32 bit masked comparison equation */ 966 struct ipa_ipfltr_mask_eq_32 { 967 int8_t offset; 968 uint32_t mask; 969 uint32_t value; 970 }; 971 972 /*! @brief Equation for identifying a range. Ranges are inclusive */ 973 struct ipa_ipfltr_range_eq_16 { 974 int8_t offset; 975 uint16_t range_low; 976 uint16_t range_high; 977 }; 978 979 /*! @brief Rule equations which are set according to DS filter installation */ 980 struct ipa_ipfltri_rule_eq { 981 /*! 16-bit Bitmask to indicate how many eqs are valid in this rule */ 982 uint16_t rule_eq_bitmap; 983 984 /* 985 * tos_eq_present field has two meanings: 986 * IPA ver < 4.5: 987 * specifies if a type of service check rule is present 988 * (as the field name reveals). 989 * IPA ver >= 4.5: 990 * specifies if a tcp pure ack check rule is present 991 */ 992 uint8_t tos_eq_present; 993 /*! The value to check against the type of service (ipv4) field */ 994 uint8_t tos_eq; 995 /*! Specifies if a protocol check rule is present */ 996 uint8_t protocol_eq_present; 997 /*! The value to check against the protocol (ipv6) field */ 998 uint8_t protocol_eq; 999 /*! The number of ip header length offset 16 bit range check 1000 * rules in this rule 1001 */ 1002 uint8_t num_ihl_offset_range_16; 1003 /*! An array of the registered ip header length offset 16 bit 1004 * range check rules 1005 */ 1006 struct ipa_ipfltr_range_eq_16 1007 ihl_offset_range_16[IPA_IPFLTR_NUM_IHL_RANGE_16_EQNS]; 1008 /*! The number of mask equal 32 rules present in this rule */ 1009 uint8_t num_offset_meq_32; 1010 /*! An array of all the possible mask equal 32 rules in this rule */ 1011 struct ipa_ipfltr_mask_eq_32 1012 offset_meq_32[IPA_IPFLTR_NUM_MEQ_32_EQNS]; 1013 /*! Specifies if the traffic class rule is present in this rule */ 1014 uint8_t tc_eq_present; 1015 /*! The value to check the traffic class (ipv4) field against */ 1016 uint8_t tc_eq; 1017 /*! Specifies if the flow equals rule is present in this rule */ 1018 uint8_t fl_eq_present; 1019 /*! The value to check the flow (ipv6) field against */ 1020 uint32_t fl_eq; 1021 /*! The number of ip header length offset 16 bit equations in this 1022 * rule 1023 */ 1024 uint8_t ihl_offset_eq_16_present; 1025 /*! The ip header length offset 16 bit equation */ 1026 struct ipa_ipfltr_eq_16 ihl_offset_eq_16; 1027 /*! The number of ip header length offset 32 bit equations in this 1028 * rule 1029 */ 1030 uint8_t ihl_offset_eq_32_present; 1031 /*! The ip header length offset 32 bit equation */ 1032 struct ipa_ipfltr_eq_32 ihl_offset_eq_32; 1033 /*! The number of ip header length offset 32 bit mask equations in 1034 * this rule 1035 */ 1036 uint8_t num_ihl_offset_meq_32; 1037 /*! The ip header length offset 32 bit mask equation */ 1038 struct ipa_ipfltr_mask_eq_32 1039 ihl_offset_meq_32[IPA_IPFLTR_NUM_IHL_MEQ_32_EQNS]; 1040 /*! The number of ip header length offset 128 bit equations in this 1041 * rule 1042 */ 1043 uint8_t num_offset_meq_128; 1044 /*! The ip header length offset 128 bit equation */ 1045 struct ipa_ipfltr_mask_eq_128 1046 offset_meq_128[IPA_IPFLTR_NUM_MEQ_128_EQNS]; 1047 /*! The metadata 32 bit masked comparison equation present or not */ 1048 /* Metadata based rules are added internally by IPA driver */ 1049 uint8_t metadata_meq32_present; 1050 /*! The metadata 32 bit masked comparison equation */ 1051 struct ipa_ipfltr_mask_eq_32 metadata_meq32; 1052 /*! Specifies if the Fragment equation is present in this rule */ 1053 uint8_t ipv4_frag_eq_present; 1054 }; 1055 1056 /** 1057 * struct ipa_flt_rule - attributes of a filtering rule 1058 * @retain_hdr: bool switch to instruct IPA core to add back to the packet 1059 * the header removed as part of header removal 1060 * @to_uc: bool switch to pass packet to micro-controller 1061 * @action: action field 1062 * @rt_tbl_hdl: handle of table from "get" 1063 * @attrib: attributes of the rule 1064 * @eq_attrib: attributes of the rule in equation form (valid when 1065 * eq_attrib_type is true) 1066 * @rt_tbl_idx: index of RT table referred to by filter rule (valid when 1067 * eq_attrib_type is true and non-exception action) 1068 * @eq_attrib_type: true if equation level form used to specify attributes 1069 * @max_prio: bool switch. is this rule with Max priority? meaning on rule hit, 1070 * IPA will use the rule and will not look for other rules that may have 1071 * higher priority 1072 * @hashable: bool switch. is this rule hashable or not? 1073 * ipa uses hashable rules to cache their hit results to be used in 1074 * consecutive packets 1075 * @rule_id: rule_id to be assigned to the filter rule. In case client specifies 1076 * rule_id as 0 the driver will assign a new rule_id 1077 * @set_metadata: bool switch. should metadata replacement at the NAT block 1078 * take place? 1079 * @pdn_idx: if action is "pass to source\destination NAT" then a comparison 1080 * against the PDN index in the matching PDN entry will take place as an 1081 * additional condition for NAT hit. 1082 */ 1083 struct ipa_flt_rule { 1084 uint8_t retain_hdr; 1085 uint8_t to_uc; 1086 enum ipa_flt_action action; 1087 uint32_t rt_tbl_hdl; 1088 struct ipa_rule_attrib attrib; 1089 struct ipa_ipfltri_rule_eq eq_attrib; 1090 uint32_t rt_tbl_idx; 1091 uint8_t eq_attrib_type; 1092 uint8_t max_prio; 1093 uint8_t hashable; 1094 uint16_t rule_id; 1095 uint8_t set_metadata; 1096 uint8_t pdn_idx; 1097 }; 1098 1099 /** 1100 * struct ipa_flt_rule_v2 - attributes of a filtering rule 1101 * @retain_hdr: bool switch to instruct IPA core to add back to the packet 1102 * the header removed as part of header removal 1103 * @to_uc: bool switch to pass packet to micro-controller 1104 * @action: action field 1105 * @rt_tbl_hdl: handle of table from "get" 1106 * @attrib: attributes of the rule 1107 * @eq_attrib: attributes of the rule in equation form (valid when 1108 * eq_attrib_type is true) 1109 * @rt_tbl_idx: index of RT table referred to by filter rule (valid when 1110 * eq_attrib_type is true and non-exception action) 1111 * @eq_attrib_type: true if equation level form used to specify attributes 1112 * @max_prio: bool switch. is this rule with Max priority? meaning on rule hit, 1113 * IPA will use the rule and will not look for other rules that may have 1114 * higher priority 1115 * @hashable: bool switch. is this rule hashable or not? 1116 * ipa uses hashable rules to cache their hit results to be used in 1117 * consecutive packets 1118 * @rule_id: rule_id to be assigned to the filter rule. In case client specifies 1119 * rule_id as 0 the driver will assign a new rule_id 1120 * @set_metadata: bool switch. should metadata replacement at the NAT block 1121 * take place? 1122 * @pdn_idx: if action is "pass to source\destination NAT" then a comparison 1123 * against the PDN index in the matching PDN entry will take place as an 1124 * additional condition for NAT hit. 1125 * @enable_stats: is true when we want to enable stats for this 1126 * flt rule. 1127 * @cnt_idx: if 0 means disable, otherwise use for index. 1128 * will be assigned by ipa driver. 1129 */ 1130 struct ipa_flt_rule_v2 { 1131 uint8_t retain_hdr; 1132 uint8_t to_uc; 1133 enum ipa_flt_action action; 1134 uint32_t rt_tbl_hdl; 1135 struct ipa_rule_attrib attrib; 1136 struct ipa_ipfltri_rule_eq eq_attrib; 1137 uint32_t rt_tbl_idx; 1138 uint8_t eq_attrib_type; 1139 uint8_t max_prio; 1140 uint8_t hashable; 1141 uint16_t rule_id; 1142 uint8_t set_metadata; 1143 uint8_t pdn_idx; 1144 uint8_t enable_stats; 1145 uint8_t cnt_idx; 1146 }; 1147 1148 /** 1149 * enum ipa_hdr_l2_type - L2 header type 1150 * IPA_HDR_L2_NONE: L2 header which isn't Ethernet II and isn't 802_3 1151 * IPA_HDR_L2_ETHERNET_II: L2 header of type Ethernet II 1152 * IPA_HDR_L2_802_3: L2 header of type 802_3 1153 * IPA_HDR_L2_802_1Q: L2 header of type 802_1Q 1154 */ 1155 enum ipa_hdr_l2_type { 1156 IPA_HDR_L2_NONE, 1157 IPA_HDR_L2_ETHERNET_II, 1158 IPA_HDR_L2_802_3, 1159 IPA_HDR_L2_802_1Q, 1160 }; 1161 #define IPA_HDR_L2_MAX (IPA_HDR_L2_802_1Q + 1) 1162 1163 #define IPA_HDR_L2_802_1Q IPA_HDR_L2_802_1Q 1164 1165 /** 1166 * enum ipa_hdr_l2_type - Processing context type 1167 * IPA_HDR_PROC_NONE: No processing context 1168 * IPA_HDR_PROC_ETHII_TO_ETHII: Process Ethernet II to Ethernet II 1169 * IPA_HDR_PROC_ETHII_TO_802_3: Process Ethernet II to 802_3 1170 * IPA_HDR_PROC_802_3_TO_ETHII: Process 802_3 to Ethernet II 1171 * IPA_HDR_PROC_802_3_TO_802_3: Process 802_3 to 802_3 1172 * IPA_HDR_PROC_ETHII_TO_ETHII_EX: Process Ethernet II to Ethernet II with 1173 * generic lengths of src and dst headers 1174 * IPA_HDR_PROC_L2TP_UDP_HEADER_ADD: Process WLAN To Ethernet packets to 1175 * add L2TP UDP header. 1176 * IPA_HDR_PROC_L2TP_UDP_HEADER_REMOVE: Process Ethernet To WLAN packets to 1177 * remove L2TP UDP header. 1178 */ 1179 enum ipa_hdr_proc_type { 1180 IPA_HDR_PROC_NONE, 1181 IPA_HDR_PROC_ETHII_TO_ETHII, 1182 IPA_HDR_PROC_ETHII_TO_802_3, 1183 IPA_HDR_PROC_802_3_TO_ETHII, 1184 IPA_HDR_PROC_802_3_TO_802_3, 1185 IPA_HDR_PROC_L2TP_HEADER_ADD, 1186 IPA_HDR_PROC_L2TP_HEADER_REMOVE, 1187 IPA_HDR_PROC_ETHII_TO_ETHII_EX, 1188 IPA_HDR_PROC_L2TP_UDP_HEADER_ADD, 1189 IPA_HDR_PROC_L2TP_UDP_HEADER_REMOVE, 1190 IPA_HDR_PROC_SET_DSCP, 1191 }; 1192 #define IPA_HDR_PROC_MAX (IPA_HDR_PROC_SET_DSCP + 1) 1193 1194 /** 1195 * struct ipa_rt_rule - attributes of a routing rule 1196 * @dst: dst "client" 1197 * @hdr_hdl: handle to the dynamic header 1198 it is not an index or an offset 1199 * @hdr_proc_ctx_hdl: handle to header processing context. if it is provided 1200 hdr_hdl shall be 0 1201 * @attrib: attributes of the rule 1202 * @max_prio: bool switch. is this rule with Max priority? meaning on rule hit, 1203 * IPA will use the rule and will not look for other rules that may have 1204 * higher priority 1205 * @hashable: bool switch. is this rule hashable or not? 1206 * ipa uses hashable rules to cache their hit results to be used in 1207 * consecutive packets 1208 * @retain_hdr: bool switch to instruct IPA core to add back to the packet 1209 * the header removed as part of header removal 1210 * @coalesce: bool to decide whether packets should be coalesced or not 1211 */ 1212 struct ipa_rt_rule { 1213 enum ipa_client_type dst; 1214 uint32_t hdr_hdl; 1215 uint32_t hdr_proc_ctx_hdl; 1216 struct ipa_rule_attrib attrib; 1217 uint8_t max_prio; 1218 uint8_t hashable; 1219 uint8_t retain_hdr; 1220 uint8_t coalesce; 1221 }; 1222 #define IPA_RT_SUPPORT_COAL 1223 1224 /** 1225 * struct ipa_rt_rule_v2 - attributes of a routing rule 1226 * @dst: dst "client" 1227 * @hdr_hdl: handle to the dynamic header 1228 it is not an index or an offset 1229 * @hdr_proc_ctx_hdl: handle to header processing context. if it is provided 1230 hdr_hdl shall be 0 1231 * @attrib: attributes of the rule 1232 * @max_prio: bool switch. is this rule with Max priority? meaning on rule hit, 1233 * IPA will use the rule and will not look for other rules that may have 1234 * higher priority 1235 * @hashable: bool switch. is this rule hashable or not? 1236 * ipa uses hashable rules to cache their hit results to be used in 1237 * consecutive packets 1238 * @retain_hdr: bool switch to instruct IPA core to add back to the packet 1239 * the header removed as part of header removal 1240 * @coalesce: bool to decide whether packets should be coalesced or not 1241 * @enable_stats: is true when we want to enable stats for this 1242 * rt rule. 1243 * @cnt_idx: if enable_stats is 1 and cnt_idx is 0, then cnt_idx 1244 * will be assigned by ipa driver. 1245 */ 1246 struct ipa_rt_rule_v2 { 1247 enum ipa_client_type dst; 1248 uint32_t hdr_hdl; 1249 uint32_t hdr_proc_ctx_hdl; 1250 struct ipa_rule_attrib attrib; 1251 uint8_t max_prio; 1252 uint8_t hashable; 1253 uint8_t retain_hdr; 1254 uint8_t coalesce; 1255 uint8_t enable_stats; 1256 uint8_t cnt_idx; 1257 }; 1258 1259 /** 1260 * struct ipa_hdr_add - header descriptor includes in and out 1261 * parameters 1262 * @name: name of the header 1263 * @hdr: actual header to be inserted 1264 * @hdr_len: size of above header 1265 * @type: l2 header type 1266 * @is_partial: header not fully specified 1267 * @hdr_hdl: out parameter, handle to header, valid when status is 0 1268 * @status: out parameter, status of header add operation, 1269 * 0 for success, 1270 * -1 for failure 1271 * @is_eth2_ofst_valid: is eth2_ofst field valid? 1272 * @eth2_ofst: offset to start of Ethernet-II/802.3 header 1273 */ 1274 struct ipa_hdr_add { 1275 char name[IPA_RESOURCE_NAME_MAX]; 1276 uint8_t hdr[IPA_HDR_MAX_SIZE]; 1277 uint8_t hdr_len; 1278 enum ipa_hdr_l2_type type; 1279 uint8_t is_partial; 1280 uint32_t hdr_hdl; 1281 int status; 1282 uint8_t is_eth2_ofst_valid; 1283 uint16_t eth2_ofst; 1284 }; 1285 1286 /** 1287 * struct ipa_ioc_add_hdr - header addition parameters (support 1288 * multiple headers and commit) 1289 * @commit: should headers be written to IPA HW also? 1290 * @num_hdrs: num of headers that follow 1291 * @ipa_hdr_add hdr: all headers need to go here back to 1292 * back, no pointers 1293 */ 1294 struct ipa_ioc_add_hdr { 1295 uint8_t commit; 1296 uint8_t num_hdrs; 1297 struct ipa_hdr_add hdr[0]; 1298 }; 1299 1300 /** 1301 * struct ipa_l2tp_header_add_procparams - 1302 * @eth_hdr_retained: Specifies if Ethernet header is retained or not 1303 * @input_ip_version: Specifies if Input header is IPV4(0) or IPV6(1) 1304 * @output_ip_version: Specifies if template header is IPV4(0) or IPV6(1) 1305 * @single_pass: Specifies if second pass is required or not 1306 */ 1307 struct ipa_l2tp_header_add_procparams { 1308 uint32_t eth_hdr_retained:1; 1309 uint32_t input_ip_version:1; 1310 uint32_t output_ip_version:1; 1311 uint32_t second_pass:1; 1312 uint32_t reserved:28; 1313 }; 1314 1315 /** 1316 * struct ipa_l2tp_header_remove_procparams - 1317 * @hdr_len_remove: Specifies how much of the header needs to 1318 be removed in bytes 1319 * @eth_hdr_retained: Specifies if Ethernet header is retained or not 1320 * @hdr_ofst_pkt_size_valid: Specifies if the Header offset is valid 1321 * @hdr_ofst_pkt_size: If hdr_ofst_pkt_size_valid =1, this indicates where the 1322 packet size field (2bytes) resides 1323 * @hdr_endianness: 0:little endian, 1:big endian 1324 */ 1325 struct ipa_l2tp_header_remove_procparams { 1326 uint32_t hdr_len_remove:8; 1327 uint32_t eth_hdr_retained:1; 1328 /* Following fields are valid if eth_hdr_retained =1 ( bridge mode) */ 1329 uint32_t hdr_ofst_pkt_size_valid:1; 1330 uint32_t hdr_ofst_pkt_size:6; 1331 uint32_t hdr_endianness:1; 1332 uint32_t reserved:15; 1333 }; 1334 1335 /** 1336 * struct ipa_l2tp_hdr_proc_ctx_params - 1337 * @hdr_add_param: parameters for header add 1338 * @hdr_remove_param: parameters for header remove 1339 * @is_dst_pipe_valid: if dst pipe is valid 1340 * @dst_pipe: destination pipe 1341 */ 1342 struct ipa_l2tp_hdr_proc_ctx_params { 1343 struct ipa_l2tp_header_add_procparams hdr_add_param; 1344 struct ipa_l2tp_header_remove_procparams hdr_remove_param; 1345 uint8_t is_dst_pipe_valid; 1346 enum ipa_client_type dst_pipe; 1347 }; 1348 1349 /** 1350 * struct ipa_eth_II_to_eth_II_ex_procparams - 1351 * @input_ethhdr_negative_offset: Specifies where the ethernet hdr offset is 1352 * (in bytes) from the start of the input IP hdr 1353 * @output_ethhdr_negative_offset: Specifies where the ethernet hdr offset is 1354 * (in bytes) from the end of the template hdr 1355 * @reserved: for future use 1356 */ 1357 struct ipa_eth_II_to_eth_II_ex_procparams { 1358 uint32_t input_ethhdr_negative_offset : 8; 1359 uint32_t output_ethhdr_negative_offset : 8; 1360 uint32_t reserved : 16; 1361 }; 1362 1363 #define L2TP_USER_SPACE_SPECIFY_DST_PIPE 1364 1365 /** 1366 * struct ipa_hdr_proc_ctx_add - processing context descriptor includes 1367 * in and out parameters 1368 * @type: processing context type 1369 * @hdr_hdl: in parameter, handle to header 1370 * @l2tp_params: l2tp parameters 1371 * @generic_params: generic proc_ctx params 1372 * @proc_ctx_hdl: out parameter, handle to proc_ctx, valid when status is 0 1373 * @status: out parameter, status of header add operation, 1374 * 0 for success, 1375 * -1 for failure 1376 */ 1377 struct ipa_hdr_proc_ctx_add { 1378 enum ipa_hdr_proc_type type; 1379 uint32_t hdr_hdl; 1380 uint32_t proc_ctx_hdl; 1381 int status; 1382 struct ipa_l2tp_hdr_proc_ctx_params l2tp_params; 1383 struct ipa_eth_II_to_eth_II_ex_procparams generic_params; 1384 }; 1385 1386 #define IPA_L2TP_HDR_PROC_SUPPORT 1387 1388 /** 1389 * struct ipa_ioc_add_hdr - processing context addition parameters (support 1390 * multiple processing context and commit) 1391 * @commit: should processing context be written to IPA HW also? 1392 * @num_proc_ctxs: num of processing context that follow 1393 * @proc_ctx: all processing context need to go here back to 1394 * back, no pointers 1395 */ 1396 struct ipa_ioc_add_hdr_proc_ctx { 1397 uint8_t commit; 1398 uint8_t num_proc_ctxs; 1399 struct ipa_hdr_proc_ctx_add proc_ctx[0]; 1400 }; 1401 1402 /** 1403 * struct ipa_ioc_copy_hdr - retrieve a copy of the specified 1404 * header - caller can then derive the complete header 1405 * @name: name of the header resource 1406 * @hdr: out parameter, contents of specified header, 1407 * valid only when ioctl return val is non-negative 1408 * @hdr_len: out parameter, size of above header 1409 * valid only when ioctl return val is non-negative 1410 * @type: l2 header type 1411 * valid only when ioctl return val is non-negative 1412 * @is_partial: out parameter, indicates whether specified header is partial 1413 * valid only when ioctl return val is non-negative 1414 * @is_eth2_ofst_valid: is eth2_ofst field valid? 1415 * @eth2_ofst: offset to start of Ethernet-II/802.3 header 1416 */ 1417 struct ipa_ioc_copy_hdr { 1418 char name[IPA_RESOURCE_NAME_MAX]; 1419 uint8_t hdr[IPA_HDR_MAX_SIZE]; 1420 uint8_t hdr_len; 1421 enum ipa_hdr_l2_type type; 1422 uint8_t is_partial; 1423 uint8_t is_eth2_ofst_valid; 1424 uint16_t eth2_ofst; 1425 }; 1426 1427 /** 1428 * struct ipa_ioc_get_hdr - header entry lookup parameters, if lookup was 1429 * successful caller must call put to release the reference count when done 1430 * @name: name of the header resource 1431 * @hdl: out parameter, handle of header entry 1432 * valid only when ioctl return val is non-negative 1433 */ 1434 struct ipa_ioc_get_hdr { 1435 char name[IPA_RESOURCE_NAME_MAX]; 1436 uint32_t hdl; 1437 }; 1438 1439 /** 1440 * struct ipa_hdr_del - header descriptor includes in and out 1441 * parameters 1442 * 1443 * @hdl: handle returned from header add operation 1444 * @status: out parameter, status of header remove operation, 1445 * 0 for success, 1446 * -1 for failure 1447 */ 1448 struct ipa_hdr_del { 1449 uint32_t hdl; 1450 int status; 1451 }; 1452 1453 /** 1454 * struct ipa_ioc_del_hdr - header deletion parameters (support 1455 * multiple headers and commit) 1456 * @commit: should headers be removed from IPA HW also? 1457 * @num_hdls: num of headers being removed 1458 * @ipa_hdr_del hdl: all handles need to go here back to back, no pointers 1459 */ 1460 struct ipa_ioc_del_hdr { 1461 uint8_t commit; 1462 uint8_t num_hdls; 1463 struct ipa_hdr_del hdl[0]; 1464 }; 1465 1466 /** 1467 * struct ipa_hdr_proc_ctx_del - processing context descriptor includes 1468 * in and out parameters 1469 * @hdl: handle returned from processing context add operation 1470 * @status: out parameter, status of header remove operation, 1471 * 0 for success, 1472 * -1 for failure 1473 */ 1474 struct ipa_hdr_proc_ctx_del { 1475 uint32_t hdl; 1476 int status; 1477 }; 1478 1479 /** 1480 * ipa_ioc_del_hdr_proc_ctx - processing context deletion parameters (support 1481 * multiple headers and commit) 1482 * @commit: should processing contexts be removed from IPA HW also? 1483 * @num_hdls: num of processing contexts being removed 1484 * @ipa_hdr_proc_ctx_del hdl: all handles need to go here back to back, 1485 * no pointers 1486 */ 1487 struct ipa_ioc_del_hdr_proc_ctx { 1488 uint8_t commit; 1489 uint8_t num_hdls; 1490 struct ipa_hdr_proc_ctx_del hdl[0]; 1491 }; 1492 1493 /** 1494 * struct ipa_rt_rule_add - routing rule descriptor includes in 1495 * and out parameters 1496 * @rule: actual rule to be added 1497 * @at_rear: add at back of routing table, it is NOT possible to add rules at 1498 * the rear of the "default" routing tables 1499 * @rt_rule_hdl: output parameter, handle to rule, valid when status is 0 1500 * @status: output parameter, status of routing rule add operation, 1501 * 0 for success, 1502 * -1 for failure 1503 */ 1504 struct ipa_rt_rule_add { 1505 struct ipa_rt_rule rule; 1506 uint8_t at_rear; 1507 uint32_t rt_rule_hdl; 1508 int status; 1509 }; 1510 1511 /** 1512 * struct ipa_rt_rule_add_v2 - routing rule descriptor includes 1513 * in and out parameters 1514 * @rule: actual rule to be added 1515 * @at_rear: add at back of routing table, it is NOT possible to add rules at 1516 * the rear of the "default" routing tables 1517 * @rt_rule_hdl: output parameter, handle to rule, valid when status is 0 1518 * @status: output parameter, status of routing rule add operation, 1519 * 0 for success, 1520 * -1 for failure 1521 */ 1522 struct ipa_rt_rule_add_v2 { 1523 uint8_t at_rear; 1524 uint32_t rt_rule_hdl; 1525 int status; 1526 struct ipa_rt_rule_v2 rule; 1527 }; 1528 1529 1530 /** 1531 * struct ipa_ioc_add_rt_rule - routing rule addition parameters (supports 1532 * multiple rules and commit); 1533 * 1534 * all rules MUST be added to same table 1535 * @commit: should rules be written to IPA HW also? 1536 * @ip: IP family of rule 1537 * @rt_tbl_name: name of routing table resource 1538 * @num_rules: number of routing rules that follow 1539 * @ipa_rt_rule_add rules: all rules need to go back to back here, no pointers 1540 */ 1541 struct ipa_ioc_add_rt_rule { 1542 uint8_t commit; 1543 enum ipa_ip_type ip; 1544 char rt_tbl_name[IPA_RESOURCE_NAME_MAX]; 1545 uint8_t num_rules; 1546 struct ipa_rt_rule_add rules[0]; 1547 }; 1548 1549 /** 1550 * struct ipa_ioc_add_rt_rule_v2 - routing rule addition 1551 * parameters (supports multiple rules and commit); 1552 * 1553 * all rules MUST be added to same table 1554 * @commit: should rules be written to IPA HW also? 1555 * @ip: IP family of rule 1556 * @rt_tbl_name: name of routing table resource 1557 * @num_rules: number of routing rules that follow 1558 * @rule_add_size: sizeof(struct ipa_rt_rule_add_v2) 1559 * @ipa_rt_rule_add rules: all rules need to go back to back here, no pointers 1560 */ 1561 struct ipa_ioc_add_rt_rule_v2 { 1562 uint8_t commit; 1563 enum ipa_ip_type ip; 1564 char rt_tbl_name[IPA_RESOURCE_NAME_MAX]; 1565 uint8_t num_rules; 1566 uint32_t rule_add_size; 1567 uintptr_t rules; 1568 }; 1569 1570 /** 1571 * struct ipa_ioc_add_rt_rule_after - routing rule addition after a specific 1572 * rule parameters(supports multiple rules and commit); 1573 * 1574 * all rules MUST be added to same table 1575 * @commit: should rules be written to IPA HW also? 1576 * @ip: IP family of rule 1577 * @rt_tbl_name: name of routing table resource 1578 * @num_rules: number of routing rules that follow 1579 * @add_after_hdl: the rules will be added after this specific rule 1580 * @ipa_rt_rule_add rules: all rules need to go back to back here, no pointers 1581 * at_rear field will be ignored when using this IOCTL 1582 */ 1583 struct ipa_ioc_add_rt_rule_after { 1584 uint8_t commit; 1585 enum ipa_ip_type ip; 1586 char rt_tbl_name[IPA_RESOURCE_NAME_MAX]; 1587 uint8_t num_rules; 1588 uint32_t add_after_hdl; 1589 struct ipa_rt_rule_add rules[0]; 1590 }; 1591 1592 /** 1593 * struct ipa_ioc_add_rt_rule_after_v2 - routing rule addition 1594 * after a specific rule parameters(supports multiple rules and 1595 * commit); 1596 * 1597 * all rules MUST be added to same table 1598 * @commit: should rules be written to IPA HW also? 1599 * @ip: IP family of rule 1600 * @rt_tbl_name: name of routing table resource 1601 * @num_rules: number of routing rules that follow 1602 * @add_after_hdl: the rules will be added after this specific rule 1603 * @rule_add_size: sizeof(struct ipa_rt_rule_add_v2) 1604 * @ipa_rt_rule_add rules: all rules need to go back to back here, no pointers 1605 * at_rear field will be ignored when using this IOCTL 1606 */ 1607 struct ipa_ioc_add_rt_rule_after_v2 { 1608 uint8_t commit; 1609 enum ipa_ip_type ip; 1610 char rt_tbl_name[IPA_RESOURCE_NAME_MAX]; 1611 uint8_t num_rules; 1612 uint32_t add_after_hdl; 1613 uint32_t rule_add_size; 1614 uintptr_t rules; 1615 }; 1616 1617 /** 1618 * struct ipa_rt_rule_mdfy - routing rule descriptor includes 1619 * in and out parameters 1620 * @rule: actual rule to be added 1621 * @rt_rule_hdl: handle to rule which supposed to modify 1622 * @status: output parameter, status of routing rule modify operation, 1623 * 0 for success, 1624 * -1 for failure 1625 * 1626 */ 1627 struct ipa_rt_rule_mdfy { 1628 struct ipa_rt_rule rule; 1629 uint32_t rt_rule_hdl; 1630 int status; 1631 }; 1632 1633 /** 1634 * struct ipa_rt_rule_mdfy_v2 - routing rule descriptor includes 1635 * in and out parameters 1636 * @rule: actual rule to be added 1637 * @rt_rule_hdl: handle to rule which supposed to modify 1638 * @status: output parameter, status of routing rule modify operation, 1639 * 0 for success, 1640 * -1 for failure 1641 * 1642 */ 1643 struct ipa_rt_rule_mdfy_v2 { 1644 uint32_t rt_rule_hdl; 1645 int status; 1646 struct ipa_rt_rule_v2 rule; 1647 }; 1648 1649 /** 1650 * struct ipa_ioc_mdfy_rt_rule - routing rule modify parameters (supports 1651 * multiple rules and commit) 1652 * @commit: should rules be written to IPA HW also? 1653 * @ip: IP family of rule 1654 * @num_rules: number of routing rules that follow 1655 * @rules: all rules need to go back to back here, no pointers 1656 */ 1657 struct ipa_ioc_mdfy_rt_rule { 1658 uint8_t commit; 1659 enum ipa_ip_type ip; 1660 uint8_t num_rules; 1661 struct ipa_rt_rule_mdfy rules[0]; 1662 }; 1663 1664 /** 1665 * struct ipa_ioc_mdfy_rt_rule_v2 - routing rule modify 1666 * parameters (supports multiple rules and commit) 1667 * @commit: should rules be written to IPA HW also? 1668 * @ip: IP family of rule 1669 * @num_rules: number of routing rules that follow 1670 * @rule_mdfy_size: sizeof(struct ipa_rt_rule_mdfy_v2) 1671 * @rules: all rules need to go back to back here, no pointers 1672 */ 1673 struct ipa_ioc_mdfy_rt_rule_v2 { 1674 uint8_t commit; 1675 enum ipa_ip_type ip; 1676 uint8_t num_rules; 1677 uint32_t rule_mdfy_size; 1678 uintptr_t rules; 1679 }; 1680 1681 /** 1682 * struct ipa_rt_rule_del - routing rule descriptor includes in 1683 * and out parameters 1684 * @hdl: handle returned from route rule add operation 1685 * @status: output parameter, status of route rule delete operation, 1686 * 0 for success, 1687 * -1 for failure 1688 */ 1689 struct ipa_rt_rule_del { 1690 uint32_t hdl; 1691 int status; 1692 }; 1693 1694 /** 1695 * struct ipa_rt_rule_add_ext - routing rule descriptor includes in 1696 * and out parameters 1697 * @rule: actual rule to be added 1698 * @at_rear: add at back of routing table, it is NOT possible to add rules at 1699 * the rear of the "default" routing tables 1700 * @rt_rule_hdl: output parameter, handle to rule, valid when status is 0 1701 * @status: output parameter, status of routing rule add operation, 1702 * @rule_id: rule_id to be assigned to the routing rule. In case client 1703 * specifies rule_id as 0 the driver will assign a new rule_id 1704 * 0 for success, 1705 * -1 for failure 1706 */ 1707 struct ipa_rt_rule_add_ext { 1708 struct ipa_rt_rule rule; 1709 uint8_t at_rear; 1710 uint32_t rt_rule_hdl; 1711 int status; 1712 uint16_t rule_id; 1713 }; 1714 1715 /** 1716 * struct ipa_rt_rule_add_ext_v2 - routing rule descriptor 1717 * includes in and out parameters 1718 * @rule: actual rule to be added 1719 * @at_rear: add at back of routing table, it is NOT possible to add rules at 1720 * the rear of the "default" routing tables 1721 * @rt_rule_hdl: output parameter, handle to rule, valid when status is 0 1722 * @status: output parameter, status of routing rule add operation, 1723 * @rule_id: rule_id to be assigned to the routing rule. In case client 1724 * specifies rule_id as 0 the driver will assign a new rule_id 1725 * 0 for success, 1726 * -1 for failure 1727 */ 1728 struct ipa_rt_rule_add_ext_v2 { 1729 uint8_t at_rear; 1730 uint32_t rt_rule_hdl; 1731 int status; 1732 uint16_t rule_id; 1733 struct ipa_rt_rule_v2 rule; 1734 }; 1735 1736 /** 1737 * struct ipa_ioc_add_rt_rule_ext - routing rule addition 1738 * parameters (supports multiple rules and commit with rule_id); 1739 * 1740 * all rules MUST be added to same table 1741 * @commit: should rules be written to IPA HW also? 1742 * @ip: IP family of rule 1743 * @rt_tbl_name: name of routing table resource 1744 * @num_rules: number of routing rules that follow 1745 * @ipa_rt_rule_add_ext rules: all rules need to go back to back here, 1746 * no pointers 1747 */ 1748 struct ipa_ioc_add_rt_rule_ext { 1749 uint8_t commit; 1750 enum ipa_ip_type ip; 1751 char rt_tbl_name[IPA_RESOURCE_NAME_MAX]; 1752 uint8_t num_rules; 1753 struct ipa_rt_rule_add_ext rules[0]; 1754 }; 1755 1756 /** 1757 * struct ipa_ioc_add_rt_rule_ext_v2 - routing rule addition 1758 * parameters (supports multiple rules and commit with rule_id); 1759 * 1760 * all rules MUST be added to same table 1761 * @commit: should rules be written to IPA HW also? 1762 * @ip: IP family of rule 1763 * @rt_tbl_name: name of routing table resource 1764 * @num_rules: number of routing rules that follow 1765 * @rule_add_ext_size: sizeof(struct ipa_rt_rule_add_ext_v2) 1766 * @ipa_rt_rule_add_ext rules: all rules need to go back to back here, 1767 * no pointers 1768 */ 1769 struct ipa_ioc_add_rt_rule_ext_v2 { 1770 uint8_t commit; 1771 enum ipa_ip_type ip; 1772 char rt_tbl_name[IPA_RESOURCE_NAME_MAX]; 1773 uint8_t num_rules; 1774 uint32_t rule_add_ext_size; 1775 uintptr_t rules; 1776 }; 1777 1778 1779 /** 1780 * struct ipa_ioc_del_rt_rule - routing rule deletion parameters (supports 1781 * multiple headers and commit) 1782 * @commit: should rules be removed from IPA HW also? 1783 * @ip: IP family of rules 1784 * @num_hdls: num of rules being removed 1785 * @ipa_rt_rule_del hdl: all handles need to go back to back here, no pointers 1786 */ 1787 struct ipa_ioc_del_rt_rule { 1788 uint8_t commit; 1789 enum ipa_ip_type ip; 1790 uint8_t num_hdls; 1791 struct ipa_rt_rule_del hdl[0]; 1792 }; 1793 1794 /** 1795 * struct ipa_ioc_get_rt_tbl_indx - routing table index lookup parameters 1796 * @ip: IP family of table 1797 * @name: name of routing table resource 1798 * @index: output parameter, routing table index, valid only when ioctl 1799 * return val is non-negative 1800 */ 1801 struct ipa_ioc_get_rt_tbl_indx { 1802 enum ipa_ip_type ip; 1803 char name[IPA_RESOURCE_NAME_MAX]; 1804 uint32_t idx; 1805 }; 1806 1807 /** 1808 * struct ipa_flt_rule_add - filtering rule descriptor includes 1809 * in and out parameters 1810 * @rule: actual rule to be added 1811 * @at_rear: add at back of filtering table? 1812 * @flt_rule_hdl: out parameter, handle to rule, valid when status is 0 1813 * @status: output parameter, status of filtering rule add operation, 1814 * 0 for success, 1815 * -1 for failure 1816 * 1817 */ 1818 struct ipa_flt_rule_add { 1819 struct ipa_flt_rule rule; 1820 uint8_t at_rear; 1821 uint32_t flt_rule_hdl; 1822 int status; 1823 }; 1824 1825 /** 1826 * struct ipa_flt_rule_add_v2 - filtering rule descriptor 1827 * includes in and out parameters 1828 * @rule: actual rule to be added 1829 * @at_rear: add at back of filtering table? 1830 * @flt_rule_hdl: out parameter, handle to rule, valid when status is 0 1831 * @status: output parameter, status of filtering rule add operation, 1832 * 0 for success, 1833 * -1 for failure 1834 * 1835 */ 1836 struct ipa_flt_rule_add_v2 { 1837 uint8_t at_rear; 1838 uint32_t flt_rule_hdl; 1839 int status; 1840 struct ipa_flt_rule_v2 rule; 1841 }; 1842 1843 /** 1844 * struct ipa_ioc_add_flt_rule - filtering rule addition parameters (supports 1845 * multiple rules and commit) 1846 * all rules MUST be added to same table 1847 * @commit: should rules be written to IPA HW also? 1848 * @ip: IP family of rule 1849 * @ep: which "clients" pipe does this rule apply to? 1850 * valid only when global is 0 1851 * @global: does this apply to global filter table of specific IP family 1852 * @num_rules: number of filtering rules that follow 1853 * @rules: all rules need to go back to back here, no pointers 1854 */ 1855 struct ipa_ioc_add_flt_rule { 1856 uint8_t commit; 1857 enum ipa_ip_type ip; 1858 enum ipa_client_type ep; 1859 uint8_t global; 1860 uint8_t num_rules; 1861 struct ipa_flt_rule_add rules[0]; 1862 }; 1863 1864 /** 1865 * struct ipa_ioc_add_flt_rule_v2 - filtering rule addition 1866 * parameters (supports multiple rules and commit) 1867 * all rules MUST be added to same table 1868 * @commit: should rules be written to IPA HW also? 1869 * @ip: IP family of rule 1870 * @ep: which "clients" pipe does this rule apply to? 1871 * valid only when global is 0 1872 * @global: does this apply to global filter table of specific IP family 1873 * @num_rules: number of filtering rules that follow 1874 * @flt_rule_size: sizeof(struct ipa_flt_rule_add_v2) 1875 * @rules: all rules need to go back to back here, no pointers 1876 */ 1877 struct ipa_ioc_add_flt_rule_v2 { 1878 uint8_t commit; 1879 enum ipa_ip_type ip; 1880 enum ipa_client_type ep; 1881 uint8_t global; 1882 uint8_t num_rules; 1883 uint32_t flt_rule_size; 1884 uintptr_t rules; 1885 }; 1886 1887 1888 /** 1889 * struct ipa_ioc_add_flt_rule_after - filtering rule addition after specific 1890 * rule parameters (supports multiple rules and commit) 1891 * all rules MUST be added to same table 1892 * @commit: should rules be written to IPA HW also? 1893 * @ip: IP family of rule 1894 * @ep: which "clients" pipe does this rule apply to? 1895 * @num_rules: number of filtering rules that follow 1896 * @add_after_hdl: rules will be added after the rule with this handle 1897 * @rules: all rules need to go back to back here, no pointers. at rear field 1898 * is ignored when using this IOCTL 1899 */ 1900 struct ipa_ioc_add_flt_rule_after { 1901 uint8_t commit; 1902 enum ipa_ip_type ip; 1903 enum ipa_client_type ep; 1904 uint8_t num_rules; 1905 uint32_t add_after_hdl; 1906 struct ipa_flt_rule_add rules[0]; 1907 }; 1908 1909 /** 1910 * struct ipa_ioc_add_flt_rule_after_v2 - filtering rule 1911 * addition after specific rule parameters (supports multiple 1912 * rules and commit) all rules MUST be added to same table 1913 * @commit: should rules be written to IPA HW also? 1914 * @ip: IP family of rule 1915 * @ep: which "clients" pipe does this rule apply to? 1916 * @num_rules: number of filtering rules that follow 1917 * @add_after_hdl: rules will be added after the rule with this handle 1918 * @flt_rule_size: sizeof(struct ipa_flt_rule_add_v2) 1919 * @rules: all rules need to go back to back here, no pointers. at rear field 1920 * is ignored when using this IOCTL 1921 */ 1922 struct ipa_ioc_add_flt_rule_after_v2 { 1923 uint8_t commit; 1924 enum ipa_ip_type ip; 1925 enum ipa_client_type ep; 1926 uint8_t num_rules; 1927 uint32_t add_after_hdl; 1928 uint32_t flt_rule_size; 1929 uintptr_t rules; 1930 }; 1931 1932 /** 1933 * struct ipa_flt_rule_mdfy - filtering rule descriptor includes 1934 * in and out parameters 1935 * @rule: actual rule to be added 1936 * @flt_rule_hdl: handle to rule 1937 * @status: output parameter, status of filtering rule modify operation, 1938 * 0 for success, 1939 * -1 for failure 1940 * 1941 */ 1942 struct ipa_flt_rule_mdfy { 1943 struct ipa_flt_rule rule; 1944 uint32_t rule_hdl; 1945 int status; 1946 }; 1947 1948 /** 1949 * struct ipa_flt_rule_mdfy_v2 - filtering rule descriptor 1950 * includes in and out parameters 1951 * @rule: actual rule to be added 1952 * @flt_rule_hdl: handle to rule 1953 * @status: output parameter, status of filtering rule modify operation, 1954 * 0 for success, 1955 * -1 for failure 1956 * 1957 */ 1958 struct ipa_flt_rule_mdfy_v2 { 1959 uint32_t rule_hdl; 1960 int status; 1961 struct ipa_flt_rule_v2 rule; 1962 }; 1963 1964 /** 1965 * struct ipa_ioc_mdfy_flt_rule - filtering rule modify parameters (supports 1966 * multiple rules and commit) 1967 * @commit: should rules be written to IPA HW also? 1968 * @ip: IP family of rule 1969 * @num_rules: number of filtering rules that follow 1970 * @rules: all rules need to go back to back here, no pointers 1971 */ 1972 struct ipa_ioc_mdfy_flt_rule { 1973 uint8_t commit; 1974 enum ipa_ip_type ip; 1975 uint8_t num_rules; 1976 struct ipa_flt_rule_mdfy rules[0]; 1977 }; 1978 1979 /** 1980 * struct ipa_ioc_mdfy_flt_rule_v2 - filtering rule modify 1981 * parameters (supports multiple rules and commit) 1982 * @commit: should rules be written to IPA HW also? 1983 * @ip: IP family of rule 1984 * @num_rules: number of filtering rules that follow 1985 * @rule_mdfy_size: sizeof(struct ipa_flt_rule_mdfy_v2) 1986 * @rules: all rules need to go back to back here, no pointers 1987 */ 1988 struct ipa_ioc_mdfy_flt_rule_v2 { 1989 uint8_t commit; 1990 enum ipa_ip_type ip; 1991 uint8_t num_rules; 1992 uint32_t rule_mdfy_size; 1993 uintptr_t rules; 1994 }; 1995 1996 /** 1997 * struct ipa_flt_rule_del - filtering rule descriptor includes 1998 * in and out parameters 1999 * 2000 * @hdl: handle returned from filtering rule add operation 2001 * @status: output parameter, status of filtering rule delete operation, 2002 * 0 for success, 2003 * -1 for failure 2004 */ 2005 struct ipa_flt_rule_del { 2006 uint32_t hdl; 2007 int status; 2008 }; 2009 2010 /** 2011 * struct ipa_ioc_del_flt_rule - filtering rule deletion parameters (supports 2012 * multiple headers and commit) 2013 * @commit: should rules be removed from IPA HW also? 2014 * @ip: IP family of rules 2015 * @num_hdls: num of rules being removed 2016 * @hdl: all handles need to go back to back here, no pointers 2017 */ 2018 struct ipa_ioc_del_flt_rule { 2019 uint8_t commit; 2020 enum ipa_ip_type ip; 2021 uint8_t num_hdls; 2022 struct ipa_flt_rule_del hdl[0]; 2023 }; 2024 2025 /** 2026 * struct ipa_ioc_get_rt_tbl - routing table lookup parameters, if lookup was 2027 * successful caller must call put to release the reference 2028 * count when done 2029 * @ip: IP family of table 2030 * @name: name of routing table resource 2031 * @htl: output parameter, handle of routing table, valid only when ioctl 2032 * return val is non-negative 2033 */ 2034 struct ipa_ioc_get_rt_tbl { 2035 enum ipa_ip_type ip; 2036 char name[IPA_RESOURCE_NAME_MAX]; 2037 uint32_t hdl; 2038 }; 2039 2040 /** 2041 * struct ipa_ioc_query_intf - used to lookup number of tx and 2042 * rx properties of interface 2043 * @name: name of interface 2044 * @num_tx_props: output parameter, number of tx properties 2045 * valid only when ioctl return val is non-negative 2046 * @num_rx_props: output parameter, number of rx properties 2047 * valid only when ioctl return val is non-negative 2048 * @num_ext_props: output parameter, number of ext properties 2049 * valid only when ioctl return val is non-negative 2050 * @excp_pipe: exception packets of this interface should be 2051 * routed to this pipe 2052 */ 2053 struct ipa_ioc_query_intf { 2054 char name[IPA_RESOURCE_NAME_MAX]; 2055 uint32_t num_tx_props; 2056 uint32_t num_rx_props; 2057 uint32_t num_ext_props; 2058 enum ipa_client_type excp_pipe; 2059 }; 2060 2061 /** 2062 * struct ipa_ioc_tx_intf_prop - interface tx property 2063 * @ip: IP family of routing rule 2064 * @attrib: routing rule 2065 * @dst_pipe: routing output pipe 2066 * @alt_dst_pipe: alternate routing output pipe 2067 * @hdr_name: name of associated header if any, empty string when no header 2068 * @hdr_l2_type: type of associated header if any, use NONE when no header 2069 */ 2070 struct ipa_ioc_tx_intf_prop { 2071 enum ipa_ip_type ip; 2072 struct ipa_rule_attrib attrib; 2073 enum ipa_client_type dst_pipe; 2074 enum ipa_client_type alt_dst_pipe; 2075 char hdr_name[IPA_RESOURCE_NAME_MAX]; 2076 enum ipa_hdr_l2_type hdr_l2_type; 2077 }; 2078 2079 /** 2080 * struct ipa_ioc_query_intf_tx_props - interface tx propertie 2081 * @name: name of interface 2082 * @num_tx_props: number of TX properties 2083 * @tx[0]: output parameter, the tx properties go here back to back 2084 */ 2085 struct ipa_ioc_query_intf_tx_props { 2086 char name[IPA_RESOURCE_NAME_MAX]; 2087 uint32_t num_tx_props; 2088 struct ipa_ioc_tx_intf_prop tx[0]; 2089 }; 2090 2091 /** 2092 * struct ipa_ioc_ext_intf_prop - interface extended property 2093 * @ip: IP family of routing rule 2094 * @eq_attrib: attributes of the rule in equation form 2095 * @action: action field 2096 * @rt_tbl_idx: index of RT table referred to by filter rule 2097 * @mux_id: MUX_ID 2098 * @filter_hdl: handle of filter (as specified by provider of filter rule) 2099 * @is_xlat_rule: it is xlat flt rule or not 2100 */ 2101 struct ipa_ioc_ext_intf_prop { 2102 enum ipa_ip_type ip; 2103 struct ipa_ipfltri_rule_eq eq_attrib; 2104 enum ipa_flt_action action; 2105 uint32_t rt_tbl_idx; 2106 uint8_t mux_id; 2107 uint32_t filter_hdl; 2108 uint8_t is_xlat_rule; 2109 uint32_t rule_id; 2110 uint8_t is_rule_hashable; 2111 #define IPA_V6_UL_WL_FIREWALL_HANDLE 2112 uint8_t replicate_needed; 2113 }; 2114 2115 /** 2116 * struct ipa_ioc_query_intf_ext_props - interface ext propertie 2117 * @name: name of interface 2118 * @num_ext_props: number of EXT properties 2119 * @ext[0]: output parameter, the ext properties go here back to back 2120 */ 2121 struct ipa_ioc_query_intf_ext_props { 2122 char name[IPA_RESOURCE_NAME_MAX]; 2123 uint32_t num_ext_props; 2124 struct ipa_ioc_ext_intf_prop ext[0]; 2125 }; 2126 2127 /** 2128 * struct ipa_ioc_rx_intf_prop - interface rx property 2129 * @ip: IP family of filtering rule 2130 * @attrib: filtering rule 2131 * @src_pipe: input pipe 2132 * @hdr_l2_type: type of associated header if any, use NONE when no header 2133 */ 2134 struct ipa_ioc_rx_intf_prop { 2135 enum ipa_ip_type ip; 2136 struct ipa_rule_attrib attrib; 2137 enum ipa_client_type src_pipe; 2138 enum ipa_hdr_l2_type hdr_l2_type; 2139 }; 2140 2141 /** 2142 * struct ipa_ioc_query_intf_rx_props - interface rx propertie 2143 * @name: name of interface 2144 * @num_rx_props: number of RX properties 2145 * @rx: output parameter, the rx properties go here back to back 2146 */ 2147 struct ipa_ioc_query_intf_rx_props { 2148 char name[IPA_RESOURCE_NAME_MAX]; 2149 uint32_t num_rx_props; 2150 struct ipa_ioc_rx_intf_prop rx[0]; 2151 }; 2152 2153 /** 2154 * struct ipa_ioc_nat_alloc_mem - nat table memory allocation 2155 * properties 2156 * @dev_name: input parameter, the name of table 2157 * @size: input parameter, size of table in bytes 2158 * @offset: output parameter, offset into page in case of system memory 2159 */ 2160 struct ipa_ioc_nat_alloc_mem { 2161 char dev_name[IPA_RESOURCE_NAME_MAX]; 2162 size_t size; 2163 off_t offset; 2164 }; 2165 2166 /** 2167 * struct ipa_ioc_nat_ipv6ct_table_alloc - NAT/IPv6CT table memory allocation 2168 * properties 2169 * @size: input parameter, size of table in bytes 2170 * @offset: output parameter, offset into page in case of system memory 2171 */ 2172 struct ipa_ioc_nat_ipv6ct_table_alloc { 2173 size_t size; 2174 off_t offset; 2175 }; 2176 2177 /** 2178 * struct ipa_ioc_v4_nat_init - nat table initialization parameters 2179 * @tbl_index: input parameter, index of the table 2180 * @ipv4_rules_offset: input parameter, ipv4 rules address offset 2181 * @expn_rules_offset: input parameter, ipv4 expansion rules address offset 2182 * @index_offset: input parameter, index rules offset 2183 * @index_expn_offset: input parameter, index expansion rules offset 2184 * @table_entries: input parameter, ipv4 rules table number of entries 2185 * @expn_table_entries: input parameter, ipv4 expansion rules table number of 2186 * entries 2187 * @ip_addr: input parameter, public ip address 2188 * @mem_type: input parameter, type of memory the table resides in 2189 * @focus_change: input parameter, are we moving to/from sram or ddr 2190 */ 2191 struct ipa_ioc_v4_nat_init { 2192 uint8_t tbl_index; 2193 uint32_t ipv4_rules_offset; 2194 uint32_t expn_rules_offset; 2195 2196 uint32_t index_offset; 2197 uint32_t index_expn_offset; 2198 2199 uint16_t table_entries; 2200 uint16_t expn_table_entries; 2201 uint32_t ip_addr; 2202 2203 uint8_t mem_type; 2204 uint8_t focus_change; 2205 }; 2206 2207 /** 2208 * struct ipa_ioc_ipv6ct_init - IPv6CT table initialization parameters 2209 * @base_table_offset: input parameter, IPv6CT base table address offset 2210 * @expn_table_offset: input parameter, IPv6CT expansion table address offset 2211 * @table_entries: input parameter, IPv6CT table number of entries 2212 * @expn_table_entries: input parameter, IPv6CT expansion table number of 2213 * entries 2214 * @tbl_index: input parameter, index of the table 2215 */ 2216 struct ipa_ioc_ipv6ct_init { 2217 uint32_t base_table_offset; 2218 uint32_t expn_table_offset; 2219 uint16_t table_entries; 2220 uint16_t expn_table_entries; 2221 uint8_t tbl_index; 2222 }; 2223 2224 /** 2225 * struct ipa_ioc_v4_nat_del - nat table delete parameter 2226 * @table_index: input parameter, index of the table 2227 * @public_ip_addr: input parameter, public ip address 2228 */ 2229 struct ipa_ioc_v4_nat_del { 2230 uint8_t table_index; 2231 uint32_t public_ip_addr; 2232 }; 2233 2234 /** 2235 * struct ipa_ioc_nat_ipv6ct_table_del - NAT/IPv6CT table delete parameter 2236 * @table_index: input parameter, index of the table 2237 * @mem_type: input parameter, type of memory the table resides in 2238 */ 2239 struct ipa_ioc_nat_ipv6ct_table_del { 2240 uint8_t table_index; 2241 uint8_t mem_type; 2242 }; 2243 2244 /** 2245 * struct ipa_ioc_nat_dma_one - nat/ipv6ct dma command parameter 2246 * @table_index: input parameter, index of the table 2247 * @base_addr: type of table, from which the base address of the table 2248 * can be inferred 2249 * @offset: destination offset within the NAT table 2250 * @data: data to be written. 2251 */ 2252 struct ipa_ioc_nat_dma_one { 2253 uint8_t table_index; 2254 uint8_t base_addr; 2255 2256 uint32_t offset; 2257 uint16_t data; 2258 2259 }; 2260 2261 /** 2262 * struct ipa_ioc_nat_dma_cmd - To hold multiple nat/ipv6ct dma commands 2263 * @entries: number of dma commands in use 2264 * @dma: data pointer to the dma commands 2265 * @mem_type: input parameter, type of memory the table resides in 2266 */ 2267 struct ipa_ioc_nat_dma_cmd { 2268 uint8_t entries; 2269 uint8_t mem_type; 2270 struct ipa_ioc_nat_dma_one dma[0]; 2271 }; 2272 2273 /** 2274 * struct ipa_ioc_nat_pdn_entry - PDN entry modification data 2275 * @pdn_index: index of the entry in the PDN config table to be changed 2276 * @public_ip: PDN's public ip 2277 * @src_metadata: PDN's source NAT metadata for metadata replacement 2278 * @dst_metadata: PDN's destination NAT metadata for metadata replacement 2279 */ 2280 struct ipa_ioc_nat_pdn_entry { 2281 uint8_t pdn_index; 2282 uint32_t public_ip; 2283 uint32_t src_metadata; 2284 uint32_t dst_metadata; 2285 }; 2286 2287 /** 2288 * struct ipa_ioc_vlan_iface_info - add vlan interface 2289 * @name: interface name 2290 * @vlan_id: VLAN ID 2291 */ 2292 struct ipa_ioc_vlan_iface_info { 2293 char name[IPA_RESOURCE_NAME_MAX]; 2294 uint8_t vlan_id; 2295 }; 2296 2297 /** 2298 * enum ipa_l2tp_tunnel_type - IP or UDP 2299 */ 2300 enum ipa_l2tp_tunnel_type { 2301 IPA_L2TP_TUNNEL_IP = 1, 2302 IPA_L2TP_TUNNEL_UDP = 2 2303 #define IPA_L2TP_TUNNEL_UDP IPA_L2TP_TUNNEL_UDP 2304 }; 2305 2306 2307 /** 2308 * struct ipa_ioc_l2tp_vlan_mapping_info - l2tp->vlan mapping info 2309 * @iptype: l2tp tunnel IP type 2310 * @l2tp_iface_name: l2tp interface name 2311 * @l2tp_session_id: l2tp session id 2312 * @vlan_iface_name: vlan interface name 2313 * @tunnel_type: l2tp tunnel type 2314 * @src_port: UDP source port 2315 * @dst_port: UDP destination port 2316 * @mtu: MTU of the L2TP interface 2317 */ 2318 struct ipa_ioc_l2tp_vlan_mapping_info { 2319 enum ipa_ip_type iptype; 2320 char l2tp_iface_name[IPA_RESOURCE_NAME_MAX]; 2321 uint32_t l2tp_session_id; 2322 char vlan_iface_name[IPA_RESOURCE_NAME_MAX]; 2323 enum ipa_l2tp_tunnel_type tunnel_type; 2324 uint16_t src_port; 2325 uint16_t dst_port; 2326 uint16_t mtu; 2327 }; 2328 2329 /** 2330 * struct ipa_ioc_gsb_info - connect/disconnect 2331 * @name: interface name 2332 */ 2333 struct ipa_ioc_gsb_info { 2334 char name[IPA_RESOURCE_NAME_MAX]; 2335 }; 2336 2337 #define QUERY_MAX_EP_PAIRS 2 2338 2339 #define IPA_USB0_EP_ID 11 2340 #define IPA_USB1_EP_ID 12 2341 2342 #define IPA_PCIE0_EP_ID 21 2343 #define IPA_PCIE1_EP_ID 22 2344 2345 #define IPA_ETH0_EP_ID 31 2346 #define IPA_ETH1_EP_ID 32 2347 2348 enum ipa_peripheral_ep_type { 2349 IPA_DATA_EP_TYP_RESERVED = 0, 2350 IPA_DATA_EP_TYP_HSIC = 1, 2351 IPA_DATA_EP_TYP_HSUSB = 2, 2352 IPA_DATA_EP_TYP_PCIE = 3, 2353 IPA_DATA_EP_TYP_EMBEDDED = 4, 2354 IPA_DATA_EP_TYP_BAM_DMUX = 5, 2355 IPA_DATA_EP_TYP_ETH, 2356 }; 2357 2358 enum ipa_data_ep_prot_type { 2359 IPA_PROT_RMNET = 0, 2360 IPA_PROT_RMNET_CV2X = 1, 2361 IPA_PROT_MAX 2362 }; 2363 2364 struct ipa_ep_pair_info { 2365 uint32_t consumer_pipe_num; 2366 uint32_t producer_pipe_num; 2367 uint32_t ep_id; 2368 }; 2369 2370 /** 2371 * struct ipa_ioc_get_ep_info - query usb/pcie ep info 2372 * @ep_type: type USB/PCIE - i/p param 2373 * @max_ep_pairs: max number of ep_pairs (constant), 2374 (QUERY_MAX_EP_PAIRS) 2375 * @num_ep_pairs: number of ep_pairs - o/p param 2376 * @ep_pair_size: sizeof(ipa_ep_pair_info) * max_ep_pairs 2377 * @info: structure contains ep pair info 2378 * @teth_prot : RMNET/CV2X --i/p param 2379 * @teth_prot_valid - validity of i/p param protocol 2380 */ 2381 struct ipa_ioc_get_ep_info { 2382 enum ipa_peripheral_ep_type ep_type; 2383 uint8_t max_ep_pairs; 2384 uint8_t num_ep_pairs; 2385 uint32_t ep_pair_size; 2386 uintptr_t info; 2387 enum ipa_data_ep_prot_type teth_prot; 2388 uint8_t teth_prot_valid; 2389 }; 2390 2391 /** 2392 * struct ipa_ioc_wigig_fst_switch - switch between wigig and wlan 2393 * @netdev_name: wigig interface name 2394 * @client_mac_addr: client to switch between netdevs 2395 * @to_wigig: shall wlan client switch to wigig or the opposite? 2396 */ 2397 struct ipa_ioc_wigig_fst_switch { 2398 uint8_t netdev_name[IPA_RESOURCE_NAME_MAX]; 2399 uint8_t client_mac_addr[IPA_MAC_ADDR_SIZE]; 2400 int to_wigig; 2401 }; 2402 2403 /** 2404 * struct ipa_msg_meta - Format of the message meta-data. 2405 * @msg_type: the type of the message 2406 * @rsvd: reserved bits for future use. 2407 * @msg_len: the length of the message in bytes 2408 * 2409 * For push model: 2410 * Client in user-space should issue a read on the device (/dev/ipa) with a 2411 * sufficiently large buffer in a continuous loop, call will block when there is 2412 * no message to read. Upon return, client can read the ipa_msg_meta from start 2413 * of buffer to find out type and length of message 2414 * size of buffer supplied >= (size of largest message + size of metadata) 2415 * 2416 * For pull model: 2417 * Client in user-space can also issue a pull msg IOCTL to device (/dev/ipa) 2418 * with a payload containing space for the ipa_msg_meta and the message specific 2419 * payload length. 2420 * size of buffer supplied == (len of specific message + size of metadata) 2421 */ 2422 struct ipa_msg_meta { 2423 uint8_t msg_type; 2424 uint8_t rsvd; 2425 uint16_t msg_len; 2426 }; 2427 2428 /** 2429 * struct ipa_wlan_msg - To hold information about wlan client 2430 * @name: name of the wlan interface 2431 * @mac_addr: mac address of wlan client 2432 * 2433 * wlan drivers need to pass name of wlan iface and mac address of 2434 * wlan client along with ipa_wlan_event, whenever a wlan client is 2435 * connected/disconnected/moved to power save/come out of power save 2436 */ 2437 struct ipa_wlan_msg { 2438 char name[IPA_RESOURCE_NAME_MAX]; 2439 uint8_t mac_addr[IPA_MAC_ADDR_SIZE]; 2440 }; 2441 2442 /** 2443 * enum ipa_wlan_hdr_attrib_type - attribute type 2444 * in wlan client header 2445 * 2446 * WLAN_HDR_ATTRIB_MAC_ADDR: attrib type mac address 2447 * WLAN_HDR_ATTRIB_STA_ID: attrib type station id 2448 */ 2449 enum ipa_wlan_hdr_attrib_type { 2450 WLAN_HDR_ATTRIB_MAC_ADDR, 2451 WLAN_HDR_ATTRIB_STA_ID 2452 }; 2453 2454 /** 2455 * struct ipa_wlan_hdr_attrib_val - header attribute value 2456 * @attrib_type: type of attribute 2457 * @offset: offset of attribute within header 2458 * @u.mac_addr: mac address 2459 * @u.sta_id: station id 2460 */ 2461 struct ipa_wlan_hdr_attrib_val { 2462 enum ipa_wlan_hdr_attrib_type attrib_type; 2463 uint8_t offset; 2464 union { 2465 uint8_t mac_addr[IPA_MAC_ADDR_SIZE]; 2466 uint8_t sta_id; 2467 } u; 2468 }; 2469 2470 /** 2471 * struct ipa_wlan_msg_ex - To hold information about wlan client 2472 * @name: name of the wlan interface 2473 * @num_of_attribs: number of attributes 2474 * @attrib_val: holds attribute values 2475 * 2476 * wlan drivers need to pass name of wlan iface and mac address 2477 * of wlan client or station id along with ipa_wlan_event, 2478 * whenever a wlan client is connected/disconnected/moved to 2479 * power save/come out of power save 2480 */ 2481 struct ipa_wlan_msg_ex { 2482 char name[IPA_RESOURCE_NAME_MAX]; 2483 uint8_t num_of_attribs; 2484 struct ipa_wlan_hdr_attrib_val attribs[0]; 2485 }; 2486 2487 /** 2488 * struct ipa_wigig_msg- To hold information about wigig event 2489 * @name: name of the wigig interface 2490 * @client_mac_addr: the relevant wigig client mac address 2491 * @ipa_client: TX pipe associated with the wigig client in case of connect 2492 * @to_wigig: FST switch direction wlan->wigig? 2493 */ 2494 struct ipa_wigig_msg { 2495 char name[IPA_RESOURCE_NAME_MAX]; 2496 uint8_t client_mac_addr[IPA_MAC_ADDR_SIZE]; 2497 union { 2498 enum ipa_client_type ipa_client; 2499 uint8_t to_wigig; 2500 } u; 2501 }; 2502 2503 struct ipa_ecm_msg { 2504 char name[IPA_RESOURCE_NAME_MAX]; 2505 int ifindex; 2506 }; 2507 2508 /** 2509 * struct ipa_wan_msg - To hold information about wan client 2510 * @name: name of the wan interface 2511 * 2512 * CnE need to pass the name of default wan iface when connected/disconnected. 2513 * CNE need to pass the gw info in wlan AP+STA mode. 2514 * netmgr need to pass the name of wan eMBMS iface when connected. 2515 */ 2516 struct ipa_wan_msg { 2517 char upstream_ifname[IPA_RESOURCE_NAME_MAX]; 2518 char tethered_ifname[IPA_RESOURCE_NAME_MAX]; 2519 enum ipa_ip_type ip; 2520 uint32_t ipv4_addr_gw; 2521 uint32_t ipv6_addr_gw[IPA_WAN_MSG_IPv6_ADDR_GW_LEN]; 2522 }; 2523 2524 /* uc activation command Ids */ 2525 #define IPA_SOCKSV5_ADD_COM_ID 15 2526 #define IPA_IPv6_NAT_COM_ID 16 2527 2528 /** 2529 * ipa_kernel_tests_socksv5_uc_tmpl - uc activation entry info 2530 * @cmd_id: uc command id 2531 * @cmd_param: uC command param 2532 * @ipa_kernel_tests_ip_hdr_temp: ip header 2533 * @src_port: source port 2534 * @dst_port: destination port 2535 * @ipa_sockv5_mask: uc attribute mask for options/etc 2536 * @out_irs: 4B/4B Seq/Ack/SACK 2537 * @out_iss 2538 * @in_irs 2539 * @in_iss 2540 * @out_ircv_tsval: timestamp attributes 2541 * @in_ircv_tsecr 2542 * @out_ircv_tsecr 2543 * @in_ircv_tsval 2544 * @in_isnd_wscale: window scale attributes 2545 * @out_isnd_wscale 2546 * @in_ircv_wscale 2547 * @out_ircv_wscale 2548 * @direction: 1 for UL 0 for DL 2549 * @handle: uc activation table index 2550 */ 2551 struct ipa_kernel_tests_socksv5_uc_tmpl { 2552 uint16_t cmd_id; 2553 uint32_t cmd_param; 2554 __be32 ip_src_addr; 2555 __be32 ip_dst_addr; 2556 __be32 ipv6_src_addr[4]; 2557 __be32 ipv6_dst_addr[4]; 2558 2559 /* 2B src/dst port */ 2560 uint16_t src_port; 2561 uint16_t dst_port; 2562 2563 /* attribute mask */ 2564 uint32_t ipa_sockv5_mask; 2565 2566 /* required update 4B/4B Seq/Ack/SACK */ 2567 uint32_t out_irs; 2568 uint32_t out_iss; 2569 uint32_t in_irs; 2570 uint32_t in_iss; 2571 2572 /* option 10B: time-stamp */ 2573 uint32_t out_ircv_tsval; 2574 uint32_t in_ircv_tsecr; 2575 uint32_t out_ircv_tsecr; 2576 uint32_t in_ircv_tsval; 2577 2578 /* option 2B: window-scaling/dynamic */ 2579 uint16_t in_isnd_wscale : 4; 2580 uint16_t out_isnd_wscale : 4; 2581 uint16_t in_ircv_wscale : 4; 2582 uint16_t out_ircv_wscale : 4; 2583 2584 /* direction 1 = UL, 0 = DL */ 2585 uint8_t direction; 2586 2587 /* output: handle (index) */ 2588 uint16_t handle; 2589 }; 2590 2591 /** 2592 * struct ipacm_socksv5_info - To hold information about socksv5 connections 2593 * @ip_type: ip type 2594 * @ipv4_src: ipv4 src address 2595 * @ipv4_dst: ipv4 dst address 2596 * @ipv6_src: ipv6 src address 2597 * @ipv6_dst: ipv6 dst address 2598 * @src_port: src port number 2599 * @dst_port: dst port number 2600 * @index: the uc activation tbl index 2601 */ 2602 2603 struct ipacm_socksv5_info { 2604 /* ip-type */ 2605 enum ipa_ip_type ip_type; 2606 2607 /* ipv4 */ 2608 uint32_t ipv4_src; 2609 uint32_t ipv4_dst; 2610 2611 /* ipv6 */ 2612 uint32_t ipv6_src[4]; 2613 uint32_t ipv6_dst[4]; 2614 2615 /* 2B src/dst port */ 2616 uint16_t src_port; 2617 uint16_t dst_port; 2618 2619 /* uc-tbl index */ 2620 uint16_t index; 2621 }; 2622 2623 /** 2624 * struct ipa_socksv5_msg - To hold information about socksv5 client 2625 * @ul_in: uplink connection info 2626 * @dl_in: downlink connection info 2627 * @handle: used for ipacm to distinguish connections 2628 * 2629 * CnE need to pass the name of default wan iface when connected/disconnected. 2630 * CNE need to pass the gw info in wlan AP+STA mode. 2631 * netmgr need to pass the name of wan eMBMS iface when connected. 2632 */ 2633 struct ipa_socksv5_msg { 2634 struct ipacm_socksv5_info ul_in; 2635 struct ipacm_socksv5_info dl_in; 2636 2637 /* handle (index) */ 2638 uint16_t handle; 2639 }; 2640 2641 /** 2642 * struct ipa_ioc_ipv6_nat_uc_act_entry - To hold information about IPv6 NAT 2643 * uC entry 2644 * @cmd_id[in]: IPv6 NAT uC CMD ID - used for identifying uc activation type 2645 * @private_address_lsb[in]: client private address lsb 2646 * @private_address_msb[in]: client private address msb 2647 * @public_address_lsb[in]: client public address lsb 2648 * @public_address_msb[in]: client public address msb 2649 * @private_port[in]: client private port 2650 * @public_port[in]: client public port 2651 * @index[out]: uC activation entry index 2652 */ 2653 struct ipa_ioc_ipv6_nat_uc_act_entry { 2654 uint16_t cmd_id; 2655 uint64_t private_address_lsb; 2656 uint64_t private_address_msb; 2657 uint64_t public_address_lsb; 2658 uint64_t public_address_msb; 2659 uint32_t private_port; 2660 uint32_t public_port; 2661 uint16_t index; 2662 }; 2663 2664 /** 2665 * union ipa_ioc_uc_activation_entry - To hold information about uC activation 2666 * entry 2667 * @socks[in]: fill here if entry is Socksv5 entry 2668 * @ipv6_nat[in]: fill here if entry is IPv6 NAT entry 2669 */ 2670 union ipa_ioc_uc_activation_entry { 2671 struct ipa_kernel_tests_socksv5_uc_tmpl socks; 2672 struct ipa_ioc_ipv6_nat_uc_act_entry ipv6_nat; 2673 }; 2674 2675 2676 /** 2677 * struct ipa_ioc_rm_dependency - parameters for add/delete dependency 2678 * @resource_name: name of dependent resource 2679 * @depends_on_name: name of its dependency 2680 */ 2681 struct ipa_ioc_rm_dependency { 2682 enum ipa_rm_resource_name resource_name; 2683 enum ipa_rm_resource_name depends_on_name; 2684 }; 2685 2686 struct ipa_ioc_generate_flt_eq { 2687 enum ipa_ip_type ip; 2688 struct ipa_rule_attrib attrib; 2689 struct ipa_ipfltri_rule_eq eq_attrib; 2690 }; 2691 2692 /** 2693 * struct ipa_ioc_write_qmapid - to write mux id to endpoint meta register 2694 * @mux_id: mux id of wan 2695 */ 2696 struct ipa_ioc_write_qmapid { 2697 enum ipa_client_type client; 2698 uint8_t qmap_id; 2699 }; 2700 2701 /** 2702 * struct ipa_flt_rt_counter_alloc - flt/rt counter id allocation 2703 * @num_counters: input param, num of counters need to be allocated 2704 * @allow_less: input param, if true, success even few counter than request 2705 * @start_id: output param, allocated start_id, 0 when allocation fails 2706 * @end_id: output param, allocated start_id, 0 when allocation fails 2707 */ 2708 struct ipa_flt_rt_counter_alloc { 2709 uint8_t num_counters; 2710 uint8_t allow_less; 2711 uint8_t start_id; 2712 uint8_t end_id; 2713 }; 2714 2715 /** 2716 * struct ipa_ioc_flt_rt_counter_alloc - flt/rt counter id allocation ioctl 2717 * @hdl: output param, hdl used for deallocation, negative if allocation fails 2718 * @hw_counter: HW counters for HW process 2719 * @sw_counter: SW counters for uC / non-HW process 2720 */ 2721 struct ipa_ioc_flt_rt_counter_alloc { 2722 int hdl; 2723 struct ipa_flt_rt_counter_alloc hw_counter; 2724 struct ipa_flt_rt_counter_alloc sw_counter; 2725 }; 2726 2727 /** 2728 * struct ipa_flt_rt_stats - flt/rt stats info 2729 * @num_pkts: number of packets 2730 * @num_pkts_hash: number of packets in hash entry 2731 * @num_bytes: number of bytes 2732 */ 2733 struct ipa_flt_rt_stats { 2734 uint32_t num_pkts; 2735 uint32_t num_pkts_hash; 2736 uint64_t num_bytes; 2737 }; 2738 2739 /** 2740 * struct ipa_ioc_flt_rt_query - flt/rt counter id query 2741 * @start_id: start counter id for query 2742 * @end_id: end counter id for query 2743 * @reset: this query need hw counter to be reset or not 2744 * @stats_size: sizeof(ipa_flt_rt_stats) 2745 * @stats: structure contains the query result 2746 */ 2747 struct ipa_ioc_flt_rt_query { 2748 uint8_t start_id; 2749 uint8_t end_id; 2750 uint8_t reset; 2751 uint32_t stats_size; 2752 uintptr_t stats; 2753 }; 2754 2755 enum ipacm_client_enum { 2756 IPACM_CLIENT_USB = 1, 2757 IPACM_CLIENT_WLAN, 2758 IPACM_CLIENT_MAX 2759 }; 2760 2761 #define IPACM_SUPPORT_OF_LAN_STATS_FOR_ODU_CLIENTS 2762 2763 enum ipacm_per_client_device_type { 2764 IPACM_CLIENT_DEVICE_TYPE_USB = 0, 2765 IPACM_CLIENT_DEVICE_TYPE_WLAN = 1, 2766 IPACM_CLIENT_DEVICE_TYPE_ETH = 2, 2767 IPACM_CLIENT_DEVICE_TYPE_ODU = 3, 2768 IPACM_CLIENT_DEVICE_MAX 2769 }; 2770 2771 /** 2772 * max number of device types supported. 2773 */ 2774 #define IPACM_MAX_CLIENT_DEVICE_TYPES IPACM_CLIENT_DEVICE_MAX 2775 2776 /** 2777 * @lanIface - Name of the lan interface 2778 * @mac: Mac address of the client. 2779 */ 2780 struct ipa_lan_client_msg { 2781 char lanIface[IPA_RESOURCE_NAME_MAX]; 2782 uint8_t mac[IPA_MAC_ADDR_SIZE]; 2783 }; 2784 2785 /** 2786 * struct ipa_lan_client - lan client data 2787 * @mac: MAC Address of the client. 2788 * @client_idx: Client Index. 2789 * @inited: Bool to indicate whether client info is set. 2790 */ 2791 struct ipa_lan_client { 2792 uint8_t mac[IPA_MAC_ADDR_SIZE]; 2793 int8_t client_idx; 2794 uint8_t inited; 2795 }; 2796 2797 /** 2798 * struct ipa_lan_client_cntr_index 2799 * @ul_cnt_idx: H/w counter index for uplink stats 2800 * @dl_cnt_idx: H/w counter index for downlink stats 2801 */ 2802 struct ipa_lan_client_cntr_index { 2803 uint8_t ul_cnt_idx; 2804 uint8_t dl_cnt_idx; 2805 }; 2806 2807 /** 2808 * struct ipa_tether_device_info - tether device info indicated from IPACM 2809 * @ul_src_pipe: Source pipe of the lan client. 2810 * @hdr_len: Header length of the client. 2811 * @num_clients: Number of clients connected. 2812 */ 2813 struct ipa_tether_device_info { 2814 int32_t ul_src_pipe; 2815 uint8_t hdr_len; 2816 uint32_t num_clients; 2817 struct ipa_lan_client lan_client[IPA_MAX_NUM_HW_PATH_CLIENTS]; 2818 struct ipa_lan_client_cntr_index 2819 lan_client_indices[IPA_MAX_NUM_HW_PATH_CLIENTS]; 2820 }; 2821 2822 /** 2823 * enum ipa_vlan_ifaces - vlan interfaces types 2824 */ 2825 enum ipa_vlan_ifaces { 2826 IPA_VLAN_IF_ETH, 2827 IPA_VLAN_IF_RNDIS, 2828 IPA_VLAN_IF_ECM 2829 }; 2830 2831 #define IPA_VLAN_IF_EMAC IPA_VLAN_IF_ETH 2832 #define IPA_VLAN_IF_MAX (IPA_VLAN_IF_ECM + 1) 2833 2834 /** 2835 * struct ipa_get_vlan_mode - get vlan mode of a Lan interface 2836 * @iface: Lan interface type to be queried. 2837 * @is_vlan_mode: output parameter, is interface in vlan mode, valid only when 2838 * ioctl return val is non-negative 2839 */ 2840 struct ipa_ioc_get_vlan_mode { 2841 enum ipa_vlan_ifaces iface; 2842 uint32_t is_vlan_mode; 2843 }; 2844 2845 /** 2846 * struct ipa_ioc_bridge_vlan_mapping_info - vlan to bridge mapping info 2847 * @bridge_name: bridge interface name 2848 * @vlan_id: vlan ID bridge is mapped to 2849 * @bridge_ipv4: bridge interface ipv4 address 2850 * @subnet_mask: bridge interface subnet mask 2851 * @lan2lan_sw: indicate lan2lan traffic take sw-path or not 2852 */ 2853 struct ipa_ioc_bridge_vlan_mapping_info { 2854 char bridge_name[IPA_RESOURCE_NAME_MAX]; 2855 uint16_t vlan_id; 2856 uint32_t bridge_ipv4; 2857 uint32_t subnet_mask; 2858 uint8_t lan2lan_sw; 2859 }; 2860 2861 struct ipa_coalesce_info { 2862 uint8_t qmap_id; 2863 uint8_t tcp_enable; 2864 uint8_t udp_enable; 2865 }; 2866 2867 struct ipa_odl_ep_info { 2868 __u32 cons_pipe_num; 2869 __u32 prod_pipe_num; 2870 __u32 peripheral_iface_id; 2871 __u32 ep_type; 2872 }; 2873 2874 struct odl_agg_pipe_info { 2875 __u16 agg_byte_limit; 2876 }; 2877 2878 struct ipa_odl_modem_config { 2879 __u8 config_status; 2880 }; 2881 2882 /** 2883 * struct ipa_ioc_pdn_config - provide pdn configuration 2884 * @dev_name: PDN interface name 2885 * @pdn_cfg_type: type of the pdn config applied. 2886 * @enable: enable/disable pdn config type. 2887 * @u.collison_cfg.pdn_ip_addr: pdn_ip_address used in collision config. 2888 * @u.passthrough_cfg.pdn_ip_addr: pdn_ip_address used in passthrough config. 2889 * @u.passthrough_cfg.device_type: Device type of the client. 2890 * @u.passthrough_cfg.vlan_id: VLAN ID of the client. 2891 * @u.passthrough_cfg.client_mac_addr: client mac for which passthough 2892 * is enabled. 2893 * @u.passthrough_cfg.skip_nat: skip NAT processing. 2894 */ 2895 struct ipa_ioc_pdn_config { 2896 char dev_name[IPA_RESOURCE_NAME_MAX]; 2897 enum ipa_pdn_config_event pdn_cfg_type; 2898 uint8_t enable; 2899 union { 2900 2901 struct ipa_pdn_ip_collision_cfg { 2902 uint32_t pdn_ip_addr; 2903 } collison_cfg; 2904 2905 struct ipa_pdn_ip_passthrough_cfg { 2906 uint32_t pdn_ip_addr; 2907 enum ipacm_per_client_device_type device_type; 2908 uint16_t vlan_id; 2909 uint8_t client_mac_addr[IPA_MAC_ADDR_SIZE]; 2910 uint8_t skip_nat; 2911 } passthrough_cfg; 2912 } u; 2913 }; 2914 2915 /** 2916 * struct ipa_ioc_mac_client_list_type- mac addr exception list 2917 * @mac_addr: an array to hold clients mac addrs 2918 * @num_of_clients: holds num of clients to blacklist or whitelist 2919 * @flt_state: true to block current mac addrs and false to clean 2920 * up all previous mac addrs 2921 */ 2922 struct ipa_ioc_mac_client_list_type { 2923 uint8_t mac_addr[IPA_MAX_NUM_MAC_FLT][IPA_MAC_ADDR_SIZE]; 2924 int num_of_clients; 2925 uint8_t flt_state; 2926 }; 2927 2928 /** 2929 * actual IOCTLs supported by IPA driver 2930 */ 2931 #define IPA_IOC_ADD_HDR _IOWR(IPA_IOC_MAGIC, \ 2932 IPA_IOCTL_ADD_HDR, \ 2933 struct ipa_ioc_add_hdr *) 2934 #define IPA_IOC_DEL_HDR _IOWR(IPA_IOC_MAGIC, \ 2935 IPA_IOCTL_DEL_HDR, \ 2936 struct ipa_ioc_del_hdr *) 2937 #define IPA_IOC_ADD_RT_RULE _IOWR(IPA_IOC_MAGIC, \ 2938 IPA_IOCTL_ADD_RT_RULE, \ 2939 struct ipa_ioc_add_rt_rule *) 2940 #define IPA_IOC_ADD_RT_RULE_V2 _IOWR(IPA_IOC_MAGIC, \ 2941 IPA_IOCTL_ADD_RT_RULE_V2, \ 2942 struct ipa_ioc_add_rt_rule_v2 *) 2943 #define IPA_IOC_ADD_RT_RULE_EXT _IOWR(IPA_IOC_MAGIC, \ 2944 IPA_IOCTL_ADD_RT_RULE_EXT, \ 2945 struct ipa_ioc_add_rt_rule_ext *) 2946 #define IPA_IOC_ADD_RT_RULE_EXT_V2 _IOWR(IPA_IOC_MAGIC, \ 2947 IPA_IOCTL_ADD_RT_RULE_EXT_V2, \ 2948 struct ipa_ioc_add_rt_rule_ext_v2 *) 2949 #define IPA_IOC_ADD_RT_RULE_AFTER _IOWR(IPA_IOC_MAGIC, \ 2950 IPA_IOCTL_ADD_RT_RULE_AFTER, \ 2951 struct ipa_ioc_add_rt_rule_after *) 2952 #define IPA_IOC_ADD_RT_RULE_AFTER_V2 _IOWR(IPA_IOC_MAGIC, \ 2953 IPA_IOCTL_ADD_RT_RULE_AFTER_V2, \ 2954 struct ipa_ioc_add_rt_rule_after_v2 *) 2955 #define IPA_IOC_DEL_RT_RULE _IOWR(IPA_IOC_MAGIC, \ 2956 IPA_IOCTL_DEL_RT_RULE, \ 2957 struct ipa_ioc_del_rt_rule *) 2958 #define IPA_IOC_ADD_FLT_RULE _IOWR(IPA_IOC_MAGIC, \ 2959 IPA_IOCTL_ADD_FLT_RULE, \ 2960 struct ipa_ioc_add_flt_rule *) 2961 #define IPA_IOC_ADD_FLT_RULE_V2 _IOWR(IPA_IOC_MAGIC, \ 2962 IPA_IOCTL_ADD_FLT_RULE_V2, \ 2963 struct ipa_ioc_add_flt_rule_v2 *) 2964 #define IPA_IOC_ADD_FLT_RULE_AFTER _IOWR(IPA_IOC_MAGIC, \ 2965 IPA_IOCTL_ADD_FLT_RULE_AFTER, \ 2966 struct ipa_ioc_add_flt_rule_after *) 2967 #define IPA_IOC_ADD_FLT_RULE_AFTER_V2 _IOWR(IPA_IOC_MAGIC, \ 2968 IPA_IOCTL_ADD_FLT_RULE_AFTER_V2, \ 2969 struct ipa_ioc_add_flt_rule_after_v2 *) 2970 #define IPA_IOC_DEL_FLT_RULE _IOWR(IPA_IOC_MAGIC, \ 2971 IPA_IOCTL_DEL_FLT_RULE, \ 2972 struct ipa_ioc_del_flt_rule *) 2973 #define IPA_IOC_COMMIT_HDR _IO(IPA_IOC_MAGIC,\ 2974 IPA_IOCTL_COMMIT_HDR) 2975 #define IPA_IOC_RESET_HDR _IO(IPA_IOC_MAGIC,\ 2976 IPA_IOCTL_RESET_HDR) 2977 #define IPA_IOC_COMMIT_RT _IOW(IPA_IOC_MAGIC, \ 2978 IPA_IOCTL_COMMIT_RT, \ 2979 enum ipa_ip_type) 2980 #define IPA_IOC_RESET_RT _IOW(IPA_IOC_MAGIC, \ 2981 IPA_IOCTL_RESET_RT, \ 2982 enum ipa_ip_type) 2983 #define IPA_IOC_COMMIT_FLT _IOW(IPA_IOC_MAGIC, \ 2984 IPA_IOCTL_COMMIT_FLT, \ 2985 enum ipa_ip_type) 2986 #define IPA_IOC_RESET_FLT _IOW(IPA_IOC_MAGIC, \ 2987 IPA_IOCTL_RESET_FLT, \ 2988 enum ipa_ip_type) 2989 #define IPA_IOC_DUMP _IO(IPA_IOC_MAGIC, \ 2990 IPA_IOCTL_DUMP) 2991 #define IPA_IOC_GET_RT_TBL _IOWR(IPA_IOC_MAGIC, \ 2992 IPA_IOCTL_GET_RT_TBL, \ 2993 struct ipa_ioc_get_rt_tbl *) 2994 #define IPA_IOC_PUT_RT_TBL _IOW(IPA_IOC_MAGIC, \ 2995 IPA_IOCTL_PUT_RT_TBL, \ 2996 uint32_t) 2997 #define IPA_IOC_COPY_HDR _IOWR(IPA_IOC_MAGIC, \ 2998 IPA_IOCTL_COPY_HDR, \ 2999 struct ipa_ioc_copy_hdr *) 3000 #define IPA_IOC_QUERY_INTF _IOWR(IPA_IOC_MAGIC, \ 3001 IPA_IOCTL_QUERY_INTF, \ 3002 struct ipa_ioc_query_intf *) 3003 #define IPA_IOC_QUERY_INTF_TX_PROPS _IOWR(IPA_IOC_MAGIC, \ 3004 IPA_IOCTL_QUERY_INTF_TX_PROPS, \ 3005 struct ipa_ioc_query_intf_tx_props *) 3006 #define IPA_IOC_QUERY_INTF_RX_PROPS _IOWR(IPA_IOC_MAGIC, \ 3007 IPA_IOCTL_QUERY_INTF_RX_PROPS, \ 3008 struct ipa_ioc_query_intf_rx_props *) 3009 #define IPA_IOC_QUERY_INTF_EXT_PROPS _IOWR(IPA_IOC_MAGIC, \ 3010 IPA_IOCTL_QUERY_INTF_EXT_PROPS, \ 3011 struct ipa_ioc_query_intf_ext_props *) 3012 #define IPA_IOC_GET_HDR _IOWR(IPA_IOC_MAGIC, \ 3013 IPA_IOCTL_GET_HDR, \ 3014 struct ipa_ioc_get_hdr *) 3015 #define IPA_IOC_PUT_HDR _IOW(IPA_IOC_MAGIC, \ 3016 IPA_IOCTL_PUT_HDR, \ 3017 uint32_t) 3018 #define IPA_IOC_ALLOC_NAT_MEM _IOWR(IPA_IOC_MAGIC, \ 3019 IPA_IOCTL_ALLOC_NAT_MEM, \ 3020 struct ipa_ioc_nat_alloc_mem *) 3021 #define IPA_IOC_ALLOC_NAT_TABLE _IOWR(IPA_IOC_MAGIC, \ 3022 IPA_IOCTL_ALLOC_NAT_TABLE, \ 3023 struct ipa_ioc_nat_ipv6ct_table_alloc *) 3024 #define IPA_IOC_ALLOC_IPV6CT_TABLE _IOWR(IPA_IOC_MAGIC, \ 3025 IPA_IOCTL_ALLOC_IPV6CT_TABLE, \ 3026 struct ipa_ioc_nat_ipv6ct_table_alloc *) 3027 #define IPA_IOC_V4_INIT_NAT _IOWR(IPA_IOC_MAGIC, \ 3028 IPA_IOCTL_V4_INIT_NAT, \ 3029 struct ipa_ioc_v4_nat_init *) 3030 #define IPA_IOC_INIT_IPV6CT_TABLE _IOWR(IPA_IOC_MAGIC, \ 3031 IPA_IOCTL_INIT_IPV6CT_TABLE, \ 3032 struct ipa_ioc_ipv6ct_init *) 3033 #define IPA_IOC_NAT_DMA _IOWR(IPA_IOC_MAGIC, \ 3034 IPA_IOCTL_NAT_DMA, \ 3035 struct ipa_ioc_nat_dma_cmd *) 3036 #define IPA_IOC_TABLE_DMA_CMD _IOWR(IPA_IOC_MAGIC, \ 3037 IPA_IOCTL_TABLE_DMA_CMD, \ 3038 struct ipa_ioc_nat_dma_cmd *) 3039 #define IPA_IOC_V4_DEL_NAT _IOWR(IPA_IOC_MAGIC, \ 3040 IPA_IOCTL_V4_DEL_NAT, \ 3041 struct ipa_ioc_v4_nat_del *) 3042 #define IPA_IOC_DEL_NAT_TABLE _IOWR(IPA_IOC_MAGIC, \ 3043 IPA_IOCTL_DEL_NAT_TABLE, \ 3044 struct ipa_ioc_nat_ipv6ct_table_del *) 3045 #define IPA_IOC_DEL_IPV6CT_TABLE _IOWR(IPA_IOC_MAGIC, \ 3046 IPA_IOCTL_DEL_IPV6CT_TABLE, \ 3047 struct ipa_ioc_nat_ipv6ct_table_del *) 3048 #define IPA_IOC_GET_NAT_OFFSET _IOWR(IPA_IOC_MAGIC, \ 3049 IPA_IOCTL_GET_NAT_OFFSET, \ 3050 uint32_t *) 3051 #define IPA_IOC_NAT_MODIFY_PDN _IOWR(IPA_IOC_MAGIC, \ 3052 IPA_IOCTL_NAT_MODIFY_PDN, \ 3053 struct ipa_ioc_nat_pdn_entry *) 3054 #define IPA_IOC_SET_FLT _IOW(IPA_IOC_MAGIC, \ 3055 IPA_IOCTL_SET_FLT, \ 3056 uint32_t) 3057 #define IPA_IOC_PULL_MSG _IOWR(IPA_IOC_MAGIC, \ 3058 IPA_IOCTL_PULL_MSG, \ 3059 struct ipa_msg_meta *) 3060 #define IPA_IOC_RM_ADD_DEPENDENCY _IOWR(IPA_IOC_MAGIC, \ 3061 IPA_IOCTL_RM_ADD_DEPENDENCY, \ 3062 struct ipa_ioc_rm_dependency *) 3063 #define IPA_IOC_RM_DEL_DEPENDENCY _IOWR(IPA_IOC_MAGIC, \ 3064 IPA_IOCTL_RM_DEL_DEPENDENCY, \ 3065 struct ipa_ioc_rm_dependency *) 3066 #define IPA_IOC_GENERATE_FLT_EQ _IOWR(IPA_IOC_MAGIC, \ 3067 IPA_IOCTL_GENERATE_FLT_EQ, \ 3068 struct ipa_ioc_generate_flt_eq *) 3069 #define IPA_IOC_QUERY_EP_MAPPING _IOR(IPA_IOC_MAGIC, \ 3070 IPA_IOCTL_QUERY_EP_MAPPING, \ 3071 uint32_t) 3072 #define IPA_IOC_QUERY_RT_TBL_INDEX _IOWR(IPA_IOC_MAGIC, \ 3073 IPA_IOCTL_QUERY_RT_TBL_INDEX, \ 3074 struct ipa_ioc_get_rt_tbl_indx *) 3075 #define IPA_IOC_WRITE_QMAPID _IOWR(IPA_IOC_MAGIC, \ 3076 IPA_IOCTL_WRITE_QMAPID, \ 3077 struct ipa_ioc_write_qmapid *) 3078 #define IPA_IOC_MDFY_FLT_RULE _IOWR(IPA_IOC_MAGIC, \ 3079 IPA_IOCTL_MDFY_FLT_RULE, \ 3080 struct ipa_ioc_mdfy_flt_rule *) 3081 #define IPA_IOC_MDFY_FLT_RULE_V2 _IOWR(IPA_IOC_MAGIC, \ 3082 IPA_IOCTL_MDFY_FLT_RULE_V2, \ 3083 struct ipa_ioc_mdfy_flt_rule_v2 *) 3084 #define IPA_IOC_MDFY_RT_RULE _IOWR(IPA_IOC_MAGIC, \ 3085 IPA_IOCTL_MDFY_RT_RULE, \ 3086 struct ipa_ioc_mdfy_rt_rule *) 3087 #define IPA_IOC_MDFY_RT_RULE_V2 _IOWR(IPA_IOC_MAGIC, \ 3088 IPA_IOCTL_MDFY_RT_RULE_V2, \ 3089 struct ipa_ioc_mdfy_rt_rule_v2 *) 3090 3091 #define IPA_IOC_NOTIFY_WAN_UPSTREAM_ROUTE_ADD _IOWR(IPA_IOC_MAGIC, \ 3092 IPA_IOCTL_NOTIFY_WAN_UPSTREAM_ROUTE_ADD, \ 3093 struct ipa_wan_msg *) 3094 3095 #define IPA_IOC_NOTIFY_WAN_UPSTREAM_ROUTE_DEL _IOWR(IPA_IOC_MAGIC, \ 3096 IPA_IOCTL_NOTIFY_WAN_UPSTREAM_ROUTE_DEL, \ 3097 struct ipa_wan_msg *) 3098 #define IPA_IOC_NOTIFY_WAN_EMBMS_CONNECTED _IOWR(IPA_IOC_MAGIC, \ 3099 IPA_IOCTL_NOTIFY_WAN_EMBMS_CONNECTED, \ 3100 struct ipa_wan_msg *) 3101 #define IPA_IOC_ADD_HDR_PROC_CTX _IOWR(IPA_IOC_MAGIC, \ 3102 IPA_IOCTL_ADD_HDR_PROC_CTX, \ 3103 struct ipa_ioc_add_hdr_proc_ctx *) 3104 #define IPA_IOC_DEL_HDR_PROC_CTX _IOWR(IPA_IOC_MAGIC, \ 3105 IPA_IOCTL_DEL_HDR_PROC_CTX, \ 3106 struct ipa_ioc_del_hdr_proc_ctx *) 3107 3108 #define IPA_IOC_GET_HW_VERSION _IOWR(IPA_IOC_MAGIC, \ 3109 IPA_IOCTL_GET_HW_VERSION, \ 3110 enum ipa_hw_type *) 3111 3112 #define IPA_IOC_ADD_VLAN_IFACE _IOWR(IPA_IOC_MAGIC, \ 3113 IPA_IOCTL_ADD_VLAN_IFACE, \ 3114 struct ipa_ioc_vlan_iface_info *) 3115 3116 #define IPA_IOC_DEL_VLAN_IFACE _IOWR(IPA_IOC_MAGIC, \ 3117 IPA_IOCTL_DEL_VLAN_IFACE, \ 3118 struct ipa_ioc_vlan_iface_info *) 3119 3120 #define IPA_IOC_ADD_L2TP_VLAN_MAPPING _IOWR(IPA_IOC_MAGIC, \ 3121 IPA_IOCTL_ADD_L2TP_VLAN_MAPPING, \ 3122 struct ipa_ioc_l2tp_vlan_mapping_info *) 3123 3124 #define IPA_IOC_DEL_L2TP_VLAN_MAPPING _IOWR(IPA_IOC_MAGIC, \ 3125 IPA_IOCTL_DEL_L2TP_VLAN_MAPPING, \ 3126 struct ipa_ioc_l2tp_vlan_mapping_info *) 3127 #define IPA_IOC_GET_VLAN_MODE _IOWR(IPA_IOC_MAGIC, \ 3128 IPA_IOCTL_GET_VLAN_MODE, \ 3129 struct ipa_ioc_get_vlan_mode *) 3130 #define IPA_IOC_ADD_BRIDGE_VLAN_MAPPING _IOWR(IPA_IOC_MAGIC, \ 3131 IPA_IOCTL_ADD_BRIDGE_VLAN_MAPPING, \ 3132 struct ipa_ioc_bridge_vlan_mapping_info) 3133 3134 #define IPA_IOC_DEL_BRIDGE_VLAN_MAPPING _IOWR(IPA_IOC_MAGIC, \ 3135 IPA_IOCTL_DEL_BRIDGE_VLAN_MAPPING, \ 3136 struct ipa_ioc_bridge_vlan_mapping_info) 3137 #define IPA_IOC_CLEANUP _IO(IPA_IOC_MAGIC,\ 3138 IPA_IOCTL_CLEANUP) 3139 #define IPA_IOC_QUERY_WLAN_CLIENT _IO(IPA_IOC_MAGIC,\ 3140 IPA_IOCTL_QUERY_WLAN_CLIENT) 3141 3142 #define IPA_IOC_ODL_QUERY_ADAPL_EP_INFO _IOWR(IPA_IOC_MAGIC, \ 3143 IPA_IOCTL_ODL_QUERY_ADAPL_EP_INFO, \ 3144 struct ipa_odl_ep_info) 3145 #define IPA_IOC_ODL_GET_AGG_BYTE_LIMIT _IOWR(IPA_IOC_MAGIC, \ 3146 IPA_IOCTL_ODL_GET_AGG_BYTE_LIMIT, \ 3147 struct odl_agg_pipe_info) 3148 3149 #define IPA_IOC_ODL_QUERY_MODEM_CONFIG _IOWR(IPA_IOC_MAGIC, \ 3150 IPA_IOCTL_ODL_QUERY_MODEM_CONFIG, \ 3151 struct ipa_odl_modem_config) 3152 3153 #define IPA_IOC_GSB_CONNECT _IOWR(IPA_IOC_MAGIC, \ 3154 IPA_IOCTL_GSB_CONNECT, \ 3155 struct ipa_ioc_gsb_info) 3156 3157 #define IPA_IOC_GSB_DISCONNECT _IOWR(IPA_IOC_MAGIC, \ 3158 IPA_IOCTL_GSB_DISCONNECT, \ 3159 struct ipa_ioc_gsb_info) 3160 3161 #define IPA_IOC_WIGIG_FST_SWITCH _IOWR(IPA_IOC_MAGIC, \ 3162 IPA_IOCTL_WIGIG_FST_SWITCH, \ 3163 struct ipa_ioc_wigig_fst_switch) 3164 3165 #define IPA_IOC_FNR_COUNTER_ALLOC _IOWR(IPA_IOC_MAGIC, \ 3166 IPA_IOCTL_FNR_COUNTER_ALLOC, \ 3167 struct ipa_ioc_flt_rt_counter_alloc) 3168 3169 #define IPA_IOC_FNR_COUNTER_DEALLOC _IOWR(IPA_IOC_MAGIC, \ 3170 IPA_IOCTL_FNR_COUNTER_DEALLOC, \ 3171 int) 3172 3173 #define IPA_IOC_FNR_COUNTER_QUERY _IOWR(IPA_IOC_MAGIC, \ 3174 IPA_IOCTL_FNR_COUNTER_QUERY, \ 3175 struct ipa_ioc_flt_rt_query) 3176 3177 #define IPA_IOC_GET_NAT_IN_SRAM_INFO _IOWR(IPA_IOC_MAGIC, \ 3178 IPA_IOCTL_GET_NAT_IN_SRAM_INFO, \ 3179 struct ipa_nat_in_sram_info) 3180 3181 #define IPA_IOC_GET_PHERIPHERAL_EP_INFO _IOWR(IPA_IOC_MAGIC, \ 3182 IPA_IOCTL_GET_PHERIPHERAL_EP_INFO, \ 3183 struct ipa_ioc_get_ep_info) 3184 3185 #define IPA_IOC_APP_CLOCK_VOTE _IOWR(IPA_IOC_MAGIC, \ 3186 IPA_IOCTL_APP_CLOCK_VOTE, \ 3187 uint32_t) 3188 3189 #define IPA_IOC_PDN_CONFIG _IOWR(IPA_IOC_MAGIC, \ 3190 IPA_IOCTL_PDN_CONFIG, \ 3191 struct ipa_ioc_pdn_config) 3192 3193 #define IPA_IOC_SET_MAC_FLT _IOWR(IPA_IOC_MAGIC, \ 3194 IPA_IOCTL_SET_MAC_FLT, \ 3195 struct ipa_ioc_mac_client_list_type) 3196 3197 #define IPA_IOC_ADD_UC_ACT_ENTRY _IOWR(IPA_IOC_MAGIC, \ 3198 IPA_IOCTL_ADD_UC_ACT_ENTRY, \ 3199 union ipa_ioc_uc_activation_entry) 3200 3201 #define IPA_IOC_DEL_UC_ACT_ENTRY _IOWR(IPA_IOC_MAGIC, \ 3202 IPA_IOCTL_DEL_UC_ACT_ENTRY, \ 3203 uint16_t) 3204 3205 /* 3206 * unique magic number of the Tethering bridge ioctls 3207 */ 3208 #define TETH_BRIDGE_IOC_MAGIC 0xCE 3209 3210 /* 3211 * Ioctls supported by Tethering bridge driver 3212 */ 3213 #define TETH_BRIDGE_IOCTL_SET_BRIDGE_MODE 0 3214 #define TETH_BRIDGE_IOCTL_SET_AGGR_PARAMS 1 3215 #define TETH_BRIDGE_IOCTL_GET_AGGR_PARAMS 2 3216 #define TETH_BRIDGE_IOCTL_GET_AGGR_CAPABILITIES 3 3217 #define TETH_BRIDGE_IOCTL_MAX 4 3218 3219 3220 /** 3221 * enum teth_link_protocol_type - link protocol (IP / Ethernet) 3222 */ 3223 enum teth_link_protocol_type { 3224 TETH_LINK_PROTOCOL_IP, 3225 TETH_LINK_PROTOCOL_ETHERNET, 3226 TETH_LINK_PROTOCOL_MAX, 3227 }; 3228 3229 /** 3230 * enum teth_aggr_protocol_type - Aggregation protocol (MBIM / TLP) 3231 */ 3232 enum teth_aggr_protocol_type { 3233 TETH_AGGR_PROTOCOL_NONE, 3234 TETH_AGGR_PROTOCOL_MBIM, 3235 TETH_AGGR_PROTOCOL_TLP, 3236 TETH_AGGR_PROTOCOL_MAX, 3237 }; 3238 3239 /** 3240 * struct teth_aggr_params_link - Aggregation parameters for uplink/downlink 3241 * @aggr_prot: Aggregation protocol (MBIM / TLP) 3242 * @max_transfer_size_byte: Maximal size of aggregated packet in bytes. 3243 * Default value is 16*1024. 3244 * @max_datagrams: Maximal number of IP packets in an aggregated 3245 * packet. Default value is 16 3246 */ 3247 struct teth_aggr_params_link { 3248 enum teth_aggr_protocol_type aggr_prot; 3249 uint32_t max_transfer_size_byte; 3250 uint32_t max_datagrams; 3251 }; 3252 3253 3254 /** 3255 * struct teth_aggr_params - Aggregation parmeters 3256 * @ul: Uplink parameters 3257 * @dl: Downlink parmaeters 3258 */ 3259 struct teth_aggr_params { 3260 struct teth_aggr_params_link ul; 3261 struct teth_aggr_params_link dl; 3262 }; 3263 3264 /** 3265 * struct teth_aggr_capabilities - Aggregation capabilities 3266 * @num_protocols: Number of protocols described in the array 3267 * @prot_caps[]: Array of aggregation capabilities per protocol 3268 */ 3269 struct teth_aggr_capabilities { 3270 uint16_t num_protocols; 3271 struct teth_aggr_params_link prot_caps[0]; 3272 }; 3273 3274 /** 3275 * struct teth_ioc_set_bridge_mode 3276 * @link_protocol: link protocol (IP / Ethernet) 3277 * @lcid: logical channel number 3278 */ 3279 struct teth_ioc_set_bridge_mode { 3280 enum teth_link_protocol_type link_protocol; 3281 uint16_t lcid; 3282 }; 3283 3284 /** 3285 * struct teth_ioc_set_aggr_params 3286 * @aggr_params: Aggregation parmeters 3287 * @lcid: logical channel number 3288 */ 3289 struct teth_ioc_aggr_params { 3290 struct teth_aggr_params aggr_params; 3291 uint16_t lcid; 3292 }; 3293 3294 /** 3295 * struct ipa_nat_in_sram_info - query for nat in sram particulars 3296 * @sram_mem_available_for_nat: Amount SRAM available to fit nat table 3297 * @nat_table_offset_into_mmap: Offset into mmap'd vm where table will be 3298 * @best_nat_in_sram_size_rqst: The size to request for mmap 3299 * 3300 * The last two elements above are required to deal with situations 3301 * where the SRAM's physical address and size don't play nice with 3302 * mmap'ings page size and boundary attributes. 3303 */ 3304 struct ipa_nat_in_sram_info { 3305 uint32_t sram_mem_available_for_nat; 3306 uint32_t nat_table_offset_into_mmap; 3307 uint32_t best_nat_in_sram_size_rqst; 3308 }; 3309 3310 /** 3311 * enum ipa_app_clock_vote_type 3312 * 3313 * The types of votes that can be accepted by the 3314 * IPA_IOC_APP_CLOCK_VOTE ioctl 3315 */ 3316 enum ipa_app_clock_vote_type { 3317 IPA_APP_CLK_DEVOTE = 0, 3318 IPA_APP_CLK_VOTE = 1, 3319 IPA_APP_CLK_RESET_VOTE = 2, 3320 }; 3321 3322 #define TETH_BRIDGE_IOC_SET_BRIDGE_MODE _IOW(TETH_BRIDGE_IOC_MAGIC, \ 3323 TETH_BRIDGE_IOCTL_SET_BRIDGE_MODE, \ 3324 struct teth_ioc_set_bridge_mode *) 3325 #define TETH_BRIDGE_IOC_SET_AGGR_PARAMS _IOW(TETH_BRIDGE_IOC_MAGIC, \ 3326 TETH_BRIDGE_IOCTL_SET_AGGR_PARAMS, \ 3327 struct teth_ioc_aggr_params *) 3328 #define TETH_BRIDGE_IOC_GET_AGGR_PARAMS _IOR(TETH_BRIDGE_IOC_MAGIC, \ 3329 TETH_BRIDGE_IOCTL_GET_AGGR_PARAMS, \ 3330 struct teth_ioc_aggr_params *) 3331 #define TETH_BRIDGE_IOC_GET_AGGR_CAPABILITIES _IOWR(TETH_BRIDGE_IOC_MAGIC, \ 3332 TETH_BRIDGE_IOCTL_GET_AGGR_CAPABILITIES, \ 3333 struct teth_aggr_capabilities *) 3334 3335 /* 3336 * unique magic number of the ODU bridge ioctls 3337 */ 3338 #define ODU_BRIDGE_IOC_MAGIC 0xCD 3339 3340 /* 3341 * Ioctls supported by ODU bridge driver 3342 */ 3343 #define ODU_BRIDGE_IOCTL_SET_MODE 0 3344 #define ODU_BRIDGE_IOCTL_SET_LLV6_ADDR 1 3345 #define ODU_BRIDGE_IOCTL_MAX 2 3346 3347 /** 3348 * enum odu_bridge_mode - bridge mode 3349 * (ROUTER MODE / BRIDGE MODE) 3350 */ 3351 enum odu_bridge_mode { 3352 ODU_BRIDGE_MODE_ROUTER, 3353 ODU_BRIDGE_MODE_BRIDGE, 3354 ODU_BRIDGE_MODE_MAX, 3355 }; 3356 3357 #define ODU_BRIDGE_IOC_SET_MODE _IOW(ODU_BRIDGE_IOC_MAGIC, \ 3358 ODU_BRIDGE_IOCTL_SET_MODE, \ 3359 enum odu_bridge_mode) 3360 3361 #define ODU_BRIDGE_IOC_SET_LLV6_ADDR _IOW(ODU_BRIDGE_IOC_MAGIC, \ 3362 ODU_BRIDGE_IOCTL_SET_LLV6_ADDR, \ 3363 struct in6_addr *) 3364 3365 #endif /* _MSM_IPA_H_ */ 3366