mt76: mt7603: add upper limit for dynamic sensitivity minimum receive power
authorFelix Fietkau <nbd@nbd.name>
Sat, 22 Feb 2020 09:02:21 +0000 (10:02 +0100)
committerFelix Fietkau <nbd@nbd.name>
Tue, 17 Mar 2020 16:13:59 +0000 (17:13 +0100)
If the minimum power is raised too much, it can make it impossible for weaker
clients to connect, and there are some scenarios where the false detects will
not go down no matter how much the sensitivity is adjusted.
Fixes connectivity issues in some rare cases

Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7603/debugfs.c
drivers/net/wireless/mediatek/mt76/mt7603/init.c
drivers/net/wireless/mediatek/mt76/mt7603/mac.c
drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h

index 47c85a9fac289c3c92544c3d8eb1a60bf643b74f..a84e801d4cf0b43804831459a16ea72efadfdb1e 100644 (file)
@@ -121,4 +121,6 @@ void mt7603_init_debugfs(struct mt7603_dev *dev)
                                    mt7603_reset_read);
        debugfs_create_devm_seqfile(dev->mt76.dev, "radio", dir,
                                    mt7603_radio_read);
+       debugfs_create_u8("sensitivity_limit", 0600, dir,
+                           &dev->sensitivity_limit);
 }
index 9e40e81bcc2920a12308a3b977b5a97053072afb..97ba5ddc44bb2c7f6e66e03d7ef1a1ba8190c0b6 100644 (file)
@@ -540,6 +540,7 @@ int mt7603_register_device(struct mt7603_dev *dev)
                dev->mphy.antenna_mask = 1;
 
        dev->slottime = 9;
+       dev->sensitivity_limit = 28;
 
        ret = mt7603_init_hardware(dev);
        if (ret)
index 8f5ca9283f7d9f3cfd125941089d1f68ce0c2d04..a3daae41f2f46ea4d21090629993d7e5489061d4 100644 (file)
@@ -1750,7 +1750,8 @@ mt7603_false_cca_check(struct mt7603_dev *dev)
        min_signal -= 15;
 
        false_cca = dev->false_cca_ofdm + dev->false_cca_cck;
-       if (false_cca > 600) {
+       if (false_cca > 600 &&
+           dev->sensitivity < -100 + dev->sensitivity_limit) {
                if (!dev->sensitivity)
                        dev->sensitivity = -92;
                else
index ef374641fe805940487244c6989d72ec3a4f0b85..831a269472b3af1216eb608afa0a11883a611b69 100644 (file)
@@ -143,6 +143,7 @@ struct mt7603_dev {
        u8 ed_strong_signal;
 
        s8 sensitivity;
+       u8 sensitivity_limit;
 
        u8 beacon_check;
        u8 tx_hang_check;