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