Commit 79ee6565 authored by Andrea Merello's avatar Andrea Merello Committed by John W. Linville

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: default avatarAndrea Merello <andrea.merello@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent d7ffd588
......@@ -742,35 +742,49 @@ static void rtl8180_int_disable(struct ieee80211_hw *dev)
}
static void rtl8180_conf_basic_rates(struct ieee80211_hw *dev,
u32 rates_mask)
u32 basic_mask)
{
struct rtl8180_priv *priv = dev->priv;
u8 max, min;
u16 reg;
max = fls(rates_mask) - 1;
min = ffs(rates_mask) - 1;
u32 resp_mask;
u8 basic_max;
u8 resp_max, resp_min;
resp_mask = basic_mask;
/* IEEE80211 says the response rate should be equal to the highest basic
* rate that is not faster than received frame. But it says also that if
* the basic rate set does not contains any rate for the current
* modulation class then mandatory rate set must be used for that
* modulation class. Eventually add OFDM mandatory rates..
*/
if ((resp_mask & 0xf) == resp_mask)
resp_mask |= 0x150; /* 6, 12, 24Mbps */
switch (priv->chip_family) {
case RTL818X_CHIP_FAMILY_RTL8180:
/* in 8180 this is NOT a BITMAP */
basic_max = fls(basic_mask) - 1;
reg = rtl818x_ioread16(priv, &priv->map->BRSR);
reg &= ~3;
reg |= max;
reg |= basic_max;
rtl818x_iowrite16(priv, &priv->map->BRSR, reg);
break;
case RTL818X_CHIP_FAMILY_RTL8185:
resp_max = fls(resp_mask) - 1;
resp_min = ffs(resp_mask) - 1;
/* in 8185 this is a BITMAP */
rtl818x_iowrite16(priv, &priv->map->BRSR, rates_mask);
rtl818x_iowrite8(priv, &priv->map->RESP_RATE, (max << 4) | min);
rtl818x_iowrite16(priv, &priv->map->BRSR, basic_mask);
rtl818x_iowrite8(priv, &priv->map->RESP_RATE, (resp_max << 4) |
resp_min);
break;
case RTL818X_CHIP_FAMILY_RTL8187SE:
/* in 8187se this is a BITMAP */
rtl818x_iowrite16(priv, &priv->map->BRSR_8187SE, rates_mask);
/* in 8187se this is a BITMAP. BRSR reg actually sets
* response rates.
*/
rtl818x_iowrite16(priv, &priv->map->BRSR_8187SE, resp_mask);
break;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment