diff options
author | Christian Lamparter <chunkeey@web.de> | 2008-12-09 15:09:00 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-12-12 14:01:55 -0500 |
commit | 39ca5bb76f3382b1cb0062d75ec45abd1c46e6d2 (patch) | |
tree | 21dd8eaf22674e4f6a6c026eee6977e87bf938d4 /drivers/net/wireless | |
parent | 30dab79ed40f6c0f8a24e25fd9be7bd873eeeb8b (diff) |
p54: enforce strict tx_queue limits
The patch fixes an old FIXME in p54pci.c by moving the "queue full"
check into the common library, where we can deal with it properly.
Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/p54/p54common.c | 22 | ||||
-rw-r--r-- | drivers/net/wireless/p54/p54pci.c | 7 |
2 files changed, 21 insertions, 8 deletions
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c index 409ae930d766..fac6b416e9e9 100644 --- a/drivers/net/wireless/p54/p54common.c +++ b/drivers/net/wireless/p54/p54common.c | |||
@@ -874,7 +874,27 @@ static int p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb, | |||
874 | return -EINVAL; | 874 | return -EINVAL; |
875 | 875 | ||
876 | spin_lock_irqsave(&priv->tx_queue.lock, flags); | 876 | spin_lock_irqsave(&priv->tx_queue.lock, flags); |
877 | |||
877 | left = skb_queue_len(&priv->tx_queue); | 878 | left = skb_queue_len(&priv->tx_queue); |
879 | if (unlikely(left >= 28)) { | ||
880 | /* | ||
881 | * The tx_queue is nearly full! | ||
882 | * We have throttle normal data traffic, because we must | ||
883 | * have a few spare slots for control frames left. | ||
884 | */ | ||
885 | ieee80211_stop_queues(dev); | ||
886 | |||
887 | if (unlikely(left == 32)) { | ||
888 | /* | ||
889 | * The tx_queue is now really full. | ||
890 | * | ||
891 | * TODO: check if the device has crashed and reset it. | ||
892 | */ | ||
893 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); | ||
894 | return -ENOSPC; | ||
895 | } | ||
896 | } | ||
897 | |||
878 | while (left--) { | 898 | while (left--) { |
879 | u32 hole_size; | 899 | u32 hole_size; |
880 | info = IEEE80211_SKB_CB(entry); | 900 | info = IEEE80211_SKB_CB(entry); |
@@ -903,7 +923,7 @@ static int p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb, | |||
903 | if (!target_skb) { | 923 | if (!target_skb) { |
904 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); | 924 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); |
905 | ieee80211_stop_queues(dev); | 925 | ieee80211_stop_queues(dev); |
906 | return -ENOMEM; | 926 | return -ENOSPC; |
907 | } | 927 | } |
908 | 928 | ||
909 | info = IEEE80211_SKB_CB(skb); | 929 | info = IEEE80211_SKB_CB(skb); |
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c index d21c509325fe..c28220e401b9 100644 --- a/drivers/net/wireless/p54/p54pci.c +++ b/drivers/net/wireless/p54/p54pci.c | |||
@@ -332,13 +332,6 @@ static void p54p_tx(struct ieee80211_hw *dev, struct sk_buff *skb, | |||
332 | 332 | ||
333 | P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_UPDATE)); | 333 | P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_UPDATE)); |
334 | P54P_READ(dev_int); | 334 | P54P_READ(dev_int); |
335 | |||
336 | /* FIXME: unlikely to happen because the device usually runs out of | ||
337 | memory before we fill the ring up, but we can make it impossible */ | ||
338 | if (idx - device_idx > ARRAY_SIZE(ring_control->tx_data) - 2) { | ||
339 | p54_free_skb(dev, skb); | ||
340 | printk(KERN_INFO "%s: tx overflow.\n", wiphy_name(dev->wiphy)); | ||
341 | } | ||
342 | } | 335 | } |
343 | 336 | ||
344 | static void p54p_stop(struct ieee80211_hw *dev) | 337 | static void p54p_stop(struct ieee80211_hw *dev) |