mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
mt76x2: add helper function for setting drop mask
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
@@ -145,6 +145,16 @@ mt76x2_mac_tx_rate_val(struct mt76x2_dev *dev,
|
||||
return cpu_to_le16(rateval);
|
||||
}
|
||||
|
||||
void mt76x2_mac_wcid_set_drop(struct mt76x2_dev *dev, u8 idx, bool drop)
|
||||
{
|
||||
u32 val = mt76_rr(dev, MT_WCID_DROP(idx));
|
||||
u32 bit = MT_WCID_DROP_MASK(idx);
|
||||
|
||||
/* prevent unnecessary writes */
|
||||
if ((val & bit) != (bit * drop))
|
||||
mt76_wr(dev, MT_WCID_DROP(idx), (val & ~bit) | (bit * drop));
|
||||
}
|
||||
|
||||
void mt76x2_mac_wcid_set_rate(struct mt76x2_dev *dev, struct mt76_wcid *wcid,
|
||||
const struct ieee80211_tx_rate *rate)
|
||||
{
|
||||
|
||||
@@ -173,6 +173,7 @@ int mt76x2_mac_wcid_set_key(struct mt76x2_dev *dev, u8 idx,
|
||||
struct ieee80211_key_conf *key);
|
||||
void mt76x2_mac_wcid_set_rate(struct mt76x2_dev *dev, struct mt76_wcid *wcid,
|
||||
const struct ieee80211_tx_rate *rate);
|
||||
void mt76x2_mac_wcid_set_drop(struct mt76x2_dev *dev, u8 idx, bool drop);
|
||||
|
||||
int mt76x2_mac_shared_key_setup(struct mt76x2_dev *dev, u8 vif_idx, u8 key_idx,
|
||||
struct ieee80211_key_conf *key);
|
||||
|
||||
+4
-4
@@ -263,7 +263,7 @@ mt76x2_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
||||
msta->wcid.idx = idx;
|
||||
msta->wcid.hw_key_idx = -1;
|
||||
mt76x2_mac_wcid_setup(dev, idx, mvif->idx, sta->addr);
|
||||
mt76_clear(dev, MT_WCID_DROP(idx), MT_WCID_DROP_MASK(idx));
|
||||
mt76x2_mac_wcid_set_drop(dev, idx, false);
|
||||
for (i = 0; i < ARRAY_SIZE(sta->txq); i++)
|
||||
mt76x2_txq_init(dev, sta->txq[i]);
|
||||
|
||||
@@ -288,7 +288,7 @@ mt76x2_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
||||
rcu_assign_pointer(dev->wcid[idx], NULL);
|
||||
for (i = 0; i < ARRAY_SIZE(sta->txq); i++)
|
||||
mt76_txq_remove(&dev->mt76, sta->txq[i]);
|
||||
mt76_set(dev, MT_WCID_DROP(idx), MT_WCID_DROP_MASK(idx));
|
||||
mt76x2_mac_wcid_set_drop(dev, idx, true);
|
||||
mt76_wcid_free(dev->wcid_mask, idx);
|
||||
mt76x2_mac_wcid_setup(dev, idx, 0, NULL);
|
||||
mutex_unlock(&dev->mutex);
|
||||
@@ -306,11 +306,11 @@ mt76x2_sta_notify(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
||||
|
||||
switch (cmd) {
|
||||
case STA_NOTIFY_SLEEP:
|
||||
mt76_set(dev, MT_WCID_DROP(idx), MT_WCID_DROP_MASK(idx));
|
||||
mt76x2_mac_wcid_set_drop(dev, idx, true);
|
||||
mt76_stop_tx_queues(&dev->mt76, sta, true);
|
||||
break;
|
||||
case STA_NOTIFY_AWAKE:
|
||||
mt76_clear(dev, MT_WCID_DROP(idx), MT_WCID_DROP_MASK(idx));
|
||||
mt76x2_mac_wcid_set_drop(dev, idx, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user