2 * Marvell Wireless LAN device driver: 802.11n
4 * Copyright (C) 2011, Marvell International Ltd.
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.
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.
29 * Fills HT capability information field, AMPDU Parameters field, HT extended
30 * capability field, and supported MCS set fields.
32 * HT capability information field, AMPDU Parameters field, supported MCS set
33 * fields are retrieved from cfg80211 stack
35 * RD responder bit to set to clear in the extended capability header.
38 mwifiex_fill_cap_info(struct mwifiex_private
*priv
, u8 radio_type
,
39 struct mwifiex_ie_types_htcap
*ht_cap
)
41 uint16_t ht_ext_cap
= le16_to_cpu(ht_cap
->ht_cap
.extended_ht_cap_info
);
42 struct ieee80211_supported_band
*sband
=
43 priv
->wdev
->wiphy
->bands
[radio_type
];
45 ht_cap
->ht_cap
.ampdu_params_info
=
46 (sband
->ht_cap
.ampdu_factor
&
47 IEEE80211_HT_AMPDU_PARM_FACTOR
) |
48 ((sband
->ht_cap
.ampdu_density
<<
49 IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT
) &
50 IEEE80211_HT_AMPDU_PARM_DENSITY
);
52 memcpy((u8
*) &ht_cap
->ht_cap
.mcs
, &sband
->ht_cap
.mcs
,
53 sizeof(sband
->ht_cap
.mcs
));
55 if (priv
->bss_mode
== NL80211_IFTYPE_STATION
||
56 (sband
->ht_cap
.cap
& IEEE80211_HT_CAP_SUP_WIDTH_20_40
&&
57 (priv
->adapter
->sec_chan_offset
!=
58 IEEE80211_HT_PARAM_CHA_SEC_NONE
)))
59 /* Set MCS32 for infra mode or ad-hoc mode with 40MHz support */
60 SETHT_MCS32(ht_cap
->ht_cap
.mcs
.rx_mask
);
62 /* Clear RD responder bit */
63 ht_ext_cap
&= ~IEEE80211_HT_EXT_CAP_RD_RESPONDER
;
65 ht_cap
->ht_cap
.cap_info
= cpu_to_le16(sband
->ht_cap
.cap
);
66 ht_cap
->ht_cap
.extended_ht_cap_info
= cpu_to_le16(ht_ext_cap
);
70 * This function returns the pointer to an entry in BA Stream
71 * table which matches the requested BA status.
73 static struct mwifiex_tx_ba_stream_tbl
*
74 mwifiex_get_ba_status(struct mwifiex_private
*priv
,
75 enum mwifiex_ba_status ba_status
)
77 struct mwifiex_tx_ba_stream_tbl
*tx_ba_tsr_tbl
;
80 spin_lock_irqsave(&priv
->tx_ba_stream_tbl_lock
, flags
);
81 list_for_each_entry(tx_ba_tsr_tbl
, &priv
->tx_ba_stream_tbl_ptr
, list
) {
82 if (tx_ba_tsr_tbl
->ba_status
== ba_status
) {
83 spin_unlock_irqrestore(&priv
->tx_ba_stream_tbl_lock
,
88 spin_unlock_irqrestore(&priv
->tx_ba_stream_tbl_lock
, flags
);
93 * This function handles the command response of delete a block
96 * The function checks the response success status and takes action
97 * accordingly (send an add BA request in case of success, or recreate
98 * the deleted stream in case of failure, if the add BA was also
101 int mwifiex_ret_11n_delba(struct mwifiex_private
*priv
,
102 struct host_cmd_ds_command
*resp
)
105 struct mwifiex_tx_ba_stream_tbl
*tx_ba_tbl
;
106 struct host_cmd_ds_11n_delba
*del_ba
= &resp
->params
.del_ba
;
107 uint16_t del_ba_param_set
= le16_to_cpu(del_ba
->del_ba_param_set
);
109 tid
= del_ba_param_set
>> DELBA_TID_POS
;
110 if (del_ba
->del_result
== BA_RESULT_SUCCESS
) {
111 mwifiex_del_ba_tbl(priv
, tid
, del_ba
->peer_mac_addr
,
113 INITIATOR_BIT(del_ba_param_set
));
115 tx_ba_tbl
= mwifiex_get_ba_status(priv
, BA_SETUP_INPROGRESS
);
117 mwifiex_send_addba(priv
, tx_ba_tbl
->tid
,
120 * In case of failure, recreate the deleted stream in case
121 * we initiated the ADDBA
123 if (!INITIATOR_BIT(del_ba_param_set
))
126 mwifiex_create_ba_tbl(priv
, del_ba
->peer_mac_addr
, tid
,
127 BA_SETUP_INPROGRESS
);
129 tx_ba_tbl
= mwifiex_get_ba_status(priv
, BA_SETUP_INPROGRESS
);
132 mwifiex_del_ba_tbl(priv
, tx_ba_tbl
->tid
, tx_ba_tbl
->ra
,
133 TYPE_DELBA_SENT
, true);
140 * This function handles the command response of add a block
143 * Handling includes changing the header fields to CPU formats, checking
144 * the response success status and taking actions accordingly (delete the
145 * BA stream table in case of failure).
147 int mwifiex_ret_11n_addba_req(struct mwifiex_private
*priv
,
148 struct host_cmd_ds_command
*resp
)
151 struct host_cmd_ds_11n_addba_rsp
*add_ba_rsp
= &resp
->params
.add_ba_rsp
;
152 struct mwifiex_tx_ba_stream_tbl
*tx_ba_tbl
;
154 add_ba_rsp
->ssn
= cpu_to_le16((le16_to_cpu(add_ba_rsp
->ssn
))
157 tid
= (le16_to_cpu(add_ba_rsp
->block_ack_param_set
)
158 & IEEE80211_ADDBA_PARAM_TID_MASK
)
159 >> BLOCKACKPARAM_TID_POS
;
160 if (le16_to_cpu(add_ba_rsp
->status_code
) == BA_RESULT_SUCCESS
) {
161 tx_ba_tbl
= mwifiex_get_ba_tbl(priv
, tid
,
162 add_ba_rsp
->peer_mac_addr
);
164 dev_dbg(priv
->adapter
->dev
, "info: BA stream complete\n");
165 tx_ba_tbl
->ba_status
= BA_SETUP_COMPLETE
;
167 dev_err(priv
->adapter
->dev
, "BA stream not created\n");
170 mwifiex_del_ba_tbl(priv
, tid
, add_ba_rsp
->peer_mac_addr
,
171 TYPE_DELBA_SENT
, true);
172 if (add_ba_rsp
->add_rsp_result
!= BA_RESULT_TIMEOUT
)
173 priv
->aggr_prio_tbl
[tid
].ampdu_ap
=
174 BA_STREAM_NOT_ALLOWED
;
181 * This function prepares command of reconfigure Tx buffer.
183 * Preparation includes -
184 * - Setting command ID, action and proper size
185 * - Setting Tx buffer size (for SET only)
186 * - Ensuring correct endian-ness
188 int mwifiex_cmd_recfg_tx_buf(struct mwifiex_private
*priv
,
189 struct host_cmd_ds_command
*cmd
, int cmd_action
,
192 struct host_cmd_ds_txbuf_cfg
*tx_buf
= &cmd
->params
.tx_buf
;
193 u16 action
= (u16
) cmd_action
;
195 cmd
->command
= cpu_to_le16(HostCmd_CMD_RECONFIGURE_TX_BUFF
);
197 cpu_to_le16(sizeof(struct host_cmd_ds_txbuf_cfg
) + S_DS_GEN
);
198 tx_buf
->action
= cpu_to_le16(action
);
200 case HostCmd_ACT_GEN_SET
:
201 dev_dbg(priv
->adapter
->dev
, "cmd: set tx_buf=%d\n", *buf_size
);
202 tx_buf
->buff_size
= cpu_to_le16(*buf_size
);
204 case HostCmd_ACT_GEN_GET
:
206 tx_buf
->buff_size
= 0;
213 * This function prepares command of AMSDU aggregation control.
215 * Preparation includes -
216 * - Setting command ID, action and proper size
217 * - Setting AMSDU control parameters (for SET only)
218 * - Ensuring correct endian-ness
220 int mwifiex_cmd_amsdu_aggr_ctrl(struct host_cmd_ds_command
*cmd
,
222 struct mwifiex_ds_11n_amsdu_aggr_ctrl
*aa_ctrl
)
224 struct host_cmd_ds_amsdu_aggr_ctrl
*amsdu_ctrl
=
225 &cmd
->params
.amsdu_aggr_ctrl
;
226 u16 action
= (u16
) cmd_action
;
228 cmd
->command
= cpu_to_le16(HostCmd_CMD_AMSDU_AGGR_CTRL
);
229 cmd
->size
= cpu_to_le16(sizeof(struct host_cmd_ds_amsdu_aggr_ctrl
)
231 amsdu_ctrl
->action
= cpu_to_le16(action
);
233 case HostCmd_ACT_GEN_SET
:
234 amsdu_ctrl
->enable
= cpu_to_le16(aa_ctrl
->enable
);
235 amsdu_ctrl
->curr_buf_size
= 0;
237 case HostCmd_ACT_GEN_GET
:
239 amsdu_ctrl
->curr_buf_size
= 0;
246 * This function prepares 11n configuration command.
248 * Preparation includes -
249 * - Setting command ID, action and proper size
250 * - Setting HT Tx capability and HT Tx information fields
251 * - Ensuring correct endian-ness
253 int mwifiex_cmd_11n_cfg(struct mwifiex_private
*priv
,
254 struct host_cmd_ds_command
*cmd
, u16 cmd_action
,
255 struct mwifiex_ds_11n_tx_cfg
*txcfg
)
257 struct host_cmd_ds_11n_cfg
*htcfg
= &cmd
->params
.htcfg
;
259 cmd
->command
= cpu_to_le16(HostCmd_CMD_11N_CFG
);
260 cmd
->size
= cpu_to_le16(sizeof(struct host_cmd_ds_11n_cfg
) + S_DS_GEN
);
261 htcfg
->action
= cpu_to_le16(cmd_action
);
262 htcfg
->ht_tx_cap
= cpu_to_le16(txcfg
->tx_htcap
);
263 htcfg
->ht_tx_info
= cpu_to_le16(txcfg
->tx_htinfo
);
265 if (priv
->adapter
->is_hw_11ac_capable
)
266 htcfg
->misc_config
= cpu_to_le16(txcfg
->misc_config
);
272 * This function appends an 11n TLV to a buffer.
274 * Buffer allocation is responsibility of the calling
275 * function. No size validation is made here.
277 * The function fills up the following sections, if applicable -
279 * - HT information IE (with channel list)
280 * - 20/40 BSS Coexistence IE
281 * - HT Extended Capabilities IE
284 mwifiex_cmd_append_11n_tlv(struct mwifiex_private
*priv
,
285 struct mwifiex_bssdescriptor
*bss_desc
,
288 struct mwifiex_ie_types_htcap
*ht_cap
;
289 struct mwifiex_ie_types_htinfo
*ht_info
;
290 struct mwifiex_ie_types_chan_list_param_set
*chan_list
;
291 struct mwifiex_ie_types_2040bssco
*bss_co_2040
;
292 struct mwifiex_ie_types_extcap
*ext_cap
;
294 struct ieee80211_supported_band
*sband
;
295 struct ieee_types_header
*hdr
;
298 if (!buffer
|| !*buffer
)
301 radio_type
= mwifiex_band_to_radio_type((u8
) bss_desc
->bss_band
);
302 sband
= priv
->wdev
->wiphy
->bands
[radio_type
];
304 if (bss_desc
->bcn_ht_cap
) {
305 ht_cap
= (struct mwifiex_ie_types_htcap
*) *buffer
;
306 memset(ht_cap
, 0, sizeof(struct mwifiex_ie_types_htcap
));
307 ht_cap
->header
.type
= cpu_to_le16(WLAN_EID_HT_CAPABILITY
);
309 cpu_to_le16(sizeof(struct ieee80211_ht_cap
));
310 memcpy((u8
*) ht_cap
+ sizeof(struct mwifiex_ie_types_header
),
311 (u8
*) bss_desc
->bcn_ht_cap
+
312 sizeof(struct ieee_types_header
),
313 le16_to_cpu(ht_cap
->header
.len
));
315 mwifiex_fill_cap_info(priv
, radio_type
, ht_cap
);
317 *buffer
+= sizeof(struct mwifiex_ie_types_htcap
);
318 ret_len
+= sizeof(struct mwifiex_ie_types_htcap
);
321 if (bss_desc
->bcn_ht_oper
) {
322 if (priv
->bss_mode
== NL80211_IFTYPE_ADHOC
) {
323 ht_info
= (struct mwifiex_ie_types_htinfo
*) *buffer
;
325 sizeof(struct mwifiex_ie_types_htinfo
));
326 ht_info
->header
.type
=
327 cpu_to_le16(WLAN_EID_HT_OPERATION
);
328 ht_info
->header
.len
=
330 sizeof(struct ieee80211_ht_operation
));
332 memcpy((u8
*) ht_info
+
333 sizeof(struct mwifiex_ie_types_header
),
334 (u8
*) bss_desc
->bcn_ht_oper
+
335 sizeof(struct ieee_types_header
),
336 le16_to_cpu(ht_info
->header
.len
));
338 if (!(sband
->ht_cap
.cap
&
339 IEEE80211_HT_CAP_SUP_WIDTH_20_40
))
340 ht_info
->ht_oper
.ht_param
&=
341 ~(IEEE80211_HT_PARAM_CHAN_WIDTH_ANY
|
342 IEEE80211_HT_PARAM_CHA_SEC_OFFSET
);
344 *buffer
+= sizeof(struct mwifiex_ie_types_htinfo
);
345 ret_len
+= sizeof(struct mwifiex_ie_types_htinfo
);
349 (struct mwifiex_ie_types_chan_list_param_set
*) *buffer
;
351 sizeof(struct mwifiex_ie_types_chan_list_param_set
));
352 chan_list
->header
.type
= cpu_to_le16(TLV_TYPE_CHANLIST
);
353 chan_list
->header
.len
= cpu_to_le16(
354 sizeof(struct mwifiex_ie_types_chan_list_param_set
) -
355 sizeof(struct mwifiex_ie_types_header
));
356 chan_list
->chan_scan_param
[0].chan_number
=
357 bss_desc
->bcn_ht_oper
->primary_chan
;
358 chan_list
->chan_scan_param
[0].radio_type
=
359 mwifiex_band_to_radio_type((u8
) bss_desc
->bss_band
);
361 if (sband
->ht_cap
.cap
& IEEE80211_HT_CAP_SUP_WIDTH_20_40
&&
362 bss_desc
->bcn_ht_oper
->ht_param
&
363 IEEE80211_HT_PARAM_CHAN_WIDTH_ANY
)
364 SET_SECONDARYCHAN(chan_list
->chan_scan_param
[0].
366 (bss_desc
->bcn_ht_oper
->ht_param
&
367 IEEE80211_HT_PARAM_CHA_SEC_OFFSET
));
369 *buffer
+= sizeof(struct mwifiex_ie_types_chan_list_param_set
);
370 ret_len
+= sizeof(struct mwifiex_ie_types_chan_list_param_set
);
373 if (bss_desc
->bcn_bss_co_2040
) {
374 bss_co_2040
= (struct mwifiex_ie_types_2040bssco
*) *buffer
;
375 memset(bss_co_2040
, 0,
376 sizeof(struct mwifiex_ie_types_2040bssco
));
377 bss_co_2040
->header
.type
= cpu_to_le16(WLAN_EID_BSS_COEX_2040
);
378 bss_co_2040
->header
.len
=
379 cpu_to_le16(sizeof(bss_co_2040
->bss_co_2040
));
381 memcpy((u8
*) bss_co_2040
+
382 sizeof(struct mwifiex_ie_types_header
),
383 bss_desc
->bcn_bss_co_2040
+
384 sizeof(struct ieee_types_header
),
385 le16_to_cpu(bss_co_2040
->header
.len
));
387 *buffer
+= sizeof(struct mwifiex_ie_types_2040bssco
);
388 ret_len
+= sizeof(struct mwifiex_ie_types_2040bssco
);
391 if (bss_desc
->bcn_ext_cap
) {
392 hdr
= (void *)bss_desc
->bcn_ext_cap
;
393 ext_cap
= (struct mwifiex_ie_types_extcap
*) *buffer
;
394 memset(ext_cap
, 0, sizeof(struct mwifiex_ie_types_extcap
));
395 ext_cap
->header
.type
= cpu_to_le16(WLAN_EID_EXT_CAPABILITY
);
396 ext_cap
->header
.len
= cpu_to_le16(hdr
->len
);
398 memcpy((u8
*)ext_cap
->ext_capab
,
399 bss_desc
->bcn_ext_cap
+ sizeof(struct ieee_types_header
),
400 le16_to_cpu(ext_cap
->header
.len
));
403 ext_cap
->ext_capab
[3] & WLAN_EXT_CAPA4_INTERWORKING_ENABLED
)
404 priv
->hs2_enabled
= true;
406 priv
->hs2_enabled
= false;
408 *buffer
+= sizeof(struct mwifiex_ie_types_extcap
) + hdr
->len
;
409 ret_len
+= sizeof(struct mwifiex_ie_types_extcap
) + hdr
->len
;
416 * This function checks if the given pointer is valid entry of
417 * Tx BA Stream table.
419 static int mwifiex_is_tx_ba_stream_ptr_valid(struct mwifiex_private
*priv
,
420 struct mwifiex_tx_ba_stream_tbl
*tx_tbl_ptr
)
422 struct mwifiex_tx_ba_stream_tbl
*tx_ba_tsr_tbl
;
424 list_for_each_entry(tx_ba_tsr_tbl
, &priv
->tx_ba_stream_tbl_ptr
, list
) {
425 if (tx_ba_tsr_tbl
== tx_tbl_ptr
)
433 * This function deletes the given entry in Tx BA Stream table.
435 * The function also performs a validity check on the supplied
436 * pointer before trying to delete.
438 void mwifiex_11n_delete_tx_ba_stream_tbl_entry(struct mwifiex_private
*priv
,
439 struct mwifiex_tx_ba_stream_tbl
*tx_ba_tsr_tbl
)
441 if (!tx_ba_tsr_tbl
&&
442 mwifiex_is_tx_ba_stream_ptr_valid(priv
, tx_ba_tsr_tbl
))
445 dev_dbg(priv
->adapter
->dev
, "info: tx_ba_tsr_tbl %p\n", tx_ba_tsr_tbl
);
447 list_del(&tx_ba_tsr_tbl
->list
);
449 kfree(tx_ba_tsr_tbl
);
453 * This function deletes all the entries in Tx BA Stream table.
455 void mwifiex_11n_delete_all_tx_ba_stream_tbl(struct mwifiex_private
*priv
)
458 struct mwifiex_tx_ba_stream_tbl
*del_tbl_ptr
, *tmp_node
;
461 spin_lock_irqsave(&priv
->tx_ba_stream_tbl_lock
, flags
);
462 list_for_each_entry_safe(del_tbl_ptr
, tmp_node
,
463 &priv
->tx_ba_stream_tbl_ptr
, list
)
464 mwifiex_11n_delete_tx_ba_stream_tbl_entry(priv
, del_tbl_ptr
);
465 spin_unlock_irqrestore(&priv
->tx_ba_stream_tbl_lock
, flags
);
467 INIT_LIST_HEAD(&priv
->tx_ba_stream_tbl_ptr
);
469 for (i
= 0; i
< MAX_NUM_TID
; ++i
)
470 priv
->aggr_prio_tbl
[i
].ampdu_ap
=
471 priv
->aggr_prio_tbl
[i
].ampdu_user
;
475 * This function returns the pointer to an entry in BA Stream
476 * table which matches the given RA/TID pair.
478 struct mwifiex_tx_ba_stream_tbl
*
479 mwifiex_get_ba_tbl(struct mwifiex_private
*priv
, int tid
, u8
*ra
)
481 struct mwifiex_tx_ba_stream_tbl
*tx_ba_tsr_tbl
;
484 spin_lock_irqsave(&priv
->tx_ba_stream_tbl_lock
, flags
);
485 list_for_each_entry(tx_ba_tsr_tbl
, &priv
->tx_ba_stream_tbl_ptr
, list
) {
486 if (ether_addr_equal_unaligned(tx_ba_tsr_tbl
->ra
, ra
) &&
487 tx_ba_tsr_tbl
->tid
== tid
) {
488 spin_unlock_irqrestore(&priv
->tx_ba_stream_tbl_lock
,
490 return tx_ba_tsr_tbl
;
493 spin_unlock_irqrestore(&priv
->tx_ba_stream_tbl_lock
, flags
);
498 * This function creates an entry in Tx BA stream table for the
501 void mwifiex_create_ba_tbl(struct mwifiex_private
*priv
, u8
*ra
, int tid
,
502 enum mwifiex_ba_status ba_status
)
504 struct mwifiex_tx_ba_stream_tbl
*new_node
;
507 if (!mwifiex_get_ba_tbl(priv
, tid
, ra
)) {
508 new_node
= kzalloc(sizeof(struct mwifiex_tx_ba_stream_tbl
),
513 INIT_LIST_HEAD(&new_node
->list
);
516 new_node
->ba_status
= ba_status
;
517 memcpy(new_node
->ra
, ra
, ETH_ALEN
);
519 spin_lock_irqsave(&priv
->tx_ba_stream_tbl_lock
, flags
);
520 list_add_tail(&new_node
->list
, &priv
->tx_ba_stream_tbl_ptr
);
521 spin_unlock_irqrestore(&priv
->tx_ba_stream_tbl_lock
, flags
);
526 * This function sends an add BA request to the given TID/RA pair.
528 int mwifiex_send_addba(struct mwifiex_private
*priv
, int tid
, u8
*peer_mac
)
530 struct host_cmd_ds_11n_addba_req add_ba_req
;
531 static u8 dialog_tok
;
534 dev_dbg(priv
->adapter
->dev
, "cmd: %s: tid %d\n", __func__
, tid
);
536 add_ba_req
.block_ack_param_set
= cpu_to_le16(
537 (u16
) ((tid
<< BLOCKACKPARAM_TID_POS
) |
539 tx_win_size
<< BLOCKACKPARAM_WINSIZE_POS
) |
540 IMMEDIATE_BLOCK_ACK
));
541 add_ba_req
.block_ack_tmo
= cpu_to_le16((u16
)priv
->add_ba_param
.timeout
);
548 add_ba_req
.dialog_token
= dialog_tok
;
549 memcpy(&add_ba_req
.peer_mac_addr
, peer_mac
, ETH_ALEN
);
551 /* We don't wait for the response of this command */
552 ret
= mwifiex_send_cmd_async(priv
, HostCmd_CMD_11N_ADDBA_REQ
,
559 * This function sends a delete BA request to the given TID/RA pair.
561 int mwifiex_send_delba(struct mwifiex_private
*priv
, int tid
, u8
*peer_mac
,
564 struct host_cmd_ds_11n_delba delba
;
566 uint16_t del_ba_param_set
;
568 memset(&delba
, 0, sizeof(delba
));
569 delba
.del_ba_param_set
= cpu_to_le16(tid
<< DELBA_TID_POS
);
571 del_ba_param_set
= le16_to_cpu(delba
.del_ba_param_set
);
573 del_ba_param_set
|= IEEE80211_DELBA_PARAM_INITIATOR_MASK
;
575 del_ba_param_set
&= ~IEEE80211_DELBA_PARAM_INITIATOR_MASK
;
577 memcpy(&delba
.peer_mac_addr
, peer_mac
, ETH_ALEN
);
579 /* We don't wait for the response of this command */
580 ret
= mwifiex_send_cmd_async(priv
, HostCmd_CMD_11N_DELBA
,
581 HostCmd_ACT_GEN_SET
, 0, &delba
);
587 * This function handles the command response of a delete BA request.
589 void mwifiex_11n_delete_ba_stream(struct mwifiex_private
*priv
, u8
*del_ba
)
591 struct host_cmd_ds_11n_delba
*cmd_del_ba
=
592 (struct host_cmd_ds_11n_delba
*) del_ba
;
593 uint16_t del_ba_param_set
= le16_to_cpu(cmd_del_ba
->del_ba_param_set
);
596 tid
= del_ba_param_set
>> DELBA_TID_POS
;
598 mwifiex_del_ba_tbl(priv
, tid
, cmd_del_ba
->peer_mac_addr
,
599 TYPE_DELBA_RECEIVE
, INITIATOR_BIT(del_ba_param_set
));
603 * This function retrieves the Rx reordering table.
605 int mwifiex_get_rx_reorder_tbl(struct mwifiex_private
*priv
,
606 struct mwifiex_ds_rx_reorder_tbl
*buf
)
609 struct mwifiex_ds_rx_reorder_tbl
*rx_reo_tbl
= buf
;
610 struct mwifiex_rx_reorder_tbl
*rx_reorder_tbl_ptr
;
614 spin_lock_irqsave(&priv
->rx_reorder_tbl_lock
, flags
);
615 list_for_each_entry(rx_reorder_tbl_ptr
, &priv
->rx_reorder_tbl_ptr
,
617 rx_reo_tbl
->tid
= (u16
) rx_reorder_tbl_ptr
->tid
;
618 memcpy(rx_reo_tbl
->ta
, rx_reorder_tbl_ptr
->ta
, ETH_ALEN
);
619 rx_reo_tbl
->start_win
= rx_reorder_tbl_ptr
->start_win
;
620 rx_reo_tbl
->win_size
= rx_reorder_tbl_ptr
->win_size
;
621 for (i
= 0; i
< rx_reorder_tbl_ptr
->win_size
; ++i
) {
622 if (rx_reorder_tbl_ptr
->rx_reorder_ptr
[i
])
623 rx_reo_tbl
->buffer
[i
] = true;
625 rx_reo_tbl
->buffer
[i
] = false;
630 if (count
>= MWIFIEX_MAX_RX_BASTREAM_SUPPORTED
)
633 spin_unlock_irqrestore(&priv
->rx_reorder_tbl_lock
, flags
);
639 * This function retrieves the Tx BA stream table.
641 int mwifiex_get_tx_ba_stream_tbl(struct mwifiex_private
*priv
,
642 struct mwifiex_ds_tx_ba_stream_tbl
*buf
)
644 struct mwifiex_tx_ba_stream_tbl
*tx_ba_tsr_tbl
;
645 struct mwifiex_ds_tx_ba_stream_tbl
*rx_reo_tbl
= buf
;
649 spin_lock_irqsave(&priv
->tx_ba_stream_tbl_lock
, flags
);
650 list_for_each_entry(tx_ba_tsr_tbl
, &priv
->tx_ba_stream_tbl_ptr
, list
) {
651 rx_reo_tbl
->tid
= (u16
) tx_ba_tsr_tbl
->tid
;
652 dev_dbg(priv
->adapter
->dev
, "data: %s tid=%d\n",
653 __func__
, rx_reo_tbl
->tid
);
654 memcpy(rx_reo_tbl
->ra
, tx_ba_tsr_tbl
->ra
, ETH_ALEN
);
657 if (count
>= MWIFIEX_MAX_TX_BASTREAM_SUPPORTED
)
660 spin_unlock_irqrestore(&priv
->tx_ba_stream_tbl_lock
, flags
);
666 * This function retrieves the entry for specific tx BA stream table by RA and
669 void mwifiex_del_tx_ba_stream_tbl_by_ra(struct mwifiex_private
*priv
, u8
*ra
)
671 struct mwifiex_tx_ba_stream_tbl
*tbl
, *tmp
;
677 spin_lock_irqsave(&priv
->tx_ba_stream_tbl_lock
, flags
);
678 list_for_each_entry_safe(tbl
, tmp
, &priv
->tx_ba_stream_tbl_ptr
, list
) {
679 if (!memcmp(tbl
->ra
, ra
, ETH_ALEN
)) {
680 spin_unlock_irqrestore(&priv
->tx_ba_stream_tbl_lock
,
682 mwifiex_11n_delete_tx_ba_stream_tbl_entry(priv
, tbl
);
683 spin_lock_irqsave(&priv
->tx_ba_stream_tbl_lock
, flags
);
686 spin_unlock_irqrestore(&priv
->tx_ba_stream_tbl_lock
, flags
);
691 /* This function initializes the BlockACK setup information for given
692 * mwifiex_private structure.
694 void mwifiex_set_ba_params(struct mwifiex_private
*priv
)
696 priv
->add_ba_param
.timeout
= MWIFIEX_DEFAULT_BLOCK_ACK_TIMEOUT
;
698 if (GET_BSS_ROLE(priv
) == MWIFIEX_BSS_ROLE_UAP
) {
699 priv
->add_ba_param
.tx_win_size
=
700 MWIFIEX_UAP_AMPDU_DEF_TXWINSIZE
;
701 priv
->add_ba_param
.rx_win_size
=
702 MWIFIEX_UAP_AMPDU_DEF_RXWINSIZE
;
704 priv
->add_ba_param
.tx_win_size
=
705 MWIFIEX_STA_AMPDU_DEF_TXWINSIZE
;
706 priv
->add_ba_param
.rx_win_size
=
707 MWIFIEX_STA_AMPDU_DEF_RXWINSIZE
;