Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6
[pandora-kernel.git] / drivers / staging / ath6kl / include / aggr_recv_api.h
1 /*
2  *
3  * Copyright (c) 2004-2010 Atheros Communications Inc.
4  * All rights reserved.
5  *
6  * 
7 //
8 // Permission to use, copy, modify, and/or distribute this software for any
9 // purpose with or without fee is hereby granted, provided that the above
10 // copyright notice and this permission notice appear in all copies.
11 //
12 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15 // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 //
20 //
21  *
22  */
23
24 #ifndef __AGGR_RECV_API_H__
25 #define __AGGR_RECV_API_H__
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 typedef void (* RX_CALLBACK)(void * dev, void *osbuf);
32
33 typedef void (* ALLOC_NETBUFS)(A_NETBUF_QUEUE_T *q, A_UINT16 num);
34
35 /*
36  * aggr_init:
37  * Initialises the data structures, allocates data queues and 
38  * os buffers. Netbuf allocator is the input param, used by the
39  * aggr module for allocation of NETBUFs from driver context.
40  * These NETBUFs are used for AMSDU processing.
41  * Returns the context for the aggr module.
42  */
43 void *
44 aggr_init(ALLOC_NETBUFS netbuf_allocator);
45
46
47 /*
48  * aggr_register_rx_dispatcher:
49  * Registers OS call back function to deliver the
50  * frames to OS. This is generally the topmost layer of
51  * the driver context, after which the frames go to
52  * IP stack via the call back function.
53  * This dispatcher is active only when aggregation is ON.
54  */
55 void
56 aggr_register_rx_dispatcher(void *cntxt, void * dev,  RX_CALLBACK fn);
57
58
59 /*
60  * aggr_process_bar:
61  * When target receives BAR, it communicates to host driver
62  * for modifying window parameters. Target indicates this via the 
63  * event: WMI_ADDBA_REQ_EVENTID. Host will dequeue all frames
64  * up to the indicated sequence number.
65  */
66 void
67 aggr_process_bar(void *cntxt, A_UINT8 tid, A_UINT16 seq_no);
68
69
70 /*
71  * aggr_recv_addba_req_evt:
72  * This event is to initiate/modify the receive side window.
73  * Target will send WMI_ADDBA_REQ_EVENTID event to host - to setup 
74  * recv re-ordering queues. Target will negotiate ADDBA with peer, 
75  * and indicate via this event after succesfully completing the 
76  * negotiation. This happens in two situations:
77  *  1. Initial setup of aggregation
78  *  2. Renegotiation of current recv window.
79  * Window size for re-ordering is limited by target buffer
80  * space, which is reflected in win_sz.
81  * (Re)Start the periodic timer to deliver long standing frames,
82  * in hold_q to OS.
83  */
84 void
85 aggr_recv_addba_req_evt(void * cntxt, A_UINT8 tid, A_UINT16 seq_no, A_UINT8 win_sz);
86
87
88 /*
89  * aggr_recv_delba_req_evt:
90  * Target indicates deletion of a BA window for a tid via the
91  * WMI_DELBA_EVENTID. Host would deliver all the frames in the 
92  * hold_q, reset tid config and disable the periodic timer, if 
93  * aggr is not enabled on any tid.
94  */
95 void
96 aggr_recv_delba_req_evt(void * cntxt, A_UINT8 tid);
97
98
99
100 /*
101  * aggr_process_recv_frm:
102  * Called only for data frames. When aggr is ON for a tid, the buffer 
103  * is always consumed, and osbuf would be NULL. For a non-aggr case,
104  * osbuf is not modified.
105  * AMSDU frames are consumed and are later freed. They are sliced and 
106  * diced to individual frames and dispatched to stack.
107  * After consuming a osbuf(when aggr is ON), a previously registered
108  * callback may be called to deliver frames in order.
109  */
110 void
111 aggr_process_recv_frm(void *cntxt, A_UINT8 tid, A_UINT16 seq_no, A_BOOL is_amsdu, void **osbuf);
112
113
114 /*
115  * aggr_module_destroy:
116  * Frees up all the queues and frames in them. Releases the cntxt to OS.
117  */
118 void
119 aggr_module_destroy(void *cntxt);
120
121 /*
122  * Dumps the aggregation stats 
123  */
124 void
125 aggr_dump_stats(void *cntxt, PACKET_LOG **log_buf);
126
127 /* 
128  * aggr_reset_state -- Called when it is deemed necessary to clear the aggregate
129  *  hold Q state.  Examples include when a Connect event or disconnect event is 
130  *  received. 
131  */
132 void
133 aggr_reset_state(void *cntxt);
134
135
136 #ifdef __cplusplus
137 }
138 #endif
139
140 #endif /*__AGGR_RECV_API_H__ */