Talel Atias | 8390f26 | 2012-11-15 16:33:18 +0200 | [diff] [blame] | 1 | #ifndef _MSM_IPA_H_ |
| 2 | #define _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 | |
| 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_GET_ASYNC_MSG 27 |
| 51 | #define IPA_IOCTL_GET_NAT_OFFSET 28 |
| 52 | #define IPA_IOCTL_MAX 29 |
| 53 | |
| 54 | /** |
| 55 | * max size of the header to be inserted |
| 56 | */ |
| 57 | #define IPA_HDR_MAX_SIZE 64 |
| 58 | |
| 59 | /** |
| 60 | * max size of the name of the resource (routing table, header) |
| 61 | */ |
| 62 | #define IPA_RESOURCE_NAME_MAX 20 |
| 63 | |
| 64 | /** |
| 65 | * the attributes of the rule (routing or filtering) |
| 66 | */ |
| 67 | #define IPA_FLT_TOS (1ul << 0) |
| 68 | #define IPA_FLT_PROTOCOL (1ul << 1) |
| 69 | #define IPA_FLT_SRC_ADDR (1ul << 2) |
| 70 | #define IPA_FLT_DST_ADDR (1ul << 3) |
| 71 | #define IPA_FLT_SRC_PORT_RANGE (1ul << 4) |
| 72 | #define IPA_FLT_DST_PORT_RANGE (1ul << 5) |
| 73 | #define IPA_FLT_TYPE (1ul << 6) |
| 74 | #define IPA_FLT_CODE (1ul << 7) |
| 75 | #define IPA_FLT_SPI (1ul << 8) |
| 76 | #define IPA_FLT_SRC_PORT (1ul << 9) |
| 77 | #define IPA_FLT_DST_PORT (1ul << 10) |
| 78 | #define IPA_FLT_TC (1ul << 11) |
| 79 | #define IPA_FLT_FLOW_LABEL (1ul << 12) |
| 80 | #define IPA_FLT_NEXT_HDR (1ul << 13) |
| 81 | #define IPA_FLT_META_DATA (1ul << 14) |
| 82 | #define IPA_FLT_FRAGMENT (1ul << 15) |
| 83 | |
| 84 | /** |
| 85 | * enum ipa_client_type - names for the various IPA "clients" |
| 86 | * these are from the perspective of the clients, for e.g. |
| 87 | * HSIC1_PROD means HSIC client is the producer and IPA is the |
| 88 | * consumer |
| 89 | */ |
| 90 | enum ipa_client_type { |
| 91 | IPA_CLIENT_PROD, |
| 92 | IPA_CLIENT_HSIC1_PROD = IPA_CLIENT_PROD, |
| 93 | IPA_CLIENT_HSIC2_PROD, |
| 94 | IPA_CLIENT_HSIC3_PROD, |
| 95 | IPA_CLIENT_HSIC4_PROD, |
| 96 | IPA_CLIENT_HSIC5_PROD, |
| 97 | IPA_CLIENT_USB_PROD, |
| 98 | IPA_CLIENT_A5_WLAN_AMPDU_PROD, |
| 99 | IPA_CLIENT_A2_EMBEDDED_PROD, |
| 100 | IPA_CLIENT_A2_TETHERED_PROD, |
| 101 | IPA_CLIENT_A5_LAN_WAN_PROD, |
| 102 | IPA_CLIENT_A5_CMD_PROD, |
| 103 | IPA_CLIENT_Q6_LAN_PROD, |
| 104 | |
| 105 | IPA_CLIENT_CONS, |
| 106 | IPA_CLIENT_HSIC1_CONS = IPA_CLIENT_CONS, |
| 107 | IPA_CLIENT_HSIC2_CONS, |
| 108 | IPA_CLIENT_HSIC3_CONS, |
| 109 | IPA_CLIENT_HSIC4_CONS, |
| 110 | IPA_CLIENT_HSIC5_CONS, |
| 111 | IPA_CLIENT_USB_CONS, |
| 112 | IPA_CLIENT_A2_EMBEDDED_CONS, |
| 113 | IPA_CLIENT_A2_TETHERED_CONS, |
| 114 | IPA_CLIENT_A5_LAN_WAN_CONS, |
| 115 | IPA_CLIENT_Q6_LAN_CONS, |
| 116 | |
| 117 | IPA_CLIENT_MAX, |
| 118 | }; |
| 119 | |
| 120 | /** |
| 121 | * enum ipa_ip_type - Address family: IPv4 or IPv6 |
| 122 | */ |
| 123 | enum ipa_ip_type { |
| 124 | IPA_IP_v4, |
| 125 | IPA_IP_v6, |
| 126 | IPA_IP_MAX |
| 127 | }; |
| 128 | |
| 129 | /** |
| 130 | * enum ipa_flt_action - action field of filtering rule |
| 131 | * |
| 132 | * Pass to routing: 5'd0 |
| 133 | * Pass to source NAT: 5'd1 |
| 134 | * Pass to destination NAT: 5'd2 |
| 135 | * Pass to default output pipe (e.g., A5): 5'd3 |
| 136 | */ |
| 137 | enum ipa_flt_action { |
| 138 | IPA_PASS_TO_ROUTING, |
| 139 | IPA_PASS_TO_SRC_NAT, |
| 140 | IPA_PASS_TO_DST_NAT, |
| 141 | IPA_PASS_TO_EXCEPTION |
| 142 | }; |
| 143 | |
| 144 | /** |
| 145 | * struct ipa_rule_attrib - attributes of a routing/filtering |
| 146 | * rule, all in LE |
| 147 | * @attrib_mask: what attributes are valid |
| 148 | * @src_port_lo: low port of src port range |
| 149 | * @src_port_hi: high port of src port range |
| 150 | * @dst_port_lo: low port of dst port range |
| 151 | * @dst_port_hi: high port of dst port range |
| 152 | * @type: ICMP/IGMP type |
| 153 | * @code: ICMP/IGMP code |
| 154 | * @spi: IPSec SPI |
| 155 | * @src_port: exact src port |
| 156 | * @dst_port: exact dst port |
| 157 | * @meta_data: meta-data val |
| 158 | * @meta_data_mask: meta-data mask |
| 159 | * @u.v4.tos: type of service |
| 160 | * @u.v4.protocol: protocol |
| 161 | * @u.v4.src_addr: src address value |
| 162 | * @u.v4.src_addr_mask: src address mask |
| 163 | * @u.v4.dst_addr: dst address value |
| 164 | * @u.v4.dst_addr_mask: dst address mask |
| 165 | * @u.v6.tc: traffic class |
| 166 | * @u.v6.flow_label: flow label |
| 167 | * @u.v6.next_hdr: next header |
| 168 | * @u.v6.src_addr: src address val |
| 169 | * @u.v6.src_addr_mask: src address mask |
| 170 | * @u.v6.dst_addr: dst address val |
| 171 | * @u.v6.dst_addr_mask: dst address mask |
| 172 | */ |
| 173 | struct ipa_rule_attrib { |
| 174 | uint32_t attrib_mask; |
| 175 | uint16_t src_port_lo; |
| 176 | uint16_t src_port_hi; |
| 177 | uint16_t dst_port_lo; |
| 178 | uint16_t dst_port_hi; |
| 179 | uint8_t type; |
| 180 | uint8_t code; |
| 181 | uint32_t spi; |
| 182 | uint16_t src_port; |
| 183 | uint16_t dst_port; |
| 184 | uint32_t meta_data; |
| 185 | uint32_t meta_data_mask; |
| 186 | union { |
| 187 | struct { |
| 188 | uint8_t tos; |
| 189 | uint8_t protocol; |
| 190 | uint32_t src_addr; |
| 191 | uint32_t src_addr_mask; |
| 192 | uint32_t dst_addr; |
| 193 | uint32_t dst_addr_mask; |
| 194 | } v4; |
| 195 | struct { |
| 196 | uint8_t tc; |
| 197 | uint32_t flow_label; |
| 198 | uint8_t next_hdr; |
| 199 | uint32_t src_addr[4]; |
| 200 | uint32_t src_addr_mask[4]; |
| 201 | uint32_t dst_addr[4]; |
| 202 | uint32_t dst_addr_mask[4]; |
| 203 | } v6; |
| 204 | } u; |
| 205 | }; |
| 206 | |
| 207 | /** |
| 208 | * struct ipa_flt_rule - attributes of a filtering rule |
| 209 | * @action: action field |
| 210 | * @rt_tbl_hdl: handle of table from "get" |
| 211 | * @attrib: attributes of the rule |
| 212 | */ |
| 213 | struct ipa_flt_rule { |
| 214 | enum ipa_flt_action action; |
| 215 | uint32_t rt_tbl_hdl; |
| 216 | struct ipa_rule_attrib attrib; |
| 217 | }; |
| 218 | |
| 219 | /** |
| 220 | * struct ipa_rt_rule - attributes of a routing rule |
| 221 | * @dst: dst "client" |
| 222 | * @hdr_hdl: handle to the dynamic header |
| 223 | it is not an index or an offset |
| 224 | * @attrib: attributes of the rule |
| 225 | */ |
| 226 | struct ipa_rt_rule { |
| 227 | enum ipa_client_type dst; |
| 228 | uint32_t hdr_hdl; |
| 229 | struct ipa_rule_attrib attrib; |
| 230 | }; |
| 231 | |
| 232 | /** |
| 233 | * struct ipa_hdr_add - header descriptor includes in and out |
| 234 | * parameters |
| 235 | * @name: name of the header |
| 236 | * @hdr: actual header to be inserted |
| 237 | * @hdr_len: size of above header |
| 238 | * @is_partial: header not fully specified |
| 239 | * @hdr_hdl: out paramerer, handle to header, valid when status is 0 |
| 240 | * @status: out paramerer, status of header add operation, |
| 241 | * 0 for success, |
| 242 | * -1 for failure |
| 243 | */ |
| 244 | struct ipa_hdr_add { |
| 245 | char name[IPA_RESOURCE_NAME_MAX]; |
| 246 | uint8_t hdr[IPA_HDR_MAX_SIZE]; |
| 247 | uint8_t hdr_len; |
| 248 | uint8_t is_partial; |
| 249 | uint32_t hdr_hdl; |
| 250 | int status; |
| 251 | }; |
| 252 | |
| 253 | /** |
| 254 | * struct ipa_ioc_add_hdr - header addition parameters (support |
| 255 | * multiple headers and commit) |
| 256 | * @commit: should headers be written to IPA HW also? |
| 257 | * @num_hdrs: num of headers that follow |
| 258 | * @ipa_hdr_add hdr: all headers need to go here back to |
| 259 | * back, no pointers |
| 260 | */ |
| 261 | struct ipa_ioc_add_hdr { |
| 262 | uint8_t commit; |
| 263 | uint8_t num_hdrs; |
| 264 | struct ipa_hdr_add hdr[0]; |
| 265 | }; |
| 266 | |
| 267 | /** |
| 268 | * struct ipa_ioc_copy_hdr - retrieve a copy of the specified |
| 269 | * header - caller can then derive the complete header |
| 270 | * @name: name of the header resource |
| 271 | * @hdr: out parameter, contents of specified header, |
| 272 | * valid only when ioctl return val is non-negative |
| 273 | * @hdr_len: out parameter, size of above header |
| 274 | * valid only when ioctl return val is non-negative |
| 275 | * @is_partial: out parameter, indicates whether specified header is partial |
| 276 | * valid only when ioctl return val is non-negative |
| 277 | */ |
| 278 | struct ipa_ioc_copy_hdr { |
| 279 | char name[IPA_RESOURCE_NAME_MAX]; |
| 280 | uint8_t hdr[IPA_HDR_MAX_SIZE]; |
| 281 | uint8_t hdr_len; |
| 282 | uint8_t is_partial; |
| 283 | }; |
| 284 | |
| 285 | /** |
| 286 | * struct ipa_ioc_get_hdr - header entry lookup parameters, if lookup was |
| 287 | * successful caller must call put to release the reference count when done |
| 288 | * @name: name of the header resource |
| 289 | * @hdl: out parameter, handle of header entry |
| 290 | * valid only when ioctl return val is non-negative |
| 291 | */ |
| 292 | struct ipa_ioc_get_hdr { |
| 293 | char name[IPA_RESOURCE_NAME_MAX]; |
| 294 | uint32_t hdl; |
| 295 | }; |
| 296 | |
| 297 | /** |
| 298 | * struct ipa_hdr_del - header descriptor includes in and out |
| 299 | * parameters |
| 300 | * |
| 301 | * @hdl: handle returned from header add operation |
| 302 | * @status: out parameter, status of header remove operation, |
| 303 | * 0 for success, |
| 304 | * -1 for failure |
| 305 | */ |
| 306 | struct ipa_hdr_del { |
| 307 | uint32_t hdl; |
| 308 | int status; |
| 309 | }; |
| 310 | |
| 311 | /** |
| 312 | * struct ipa_ioc_del_hdr - header deletion parameters (support |
| 313 | * multiple headers and commit) |
| 314 | * @commit: should headers be removed from IPA HW also? |
| 315 | * @num_hdls: num of headers being removed |
| 316 | * @ipa_hdr_del hdl: all handles need to go here back to back, no pointers |
| 317 | */ |
| 318 | struct ipa_ioc_del_hdr { |
| 319 | uint8_t commit; |
| 320 | uint8_t num_hdls; |
| 321 | struct ipa_hdr_del hdl[0]; |
| 322 | }; |
| 323 | |
| 324 | /** |
| 325 | * struct ipa_rt_rule_add - routing rule descriptor includes in |
| 326 | * and out parameters |
| 327 | * @rule: actual rule to be added |
| 328 | * @at_rear: add at back of routing table, it is NOT possible to add rules at |
| 329 | * the rear of the "default" routing tables |
| 330 | * @rt_rule_hdl: output parameter, handle to rule, valid when status is 0 |
| 331 | * @status: output parameter, status of routing rule add operation, |
| 332 | * 0 for success, |
| 333 | * -1 for failure |
| 334 | */ |
| 335 | struct ipa_rt_rule_add { |
| 336 | struct ipa_rt_rule rule; |
| 337 | uint8_t at_rear; |
| 338 | uint32_t rt_rule_hdl; |
| 339 | int status; |
| 340 | }; |
| 341 | |
| 342 | /** |
| 343 | * struct ipa_ioc_add_rt_rule - routing rule addition parameters (supports |
| 344 | * multiple rules and commit); |
| 345 | * |
| 346 | * all rules MUST be added to same table |
| 347 | * @commit: should rules be written to IPA HW also? |
| 348 | * @ip: IP family of rule |
| 349 | * @rt_tbl_name: name of routing table resource |
| 350 | * @num_rules: number of routing rules that follow |
| 351 | * @ipa_rt_rule_add rules: all rules need to go back to back here, no pointers |
| 352 | */ |
| 353 | struct ipa_ioc_add_rt_rule { |
| 354 | uint8_t commit; |
| 355 | enum ipa_ip_type ip; |
| 356 | char rt_tbl_name[IPA_RESOURCE_NAME_MAX]; |
| 357 | uint8_t num_rules; |
| 358 | struct ipa_rt_rule_add rules[0]; |
| 359 | }; |
| 360 | |
| 361 | /** |
| 362 | * struct ipa_rt_rule_del - routing rule descriptor includes in |
| 363 | * and out parameters |
| 364 | * @hdl: handle returned from route rule add operation |
| 365 | * @status: output parameter, status of route rule delete operation, |
| 366 | * 0 for success, |
| 367 | * -1 for failure |
| 368 | */ |
| 369 | struct ipa_rt_rule_del { |
| 370 | uint32_t hdl; |
| 371 | int status; |
| 372 | }; |
| 373 | |
| 374 | /** |
| 375 | * struct ipa_ioc_del_rt_rule - routing rule deletion parameters (supports |
| 376 | * multiple headers and commit) |
| 377 | * @commit: should rules be removed from IPA HW also? |
| 378 | * @ip: IP family of rules |
| 379 | * @num_hdls: num of rules being removed |
| 380 | * @ipa_rt_rule_del hdl: all handles need to go back to back here, no pointers |
| 381 | */ |
| 382 | struct ipa_ioc_del_rt_rule { |
| 383 | uint8_t commit; |
| 384 | enum ipa_ip_type ip; |
| 385 | uint8_t num_hdls; |
| 386 | struct ipa_rt_rule_del hdl[0]; |
| 387 | }; |
| 388 | |
| 389 | /** |
| 390 | * struct ipa_flt_rule_add - filtering rule descriptor includes |
| 391 | * in and out parameters |
| 392 | * @rule: actual rule to be added |
| 393 | * @at_rear: add at back of filtering table? |
| 394 | * @flt_rule_hdl: out parameter, handle to rule, valid when status is 0 |
| 395 | * @status: output parameter, status of filtering rule add operation, |
| 396 | * 0 for success, |
| 397 | * -1 for failure |
| 398 | * |
| 399 | */ |
| 400 | struct ipa_flt_rule_add { |
| 401 | struct ipa_flt_rule rule; |
| 402 | uint8_t at_rear; |
| 403 | uint32_t flt_rule_hdl; |
| 404 | int status; |
| 405 | }; |
| 406 | |
| 407 | /** |
| 408 | * struct ipa_ioc_add_flt_rule - filtering rule addition parameters (supports |
| 409 | * multiple rules and commit) |
| 410 | * all rules MUST be added to same table |
| 411 | * @commit: should rules be written to IPA HW also? |
| 412 | * @ip: IP family of rule |
| 413 | * @ep: which "clients" pipe does this rule apply to? |
| 414 | * valid only when global is 0 |
| 415 | * @global: does this apply to global filter table of specific IP family |
| 416 | * @num_rules: number of filtering rules that follow |
| 417 | * @rules: all rules need to go back to back here, no pointers |
| 418 | */ |
| 419 | struct ipa_ioc_add_flt_rule { |
| 420 | uint8_t commit; |
| 421 | enum ipa_ip_type ip; |
| 422 | enum ipa_client_type ep; |
| 423 | uint8_t global; |
| 424 | uint8_t num_rules; |
| 425 | struct ipa_flt_rule_add rules[0]; |
| 426 | }; |
| 427 | |
| 428 | /** |
| 429 | * struct ipa_flt_rule_del - filtering rule descriptor includes |
| 430 | * in and out parameters |
| 431 | * |
| 432 | * @hdl: handle returned from filtering rule add operation |
| 433 | * @status: output parameter, status of filtering rule delete operation, |
| 434 | * 0 for success, |
| 435 | * -1 for failure |
| 436 | */ |
| 437 | struct ipa_flt_rule_del { |
| 438 | uint32_t hdl; |
| 439 | int status; |
| 440 | }; |
| 441 | |
| 442 | /** |
| 443 | * struct ipa_ioc_del_flt_rule - filtering rule deletion parameters (supports |
| 444 | * multiple headers and commit) |
| 445 | * @commit: should rules be removed from IPA HW also? |
| 446 | * @ip: IP family of rules |
| 447 | * @num_hdls: num of rules being removed |
| 448 | * @hdl: all handles need to go back to back here, no pointers |
| 449 | */ |
| 450 | struct ipa_ioc_del_flt_rule { |
| 451 | uint8_t commit; |
| 452 | enum ipa_ip_type ip; |
| 453 | uint8_t num_hdls; |
| 454 | struct ipa_flt_rule_del hdl[0]; |
| 455 | }; |
| 456 | |
| 457 | /** |
| 458 | * struct ipa_ioc_get_rt_tbl - routing table lookup parameters, if lookup was |
| 459 | * successful caller must call put to release the reference |
| 460 | * count when done |
| 461 | * @ip: IP family of table |
| 462 | * @name: name of routing table resource |
| 463 | * @htl: output parameter, handle of routing table, valid only when ioctl |
| 464 | * return val is non-negative |
| 465 | */ |
| 466 | struct ipa_ioc_get_rt_tbl { |
| 467 | enum ipa_ip_type ip; |
| 468 | char name[IPA_RESOURCE_NAME_MAX]; |
| 469 | uint32_t hdl; |
| 470 | }; |
| 471 | |
| 472 | /** |
| 473 | * struct ipa_ioc_query_intf - used to lookup number of tx and |
| 474 | * rx properties of interface |
| 475 | * @name: name of interface |
| 476 | * @num_tx_props: output parameter, number of tx properties |
| 477 | * valid only when ioctl return val is non-negative |
| 478 | * @num_rx_props: output parameter, number of rx properties |
| 479 | * valid only when ioctl return val is non-negative |
| 480 | */ |
| 481 | struct ipa_ioc_query_intf { |
| 482 | char name[IPA_RESOURCE_NAME_MAX]; |
| 483 | uint32_t num_tx_props; |
| 484 | uint32_t num_rx_props; |
| 485 | }; |
| 486 | |
| 487 | /** |
| 488 | * struct ipa_ioc_tx_intf_prop - interface tx property |
| 489 | * @ip: IP family of routing rule |
| 490 | * @attrib: routing rule |
| 491 | * @dst_pipe: routing output pipe |
| 492 | * @hdr_name: name of associated header if any, empty string when no header |
| 493 | */ |
| 494 | struct ipa_ioc_tx_intf_prop { |
| 495 | enum ipa_ip_type ip; |
| 496 | struct ipa_rule_attrib attrib; |
| 497 | enum ipa_client_type dst_pipe; |
| 498 | char hdr_name[IPA_RESOURCE_NAME_MAX]; |
| 499 | }; |
| 500 | |
| 501 | /** |
| 502 | * struct ipa_ioc_query_intf_tx_props - interface tx propertie |
| 503 | * @name: name of interface |
| 504 | * @tx[0]: output parameter, the tx properties go here back to back |
| 505 | */ |
| 506 | struct ipa_ioc_query_intf_tx_props { |
| 507 | char name[IPA_RESOURCE_NAME_MAX]; |
| 508 | struct ipa_ioc_tx_intf_prop tx[0]; |
| 509 | }; |
| 510 | |
| 511 | /** |
| 512 | * struct ipa_ioc_rx_intf_prop - interface rx property |
| 513 | * @ip: IP family of filtering rule |
| 514 | * @attrib: filtering rule |
| 515 | * @src_pipe: input pipe |
| 516 | */ |
| 517 | struct ipa_ioc_rx_intf_prop { |
| 518 | enum ipa_ip_type ip; |
| 519 | struct ipa_rule_attrib attrib; |
| 520 | enum ipa_client_type src_pipe; |
| 521 | }; |
| 522 | |
| 523 | /** |
| 524 | * struct ipa_ioc_query_intf_rx_props - interface rx propertie |
| 525 | * @name: name of interface |
| 526 | * @rx: output parameter, the rx properties go here back to back |
| 527 | */ |
| 528 | struct ipa_ioc_query_intf_rx_props { |
| 529 | char name[IPA_RESOURCE_NAME_MAX]; |
| 530 | struct ipa_ioc_rx_intf_prop rx[0]; |
| 531 | }; |
| 532 | |
| 533 | /** |
| 534 | * struct ipa_ioc_nat_alloc_mem - nat table memory allocation |
| 535 | * properties |
| 536 | * @dev_name: input parameter, the name of table |
| 537 | * @size: input parameter, size of table in bytes |
| 538 | * @offset: output parameter, offset into page in case of system memory |
| 539 | */ |
| 540 | struct ipa_ioc_nat_alloc_mem { |
| 541 | char dev_name[IPA_RESOURCE_NAME_MAX]; |
| 542 | size_t size; |
| 543 | off_t offset; |
| 544 | }; |
| 545 | |
| 546 | /** |
| 547 | * struct ipa_ioc_v4_nat_init - nat table initialization |
| 548 | * parameters |
| 549 | * @tbl_index: input parameter, index of the table |
| 550 | * @ipv4_rules_offset: input parameter, ipv4 rules address offset |
| 551 | * @expn_rules_offset: input parameter, ipv4 expansion rules address offset |
| 552 | * @index_offset: input parameter, index rules offset |
| 553 | * @index_expn_offset: input parameter, index expansion rules offset |
| 554 | * @table_entries: input parameter, ipv4 rules table size in entries |
| 555 | * @expn_table_entries: input parameter, ipv4 expansion rules table size |
| 556 | * @ip_addr: input parameter, public ip address |
| 557 | */ |
| 558 | struct ipa_ioc_v4_nat_init { |
| 559 | uint8_t tbl_index; |
| 560 | uint32_t ipv4_rules_offset; |
| 561 | uint32_t expn_rules_offset; |
| 562 | |
| 563 | uint32_t index_offset; |
| 564 | uint32_t index_expn_offset; |
| 565 | |
| 566 | uint16_t table_entries; |
| 567 | uint16_t expn_table_entries; |
| 568 | uint32_t ip_addr; |
| 569 | }; |
| 570 | |
| 571 | /** |
| 572 | * struct ipa_ioc_v4_nat_del - nat table delete parameter |
| 573 | * @table_index: input parameter, index of the table |
| 574 | * @public_ip_addr: input parameter, public ip address |
| 575 | */ |
| 576 | struct ipa_ioc_v4_nat_del { |
| 577 | uint8_t table_index; |
| 578 | uint32_t public_ip_addr; |
| 579 | }; |
| 580 | |
| 581 | /** |
| 582 | * struct ipa_ioc_nat_dma_one - nat dma command parameter |
| 583 | * @table_index: input parameter, index of the table |
| 584 | * @base_addr: type of table, from which the base address of the table |
| 585 | * can be inferred |
| 586 | * @offset: destination offset within the NAT table |
| 587 | * @data: data to be written. |
| 588 | */ |
| 589 | struct ipa_ioc_nat_dma_one { |
| 590 | uint8_t table_index; |
| 591 | uint8_t base_addr; |
| 592 | |
| 593 | uint32_t offset; |
| 594 | uint16_t data; |
| 595 | |
| 596 | }; |
| 597 | |
| 598 | /** |
| 599 | * struct ipa_ioc_nat_dma_cmd - To hold multiple nat dma commands |
| 600 | * @entries: number of dma commands in use |
| 601 | * @dma: data pointer to the dma commands |
| 602 | */ |
| 603 | struct ipa_ioc_nat_dma_cmd { |
| 604 | uint8_t entries; |
| 605 | struct ipa_ioc_nat_dma_one dma[0]; |
| 606 | |
| 607 | }; |
| 608 | |
| 609 | /** |
| 610 | * struct ipa_msg_meta - Format of the message meta-data. |
| 611 | * @msg_type: the type of the message |
| 612 | * @msg_len: the length of the message in bytes |
| 613 | * @rsvd: reserved bits for future use. |
| 614 | * |
| 615 | * Client in user-space should issue a read on the device (/dev/ipa) with a |
| 616 | * buffer of atleast this size in an continuous loop, call will block when there |
| 617 | * is no pending async message. |
| 618 | * |
| 619 | * After reading a message's meta-data using above scheme, client should issue a |
| 620 | * GET_MSG IOCTL to actually read the message itself into the buffer of |
| 621 | * "msg_len" immediately following the ipa_msg_meta itself in the IOCTL payload |
| 622 | */ |
| 623 | struct ipa_msg_meta { |
| 624 | uint8_t msg_type; |
| 625 | uint16_t msg_len; |
| 626 | uint8_t rsvd; |
| 627 | }; |
| 628 | |
| 629 | /** |
| 630 | * actual IOCTLs supported by IPA driver |
| 631 | */ |
| 632 | #define IPA_IOC_ADD_HDR _IOWR(IPA_IOC_MAGIC, \ |
| 633 | IPA_IOCTL_ADD_HDR, \ |
| 634 | struct ipa_ioc_add_hdr *) |
| 635 | #define IPA_IOC_DEL_HDR _IOWR(IPA_IOC_MAGIC, \ |
| 636 | IPA_IOCTL_DEL_HDR, \ |
| 637 | struct ipa_ioc_del_hdr *) |
| 638 | #define IPA_IOC_ADD_RT_RULE _IOWR(IPA_IOC_MAGIC, \ |
| 639 | IPA_IOCTL_ADD_RT_RULE, \ |
| 640 | struct ipa_ioc_add_rt_rule *) |
| 641 | #define IPA_IOC_DEL_RT_RULE _IOWR(IPA_IOC_MAGIC, \ |
| 642 | IPA_IOCTL_DEL_RT_RULE, \ |
| 643 | struct ipa_ioc_del_rt_rule *) |
| 644 | #define IPA_IOC_ADD_FLT_RULE _IOWR(IPA_IOC_MAGIC, \ |
| 645 | IPA_IOCTL_ADD_FLT_RULE, \ |
| 646 | struct ipa_ioc_add_flt_rule *) |
| 647 | #define IPA_IOC_DEL_FLT_RULE _IOWR(IPA_IOC_MAGIC, \ |
| 648 | IPA_IOCTL_DEL_FLT_RULE, \ |
| 649 | struct ipa_ioc_del_flt_rule *) |
| 650 | #define IPA_IOC_COMMIT_HDR _IO(IPA_IOC_MAGIC,\ |
| 651 | IPA_IOCTL_COMMIT_HDR) |
| 652 | #define IPA_IOC_RESET_HDR _IO(IPA_IOC_MAGIC,\ |
| 653 | IPA_IOCTL_RESET_HDR) |
| 654 | #define IPA_IOC_COMMIT_RT _IOW(IPA_IOC_MAGIC, \ |
| 655 | IPA_IOCTL_COMMIT_RT, \ |
| 656 | enum ipa_ip_type) |
| 657 | #define IPA_IOC_RESET_RT _IOW(IPA_IOC_MAGIC, \ |
| 658 | IPA_IOCTL_RESET_RT, \ |
| 659 | enum ipa_ip_type) |
| 660 | #define IPA_IOC_COMMIT_FLT _IOW(IPA_IOC_MAGIC, \ |
| 661 | IPA_IOCTL_COMMIT_FLT, \ |
| 662 | enum ipa_ip_type) |
| 663 | #define IPA_IOC_RESET_FLT _IOW(IPA_IOC_MAGIC, \ |
| 664 | IPA_IOCTL_RESET_FLT, \ |
| 665 | enum ipa_ip_type) |
| 666 | #define IPA_IOC_DUMP _IO(IPA_IOC_MAGIC, \ |
| 667 | IPA_IOCTL_DUMP) |
| 668 | #define IPA_IOC_GET_RT_TBL _IOWR(IPA_IOC_MAGIC, \ |
| 669 | IPA_IOCTL_GET_RT_TBL, \ |
| 670 | struct ipa_ioc_get_rt_tbl *) |
| 671 | #define IPA_IOC_PUT_RT_TBL _IOW(IPA_IOC_MAGIC, \ |
| 672 | IPA_IOCTL_PUT_RT_TBL, \ |
| 673 | uint32_t) |
| 674 | #define IPA_IOC_COPY_HDR _IOWR(IPA_IOC_MAGIC, \ |
| 675 | IPA_IOCTL_COPY_HDR, \ |
| 676 | struct ipa_ioc_copy_hdr *) |
| 677 | #define IPA_IOC_QUERY_INTF _IOWR(IPA_IOC_MAGIC, \ |
| 678 | IPA_IOCTL_QUERY_INTF, \ |
| 679 | struct ipa_ioc_query_intf *) |
| 680 | #define IPA_IOC_QUERY_INTF_TX_PROPS _IOWR(IPA_IOC_MAGIC, \ |
| 681 | IPA_IOCTL_QUERY_INTF_TX_PROPS, \ |
| 682 | struct ipa_ioc_query_intf_tx_props *) |
| 683 | #define IPA_IOC_QUERY_INTF_RX_PROPS _IOWR(IPA_IOC_MAGIC, \ |
| 684 | IPA_IOCTL_QUERY_INTF_RX_PROPS, \ |
| 685 | struct ipa_ioc_query_intf_rx_props *) |
| 686 | #define IPA_IOC_GET_HDR _IOWR(IPA_IOC_MAGIC, \ |
| 687 | IPA_IOCTL_GET_HDR, \ |
| 688 | struct ipa_ioc_get_hdr *) |
| 689 | #define IPA_IOC_PUT_HDR _IOW(IPA_IOC_MAGIC, \ |
| 690 | IPA_IOCTL_PUT_HDR, \ |
| 691 | uint32_t) |
| 692 | #define IPA_IOC_ALLOC_NAT_MEM _IOWR(IPA_IOC_MAGIC, \ |
| 693 | IPA_IOCTL_ALLOC_NAT_MEM, \ |
| 694 | struct ipa_ioc_nat_alloc_mem *) |
| 695 | #define IPA_IOC_V4_INIT_NAT _IOWR(IPA_IOC_MAGIC, \ |
| 696 | IPA_IOCTL_V4_INIT_NAT, \ |
| 697 | struct ipa_ioc_v4_nat_init *) |
| 698 | #define IPA_IOC_NAT_DMA _IOWR(IPA_IOC_MAGIC, \ |
| 699 | IPA_IOCTL_NAT_DMA, \ |
| 700 | struct ipa_ioc_nat_dma_cmd *) |
| 701 | #define IPA_IOC_V4_DEL_NAT _IOWR(IPA_IOC_MAGIC, \ |
| 702 | IPA_IOCTL_V4_DEL_NAT, \ |
| 703 | struct ipa_ioc_v4_nat_del *) |
| 704 | #define IPA_IOC_GET_NAT_OFFSET _IOWR(IPA_IOC_MAGIC, \ |
| 705 | IPA_IOCTL_GET_NAT_OFFSET, \ |
| 706 | uint32_t *) |
| 707 | #define IPA_IOC_SET_FLT _IOW(IPA_IOC_MAGIC, \ |
| 708 | IPA_IOCTL_SET_FLT, \ |
| 709 | uint32_t) |
| 710 | #define IPA_IOC_GET_ASYNC_MSG _IOWR(IPA_IOC_MAGIC, \ |
| 711 | IPA_IOCTL_GET_ASYNC_MSG, \ |
| 712 | struct ipa_msg_meta *) |
| 713 | |
| 714 | #endif /* _MSM_IPA_H_ */ |