Commit 39df5e82 authored by Zhaoyang Liu's avatar Zhaoyang Liu Committed by Kalle Valo

mwifiex: get rid of BA setup helper functions

This patch removes BA setup helper routines
mwifiex_is_bastream_setup and  mwifiex_is_amsdu_in_ampdu_allowed.

Current code will use two functions to check bastream setup and
amsdu in ampdu. This patch change these functions to flags, thus
avoiding redundant spin_lock check while dequeuing TX packets.
Signed-off-by: default avatarZhaoyang Liu <liuzy@marvell.com>
Reviewed-by: default avatarCathy Luo <cluo@marvell.com>
Reviewed-by: default avatarAvinash Patil <patila@marvell.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent b2713f67
...@@ -159,6 +159,7 @@ int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv, ...@@ -159,6 +159,7 @@ int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv,
int tid; int tid;
struct host_cmd_ds_11n_addba_rsp *add_ba_rsp = &resp->params.add_ba_rsp; struct host_cmd_ds_11n_addba_rsp *add_ba_rsp = &resp->params.add_ba_rsp;
struct mwifiex_tx_ba_stream_tbl *tx_ba_tbl; struct mwifiex_tx_ba_stream_tbl *tx_ba_tbl;
struct mwifiex_ra_list_tbl *ra_list;
u16 block_ack_param_set = le16_to_cpu(add_ba_rsp->block_ack_param_set); u16 block_ack_param_set = le16_to_cpu(add_ba_rsp->block_ack_param_set);
add_ba_rsp->ssn = cpu_to_le16((le16_to_cpu(add_ba_rsp->ssn)) add_ba_rsp->ssn = cpu_to_le16((le16_to_cpu(add_ba_rsp->ssn))
...@@ -166,7 +167,13 @@ int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv, ...@@ -166,7 +167,13 @@ int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv,
tid = (block_ack_param_set & IEEE80211_ADDBA_PARAM_TID_MASK) tid = (block_ack_param_set & IEEE80211_ADDBA_PARAM_TID_MASK)
>> BLOCKACKPARAM_TID_POS; >> BLOCKACKPARAM_TID_POS;
ra_list = mwifiex_wmm_get_ralist_node(priv, tid, add_ba_rsp->
peer_mac_addr);
if (le16_to_cpu(add_ba_rsp->status_code) != BA_RESULT_SUCCESS) { if (le16_to_cpu(add_ba_rsp->status_code) != BA_RESULT_SUCCESS) {
if (ra_list) {
ra_list->ba_status = BA_SETUP_NONE;
ra_list->amsdu_in_ampdu = false;
}
mwifiex_del_ba_tbl(priv, tid, add_ba_rsp->peer_mac_addr, mwifiex_del_ba_tbl(priv, tid, add_ba_rsp->peer_mac_addr,
TYPE_DELBA_SENT, true); TYPE_DELBA_SENT, true);
if (add_ba_rsp->add_rsp_result != BA_RESULT_TIMEOUT) if (add_ba_rsp->add_rsp_result != BA_RESULT_TIMEOUT)
...@@ -185,6 +192,10 @@ int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv, ...@@ -185,6 +192,10 @@ int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv,
tx_ba_tbl->amsdu = true; tx_ba_tbl->amsdu = true;
else else
tx_ba_tbl->amsdu = false; tx_ba_tbl->amsdu = false;
if (ra_list) {
ra_list->amsdu_in_ampdu = tx_ba_tbl->amsdu;
ra_list->ba_status = BA_SETUP_COMPLETE;
}
} else { } else {
dev_err(priv->adapter->dev, "BA stream not created\n"); dev_err(priv->adapter->dev, "BA stream not created\n");
} }
...@@ -515,6 +526,7 @@ void mwifiex_create_ba_tbl(struct mwifiex_private *priv, u8 *ra, int tid, ...@@ -515,6 +526,7 @@ void mwifiex_create_ba_tbl(struct mwifiex_private *priv, u8 *ra, int tid,
enum mwifiex_ba_status ba_status) enum mwifiex_ba_status ba_status)
{ {
struct mwifiex_tx_ba_stream_tbl *new_node; struct mwifiex_tx_ba_stream_tbl *new_node;
struct mwifiex_ra_list_tbl *ra_list;
unsigned long flags; unsigned long flags;
if (!mwifiex_get_ba_tbl(priv, tid, ra)) { if (!mwifiex_get_ba_tbl(priv, tid, ra)) {
...@@ -522,7 +534,11 @@ void mwifiex_create_ba_tbl(struct mwifiex_private *priv, u8 *ra, int tid, ...@@ -522,7 +534,11 @@ void mwifiex_create_ba_tbl(struct mwifiex_private *priv, u8 *ra, int tid,
GFP_ATOMIC); GFP_ATOMIC);
if (!new_node) if (!new_node)
return; return;
ra_list = mwifiex_wmm_get_ralist_node(priv, tid, ra);
if (ra_list) {
ra_list->ba_status = ba_status;
ra_list->amsdu_in_ampdu = false;
}
INIT_LIST_HEAD(&new_node->list); INIT_LIST_HEAD(&new_node->list);
new_node->tid = tid; new_node->tid = tid;
......
...@@ -77,22 +77,6 @@ mwifiex_is_station_ampdu_allowed(struct mwifiex_private *priv, ...@@ -77,22 +77,6 @@ mwifiex_is_station_ampdu_allowed(struct mwifiex_private *priv,
return (node->ampdu_sta[tid] != BA_STREAM_NOT_ALLOWED) ? true : false; return (node->ampdu_sta[tid] != BA_STREAM_NOT_ALLOWED) ? true : false;
} }
/* This function checks whether AMSDU is allowed for BA stream. */
static inline u8
mwifiex_is_amsdu_in_ampdu_allowed(struct mwifiex_private *priv,
struct mwifiex_ra_list_tbl *ptr, int tid)
{
struct mwifiex_tx_ba_stream_tbl *tx_tbl;
if (is_broadcast_ether_addr(ptr->ra))
return false;
tx_tbl = mwifiex_get_ba_tbl(priv, tid, ptr->ra);
if (tx_tbl)
return tx_tbl->amsdu;
return false;
}
/* This function checks whether AMPDU is allowed or not for a particular TID. */ /* This function checks whether AMPDU is allowed or not for a particular TID. */
static inline u8 static inline u8
mwifiex_is_ampdu_allowed(struct mwifiex_private *priv, mwifiex_is_ampdu_allowed(struct mwifiex_private *priv,
...@@ -181,22 +165,6 @@ mwifiex_find_stream_to_delete(struct mwifiex_private *priv, int ptr_tid, ...@@ -181,22 +165,6 @@ mwifiex_find_stream_to_delete(struct mwifiex_private *priv, int ptr_tid,
return ret; return ret;
} }
/*
* This function checks whether BA stream is set up or not.
*/
static inline int
mwifiex_is_ba_stream_setup(struct mwifiex_private *priv,
struct mwifiex_ra_list_tbl *ptr, int tid)
{
struct mwifiex_tx_ba_stream_tbl *tx_tbl;
tx_tbl = mwifiex_get_ba_tbl(priv, tid, ptr->ra);
if (tx_tbl && IS_BASTREAM_SETUP(tx_tbl))
return true;
return false;
}
/* /*
* This function checks whether associated station is 11n enabled * This function checks whether associated station is 11n enabled
*/ */
......
...@@ -659,6 +659,7 @@ mwifiex_del_ba_tbl(struct mwifiex_private *priv, int tid, u8 *peer_mac, ...@@ -659,6 +659,7 @@ mwifiex_del_ba_tbl(struct mwifiex_private *priv, int tid, u8 *peer_mac,
{ {
struct mwifiex_rx_reorder_tbl *tbl; struct mwifiex_rx_reorder_tbl *tbl;
struct mwifiex_tx_ba_stream_tbl *ptx_tbl; struct mwifiex_tx_ba_stream_tbl *ptx_tbl;
struct mwifiex_ra_list_tbl *ra_list;
u8 cleanup_rx_reorder_tbl; u8 cleanup_rx_reorder_tbl;
unsigned long flags; unsigned long flags;
...@@ -686,7 +687,11 @@ mwifiex_del_ba_tbl(struct mwifiex_private *priv, int tid, u8 *peer_mac, ...@@ -686,7 +687,11 @@ mwifiex_del_ba_tbl(struct mwifiex_private *priv, int tid, u8 *peer_mac,
"event: TID, RA not found in table\n"); "event: TID, RA not found in table\n");
return; return;
} }
ra_list = mwifiex_wmm_get_ralist_node(priv, tid, peer_mac);
if (ra_list) {
ra_list->amsdu_in_ampdu = false;
ra_list->ba_status = BA_SETUP_NONE;
}
spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags); spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags);
mwifiex_11n_delete_tx_ba_stream_tbl_entry(priv, ptx_tbl); mwifiex_11n_delete_tx_ba_stream_tbl_entry(priv, ptx_tbl);
spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags); spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags);
......
...@@ -211,6 +211,12 @@ struct mwifiex_tx_aggr { ...@@ -211,6 +211,12 @@ struct mwifiex_tx_aggr {
u8 amsdu; u8 amsdu;
}; };
enum mwifiex_ba_status {
BA_SETUP_NONE = 0,
BA_SETUP_INPROGRESS,
BA_SETUP_COMPLETE
};
struct mwifiex_ra_list_tbl { struct mwifiex_ra_list_tbl {
struct list_head list; struct list_head list;
struct sk_buff_head skb_head; struct sk_buff_head skb_head;
...@@ -219,6 +225,8 @@ struct mwifiex_ra_list_tbl { ...@@ -219,6 +225,8 @@ struct mwifiex_ra_list_tbl {
u16 max_amsdu; u16 max_amsdu;
u16 ba_pkt_count; u16 ba_pkt_count;
u8 ba_packet_thr; u8 ba_packet_thr;
enum mwifiex_ba_status ba_status;
u8 amsdu_in_ampdu;
u16 total_pkt_count; u16 total_pkt_count;
bool tdls_link; bool tdls_link;
}; };
...@@ -602,11 +610,6 @@ struct mwifiex_private { ...@@ -602,11 +610,6 @@ struct mwifiex_private {
struct mwifiex_11h_intf_state state_11h; struct mwifiex_11h_intf_state state_11h;
}; };
enum mwifiex_ba_status {
BA_SETUP_NONE = 0,
BA_SETUP_INPROGRESS,
BA_SETUP_COMPLETE
};
struct mwifiex_tx_ba_stream_tbl { struct mwifiex_tx_ba_stream_tbl {
struct list_head list; struct list_head list;
......
...@@ -157,6 +157,8 @@ void mwifiex_ralist_add(struct mwifiex_private *priv, const u8 *ra) ...@@ -157,6 +157,8 @@ void mwifiex_ralist_add(struct mwifiex_private *priv, const u8 *ra)
ra_list->is_11n_enabled = 0; ra_list->is_11n_enabled = 0;
ra_list->tdls_link = false; ra_list->tdls_link = false;
ra_list->ba_status = BA_SETUP_NONE;
ra_list->amsdu_in_ampdu = false;
if (!mwifiex_queuing_ra_based(priv)) { if (!mwifiex_queuing_ra_based(priv)) {
if (mwifiex_get_tdls_link_status(priv, ra) == if (mwifiex_get_tdls_link_status(priv, ra) ==
TDLS_SETUP_COMPLETE) { TDLS_SETUP_COMPLETE) {
...@@ -574,7 +576,7 @@ mwifiex_clean_txrx(struct mwifiex_private *priv) ...@@ -574,7 +576,7 @@ mwifiex_clean_txrx(struct mwifiex_private *priv)
* This function retrieves a particular RA list node, matching with the * This function retrieves a particular RA list node, matching with the
* given TID and RA address. * given TID and RA address.
*/ */
static struct mwifiex_ra_list_tbl * struct mwifiex_ra_list_tbl *
mwifiex_wmm_get_ralist_node(struct mwifiex_private *priv, u8 tid, mwifiex_wmm_get_ralist_node(struct mwifiex_private *priv, u8 tid,
const u8 *ra_addr) const u8 *ra_addr)
{ {
...@@ -1276,13 +1278,13 @@ mwifiex_dequeue_tx_packet(struct mwifiex_adapter *adapter) ...@@ -1276,13 +1278,13 @@ mwifiex_dequeue_tx_packet(struct mwifiex_adapter *adapter)
} }
if (!ptr->is_11n_enabled || if (!ptr->is_11n_enabled ||
mwifiex_is_ba_stream_setup(priv, ptr, tid) || ptr->ba_status ||
priv->wps.session_enable) { priv->wps.session_enable) {
if (ptr->is_11n_enabled && if (ptr->is_11n_enabled &&
mwifiex_is_ba_stream_setup(priv, ptr, tid) && ptr->ba_status &&
mwifiex_is_amsdu_in_ampdu_allowed(priv, ptr, tid) && ptr->amsdu_in_ampdu &&
mwifiex_is_amsdu_allowed(priv, tid) && mwifiex_is_amsdu_allowed(priv, tid) &&
mwifiex_is_11n_aggragation_possible(priv, ptr, mwifiex_is_11n_aggragation_possible(priv, ptr,
adapter->tx_buf_size)) adapter->tx_buf_size))
mwifiex_11n_aggregate_pkt(priv, ptr, ptr_index, flags); mwifiex_11n_aggregate_pkt(priv, ptr, ptr_index, flags);
/* ra_list_spinlock has been freed in /* ra_list_spinlock has been freed in
......
...@@ -127,4 +127,6 @@ mwifiex_wmm_get_queue_raptr(struct mwifiex_private *priv, u8 tid, ...@@ -127,4 +127,6 @@ mwifiex_wmm_get_queue_raptr(struct mwifiex_private *priv, u8 tid,
const u8 *ra_addr); const u8 *ra_addr);
u8 mwifiex_wmm_downgrade_tid(struct mwifiex_private *priv, u32 tid); u8 mwifiex_wmm_downgrade_tid(struct mwifiex_private *priv, u32 tid);
struct mwifiex_ra_list_tbl *mwifiex_wmm_get_ralist_node(struct mwifiex_private
*priv, u8 tid, const u8 *ra_addr);
#endif /* !_MWIFIEX_WMM_H_ */ #endif /* !_MWIFIEX_WMM_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment