diff options
author | Marc Yang <yangyang@marvell.com> | 2011-05-16 22:17:49 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-05-19 13:53:55 -0400 |
commit | f699254c7126d7df94491dfd4c3648f8ec0c0d51 (patch) | |
tree | 8df2829d738771c9915c728ac4a8e1b051fcd7c0 /drivers | |
parent | 7176ba23f8b589b1df3229574ff46fb904ce9ec5 (diff) |
mwifiex: reduce CPU usage by tracking tx_pkts_queued
This patch adds tx_pkts_queued to track number of packets being
enqueued & dequeued so that mwifiex_wmm_lists_empty() evaluation
is lightweight.
Signed-off-by: Marc Yang <yangyang@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/mwifiex/11n_aggr.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/main.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/wmm.c | 22 |
3 files changed, 19 insertions, 10 deletions
diff --git a/drivers/net/wireless/mwifiex/11n_aggr.c b/drivers/net/wireless/mwifiex/11n_aggr.c index d3d5e0853c45..f807447e4d99 100644 --- a/drivers/net/wireless/mwifiex/11n_aggr.c +++ b/drivers/net/wireless/mwifiex/11n_aggr.c | |||
@@ -196,6 +196,8 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, | |||
196 | if (skb_src) | 196 | if (skb_src) |
197 | pra_list->total_pkts_size -= skb_src->len; | 197 | pra_list->total_pkts_size -= skb_src->len; |
198 | 198 | ||
199 | atomic_dec(&priv->wmm.tx_pkts_queued); | ||
200 | |||
199 | spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, | 201 | spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, |
200 | ra_list_flags); | 202 | ra_list_flags); |
201 | mwifiex_11n_form_amsdu_pkt(skb_aggr, skb_src, &pad); | 203 | mwifiex_11n_form_amsdu_pkt(skb_aggr, skb_src, &pad); |
@@ -257,6 +259,8 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, | |||
257 | 259 | ||
258 | pra_list->total_pkts_size += skb_aggr->len; | 260 | pra_list->total_pkts_size += skb_aggr->len; |
259 | 261 | ||
262 | atomic_inc(&priv->wmm.tx_pkts_queued); | ||
263 | |||
260 | tx_info_aggr->flags |= MWIFIEX_BUF_FLAG_REQUEUED_PKT; | 264 | tx_info_aggr->flags |= MWIFIEX_BUF_FLAG_REQUEUED_PKT; |
261 | spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, | 265 | spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, |
262 | ra_list_flags); | 266 | ra_list_flags); |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index 672701dc2721..537b40dc016e 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -213,7 +213,8 @@ struct mwifiex_wmm_desc { | |||
213 | u32 drv_pkt_delay_max; | 213 | u32 drv_pkt_delay_max; |
214 | u8 queue_priority[IEEE80211_MAX_QUEUES]; | 214 | u8 queue_priority[IEEE80211_MAX_QUEUES]; |
215 | u32 user_pri_pkt_tx_ctrl[WMM_HIGHEST_PRIORITY + 1]; /* UP: 0 to 7 */ | 215 | u32 user_pri_pkt_tx_ctrl[WMM_HIGHEST_PRIORITY + 1]; /* UP: 0 to 7 */ |
216 | 216 | /* Number of transmit packets queued */ | |
217 | atomic_t tx_pkts_queued; | ||
217 | }; | 218 | }; |
218 | 219 | ||
219 | struct mwifiex_802_11_security { | 220 | struct mwifiex_802_11_security { |
diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c index faa09e32902e..52d218512c1e 100644 --- a/drivers/net/wireless/mwifiex/wmm.c +++ b/drivers/net/wireless/mwifiex/wmm.c | |||
@@ -399,6 +399,8 @@ mwifiex_wmm_init(struct mwifiex_adapter *adapter) | |||
399 | priv->add_ba_param.timeout = MWIFIEX_DEFAULT_BLOCK_ACK_TIMEOUT; | 399 | priv->add_ba_param.timeout = MWIFIEX_DEFAULT_BLOCK_ACK_TIMEOUT; |
400 | priv->add_ba_param.tx_win_size = MWIFIEX_AMPDU_DEF_TXWINSIZE; | 400 | priv->add_ba_param.tx_win_size = MWIFIEX_AMPDU_DEF_TXWINSIZE; |
401 | priv->add_ba_param.rx_win_size = MWIFIEX_AMPDU_DEF_RXWINSIZE; | 401 | priv->add_ba_param.rx_win_size = MWIFIEX_AMPDU_DEF_RXWINSIZE; |
402 | |||
403 | atomic_set(&priv->wmm.tx_pkts_queued, 0); | ||
402 | } | 404 | } |
403 | } | 405 | } |
404 | 406 | ||
@@ -408,17 +410,13 @@ mwifiex_wmm_init(struct mwifiex_adapter *adapter) | |||
408 | int | 410 | int |
409 | mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter) | 411 | mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter) |
410 | { | 412 | { |
411 | int i, j; | 413 | int i; |
412 | struct mwifiex_private *priv; | 414 | struct mwifiex_private *priv; |
413 | 415 | ||
414 | for (j = 0; j < adapter->priv_num; ++j) { | 416 | for (i = 0; i < adapter->priv_num; ++i) { |
415 | priv = adapter->priv[j]; | 417 | priv = adapter->priv[i]; |
416 | if (priv) { | 418 | if (priv && atomic_read(&priv->wmm.tx_pkts_queued)) |
417 | for (i = 0; i < MAX_NUM_TID; i++) | 419 | return false; |
418 | if (!mwifiex_wmm_is_ra_list_empty( | ||
419 | &priv->wmm.tid_tbl_ptr[i].ra_list)) | ||
420 | return false; | ||
421 | } | ||
422 | } | 420 | } |
423 | 421 | ||
424 | return true; | 422 | return true; |
@@ -468,6 +466,8 @@ static void mwifiex_wmm_cleanup_queues(struct mwifiex_private *priv) | |||
468 | for (i = 0; i < MAX_NUM_TID; i++) | 466 | for (i = 0; i < MAX_NUM_TID; i++) |
469 | mwifiex_wmm_del_pkts_in_ralist(priv, &priv->wmm.tid_tbl_ptr[i]. | 467 | mwifiex_wmm_del_pkts_in_ralist(priv, &priv->wmm.tid_tbl_ptr[i]. |
470 | ra_list); | 468 | ra_list); |
469 | |||
470 | atomic_set(&priv->wmm.tx_pkts_queued, 0); | ||
471 | } | 471 | } |
472 | 472 | ||
473 | /* | 473 | /* |
@@ -638,6 +638,8 @@ mwifiex_wmm_add_buf_txqueue(struct mwifiex_adapter *adapter, | |||
638 | 638 | ||
639 | ra_list->total_pkts_size += skb->len; | 639 | ra_list->total_pkts_size += skb->len; |
640 | 640 | ||
641 | atomic_inc(&priv->wmm.tx_pkts_queued); | ||
642 | |||
641 | spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, flags); | 643 | spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, flags); |
642 | } | 644 | } |
643 | 645 | ||
@@ -1028,6 +1030,7 @@ mwifiex_send_single_packet(struct mwifiex_private *priv, | |||
1028 | .bss_prio_cur->list, | 1030 | .bss_prio_cur->list, |
1029 | struct mwifiex_bss_prio_node, | 1031 | struct mwifiex_bss_prio_node, |
1030 | list); | 1032 | list); |
1033 | atomic_dec(&priv->wmm.tx_pkts_queued); | ||
1031 | spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, | 1034 | spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, |
1032 | ra_list_flags); | 1035 | ra_list_flags); |
1033 | } | 1036 | } |
@@ -1134,6 +1137,7 @@ mwifiex_send_processed_packet(struct mwifiex_private *priv, | |||
1134 | .bss_prio_cur->list, | 1137 | .bss_prio_cur->list, |
1135 | struct mwifiex_bss_prio_node, | 1138 | struct mwifiex_bss_prio_node, |
1136 | list); | 1139 | list); |
1140 | atomic_dec(&priv->wmm.tx_pkts_queued); | ||
1137 | spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, | 1141 | spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, |
1138 | ra_list_flags); | 1142 | ra_list_flags); |
1139 | } | 1143 | } |