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