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