mt7603: add mt7603_wtbl_set_skip_tx, change mt7603_wtbl_set_ps users

Avoids unnecessary toggling of the MT_WTBL1_OR_PSM_WRITE flag

Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Felix Fietkau
2018-11-16 12:28:30 +01:00
parent 13f1e82f6f
commit 90e2c1b616
3 changed files with 20 additions and 6 deletions
+16 -3
View File
@@ -160,8 +160,8 @@ void mt7603_wtbl_set_ps(struct mt7603_dev *dev, int idx, bool enabled)
{
u32 addr = mt7603_wtbl1_addr(idx);
u32 reg = mt76_rr(dev, addr + 3 * 4);
u32 val = (reg & ~MT_WTBL1_W3_SKIP_TX) |
(enabled * MT_WTBL1_W3_SKIP_TX);
u32 val = (reg & ~MT_WTBL1_W3_POWER_SAVE) |
(enabled * MT_WTBL1_W3_POWER_SAVE);
if (reg == val)
return;
@@ -171,6 +171,19 @@ void mt7603_wtbl_set_ps(struct mt7603_dev *dev, int idx, bool enabled)
mt76_clear(dev, MT_WTBL1_OR, MT_WTBL1_OR_PSM_WRITE);
}
void mt7603_wtbl_set_skip_tx(struct mt7603_dev *dev, int idx, bool enabled)
{
u32 addr = mt7603_wtbl1_addr(idx);
u32 reg = mt76_rr(dev, addr + 3 * 4);
u32 val = (reg & ~MT_WTBL1_W3_SKIP_TX) |
(enabled * MT_WTBL1_W3_SKIP_TX);
if (reg == val)
return;
mt76_wr(dev, addr + 3 * 4, val);
}
void mt7603_wtbl_clear(struct mt7603_dev *dev, int idx)
{
int wtbl2_frame_size = MT_PSE_PAGE_SIZE / MT_WTBL2_SIZE;
@@ -874,7 +887,7 @@ int mt7603_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
} else {
if (info->flags & (IEEE80211_TX_CTL_NO_PS_BUFFER |
IEEE80211_TX_CTL_CLEAR_PS_FILT))
mt7603_wtbl_set_ps(dev, wcid->idx, false);
mt7603_wtbl_set_skip_tx(dev, wcid->idx, false);
}
pid = mt76_tx_status_skb_add(mdev, wcid, skb);
+2 -2
View File
@@ -95,7 +95,7 @@ mt7603_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
eth_broadcast_addr(bc_addr);
mt7603_wtbl_init(dev, idx, mvif->idx, bc_addr);
mt7603_wtbl_set_ps(dev, idx, false);
mt7603_wtbl_set_skip_tx(dev, idx, false);
rcu_assign_pointer(dev->mt76.wcid[idx], &mvif->sta.wcid);
mt7603_txq_init(dev, vif->txq);
@@ -336,7 +336,7 @@ mt7603_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps)
int idx = msta->wcid.idx;
mt76_stop_tx_queues(&dev->mt76, sta, false);
mt7603_wtbl_set_ps(dev, idx, ps);
mt7603_wtbl_set_skip_tx(dev, idx, ps);
}
static int
+2 -1
View File
@@ -208,7 +208,8 @@ void mt7603_wtbl_set_rates(struct mt7603_dev *dev, struct mt7603_sta *sta,
struct ieee80211_tx_rate *rates);
int mt7603_wtbl_set_key(struct mt7603_dev *dev, int wcid,
struct ieee80211_key_conf *key);
void mt7603_wtbl_set_ps(struct mt7603_dev *dev, int idx, bool val);
void mt7603_wtbl_set_ps(struct mt7603_dev *dev, int idx, bool enabled);
void mt7603_wtbl_set_skip_tx(struct mt7603_dev *dev, int idx, bool val);
int mt7603_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
struct sk_buff *skb, struct mt76_queue *q,