From e87f925667a2c68e6a5a1f55e3a92c9e10570e61 Mon Sep 17 00:00:00 2001 From: Lorenzo Bianconi Date: Tue, 15 May 2018 12:08:14 +0200 Subject: [PATCH] mt76x2: apply coverage class on slot time too According to 802.11-2007 17.3.8.6 (slot time), the slot time should be increased by 3 us * coverage class. Taking into account coverage class in slot time configuration allows to increase by an order of magnitude the throughput on a 4Km link in a noisy environment Tested-by: Luca Bisti Tested-by: Gaetano Catalli Signed-off-by: Lorenzo Bianconi --- mt76x2_init.c | 3 +++ mt76x2_main.c | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mt76x2_init.c b/mt76x2_init.c index 4268e2bf..35f06aba 100644 --- a/mt76x2_init.c +++ b/mt76x2_init.c @@ -492,7 +492,10 @@ void mt76x2_set_tx_ackto(struct mt76x2_dev *dev) { u8 ackto, sifs, slottime = dev->slottime; + /* As defined by IEEE 802.11-2007 17.3.8.6 */ slottime += 3 * dev->coverage_class; + mt76_rmw_field(dev, MT_BKOFF_SLOT_CFG, + MT_BKOFF_SLOT_CFG_SLOTTIME, slottime); sifs = mt76_get_field(dev, MT_XIFS_TIME_CFG, MT_XIFS_TIME_CFG_OFDM_SIFS); diff --git a/mt76x2_main.c b/mt76x2_main.c index 5c0d1e12..826c2431 100644 --- a/mt76x2_main.c +++ b/mt76x2_main.c @@ -247,8 +247,7 @@ mt76x2_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int slottime = info->use_short_slot ? 9 : 20; dev->slottime = slottime; - mt76_rmw_field(dev, MT_BKOFF_SLOT_CFG, - MT_BKOFF_SLOT_CFG_SLOTTIME, slottime); + mt76x2_set_tx_ackto(dev); } mutex_unlock(&dev->mutex);