@@ -1554,26 +1554,6 @@ mt76_sta_add(struct mt76_phy *phy, struct ieee80211_vif *vif,
return ret;
}
-void __mt76_sta_remove(struct mt76_phy *phy, struct ieee80211_vif *vif,
- struct ieee80211_sta *sta)
-{
- struct mt76_dev *dev = phy->dev;
- struct mt76_wcid *wcid = (struct mt76_wcid *)sta->drv_priv;
- int i, idx = wcid->idx;
-
- for (i = 0; i < ARRAY_SIZE(wcid->aggr); i++)
- mt76_rx_aggr_stop(dev, wcid, i);
-
- if (dev->drv->sta_remove)
- dev->drv->sta_remove(dev, vif, sta);
-
- mt76_wcid_cleanup(dev, wcid);
-
- mt76_wcid_mask_clear(dev->wcid_mask, idx);
- phy->num_sta--;
-}
-EXPORT_SYMBOL_GPL(__mt76_sta_remove);
-
static void
mt76_sta_remove(struct mt76_phy *phy, struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
@@ -1581,7 +1561,9 @@ mt76_sta_remove(struct mt76_phy *phy, struct ieee80211_vif *vif,
struct mt76_dev *dev = phy->dev;
mutex_lock(&dev->mutex);
- __mt76_sta_remove(phy, vif, sta);
+ if (dev->drv->sta_remove)
+ dev->drv->sta_remove(dev, vif, sta);
+ phy->num_sta--;
mutex_unlock(&dev->mutex);
}
@@ -1484,8 +1484,6 @@ int mt76_sta_state(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
enum ieee80211_sta_state old_state,
enum ieee80211_sta_state new_state);
-void __mt76_sta_remove(struct mt76_phy *phy, struct ieee80211_vif *vif,
- struct ieee80211_sta *sta);
void mt76_sta_pre_rcu_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_sta *sta);
@@ -378,6 +378,10 @@ mt7603_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct mt7603_vif *mvif = (struct mt7603_vif *)vif->drv_priv;
struct mt7603_sta *msta = (struct mt7603_sta *)sta->drv_priv;
struct mt76_wcid *wcid = (struct mt76_wcid *)sta->drv_priv;
+ int i, idx = wcid->idx;
+
+ for (i = 0; i < ARRAY_SIZE(wcid->aggr); i++)
+ mt76_rx_aggr_stop(mdev, wcid, i);
spin_lock_bh(&dev->ps_lock);
__skb_queue_purge(&msta->psq);
@@ -390,6 +394,9 @@ mt7603_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
spin_unlock_bh(&mdev->sta_poll_lock);
mt7603_wtbl_clear(dev, wcid->idx);
+
+ mt76_wcid_cleanup(mdev, wcid);
+ mt76_wcid_mask_clear(mdev->wcid_mask, idx);
}
static void
@@ -679,8 +679,12 @@ void mt7615_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76);
struct mt7615_sta *msta = (struct mt7615_sta *)sta->drv_priv;
struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;
+ int i, idx = msta->wcid.idx;
struct mt7615_phy *phy;
+ for (i = 0; i < ARRAY_SIZE(msta->wcid.aggr); i++)
+ mt76_rx_aggr_stop(mdev, &msta->wcid, i);
+
mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->wcid);
phy = mvif->mt76.band_idx ? mt7615_ext_phy(dev) : &dev->phy;
@@ -698,6 +702,9 @@ void mt7615_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
spin_unlock_bh(&mdev->sta_poll_lock);
mt76_connac_power_save_sched(phy->mt76, &dev->pm);
+
+ mt76_wcid_cleanup(mdev, &msta->wcid);
+ mt76_wcid_mask_clear(mdev->wcid_mask, idx);
}
EXPORT_SYMBOL_GPL(mt7615_mac_sta_remove);
@@ -423,7 +423,7 @@ static void mt76x02_reset_state(struct mt76x02_dev *dev)
priv = msta->vif;
vif = container_of(priv, struct ieee80211_vif, drv_priv);
- __mt76_sta_remove(&dev->mphy, vif, sta);
+ mt76x02_sta_remove(&dev->mt76, vif, sta);
memset(msta, 0, sizeof(*msta));
}
@@ -271,10 +271,16 @@ void mt76x02_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
{
struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76);
struct mt76_wcid *wcid = (struct mt76_wcid *)sta->drv_priv;
- int idx = wcid->idx;
+ int i, idx = wcid->idx;
+
+ for (i = 0; i < ARRAY_SIZE(wcid->aggr); i++)
+ mt76_rx_aggr_stop(mdev, wcid, i);
mt76x02_mac_wcid_set_drop(dev, idx, true);
mt76x02_mac_wcid_setup(dev, idx, 0, NULL);
+
+ mt76_wcid_cleanup(mdev, wcid);
+ mt76_wcid_mask_clear(mdev->wcid_mask, idx);
}
EXPORT_SYMBOL_GPL(mt76x02_sta_remove);
@@ -868,6 +868,10 @@ void mt7915_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
{
struct mt7915_dev *dev = container_of(mdev, struct mt7915_dev, mt76);
struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
+ int i, idx = msta->wcid.idx;
+
+ for (i = 0; i < ARRAY_SIZE(msta->wcid.aggr); i++)
+ mt76_rx_aggr_stop(mdev, &msta->wcid, i);
mt7915_mac_wtbl_update(dev, msta->wcid.idx,
MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
@@ -878,6 +882,9 @@ void mt7915_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
if (!list_empty(&msta->rc_list))
list_del_init(&msta->rc_list);
spin_unlock_bh(&mdev->sta_poll_lock);
+
+ mt76_wcid_cleanup(mdev, &msta->wcid);
+ mt76_wcid_mask_clear(mdev->wcid_mask, idx);
}
static void mt7915_tx(struct ieee80211_hw *hw,
@@ -871,6 +871,10 @@ void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
{
struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
+ int i, idx = msta->deflink.wcid.idx;
+
+ for (i = 0; i < ARRAY_SIZE(msta->deflink.wcid.aggr); i++)
+ mt76_rx_aggr_stop(mdev, &msta->deflink.wcid, i);
mt7921_roc_abort_sync(dev);
mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->deflink.wcid);
@@ -899,6 +903,9 @@ void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
mt7921_regd_set_6ghz_power_type(vif, false);
mt76_connac_power_save_sched(&dev->mphy, &dev->pm);
+
+ mt76_wcid_cleanup(mdev, &msta->deflink.wcid);
+ mt76_wcid_mask_clear(mdev->wcid_mask, idx);
}
EXPORT_SYMBOL_GPL(mt7921_mac_sta_remove);
@@ -1231,8 +1231,12 @@ void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
.active = true,
},
};
+ int i, idx = msta->deflink.wcid.idx;
unsigned long rem;
+ for (i = 0; i < ARRAY_SIZE(msta->deflink.wcid.aggr); i++)
+ mt76_rx_aggr_stop(mdev, &msta->deflink.wcid, i);
+
rem = ieee80211_vif_is_mld(vif) ? msta->valid_links : BIT(0);
mt7925_mac_sta_remove_links(dev, vif, sta, rem);
@@ -1252,6 +1256,9 @@ void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
mvif->wep_sta = NULL;
ewma_rssi_init(&mvif->bss_conf.rssi);
}
+
+ mt76_wcid_cleanup(mdev, &msta->deflink.wcid);
+ mt76_wcid_mask_clear(mdev->wcid_mask, idx);
}
EXPORT_SYMBOL_GPL(mt7925_mac_sta_remove);
@@ -873,6 +873,10 @@ void mt7996_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76);
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
struct mt7996_sta_link *msta_link = &msta->deflink;
+ int i, idx = msta_link->wcid.idx;
+
+ for (i = 0; i < ARRAY_SIZE(msta_link->wcid.aggr); i++)
+ mt76_rx_aggr_stop(mdev, &msta_link->wcid, i);
mt7996_mac_wtbl_update(dev, msta_link->wcid.idx,
MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
@@ -883,6 +887,9 @@ void mt7996_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
if (!list_empty(&msta_link->rc_list))
list_del_init(&msta_link->rc_list);
spin_unlock_bh(&mdev->sta_poll_lock);
+
+ mt76_wcid_cleanup(mdev, &msta_link->wcid);
+ mt76_wcid_mask_clear(mdev->wcid_mask, idx);
}
static void mt7996_tx(struct ieee80211_hw *hw,
Move wcid remove logic in hw specific driver codebase. This change is needed to allow the SoC driver to select the proper wcid identifying the sta link. This is a preliminary patch to introduce MLO support for MT7996 driver. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> --- drivers/net/wireless/mediatek/mt76/mac80211.c | 24 +++-------------------- drivers/net/wireless/mediatek/mt76/mt76.h | 2 -- drivers/net/wireless/mediatek/mt76/mt7603/main.c | 7 +++++++ drivers/net/wireless/mediatek/mt76/mt7615/main.c | 7 +++++++ drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 8 +++++++- drivers/net/wireless/mediatek/mt76/mt7915/main.c | 7 +++++++ drivers/net/wireless/mediatek/mt76/mt7921/main.c | 7 +++++++ drivers/net/wireless/mediatek/mt76/mt7925/main.c | 7 +++++++ drivers/net/wireless/mediatek/mt76/mt7996/main.c | 7 +++++++ 10 files changed, 53 insertions(+), 25 deletions(-)