mt76: mt7603: store software PN/IV in wcid

Avoids expensive 64-bit atomic access in the data path

Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Felix Fietkau
2019-03-16 20:11:42 +01:00
parent 42ce040662
commit 2660aa98c4
2 changed files with 6 additions and 1 deletions
+5 -1
View File
@@ -924,7 +924,11 @@ mt7603_mac_write_txwi(struct mt7603_dev *dev, __le32 *txwi,
txwi[3] = cpu_to_le32(val);
if (key) {
u64 pn = atomic64_inc_return(&key->tx_pn);
u64 pn;
spin_lock(&dev->mt76.lock);
pn = ++wcid->tx_pn;
spin_unlock(&dev->mt76.lock);
txwi[3] |= cpu_to_le32(MT_TXD3_PN_VALID);
txwi[4] = cpu_to_le32(pn & GENMASK(31, 0));
+1
View File
@@ -472,6 +472,7 @@ mt7603_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
if (cmd == SET_KEY) {
key->hw_key_idx = wcid->idx;
wcid->hw_key_idx = idx;
wcid->tx_pn = atomic64_read(&key->tx_pn);
} else {
if (idx == wcid->hw_key_idx)
wcid->hw_key_idx = -1;