2011-03-22 09:00:50 +08:00
|
|
|
/*
|
2020-02-13 00:17:10 +08:00
|
|
|
* NXP Wireless LAN device driver: 802.11n RX Re-ordering
|
2011-03-22 09:00:50 +08:00
|
|
|
*
|
2020-02-13 00:17:10 +08:00
|
|
|
* Copyright 2011-2020 NXP
|
2011-03-22 09:00:50 +08:00
|
|
|
*
|
2020-02-13 00:17:10 +08:00
|
|
|
* This software file (the "File") is distributed by NXP
|
|
|
|
* under the terms of the GNU General Public License Version 2, June 1991
|
2011-03-22 09:00:50 +08:00
|
|
|
* (the "License"). You may use, redistribute and/or modify this File in
|
|
|
|
* accordance with the terms and conditions of the License, a copy of which
|
|
|
|
* is available by writing to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
|
|
|
|
* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
|
|
|
*
|
|
|
|
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE EXPRESSLY DISCLAIMED. The License provides additional details about
|
|
|
|
* this warranty disclaimer.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "decl.h"
|
|
|
|
#include "ioctl.h"
|
|
|
|
#include "util.h"
|
|
|
|
#include "fw.h"
|
|
|
|
#include "main.h"
|
|
|
|
#include "wmm.h"
|
|
|
|
#include "11n.h"
|
|
|
|
#include "11n_rxreorder.h"
|
|
|
|
|
2014-03-08 11:41:31 +08:00
|
|
|
/* This function will dispatch amsdu packet and forward it to kernel/upper
|
|
|
|
* layer.
|
|
|
|
*/
|
|
|
|
static int mwifiex_11n_dispatch_amsdu_pkt(struct mwifiex_private *priv,
|
|
|
|
struct sk_buff *skb)
|
|
|
|
{
|
|
|
|
struct rxpd *local_rx_pd = (struct rxpd *)(skb->data);
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (le16_to_cpu(local_rx_pd->rx_pkt_type) == PKT_TYPE_AMSDU) {
|
|
|
|
struct sk_buff_head list;
|
|
|
|
struct sk_buff *rx_skb;
|
|
|
|
|
|
|
|
__skb_queue_head_init(&list);
|
|
|
|
|
|
|
|
skb_pull(skb, le16_to_cpu(local_rx_pd->rx_pkt_offset));
|
|
|
|
skb_trim(skb, le16_to_cpu(local_rx_pd->rx_pkt_length));
|
|
|
|
|
|
|
|
ieee80211_amsdu_to_8023s(skb, &list, priv->curr_addr,
|
2016-10-05 22:17:01 +08:00
|
|
|
priv->wdev.iftype, 0, NULL, NULL);
|
2014-03-08 11:41:31 +08:00
|
|
|
|
|
|
|
while (!skb_queue_empty(&list)) {
|
2015-12-14 20:15:11 +08:00
|
|
|
struct rx_packet_hdr *rx_hdr;
|
|
|
|
|
2014-03-08 11:41:31 +08:00
|
|
|
rx_skb = __skb_dequeue(&list);
|
2015-12-14 20:15:11 +08:00
|
|
|
rx_hdr = (struct rx_packet_hdr *)rx_skb->data;
|
|
|
|
if (ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info) &&
|
|
|
|
ntohs(rx_hdr->eth803_hdr.h_proto) == ETH_P_TDLS) {
|
|
|
|
mwifiex_process_tdls_action_frame(priv,
|
|
|
|
(u8 *)rx_hdr,
|
|
|
|
skb->len);
|
|
|
|
}
|
|
|
|
|
2016-04-05 16:04:39 +08:00
|
|
|
if (priv->bss_role == MWIFIEX_BSS_ROLE_UAP)
|
|
|
|
ret = mwifiex_uap_recv_packet(priv, rx_skb);
|
|
|
|
else
|
|
|
|
ret = mwifiex_recv_packet(priv, rx_skb);
|
2014-03-08 11:41:31 +08:00
|
|
|
if (ret == -1)
|
2015-05-12 03:18:20 +08:00
|
|
|
mwifiex_dbg(priv->adapter, ERROR,
|
|
|
|
"Rx of A-MSDU failed");
|
2014-03-08 11:41:31 +08:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2014-03-08 11:41:30 +08:00
|
|
|
/* This function will process the rx packet and forward it to kernel/upper
|
|
|
|
* layer.
|
|
|
|
*/
|
2019-06-26 01:40:44 +08:00
|
|
|
static int mwifiex_11n_dispatch_pkt(struct mwifiex_private *priv,
|
|
|
|
struct sk_buff *payload)
|
2014-03-08 11:41:30 +08:00
|
|
|
{
|
2014-03-08 11:41:31 +08:00
|
|
|
|
2016-07-25 23:51:08 +08:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (!payload) {
|
|
|
|
mwifiex_dbg(priv->adapter, INFO, "info: fw drop data\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = mwifiex_11n_dispatch_amsdu_pkt(priv, payload);
|
2014-03-08 11:41:31 +08:00
|
|
|
if (!ret)
|
|
|
|
return 0;
|
|
|
|
|
2014-03-08 11:41:30 +08:00
|
|
|
if (priv->bss_role == MWIFIEX_BSS_ROLE_UAP)
|
|
|
|
return mwifiex_handle_uap_rx_forward(priv, payload);
|
|
|
|
|
|
|
|
return mwifiex_process_rx_packet(priv, payload);
|
|
|
|
}
|
|
|
|
|
2011-03-22 09:00:50 +08:00
|
|
|
/*
|
2012-03-13 10:35:13 +08:00
|
|
|
* This function dispatches all packets in the Rx reorder table until the
|
|
|
|
* start window.
|
2011-03-22 09:00:50 +08:00
|
|
|
*
|
|
|
|
* There could be holes in the buffer, which are skipped by the function.
|
|
|
|
* Since the buffer is linear, the function uses rotation to simulate
|
|
|
|
* circular buffer.
|
|
|
|
*/
|
2011-11-08 13:41:08 +08:00
|
|
|
static void
|
2014-03-08 11:41:30 +08:00
|
|
|
mwifiex_11n_dispatch_pkt_until_start_win(struct mwifiex_private *priv,
|
|
|
|
struct mwifiex_rx_reorder_tbl *tbl,
|
|
|
|
int start_win)
|
2011-03-22 09:00:50 +08:00
|
|
|
{
|
2019-06-26 01:40:44 +08:00
|
|
|
struct sk_buff_head list;
|
|
|
|
struct sk_buff *skb;
|
2012-03-13 10:35:13 +08:00
|
|
|
int pkt_to_send, i;
|
2011-03-22 09:00:50 +08:00
|
|
|
|
2019-06-26 01:40:44 +08:00
|
|
|
__skb_queue_head_init(&list);
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_lock_bh(&priv->rx_reorder_tbl_lock);
|
2019-06-26 01:40:44 +08:00
|
|
|
|
2012-03-13 10:35:13 +08:00
|
|
|
pkt_to_send = (start_win > tbl->start_win) ?
|
|
|
|
min((start_win - tbl->start_win), tbl->win_size) :
|
|
|
|
tbl->win_size;
|
2011-03-22 09:00:50 +08:00
|
|
|
|
2012-03-13 10:35:13 +08:00
|
|
|
for (i = 0; i < pkt_to_send; ++i) {
|
|
|
|
if (tbl->rx_reorder_ptr[i]) {
|
2019-06-26 01:40:44 +08:00
|
|
|
skb = tbl->rx_reorder_ptr[i];
|
|
|
|
__skb_queue_tail(&list, skb);
|
2012-03-13 10:35:13 +08:00
|
|
|
tbl->rx_reorder_ptr[i] = NULL;
|
2011-03-22 09:00:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We don't have a circular buffer, hence use rotation to simulate
|
|
|
|
* circular buffer
|
|
|
|
*/
|
2012-03-13 10:35:13 +08:00
|
|
|
for (i = 0; i < tbl->win_size - pkt_to_send; ++i) {
|
|
|
|
tbl->rx_reorder_ptr[i] = tbl->rx_reorder_ptr[pkt_to_send + i];
|
|
|
|
tbl->rx_reorder_ptr[pkt_to_send + i] = NULL;
|
2011-03-22 09:00:50 +08:00
|
|
|
}
|
|
|
|
|
2012-03-13 10:35:13 +08:00
|
|
|
tbl->start_win = start_win;
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_unlock_bh(&priv->rx_reorder_tbl_lock);
|
2019-06-26 01:40:44 +08:00
|
|
|
|
|
|
|
while ((skb = __skb_dequeue(&list)))
|
|
|
|
mwifiex_11n_dispatch_pkt(priv, skb);
|
2011-03-22 09:00:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function dispatches all packets in the Rx reorder table until
|
|
|
|
* a hole is found.
|
|
|
|
*
|
|
|
|
* The start window is adjusted automatically when a hole is located.
|
|
|
|
* Since the buffer is linear, the function uses rotation to simulate
|
|
|
|
* circular buffer.
|
|
|
|
*/
|
2011-11-08 13:41:08 +08:00
|
|
|
static void
|
2011-03-22 09:00:50 +08:00
|
|
|
mwifiex_11n_scan_and_dispatch(struct mwifiex_private *priv,
|
2012-03-13 10:35:13 +08:00
|
|
|
struct mwifiex_rx_reorder_tbl *tbl)
|
2011-03-22 09:00:50 +08:00
|
|
|
{
|
2019-06-26 01:40:44 +08:00
|
|
|
struct sk_buff_head list;
|
|
|
|
struct sk_buff *skb;
|
2011-03-22 09:00:50 +08:00
|
|
|
int i, j, xchg;
|
|
|
|
|
2019-06-26 01:40:44 +08:00
|
|
|
__skb_queue_head_init(&list);
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_lock_bh(&priv->rx_reorder_tbl_lock);
|
2019-06-26 01:40:44 +08:00
|
|
|
|
2012-03-13 10:35:13 +08:00
|
|
|
for (i = 0; i < tbl->win_size; ++i) {
|
2019-06-26 01:40:44 +08:00
|
|
|
if (!tbl->rx_reorder_ptr[i])
|
2011-03-22 09:00:50 +08:00
|
|
|
break;
|
2019-06-26 01:40:44 +08:00
|
|
|
skb = tbl->rx_reorder_ptr[i];
|
|
|
|
__skb_queue_tail(&list, skb);
|
2012-03-13 10:35:13 +08:00
|
|
|
tbl->rx_reorder_ptr[i] = NULL;
|
2011-03-22 09:00:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We don't have a circular buffer, hence use rotation to simulate
|
|
|
|
* circular buffer
|
|
|
|
*/
|
|
|
|
if (i > 0) {
|
2012-03-13 10:35:13 +08:00
|
|
|
xchg = tbl->win_size - i;
|
2011-03-22 09:00:50 +08:00
|
|
|
for (j = 0; j < xchg; ++j) {
|
2012-03-13 10:35:13 +08:00
|
|
|
tbl->rx_reorder_ptr[j] = tbl->rx_reorder_ptr[i + j];
|
|
|
|
tbl->rx_reorder_ptr[i + j] = NULL;
|
2011-03-22 09:00:50 +08:00
|
|
|
}
|
|
|
|
}
|
2012-03-13 10:35:13 +08:00
|
|
|
tbl->start_win = (tbl->start_win + i) & (MAX_TID_VALUE - 1);
|
2019-06-26 01:40:44 +08:00
|
|
|
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_unlock_bh(&priv->rx_reorder_tbl_lock);
|
2019-06-26 01:40:44 +08:00
|
|
|
|
|
|
|
while ((skb = __skb_dequeue(&list)))
|
|
|
|
mwifiex_11n_dispatch_pkt(priv, skb);
|
2011-03-22 09:00:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function deletes the Rx reorder table and frees the memory.
|
|
|
|
*
|
|
|
|
* The function stops the associated timer and dispatches all the
|
|
|
|
* pending packets in the Rx reorder table before deletion.
|
|
|
|
*/
|
|
|
|
static void
|
2012-03-13 10:35:13 +08:00
|
|
|
mwifiex_del_rx_reorder_entry(struct mwifiex_private *priv,
|
|
|
|
struct mwifiex_rx_reorder_tbl *tbl)
|
2011-03-22 09:00:50 +08:00
|
|
|
{
|
2014-03-08 11:41:29 +08:00
|
|
|
int start_win;
|
2011-03-22 09:00:50 +08:00
|
|
|
|
2012-03-13 10:35:13 +08:00
|
|
|
if (!tbl)
|
2011-03-22 09:00:50 +08:00
|
|
|
return;
|
|
|
|
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_lock_bh(&priv->adapter->rx_proc_lock);
|
2014-09-12 22:38:59 +08:00
|
|
|
priv->adapter->rx_locked = true;
|
|
|
|
if (priv->adapter->rx_processing) {
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_unlock_bh(&priv->adapter->rx_proc_lock);
|
2014-09-12 22:38:59 +08:00
|
|
|
flush_workqueue(priv->adapter->rx_workqueue);
|
|
|
|
} else {
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_unlock_bh(&priv->adapter->rx_proc_lock);
|
2014-09-12 22:38:59 +08:00
|
|
|
}
|
|
|
|
|
2014-03-08 11:41:29 +08:00
|
|
|
start_win = (tbl->start_win + tbl->win_size) & (MAX_TID_VALUE - 1);
|
2014-03-08 11:41:30 +08:00
|
|
|
mwifiex_11n_dispatch_pkt_until_start_win(priv, tbl, start_win);
|
2011-03-22 09:00:50 +08:00
|
|
|
|
2014-02-19 07:47:55 +08:00
|
|
|
del_timer_sync(&tbl->timer_context.timer);
|
2014-10-30 01:14:34 +08:00
|
|
|
tbl->timer_context.timer_is_set = false;
|
2018-12-01 01:59:57 +08:00
|
|
|
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_lock_bh(&priv->rx_reorder_tbl_lock);
|
2012-03-13 10:35:13 +08:00
|
|
|
list_del(&tbl->list);
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_unlock_bh(&priv->rx_reorder_tbl_lock);
|
2018-12-01 01:59:57 +08:00
|
|
|
|
2012-03-13 10:35:13 +08:00
|
|
|
kfree(tbl->rx_reorder_ptr);
|
|
|
|
kfree(tbl);
|
2014-09-12 22:38:59 +08:00
|
|
|
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_lock_bh(&priv->adapter->rx_proc_lock);
|
2014-09-12 22:38:59 +08:00
|
|
|
priv->adapter->rx_locked = false;
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_unlock_bh(&priv->adapter->rx_proc_lock);
|
2014-09-12 22:38:59 +08:00
|
|
|
|
2011-03-22 09:00:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function returns the pointer to an entry in Rx reordering
|
|
|
|
* table which matches the given TA/TID pair.
|
|
|
|
*/
|
2012-08-04 09:06:09 +08:00
|
|
|
struct mwifiex_rx_reorder_tbl *
|
2011-03-22 09:00:50 +08:00
|
|
|
mwifiex_11n_get_rx_reorder_tbl(struct mwifiex_private *priv, int tid, u8 *ta)
|
|
|
|
{
|
2012-03-13 10:35:13 +08:00
|
|
|
struct mwifiex_rx_reorder_tbl *tbl;
|
2011-03-22 09:00:50 +08:00
|
|
|
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_lock_bh(&priv->rx_reorder_tbl_lock);
|
2018-12-01 01:59:57 +08:00
|
|
|
list_for_each_entry(tbl, &priv->rx_reorder_tbl_ptr, list) {
|
|
|
|
if (!memcmp(tbl->ta, ta, ETH_ALEN) && tbl->tid == tid) {
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_unlock_bh(&priv->rx_reorder_tbl_lock);
|
2012-03-13 10:35:13 +08:00
|
|
|
return tbl;
|
2018-12-01 01:59:57 +08:00
|
|
|
}
|
|
|
|
}
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_unlock_bh(&priv->rx_reorder_tbl_lock);
|
2011-03-22 09:00:50 +08:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-08-04 09:06:11 +08:00
|
|
|
/* This function retrieves the pointer to an entry in Rx reordering
|
|
|
|
* table which matches the given TA and deletes it.
|
|
|
|
*/
|
|
|
|
void mwifiex_11n_del_rx_reorder_tbl_by_ta(struct mwifiex_private *priv, u8 *ta)
|
|
|
|
{
|
|
|
|
struct mwifiex_rx_reorder_tbl *tbl, *tmp;
|
|
|
|
|
|
|
|
if (!ta)
|
|
|
|
return;
|
|
|
|
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_lock_bh(&priv->rx_reorder_tbl_lock);
|
2018-12-01 01:59:57 +08:00
|
|
|
list_for_each_entry_safe(tbl, tmp, &priv->rx_reorder_tbl_ptr, list) {
|
|
|
|
if (!memcmp(tbl->ta, ta, ETH_ALEN)) {
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_unlock_bh(&priv->rx_reorder_tbl_lock);
|
2012-08-04 09:06:11 +08:00
|
|
|
mwifiex_del_rx_reorder_entry(priv, tbl);
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_lock_bh(&priv->rx_reorder_tbl_lock);
|
2018-12-01 01:59:57 +08:00
|
|
|
}
|
|
|
|
}
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_unlock_bh(&priv->rx_reorder_tbl_lock);
|
2012-08-04 09:06:11 +08:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-03-22 09:00:50 +08:00
|
|
|
/*
|
|
|
|
* This function finds the last sequence number used in the packets
|
|
|
|
* buffered in Rx reordering table.
|
|
|
|
*/
|
|
|
|
static int
|
2014-07-12 11:53:13 +08:00
|
|
|
mwifiex_11n_find_last_seq_num(struct reorder_tmr_cnxt *ctx)
|
2011-03-22 09:00:50 +08:00
|
|
|
{
|
2014-07-12 11:53:13 +08:00
|
|
|
struct mwifiex_rx_reorder_tbl *rx_reorder_tbl_ptr = ctx->ptr;
|
2018-12-01 01:59:57 +08:00
|
|
|
struct mwifiex_private *priv = ctx->priv;
|
2011-03-22 09:00:50 +08:00
|
|
|
int i;
|
|
|
|
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_lock_bh(&priv->rx_reorder_tbl_lock);
|
2018-12-01 01:59:57 +08:00
|
|
|
for (i = rx_reorder_tbl_ptr->win_size - 1; i >= 0; --i) {
|
|
|
|
if (rx_reorder_tbl_ptr->rx_reorder_ptr[i]) {
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_unlock_bh(&priv->rx_reorder_tbl_lock);
|
2011-03-22 09:00:50 +08:00
|
|
|
return i;
|
2018-12-01 01:59:57 +08:00
|
|
|
}
|
|
|
|
}
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_unlock_bh(&priv->rx_reorder_tbl_lock);
|
2011-03-22 09:00:50 +08:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function flushes all the packets in Rx reordering table.
|
|
|
|
*
|
|
|
|
* The function checks if any packets are currently buffered in the
|
|
|
|
* table or not. In case there are packets available, it dispatches
|
|
|
|
* them and then dumps the Rx reordering table.
|
|
|
|
*/
|
|
|
|
static void
|
2017-10-24 17:29:19 +08:00
|
|
|
mwifiex_flush_data(struct timer_list *t)
|
2011-03-22 09:00:50 +08:00
|
|
|
{
|
2012-03-13 10:35:13 +08:00
|
|
|
struct reorder_tmr_cnxt *ctx =
|
2017-10-24 17:29:19 +08:00
|
|
|
from_timer(ctx, t, timer);
|
2014-03-08 11:41:29 +08:00
|
|
|
int start_win, seq_num;
|
2011-03-22 09:00:50 +08:00
|
|
|
|
2014-10-30 01:14:34 +08:00
|
|
|
ctx->timer_is_set = false;
|
2014-07-12 11:53:13 +08:00
|
|
|
seq_num = mwifiex_11n_find_last_seq_num(ctx);
|
2012-03-13 10:35:12 +08:00
|
|
|
|
2018-12-01 01:59:57 +08:00
|
|
|
if (seq_num < 0)
|
2012-03-13 10:35:12 +08:00
|
|
|
return;
|
|
|
|
|
2015-05-12 03:18:20 +08:00
|
|
|
mwifiex_dbg(ctx->priv->adapter, INFO, "info: flush data %d\n", seq_num);
|
2014-03-08 11:41:29 +08:00
|
|
|
start_win = (ctx->ptr->start_win + seq_num + 1) & (MAX_TID_VALUE - 1);
|
2014-03-08 11:41:30 +08:00
|
|
|
mwifiex_11n_dispatch_pkt_until_start_win(ctx->priv, ctx->ptr,
|
|
|
|
start_win);
|
2011-03-22 09:00:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function creates an entry in Rx reordering table for the
|
|
|
|
* given TA/TID.
|
|
|
|
*
|
|
|
|
* The function also initializes the entry with sequence number, window
|
|
|
|
* size as well as initializes the timer.
|
|
|
|
*
|
|
|
|
* If the received TA/TID pair is already present, all the packets are
|
|
|
|
* dispatched and the window size is moved until the SSN.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta,
|
2012-03-14 10:22:34 +08:00
|
|
|
int tid, int win_size, int seq_num)
|
2011-03-22 09:00:50 +08:00
|
|
|
{
|
|
|
|
int i;
|
2012-03-13 10:35:13 +08:00
|
|
|
struct mwifiex_rx_reorder_tbl *tbl, *new_node;
|
2011-03-22 09:00:50 +08:00
|
|
|
u16 last_seq = 0;
|
2012-08-04 09:06:10 +08:00
|
|
|
struct mwifiex_sta_node *node;
|
2011-03-22 09:00:50 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If we get a TID, ta pair which is already present dispatch all the
|
|
|
|
* the packets and move the window size until the ssn
|
|
|
|
*/
|
2012-03-13 10:35:13 +08:00
|
|
|
tbl = mwifiex_11n_get_rx_reorder_tbl(priv, tid, ta);
|
|
|
|
if (tbl) {
|
2014-03-08 11:41:30 +08:00
|
|
|
mwifiex_11n_dispatch_pkt_until_start_win(priv, tbl, seq_num);
|
2011-03-22 09:00:50 +08:00
|
|
|
return;
|
|
|
|
}
|
2012-03-13 10:35:13 +08:00
|
|
|
/* if !tbl then create one */
|
2011-03-22 09:00:50 +08:00
|
|
|
new_node = kzalloc(sizeof(struct mwifiex_rx_reorder_tbl), GFP_KERNEL);
|
2013-02-04 01:28:14 +08:00
|
|
|
if (!new_node)
|
2011-03-22 09:00:50 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
INIT_LIST_HEAD(&new_node->list);
|
|
|
|
new_node->tid = tid;
|
|
|
|
memcpy(new_node->ta, ta, ETH_ALEN);
|
|
|
|
new_node->start_win = seq_num;
|
2014-02-26 08:31:37 +08:00
|
|
|
new_node->init_win = seq_num;
|
|
|
|
new_node->flags = 0;
|
2012-08-04 09:06:10 +08:00
|
|
|
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_lock_bh(&priv->sta_list_spinlock);
|
2012-08-04 09:06:10 +08:00
|
|
|
if (mwifiex_queuing_ra_based(priv)) {
|
|
|
|
if (priv->bss_role == MWIFIEX_BSS_ROLE_UAP) {
|
|
|
|
node = mwifiex_get_sta_entry(priv, ta);
|
|
|
|
if (node)
|
|
|
|
last_seq = node->rx_seq[tid];
|
|
|
|
}
|
|
|
|
} else {
|
2014-02-08 08:30:37 +08:00
|
|
|
node = mwifiex_get_sta_entry(priv, ta);
|
|
|
|
if (node)
|
|
|
|
last_seq = node->rx_seq[tid];
|
|
|
|
else
|
|
|
|
last_seq = priv->rx_seq[tid];
|
2012-08-04 09:06:10 +08:00
|
|
|
}
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_unlock_bh(&priv->sta_list_spinlock);
|
2011-03-22 09:00:50 +08:00
|
|
|
|
2015-05-12 03:18:20 +08:00
|
|
|
mwifiex_dbg(priv->adapter, INFO,
|
|
|
|
"info: last_seq=%d start_win=%d\n",
|
|
|
|
last_seq, new_node->start_win);
|
2015-01-07 20:40:25 +08:00
|
|
|
|
2012-06-21 11:21:10 +08:00
|
|
|
if (last_seq != MWIFIEX_DEF_11N_RX_SEQ_NUM &&
|
2014-02-26 08:31:37 +08:00
|
|
|
last_seq >= new_node->start_win) {
|
2011-03-22 09:00:50 +08:00
|
|
|
new_node->start_win = last_seq + 1;
|
2014-02-26 08:31:37 +08:00
|
|
|
new_node->flags |= RXREOR_INIT_WINDOW_SHIFT;
|
|
|
|
}
|
2011-03-22 09:00:50 +08:00
|
|
|
|
|
|
|
new_node->win_size = win_size;
|
|
|
|
|
treewide: kzalloc() -> kcalloc()
The kzalloc() function has a 2-factor argument form, kcalloc(). This
patch replaces cases of:
kzalloc(a * b, gfp)
with:
kcalloc(a * b, gfp)
as well as handling cases of:
kzalloc(a * b * c, gfp)
with:
kzalloc(array3_size(a, b, c), gfp)
as it's slightly less ugly than:
kzalloc_array(array_size(a, b), c, gfp)
This does, however, attempt to ignore constant size factors like:
kzalloc(4 * 1024, gfp)
though any constants defined via macros get caught up in the conversion.
Any factors with a sizeof() of "unsigned char", "char", and "u8" were
dropped, since they're redundant.
The Coccinelle script used for this was:
// Fix redundant parens around sizeof().
@@
type TYPE;
expression THING, E;
@@
(
kzalloc(
- (sizeof(TYPE)) * E
+ sizeof(TYPE) * E
, ...)
|
kzalloc(
- (sizeof(THING)) * E
+ sizeof(THING) * E
, ...)
)
// Drop single-byte sizes and redundant parens.
@@
expression COUNT;
typedef u8;
typedef __u8;
@@
(
kzalloc(
- sizeof(u8) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(__u8) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(char) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(unsigned char) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(u8) * COUNT
+ COUNT
, ...)
|
kzalloc(
- sizeof(__u8) * COUNT
+ COUNT
, ...)
|
kzalloc(
- sizeof(char) * COUNT
+ COUNT
, ...)
|
kzalloc(
- sizeof(unsigned char) * COUNT
+ COUNT
, ...)
)
// 2-factor product with sizeof(type/expression) and identifier or constant.
@@
type TYPE;
expression THING;
identifier COUNT_ID;
constant COUNT_CONST;
@@
(
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * (COUNT_ID)
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * COUNT_ID
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * (COUNT_CONST)
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * COUNT_CONST
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * (COUNT_ID)
+ COUNT_ID, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * COUNT_ID
+ COUNT_ID, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * (COUNT_CONST)
+ COUNT_CONST, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * COUNT_CONST
+ COUNT_CONST, sizeof(THING)
, ...)
)
// 2-factor product, only identifiers.
@@
identifier SIZE, COUNT;
@@
- kzalloc
+ kcalloc
(
- SIZE * COUNT
+ COUNT, SIZE
, ...)
// 3-factor product with 1 sizeof(type) or sizeof(expression), with
// redundant parens removed.
@@
expression THING;
identifier STRIDE, COUNT;
type TYPE;
@@
(
kzalloc(
- sizeof(TYPE) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(TYPE) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(TYPE) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(TYPE) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(THING) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kzalloc(
- sizeof(THING) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kzalloc(
- sizeof(THING) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kzalloc(
- sizeof(THING) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
)
// 3-factor product with 2 sizeof(variable), with redundant parens removed.
@@
expression THING1, THING2;
identifier COUNT;
type TYPE1, TYPE2;
@@
(
kzalloc(
- sizeof(TYPE1) * sizeof(TYPE2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
kzalloc(
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
kzalloc(
- sizeof(THING1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
kzalloc(
- sizeof(THING1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
kzalloc(
- sizeof(TYPE1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
|
kzalloc(
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
)
// 3-factor product, only identifiers, with redundant parens removed.
@@
identifier STRIDE, SIZE, COUNT;
@@
(
kzalloc(
- (COUNT) * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- (COUNT) * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- (COUNT) * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- (COUNT) * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
)
// Any remaining multi-factor products, first at least 3-factor products,
// when they're not all constants...
@@
expression E1, E2, E3;
constant C1, C2, C3;
@@
(
kzalloc(C1 * C2 * C3, ...)
|
kzalloc(
- (E1) * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
|
kzalloc(
- (E1) * (E2) * E3
+ array3_size(E1, E2, E3)
, ...)
|
kzalloc(
- (E1) * (E2) * (E3)
+ array3_size(E1, E2, E3)
, ...)
|
kzalloc(
- E1 * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
)
// And then all remaining 2 factors products when they're not all constants,
// keeping sizeof() as the second factor argument.
@@
expression THING, E1, E2;
type TYPE;
constant C1, C2, C3;
@@
(
kzalloc(sizeof(THING) * C2, ...)
|
kzalloc(sizeof(TYPE) * C2, ...)
|
kzalloc(C1 * C2 * C3, ...)
|
kzalloc(C1 * C2, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * (E2)
+ E2, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * E2
+ E2, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * (E2)
+ E2, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * E2
+ E2, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- (E1) * E2
+ E1, E2
, ...)
|
- kzalloc
+ kcalloc
(
- (E1) * (E2)
+ E1, E2
, ...)
|
- kzalloc
+ kcalloc
(
- E1 * E2
+ E1, E2
, ...)
)
Signed-off-by: Kees Cook <keescook@chromium.org>
2018-06-13 05:03:40 +08:00
|
|
|
new_node->rx_reorder_ptr = kcalloc(win_size, sizeof(void *),
|
|
|
|
GFP_KERNEL);
|
2011-03-22 09:00:50 +08:00
|
|
|
if (!new_node->rx_reorder_ptr) {
|
|
|
|
kfree((u8 *) new_node);
|
2015-05-12 03:18:20 +08:00
|
|
|
mwifiex_dbg(priv->adapter, ERROR,
|
|
|
|
"%s: failed to alloc reorder_ptr\n", __func__);
|
2011-03-22 09:00:50 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
new_node->timer_context.ptr = new_node;
|
|
|
|
new_node->timer_context.priv = priv;
|
2014-10-30 01:14:34 +08:00
|
|
|
new_node->timer_context.timer_is_set = false;
|
2011-03-22 09:00:50 +08:00
|
|
|
|
2017-10-24 17:29:19 +08:00
|
|
|
timer_setup(&new_node->timer_context.timer, mwifiex_flush_data, 0);
|
2011-03-22 09:00:50 +08:00
|
|
|
|
|
|
|
for (i = 0; i < win_size; ++i)
|
|
|
|
new_node->rx_reorder_ptr[i] = NULL;
|
|
|
|
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_lock_bh(&priv->rx_reorder_tbl_lock);
|
2011-03-22 09:00:50 +08:00
|
|
|
list_add_tail(&new_node->list, &priv->rx_reorder_tbl_ptr);
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_unlock_bh(&priv->rx_reorder_tbl_lock);
|
2011-03-22 09:00:50 +08:00
|
|
|
}
|
|
|
|
|
2014-10-30 01:14:34 +08:00
|
|
|
static void
|
|
|
|
mwifiex_11n_rxreorder_timer_restart(struct mwifiex_rx_reorder_tbl *tbl)
|
|
|
|
{
|
|
|
|
u32 min_flush_time;
|
|
|
|
|
|
|
|
if (tbl->win_size >= MWIFIEX_BA_WIN_SIZE_32)
|
|
|
|
min_flush_time = MIN_FLUSH_TIMER_15_MS;
|
|
|
|
else
|
|
|
|
min_flush_time = MIN_FLUSH_TIMER_MS;
|
|
|
|
|
|
|
|
mod_timer(&tbl->timer_context.timer,
|
|
|
|
jiffies + msecs_to_jiffies(min_flush_time * tbl->win_size));
|
|
|
|
|
|
|
|
tbl->timer_context.timer_is_set = true;
|
|
|
|
}
|
|
|
|
|
2011-03-22 09:00:50 +08:00
|
|
|
/*
|
|
|
|
* This function prepares command for adding a BA request.
|
|
|
|
*
|
|
|
|
* Preparation includes -
|
|
|
|
* - Setting command ID and proper size
|
|
|
|
* - Setting add BA request buffer
|
|
|
|
* - Ensuring correct endian-ness
|
|
|
|
*/
|
2011-04-14 08:27:08 +08:00
|
|
|
int mwifiex_cmd_11n_addba_req(struct host_cmd_ds_command *cmd, void *data_buf)
|
2011-03-22 09:00:50 +08:00
|
|
|
{
|
2012-06-04 20:44:17 +08:00
|
|
|
struct host_cmd_ds_11n_addba_req *add_ba_req = &cmd->params.add_ba_req;
|
2011-03-22 09:00:50 +08:00
|
|
|
|
|
|
|
cmd->command = cpu_to_le16(HostCmd_CMD_11N_ADDBA_REQ);
|
|
|
|
cmd->size = cpu_to_le16(sizeof(*add_ba_req) + S_DS_GEN);
|
|
|
|
memcpy(add_ba_req, data_buf, sizeof(*add_ba_req));
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function prepares command for adding a BA response.
|
|
|
|
*
|
|
|
|
* Preparation includes -
|
|
|
|
* - Setting command ID and proper size
|
|
|
|
* - Setting add BA response buffer
|
|
|
|
* - Ensuring correct endian-ness
|
|
|
|
*/
|
|
|
|
int mwifiex_cmd_11n_addba_rsp_gen(struct mwifiex_private *priv,
|
|
|
|
struct host_cmd_ds_command *cmd,
|
2011-06-21 06:21:48 +08:00
|
|
|
struct host_cmd_ds_11n_addba_req
|
|
|
|
*cmd_addba_req)
|
2011-03-22 09:00:50 +08:00
|
|
|
{
|
2012-06-04 20:44:17 +08:00
|
|
|
struct host_cmd_ds_11n_addba_rsp *add_ba_rsp = &cmd->params.add_ba_rsp;
|
2014-02-08 08:30:40 +08:00
|
|
|
struct mwifiex_sta_node *sta_ptr;
|
|
|
|
u32 rx_win_size = priv->add_ba_param.rx_win_size;
|
2011-05-04 11:11:46 +08:00
|
|
|
u8 tid;
|
|
|
|
int win_size;
|
2011-03-22 09:00:50 +08:00
|
|
|
uint16_t block_ack_param_set;
|
|
|
|
|
2014-02-08 08:30:40 +08:00
|
|
|
if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) &&
|
|
|
|
ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info) &&
|
|
|
|
priv->adapter->is_hw_11ac_capable &&
|
|
|
|
memcmp(priv->cfg_bssid, cmd_addba_req->peer_mac_addr, ETH_ALEN)) {
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_lock_bh(&priv->sta_list_spinlock);
|
2014-02-08 08:30:40 +08:00
|
|
|
sta_ptr = mwifiex_get_sta_entry(priv,
|
|
|
|
cmd_addba_req->peer_mac_addr);
|
|
|
|
if (!sta_ptr) {
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_unlock_bh(&priv->sta_list_spinlock);
|
2015-05-12 03:18:20 +08:00
|
|
|
mwifiex_dbg(priv->adapter, ERROR,
|
|
|
|
"BA setup with unknown TDLS peer %pM!\n",
|
|
|
|
cmd_addba_req->peer_mac_addr);
|
2014-02-08 08:30:40 +08:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if (sta_ptr->is_11ac_enabled)
|
|
|
|
rx_win_size = MWIFIEX_11AC_STA_AMPDU_DEF_RXWINSIZE;
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_unlock_bh(&priv->sta_list_spinlock);
|
2014-02-08 08:30:40 +08:00
|
|
|
}
|
|
|
|
|
2011-03-22 09:00:50 +08:00
|
|
|
cmd->command = cpu_to_le16(HostCmd_CMD_11N_ADDBA_RSP);
|
|
|
|
cmd->size = cpu_to_le16(sizeof(*add_ba_rsp) + S_DS_GEN);
|
|
|
|
|
|
|
|
memcpy(add_ba_rsp->peer_mac_addr, cmd_addba_req->peer_mac_addr,
|
|
|
|
ETH_ALEN);
|
|
|
|
add_ba_rsp->dialog_token = cmd_addba_req->dialog_token;
|
|
|
|
add_ba_rsp->block_ack_tmo = cmd_addba_req->block_ack_tmo;
|
|
|
|
add_ba_rsp->ssn = cmd_addba_req->ssn;
|
|
|
|
|
|
|
|
block_ack_param_set = le16_to_cpu(cmd_addba_req->block_ack_param_set);
|
|
|
|
tid = (block_ack_param_set & IEEE80211_ADDBA_PARAM_TID_MASK)
|
|
|
|
>> BLOCKACKPARAM_TID_POS;
|
|
|
|
add_ba_rsp->status_code = cpu_to_le16(ADDBA_RSP_STATUS_ACCEPT);
|
|
|
|
block_ack_param_set &= ~IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK;
|
2014-03-08 11:41:31 +08:00
|
|
|
|
|
|
|
/* If we don't support AMSDU inside AMPDU, reset the bit */
|
|
|
|
if (!priv->add_ba_param.rx_amsdu ||
|
|
|
|
(priv->aggr_prio_tbl[tid].amsdu == BA_STREAM_NOT_ALLOWED))
|
|
|
|
block_ack_param_set &= ~BLOCKACKPARAM_AMSDU_SUPP_MASK;
|
2014-02-08 08:30:40 +08:00
|
|
|
block_ack_param_set |= rx_win_size << BLOCKACKPARAM_WINSIZE_POS;
|
2011-03-22 09:00:50 +08:00
|
|
|
add_ba_rsp->block_ack_param_set = cpu_to_le16(block_ack_param_set);
|
|
|
|
win_size = (le16_to_cpu(add_ba_rsp->block_ack_param_set)
|
|
|
|
& IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK)
|
|
|
|
>> BLOCKACKPARAM_WINSIZE_POS;
|
|
|
|
cmd_addba_req->block_ack_param_set = cpu_to_le16(block_ack_param_set);
|
|
|
|
|
|
|
|
mwifiex_11n_create_rx_reorder_tbl(priv, cmd_addba_req->peer_mac_addr,
|
2012-03-14 10:22:34 +08:00
|
|
|
tid, win_size,
|
|
|
|
le16_to_cpu(cmd_addba_req->ssn));
|
2011-03-22 09:00:50 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function prepares command for deleting a BA request.
|
|
|
|
*
|
|
|
|
* Preparation includes -
|
|
|
|
* - Setting command ID and proper size
|
|
|
|
* - Setting del BA request buffer
|
|
|
|
* - Ensuring correct endian-ness
|
|
|
|
*/
|
2011-04-14 08:27:08 +08:00
|
|
|
int mwifiex_cmd_11n_delba(struct host_cmd_ds_command *cmd, void *data_buf)
|
2011-03-22 09:00:50 +08:00
|
|
|
{
|
2012-06-04 20:44:17 +08:00
|
|
|
struct host_cmd_ds_11n_delba *del_ba = &cmd->params.del_ba;
|
2011-03-22 09:00:50 +08:00
|
|
|
|
|
|
|
cmd->command = cpu_to_le16(HostCmd_CMD_11N_DELBA);
|
|
|
|
cmd->size = cpu_to_le16(sizeof(*del_ba) + S_DS_GEN);
|
|
|
|
memcpy(del_ba, data_buf, sizeof(*del_ba));
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function identifies if Rx reordering is needed for a received packet.
|
|
|
|
*
|
|
|
|
* In case reordering is required, the function will do the reordering
|
|
|
|
* before sending it to kernel.
|
|
|
|
*
|
|
|
|
* The Rx reorder table is checked first with the received TID/TA pair. If
|
|
|
|
* not found, the received packet is dispatched immediately. But if found,
|
|
|
|
* the packet is reordered and all the packets in the updated Rx reordering
|
|
|
|
* table is dispatched until a hole is found.
|
|
|
|
*
|
|
|
|
* For sequence number less than the starting window, the packet is dropped.
|
|
|
|
*/
|
|
|
|
int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv,
|
|
|
|
u16 seq_num, u16 tid,
|
|
|
|
u8 *ta, u8 pkt_type, void *payload)
|
|
|
|
{
|
2012-03-13 10:35:13 +08:00
|
|
|
struct mwifiex_rx_reorder_tbl *tbl;
|
2014-10-30 01:14:34 +08:00
|
|
|
int prev_start_win, start_win, end_win, win_size;
|
2011-05-04 11:11:46 +08:00
|
|
|
u16 pkt_index;
|
2014-02-26 08:31:37 +08:00
|
|
|
bool init_window_shift = false;
|
2014-10-30 01:14:34 +08:00
|
|
|
int ret = 0;
|
2011-03-22 09:00:50 +08:00
|
|
|
|
2012-06-04 20:44:17 +08:00
|
|
|
tbl = mwifiex_11n_get_rx_reorder_tbl(priv, tid, ta);
|
2012-03-13 10:35:13 +08:00
|
|
|
if (!tbl) {
|
2014-03-08 11:41:30 +08:00
|
|
|
if (pkt_type != PKT_TYPE_BAR)
|
|
|
|
mwifiex_11n_dispatch_pkt(priv, payload);
|
2014-10-30 01:14:34 +08:00
|
|
|
return ret;
|
2011-03-22 09:00:50 +08:00
|
|
|
}
|
2014-03-08 11:41:31 +08:00
|
|
|
|
|
|
|
if ((pkt_type == PKT_TYPE_AMSDU) && !tbl->amsdu) {
|
|
|
|
mwifiex_11n_dispatch_pkt(priv, payload);
|
2014-10-30 01:14:34 +08:00
|
|
|
return ret;
|
2014-03-08 11:41:31 +08:00
|
|
|
}
|
|
|
|
|
2012-03-13 10:35:13 +08:00
|
|
|
start_win = tbl->start_win;
|
2014-10-30 01:14:34 +08:00
|
|
|
prev_start_win = start_win;
|
2012-03-13 10:35:13 +08:00
|
|
|
win_size = tbl->win_size;
|
2011-03-22 09:00:50 +08:00
|
|
|
end_win = ((start_win + win_size) - 1) & (MAX_TID_VALUE - 1);
|
2014-02-26 08:31:37 +08:00
|
|
|
if (tbl->flags & RXREOR_INIT_WINDOW_SHIFT) {
|
|
|
|
init_window_shift = true;
|
|
|
|
tbl->flags &= ~RXREOR_INIT_WINDOW_SHIFT;
|
|
|
|
}
|
2011-03-22 09:00:50 +08:00
|
|
|
|
2012-09-28 10:00:10 +08:00
|
|
|
if (tbl->flags & RXREOR_FORCE_NO_DROP) {
|
2015-05-12 03:18:20 +08:00
|
|
|
mwifiex_dbg(priv->adapter, INFO,
|
|
|
|
"RXREOR_FORCE_NO_DROP when HS is activated\n");
|
2012-09-28 10:00:10 +08:00
|
|
|
tbl->flags &= ~RXREOR_FORCE_NO_DROP;
|
2014-02-26 08:31:37 +08:00
|
|
|
} else if (init_window_shift && seq_num < start_win &&
|
|
|
|
seq_num >= tbl->init_win) {
|
2015-05-12 03:18:20 +08:00
|
|
|
mwifiex_dbg(priv->adapter, INFO,
|
|
|
|
"Sender TID sequence number reset %d->%d for SSN %d\n",
|
|
|
|
start_win, seq_num, tbl->init_win);
|
2014-02-26 08:31:37 +08:00
|
|
|
tbl->start_win = start_win = seq_num;
|
|
|
|
end_win = ((start_win + win_size) - 1) & (MAX_TID_VALUE - 1);
|
2012-09-28 10:00:10 +08:00
|
|
|
} else {
|
2014-02-26 08:31:37 +08:00
|
|
|
/*
|
|
|
|
* If seq_num is less then starting win then ignore and drop
|
|
|
|
* the packet
|
|
|
|
*/
|
2012-09-28 10:00:10 +08:00
|
|
|
if ((start_win + TWOPOW11) > (MAX_TID_VALUE - 1)) {
|
|
|
|
if (seq_num >= ((start_win + TWOPOW11) &
|
|
|
|
(MAX_TID_VALUE - 1)) &&
|
2014-10-30 01:14:34 +08:00
|
|
|
seq_num < start_win) {
|
|
|
|
ret = -1;
|
|
|
|
goto done;
|
|
|
|
}
|
2012-09-28 10:00:10 +08:00
|
|
|
} else if ((seq_num < start_win) ||
|
2014-10-30 01:14:34 +08:00
|
|
|
(seq_num >= (start_win + TWOPOW11))) {
|
|
|
|
ret = -1;
|
|
|
|
goto done;
|
2012-09-28 10:00:10 +08:00
|
|
|
}
|
2011-03-22 09:00:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If this packet is a BAR we adjust seq_num as
|
|
|
|
* WinStart = seq_num
|
|
|
|
*/
|
|
|
|
if (pkt_type == PKT_TYPE_BAR)
|
|
|
|
seq_num = ((seq_num + win_size) - 1) & (MAX_TID_VALUE - 1);
|
|
|
|
|
2012-03-14 10:22:34 +08:00
|
|
|
if (((end_win < start_win) &&
|
2012-09-28 10:00:10 +08:00
|
|
|
(seq_num < start_win) && (seq_num > end_win)) ||
|
2012-03-14 10:22:34 +08:00
|
|
|
((end_win > start_win) && ((seq_num > end_win) ||
|
|
|
|
(seq_num < start_win)))) {
|
2011-03-22 09:00:50 +08:00
|
|
|
end_win = seq_num;
|
2015-09-21 21:33:53 +08:00
|
|
|
if (((end_win - win_size) + 1) >= 0)
|
2011-03-22 09:00:50 +08:00
|
|
|
start_win = (end_win - win_size) + 1;
|
|
|
|
else
|
2015-09-21 21:33:53 +08:00
|
|
|
start_win = (MAX_TID_VALUE - (win_size - end_win)) + 1;
|
2014-03-08 11:41:30 +08:00
|
|
|
mwifiex_11n_dispatch_pkt_until_start_win(priv, tbl, start_win);
|
2011-03-22 09:00:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pkt_type != PKT_TYPE_BAR) {
|
|
|
|
if (seq_num >= start_win)
|
|
|
|
pkt_index = seq_num - start_win;
|
|
|
|
else
|
|
|
|
pkt_index = (seq_num+MAX_TID_VALUE) - start_win;
|
|
|
|
|
2014-10-30 01:14:34 +08:00
|
|
|
if (tbl->rx_reorder_ptr[pkt_index]) {
|
|
|
|
ret = -1;
|
|
|
|
goto done;
|
|
|
|
}
|
2011-03-22 09:00:50 +08:00
|
|
|
|
2012-03-13 10:35:13 +08:00
|
|
|
tbl->rx_reorder_ptr[pkt_index] = payload;
|
2011-03-22 09:00:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Dispatch all packets sequentially from start_win until a
|
|
|
|
* hole is found and adjust the start_win appropriately
|
|
|
|
*/
|
2012-03-13 10:35:13 +08:00
|
|
|
mwifiex_11n_scan_and_dispatch(priv, tbl);
|
2011-03-22 09:00:50 +08:00
|
|
|
|
2014-10-30 01:14:34 +08:00
|
|
|
done:
|
|
|
|
if (!tbl->timer_context.timer_is_set ||
|
|
|
|
prev_start_win != tbl->start_win)
|
|
|
|
mwifiex_11n_rxreorder_timer_restart(tbl);
|
|
|
|
return ret;
|
2011-03-22 09:00:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function deletes an entry for a given TID/TA pair.
|
|
|
|
*
|
|
|
|
* The TID/TA are taken from del BA event body.
|
|
|
|
*/
|
|
|
|
void
|
2012-03-13 10:35:08 +08:00
|
|
|
mwifiex_del_ba_tbl(struct mwifiex_private *priv, int tid, u8 *peer_mac,
|
|
|
|
u8 type, int initiator)
|
2011-03-22 09:00:50 +08:00
|
|
|
{
|
2012-03-13 10:35:13 +08:00
|
|
|
struct mwifiex_rx_reorder_tbl *tbl;
|
2011-03-22 09:00:50 +08:00
|
|
|
struct mwifiex_tx_ba_stream_tbl *ptx_tbl;
|
2015-03-13 20:07:55 +08:00
|
|
|
struct mwifiex_ra_list_tbl *ra_list;
|
2011-03-22 09:00:50 +08:00
|
|
|
u8 cleanup_rx_reorder_tbl;
|
2015-06-03 19:29:46 +08:00
|
|
|
int tid_down;
|
2011-03-22 09:00:50 +08:00
|
|
|
|
|
|
|
if (type == TYPE_DELBA_RECEIVE)
|
|
|
|
cleanup_rx_reorder_tbl = (initiator) ? true : false;
|
|
|
|
else
|
|
|
|
cleanup_rx_reorder_tbl = (initiator) ? false : true;
|
|
|
|
|
2015-05-12 03:18:20 +08:00
|
|
|
mwifiex_dbg(priv->adapter, EVENT, "event: DELBA: %pM tid=%d initiator=%d\n",
|
|
|
|
peer_mac, tid, initiator);
|
2011-03-22 09:00:50 +08:00
|
|
|
|
|
|
|
if (cleanup_rx_reorder_tbl) {
|
2012-03-13 10:35:13 +08:00
|
|
|
tbl = mwifiex_11n_get_rx_reorder_tbl(priv, tid,
|
2011-03-22 09:00:50 +08:00
|
|
|
peer_mac);
|
2012-03-13 10:35:13 +08:00
|
|
|
if (!tbl) {
|
2015-05-12 03:18:20 +08:00
|
|
|
mwifiex_dbg(priv->adapter, EVENT,
|
|
|
|
"event: TID, TA not found in table\n");
|
2011-03-22 09:00:50 +08:00
|
|
|
return;
|
|
|
|
}
|
2012-03-13 10:35:13 +08:00
|
|
|
mwifiex_del_rx_reorder_entry(priv, tbl);
|
2011-03-22 09:00:50 +08:00
|
|
|
} else {
|
2012-03-13 10:35:08 +08:00
|
|
|
ptx_tbl = mwifiex_get_ba_tbl(priv, tid, peer_mac);
|
2011-03-22 09:00:50 +08:00
|
|
|
if (!ptx_tbl) {
|
2015-05-12 03:18:20 +08:00
|
|
|
mwifiex_dbg(priv->adapter, EVENT,
|
|
|
|
"event: TID, RA not found in table\n");
|
2011-03-22 09:00:50 +08:00
|
|
|
return;
|
|
|
|
}
|
2015-06-03 19:29:46 +08:00
|
|
|
|
|
|
|
tid_down = mwifiex_wmm_downgrade_tid(priv, tid);
|
|
|
|
ra_list = mwifiex_wmm_get_ralist_node(priv, tid_down, peer_mac);
|
2015-03-13 20:07:55 +08:00
|
|
|
if (ra_list) {
|
|
|
|
ra_list->amsdu_in_ampdu = false;
|
|
|
|
ra_list->ba_status = BA_SETUP_NONE;
|
|
|
|
}
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_lock_bh(&priv->tx_ba_stream_tbl_lock);
|
2011-03-22 09:00:50 +08:00
|
|
|
mwifiex_11n_delete_tx_ba_stream_tbl_entry(priv, ptx_tbl);
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_unlock_bh(&priv->tx_ba_stream_tbl_lock);
|
2011-03-22 09:00:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function handles the command response of an add BA response.
|
|
|
|
*
|
|
|
|
* Handling includes changing the header fields into CPU format and
|
|
|
|
* creating the stream, provided the add BA is accepted.
|
|
|
|
*/
|
|
|
|
int mwifiex_ret_11n_addba_resp(struct mwifiex_private *priv,
|
|
|
|
struct host_cmd_ds_command *resp)
|
|
|
|
{
|
2012-06-04 20:44:17 +08:00
|
|
|
struct host_cmd_ds_11n_addba_rsp *add_ba_rsp = &resp->params.add_ba_rsp;
|
2011-03-22 09:00:50 +08:00
|
|
|
int tid, win_size;
|
2012-03-13 10:35:13 +08:00
|
|
|
struct mwifiex_rx_reorder_tbl *tbl;
|
2011-03-22 09:00:50 +08:00
|
|
|
uint16_t block_ack_param_set;
|
|
|
|
|
|
|
|
block_ack_param_set = le16_to_cpu(add_ba_rsp->block_ack_param_set);
|
|
|
|
|
|
|
|
tid = (block_ack_param_set & IEEE80211_ADDBA_PARAM_TID_MASK)
|
|
|
|
>> BLOCKACKPARAM_TID_POS;
|
|
|
|
/*
|
|
|
|
* Check if we had rejected the ADDBA, if yes then do not create
|
|
|
|
* the stream
|
|
|
|
*/
|
2014-03-08 11:41:29 +08:00
|
|
|
if (le16_to_cpu(add_ba_rsp->status_code) != BA_RESULT_SUCCESS) {
|
2015-05-12 03:18:20 +08:00
|
|
|
mwifiex_dbg(priv->adapter, ERROR, "ADDBA RSP: failed %pM tid=%d)\n",
|
|
|
|
add_ba_rsp->peer_mac_addr, tid);
|
2011-03-22 09:00:50 +08:00
|
|
|
|
2012-03-13 10:35:13 +08:00
|
|
|
tbl = mwifiex_11n_get_rx_reorder_tbl(priv, tid,
|
|
|
|
add_ba_rsp->peer_mac_addr);
|
|
|
|
if (tbl)
|
|
|
|
mwifiex_del_rx_reorder_entry(priv, tbl);
|
2014-03-08 11:41:29 +08:00
|
|
|
|
|
|
|
return 0;
|
2011-03-22 09:00:50 +08:00
|
|
|
}
|
|
|
|
|
2014-03-08 11:41:29 +08:00
|
|
|
win_size = (block_ack_param_set & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK)
|
|
|
|
>> BLOCKACKPARAM_WINSIZE_POS;
|
|
|
|
|
2014-03-08 11:41:31 +08:00
|
|
|
tbl = mwifiex_11n_get_rx_reorder_tbl(priv, tid,
|
|
|
|
add_ba_rsp->peer_mac_addr);
|
|
|
|
if (tbl) {
|
|
|
|
if ((block_ack_param_set & BLOCKACKPARAM_AMSDU_SUPP_MASK) &&
|
|
|
|
priv->add_ba_param.rx_amsdu &&
|
|
|
|
(priv->aggr_prio_tbl[tid].amsdu != BA_STREAM_NOT_ALLOWED))
|
|
|
|
tbl->amsdu = true;
|
|
|
|
else
|
|
|
|
tbl->amsdu = false;
|
|
|
|
}
|
|
|
|
|
2015-05-12 03:18:20 +08:00
|
|
|
mwifiex_dbg(priv->adapter, CMD,
|
|
|
|
"cmd: ADDBA RSP: %pM tid=%d ssn=%d win_size=%d\n",
|
2014-03-08 11:41:29 +08:00
|
|
|
add_ba_rsp->peer_mac_addr, tid, add_ba_rsp->ssn, win_size);
|
|
|
|
|
2011-03-22 09:00:50 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function handles BA stream timeout event by preparing and sending
|
|
|
|
* a command to the firmware.
|
|
|
|
*/
|
|
|
|
void mwifiex_11n_ba_stream_timeout(struct mwifiex_private *priv,
|
|
|
|
struct host_cmd_ds_11n_batimeout *event)
|
|
|
|
{
|
|
|
|
struct host_cmd_ds_11n_delba delba;
|
|
|
|
|
|
|
|
memset(&delba, 0, sizeof(struct host_cmd_ds_11n_delba));
|
|
|
|
memcpy(delba.peer_mac_addr, event->peer_mac_addr, ETH_ALEN);
|
|
|
|
|
|
|
|
delba.del_ba_param_set |=
|
|
|
|
cpu_to_le16((u16) event->tid << DELBA_TID_POS);
|
|
|
|
delba.del_ba_param_set |= cpu_to_le16(
|
|
|
|
(u16) event->origninator << DELBA_INITIATOR_POS);
|
|
|
|
delba.reason_code = cpu_to_le16(WLAN_REASON_QSTA_TIMEOUT);
|
2014-02-28 11:35:12 +08:00
|
|
|
mwifiex_send_cmd(priv, HostCmd_CMD_11N_DELBA, 0, 0, &delba, false);
|
2011-03-22 09:00:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function cleans up the Rx reorder table by deleting all the entries
|
|
|
|
* and re-initializing.
|
|
|
|
*/
|
|
|
|
void mwifiex_11n_cleanup_reorder_tbl(struct mwifiex_private *priv)
|
|
|
|
{
|
|
|
|
struct mwifiex_rx_reorder_tbl *del_tbl_ptr, *tmp_node;
|
|
|
|
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_lock_bh(&priv->rx_reorder_tbl_lock);
|
2011-03-22 09:00:50 +08:00
|
|
|
list_for_each_entry_safe(del_tbl_ptr, tmp_node,
|
2018-12-01 01:59:57 +08:00
|
|
|
&priv->rx_reorder_tbl_ptr, list) {
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_unlock_bh(&priv->rx_reorder_tbl_lock);
|
2012-03-13 10:35:13 +08:00
|
|
|
mwifiex_del_rx_reorder_entry(priv, del_tbl_ptr);
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_lock_bh(&priv->rx_reorder_tbl_lock);
|
2018-12-01 01:59:57 +08:00
|
|
|
}
|
2014-07-12 11:53:13 +08:00
|
|
|
INIT_LIST_HEAD(&priv->rx_reorder_tbl_ptr);
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_unlock_bh(&priv->rx_reorder_tbl_lock);
|
2011-03-22 09:00:50 +08:00
|
|
|
|
2012-06-21 11:21:10 +08:00
|
|
|
mwifiex_reset_11n_rx_seq_num(priv);
|
2011-03-22 09:00:50 +08:00
|
|
|
}
|
2012-09-28 10:00:10 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This function updates all rx_reorder_tbl's flags.
|
|
|
|
*/
|
|
|
|
void mwifiex_update_rxreor_flags(struct mwifiex_adapter *adapter, u8 flags)
|
|
|
|
{
|
|
|
|
struct mwifiex_private *priv;
|
|
|
|
struct mwifiex_rx_reorder_tbl *tbl;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < adapter->priv_num; i++) {
|
|
|
|
priv = adapter->priv[i];
|
|
|
|
if (!priv)
|
|
|
|
continue;
|
|
|
|
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_lock_bh(&priv->rx_reorder_tbl_lock);
|
2012-09-28 10:00:10 +08:00
|
|
|
list_for_each_entry(tbl, &priv->rx_reorder_tbl_ptr, list)
|
|
|
|
tbl->flags = flags;
|
2019-06-26 01:40:45 +08:00
|
|
|
spin_unlock_bh(&priv->rx_reorder_tbl_lock);
|
2012-09-28 10:00:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2015-06-10 21:19:48 +08:00
|
|
|
|
|
|
|
/* This function update all the rx_win_size based on coex flag
|
|
|
|
*/
|
|
|
|
static void mwifiex_update_ampdu_rxwinsize(struct mwifiex_adapter *adapter,
|
|
|
|
bool coex_flag)
|
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
u32 rx_win_size;
|
|
|
|
struct mwifiex_private *priv;
|
|
|
|
|
|
|
|
dev_dbg(adapter->dev, "Update rxwinsize %d\n", coex_flag);
|
|
|
|
|
|
|
|
for (i = 0; i < adapter->priv_num; i++) {
|
|
|
|
if (!adapter->priv[i])
|
|
|
|
continue;
|
|
|
|
priv = adapter->priv[i];
|
|
|
|
rx_win_size = priv->add_ba_param.rx_win_size;
|
|
|
|
if (coex_flag) {
|
|
|
|
if (priv->bss_type == MWIFIEX_BSS_TYPE_STA)
|
|
|
|
priv->add_ba_param.rx_win_size =
|
|
|
|
MWIFIEX_STA_COEX_AMPDU_DEF_RXWINSIZE;
|
|
|
|
if (priv->bss_type == MWIFIEX_BSS_TYPE_P2P)
|
|
|
|
priv->add_ba_param.rx_win_size =
|
|
|
|
MWIFIEX_STA_COEX_AMPDU_DEF_RXWINSIZE;
|
|
|
|
if (priv->bss_type == MWIFIEX_BSS_TYPE_UAP)
|
|
|
|
priv->add_ba_param.rx_win_size =
|
|
|
|
MWIFIEX_UAP_COEX_AMPDU_DEF_RXWINSIZE;
|
|
|
|
} else {
|
|
|
|
if (priv->bss_type == MWIFIEX_BSS_TYPE_STA)
|
|
|
|
priv->add_ba_param.rx_win_size =
|
|
|
|
MWIFIEX_STA_AMPDU_DEF_RXWINSIZE;
|
|
|
|
if (priv->bss_type == MWIFIEX_BSS_TYPE_P2P)
|
|
|
|
priv->add_ba_param.rx_win_size =
|
|
|
|
MWIFIEX_STA_AMPDU_DEF_RXWINSIZE;
|
|
|
|
if (priv->bss_type == MWIFIEX_BSS_TYPE_UAP)
|
|
|
|
priv->add_ba_param.rx_win_size =
|
|
|
|
MWIFIEX_UAP_AMPDU_DEF_RXWINSIZE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (adapter->coex_win_size && adapter->coex_rx_win_size)
|
|
|
|
priv->add_ba_param.rx_win_size =
|
|
|
|
adapter->coex_rx_win_size;
|
|
|
|
|
|
|
|
if (rx_win_size != priv->add_ba_param.rx_win_size) {
|
|
|
|
if (!priv->media_connected)
|
|
|
|
continue;
|
|
|
|
for (i = 0; i < MAX_NUM_TID; i++)
|
|
|
|
mwifiex_11n_delba(priv, i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This function check coex for RX BA
|
|
|
|
*/
|
|
|
|
void mwifiex_coex_ampdu_rxwinsize(struct mwifiex_adapter *adapter)
|
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
struct mwifiex_private *priv;
|
|
|
|
u8 count = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < adapter->priv_num; i++) {
|
|
|
|
if (adapter->priv[i]) {
|
|
|
|
priv = adapter->priv[i];
|
|
|
|
if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) {
|
|
|
|
if (priv->media_connected)
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP) {
|
|
|
|
if (priv->bss_started)
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (count >= MWIFIEX_BSS_COEX_COUNT)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (count >= MWIFIEX_BSS_COEX_COUNT)
|
|
|
|
mwifiex_update_ampdu_rxwinsize(adapter, true);
|
|
|
|
else
|
|
|
|
mwifiex_update_ampdu_rxwinsize(adapter, false);
|
|
|
|
}
|
2016-07-25 23:51:08 +08:00
|
|
|
|
|
|
|
/* This function handles rxba_sync event
|
|
|
|
*/
|
|
|
|
void mwifiex_11n_rxba_sync_event(struct mwifiex_private *priv,
|
|
|
|
u8 *event_buf, u16 len)
|
|
|
|
{
|
|
|
|
struct mwifiex_ie_types_rxba_sync *tlv_rxba = (void *)event_buf;
|
|
|
|
u16 tlv_type, tlv_len;
|
|
|
|
struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr;
|
|
|
|
u8 i, j;
|
|
|
|
u16 seq_num, tlv_seq_num, tlv_bitmap_len;
|
|
|
|
int tlv_buf_left = len;
|
|
|
|
int ret;
|
|
|
|
u8 *tmp;
|
|
|
|
|
|
|
|
mwifiex_dbg_dump(priv->adapter, EVT_D, "RXBA_SYNC event:",
|
|
|
|
event_buf, len);
|
|
|
|
while (tlv_buf_left >= sizeof(*tlv_rxba)) {
|
|
|
|
tlv_type = le16_to_cpu(tlv_rxba->header.type);
|
|
|
|
tlv_len = le16_to_cpu(tlv_rxba->header.len);
|
|
|
|
if (tlv_type != TLV_TYPE_RXBA_SYNC) {
|
|
|
|
mwifiex_dbg(priv->adapter, ERROR,
|
|
|
|
"Wrong TLV id=0x%x\n", tlv_type);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
tlv_seq_num = le16_to_cpu(tlv_rxba->seq_num);
|
|
|
|
tlv_bitmap_len = le16_to_cpu(tlv_rxba->bitmap_len);
|
|
|
|
mwifiex_dbg(priv->adapter, INFO,
|
|
|
|
"%pM tid=%d seq_num=%d bitmap_len=%d\n",
|
|
|
|
tlv_rxba->mac, tlv_rxba->tid, tlv_seq_num,
|
|
|
|
tlv_bitmap_len);
|
|
|
|
|
|
|
|
rx_reor_tbl_ptr =
|
|
|
|
mwifiex_11n_get_rx_reorder_tbl(priv, tlv_rxba->tid,
|
|
|
|
tlv_rxba->mac);
|
|
|
|
if (!rx_reor_tbl_ptr) {
|
|
|
|
mwifiex_dbg(priv->adapter, ERROR,
|
|
|
|
"Can not find rx_reorder_tbl!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < tlv_bitmap_len; i++) {
|
|
|
|
for (j = 0 ; j < 8; j++) {
|
|
|
|
if (tlv_rxba->bitmap[i] & (1 << j)) {
|
|
|
|
seq_num = (MAX_TID_VALUE - 1) &
|
|
|
|
(tlv_seq_num + i * 8 + j);
|
|
|
|
|
|
|
|
mwifiex_dbg(priv->adapter, ERROR,
|
|
|
|
"drop packet,seq=%d\n",
|
|
|
|
seq_num);
|
|
|
|
|
|
|
|
ret = mwifiex_11n_rx_reorder_pkt
|
|
|
|
(priv, seq_num, tlv_rxba->tid,
|
|
|
|
tlv_rxba->mac, 0, NULL);
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
mwifiex_dbg(priv->adapter,
|
|
|
|
ERROR,
|
|
|
|
"Fail to drop packet");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tlv_buf_left -= (sizeof(*tlv_rxba) + tlv_len);
|
|
|
|
tmp = (u8 *)tlv_rxba + tlv_len + sizeof(*tlv_rxba);
|
|
|
|
tlv_rxba = (struct mwifiex_ie_types_rxba_sync *)tmp;
|
|
|
|
}
|
|
|
|
}
|