mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
mt76: mt76x02: 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:
@@ -220,6 +220,8 @@ struct mt76_wcid {
|
||||
u8 rx_key_pn[IEEE80211_NUM_TIDS][6];
|
||||
|
||||
u32 tx_info;
|
||||
|
||||
u64 tx_pn;
|
||||
bool sw_iv;
|
||||
|
||||
u8 packet_id;
|
||||
|
||||
+6
-1
@@ -352,7 +352,12 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
|
||||
txwi->wcid = 0xff;
|
||||
|
||||
if (wcid && wcid->sw_iv && 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);
|
||||
|
||||
ccmp_pn[0] = pn;
|
||||
ccmp_pn[1] = pn >> 8;
|
||||
ccmp_pn[2] = 0;
|
||||
|
||||
+5
-2
@@ -421,10 +421,13 @@ static void mt76x02_key_sync(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
||||
|
||||
wcid = (struct mt76_wcid *) sta->drv_priv;
|
||||
|
||||
if (wcid->hw_key_idx != key->keyidx || wcid->sw_iv)
|
||||
if (wcid->hw_key_idx != key->keyidx)
|
||||
return;
|
||||
|
||||
mt76x02_mac_wcid_sync_pn(dev, wcid->idx, key);
|
||||
if (wcid->sw_iv)
|
||||
atomic64_set(&key->tx_pn, wcid->tx_pn);
|
||||
else
|
||||
mt76x02_mac_wcid_sync_pn(dev, wcid->idx, key);
|
||||
}
|
||||
|
||||
static void mt76x02_reset_state(struct mt76x02_dev *dev)
|
||||
|
||||
@@ -433,6 +433,7 @@ int mt76x02_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
|
||||
if (key->flags & IEEE80211_KEY_FLAG_RX_MGMT) {
|
||||
key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX;
|
||||
wcid->sw_iv = true;
|
||||
wcid->tx_pn = atomic64_read(&key->tx_pn);
|
||||
}
|
||||
} else {
|
||||
if (idx == wcid->hw_key_idx) {
|
||||
|
||||
Reference in New Issue
Block a user