Skip to content

Commit

Permalink
mt76: mt76x02: remove mt76x02_txq_init
Browse files Browse the repository at this point in the history
Open-coding it simplifies the code

Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
nbd168 committed Nov 16, 2018
1 parent e65ad4c commit 7b1373e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 28 deletions.
23 changes: 0 additions & 23 deletions mt76x02_mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,29 +126,6 @@ void mt76x02_mac_wcid_set_drop(struct mt76x02_dev *dev, u8 idx, bool drop)
mt76_wr(dev, MT_WCID_DROP(idx), (val & ~bit) | (bit * drop));
}

void mt76x02_txq_init(struct mt76x02_dev *dev, struct ieee80211_txq *txq)
{
struct mt76_txq *mtxq;

if (!txq)
return;

mtxq = (struct mt76_txq *) txq->drv_priv;
if (txq->sta) {
struct mt76x02_sta *sta;

sta = (struct mt76x02_sta *) txq->sta->drv_priv;
mtxq->wcid = &sta->wcid;
} else {
struct mt76x02_vif *mvif;

mvif = (struct mt76x02_vif *) txq->vif->drv_priv;
mtxq->wcid = &mvif->group_wcid;
}

mt76_txq_init(&dev->mt76, txq);
}

static __le16
mt76x02_mac_tx_rate_val(struct mt76x02_dev *dev,
const struct ieee80211_tx_rate *rate, u8 *nss_val)
Expand Down
2 changes: 0 additions & 2 deletions mt76x02_mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ static inline bool mt76x02_wait_for_mac(struct mt76_dev *dev)
return false;
}

void mt76x02_txq_init(struct mt76x02_dev *dev, struct ieee80211_txq *txq);

void mt76x02_mac_set_short_preamble(struct mt76x02_dev *dev, bool enable);
int mt76x02_mac_shared_key_setup(struct mt76x02_dev *dev, u8 vif_idx,
u8 key_idx, struct ieee80211_key_conf *key);
Expand Down
15 changes: 12 additions & 3 deletions mt76x02_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,13 @@ int mt76x02_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
msta->wcid.hw_key_idx = -1;
mt76x02_mac_wcid_setup(dev, idx, mvif->idx, sta->addr);
mt76x02_mac_wcid_set_drop(dev, idx, false);
for (i = 0; i < ARRAY_SIZE(sta->txq); i++)
mt76x02_txq_init(dev, sta->txq[i]);
for (i = 0; i < ARRAY_SIZE(sta->txq); i++) {
struct mt76_txq *mtxq;

mtxq = (struct mt76_txq *) sta->txq[i]->drv_priv;
mtxq->wcid = &msta->wcid;
mt76_txq_init(&dev->mt76, sta->txq[i]);
}

if (vif->type == NL80211_IFTYPE_AP)
set_bit(MT_WCID_FLAG_CHECK_PS, &msta->wcid.flags);
Expand Down Expand Up @@ -230,11 +235,15 @@ void mt76x02_vif_init(struct mt76x02_dev *dev, struct ieee80211_vif *vif,
unsigned int idx)
{
struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv;
struct mt76_txq *mtxq;

mvif->idx = idx;
mvif->group_wcid.idx = MT_VIF_WCID(idx);
mvif->group_wcid.hw_key_idx = -1;
mt76x02_txq_init(dev, vif->txq);
mtxq = (struct mt76_txq *) vif->txq->drv_priv;
mtxq->wcid = &mvif->group_wcid;

mt76_txq_init(&dev->mt76, vif->txq);
}
EXPORT_SYMBOL_GPL(mt76x02_vif_init);

Expand Down

0 comments on commit 7b1373e

Please sign in to comment.