diff options
author | Larry Finger <Larry.Finger@lwfinger.net> | 2011-03-01 00:36:09 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-03-04 14:05:17 -0500 |
commit | 6410db593e8c1b2b79a2f18554310d6da9415584 (patch) | |
tree | 9d36f25f767d269815509165e2b2af8cb316cf4c | |
parent | 1ffe4dd126bcad84f0701ca271a7f10494d0c2c8 (diff) |
rtl8187: Change rate-control feedback
The driver for the RTL8187L chips returns IEEE80211_TX_STAT_ACK for all
packets, even if the maximum number of retries was exhausted. In addition
it fails to setup max_rates in the ieee80211_hw struct, This behavior
may be responsible for the problems noted in Bug 14168. As the bug is very
old, testers have not been found, and I do not have the case where the
indicated signal is less than -70 dBm.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Acked-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Cc: Stable <stable@kernel.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/rtl818x/rtl8187/dev.c | 25 | ||||
-rw-r--r-- | drivers/net/wireless/rtl818x/rtl8187/rtl8187.h | 2 |
2 files changed, 22 insertions, 5 deletions
diff --git a/drivers/net/wireless/rtl818x/rtl8187/dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c index c5a5e788f25f..1e0be14d10d4 100644 --- a/drivers/net/wireless/rtl818x/rtl8187/dev.c +++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c | |||
@@ -869,23 +869,35 @@ static void rtl8187_work(struct work_struct *work) | |||
869 | /* The RTL8187 returns the retry count through register 0xFFFA. In | 869 | /* The RTL8187 returns the retry count through register 0xFFFA. In |
870 | * addition, it appears to be a cumulative retry count, not the | 870 | * addition, it appears to be a cumulative retry count, not the |
871 | * value for the current TX packet. When multiple TX entries are | 871 | * value for the current TX packet. When multiple TX entries are |
872 | * queued, the retry count will be valid for the last one in the queue. | 872 | * waiting in the queue, the retry count will be the total for all. |
873 | * The "error" should not matter for purposes of rate setting. */ | 873 | * The "error" may matter for purposes of rate setting, but there is |
874 | * no other choice with this hardware. | ||
875 | */ | ||
874 | struct rtl8187_priv *priv = container_of(work, struct rtl8187_priv, | 876 | struct rtl8187_priv *priv = container_of(work, struct rtl8187_priv, |
875 | work.work); | 877 | work.work); |
876 | struct ieee80211_tx_info *info; | 878 | struct ieee80211_tx_info *info; |
877 | struct ieee80211_hw *dev = priv->dev; | 879 | struct ieee80211_hw *dev = priv->dev; |
878 | static u16 retry; | 880 | static u16 retry; |
879 | u16 tmp; | 881 | u16 tmp; |
882 | u16 avg_retry; | ||
883 | int length; | ||
880 | 884 | ||
881 | mutex_lock(&priv->conf_mutex); | 885 | mutex_lock(&priv->conf_mutex); |
882 | tmp = rtl818x_ioread16(priv, (__le16 *)0xFFFA); | 886 | tmp = rtl818x_ioread16(priv, (__le16 *)0xFFFA); |
887 | length = skb_queue_len(&priv->b_tx_status.queue); | ||
888 | if (unlikely(!length)) | ||
889 | length = 1; | ||
890 | if (unlikely(tmp < retry)) | ||
891 | tmp = retry; | ||
892 | avg_retry = (tmp - retry) / length; | ||
883 | while (skb_queue_len(&priv->b_tx_status.queue) > 0) { | 893 | while (skb_queue_len(&priv->b_tx_status.queue) > 0) { |
884 | struct sk_buff *old_skb; | 894 | struct sk_buff *old_skb; |
885 | 895 | ||
886 | old_skb = skb_dequeue(&priv->b_tx_status.queue); | 896 | old_skb = skb_dequeue(&priv->b_tx_status.queue); |
887 | info = IEEE80211_SKB_CB(old_skb); | 897 | info = IEEE80211_SKB_CB(old_skb); |
888 | info->status.rates[0].count = tmp - retry + 1; | 898 | info->status.rates[0].count = avg_retry + 1; |
899 | if (info->status.rates[0].count > RETRY_COUNT) | ||
900 | info->flags &= ~IEEE80211_TX_STAT_ACK; | ||
889 | ieee80211_tx_status_irqsafe(dev, old_skb); | 901 | ieee80211_tx_status_irqsafe(dev, old_skb); |
890 | } | 902 | } |
891 | retry = tmp; | 903 | retry = tmp; |
@@ -931,8 +943,8 @@ static int rtl8187_start(struct ieee80211_hw *dev) | |||
931 | rtl818x_iowrite32(priv, &priv->map->TX_CONF, | 943 | rtl818x_iowrite32(priv, &priv->map->TX_CONF, |
932 | RTL818X_TX_CONF_HW_SEQNUM | | 944 | RTL818X_TX_CONF_HW_SEQNUM | |
933 | RTL818X_TX_CONF_DISREQQSIZE | | 945 | RTL818X_TX_CONF_DISREQQSIZE | |
934 | (7 << 8 /* short retry limit */) | | 946 | (RETRY_COUNT << 8 /* short retry limit */) | |
935 | (7 << 0 /* long retry limit */) | | 947 | (RETRY_COUNT << 0 /* long retry limit */) | |
936 | (7 << 21 /* MAX TX DMA */)); | 948 | (7 << 21 /* MAX TX DMA */)); |
937 | rtl8187_init_urbs(dev); | 949 | rtl8187_init_urbs(dev); |
938 | rtl8187b_init_status_urb(dev); | 950 | rtl8187b_init_status_urb(dev); |
@@ -1376,6 +1388,9 @@ static int __devinit rtl8187_probe(struct usb_interface *intf, | |||
1376 | dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | | 1388 | dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | |
1377 | IEEE80211_HW_SIGNAL_DBM | | 1389 | IEEE80211_HW_SIGNAL_DBM | |
1378 | IEEE80211_HW_RX_INCLUDES_FCS; | 1390 | IEEE80211_HW_RX_INCLUDES_FCS; |
1391 | /* Initialize rate-control variables */ | ||
1392 | dev->max_rates = 1; | ||
1393 | dev->max_rate_tries = RETRY_COUNT; | ||
1379 | 1394 | ||
1380 | eeprom.data = dev; | 1395 | eeprom.data = dev; |
1381 | eeprom.register_read = rtl8187_eeprom_register_read; | 1396 | eeprom.register_read = rtl8187_eeprom_register_read; |
diff --git a/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h b/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h index 0d7b1423f77b..f1cc90751dbf 100644 --- a/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h +++ b/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h | |||
@@ -35,6 +35,8 @@ | |||
35 | #define RFKILL_MASK_8187_89_97 0x2 | 35 | #define RFKILL_MASK_8187_89_97 0x2 |
36 | #define RFKILL_MASK_8198 0x4 | 36 | #define RFKILL_MASK_8198 0x4 |
37 | 37 | ||
38 | #define RETRY_COUNT 7 | ||
39 | |||
38 | struct rtl8187_rx_info { | 40 | struct rtl8187_rx_info { |
39 | struct urb *urb; | 41 | struct urb *urb; |
40 | struct ieee80211_hw *dev; | 42 | struct ieee80211_hw *dev; |