Commit | Line | Data |
---|---|---|
5e6e3a92 BZ |
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 | ||
5e6e3a92 BZ |
27 | int mwifiex_ret_11n_delba(struct mwifiex_private *priv, |
28 | struct host_cmd_ds_command *resp); | |
29 | int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv, | |
30 | struct host_cmd_ds_command *resp); | |
572e8f3e | 31 | int mwifiex_ret_11n_cfg(struct host_cmd_ds_command *resp, |
a5ffddb7 AK |
32 | struct mwifiex_ds_11n_tx_cfg *tx_cfg); |
33 | int mwifiex_cmd_11n_cfg(struct host_cmd_ds_command *cmd, u16 cmd_action, | |
34 | struct mwifiex_ds_11n_tx_cfg *txcfg); | |
5e6e3a92 BZ |
35 | |
36 | int mwifiex_cmd_append_11n_tlv(struct mwifiex_private *priv, | |
37 | struct mwifiex_bssdescriptor *bss_desc, | |
38 | u8 **buffer); | |
39 | void mwifiex_cfg_tx_buf(struct mwifiex_private *priv, | |
40 | struct mwifiex_bssdescriptor *bss_desc); | |
a46b7b5c | 41 | void mwifiex_fill_cap_info(struct mwifiex_private *, u8 radio_type, |
5e6e3a92 BZ |
42 | struct mwifiex_ie_types_htcap *); |
43 | int mwifiex_set_get_11n_htcap_cfg(struct mwifiex_private *priv, | |
44 | u16 action, int *htcap_cfg); | |
45 | void mwifiex_11n_delete_tx_ba_stream_tbl_entry(struct mwifiex_private *priv, | |
46 | struct mwifiex_tx_ba_stream_tbl | |
47 | *tx_tbl); | |
48 | void mwifiex_11n_delete_all_tx_ba_stream_tbl(struct mwifiex_private *priv); | |
3e822635 | 49 | struct mwifiex_tx_ba_stream_tbl *mwifiex_get_ba_tbl(struct |
5e6e3a92 BZ |
50 | mwifiex_private |
51 | *priv, int tid, | |
52 | u8 *ra); | |
3e822635 YAP |
53 | void mwifiex_create_ba_tbl(struct mwifiex_private *priv, u8 *ra, int tid, |
54 | enum mwifiex_ba_status ba_status); | |
5e6e3a92 BZ |
55 | int mwifiex_send_addba(struct mwifiex_private *priv, int tid, u8 *peer_mac); |
56 | int mwifiex_send_delba(struct mwifiex_private *priv, int tid, u8 *peer_mac, | |
57 | int initiator); | |
58 | void mwifiex_11n_delete_ba_stream(struct mwifiex_private *priv, u8 *del_ba); | |
59 | int mwifiex_get_rx_reorder_tbl(struct mwifiex_private *priv, | |
60 | struct mwifiex_ds_rx_reorder_tbl *buf); | |
61 | int mwifiex_get_tx_ba_stream_tbl(struct mwifiex_private *priv, | |
62 | struct mwifiex_ds_tx_ba_stream_tbl *buf); | |
572e8f3e | 63 | int mwifiex_ret_amsdu_aggr_ctrl(struct host_cmd_ds_command *resp, |
a5ffddb7 AK |
64 | struct mwifiex_ds_11n_amsdu_aggr_ctrl |
65 | *amsdu_aggr_ctrl); | |
5e6e3a92 BZ |
66 | int mwifiex_cmd_recfg_tx_buf(struct mwifiex_private *priv, |
67 | struct host_cmd_ds_command *cmd, | |
a5ffddb7 | 68 | int cmd_action, u16 *buf_size); |
572e8f3e | 69 | int mwifiex_cmd_amsdu_aggr_ctrl(struct host_cmd_ds_command *cmd, |
a5ffddb7 AK |
70 | int cmd_action, |
71 | struct mwifiex_ds_11n_amsdu_aggr_ctrl *aa_ctrl); | |
3e238a11 | 72 | void mwifiex_del_tx_ba_stream_tbl_by_ra(struct mwifiex_private *priv, u8 *ra); |
5e6e3a92 BZ |
73 | |
74 | /* | |
75 | * This function checks whether AMPDU is allowed or not for a particular TID. | |
76 | */ | |
77 | static inline u8 | |
572e8f3e | 78 | mwifiex_is_ampdu_allowed(struct mwifiex_private *priv, int tid) |
5e6e3a92 BZ |
79 | { |
80 | return ((priv->aggr_prio_tbl[tid].ampdu_ap != BA_STREAM_NOT_ALLOWED) | |
81 | ? true : false); | |
82 | } | |
83 | ||
84 | /* | |
85 | * This function checks whether AMSDU is allowed or not for a particular TID. | |
86 | */ | |
87 | static inline u8 | |
572e8f3e | 88 | mwifiex_is_amsdu_allowed(struct mwifiex_private *priv, int tid) |
5e6e3a92 | 89 | { |
84266841 YAP |
90 | return (((priv->aggr_prio_tbl[tid].amsdu != BA_STREAM_NOT_ALLOWED) && |
91 | (priv->is_data_rate_auto || !(priv->bitmap_rates[2] & 0x03))) | |
5e6e3a92 BZ |
92 | ? true : false); |
93 | } | |
94 | ||
95 | /* | |
53d7938e | 96 | * This function checks whether a space is available for new BA stream or not. |
5e6e3a92 | 97 | */ |
53d7938e BZ |
98 | static inline u8 mwifiex_space_avail_for_new_ba_stream( |
99 | struct mwifiex_adapter *adapter) | |
5e6e3a92 | 100 | { |
572e8f3e AK |
101 | struct mwifiex_private *priv; |
102 | u8 i; | |
5e6e3a92 BZ |
103 | u32 ba_stream_num = 0; |
104 | ||
572e8f3e AK |
105 | for (i = 0; i < adapter->priv_num; i++) { |
106 | priv = adapter->priv[i]; | |
107 | if (priv) | |
108 | ba_stream_num += mwifiex_wmm_list_len( | |
2c208890 | 109 | &priv->tx_ba_stream_tbl_ptr); |
5e6e3a92 BZ |
110 | } |
111 | ||
112 | return ((ba_stream_num < | |
113 | MWIFIEX_MAX_TX_BASTREAM_SUPPORTED) ? true : false); | |
114 | } | |
115 | ||
116 | /* | |
117 | * This function finds the correct Tx BA stream to delete. | |
118 | * | |
119 | * Upon successfully locating, both the TID and the RA are returned. | |
120 | */ | |
121 | static inline u8 | |
572e8f3e | 122 | mwifiex_find_stream_to_delete(struct mwifiex_private *priv, int ptr_tid, |
5e6e3a92 BZ |
123 | int *ptid, u8 *ra) |
124 | { | |
125 | int tid; | |
126 | u8 ret = false; | |
127 | struct mwifiex_tx_ba_stream_tbl *tx_tbl; | |
128 | unsigned long flags; | |
129 | ||
130 | tid = priv->aggr_prio_tbl[ptr_tid].ampdu_user; | |
131 | ||
132 | spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags); | |
133 | list_for_each_entry(tx_tbl, &priv->tx_ba_stream_tbl_ptr, list) { | |
134 | if (tid > priv->aggr_prio_tbl[tx_tbl->tid].ampdu_user) { | |
135 | tid = priv->aggr_prio_tbl[tx_tbl->tid].ampdu_user; | |
136 | *ptid = tx_tbl->tid; | |
137 | memcpy(ra, tx_tbl->ra, ETH_ALEN); | |
138 | ret = true; | |
139 | } | |
140 | } | |
141 | spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags); | |
142 | ||
143 | return ret; | |
144 | } | |
145 | ||
146 | /* | |
147 | * This function checks whether BA stream is set up or not. | |
148 | */ | |
149 | static inline int | |
150 | mwifiex_is_ba_stream_setup(struct mwifiex_private *priv, | |
84266841 | 151 | struct mwifiex_ra_list_tbl *ptr, int tid) |
5e6e3a92 BZ |
152 | { |
153 | struct mwifiex_tx_ba_stream_tbl *tx_tbl; | |
154 | ||
3e822635 | 155 | tx_tbl = mwifiex_get_ba_tbl(priv, tid, ptr->ra); |
5e6e3a92 BZ |
156 | if (tx_tbl && IS_BASTREAM_SETUP(tx_tbl)) |
157 | return true; | |
158 | ||
159 | return false; | |
160 | } | |
5a009adf AP |
161 | |
162 | /* | |
163 | * This function checks whether associated station is 11n enabled | |
164 | */ | |
165 | static inline int mwifiex_is_sta_11n_enabled(struct mwifiex_private *priv, | |
166 | struct mwifiex_sta_node *node) | |
167 | { | |
168 | ||
169 | if (!node || (priv->bss_role != MWIFIEX_BSS_ROLE_UAP) || | |
170 | !priv->ap_11n_enabled) | |
171 | return 0; | |
172 | ||
173 | return node->is_11n_enabled; | |
174 | } | |
5e6e3a92 | 175 | #endif /* !_MWIFIEX_11N_H_ */ |