diff options
author | Zhaoyang Liu <liuzy@marvell.com> | 2015-03-13 08:07:55 -0400 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2015-03-16 12:12:27 -0400 |
commit | 39df5e8233bf34696204207c7594a0a6320fa044 (patch) | |
tree | 59feca393ea83b8e9c2971293ef2de4b777ad4b8 /drivers/net/wireless/mwifiex | |
parent | b2713f67f7a4c3226772c5ac581c7f37d7c473f1 (diff) |
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: Zhaoyang Liu <liuzy@marvell.com>
Reviewed-by: Cathy Luo <cluo@marvell.com>
Reviewed-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/mwifiex')
-rw-r--r-- | drivers/net/wireless/mwifiex/11n.c | 18 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/11n.h | 32 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/11n_rxreorder.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/main.h | 13 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/wmm.c | 16 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/wmm.h | 2 |
6 files changed, 42 insertions, 46 deletions
diff --git a/drivers/net/wireless/mwifiex/11n.c b/drivers/net/wireless/mwifiex/11n.c index 543148d27b01..433bd6837c79 100644 --- a/drivers/net/wireless/mwifiex/11n.c +++ b/drivers/net/wireless/mwifiex/11n.c | |||
@@ -159,6 +159,7 @@ int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv, | |||
159 | int tid; | 159 | int tid; |
160 | struct host_cmd_ds_11n_addba_rsp *add_ba_rsp = &resp->params.add_ba_rsp; | 160 | struct host_cmd_ds_11n_addba_rsp *add_ba_rsp = &resp->params.add_ba_rsp; |
161 | struct mwifiex_tx_ba_stream_tbl *tx_ba_tbl; | 161 | struct mwifiex_tx_ba_stream_tbl *tx_ba_tbl; |
162 | struct mwifiex_ra_list_tbl *ra_list; | ||
162 | u16 block_ack_param_set = le16_to_cpu(add_ba_rsp->block_ack_param_set); | 163 | u16 block_ack_param_set = le16_to_cpu(add_ba_rsp->block_ack_param_set); |
163 | 164 | ||
164 | add_ba_rsp->ssn = cpu_to_le16((le16_to_cpu(add_ba_rsp->ssn)) | 165 | 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 | 167 | ||
167 | tid = (block_ack_param_set & IEEE80211_ADDBA_PARAM_TID_MASK) | 168 | tid = (block_ack_param_set & IEEE80211_ADDBA_PARAM_TID_MASK) |
168 | >> BLOCKACKPARAM_TID_POS; | 169 | >> BLOCKACKPARAM_TID_POS; |
170 | ra_list = mwifiex_wmm_get_ralist_node(priv, tid, add_ba_rsp-> | ||
171 | peer_mac_addr); | ||
169 | if (le16_to_cpu(add_ba_rsp->status_code) != BA_RESULT_SUCCESS) { | 172 | if (le16_to_cpu(add_ba_rsp->status_code) != BA_RESULT_SUCCESS) { |
173 | if (ra_list) { | ||
174 | ra_list->ba_status = BA_SETUP_NONE; | ||
175 | ra_list->amsdu_in_ampdu = false; | ||
176 | } | ||
170 | mwifiex_del_ba_tbl(priv, tid, add_ba_rsp->peer_mac_addr, | 177 | mwifiex_del_ba_tbl(priv, tid, add_ba_rsp->peer_mac_addr, |
171 | TYPE_DELBA_SENT, true); | 178 | TYPE_DELBA_SENT, true); |
172 | if (add_ba_rsp->add_rsp_result != BA_RESULT_TIMEOUT) | 179 | 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 | tx_ba_tbl->amsdu = true; | 192 | tx_ba_tbl->amsdu = true; |
186 | else | 193 | else |
187 | tx_ba_tbl->amsdu = false; | 194 | tx_ba_tbl->amsdu = false; |
195 | if (ra_list) { | ||
196 | ra_list->amsdu_in_ampdu = tx_ba_tbl->amsdu; | ||
197 | ra_list->ba_status = BA_SETUP_COMPLETE; | ||
198 | } | ||
188 | } else { | 199 | } else { |
189 | dev_err(priv->adapter->dev, "BA stream not created\n"); | 200 | dev_err(priv->adapter->dev, "BA stream not created\n"); |
190 | } | 201 | } |
@@ -515,6 +526,7 @@ void mwifiex_create_ba_tbl(struct mwifiex_private *priv, u8 *ra, int tid, | |||
515 | enum mwifiex_ba_status ba_status) | 526 | enum mwifiex_ba_status ba_status) |
516 | { | 527 | { |
517 | struct mwifiex_tx_ba_stream_tbl *new_node; | 528 | struct mwifiex_tx_ba_stream_tbl *new_node; |
529 | struct mwifiex_ra_list_tbl *ra_list; | ||
518 | unsigned long flags; | 530 | unsigned long flags; |
519 | 531 | ||
520 | if (!mwifiex_get_ba_tbl(priv, tid, ra)) { | 532 | 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 | GFP_ATOMIC); | 534 | GFP_ATOMIC); |
523 | if (!new_node) | 535 | if (!new_node) |
524 | return; | 536 | return; |
525 | 537 | ra_list = mwifiex_wmm_get_ralist_node(priv, tid, ra); | |
538 | if (ra_list) { | ||
539 | ra_list->ba_status = ba_status; | ||
540 | ra_list->amsdu_in_ampdu = false; | ||
541 | } | ||
526 | INIT_LIST_HEAD(&new_node->list); | 542 | INIT_LIST_HEAD(&new_node->list); |
527 | 543 | ||
528 | new_node->tid = tid; | 544 | new_node->tid = tid; |
diff --git a/drivers/net/wireless/mwifiex/11n.h b/drivers/net/wireless/mwifiex/11n.h index 8e2e39422ad8..afdd58aa90de 100644 --- a/drivers/net/wireless/mwifiex/11n.h +++ b/drivers/net/wireless/mwifiex/11n.h | |||
@@ -77,22 +77,6 @@ mwifiex_is_station_ampdu_allowed(struct mwifiex_private *priv, | |||
77 | return (node->ampdu_sta[tid] != BA_STREAM_NOT_ALLOWED) ? true : false; | 77 | return (node->ampdu_sta[tid] != BA_STREAM_NOT_ALLOWED) ? true : false; |
78 | } | 78 | } |
79 | 79 | ||
80 | /* This function checks whether AMSDU is allowed for BA stream. */ | ||
81 | static inline u8 | ||
82 | mwifiex_is_amsdu_in_ampdu_allowed(struct mwifiex_private *priv, | ||
83 | struct mwifiex_ra_list_tbl *ptr, int tid) | ||
84 | { | ||
85 | struct mwifiex_tx_ba_stream_tbl *tx_tbl; | ||
86 | |||
87 | if (is_broadcast_ether_addr(ptr->ra)) | ||
88 | return false; | ||
89 | tx_tbl = mwifiex_get_ba_tbl(priv, tid, ptr->ra); | ||
90 | if (tx_tbl) | ||
91 | return tx_tbl->amsdu; | ||
92 | |||
93 | return false; | ||
94 | } | ||
95 | |||
96 | /* This function checks whether AMPDU is allowed or not for a particular TID. */ | 80 | /* This function checks whether AMPDU is allowed or not for a particular TID. */ |
97 | static inline u8 | 81 | static inline u8 |
98 | mwifiex_is_ampdu_allowed(struct mwifiex_private *priv, | 82 | mwifiex_is_ampdu_allowed(struct mwifiex_private *priv, |
@@ -182,22 +166,6 @@ mwifiex_find_stream_to_delete(struct mwifiex_private *priv, int ptr_tid, | |||
182 | } | 166 | } |
183 | 167 | ||
184 | /* | 168 | /* |
185 | * This function checks whether BA stream is set up or not. | ||
186 | */ | ||
187 | static inline int | ||
188 | mwifiex_is_ba_stream_setup(struct mwifiex_private *priv, | ||
189 | struct mwifiex_ra_list_tbl *ptr, int tid) | ||
190 | { | ||
191 | struct mwifiex_tx_ba_stream_tbl *tx_tbl; | ||
192 | |||
193 | tx_tbl = mwifiex_get_ba_tbl(priv, tid, ptr->ra); | ||
194 | if (tx_tbl && IS_BASTREAM_SETUP(tx_tbl)) | ||
195 | return true; | ||
196 | |||
197 | return false; | ||
198 | } | ||
199 | |||
200 | /* | ||
201 | * This function checks whether associated station is 11n enabled | 169 | * This function checks whether associated station is 11n enabled |
202 | */ | 170 | */ |
203 | static inline int mwifiex_is_sta_11n_enabled(struct mwifiex_private *priv, | 171 | static inline int mwifiex_is_sta_11n_enabled(struct mwifiex_private *priv, |
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.c b/drivers/net/wireless/mwifiex/11n_rxreorder.c index a2e8817b56d8..f75f8acfaca0 100644 --- a/drivers/net/wireless/mwifiex/11n_rxreorder.c +++ b/drivers/net/wireless/mwifiex/11n_rxreorder.c | |||
@@ -659,6 +659,7 @@ mwifiex_del_ba_tbl(struct mwifiex_private *priv, int tid, u8 *peer_mac, | |||
659 | { | 659 | { |
660 | struct mwifiex_rx_reorder_tbl *tbl; | 660 | struct mwifiex_rx_reorder_tbl *tbl; |
661 | struct mwifiex_tx_ba_stream_tbl *ptx_tbl; | 661 | struct mwifiex_tx_ba_stream_tbl *ptx_tbl; |
662 | struct mwifiex_ra_list_tbl *ra_list; | ||
662 | u8 cleanup_rx_reorder_tbl; | 663 | u8 cleanup_rx_reorder_tbl; |
663 | unsigned long flags; | 664 | unsigned long flags; |
664 | 665 | ||
@@ -686,7 +687,11 @@ mwifiex_del_ba_tbl(struct mwifiex_private *priv, int tid, u8 *peer_mac, | |||
686 | "event: TID, RA not found in table\n"); | 687 | "event: TID, RA not found in table\n"); |
687 | return; | 688 | return; |
688 | } | 689 | } |
689 | 690 | ra_list = mwifiex_wmm_get_ralist_node(priv, tid, peer_mac); | |
691 | if (ra_list) { | ||
692 | ra_list->amsdu_in_ampdu = false; | ||
693 | ra_list->ba_status = BA_SETUP_NONE; | ||
694 | } | ||
690 | spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags); | 695 | spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags); |
691 | mwifiex_11n_delete_tx_ba_stream_tbl_entry(priv, ptx_tbl); | 696 | mwifiex_11n_delete_tx_ba_stream_tbl_entry(priv, ptx_tbl); |
692 | spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags); | 697 | spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags); |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index a319abe84423..439db1734904 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -211,6 +211,12 @@ struct mwifiex_tx_aggr { | |||
211 | u8 amsdu; | 211 | u8 amsdu; |
212 | }; | 212 | }; |
213 | 213 | ||
214 | enum mwifiex_ba_status { | ||
215 | BA_SETUP_NONE = 0, | ||
216 | BA_SETUP_INPROGRESS, | ||
217 | BA_SETUP_COMPLETE | ||
218 | }; | ||
219 | |||
214 | struct mwifiex_ra_list_tbl { | 220 | struct mwifiex_ra_list_tbl { |
215 | struct list_head list; | 221 | struct list_head list; |
216 | struct sk_buff_head skb_head; | 222 | struct sk_buff_head skb_head; |
@@ -219,6 +225,8 @@ struct mwifiex_ra_list_tbl { | |||
219 | u16 max_amsdu; | 225 | u16 max_amsdu; |
220 | u16 ba_pkt_count; | 226 | u16 ba_pkt_count; |
221 | u8 ba_packet_thr; | 227 | u8 ba_packet_thr; |
228 | enum mwifiex_ba_status ba_status; | ||
229 | u8 amsdu_in_ampdu; | ||
222 | u16 total_pkt_count; | 230 | u16 total_pkt_count; |
223 | bool tdls_link; | 231 | bool tdls_link; |
224 | }; | 232 | }; |
@@ -602,11 +610,6 @@ struct mwifiex_private { | |||
602 | struct mwifiex_11h_intf_state state_11h; | 610 | struct mwifiex_11h_intf_state state_11h; |
603 | }; | 611 | }; |
604 | 612 | ||
605 | enum mwifiex_ba_status { | ||
606 | BA_SETUP_NONE = 0, | ||
607 | BA_SETUP_INPROGRESS, | ||
608 | BA_SETUP_COMPLETE | ||
609 | }; | ||
610 | 613 | ||
611 | struct mwifiex_tx_ba_stream_tbl { | 614 | struct mwifiex_tx_ba_stream_tbl { |
612 | struct list_head list; | 615 | struct list_head list; |
diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c index 0cd4f6bed9fc..2d14dd5856c3 100644 --- a/drivers/net/wireless/mwifiex/wmm.c +++ b/drivers/net/wireless/mwifiex/wmm.c | |||
@@ -157,6 +157,8 @@ void mwifiex_ralist_add(struct mwifiex_private *priv, const u8 *ra) | |||
157 | 157 | ||
158 | ra_list->is_11n_enabled = 0; | 158 | ra_list->is_11n_enabled = 0; |
159 | ra_list->tdls_link = false; | 159 | ra_list->tdls_link = false; |
160 | ra_list->ba_status = BA_SETUP_NONE; | ||
161 | ra_list->amsdu_in_ampdu = false; | ||
160 | if (!mwifiex_queuing_ra_based(priv)) { | 162 | if (!mwifiex_queuing_ra_based(priv)) { |
161 | if (mwifiex_get_tdls_link_status(priv, ra) == | 163 | if (mwifiex_get_tdls_link_status(priv, ra) == |
162 | TDLS_SETUP_COMPLETE) { | 164 | TDLS_SETUP_COMPLETE) { |
@@ -574,7 +576,7 @@ mwifiex_clean_txrx(struct mwifiex_private *priv) | |||
574 | * This function retrieves a particular RA list node, matching with the | 576 | * This function retrieves a particular RA list node, matching with the |
575 | * given TID and RA address. | 577 | * given TID and RA address. |
576 | */ | 578 | */ |
577 | static struct mwifiex_ra_list_tbl * | 579 | struct mwifiex_ra_list_tbl * |
578 | mwifiex_wmm_get_ralist_node(struct mwifiex_private *priv, u8 tid, | 580 | mwifiex_wmm_get_ralist_node(struct mwifiex_private *priv, u8 tid, |
579 | const u8 *ra_addr) | 581 | const u8 *ra_addr) |
580 | { | 582 | { |
@@ -1276,13 +1278,13 @@ mwifiex_dequeue_tx_packet(struct mwifiex_adapter *adapter) | |||
1276 | } | 1278 | } |
1277 | 1279 | ||
1278 | if (!ptr->is_11n_enabled || | 1280 | if (!ptr->is_11n_enabled || |
1279 | mwifiex_is_ba_stream_setup(priv, ptr, tid) || | 1281 | ptr->ba_status || |
1280 | priv->wps.session_enable) { | 1282 | priv->wps.session_enable) { |
1281 | if (ptr->is_11n_enabled && | 1283 | if (ptr->is_11n_enabled && |
1282 | mwifiex_is_ba_stream_setup(priv, ptr, tid) && | 1284 | ptr->ba_status && |
1283 | mwifiex_is_amsdu_in_ampdu_allowed(priv, ptr, tid) && | 1285 | ptr->amsdu_in_ampdu && |
1284 | mwifiex_is_amsdu_allowed(priv, tid) && | 1286 | mwifiex_is_amsdu_allowed(priv, tid) && |
1285 | mwifiex_is_11n_aggragation_possible(priv, ptr, | 1287 | mwifiex_is_11n_aggragation_possible(priv, ptr, |
1286 | adapter->tx_buf_size)) | 1288 | adapter->tx_buf_size)) |
1287 | mwifiex_11n_aggregate_pkt(priv, ptr, ptr_index, flags); | 1289 | mwifiex_11n_aggregate_pkt(priv, ptr, ptr_index, flags); |
1288 | /* ra_list_spinlock has been freed in | 1290 | /* ra_list_spinlock has been freed in |
diff --git a/drivers/net/wireless/mwifiex/wmm.h b/drivers/net/wireless/mwifiex/wmm.h index 569bd73f33c5..48ece0b35591 100644 --- a/drivers/net/wireless/mwifiex/wmm.h +++ b/drivers/net/wireless/mwifiex/wmm.h | |||
@@ -127,4 +127,6 @@ mwifiex_wmm_get_queue_raptr(struct mwifiex_private *priv, u8 tid, | |||
127 | const u8 *ra_addr); | 127 | const u8 *ra_addr); |
128 | u8 mwifiex_wmm_downgrade_tid(struct mwifiex_private *priv, u32 tid); | 128 | u8 mwifiex_wmm_downgrade_tid(struct mwifiex_private *priv, u32 tid); |
129 | 129 | ||
130 | struct mwifiex_ra_list_tbl *mwifiex_wmm_get_ralist_node(struct mwifiex_private | ||
131 | *priv, u8 tid, const u8 *ra_addr); | ||
130 | #endif /* !_MWIFIEX_WMM_H_ */ | 132 | #endif /* !_MWIFIEX_WMM_H_ */ |