aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex/11n.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/mwifiex/11n.h')
-rw-r--r--drivers/net/wireless/mwifiex/11n.h176
1 files changed, 176 insertions, 0 deletions
diff --git a/drivers/net/wireless/mwifiex/11n.h b/drivers/net/wireless/mwifiex/11n.h
new file mode 100644
index 00000000000..71a853e61b6
--- /dev/null
+++ b/drivers/net/wireless/mwifiex/11n.h
@@ -0,0 +1,176 @@
1/*
2 * Marvell Wireless LAN device driver: 802.11n
3 *
4 * Copyright (C) 2011, Marvell International Ltd.
5 *
6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
8 * (the "License"). You may use, redistribute and/or modify this File in
9 * accordance with the terms and conditions of the License, a copy of which
10 * is available by writing to the Free Software Foundation, Inc.,
11 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
12 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
13 *
14 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
16 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
17 * this warranty disclaimer.
18 */
19
20#ifndef _MWIFIEX_11N_H_
21#define _MWIFIEX_11N_H_
22
23#include "11n_aggr.h"
24#include "11n_rxreorder.h"
25#include "wmm.h"
26
27int mwifiex_ret_11n_delba(struct mwifiex_private *priv,
28 struct host_cmd_ds_command *resp);
29int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv,
30 struct host_cmd_ds_command *resp);
31int mwifiex_ret_11n_cfg(struct mwifiex_private *priv,
32 struct host_cmd_ds_command *resp,
33 void *data_buf);
34int mwifiex_cmd_11n_cfg(struct mwifiex_private *priv,
35 struct host_cmd_ds_command *cmd,
36 u16 cmd_action, void *data_buf);
37
38int mwifiex_cmd_11n_cfg(struct mwifiex_private *priv,
39 struct host_cmd_ds_command *cmd,
40 u16 cmd_action, void *data_buf);
41
42int mwifiex_cmd_append_11n_tlv(struct mwifiex_private *priv,
43 struct mwifiex_bssdescriptor *bss_desc,
44 u8 **buffer);
45void mwifiex_cfg_tx_buf(struct mwifiex_private *priv,
46 struct mwifiex_bssdescriptor *bss_desc);
47void mwifiex_fill_cap_info(struct mwifiex_private *,
48 struct mwifiex_ie_types_htcap *);
49int mwifiex_set_get_11n_htcap_cfg(struct mwifiex_private *priv,
50 u16 action, int *htcap_cfg);
51void mwifiex_11n_delete_tx_ba_stream_tbl_entry(struct mwifiex_private *priv,
52 struct mwifiex_tx_ba_stream_tbl
53 *tx_tbl);
54void mwifiex_11n_delete_all_tx_ba_stream_tbl(struct mwifiex_private *priv);
55struct mwifiex_tx_ba_stream_tbl *mwifiex_11n_get_tx_ba_stream_tbl(struct
56 mwifiex_private
57 *priv, int tid,
58 u8 *ra);
59void mwifiex_11n_create_tx_ba_stream_tbl(struct mwifiex_private *priv, u8 *ra,
60 int tid,
61 enum mwifiex_ba_status ba_status);
62int mwifiex_send_addba(struct mwifiex_private *priv, int tid, u8 *peer_mac);
63int mwifiex_send_delba(struct mwifiex_private *priv, int tid, u8 *peer_mac,
64 int initiator);
65void mwifiex_11n_delete_ba_stream(struct mwifiex_private *priv, u8 *del_ba);
66int mwifiex_get_rx_reorder_tbl(struct mwifiex_private *priv,
67 struct mwifiex_ds_rx_reorder_tbl *buf);
68int mwifiex_get_tx_ba_stream_tbl(struct mwifiex_private *priv,
69 struct mwifiex_ds_tx_ba_stream_tbl *buf);
70int mwifiex_ret_amsdu_aggr_ctrl(struct mwifiex_private *priv,
71 struct host_cmd_ds_command
72 *resp,
73 void *data_buf);
74int mwifiex_cmd_recfg_tx_buf(struct mwifiex_private *priv,
75 struct host_cmd_ds_command *cmd,
76 int cmd_action, void *data_buf);
77int mwifiex_cmd_amsdu_aggr_ctrl(struct mwifiex_private *priv,
78 struct host_cmd_ds_command *cmd,
79 int cmd_action,
80 void *data_buf);
81
82/*
83 * This function checks whether AMPDU is allowed or not for a particular TID.
84 */
85static inline u8
86mwifiex_is_ampdu_allowed(struct mwifiex_private *priv,
87 struct mwifiex_ra_list_tbl *ptr, int tid)
88{
89 return ((priv->aggr_prio_tbl[tid].ampdu_ap != BA_STREAM_NOT_ALLOWED)
90 ? true : false);
91}
92
93/*
94 * This function checks whether AMSDU is allowed or not for a particular TID.
95 */
96static inline u8
97mwifiex_is_amsdu_allowed(struct mwifiex_private *priv,
98 struct mwifiex_ra_list_tbl *ptr, int tid)
99{
100 return (((priv->aggr_prio_tbl[tid].amsdu != BA_STREAM_NOT_ALLOWED)
101 && ((priv->is_data_rate_auto)
102 || !((priv->bitmap_rates[2]) & 0x03)))
103 ? true : false);
104}
105
106/*
107 * This function checks whether a BA stream is available or not.
108 */
109static inline u8
110mwifiex_is_ba_stream_avail(struct mwifiex_private *priv)
111{
112 struct mwifiex_private *pmpriv = NULL;
113 u8 i = 0;
114 u32 ba_stream_num = 0;
115
116 for (i = 0; i < priv->adapter->priv_num; i++) {
117 pmpriv = priv->adapter->priv[i];
118 if (pmpriv)
119 ba_stream_num +=
120 mwifiex_wmm_list_len(priv->adapter,
121 (struct list_head
122 *) &pmpriv->
123 tx_ba_stream_tbl_ptr);
124 }
125
126 return ((ba_stream_num <
127 MWIFIEX_MAX_TX_BASTREAM_SUPPORTED) ? true : false);
128}
129
130/*
131 * This function finds the correct Tx BA stream to delete.
132 *
133 * Upon successfully locating, both the TID and the RA are returned.
134 */
135static inline u8
136mwifiex_find_stream_to_delete(struct mwifiex_private *priv,
137 struct mwifiex_ra_list_tbl *ptr, int ptr_tid,
138 int *ptid, u8 *ra)
139{
140 int tid;
141 u8 ret = false;
142 struct mwifiex_tx_ba_stream_tbl *tx_tbl;
143 unsigned long flags;
144
145 tid = priv->aggr_prio_tbl[ptr_tid].ampdu_user;
146
147 spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags);
148 list_for_each_entry(tx_tbl, &priv->tx_ba_stream_tbl_ptr, list) {
149 if (tid > priv->aggr_prio_tbl[tx_tbl->tid].ampdu_user) {
150 tid = priv->aggr_prio_tbl[tx_tbl->tid].ampdu_user;
151 *ptid = tx_tbl->tid;
152 memcpy(ra, tx_tbl->ra, ETH_ALEN);
153 ret = true;
154 }
155 }
156 spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags);
157
158 return ret;
159}
160
161/*
162 * This function checks whether BA stream is set up or not.
163 */
164static inline int
165mwifiex_is_ba_stream_setup(struct mwifiex_private *priv,
166 struct mwifiex_ra_list_tbl *ptr, int tid)
167{
168 struct mwifiex_tx_ba_stream_tbl *tx_tbl;
169
170 tx_tbl = mwifiex_11n_get_tx_ba_stream_tbl(priv, tid, ptr->ra);
171 if (tx_tbl && IS_BASTREAM_SETUP(tx_tbl))
172 return true;
173
174 return false;
175}
176#endif /* !_MWIFIEX_11N_H_ */