diff options
author | Felix Fietkau <nbd@nbd.name> | 2019-02-18 20:29:11 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2019-02-18 20:41:50 +0100 |
commit | 9f688473408b6334c5da5ec085f9ea1954675fe7 (patch) | |
tree | cdc970776664de59459ee5f3aa11624e1ecbc8e3 /drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | |
parent | f2f6a47b504b8fe19922e835231552a01ef30e01 (diff) | |
download | linux-stable-9f688473408b6334c5da5ec085f9ea1954675fe7.tar.gz linux-stable-9f688473408b6334c5da5ec085f9ea1954675fe7.tar.bz2 linux-stable-9f688473408b6334c5da5ec085f9ea1954675fe7.zip |
mt76: mt76x2: simplify per-chain signal strength handling
There is no need to use a for loop here, supported chips can only support
up to 2 chains.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt76x02_mac.c')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c index eab713723b7e..be2979f34f31 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c @@ -608,7 +608,7 @@ int mt76x02_mac_process_rx(struct mt76x02_dev *dev, struct sk_buff *skb, u16 rate = le16_to_cpu(rxwi->rate); u16 tid_sn = le16_to_cpu(rxwi->tid_sn); bool unicast = rxwi->rxinfo & cpu_to_le32(MT_RXINFO_UNICAST); - int i, pad_len = 0, nstreams = dev->mt76.chainmask & 0xf; + int pad_len = 0, nstreams = dev->mt76.chainmask & 0xf; s8 signal; u8 pn_len; u8 wcid; @@ -668,12 +668,13 @@ int mt76x02_mac_process_rx(struct mt76x02_dev *dev, struct sk_buff *skb, status->chains = BIT(0); signal = mt76x02_mac_get_rssi(dev, rxwi->rssi[0], 0); - for (i = 0; i < nstreams; i++) { - status->chains |= BIT(i); - status->chain_signal[i] = mt76x02_mac_get_rssi(dev, - rxwi->rssi[i], - i); - signal = max_t(s8, signal, status->chain_signal[i]); + status->chain_signal[0] = signal; + if (nstreams > 1) { + status->chains |= BIT(1); + status->chain_signal[1] = mt76x02_mac_get_rssi(dev, + rxwi->rssi[1], + 1); + signal = max_t(s8, signal, status->chain_signal[1]); } status->signal = signal; status->freq = dev->mt76.chandef.chan->center_freq; |