wifi: mt76: move struct ieee80211_chanctx_conf up to struct mt76_vif
authorSean Wang <sean.wang@mediatek.com>
Mon, 18 Sep 2023 08:03:06 +0000 (16:03 +0800)
committerFelix Fietkau <nbd@nbd.name>
Sat, 30 Sep 2023 18:03:05 +0000 (20:03 +0200)
Move struct ieee80211_chanctx_conf up to struct mt76_vif to allow the
connac2 library can access the struct ieee80211_chanctx_conf * member in
struct mt76_vif.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Reviewed-by: David Ruth <druth@chromium.org>
Tested-by: David Ruth <druth@chromium.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt76.h
drivers/net/wireless/mediatek/mt76/mt7921/main.c
drivers/net/wireless/mediatek/mt76/mt792x.h
drivers/net/wireless/mediatek/mt76/mt792x_core.c

index 6407cbc81985ac3c22c516ef252e18d2dd0420c0..fabed3f3ef32d7b0e47237d7b8c8b9a5058e18bc 100644 (file)
@@ -712,6 +712,7 @@ struct mt76_vif {
        u8 basic_rates_idx;
        u8 mcast_rates_idx;
        u8 beacon_rates_idx;
+       struct ieee80211_chanctx_conf *ctx;
 };
 
 struct mt76_phy {
index 571b82ed9293c9d191769fe21d8d571bcf859c78..aa20fdce27293f8ceee482a5527fc5e40687e9c8 100644 (file)
@@ -753,7 +753,7 @@ void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
 
        if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls)
                mt76_connac_mcu_uni_add_bss(&dev->mphy, vif, &mvif->sta.wcid,
-                                           true, mvif->ctx);
+                                           true, mvif->mt76.ctx);
 
        ewma_avg_signal_init(&msta->avg_ack_signal);
 
@@ -788,7 +788,7 @@ void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
                if (!sta->tdls)
                        mt76_connac_mcu_uni_add_bss(&dev->mphy, vif,
                                                    &mvif->sta.wcid, false,
-                                                   mvif->ctx);
+                                                   mvif->mt76.ctx);
        }
 
        spin_lock_bh(&dev->mt76.sta_poll_lock);
@@ -1205,7 +1205,7 @@ mt7921_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
        mt792x_mutex_acquire(dev);
 
        err = mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid,
-                                         true, mvif->ctx);
+                                         true, mvif->mt76.ctx);
        if (err)
                goto out;
 
@@ -1237,7 +1237,7 @@ mt7921_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                goto out;
 
        mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid, false,
-                                   mvif->ctx);
+                                   mvif->mt76.ctx);
 
 out:
        mt792x_mutex_release(dev);
@@ -1262,7 +1262,7 @@ static void mt7921_ctx_iter(void *priv, u8 *mac,
        struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
        struct ieee80211_chanctx_conf *ctx = priv;
 
-       if (ctx != mvif->ctx)
+       if (ctx != mvif->mt76.ctx)
                return;
 
        if (vif->type == NL80211_IFTYPE_MONITOR)
@@ -1295,7 +1295,7 @@ static void mt7921_mgd_prepare_tx(struct ieee80211_hw *hw,
                       jiffies_to_msecs(HZ);
 
        mt792x_mutex_acquire(dev);
-       mt7921_set_roc(mvif->phy, mvif, mvif->ctx->def.chan, duration,
+       mt7921_set_roc(mvif->phy, mvif, mvif->mt76.ctx->def.chan, duration,
                       MT7921_ROC_REQ_JOIN);
        mt792x_mutex_release(dev);
 }
index 39cbd13974571a507c25c3439e95c2d2ac95faab..548e89fad4d9f93a62b69631231b2e1cbb74d9fa 100644 (file)
@@ -93,7 +93,6 @@ struct mt792x_vif {
        struct ewma_rssi rssi;
 
        struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS];
-       struct ieee80211_chanctx_conf *ctx;
 };
 
 struct mt792x_phy {
index 8c97ac007d9ca092b9ce8a0665f6e329c91d7a83..7c4a74fb11804a9d6cee509f8b6d9ac335fef129 100644 (file)
@@ -243,7 +243,7 @@ int mt792x_assign_vif_chanctx(struct ieee80211_hw *hw,
        struct mt792x_dev *dev = mt792x_hw_dev(hw);
 
        mutex_lock(&dev->mt76.mutex);
-       mvif->ctx = ctx;
+       mvif->mt76.ctx = ctx;
        mutex_unlock(&dev->mt76.mutex);
 
        return 0;
@@ -259,7 +259,7 @@ void mt792x_unassign_vif_chanctx(struct ieee80211_hw *hw,
        struct mt792x_dev *dev = mt792x_hw_dev(hw);
 
        mutex_lock(&dev->mt76.mutex);
-       mvif->ctx = NULL;
+       mvif->mt76.ctx = NULL;
        mutex_unlock(&dev->mt76.mutex);
 }
 EXPORT_SYMBOL_GPL(mt792x_unassign_vif_chanctx);