aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Merello <andrea.merello@gmail.com>2014-10-06 14:23:55 -0400
committerJohn W. Linville <linville@tuxdriver.com>2014-10-07 14:48:37 -0400
commit79ee65659e116a49c81f63480a7672b7cbafa323 (patch)
tree84eec82afc5003e0fedd761b0f543315be719652
parentd7ffd588f00ef2d9d0f3acc569ddbaebe5c4f8c3 (diff)
rtl818x_pci: fix response rate may be incorrect.
Currently the allowed "respose rate" set (rates for HW generated frames like ACKs) is the same as the basic rate set. The HW will use the higher allowed response rate that is lower than the rate of the received frame. This is more or less what IEEE80211 mandates, but I missed the fact that IEEE80211 also says that whenever it happens that for a modulation class there is no any rate in the basic rates set, then the response rate set shall include also all the mandatory rates for that modulation class. This patch adds mandatory OFDM rates to the allowed response rate set if no OFDM rate is included in the basic rate set. Depending by the AP, I faced cases in which this patch seems to cause a noticeable perfomance improvement. - With my usual test AP there is no particular perfomance difference. - With a prism54/hostapd AP this patch causes RX thoughput increase from about 5Mbps to about 20Mbps. Hopefully this patch may help people that faced performance regression wrt the old staging driver. Signed-off-by: Andrea Merello <andrea.merello@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180/dev.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/drivers/net/wireless/rtl818x/rtl8180/dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c
index ded967aa6ecb..706b844bce00 100644
--- a/drivers/net/wireless/rtl818x/rtl8180/dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c
@@ -742,35 +742,49 @@ static void rtl8180_int_disable(struct ieee80211_hw *dev)
742} 742}
743 743
744static void rtl8180_conf_basic_rates(struct ieee80211_hw *dev, 744static void rtl8180_conf_basic_rates(struct ieee80211_hw *dev,
745 u32 rates_mask) 745 u32 basic_mask)
746{ 746{
747 struct rtl8180_priv *priv = dev->priv; 747 struct rtl8180_priv *priv = dev->priv;
748
749 u8 max, min;
750 u16 reg; 748 u16 reg;
751 749 u32 resp_mask;
752 max = fls(rates_mask) - 1; 750 u8 basic_max;
753 min = ffs(rates_mask) - 1; 751 u8 resp_max, resp_min;
752
753 resp_mask = basic_mask;
754 /* IEEE80211 says the response rate should be equal to the highest basic
755 * rate that is not faster than received frame. But it says also that if
756 * the basic rate set does not contains any rate for the current
757 * modulation class then mandatory rate set must be used for that
758 * modulation class. Eventually add OFDM mandatory rates..
759 */
760 if ((resp_mask & 0xf) == resp_mask)
761 resp_mask |= 0x150; /* 6, 12, 24Mbps */
754 762
755 switch (priv->chip_family) { 763 switch (priv->chip_family) {
756 764
757 case RTL818X_CHIP_FAMILY_RTL8180: 765 case RTL818X_CHIP_FAMILY_RTL8180:
758 /* in 8180 this is NOT a BITMAP */ 766 /* in 8180 this is NOT a BITMAP */
767 basic_max = fls(basic_mask) - 1;
759 reg = rtl818x_ioread16(priv, &priv->map->BRSR); 768 reg = rtl818x_ioread16(priv, &priv->map->BRSR);
760 reg &= ~3; 769 reg &= ~3;
761 reg |= max; 770 reg |= basic_max;
762 rtl818x_iowrite16(priv, &priv->map->BRSR, reg); 771 rtl818x_iowrite16(priv, &priv->map->BRSR, reg);
763 break; 772 break;
764 773
765 case RTL818X_CHIP_FAMILY_RTL8185: 774 case RTL818X_CHIP_FAMILY_RTL8185:
775 resp_max = fls(resp_mask) - 1;
776 resp_min = ffs(resp_mask) - 1;
766 /* in 8185 this is a BITMAP */ 777 /* in 8185 this is a BITMAP */
767 rtl818x_iowrite16(priv, &priv->map->BRSR, rates_mask); 778 rtl818x_iowrite16(priv, &priv->map->BRSR, basic_mask);
768 rtl818x_iowrite8(priv, &priv->map->RESP_RATE, (max << 4) | min); 779 rtl818x_iowrite8(priv, &priv->map->RESP_RATE, (resp_max << 4) |
780 resp_min);
769 break; 781 break;
770 782
771 case RTL818X_CHIP_FAMILY_RTL8187SE: 783 case RTL818X_CHIP_FAMILY_RTL8187SE:
772 /* in 8187se this is a BITMAP */ 784 /* in 8187se this is a BITMAP. BRSR reg actually sets
773 rtl818x_iowrite16(priv, &priv->map->BRSR_8187SE, rates_mask); 785 * response rates.
786 */
787 rtl818x_iowrite16(priv, &priv->map->BRSR_8187SE, resp_mask);
774 break; 788 break;
775 } 789 }
776} 790}