summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mwifiex/wmm.c
diff options
context:
space:
mode:
authorMarc Yang <yangyang@marvell.com>2011-05-16 19:17:49 -0700
committerJohn W. Linville <linville@tuxdriver.com>2011-05-19 13:53:55 -0400
commitf699254c7126d7df94491dfd4c3648f8ec0c0d51 (patch)
tree8df2829d738771c9915c728ac4a8e1b051fcd7c0 /drivers/net/wireless/mwifiex/wmm.c
parent7176ba23f8b589b1df3229574ff46fb904ce9ec5 (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/net/wireless/mwifiex/wmm.c')
-rw-r--r--drivers/net/wireless/mwifiex/wmm.c22
1 files changed, 13 insertions, 9 deletions
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)
priv->add_ba_param.timeout = MWIFIEX_DEFAULT_BLOCK_ACK_TIMEOUT;
priv->add_ba_param.tx_win_size = MWIFIEX_AMPDU_DEF_TXWINSIZE;
priv->add_ba_param.rx_win_size = MWIFIEX_AMPDU_DEF_RXWINSIZE;
+
+ atomic_set(&priv->wmm.tx_pkts_queued, 0);
}
}
@@ -408,17 +410,13 @@ mwifiex_wmm_init(struct mwifiex_adapter *adapter)
int
mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter)
{
- int i, j;
+ int i;
struct mwifiex_private *priv;
- for (j = 0; j < adapter->priv_num; ++j) {
- priv = adapter->priv[j];
- if (priv) {
- for (i = 0; i < MAX_NUM_TID; i++)
- if (!mwifiex_wmm_is_ra_list_empty(
- &priv->wmm.tid_tbl_ptr[i].ra_list))
- return false;
- }
+ for (i = 0; i < adapter->priv_num; ++i) {
+ priv = adapter->priv[i];
+ if (priv && atomic_read(&priv->wmm.tx_pkts_queued))
+ return false;
}
return true;
@@ -468,6 +466,8 @@ static void mwifiex_wmm_cleanup_queues(struct mwifiex_private *priv)
for (i = 0; i < MAX_NUM_TID; i++)
mwifiex_wmm_del_pkts_in_ralist(priv, &priv->wmm.tid_tbl_ptr[i].
ra_list);
+
+ atomic_set(&priv->wmm.tx_pkts_queued, 0);
}
/*
@@ -638,6 +638,8 @@ mwifiex_wmm_add_buf_txqueue(struct mwifiex_adapter *adapter,
ra_list->total_pkts_size += skb->len;
+ atomic_inc(&priv->wmm.tx_pkts_queued);
+
spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, flags);
}
@@ -1028,6 +1030,7 @@ mwifiex_send_single_packet(struct mwifiex_private *priv,
.bss_prio_cur->list,
struct mwifiex_bss_prio_node,
list);
+ atomic_dec(&priv->wmm.tx_pkts_queued);
spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock,
ra_list_flags);
}
@@ -1134,6 +1137,7 @@ mwifiex_send_processed_packet(struct mwifiex_private *priv,
.bss_prio_cur->list,
struct mwifiex_bss_prio_node,
list);
+ atomic_dec(&priv->wmm.tx_pkts_queued);
spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock,
ra_list_flags);
}