diff options
author | Felix Fietkau <nbd@nbd.name> | 2019-02-27 19:42:39 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2019-03-07 12:50:23 +0100 |
commit | 004960423fe17dfff93753017b7081dab36c7180 (patch) | |
tree | f7f0aadb89dbeda7e9d734683747e4dea751c5b1 /drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | |
parent | de3c2af15fce23c42407ad0a868ac47df2e7279a (diff) | |
download | linux-stable-004960423fe17dfff93753017b7081dab36c7180.tar.gz linux-stable-004960423fe17dfff93753017b7081dab36c7180.tar.bz2 linux-stable-004960423fe17dfff93753017b7081dab36c7180.zip |
mt76: mt76x2: implement full device restart on watchdog reset
Restart the firmware and re-initialize the MAC to be able to recover
from more kinds of hang states
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 | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c index 8109bac5aee6..e1e0c8da5a8c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c @@ -67,6 +67,32 @@ int mt76x02_mac_shared_key_setup(struct mt76x02_dev *dev, u8 vif_idx, } EXPORT_SYMBOL_GPL(mt76x02_mac_shared_key_setup); +void mt76x02_mac_wcid_sync_pn(struct mt76x02_dev *dev, u8 idx, + struct ieee80211_key_conf *key) +{ + enum mt76x02_cipher_type cipher; + u8 key_data[32]; + u32 iv, eiv; + u64 pn; + + cipher = mt76x02_mac_get_key_info(key, key_data); + iv = mt76_rr(dev, MT_WCID_IV(idx)); + eiv = mt76_rr(dev, MT_WCID_IV(idx) + 4); + + pn = (u64)eiv << 16; + if (cipher == MT_CIPHER_TKIP) { + pn |= (iv >> 16) & 0xff; + pn |= (iv & 0xff) << 8; + } else if (cipher >= MT_CIPHER_AES_CCMP) { + pn |= iv & 0xffff; + } else { + return; + } + + atomic64_set(&key->tx_pn, pn); +} + + int mt76x02_mac_wcid_set_key(struct mt76x02_dev *dev, u8 idx, struct ieee80211_key_conf *key) { |