blob: 5ead58d5febd9514fe3f06f07ec240952a0baa9b [file] [log] [blame]
Vipin Mehta30295c82010-09-01 12:06:33 -07001/*
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
28extern "C" {
29#endif
30
31typedef void (* RX_CALLBACK)(void * dev, void *osbuf);
32
Joe Perches4853ac02011-02-02 14:05:50 -080033typedef void (* ALLOC_NETBUFS)(A_NETBUF_QUEUE_T *q, u16 num);
Vipin Mehta30295c82010-09-01 12:06:33 -070034
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 */
43void *
44aggr_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 */
55void
56aggr_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 */
66void
Joe Perches4853ac02011-02-02 14:05:50 -080067aggr_process_bar(void *cntxt, u8 tid, u16 seq_no);
Vipin Mehta30295c82010-09-01 12:06:33 -070068
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,
Lucas De Marchi25985ed2011-03-30 22:57:33 -030075 * and indicate via this event after successfully completing the
Vipin Mehta30295c82010-09-01 12:06:33 -070076 * 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 */
84void
Joe Perches4853ac02011-02-02 14:05:50 -080085aggr_recv_addba_req_evt(void * cntxt, u8 tid, u16 seq_no, u8 win_sz);
Vipin Mehta30295c82010-09-01 12:06:33 -070086
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 */
95void
Joe Perchesab3655d2011-02-02 14:05:49 -080096aggr_recv_delba_req_evt(void * cntxt, u8 tid);
Vipin Mehta30295c82010-09-01 12:06:33 -070097
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 */
110void
Joe Perches4853ac02011-02-02 14:05:50 -0800111aggr_process_recv_frm(void *cntxt, u8 tid, u16 seq_no, bool is_amsdu, void **osbuf);
Vipin Mehta30295c82010-09-01 12:06:33 -0700112
113
114/*
115 * aggr_module_destroy:
116 * Frees up all the queues and frames in them. Releases the cntxt to OS.
117 */
118void
119aggr_module_destroy(void *cntxt);
120
121/*
122 * Dumps the aggregation stats
123 */
124void
125aggr_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 */
132void
133aggr_reset_state(void *cntxt);
134
135
136#ifdef __cplusplus
137}
138#endif
139
140#endif /*__AGGR_RECV_API_H__ */