diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2010-01-08 12:31:47 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-01-12 14:02:10 -0500 |
commit | efb7c49a68cf206f35793d7799608e1d69a209f9 (patch) | |
tree | 84121e89eddcf9ff0a8fbdb585cecbcf248a0e50 /drivers | |
parent | b64fe619e371fc17d8d686d6d44aef1b41317880 (diff) |
mwl8k: allow limiting the amount of transmit reclaim done
Add a limit argument to mwl8k_txq_reclaim(), to allow limiting the
number of packets that it will reclaim, and make it return the number
of packets that it reclaimed.
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/mwl8k.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c index 759c94fb8e77..6598efcda5cc 100644 --- a/drivers/net/wireless/mwl8k.c +++ b/drivers/net/wireless/mwl8k.c | |||
@@ -1249,13 +1249,15 @@ static int mwl8k_tx_wait_empty(struct ieee80211_hw *hw) | |||
1249 | MWL8K_TXD_STATUS_OK_RETRY | \ | 1249 | MWL8K_TXD_STATUS_OK_RETRY | \ |
1250 | MWL8K_TXD_STATUS_OK_MORE_RETRY)) | 1250 | MWL8K_TXD_STATUS_OK_MORE_RETRY)) |
1251 | 1251 | ||
1252 | static void mwl8k_txq_reclaim(struct ieee80211_hw *hw, int index, int force) | 1252 | static int |
1253 | mwl8k_txq_reclaim(struct ieee80211_hw *hw, int index, int limit, int force) | ||
1253 | { | 1254 | { |
1254 | struct mwl8k_priv *priv = hw->priv; | 1255 | struct mwl8k_priv *priv = hw->priv; |
1255 | struct mwl8k_tx_queue *txq = priv->txq + index; | 1256 | struct mwl8k_tx_queue *txq = priv->txq + index; |
1256 | int wake = 0; | 1257 | int processed; |
1257 | 1258 | ||
1258 | while (txq->stats.len > 0) { | 1259 | processed = 0; |
1260 | while (txq->stats.len > 0 && limit--) { | ||
1259 | int tx; | 1261 | int tx; |
1260 | struct mwl8k_tx_desc *tx_desc; | 1262 | struct mwl8k_tx_desc *tx_desc; |
1261 | unsigned long addr; | 1263 | unsigned long addr; |
@@ -1302,11 +1304,13 @@ static void mwl8k_txq_reclaim(struct ieee80211_hw *hw, int index, int force) | |||
1302 | 1304 | ||
1303 | ieee80211_tx_status_irqsafe(hw, skb); | 1305 | ieee80211_tx_status_irqsafe(hw, skb); |
1304 | 1306 | ||
1305 | wake = 1; | 1307 | processed++; |
1306 | } | 1308 | } |
1307 | 1309 | ||
1308 | if (wake && priv->radio_on && !mutex_is_locked(&priv->fw_mutex)) | 1310 | if (processed && priv->radio_on && !mutex_is_locked(&priv->fw_mutex)) |
1309 | ieee80211_wake_queue(hw, index); | 1311 | ieee80211_wake_queue(hw, index); |
1312 | |||
1313 | return processed; | ||
1310 | } | 1314 | } |
1311 | 1315 | ||
1312 | /* must be called only when the card's transmit is completely halted */ | 1316 | /* must be called only when the card's transmit is completely halted */ |
@@ -1315,7 +1319,7 @@ static void mwl8k_txq_deinit(struct ieee80211_hw *hw, int index) | |||
1315 | struct mwl8k_priv *priv = hw->priv; | 1319 | struct mwl8k_priv *priv = hw->priv; |
1316 | struct mwl8k_tx_queue *txq = priv->txq + index; | 1320 | struct mwl8k_tx_queue *txq = priv->txq + index; |
1317 | 1321 | ||
1318 | mwl8k_txq_reclaim(hw, index, 1); | 1322 | mwl8k_txq_reclaim(hw, index, INT_MAX, 1); |
1319 | 1323 | ||
1320 | kfree(txq->skb); | 1324 | kfree(txq->skb); |
1321 | txq->skb = NULL; | 1325 | txq->skb = NULL; |
@@ -3084,7 +3088,7 @@ static void mwl8k_stop(struct ieee80211_hw *hw) | |||
3084 | 3088 | ||
3085 | /* Return all skbs to mac80211 */ | 3089 | /* Return all skbs to mac80211 */ |
3086 | for (i = 0; i < MWL8K_TX_QUEUES; i++) | 3090 | for (i = 0; i < MWL8K_TX_QUEUES; i++) |
3087 | mwl8k_txq_reclaim(hw, i, 1); | 3091 | mwl8k_txq_reclaim(hw, i, INT_MAX, 1); |
3088 | } | 3092 | } |
3089 | 3093 | ||
3090 | static int mwl8k_add_interface(struct ieee80211_hw *hw, | 3094 | static int mwl8k_add_interface(struct ieee80211_hw *hw, |
@@ -3647,7 +3651,7 @@ static void mwl8k_tx_reclaim_handler(unsigned long data) | |||
3647 | 3651 | ||
3648 | spin_lock_bh(&priv->tx_lock); | 3652 | spin_lock_bh(&priv->tx_lock); |
3649 | for (i = 0; i < MWL8K_TX_QUEUES; i++) | 3653 | for (i = 0; i < MWL8K_TX_QUEUES; i++) |
3650 | mwl8k_txq_reclaim(hw, i, 0); | 3654 | mwl8k_txq_reclaim(hw, i, INT_MAX, 0); |
3651 | 3655 | ||
3652 | if (priv->tx_wait != NULL && !priv->pending_tx_pkts) { | 3656 | if (priv->tx_wait != NULL && !priv->pending_tx_pkts) { |
3653 | complete(priv->tx_wait); | 3657 | complete(priv->tx_wait); |
@@ -4021,7 +4025,7 @@ static void __devexit mwl8k_remove(struct pci_dev *pdev) | |||
4021 | 4025 | ||
4022 | /* Return all skbs to mac80211 */ | 4026 | /* Return all skbs to mac80211 */ |
4023 | for (i = 0; i < MWL8K_TX_QUEUES; i++) | 4027 | for (i = 0; i < MWL8K_TX_QUEUES; i++) |
4024 | mwl8k_txq_reclaim(hw, i, 1); | 4028 | mwl8k_txq_reclaim(hw, i, INT_MAX, 1); |
4025 | 4029 | ||
4026 | for (i = 0; i < MWL8K_TX_QUEUES; i++) | 4030 | for (i = 0; i < MWL8K_TX_QUEUES; i++) |
4027 | mwl8k_txq_deinit(hw, i); | 4031 | mwl8k_txq_deinit(hw, i); |