blob: f035710e0c01e7e2dc2b7d7eb0a7c5e940df40ee [file] [log] [blame]
From a8c22741f0614f90922e3dcac3a94666e29e4682 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Fri, 24 Nov 2023 11:31:55 +0800
Subject: [PATCH 085/116] wifi: mt76: mt7996: switch to per-link data structure
of vif
Introduce struct mt7996_bss_conf, data structure for per-link BSS.
Note that mt7996_vif now represents a legacy or MLD device.
This is a preliminary patch to add MLO support for mt7996 chipsets.
Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
mt7996/debugfs.c | 10 +-
mt7996/init.c | 4 +-
mt7996/mac.c | 25 ++-
mt7996/main.c | 269 ++++++++++++++++++-----------
mt7996/mcu.c | 429 +++++++++++++++++++++++-----------------------
mt7996/mt7996.h | 72 +++++---
mt7996/testmode.c | 17 +-
7 files changed, 463 insertions(+), 363 deletions(-)
diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
index 8377586..06015d6 100644
--- a/mt7996/debugfs.c
+++ b/mt7996/debugfs.c
@@ -739,7 +739,7 @@ static void
mt7996_sta_hw_queue_read(void *data, struct ieee80211_sta *sta)
{
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
- struct mt7996_dev *dev = msta->vif->phy->dev;
+ struct mt7996_dev *dev = msta->vif->deflink.phy->dev;
struct seq_file *s = data;
u8 ac;
@@ -759,7 +759,7 @@ mt7996_sta_hw_queue_read(void *data, struct ieee80211_sta *sta)
GENMASK(11, 0));
seq_printf(s, "\tSTA %pM wcid %d: AC%d%d queued:%d\n",
sta->addr, msta->wcid.idx,
- msta->vif->mt76.wmm_idx, ac, qlen);
+ msta->vif->deflink.mt76.wmm_idx, ac, qlen);
}
}
@@ -1023,7 +1023,7 @@ mt7996_atf_enable_set(void *data, u64 val)
int ret;
vow->max_deficit = val ? 64 : 1;
- ret = mt7996_mcu_set_vow_drr_ctrl(phy, NULL, VOW_DRR_CTRL_AIRTIME_DEFICIT_BOUND);
+ ret = mt7996_mcu_set_vow_drr_ctrl(phy, NULL, NULL, VOW_DRR_CTRL_AIRTIME_DEFICIT_BOUND);
if (ret)
return ret;
@@ -1055,7 +1055,7 @@ mt7996_airtime_read(struct seq_file *s, void *data)
msta = container_of(wcid, struct mt7996_sta, wcid);
sta = container_of((void *)msta, struct ieee80211_sta, drv_priv);
- vif = &msta->vif->mt76;
+ vif = &msta->vif->deflink.mt76;
stats = &wcid->stats;
seq_printf(s, "%pM WCID: %hu BandIdx: %hhu OmacIdx: 0x%hhx\t"
@@ -1230,7 +1230,7 @@ static ssize_t mt7996_sta_fixed_rate_set(struct file *file,
#define LONG_PREAMBLE 1
struct ieee80211_sta *sta = file->private_data;
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
- struct mt7996_dev *dev = msta->vif->phy->dev;
+ struct mt7996_dev *dev = msta->vif->deflink.phy->dev;
struct ra_rate phy = {};
char buf[100];
int ret;
diff --git a/mt7996/init.c b/mt7996/init.c
index 6eeec3b..381e129 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
@@ -628,11 +628,11 @@ static int mt7996_vow_init(struct mt7996_phy *phy)
vow->drr_quantum[6] = VOW_DRR_QUANTUM_L6;
vow->drr_quantum[7] = VOW_DRR_QUANTUM_L7;
- ret = mt7996_mcu_set_vow_drr_ctrl(phy, NULL, VOW_DRR_CTRL_AIRTIME_DEFICIT_BOUND);
+ ret = mt7996_mcu_set_vow_drr_ctrl(phy, NULL, NULL, VOW_DRR_CTRL_AIRTIME_DEFICIT_BOUND);
if (ret)
return ret;
- ret = mt7996_mcu_set_vow_drr_ctrl(phy, NULL, VOW_DRR_CTRL_AIRTIME_QUANTUM_ALL);
+ ret = mt7996_mcu_set_vow_drr_ctrl(phy, NULL, NULL, VOW_DRR_CTRL_AIRTIME_QUANTUM_ALL);
if (ret)
return ret;
diff --git a/mt7996/mac.c b/mt7996/mac.c
index 0879c77..63b16f9 100644
--- a/mt7996/mac.c
+++ b/mt7996/mac.c
@@ -897,8 +897,9 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
if (vif) {
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ struct mt7996_bss_conf *mconf = &mvif->deflink;
- txp->fw.bss_idx = mvif->mt76.idx;
+ txp->fw.bss_idx = mconf->mt76.idx;
}
txp->fw.token = cpu_to_le16(id);
@@ -1518,12 +1519,15 @@ static void
mt7996_update_vif_beacon(void *priv, u8 *mac, struct ieee80211_vif *vif)
{
struct ieee80211_hw *hw = priv;
+ struct ieee80211_bss_conf *conf = &vif->bss_conf;
+ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ struct mt7996_bss_conf *mconf = &mvif->deflink;
switch (vif->type) {
case NL80211_IFTYPE_MESH_POINT:
case NL80211_IFTYPE_ADHOC:
case NL80211_IFTYPE_AP:
- mt7996_mcu_add_beacon(hw, vif, vif->bss_conf.enable_beacon);
+ mt7996_mcu_add_beacon(hw, conf, mconf, conf->enable_beacon);
break;
default:
break;
@@ -2237,6 +2241,8 @@ void mt7996_mac_sta_rc_work(struct work_struct *work)
struct mt7996_dev *dev = container_of(work, struct mt7996_dev, rc_work);
struct ieee80211_sta *sta;
struct ieee80211_vif *vif;
+ struct ieee80211_bss_conf *conf;
+ struct mt7996_bss_conf *mconf;
struct mt7996_sta *msta;
u32 changed;
LIST_HEAD(list);
@@ -2253,14 +2259,16 @@ void mt7996_mac_sta_rc_work(struct work_struct *work)
sta = container_of((void *)msta, struct ieee80211_sta, drv_priv);
vif = container_of((void *)msta->vif, struct ieee80211_vif, drv_priv);
+ conf = &vif->bss_conf;
+ mconf = &msta->vif->deflink;
if (changed & (IEEE80211_RC_SUPP_RATES_CHANGED |
IEEE80211_RC_NSS_CHANGED |
IEEE80211_RC_BW_CHANGED))
- mt7996_mcu_add_rate_ctrl(dev, vif, sta, true);
+ mt7996_mcu_add_rate_ctrl(dev, conf, mconf, sta, true);
if (changed & IEEE80211_RC_SMPS_CHANGED)
- mt7996_mcu_set_fixed_field(dev, vif, sta, NULL,
+ mt7996_mcu_set_fixed_field(dev, mconf, sta, NULL,
RATE_PARAM_MMPS_UPDATE);
spin_lock_bh(&dev->mt76.sta_poll_lock);
@@ -2643,7 +2651,7 @@ void mt7996_mac_add_twt_setup(struct ieee80211_hw *hw,
flow->sched = true;
flow->start_tsf = mt7996_mac_twt_sched_list_add(dev, flow);
- curr_tsf = __mt7996_get_tsf(hw, msta->vif);
+ curr_tsf = __mt7996_get_tsf(hw, &msta->vif->deflink);
div_u64_rem(curr_tsf - flow->start_tsf, interval, &rem);
flow_tsf = curr_tsf + interval - rem;
twt_agrt->twt = cpu_to_le64(flow_tsf);
@@ -2652,7 +2660,8 @@ void mt7996_mac_add_twt_setup(struct ieee80211_hw *hw,
}
flow->tsf = le64_to_cpu(twt_agrt->twt);
- if (mt7996_mcu_twt_agrt_update(dev, msta->vif, flow, MCU_TWT_AGRT_ADD))
+ if (mt7996_mcu_twt_agrt_update(dev, &msta->vif->deflink, flow,
+ MCU_TWT_AGRT_ADD))
goto unlock;
setup_cmd = TWT_SETUP_CMD_ACCEPT;
@@ -2674,6 +2683,7 @@ void mt7996_mac_twt_teardown_flow(struct mt7996_dev *dev,
u8 flowid)
{
struct mt7996_twt_flow *flow;
+ struct mt7996_bss_conf *mconf = mconf_dereference_protected(msta->vif, 0);
lockdep_assert_held(&dev->mt76.mutex);
@@ -2684,8 +2694,7 @@ void mt7996_mac_twt_teardown_flow(struct mt7996_dev *dev,
return;
flow = &msta->twt.flow[flowid];
- if (mt7996_mcu_twt_agrt_update(dev, msta->vif, flow,
- MCU_TWT_AGRT_DELETE))
+ if (mt7996_mcu_twt_agrt_update(dev, mconf, flow, MCU_TWT_AGRT_DELETE))
return;
list_del_init(&flow->list);
diff --git a/mt7996/main.c b/mt7996/main.c
index 9eb4c5b..bc4863d 100644
--- a/mt7996/main.c
+++ b/mt7996/main.c
@@ -205,29 +205,30 @@ static int get_omac_idx(enum nl80211_iftype type, u64 mask)
return -1;
}
-static void mt7996_init_bitrate_mask(struct ieee80211_vif *vif)
+static void mt7996_init_bitrate_mask(struct mt7996_bss_conf *mconf)
{
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
int i;
- for (i = 0; i < ARRAY_SIZE(mvif->bitrate_mask.control); i++) {
- mvif->bitrate_mask.control[i].gi = NL80211_TXRATE_DEFAULT_GI;
- mvif->bitrate_mask.control[i].he_gi = 0xff;
- mvif->bitrate_mask.control[i].he_ltf = 0xff;
- mvif->bitrate_mask.control[i].legacy = GENMASK(31, 0);
- memset(mvif->bitrate_mask.control[i].ht_mcs, 0xff,
- sizeof(mvif->bitrate_mask.control[i].ht_mcs));
- memset(mvif->bitrate_mask.control[i].vht_mcs, 0xff,
- sizeof(mvif->bitrate_mask.control[i].vht_mcs));
- memset(mvif->bitrate_mask.control[i].he_mcs, 0xff,
- sizeof(mvif->bitrate_mask.control[i].he_mcs));
+ for (i = 0; i < ARRAY_SIZE(mconf->bitrate_mask.control); i++) {
+ mconf->bitrate_mask.control[i].gi = NL80211_TXRATE_DEFAULT_GI;
+ mconf->bitrate_mask.control[i].he_gi = 0xff;
+ mconf->bitrate_mask.control[i].he_ltf = 0xff;
+ mconf->bitrate_mask.control[i].legacy = GENMASK(31, 0);
+ memset(mconf->bitrate_mask.control[i].ht_mcs, 0xff,
+ sizeof(mconf->bitrate_mask.control[i].ht_mcs));
+ memset(mconf->bitrate_mask.control[i].vht_mcs, 0xff,
+ sizeof(mconf->bitrate_mask.control[i].vht_mcs));
+ memset(mconf->bitrate_mask.control[i].he_mcs, 0xff,
+ sizeof(mconf->bitrate_mask.control[i].he_mcs));
}
}
static int mt7996_add_interface(struct ieee80211_hw *hw,
struct ieee80211_vif *vif)
{
+ struct ieee80211_bss_conf *conf = &vif->bss_conf;
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ struct mt7996_bss_conf *mconf = &mvif->deflink;
struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct mt7996_phy *phy = mt7996_hw_phy(hw);
struct mt76_txq *mtxq;
@@ -240,8 +241,8 @@ static int mt7996_add_interface(struct ieee80211_hw *hw,
is_zero_ether_addr(vif->addr))
phy->monitor_vif = vif;
- mvif->mt76.idx = __ffs64(~dev->mt76.vif_mask);
- if (mvif->mt76.idx >= mt7996_max_interface_num(dev)) {
+ mconf->mt76.idx = __ffs64(~dev->mt76.vif_mask);
+ if (mconf->mt76.idx >= mt7996_max_interface_num(dev)) {
ret = -ENOSPC;
goto out;
}
@@ -251,19 +252,21 @@ static int mt7996_add_interface(struct ieee80211_hw *hw,
ret = -ENOSPC;
goto out;
}
- mvif->mt76.omac_idx = idx;
- mvif->phy = phy;
- mvif->mt76.band_idx = band_idx;
- mvif->mt76.wmm_idx = vif->type != NL80211_IFTYPE_AP;
-
- ret = mt7996_mcu_add_dev_info(phy, vif, true);
+ mconf->mt76.omac_idx = idx;
+ mconf->vif = mvif;
+ mconf->phy = phy;
+ mconf->mt76.band_idx = band_idx;
+ mconf->mt76.wmm_idx = vif->type != NL80211_IFTYPE_AP;
+ mvif->dev = dev;
+
+ ret = mt7996_mcu_add_dev_info(phy, conf, mconf, true);
if (ret)
goto out;
- dev->mt76.vif_mask |= BIT_ULL(mvif->mt76.idx);
- phy->omac_mask |= BIT_ULL(mvif->mt76.omac_idx);
+ dev->mt76.vif_mask |= BIT_ULL(mconf->mt76.idx);
+ phy->omac_mask |= BIT_ULL(mconf->mt76.omac_idx);
- idx = MT7996_WTBL_RESERVED - mvif->mt76.idx;
+ idx = MT7996_WTBL_RESERVED - mconf->mt76.idx;
INIT_LIST_HEAD(&mvif->sta.rc_list);
INIT_LIST_HEAD(&mvif->sta.wcid.poll_list);
@@ -283,24 +286,25 @@ static int mt7996_add_interface(struct ieee80211_hw *hw,
}
if (vif->type != NL80211_IFTYPE_AP &&
- (!mvif->mt76.omac_idx || mvif->mt76.omac_idx > 3))
+ (!mconf->mt76.omac_idx || mconf->mt76.omac_idx > 3))
vif->offload_flags = 0;
vif->offload_flags |= IEEE80211_OFFLOAD_ENCAP_4ADDR;
if (phy->mt76->chandef.chan->band != NL80211_BAND_2GHZ)
- mvif->mt76.basic_rates_idx = MT7996_BASIC_RATES_TBL + 4;
+ mconf->mt76.basic_rates_idx = MT7996_BASIC_RATES_TBL + 4;
else
- mvif->mt76.basic_rates_idx = MT7996_BASIC_RATES_TBL;
+ mconf->mt76.basic_rates_idx = MT7996_BASIC_RATES_TBL;
- mt7996_init_bitrate_mask(vif);
+ mt7996_init_bitrate_mask(mconf);
- mt7996_mcu_add_bss_info(phy, vif, true);
+ mt7996_mcu_add_bss_info(phy, conf, mconf, true);
/* defer the first STA_REC of BMC entry to BSS_CHANGED_BSSID for STA
* interface, since firmware only records BSSID when the entry is new
*/
if (vif->type != NL80211_IFTYPE_STATION)
- mt7996_mcu_add_sta(dev, vif, NULL, true, true);
+ mt7996_mcu_add_sta(dev, conf, mconf, NULL, true, true);
rcu_assign_pointer(dev->mt76.wcid[idx], &mvif->sta.wcid);
+ rcu_assign_pointer(mvif->link[0], mconf);
out:
mutex_unlock(&dev->mt76.mutex);
@@ -311,7 +315,9 @@ out:
static void mt7996_remove_interface(struct ieee80211_hw *hw,
struct ieee80211_vif *vif)
{
+ struct ieee80211_bss_conf *conf;
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ struct mt7996_bss_conf *mconf;
struct mt7996_sta *msta = &mvif->sta;
struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct mt7996_phy *phy = mt7996_hw_phy(hw);
@@ -319,24 +325,22 @@ static void mt7996_remove_interface(struct ieee80211_hw *hw,
cancel_delayed_work_sync(&phy->scan_work);
- mt7996_mcu_add_sta(dev, vif, NULL, false, false);
- mt7996_mcu_add_bss_info(phy, vif, false);
+ mutex_lock(&dev->mt76.mutex);
+
+ conf = link_conf_dereference_protected(vif, 0);
+ mconf = mconf_dereference_protected(mvif, 0);
+ mt7996_mcu_add_sta(dev, conf, mconf, NULL, false, false);
+ mt7996_mcu_add_bss_info(phy, conf, mconf, false);
if (vif == phy->monitor_vif)
phy->monitor_vif = NULL;
- mt7996_mcu_add_dev_info(phy, vif, false);
+ mt7996_mcu_add_dev_info(phy, conf, mconf, false);
rcu_assign_pointer(dev->mt76.wcid[idx], NULL);
- mutex_lock(&dev->mt76.mutex);
-
- if (test_bit(MT76_SCANNING, &phy->mt76->state))
- mt7996_scan_complete(phy, true);
-
- dev->mt76.vif_mask &= ~BIT_ULL(mvif->mt76.idx);
- phy->omac_mask &= ~BIT_ULL(mvif->mt76.omac_idx);
- mutex_unlock(&dev->mt76.mutex);
+ dev->mt76.vif_mask &= ~BIT_ULL(mconf->mt76.idx);
+ phy->omac_mask &= ~BIT_ULL(mconf->mt76.omac_idx);
spin_lock_bh(&dev->mt76.sta_poll_lock);
if (!list_empty(&msta->wcid.poll_list))
@@ -344,6 +348,9 @@ static void mt7996_remove_interface(struct ieee80211_hw *hw,
spin_unlock_bh(&dev->mt76.sta_poll_lock);
mt76_wcid_cleanup(&dev->mt76, &msta->wcid);
+ rcu_assign_pointer(mvif->link[0], NULL);
+
+ mutex_unlock(&dev->mt76.mutex);
}
static void ___mt7996_set_channel(struct mt7996_phy *phy,
@@ -441,6 +448,8 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
struct mt7996_sta *msta = sta ? (struct mt7996_sta *)sta->drv_priv :
&mvif->sta;
struct mt76_wcid *wcid = &msta->wcid;
+ struct mt7996_bss_conf *mconf;
+ struct ieee80211_bss_conf *conf;
u8 *wcid_keyidx = &wcid->hw_key_idx;
int idx = key->keyidx;
int err = 0;
@@ -482,9 +491,11 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
mutex_lock(&dev->mt76.mutex);
- if (cmd == SET_KEY && !sta && !mvif->mt76.cipher) {
- mvif->mt76.cipher = mt76_connac_mcu_get_cipher(key->cipher);
- mt7996_mcu_add_bss_info(phy, vif, true);
+ conf = link_conf_dereference_protected(vif, 0);
+ mconf = mconf_dereference_protected(mvif, 0);
+ if (cmd == SET_KEY && !sta && !mconf->mt76.cipher) {
+ mconf->mt76.cipher = mt76_connac_mcu_get_cipher(key->cipher);
+ mt7996_mcu_add_bss_info(phy, conf, mconf, true);
}
if (cmd == SET_KEY) {
@@ -498,9 +509,9 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
mt76_wcid_key_setup(&dev->mt76, wcid, key);
if (key->keyidx == 6 || key->keyidx == 7)
- err = mt7996_mcu_bcn_prot_enable(dev, vif, key);
+ err = mt7996_mcu_bcn_prot_enable(dev, conf, mconf, key);
else
- err = mt7996_mcu_add_key(&dev->mt76, vif, key,
+ err = mt7996_mcu_add_key(&dev->mt76, mconf, key,
MCU_WMWA_UNI_CMD(STA_REC_UPDATE),
&msta->wcid, cmd);
out:
@@ -547,7 +558,9 @@ mt7996_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
unsigned int link_id, u16 queue,
const struct ieee80211_tx_queue_params *params)
{
+ struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ struct mt7996_bss_conf *mconf;
static const u8 mq_to_aci[] = {
[IEEE80211_AC_VO] = 3,
[IEEE80211_AC_VI] = 2,
@@ -555,10 +568,15 @@ mt7996_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
[IEEE80211_AC_BK] = 1,
};
+ mutex_lock(&dev->mt76.mutex);
+ mconf = mconf_dereference_protected(mvif, 0);
+
/* firmware uses access class index */
- mvif->queue_params[mq_to_aci[queue]] = *params;
+ mconf->queue_params[mq_to_aci[queue]] = *params;
/* no need to update right away, we'll get BSS_CHANGED_QOS */
+ mutex_unlock(&dev->mt76.mutex);
+
return 0;
}
@@ -619,22 +637,20 @@ static void mt7996_configure_filter(struct ieee80211_hw *hw,
}
static void
-mt7996_update_bss_color(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
+mt7996_update_bss_color(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct mt7996_bss_conf *mconf,
struct cfg80211_he_bss_color *bss_color)
{
struct mt7996_dev *dev = mt7996_hw_dev(hw);
switch (vif->type) {
case NL80211_IFTYPE_AP: {
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
-
- if (mvif->mt76.omac_idx > HW_BSSID_MAX)
+ if (mconf->mt76.omac_idx > HW_BSSID_MAX)
return;
fallthrough;
}
case NL80211_IFTYPE_STATION:
- mt7996_mcu_update_bss_color(dev, vif, bss_color);
+ mt7996_mcu_update_bss_color(dev, mconf, bss_color);
break;
default:
break;
@@ -642,16 +658,15 @@ mt7996_update_bss_color(struct ieee80211_hw *hw,
}
static u8
-mt7996_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- bool beacon, bool mcast)
+mt7996_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf, bool beacon, bool mcast)
{
- struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
struct mt7996_dev *dev = mt7996_hw_dev(hw);
- struct mt76_phy *mphy = hw->priv;
+ struct mt76_phy *mphy = mconf->phy->mt76;
u16 rate;
u8 i, idx;
- rate = mt76_connac2_mac_tx_rate_val(mphy, vif, beacon, mcast);
+ rate = mt76_connac2_mac_tx_rate_val(mphy, conf->vif, beacon, mcast);
if (beacon) {
struct mt7996_phy *phy = mphy->priv;
@@ -672,23 +687,22 @@ mt7996_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
if ((mt76_rates[i].hw_value & GENMASK(7, 0)) == idx)
return MT7996_BASIC_RATES_TBL + 2 * i;
- return mvif->basic_rates_idx;
+ return mconf->mt76.basic_rates_idx;
}
static void
-mt7996_update_mu_group(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- struct ieee80211_bss_conf *info)
+mt7996_update_mu_group(struct ieee80211_hw *hw, struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf)
{
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_dev *dev = mt7996_hw_dev(hw);
- u8 band = mvif->mt76.band_idx;
+ u8 band = mconf->mt76.band_idx;
u32 *mu;
- mu = (u32 *)info->mu_group.membership;
+ mu = (u32 *)conf->mu_group.membership;
mt76_wr(dev, MT_WF_PHYRX_BAND_GID_TAB_VLD0(band), mu[0]);
mt76_wr(dev, MT_WF_PHYRX_BAND_GID_TAB_VLD1(band), mu[1]);
- mu = (u32 *)info->mu_group.position;
+ mu = (u32 *)conf->mu_group.position;
mt76_wr(dev, MT_WF_PHYRX_BAND_GID_TAB_POS0(band), mu[0]);
mt76_wr(dev, MT_WF_PHYRX_BAND_GID_TAB_POS1(band), mu[1]);
mt76_wr(dev, MT_WF_PHYRX_BAND_GID_TAB_POS2(band), mu[2]);
@@ -700,20 +714,22 @@ static void mt7996_bss_info_changed(struct ieee80211_hw *hw,
struct ieee80211_bss_conf *info,
u64 changed)
{
- struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
+ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ struct mt7996_bss_conf *mconf;
struct mt7996_phy *phy = mt7996_hw_phy(hw);
struct mt7996_dev *dev = mt7996_hw_dev(hw);
mutex_lock(&dev->mt76.mutex);
+ mconf = mconf_dereference_protected(mvif, 0);
/* station mode uses BSSID to map the wlan entry to a peer,
* and then peer references bss_info_rfch to set bandwidth cap.
*/
if ((changed & BSS_CHANGED_BSSID && !is_zero_ether_addr(info->bssid)) ||
(changed & BSS_CHANGED_ASSOC && vif->cfg.assoc) ||
(changed & BSS_CHANGED_BEACON_ENABLED && info->enable_beacon)) {
- mt7996_mcu_add_bss_info(phy, vif, true);
- mt7996_mcu_add_sta(dev, vif, NULL, true,
+ mt7996_mcu_add_bss_info(phy, info, mconf, true);
+ mt7996_mcu_add_sta(dev, info, mconf, NULL, true,
!!(changed & BSS_CHANGED_BSSID));
}
@@ -725,42 +741,42 @@ static void mt7996_bss_info_changed(struct ieee80211_hw *hw,
if (slottime != phy->slottime) {
phy->slottime = slottime;
- mt7996_mcu_set_timing(phy, vif);
+ mt7996_mcu_set_timing(phy, mconf);
}
}
if (changed & BSS_CHANGED_MCAST_RATE)
- mvif->mcast_rates_idx =
- mt7996_get_rates_table(hw, vif, false, true);
+ mconf->mt76.mcast_rates_idx =
+ mt7996_get_rates_table(hw, info, mconf, false, true);
if (changed & BSS_CHANGED_BASIC_RATES)
- mvif->basic_rates_idx =
- mt7996_get_rates_table(hw, vif, false, false);
+ mconf->mt76.basic_rates_idx =
+ mt7996_get_rates_table(hw, info, mconf, false, false);
/* ensure that enable txcmd_mode after bss_info */
if (changed & (BSS_CHANGED_QOS | BSS_CHANGED_BEACON_ENABLED))
- mt7996_mcu_set_tx(dev, vif);
+ mt7996_mcu_set_tx(dev, mconf);
if (changed & BSS_CHANGED_HE_OBSS_PD)
- mt7996_mcu_add_obss_spr(phy, vif, &info->he_obss_pd);
+ mt7996_mcu_add_obss_spr(phy, mconf, &info->he_obss_pd);
if (changed & BSS_CHANGED_HE_BSS_COLOR)
- mt7996_update_bss_color(hw, vif, &info->he_bss_color);
+ mt7996_update_bss_color(hw, vif, mconf, &info->he_bss_color);
if (changed & (BSS_CHANGED_BEACON |
BSS_CHANGED_BEACON_ENABLED)) {
- mvif->beacon_rates_idx =
- mt7996_get_rates_table(hw, vif, true, false);
+ mconf->mt76.beacon_rates_idx =
+ mt7996_get_rates_table(hw, info, mconf, true, false);
- mt7996_mcu_add_beacon(hw, vif, info->enable_beacon);
+ mt7996_mcu_add_beacon(hw, info, mconf, info->enable_beacon);
}
if (changed & (BSS_CHANGED_UNSOL_BCAST_PROBE_RESP |
BSS_CHANGED_FILS_DISCOVERY))
- mt7996_mcu_beacon_inband_discov(dev, vif, changed);
+ mt7996_mcu_beacon_inband_discov(dev, info, mconf, changed);
if (changed & BSS_CHANGED_MU_GROUPS)
- mt7996_update_mu_group(hw, vif, info);
+ mt7996_update_mu_group(hw, info, mconf);
mutex_unlock(&dev->mt76.mutex);
}
@@ -771,9 +787,14 @@ mt7996_channel_switch_beacon(struct ieee80211_hw *hw,
struct cfg80211_chan_def *chandef)
{
struct mt7996_dev *dev = mt7996_hw_dev(hw);
+ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ struct mt7996_bss_conf *mconf;
+ struct ieee80211_bss_conf *conf;
mutex_lock(&dev->mt76.mutex);
- mt7996_mcu_add_beacon(hw, vif, true);
+ mconf = mconf_dereference_protected(mvif, 0);
+ conf = link_conf_dereference_protected(vif, 0);
+ mt7996_mcu_add_beacon(hw, conf, mconf, true);
mutex_unlock(&dev->mt76.mutex);
}
@@ -783,7 +804,8 @@ int mt7996_mac_sta_add(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_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
- u8 band_idx = mvif->phy->mt76->band_idx;
+ struct mt7996_bss_conf *mconf = mconf_dereference_protected(mvif, 0);
+ u8 band_idx = mconf->phy->mt76->band_idx;
int idx;
#ifdef CONFIG_MTK_VENDOR
@@ -803,7 +825,7 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
msta->wcid.tx_info |= MT_WCID_TX_INFO_SET;
#ifdef CONFIG_MTK_VENDOR
- mt7996_vendor_amnt_sta_remove(mvif->phy, sta);
+ mt7996_vendor_amnt_sta_remove(mconf->phy, sta);
#endif
#ifdef CONFIG_MTK_VENDOR
@@ -830,15 +852,20 @@ void mt7996_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{
struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76);
+ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
+ struct mt7996_bss_conf *mconf;
+ struct ieee80211_bss_conf *conf;
mutex_lock(&dev->mt76.mutex);
mt7996_mac_wtbl_update(dev, msta->wcid.idx,
MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
- mt7996_mcu_add_sta(dev, vif, sta, true, true);
- mt7996_mcu_add_rate_ctrl(dev, vif, sta, false);
+ conf = link_conf_dereference_protected(vif, 0);
+ mconf = mconf_dereference_protected(mvif, 0);
+ mt7996_mcu_add_sta(dev, conf, mconf, sta, true, true);
+ mt7996_mcu_add_rate_ctrl(dev, conf, mconf, sta, false);
ewma_avg_signal_init(&msta->avg_ack_signal);
@@ -849,10 +876,15 @@ void mt7996_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{
struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76);
+ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
+ struct mt7996_bss_conf *mconf;
+ struct ieee80211_bss_conf *conf;
int i;
- mt7996_mcu_add_sta(dev, vif, sta, false, false);
+ conf = link_conf_dereference_protected(vif, 0);
+ mconf = mconf_dereference_protected(mvif, 0);
+ mt7996_mcu_add_sta(dev, conf, mconf, sta, false, false);
mt7996_mac_wtbl_update(dev, msta->wcid.idx,
MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
@@ -984,7 +1016,7 @@ mt7996_get_stats(struct ieee80211_hw *hw,
return 0;
}
-u64 __mt7996_get_tsf(struct ieee80211_hw *hw, struct mt7996_vif *mvif)
+u64 __mt7996_get_tsf(struct ieee80211_hw *hw, struct mt7996_bss_conf *mconf)
{
struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct mt7996_phy *phy = mt7996_hw_phy(hw);
@@ -996,8 +1028,8 @@ u64 __mt7996_get_tsf(struct ieee80211_hw *hw, struct mt7996_vif *mvif)
lockdep_assert_held(&dev->mt76.mutex);
- n = mvif->mt76.omac_idx > HW_BSSID_MAX ? HW_BSSID_0
- : mvif->mt76.omac_idx;
+ n = mconf->mt76.omac_idx > HW_BSSID_MAX ? HW_BSSID_0
+ : mconf->mt76.omac_idx;
/* TSF software read */
mt76_rmw(dev, MT_LPON_TCR(phy->mt76->band_idx, n), MT_LPON_TCR_SW_MODE,
MT_LPON_TCR_SW_READ);
@@ -1012,10 +1044,12 @@ mt7996_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
{
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_dev *dev = mt7996_hw_dev(hw);
+ struct mt7996_bss_conf *mconf;
u64 ret;
mutex_lock(&dev->mt76.mutex);
- ret = __mt7996_get_tsf(hw, mvif);
+ mconf = mconf_dereference_protected(mvif, 0);
+ ret = __mt7996_get_tsf(hw, mconf);
mutex_unlock(&dev->mt76.mutex);
return ret;
@@ -1028,6 +1062,7 @@ mt7996_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct mt7996_phy *phy = mt7996_hw_phy(hw);
+ struct mt7996_bss_conf *mconf;
union {
u64 t64;
u32 t32[2];
@@ -1036,8 +1071,9 @@ mt7996_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
mutex_lock(&dev->mt76.mutex);
- n = mvif->mt76.omac_idx > HW_BSSID_MAX ? HW_BSSID_0
- : mvif->mt76.omac_idx;
+ mconf = mconf_dereference_protected(mvif, 0);
+ n = mconf->mt76.omac_idx > HW_BSSID_MAX ? HW_BSSID_0
+ : mconf->mt76.omac_idx;
mt76_wr(dev, MT_LPON_UTTR0(phy->mt76->band_idx), tsf.t32[0]);
mt76_wr(dev, MT_LPON_UTTR1(phy->mt76->band_idx), tsf.t32[1]);
/* TSF software overwrite */
@@ -1054,6 +1090,7 @@ mt7996_offset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct mt7996_phy *phy = mt7996_hw_phy(hw);
+ struct mt7996_bss_conf *mconf;
union {
u64 t64;
u32 t32[2];
@@ -1062,8 +1099,9 @@ mt7996_offset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
mutex_lock(&dev->mt76.mutex);
- n = mvif->mt76.omac_idx > HW_BSSID_MAX ? HW_BSSID_0
- : mvif->mt76.omac_idx;
+ mconf = mconf_dereference_protected(mvif, 0);
+ n = mconf->mt76.omac_idx > HW_BSSID_MAX ? HW_BSSID_0
+ : mconf->mt76.omac_idx;
mt76_wr(dev, MT_LPON_UTTR0(phy->mt76->band_idx), tsf.t32[0]);
mt76_wr(dev, MT_LPON_UTTR1(phy->mt76->band_idx), tsf.t32[1]);
/* TSF software adjust*/
@@ -1179,7 +1217,7 @@ static void mt7996_sta_statistics(struct ieee80211_hw *hw,
static void mt7996_sta_rc_work(void *data, struct ieee80211_sta *sta)
{
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
- struct mt7996_dev *dev = msta->vif->phy->dev;
+ struct mt7996_dev *dev = msta->vif->dev;
u32 *changed = data;
spin_lock_bh(&dev->mt76.sta_poll_lock);
@@ -1215,9 +1253,13 @@ mt7996_set_bitrate_mask(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_phy *phy = mt7996_hw_phy(hw);
struct mt7996_dev *dev = phy->dev;
+ struct mt7996_bss_conf *mconf;
u32 changed = IEEE80211_RC_SUPP_RATES_CHANGED;
- mvif->bitrate_mask = *mask;
+ mutex_lock(&dev->mt76.mutex);
+ mconf = mconf_dereference_protected(mvif, 0);
+ mconf->bitrate_mask = *mask;
+ mutex_unlock(&dev->mt76.mutex);
/* if multiple rates across different preambles are given we can
* reconfigure this info with all peers using sta_rec command with
@@ -1239,14 +1281,20 @@ static void mt7996_sta_set_4addr(struct ieee80211_hw *hw,
bool enabled)
{
struct mt7996_dev *dev = mt7996_hw_dev(hw);
+ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
+ struct mt7996_bss_conf *mconf;
+
+ mutex_lock(&dev->mt76.mutex);
+ mconf = mconf_dereference_protected(mvif, 0);
if (enabled)
set_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags);
else
clear_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags);
- mt7996_mcu_wtbl_update_hdr_trans(dev, vif, sta);
+ mt7996_mcu_wtbl_update_hdr_trans(dev, vif, mconf, sta);
+ mutex_unlock(&dev->mt76.mutex);
}
static void mt7996_sta_set_decap_offload(struct ieee80211_hw *hw,
@@ -1255,14 +1303,20 @@ static void mt7996_sta_set_decap_offload(struct ieee80211_hw *hw,
bool enabled)
{
struct mt7996_dev *dev = mt7996_hw_dev(hw);
+ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
+ struct mt7996_bss_conf *mconf;
+
+ mutex_lock(&dev->mt76.mutex);
+ mconf = mconf_dereference_protected(mvif, 0);
if (enabled)
set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags);
else
clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags);
- mt7996_mcu_wtbl_update_hdr_trans(dev, vif, sta);
+ mt7996_mcu_wtbl_update_hdr_trans(dev, vif, mconf, sta);
+ mutex_unlock(&dev->mt76.mutex);
}
static const char mt7996_gstrings_stats[][ETH_GSTRING_LEN] = {
@@ -1395,7 +1449,7 @@ static void mt7996_ethtool_worker(void *wi_data, struct ieee80211_sta *sta)
struct mt76_ethtool_worker_info *wi = wi_data;
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
- if (msta->vif->mt76.idx != wi->idx)
+ if (msta->vif->deflink.mt76.idx != wi->idx)
return;
mt76_ethtool_worker(wi, &msta->wcid.stats, true);
@@ -1409,15 +1463,17 @@ void mt7996_get_et_stats(struct ieee80211_hw *hw,
struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct mt7996_phy *phy = mt7996_hw_phy(hw);
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ struct mt7996_bss_conf *mconf;
struct mt76_mib_stats *mib = &phy->mib;
struct mt76_ethtool_worker_info wi = {
.data = data,
- .idx = mvif->mt76.idx,
};
/* See mt7996_ampdu_stat_read_phy, etc */
int i, ei = 0;
mutex_lock(&dev->mt76.mutex);
+ mconf = mconf_dereference_protected(mvif, 0);
+ wi.idx = mconf->mt76.idx,
mt7996_mac_update_stats(phy);
@@ -1623,6 +1679,7 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
struct net_device_path *path)
{
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ struct mt7996_bss_conf *mconf = &mvif->deflink;
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct mt7996_phy *phy = mt7996_hw_phy(hw);
@@ -1652,7 +1709,7 @@ mt7996_net_fill_forward_path(struct ieee80211_hw *hw,
path->type = DEV_PATH_MTK_WDMA;
path->dev = ctx->dev;
path->mtk_wdma.wdma_idx = wed->wdma_idx;
- path->mtk_wdma.bss = mvif->mt76.idx;
+ path->mtk_wdma.bss = mconf->mt76.idx;
path->mtk_wdma.queue = 0;
path->mtk_wdma.wcid = msta->wcid.idx;
@@ -1784,6 +1841,7 @@ mt7996_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct mt7996_chanctx *ctx = mt7996_chanctx_get(conf);
struct mt7996_phy *phy = ctx->phy;
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ struct mt7996_bss_conf *mconf;
wiphy_info(hw->wiphy, "Assign VIF (addr: %pM, type: %d, link_id: %d) to channel context: %d MHz\n",
vif->addr, vif->type, link_conf->link_id,
@@ -1791,7 +1849,8 @@ mt7996_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
mutex_lock(&phy->dev->mt76.mutex);
- mvif->chanctx = ctx;
+ mconf = mconf_dereference_protected(mvif, 0);
+ mconf->chanctx = ctx;
ctx->nbss_assigned++;
mutex_unlock(&phy->dev->mt76.mutex);
@@ -1807,6 +1866,7 @@ mt7996_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct mt7996_chanctx *ctx = mt7996_chanctx_get(conf);
struct mt7996_phy *phy = ctx->phy;
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ struct mt7996_bss_conf *mconf;
wiphy_info(hw->wiphy, "Remove VIF (addr: %pM, type: %d, link_id: %d) from channel context: %d MHz\n",
vif->addr, vif->type, link_conf->link_id,
@@ -1818,7 +1878,8 @@ mt7996_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
if (test_bit(MT76_SCANNING, &phy->mt76->state))
mt7996_scan_complete(phy, true);
- mvif->chanctx = NULL;
+ mconf = mconf_dereference_protected(mvif, 0);
+ mconf->chanctx = NULL;
ctx->nbss_assigned--;
mutex_unlock(&phy->dev->mt76.mutex);
diff --git a/mt7996/mcu.c b/mt7996/mcu.c
index 5319cc3..ebd3192 100644
--- a/mt7996/mcu.c
+++ b/mt7996/mcu.c
@@ -117,12 +117,12 @@ mt7996_mcu_get_sta_nss(u16 mcs_map)
}
static void
-mt7996_mcu_set_sta_he_mcs(struct ieee80211_sta *sta, __le16 *he_mcs,
- u16 mcs_map)
+mt7996_mcu_set_sta_he_mcs(struct ieee80211_sta *sta,
+ struct mt7996_bss_conf *mconf,
+ __le16 *he_mcs, u16 mcs_map)
{
- struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
- enum nl80211_band band = msta->vif->phy->mt76->chandef.chan->band;
- const u16 *mask = msta->vif->bitrate_mask.control[band].he_mcs;
+ enum nl80211_band band = mconf->phy->mt76->chandef.chan->band;
+ const u16 *mask = mconf->bitrate_mask.control[band].he_mcs;
int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss;
for (nss = 0; nss < max_nss; nss++) {
@@ -922,8 +922,7 @@ mt7996_mcu_add_uni_tlv(struct sk_buff *skb, u16 tag, u16 len)
}
static void
-mt7996_mcu_bss_rfch_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
- struct mt7996_phy *phy)
+mt7996_mcu_bss_rfch_tlv(struct sk_buff *skb, struct mt7996_phy *phy)
{
static const u8 rlm_ch_band[] = {
[NL80211_BAND_2GHZ] = 1,
@@ -953,8 +952,7 @@ mt7996_mcu_bss_rfch_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
}
static void
-mt7996_mcu_bss_ra_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
- struct mt7996_phy *phy)
+mt7996_mcu_bss_ra_tlv(struct sk_buff *skb)
{
struct bss_ra_tlv *ra;
struct tlv *tlv;
@@ -966,7 +964,7 @@ mt7996_mcu_bss_ra_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
}
static void
-mt7996_mcu_bss_he_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
+mt7996_mcu_bss_he_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *conf,
struct mt7996_phy *phy)
{
#define DEFAULT_HE_PE_DURATION 4
@@ -975,16 +973,16 @@ mt7996_mcu_bss_he_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
struct bss_info_uni_he *he;
struct tlv *tlv;
- cap = mt76_connac_get_he_phy_cap(phy->mt76, vif);
+ cap = mt76_connac_get_he_phy_cap(phy->mt76, conf->vif);
tlv = mt7996_mcu_add_uni_tlv(skb, UNI_BSS_INFO_HE_BASIC, sizeof(*he));
he = (struct bss_info_uni_he *)tlv;
- he->he_pe_duration = vif->bss_conf.htc_trig_based_pkt_ext;
+ he->he_pe_duration = conf->htc_trig_based_pkt_ext;
if (!he->he_pe_duration)
he->he_pe_duration = DEFAULT_HE_PE_DURATION;
- he->he_rts_thres = cpu_to_le16(vif->bss_conf.frame_time_rts_th);
+ he->he_rts_thres = cpu_to_le16(conf->frame_time_rts_th);
if (!he->he_rts_thres)
he->he_rts_thres = cpu_to_le16(DEFAULT_HE_DURATION_RTS_THRES);
@@ -994,13 +992,13 @@ mt7996_mcu_bss_he_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
}
static void
-mt7996_mcu_bss_mbssid_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
+mt7996_mcu_bss_mbssid_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *conf,
struct mt7996_phy *phy, int enable)
{
struct bss_info_uni_mbssid *mbssid;
struct tlv *tlv;
- if (!vif->bss_conf.bssid_indicator && enable)
+ if (!conf->bssid_indicator && enable)
return;
tlv = mt7996_mcu_add_uni_tlv(skb, UNI_BSS_INFO_11V_MBSSID, sizeof(*mbssid));
@@ -1008,23 +1006,21 @@ mt7996_mcu_bss_mbssid_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
mbssid = (struct bss_info_uni_mbssid *)tlv;
if (enable) {
- mbssid->max_indicator = vif->bss_conf.bssid_indicator;
- mbssid->mbss_idx = vif->bss_conf.bssid_index;
+ mbssid->max_indicator = conf->bssid_indicator;
+ mbssid->mbss_idx = conf->bssid_index;
mbssid->tx_bss_omac_idx = 0;
}
}
static void
-mt7996_mcu_bss_bmc_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
+mt7996_mcu_bss_bmc_tlv(struct sk_buff *skb, struct mt7996_bss_conf *mconf,
struct mt7996_phy *phy)
{
- struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
struct bss_rate_tlv *bmc;
struct cfg80211_chan_def *chandef = &phy->mt76->chandef;
enum nl80211_band band = chandef->chan->band;
struct tlv *tlv;
- u8 idx = mvif->mcast_rates_idx ?
- mvif->mcast_rates_idx : mvif->basic_rates_idx;
+ u8 idx = mconf->mt76.mcast_rates_idx ?: mconf->mt76.basic_rates_idx;
tlv = mt7996_mcu_add_uni_tlv(skb, UNI_BSS_INFO_RATE, sizeof(*bmc));
@@ -1048,9 +1044,9 @@ mt7996_mcu_bss_txcmd_tlv(struct sk_buff *skb, bool en)
}
static void
-mt7996_mcu_bss_mld_tlv(struct sk_buff *skb, struct ieee80211_vif *vif)
+mt7996_mcu_bss_mld_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
+ struct mt7996_bss_conf *mconf)
{
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct bss_mld_tlv *mld;
struct tlv *tlv;
@@ -1058,33 +1054,30 @@ mt7996_mcu_bss_mld_tlv(struct sk_buff *skb, struct ieee80211_vif *vif)
mld = (struct bss_mld_tlv *)tlv;
mld->group_mld_id = 0xff;
- mld->own_mld_id = mvif->mt76.idx;
+ mld->own_mld_id = mconf->mt76.idx;
mld->remap_idx = 0xff;
}
static void
-mt7996_mcu_bss_sec_tlv(struct sk_buff *skb, struct ieee80211_vif *vif)
+mt7996_mcu_bss_sec_tlv(struct sk_buff *skb, struct mt7996_bss_conf *mconf)
{
- struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
struct bss_sec_tlv *sec;
struct tlv *tlv;
tlv = mt7996_mcu_add_uni_tlv(skb, UNI_BSS_INFO_SEC, sizeof(*sec));
sec = (struct bss_sec_tlv *)tlv;
- sec->cipher = mvif->cipher;
+ sec->cipher = mconf->mt76.cipher;
}
static int
-mt7996_mcu_muar_config(struct mt7996_phy *phy, struct ieee80211_vif *vif,
- bool bssid, bool enable)
+mt7996_mcu_muar_config(struct mt7996_phy *phy, struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf, bool bssid, bool enable)
{
#define UNI_MUAR_ENTRY 2
struct mt7996_dev *dev = phy->dev;
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
- u32 idx = mvif->mt76.omac_idx - REPEATER_BSSID_START;
- const u8 *addr = vif->addr;
-
+ u32 idx = mconf->mt76.omac_idx - REPEATER_BSSID_START;
+ const u8 *addr = bssid ? conf->bssid : conf->vif->addr;
struct {
struct {
u8 band;
@@ -1109,9 +1102,6 @@ mt7996_mcu_muar_config(struct mt7996_phy *phy, struct ieee80211_vif *vif,
.entry_add = true,
};
- if (bssid)
- addr = vif->bss_conf.bssid;
-
if (enable)
memcpy(req.addr, addr, ETH_ALEN);
@@ -1120,10 +1110,8 @@ mt7996_mcu_muar_config(struct mt7996_phy *phy, struct ieee80211_vif *vif,
}
static void
-mt7996_mcu_bss_ifs_timing_tlv(struct sk_buff *skb, struct ieee80211_vif *vif)
+mt7996_mcu_bss_ifs_timing_tlv(struct sk_buff *skb, struct mt7996_phy *phy)
{
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
- struct mt7996_phy *phy = mvif->phy;
struct bss_ifs_time_tlv *ifs_time;
struct tlv *tlv;
bool is_2ghz = phy->mt76->chandef.chan->band == NL80211_BAND_2GHZ;
@@ -1149,12 +1137,13 @@ mt7996_mcu_bss_ifs_timing_tlv(struct sk_buff *skb, struct ieee80211_vif *vif)
static int
mt7996_mcu_bss_basic_tlv(struct sk_buff *skb,
- struct ieee80211_vif *vif,
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf,
struct ieee80211_sta *sta,
struct mt76_phy *phy, u16 wlan_idx,
bool enable)
{
- struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
+ struct ieee80211_vif *vif = conf->vif;
struct cfg80211_chan_def *chandef = &phy->chandef;
struct mt76_connac_bss_basic_tlv *bss;
u32 type = CONNECTION_INFRA_AP;
@@ -1171,8 +1160,7 @@ mt7996_mcu_bss_basic_tlv(struct sk_buff *skb,
if (enable) {
rcu_read_lock();
if (!sta)
- sta = ieee80211_find_sta(vif,
- vif->bss_conf.bssid);
+ sta = ieee80211_find_sta(vif, conf->bssid);
/* TODO: enable BSS_INFO_UAPSD & BSS_INFO_PM */
if (sta) {
struct mt76_wcid *wcid;
@@ -1195,18 +1183,17 @@ mt7996_mcu_bss_basic_tlv(struct sk_buff *skb,
tlv = mt7996_mcu_add_uni_tlv(skb, UNI_BSS_INFO_BASIC, sizeof(*bss));
bss = (struct mt76_connac_bss_basic_tlv *)tlv;
- bss->bcn_interval = cpu_to_le16(vif->bss_conf.beacon_int);
- bss->dtim_period = vif->bss_conf.dtim_period;
bss->bmc_tx_wlan_idx = cpu_to_le16(wlan_idx);
bss->sta_idx = cpu_to_le16(sta_wlan_idx);
bss->conn_type = cpu_to_le32(type);
- bss->omac_idx = mvif->omac_idx;
- bss->band_idx = mvif->band_idx;
- bss->wmm_idx = mvif->wmm_idx;
+ bss->omac_idx = mconf->mt76.omac_idx;
+ bss->band_idx = mconf->mt76.band_idx;
+ bss->wmm_idx = mconf->mt76.wmm_idx;
bss->conn_state = !enable;
bss->active = enable;
- idx = mvif->omac_idx > EXT_BSSID_START ? HW_BSSID_0 : mvif->omac_idx;
+ idx = mconf->mt76.omac_idx > EXT_BSSID_START ? HW_BSSID_0 :
+ mconf->mt76.omac_idx;
bss->hw_bss_idx = idx;
if (vif->type == NL80211_IFTYPE_MONITOR) {
@@ -1219,9 +1206,9 @@ mt7996_mcu_bss_basic_tlv(struct sk_buff *skb,
return 0;
}
- memcpy(bss->bssid, vif->bss_conf.bssid, ETH_ALEN);
- bss->bcn_interval = cpu_to_le16(vif->bss_conf.beacon_int);
- bss->dtim_period = vif->bss_conf.dtim_period;
+ memcpy(bss->bssid, conf->bssid, ETH_ALEN);
+ bss->bcn_interval = cpu_to_le16(conf->beacon_int);
+ bss->dtim_period = conf->dtim_period;
bss->phymode = mt76_connac_get_phy_mode(phy, vif,
chandef->chan->band, NULL);
bss->phymode_ext = mt76_connac_get_phy_mode_ext(phy, vif,
@@ -1248,63 +1235,64 @@ __mt7996_mcu_alloc_bss_req(struct mt76_dev *dev, struct mt76_vif *mvif, int len)
}
int mt7996_mcu_add_bss_info(struct mt7996_phy *phy,
- struct ieee80211_vif *vif, int enable)
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf, int enable)
{
+ struct ieee80211_vif *vif = conf->vif;
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_dev *dev = phy->dev;
struct sk_buff *skb;
- if (mvif->mt76.omac_idx >= REPEATER_BSSID_START) {
- mt7996_mcu_muar_config(phy, vif, false, enable);
- mt7996_mcu_muar_config(phy, vif, true, enable);
+ if (mconf->mt76.omac_idx >= REPEATER_BSSID_START) {
+ mt7996_mcu_muar_config(phy, conf, mconf, false, enable);
+ mt7996_mcu_muar_config(phy, conf, mconf, true, enable);
}
- skb = __mt7996_mcu_alloc_bss_req(&dev->mt76, &mvif->mt76,
+ skb = __mt7996_mcu_alloc_bss_req(&dev->mt76, &mconf->mt76,
MT7996_BSS_UPDATE_MAX_SIZE);
if (IS_ERR(skb))
return PTR_ERR(skb);
/* bss_basic must be first */
- mt7996_mcu_bss_basic_tlv(skb, vif, NULL, phy->mt76,
+ mt7996_mcu_bss_basic_tlv(skb, conf, mconf, NULL, phy->mt76,
mvif->sta.wcid.idx, enable);
- mt7996_mcu_bss_sec_tlv(skb, vif);
+ mt7996_mcu_bss_sec_tlv(skb, mconf);
if (vif->type == NL80211_IFTYPE_MONITOR)
goto out;
if (enable) {
- mt7996_mcu_bss_rfch_tlv(skb, vif, phy);
- mt7996_mcu_bss_bmc_tlv(skb, vif, phy);
- mt7996_mcu_bss_ra_tlv(skb, vif, phy);
+ mt7996_mcu_bss_rfch_tlv(skb, phy);
+ mt7996_mcu_bss_bmc_tlv(skb, mconf, phy);
+ mt7996_mcu_bss_ra_tlv(skb);
mt7996_mcu_bss_txcmd_tlv(skb, true);
- mt7996_mcu_bss_ifs_timing_tlv(skb, vif);
+ mt7996_mcu_bss_ifs_timing_tlv(skb, phy);
- if (vif->bss_conf.he_support)
- mt7996_mcu_bss_he_tlv(skb, vif, phy);
+ if (conf->he_support)
+ mt7996_mcu_bss_he_tlv(skb, conf, phy);
/* this tag is necessary no matter if the vif is MLD */
- mt7996_mcu_bss_mld_tlv(skb, vif);
+ mt7996_mcu_bss_mld_tlv(skb, vif, mconf);
}
- mt7996_mcu_bss_mbssid_tlv(skb, vif, phy, enable);
+ mt7996_mcu_bss_mbssid_tlv(skb, conf, phy, enable);
out:
return mt76_mcu_skb_send_msg(&dev->mt76, skb,
MCU_WMWA_UNI_CMD(BSS_INFO_UPDATE), true);
}
-int mt7996_mcu_set_timing(struct mt7996_phy *phy, struct ieee80211_vif *vif)
+int mt7996_mcu_set_timing(struct mt7996_phy *phy, struct mt7996_bss_conf *mconf)
{
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_dev *dev = phy->dev;
struct sk_buff *skb;
- skb = __mt7996_mcu_alloc_bss_req(&dev->mt76, &mvif->mt76,
+ skb = __mt7996_mcu_alloc_bss_req(&dev->mt76, &mconf->mt76,
MT7996_BSS_UPDATE_MAX_SIZE);
if (IS_ERR(skb))
return PTR_ERR(skb);
- mt7996_mcu_bss_ifs_timing_tlv(skb, vif);
+ mt7996_mcu_bss_ifs_timing_tlv(skb, phy);
return mt76_mcu_skb_send_msg(&dev->mt76, skb,
MCU_WMWA_UNI_CMD(BSS_INFO_UPDATE), true);
@@ -1346,12 +1334,12 @@ int mt7996_mcu_add_tx_ba(struct mt7996_dev *dev,
bool enable)
{
struct mt7996_sta *msta = (struct mt7996_sta *)params->sta->drv_priv;
- struct mt7996_vif *mvif = msta->vif;
+ struct mt7996_bss_conf *mconf = mconf_dereference_protected(msta->vif, 0);
if (enable && !params->amsdu)
msta->wcid.amsdu = false;
- return mt7996_mcu_sta_ba(dev, &mvif->mt76, params, enable, true);
+ return mt7996_mcu_sta_ba(dev, &mconf->mt76, params, enable, true);
}
int mt7996_mcu_add_rx_ba(struct mt7996_dev *dev,
@@ -1359,13 +1347,14 @@ int mt7996_mcu_add_rx_ba(struct mt7996_dev *dev,
bool enable)
{
struct mt7996_sta *msta = (struct mt7996_sta *)params->sta->drv_priv;
- struct mt7996_vif *mvif = msta->vif;
+ struct mt7996_bss_conf *mconf = mconf_dereference_protected(msta->vif, 0);
- return mt7996_mcu_sta_ba(dev, &mvif->mt76, params, enable, false);
+ return mt7996_mcu_sta_ba(dev, &mconf->mt76, params, enable, false);
}
static void
-mt7996_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
+mt7996_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf,
struct ieee80211_sta *sta)
{
struct ieee80211_he_cap_elem *elem = &sta->deflink.he_cap.he_cap_elem;
@@ -1386,9 +1375,9 @@ mt7996_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
he->he_phy_cap[i] = elem->phy_cap_info[i];
}
- if (vif->type == NL80211_IFTYPE_AP &&
+ if (conf->vif->type == NL80211_IFTYPE_AP &&
(elem->phy_cap_info[1] & IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD))
- u8p_replace_bits(&he->he_phy_cap[1], vif->bss_conf.he_ldpc,
+ u8p_replace_bits(&he->he_phy_cap[1], conf->he_ldpc,
IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD);
mcs_map = sta->deflink.he_cap.he_mcs_nss_supp;
@@ -1396,16 +1385,16 @@ mt7996_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
case IEEE80211_STA_RX_BW_160:
if (elem->phy_cap_info[0] &
IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)
- mt7996_mcu_set_sta_he_mcs(sta,
+ mt7996_mcu_set_sta_he_mcs(sta, mconf,
&he->max_nss_mcs[CMD_HE_MCS_BW8080],
le16_to_cpu(mcs_map.rx_mcs_80p80));
- mt7996_mcu_set_sta_he_mcs(sta,
+ mt7996_mcu_set_sta_he_mcs(sta, mconf,
&he->max_nss_mcs[CMD_HE_MCS_BW160],
le16_to_cpu(mcs_map.rx_mcs_160));
fallthrough;
default:
- mt7996_mcu_set_sta_he_mcs(sta,
+ mt7996_mcu_set_sta_he_mcs(sta, mconf,
&he->max_nss_mcs[CMD_HE_MCS_BW80],
le16_to_cpu(mcs_map.rx_mcs_80));
break;
@@ -1496,7 +1485,7 @@ mt7996_mcu_sta_vht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
struct tlv *tlv;
#ifdef CONFIG_MTK_VENDOR
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
- struct mt7996_phy *phy = (struct mt7996_phy *)msta->vif->phy;
+ struct mt7996_phy *phy = (struct mt7996_phy *)msta->vif->deflink.phy;
#endif
/* For 6G band, this tlv is necessary to let hw work normally */
@@ -1553,25 +1542,26 @@ mt7996_mcu_sta_amsdu_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
static void
mt7996_mcu_sta_muru_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
- struct ieee80211_vif *vif, struct ieee80211_sta *sta)
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf,
+ struct ieee80211_sta *sta)
{
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
- struct mt7996_phy *phy = mvif->phy;
+ struct mt7996_phy *phy = mconf->phy;
struct ieee80211_he_cap_elem *elem = &sta->deflink.he_cap.he_cap_elem;
struct sta_rec_muru *muru;
struct tlv *tlv;
- if (vif->type != NL80211_IFTYPE_STATION &&
- vif->type != NL80211_IFTYPE_AP)
+ if (conf->vif->type != NL80211_IFTYPE_STATION &&
+ conf->vif->type != NL80211_IFTYPE_AP)
return;
tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_MURU, sizeof(*muru));
muru = (struct sta_rec_muru *)tlv;
- muru->cfg.mimo_dl_en = (vif->bss_conf.eht_mu_beamformer ||
- vif->bss_conf.he_mu_beamformer ||
- vif->bss_conf.vht_mu_beamformer ||
- vif->bss_conf.vht_mu_beamformee) &&
+ muru->cfg.mimo_dl_en = (conf->eht_mu_beamformer ||
+ conf->he_mu_beamformer ||
+ conf->vht_mu_beamformer ||
+ conf->vht_mu_beamformee) &&
!!(phy->muru_onoff & MUMIMO_DL);
muru->cfg.mimo_ul_en = !!(phy->muru_onoff & MUMIMO_UL);
muru->cfg.ofdma_dl_en = !!(phy->muru_onoff & OFDMA_DL);
@@ -1612,13 +1602,14 @@ mt7996_mcu_sta_muru_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
}
static inline bool
-mt7996_is_ebf_supported(struct mt7996_phy *phy, struct ieee80211_vif *vif,
+mt7996_is_ebf_supported(struct mt7996_phy *phy, struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf,
struct ieee80211_sta *sta, bool bfee)
{
int sts = hweight16(phy->mt76->chainmask);
- if (vif->type != NL80211_IFTYPE_STATION &&
- vif->type != NL80211_IFTYPE_AP)
+ if (conf->vif->type != NL80211_IFTYPE_STATION &&
+ conf->vif->type != NL80211_IFTYPE_AP)
return false;
if (!bfee && sts < 2)
@@ -1629,10 +1620,10 @@ mt7996_is_ebf_supported(struct mt7996_phy *phy, struct ieee80211_vif *vif,
struct ieee80211_eht_cap_elem_fixed *pe = &pc->eht_cap_elem;
if (bfee)
- return vif->bss_conf.eht_su_beamformee &&
+ return conf->eht_su_beamformee &&
EHT_PHY(CAP0_SU_BEAMFORMEE, pe->phy_cap_info[0]);
else
- return vif->bss_conf.eht_su_beamformer &&
+ return conf->eht_su_beamformer &&
EHT_PHY(CAP0_SU_BEAMFORMER, pe->phy_cap_info[0]);
}
@@ -1640,10 +1631,10 @@ mt7996_is_ebf_supported(struct mt7996_phy *phy, struct ieee80211_vif *vif,
struct ieee80211_he_cap_elem *pe = &sta->deflink.he_cap.he_cap_elem;
if (bfee)
- return vif->bss_conf.he_su_beamformee &&
+ return conf->he_su_beamformee &&
HE_PHY(CAP3_SU_BEAMFORMER, pe->phy_cap_info[3]);
else
- return vif->bss_conf.he_su_beamformer &&
+ return conf->he_su_beamformer &&
HE_PHY(CAP4_SU_BEAMFORMEE, pe->phy_cap_info[4]);
}
@@ -1651,10 +1642,10 @@ mt7996_is_ebf_supported(struct mt7996_phy *phy, struct ieee80211_vif *vif,
u32 cap = sta->deflink.vht_cap.cap;
if (bfee)
- return vif->bss_conf.vht_su_beamformee &&
+ return conf->vht_su_beamformee &&
(cap & IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE);
else
- return vif->bss_conf.vht_su_beamformer &&
+ return conf->vht_su_beamformer &&
(cap & IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE);
}
@@ -1850,10 +1841,10 @@ mt7996_mcu_sta_bfer_eht(struct ieee80211_sta *sta, struct ieee80211_vif *vif,
static void
mt7996_mcu_sta_bfer_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
- struct ieee80211_vif *vif, struct ieee80211_sta *sta)
+ struct ieee80211_bss_conf *conf, struct mt7996_bss_conf *mconf,
+ struct ieee80211_sta *sta)
{
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
- struct mt7996_phy *phy = mvif->phy;
+ struct mt7996_phy *phy = mconf->phy;
int tx_ant = hweight16(phy->mt76->chainmask) - 1;
struct sta_rec_bf *bf;
struct tlv *tlv;
@@ -1868,7 +1859,7 @@ mt7996_mcu_sta_bfer_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
if (!(sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he))
return;
- ebf = mt7996_is_ebf_supported(phy, vif, sta, false);
+ ebf = mt7996_is_ebf_supported(phy, conf, mconf, sta, false);
if (!ebf && !dev->ibf)
return;
@@ -1880,9 +1871,9 @@ mt7996_mcu_sta_bfer_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
* ht: iBF only, since mac80211 lacks of eBF support
*/
if (sta->deflink.eht_cap.has_eht && ebf)
- mt7996_mcu_sta_bfer_eht(sta, vif, phy, bf);
+ mt7996_mcu_sta_bfer_eht(sta, conf->vif, phy, bf);
else if (sta->deflink.he_cap.has_he && ebf)
- mt7996_mcu_sta_bfer_he(sta, vif, phy, bf);
+ mt7996_mcu_sta_bfer_he(sta, conf->vif, phy, bf);
else if (sta->deflink.vht_cap.vht_supported)
mt7996_mcu_sta_bfer_vht(sta, phy, bf, ebf);
else if (sta->deflink.ht_cap.ht_supported)
@@ -1921,10 +1912,10 @@ mt7996_mcu_sta_bfer_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
static void
mt7996_mcu_sta_bfee_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
- struct ieee80211_vif *vif, struct ieee80211_sta *sta)
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf, struct ieee80211_sta *sta)
{
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
- struct mt7996_phy *phy = mvif->phy;
+ struct mt7996_phy *phy = mconf->phy;
int tx_ant = hweight8(phy->mt76->antenna_mask) - 1;
struct sta_rec_bfee *bfee;
struct tlv *tlv;
@@ -1933,7 +1924,7 @@ mt7996_mcu_sta_bfee_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
if (!(sta->deflink.vht_cap.vht_supported || sta->deflink.he_cap.has_he))
return;
- if (!mt7996_is_ebf_supported(phy, vif, sta, true))
+ if (!mt7996_is_ebf_supported(phy, conf, mconf, sta, true))
return;
tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_BFEE, sizeof(*bfee));
@@ -2055,17 +2046,17 @@ int mt7996_mcu_set_fixed_rate_ctrl(struct mt7996_dev *dev,
MCU_WM_UNI_CMD(RA), true);
}
-int mt7996_mcu_set_fixed_field(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+int mt7996_mcu_set_fixed_field(struct mt7996_dev *dev,
+ struct mt7996_bss_conf *mconf,
struct ieee80211_sta *sta, void *data, u32 field)
{
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
struct sta_phy_uni *phy = data;
struct sta_rec_ra_fixed_uni *ra;
struct sk_buff *skb;
struct tlv *tlv;
- skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76,
+ skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mconf->mt76,
&msta->wcid,
MT7996_STA_UPDATE_MAX_SIZE);
if (IS_ERR(skb))
@@ -2097,12 +2088,13 @@ int mt7996_mcu_set_fixed_field(struct mt7996_dev *dev, struct ieee80211_vif *vif
}
static int
-mt7996_mcu_add_rate_ctrl_fixed(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+mt7996_mcu_add_rate_ctrl_fixed(struct mt7996_dev *dev,
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf,
struct ieee80211_sta *sta)
{
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
- struct cfg80211_chan_def *chandef = &mvif->phy->mt76->chandef;
- struct cfg80211_bitrate_mask *mask = &mvif->bitrate_mask;
+ struct cfg80211_chan_def *chandef = &mconf->phy->mt76->chandef;
+ struct cfg80211_bitrate_mask *mask = &mconf->bitrate_mask;
enum nl80211_band band = chandef->chan->band;
struct sta_phy_uni phy = {};
int ret, nrates = 0;
@@ -2144,7 +2136,7 @@ mt7996_mcu_add_rate_ctrl_fixed(struct mt7996_dev *dev, struct ieee80211_vif *vif
/* fixed single rate */
if (nrates == 1) {
- ret = mt7996_mcu_set_fixed_field(dev, vif, sta, &phy,
+ ret = mt7996_mcu_set_fixed_field(dev, mconf, sta, &phy,
RATE_PARAM_FIXED_MCS);
if (ret)
return ret;
@@ -2166,7 +2158,7 @@ mt7996_mcu_add_rate_ctrl_fixed(struct mt7996_dev *dev, struct ieee80211_vif *vif
else
mt76_rmw_field(dev, addr, GENMASK(15, 12), phy.sgi);
- ret = mt7996_mcu_set_fixed_field(dev, vif, sta, &phy,
+ ret = mt7996_mcu_set_fixed_field(dev, mconf, sta, &phy,
RATE_PARAM_FIXED_GI);
if (ret)
return ret;
@@ -2174,7 +2166,7 @@ mt7996_mcu_add_rate_ctrl_fixed(struct mt7996_dev *dev, struct ieee80211_vif *vif
/* fixed HE_LTF */
if (mask->control[band].he_ltf != GENMASK(7, 0)) {
- ret = mt7996_mcu_set_fixed_field(dev, vif, sta, &phy,
+ ret = mt7996_mcu_set_fixed_field(dev, mconf, sta, &phy,
RATE_PARAM_FIXED_HE_LTF);
if (ret)
return ret;
@@ -2185,13 +2177,14 @@ mt7996_mcu_add_rate_ctrl_fixed(struct mt7996_dev *dev, struct ieee80211_vif *vif
static void
mt7996_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7996_dev *dev,
- struct ieee80211_vif *vif, struct ieee80211_sta *sta)
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf,
+ struct ieee80211_sta *sta)
{
#define INIT_RCPI 180
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
- struct mt76_phy *mphy = mvif->phy->mt76;
+ struct mt76_phy *mphy = mconf->phy->mt76;
struct cfg80211_chan_def *chandef = &mphy->chandef;
- struct cfg80211_bitrate_mask *mask = &mvif->bitrate_mask;
+ struct cfg80211_bitrate_mask *mask = &mconf->bitrate_mask;
enum nl80211_band band = chandef->chan->band;
struct sta_rec_ra_uni *ra;
struct tlv *tlv;
@@ -2203,7 +2196,7 @@ mt7996_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7996_dev *dev,
ra->valid = true;
ra->auto_rate = true;
- ra->phy_mode = mt76_connac_get_phy_mode(mphy, vif, band, sta);
+ ra->phy_mode = mt76_connac_get_phy_mode(mphy, conf->vif, band, sta);
ra->channel = chandef->chan->hw_value;
ra->bw = (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_320) ?
CMD_CBW_320MHZ : sta->deflink.bandwidth;
@@ -2242,7 +2235,7 @@ mt7996_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7996_dev *dev,
cap |= STA_CAP_TX_STBC;
if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
cap |= STA_CAP_RX_STBC;
- if (vif->bss_conf.ht_ldpc &&
+ if (conf->ht_ldpc &&
(sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING))
cap |= STA_CAP_LDPC;
@@ -2268,7 +2261,7 @@ mt7996_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7996_dev *dev,
cap |= STA_CAP_VHT_TX_STBC;
if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXSTBC_1)
cap |= STA_CAP_VHT_RX_STBC;
- if (vif->bss_conf.vht_ldpc &&
+ if (conf->vht_ldpc &&
(sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC))
cap |= STA_CAP_VHT_LDPC;
@@ -2289,15 +2282,16 @@ mt7996_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7996_dev *dev,
memset(ra->rx_rcpi, INIT_RCPI, sizeof(ra->rx_rcpi));
}
-int mt7996_mcu_add_rate_ctrl(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+int mt7996_mcu_add_rate_ctrl(struct mt7996_dev *dev,
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf,
struct ieee80211_sta *sta, bool changed)
{
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
struct sk_buff *skb;
int ret;
- skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76,
+ skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mconf->mt76,
&msta->wcid,
MT7996_STA_UPDATE_MAX_SIZE);
if (IS_ERR(skb))
@@ -2308,26 +2302,27 @@ int mt7996_mcu_add_rate_ctrl(struct mt7996_dev *dev, struct ieee80211_vif *vif,
* update sta_rec_he here.
*/
if (changed)
- mt7996_mcu_sta_he_tlv(skb, vif, sta);
+ mt7996_mcu_sta_he_tlv(skb, conf, mconf, sta);
/* sta_rec_ra accommodates BW, NSS and only MCS range format
* i.e 0-{7,8,9} for VHT.
*/
- mt7996_mcu_sta_rate_ctrl_tlv(skb, dev, vif, sta);
+ mt7996_mcu_sta_rate_ctrl_tlv(skb, dev, conf, mconf, sta);
ret = mt76_mcu_skb_send_msg(&dev->mt76, skb,
MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true);
if (ret)
return ret;
- return mt7996_mcu_add_rate_ctrl_fixed(dev, vif, sta);
+ return mt7996_mcu_add_rate_ctrl_fixed(dev, conf, mconf, sta);
}
static int
-mt7996_mcu_sta_init_vow(struct mt7996_phy *phy, struct mt7996_sta *msta)
+mt7996_mcu_sta_init_vow(struct mt7996_bss_conf *mconf, struct mt7996_sta *msta)
{
+ struct mt7996_phy *phy = mconf->phy;
struct mt7996_vow_sta_ctrl *vow = &msta->vow;
- u8 omac_idx = msta->vif->mt76.omac_idx;
+ u8 omac_idx = mconf->mt76.omac_idx;
int ret;
/* Assignment of STA BSS group index aligns FW.
@@ -2344,20 +2339,22 @@ mt7996_mcu_sta_init_vow(struct mt7996_phy *phy, struct mt7996_sta *msta)
vow->drr_quantum[IEEE80211_AC_BE] = VOW_DRR_QUANTUM_IDX2;
vow->drr_quantum[IEEE80211_AC_BK] = VOW_DRR_QUANTUM_IDX2;
- ret = mt7996_mcu_set_vow_drr_ctrl(phy, msta, VOW_DRR_CTRL_STA_BSS_GROUP);
+ ret = mt7996_mcu_set_vow_drr_ctrl(phy, mconf, msta, VOW_DRR_CTRL_STA_BSS_GROUP);
if (ret)
return ret;
- ret = mt7996_mcu_set_vow_drr_ctrl(phy, msta, VOW_DRR_CTRL_STA_PAUSE);
+ ret = mt7996_mcu_set_vow_drr_ctrl(phy, mconf, msta, VOW_DRR_CTRL_STA_PAUSE);
if (ret)
return ret;
- return mt7996_mcu_set_vow_drr_ctrl(phy, msta, VOW_DRR_CTRL_STA_ALL);
+ return mt7996_mcu_set_vow_drr_ctrl(phy, mconf, msta, VOW_DRR_CTRL_STA_ALL);
}
-int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
- struct ieee80211_sta *sta, bool enable, bool newly)
+int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf, struct ieee80211_sta *sta,
+ bool enable, bool newly)
{
+ struct ieee80211_vif *vif = conf->vif;
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_sta *msta;
struct sk_buff *skb;
@@ -2365,7 +2362,7 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
msta = sta ? (struct mt7996_sta *)sta->drv_priv : &mvif->sta;
- skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76,
+ skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mconf->mt76,
&msta->wcid,
MT7996_STA_UPDATE_MAX_SIZE);
if (IS_ERR(skb))
@@ -2387,7 +2384,7 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
/* starec hdrt mode */
mt7996_mcu_sta_hdrt_tlv(dev, skb);
/* starec bfer */
- mt7996_mcu_sta_bfer_tlv(dev, skb, vif, sta);
+ mt7996_mcu_sta_bfer_tlv(dev, skb, conf, mconf, sta);
/* starec ht */
mt7996_mcu_sta_ht_tlv(skb, sta);
/* starec vht */
@@ -2397,18 +2394,18 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
/* starec amsdu */
mt7996_mcu_sta_amsdu_tlv(dev, skb, vif, sta);
/* starec he */
- mt7996_mcu_sta_he_tlv(skb, vif, sta);
+ mt7996_mcu_sta_he_tlv(skb, conf, mconf, sta);
/* starec he 6g*/
mt7996_mcu_sta_he_6g_tlv(skb, sta);
/* starec eht */
mt7996_mcu_sta_eht_tlv(skb, sta);
/* starec muru */
- mt7996_mcu_sta_muru_tlv(dev, skb, vif, sta);
+ mt7996_mcu_sta_muru_tlv(dev, skb, conf, mconf, sta);
/* starec bfee */
- mt7996_mcu_sta_bfee_tlv(dev, skb, vif, sta);
+ mt7996_mcu_sta_bfee_tlv(dev, skb, conf, mconf, sta);
}
- ret = mt7996_mcu_sta_init_vow(mvif->phy, msta);
+ ret = mt7996_mcu_sta_init_vow(mconf, msta);
if (ret) {
dev_kfree_skb(skb);
return ret;
@@ -2463,16 +2460,15 @@ mt7996_mcu_sta_key_tlv(struct mt76_wcid *wcid,
return 0;
}
-int mt7996_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif,
+int mt7996_mcu_add_key(struct mt76_dev *dev, struct mt7996_bss_conf *mconf,
struct ieee80211_key_conf *key, int mcu_cmd,
struct mt76_wcid *wcid, enum set_key_cmd cmd)
{
- struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
struct sk_buff *skb;
int ret;
- skb = __mt76_connac_mcu_alloc_sta_req(dev, mvif, wcid,
- MT7996_STA_UPDATE_MAX_SIZE);
+ skb = __mt76_connac_mcu_alloc_sta_req(dev, (struct mt76_vif *)mconf,
+ wcid, MT7996_STA_UPDATE_MAX_SIZE);
if (IS_ERR(skb))
return PTR_ERR(skb);
@@ -2483,17 +2479,18 @@ int mt7996_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif,
return mt76_mcu_skb_send_msg(dev, skb, mcu_cmd, true);
}
-static int mt7996_mcu_get_pn(struct mt7996_dev *dev, struct ieee80211_vif *vif,
- u8 *pn)
+static int mt7996_mcu_get_pn(struct mt7996_dev *dev,
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf, u8 *pn)
{
#define TSC_TYPE_BIGTK_PN 2
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ struct mt7996_vif *mvif = (struct mt7996_vif *)conf->vif->drv_priv;
struct sta_rec_pn_info *pn_info;
struct sk_buff *skb, *rskb;
struct tlv *tlv;
int ret;
- skb = mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76, &mvif->sta.wcid);
+ skb = mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mconf->mt76, &mvif->sta.wcid);
if (IS_ERR(skb))
return PTR_ERR(skb);
@@ -2517,10 +2514,11 @@ static int mt7996_mcu_get_pn(struct mt7996_dev *dev, struct ieee80211_vif *vif,
return 0;
}
-int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev,
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf,
struct ieee80211_key_conf *key)
{
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_mcu_bcn_prot_tlv *bcn_prot;
struct sk_buff *skb;
struct tlv *tlv;
@@ -2529,7 +2527,7 @@ int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev, struct ieee80211_vif *vif
sizeof(struct mt7996_mcu_bcn_prot_tlv);
int ret;
- skb = __mt7996_mcu_alloc_bss_req(&dev->mt76, &mvif->mt76, len);
+ skb = __mt7996_mcu_alloc_bss_req(&dev->mt76, &mconf->mt76, len);
if (IS_ERR(skb))
return PTR_ERR(skb);
@@ -2537,7 +2535,7 @@ int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev, struct ieee80211_vif *vif
bcn_prot = (struct mt7996_mcu_bcn_prot_tlv *)tlv;
- ret = mt7996_mcu_get_pn(dev, vif, pn);
+ ret = mt7996_mcu_get_pn(dev, conf, mconf, pn);
if (ret) {
dev_kfree_skb(skb);
return ret;
@@ -2570,10 +2568,10 @@ int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev, struct ieee80211_vif *vif
MCU_WMWA_UNI_CMD(BSS_INFO_UPDATE), true);
}
int mt7996_mcu_add_dev_info(struct mt7996_phy *phy,
- struct ieee80211_vif *vif, bool enable)
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf, bool enable)
{
struct mt7996_dev *dev = phy->dev;
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct {
struct req_hdr {
u8 omac_idx;
@@ -2589,8 +2587,8 @@ int mt7996_mcu_add_dev_info(struct mt7996_phy *phy,
} __packed tlv;
} data = {
.hdr = {
- .omac_idx = mvif->mt76.omac_idx,
- .band_idx = mvif->mt76.band_idx,
+ .omac_idx = mconf->mt76.omac_idx,
+ .band_idx = mconf->mt76.band_idx,
},
.tlv = {
.tag = cpu_to_le16(DEV_INFO_ACTIVE),
@@ -2599,16 +2597,16 @@ int mt7996_mcu_add_dev_info(struct mt7996_phy *phy,
},
};
- if (mvif->mt76.omac_idx >= REPEATER_BSSID_START)
- return mt7996_mcu_muar_config(phy, vif, false, enable);
+ if (mconf->mt76.omac_idx >= REPEATER_BSSID_START)
+ return mt7996_mcu_muar_config(phy, conf, mconf, false, enable);
- memcpy(data.tlv.omac_addr, vif->addr, ETH_ALEN);
+ memcpy(data.tlv.omac_addr, conf->addr, ETH_ALEN);
return mt76_mcu_send_msg(&dev->mt76, MCU_WMWA_UNI_CMD(DEV_INFO_UPDATE),
&data, sizeof(data), true);
}
static void
-mt7996_mcu_beacon_cntdwn(struct ieee80211_vif *vif, struct sk_buff *rskb,
+mt7996_mcu_beacon_cntdwn(struct ieee80211_bss_conf *conf, struct sk_buff *rskb,
struct sk_buff *skb,
struct ieee80211_mutable_offsets *offs)
{
@@ -2619,7 +2617,7 @@ mt7996_mcu_beacon_cntdwn(struct ieee80211_vif *vif, struct sk_buff *rskb,
if (!offs->cntdwn_counter_offs[0])
return;
- tag = vif->bss_conf.csa_active ? UNI_BSS_INFO_BCN_CSA : UNI_BSS_INFO_BCN_BCC;
+ tag = conf->csa_active ? UNI_BSS_INFO_BCN_CSA : UNI_BSS_INFO_BCN_BCC;
tlv = mt7996_mcu_add_uni_tlv(rskb, tag, sizeof(*info));
@@ -2629,14 +2627,15 @@ mt7996_mcu_beacon_cntdwn(struct ieee80211_vif *vif, struct sk_buff *rskb,
static void
mt7996_mcu_beacon_mbss(struct sk_buff *rskb, struct sk_buff *skb,
- struct ieee80211_vif *vif, struct bss_bcn_content_tlv *bcn,
+ struct ieee80211_bss_conf *conf,
+ struct bss_bcn_content_tlv *bcn,
struct ieee80211_mutable_offsets *offs)
{
struct bss_bcn_mbss_tlv *mbss;
const struct element *elem;
struct tlv *tlv;
- if (!vif->bss_conf.bssid_indicator)
+ if (!conf->bssid_indicator)
return;
tlv = mt7996_mcu_add_uni_tlv(rskb, UNI_BSS_INFO_BCN_MBSSID, sizeof(*mbss));
@@ -2681,7 +2680,7 @@ mt7996_mcu_beacon_mbss(struct sk_buff *rskb, struct sk_buff *skb,
}
static void
-mt7996_mcu_beacon_cont(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+mt7996_mcu_beacon_cont(struct mt7996_dev *dev, struct ieee80211_bss_conf *conf,
struct sk_buff *rskb, struct sk_buff *skb,
struct bss_bcn_content_tlv *bcn,
struct ieee80211_mutable_offsets *offs)
@@ -2695,9 +2694,9 @@ mt7996_mcu_beacon_cont(struct mt7996_dev *dev, struct ieee80211_vif *vif,
if (offs->cntdwn_counter_offs[0]) {
u16 offset = offs->cntdwn_counter_offs[0];
- if (vif->bss_conf.csa_active)
+ if (conf->csa_active)
bcn->csa_ie_pos = cpu_to_le16(offset - 4);
- if (vif->bss_conf.color_change_active)
+ if (conf->color_change_active)
bcn->bcc_ie_pos = cpu_to_le16(offset - 3);
}
@@ -2709,11 +2708,11 @@ mt7996_mcu_beacon_cont(struct mt7996_dev *dev, struct ieee80211_vif *vif,
}
int mt7996_mcu_add_beacon(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif, int en)
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf, int en)
{
struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct mt7996_phy *phy = mt7996_hw_phy(hw);
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct ieee80211_mutable_offsets offs;
struct ieee80211_tx_info *info;
struct sk_buff *skb, *rskb;
@@ -2721,15 +2720,15 @@ int mt7996_mcu_add_beacon(struct ieee80211_hw *hw,
struct bss_bcn_content_tlv *bcn;
int len;
- if (vif->bss_conf.nontransmitted)
+ if (conf->nontransmitted)
return 0;
- rskb = __mt7996_mcu_alloc_bss_req(&dev->mt76, &mvif->mt76,
+ rskb = __mt7996_mcu_alloc_bss_req(&dev->mt76, &mconf->mt76,
MT7996_MAX_BSS_OFFLOAD_SIZE);
if (IS_ERR(rskb))
return PTR_ERR(rskb);
- skb = ieee80211_beacon_get_template(hw, vif, &offs, 0);
+ skb = ieee80211_beacon_get_template(hw, conf->vif, &offs, 0);
if (!skb) {
dev_kfree_skb(rskb);
return -EINVAL;
@@ -2752,9 +2751,9 @@ int mt7996_mcu_add_beacon(struct ieee80211_hw *hw,
if (!en)
goto out;
- mt7996_mcu_beacon_cont(dev, vif, rskb, skb, bcn, &offs);
- mt7996_mcu_beacon_mbss(rskb, skb, vif, bcn, &offs);
- mt7996_mcu_beacon_cntdwn(vif, rskb, skb, &offs);
+ mt7996_mcu_beacon_cont(dev, conf, rskb, skb, bcn, &offs);
+ mt7996_mcu_beacon_mbss(rskb, skb, conf, bcn, &offs);
+ mt7996_mcu_beacon_cntdwn(conf, rskb, skb, &offs);
out:
dev_kfree_skb(skb);
return mt76_mcu_skb_send_msg(&phy->dev->mt76, rskb,
@@ -2762,14 +2761,15 @@ out:
}
int mt7996_mcu_beacon_inband_discov(struct mt7996_dev *dev,
- struct ieee80211_vif *vif, u32 changed)
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf, u32 changed)
{
#define OFFLOAD_TX_MODE_SU BIT(0)
#define OFFLOAD_TX_MODE_MU BIT(1)
struct ieee80211_hw *hw = mt76_hw(dev);
+ struct ieee80211_vif *vif = conf->vif;
struct mt7996_phy *phy = mt7996_hw_phy(hw);
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
- struct cfg80211_chan_def *chandef = &mvif->phy->mt76->chandef;
+ struct cfg80211_chan_def *chandef = &mconf->phy->mt76->chandef;
enum nl80211_band band = chandef->chan->band;
struct mt76_wcid *wcid = &dev->mt76.global_wcid;
struct bss_inband_discovery_tlv *discov;
@@ -2779,20 +2779,20 @@ int mt7996_mcu_beacon_inband_discov(struct mt7996_dev *dev,
u8 *buf, interval;
int len;
- if (vif->bss_conf.nontransmitted)
+ if (conf->nontransmitted)
return 0;
- rskb = __mt7996_mcu_alloc_bss_req(&dev->mt76, &mvif->mt76,
+ rskb = __mt7996_mcu_alloc_bss_req(&dev->mt76, &mconf->mt76,
MT7996_MAX_BSS_OFFLOAD_SIZE);
if (IS_ERR(rskb))
return PTR_ERR(rskb);
if (changed & BSS_CHANGED_FILS_DISCOVERY) {
- interval = vif->bss_conf.fils_discovery.max_interval;
+ interval = conf->fils_discovery.max_interval;
skb = ieee80211_get_fils_discovery_tmpl(hw, vif);
} else if (changed & BSS_CHANGED_UNSOL_BCAST_PROBE_RESP &&
- vif->bss_conf.unsol_bcast_probe_resp_interval) {
- interval = vif->bss_conf.unsol_bcast_probe_resp_interval;
+ conf->unsol_bcast_probe_resp_interval) {
+ interval = conf->unsol_bcast_probe_resp_interval;
skb = ieee80211_get_unsol_bcast_probe_resp_tmpl(hw, vif);
}
@@ -3456,7 +3456,7 @@ int mt7996_mcu_set_hdr_trans(struct mt7996_dev *dev, bool hdr_trans)
MCU_WM_UNI_CMD(RX_HDR_TRANS), true);
}
-int mt7996_mcu_set_tx(struct mt7996_dev *dev, struct ieee80211_vif *vif)
+int mt7996_mcu_set_tx(struct mt7996_dev *dev, struct mt7996_bss_conf *mconf)
{
#define MCU_EDCA_AC_PARAM 0
#define WMM_AIFS_SET BIT(0)
@@ -3465,12 +3465,11 @@ int mt7996_mcu_set_tx(struct mt7996_dev *dev, struct ieee80211_vif *vif)
#define WMM_TXOP_SET BIT(3)
#define WMM_PARAM_SET (WMM_AIFS_SET | WMM_CW_MIN_SET | \
WMM_CW_MAX_SET | WMM_TXOP_SET)
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct {
u8 bss_idx;
u8 __rsv[3];
} __packed hdr = {
- .bss_idx = mvif->mt76.idx,
+ .bss_idx = mconf->mt76.idx,
};
struct sk_buff *skb;
int len = sizeof(hdr) + IEEE80211_NUM_ACS * sizeof(struct edca);
@@ -3483,7 +3482,7 @@ int mt7996_mcu_set_tx(struct mt7996_dev *dev, struct ieee80211_vif *vif)
skb_put_data(skb, &hdr, sizeof(hdr));
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
- struct ieee80211_tx_queue_params *q = &mvif->queue_params[ac];
+ struct ieee80211_tx_queue_params *q = &mconf->queue_params[ac];
struct edca *e;
struct tlv *tlv;
@@ -4496,12 +4495,12 @@ mt7996_mcu_set_obss_spr_pd(struct mt7996_phy *phy,
}
static int
-mt7996_mcu_set_obss_spr_siga(struct mt7996_phy *phy, struct ieee80211_vif *vif,
+mt7996_mcu_set_obss_spr_siga(struct mt7996_phy *phy,
+ struct mt7996_bss_conf *mconf,
struct ieee80211_he_obss_pd *he_obss_pd)
{
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_dev *dev = phy->dev;
- u8 omac = mvif->mt76.omac_idx;
+ u8 omac = mconf->mt76.omac_idx;
struct {
u8 band_idx;
u8 __rsv[3];
@@ -4573,7 +4572,8 @@ mt7996_mcu_set_obss_spr_bitmap(struct mt7996_phy *phy,
sizeof(req), true);
}
-int mt7996_mcu_add_obss_spr(struct mt7996_phy *phy, struct ieee80211_vif *vif,
+int mt7996_mcu_add_obss_spr(struct mt7996_phy *phy,
+ struct mt7996_bss_conf *mconf,
struct ieee80211_he_obss_pd *he_obss_pd)
{
int ret;
@@ -4607,7 +4607,7 @@ int mt7996_mcu_add_obss_spr(struct mt7996_phy *phy, struct ieee80211_vif *vif,
return ret;
/* Set SR prohibit */
- ret = mt7996_mcu_set_obss_spr_siga(phy, vif, he_obss_pd);
+ ret = mt7996_mcu_set_obss_spr_siga(phy, mconf, he_obss_pd);
if (ret)
return ret;
@@ -4615,16 +4615,16 @@ int mt7996_mcu_add_obss_spr(struct mt7996_phy *phy, struct ieee80211_vif *vif,
return mt7996_mcu_set_obss_spr_bitmap(phy, he_obss_pd);
}
-int mt7996_mcu_update_bss_color(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+int mt7996_mcu_update_bss_color(struct mt7996_dev *dev,
+ struct mt7996_bss_conf *mconf,
struct cfg80211_he_bss_color *he_bss_color)
{
int len = sizeof(struct bss_req_hdr) + sizeof(struct bss_color_tlv);
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct bss_color_tlv *bss_color;
struct sk_buff *skb;
struct tlv *tlv;
- skb = __mt7996_mcu_alloc_bss_req(&dev->mt76, &mvif->mt76, len);
+ skb = __mt7996_mcu_alloc_bss_req(&dev->mt76, &mconf->mt76, len);
if (IS_ERR(skb))
return PTR_ERR(skb);
@@ -4643,7 +4643,7 @@ int mt7996_mcu_update_bss_color(struct mt7996_dev *dev, struct ieee80211_vif *vi
#define TWT_AGRT_PROTECT BIT(2)
int mt7996_mcu_twt_agrt_update(struct mt7996_dev *dev,
- struct mt7996_vif *mvif,
+ struct mt7996_bss_conf *mconf,
struct mt7996_twt_flow *flow,
int cmd)
{
@@ -4674,12 +4674,12 @@ int mt7996_mcu_twt_agrt_update(struct mt7996_dev *dev,
.len = cpu_to_le16(sizeof(req) - 4),
.tbl_idx = flow->table_id,
.cmd = cmd,
- .own_mac_idx = mvif->mt76.omac_idx,
+ .own_mac_idx = mconf->mt76.omac_idx,
.flowid = flow->id,
.peer_id = cpu_to_le16(flow->wcid),
.duration = flow->duration,
- .bss = mvif->mt76.idx,
- .bss_idx = mvif->mt76.idx,
+ .bss = mconf->mt76.idx,
+ .bss_idx = mconf->mt76.idx,
.start_tsf = cpu_to_le64(flow->tsf),
.mantissa = flow->mantissa,
.exponent = flow->exp,
@@ -4810,15 +4810,15 @@ int mt7996_mcu_rdd_background_disable_timer(struct mt7996_dev *dev, bool disable
int mt7996_mcu_wtbl_update_hdr_trans(struct mt7996_dev *dev,
struct ieee80211_vif *vif,
+ struct mt7996_bss_conf *mconf,
struct ieee80211_sta *sta)
{
- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_sta *msta;
struct sk_buff *skb;
- msta = sta ? (struct mt7996_sta *)sta->drv_priv : &mvif->sta;
+ msta = sta ? (struct mt7996_sta *)sta->drv_priv : &mconf->vif->sta;
- skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76,
+ skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mconf->mt76,
&msta->wcid,
MT7996_STA_UPDATE_MAX_SIZE);
if (IS_ERR(skb))
@@ -5462,8 +5462,9 @@ int mt7996_mcu_set_scs(struct mt7996_phy *phy, u8 enable)
&req, sizeof(req), false);
}
-int mt7996_mcu_set_vow_drr_ctrl(struct mt7996_phy *phy, struct mt7996_sta *msta,
- enum vow_drr_ctrl_id id)
+int mt7996_mcu_set_vow_drr_ctrl(struct mt7996_phy *phy,
+ struct mt7996_bss_conf *mconf,
+ struct mt7996_sta *msta, enum vow_drr_ctrl_id id)
{
struct mt7996_vow_sta_ctrl *vow = msta ? &msta->vow : NULL;
u32 val = 0;
@@ -5489,9 +5490,9 @@ int mt7996_mcu_set_vow_drr_ctrl(struct mt7996_phy *phy, struct mt7996_sta *msta,
.len = cpu_to_le16(sizeof(req) - 4),
.wlan_idx = cpu_to_le16(msta ? msta->wcid.idx : 0),
.band_idx = phy->mt76->band_idx,
- .wmm_idx = msta ? msta->vif->mt76.wmm_idx : 0,
+ .wmm_idx = msta ? mconf->mt76.wmm_idx : 0,
.ctrl_id = cpu_to_le32(id),
- .omac_idx = msta ? msta->vif->mt76.omac_idx : 0
+ .omac_idx = msta ? mconf->mt76.omac_idx : 0
};
switch (id) {
@@ -5679,7 +5680,7 @@ void mt7996_set_wireless_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
{
u8 mode, val;
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
- struct mt7996_phy *phy = mvif->phy;
+ struct mt7996_phy *phy = mvif->deflink.phy;
mode = FIELD_GET(RATE_CFG_MODE, *((u32 *)data));
val = FIELD_GET(RATE_CFG_VAL, *((u32 *)data));
@@ -5710,11 +5711,11 @@ void mt7996_set_wireless_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
void mt7996_set_beacon_vif(void *data, u8 *mac, struct ieee80211_vif *vif)
{
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
- struct ieee80211_hw *hw = mvif->phy->mt76->hw;
+ struct ieee80211_hw *hw = mvif->deflink.phy->mt76->hw;
u8 val = *((u8 *)data);
vif->bss_conf.enable_beacon = val;
- mt7996_mcu_add_beacon(hw, vif, val);
+ mt7996_mcu_add_beacon(hw, &vif->bss_conf, &mvif->deflink, val);
}
#endif
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
index 2b266d1..6b03ee1 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -324,18 +324,25 @@ struct mt7996_sta {
struct mt7996_vow_sta_ctrl vow;
};
-struct mt7996_vif {
+struct mt7996_bss_conf {
struct mt76_vif mt76; /* must be first */
- struct mt7996_sta sta;
+ struct mt7996_vif *vif;
struct mt7996_phy *phy;
-
struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS];
struct cfg80211_bitrate_mask bitrate_mask;
struct mt7996_chanctx *chanctx;
};
+struct mt7996_vif {
+ struct mt7996_bss_conf deflink;
+ struct mt7996_bss_conf __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
+
+ struct mt7996_sta sta;
+ struct mt7996_dev *dev;
+};
+
/* crash-dump */
struct mt7996_crash_data {
guid_t guid;
@@ -769,6 +776,13 @@ mt7996_chanctx_get(struct ieee80211_chanctx_conf *ctx)
return (struct mt7996_chanctx *)&ctx->drv_priv;
}
+static inline struct mt7996_bss_conf *
+mconf_dereference_protected(struct mt7996_vif *mvif, u8 link_id)
+{
+ return rcu_dereference_protected(mvif->link[link_id],
+ lockdep_is_held(&mvif->dev->mt76.mutex));
+}
+
extern const struct ieee80211_ops mt7996_ops;
extern struct pci_driver mt7996_pci_driver;
extern struct pci_driver mt7996_hif_driver;
@@ -779,7 +793,7 @@ struct mt7996_dev *mt7996_mmio_probe(struct device *pdev,
void mt7996_wfsys_reset(struct mt7996_dev *dev);
void mt7996_rro_hw_init(struct mt7996_dev *dev);
irqreturn_t mt7996_irq_handler(int irq, void *dev_instance);
-u64 __mt7996_get_tsf(struct ieee80211_hw *hw, struct mt7996_vif *mvif);
+u64 __mt7996_get_tsf(struct ieee80211_hw *hw, struct mt7996_bss_conf *mconf);
int mt7996_register_device(struct mt7996_dev *dev);
void mt7996_unregister_device(struct mt7996_dev *dev);
const char *mt7996_eeprom_name(struct mt7996_dev *dev);
@@ -805,37 +819,47 @@ int mt7996_run(struct ieee80211_hw *hw);
int mt7996_mcu_init(struct mt7996_dev *dev);
int mt7996_mcu_init_firmware(struct mt7996_dev *dev);
int mt7996_mcu_twt_agrt_update(struct mt7996_dev *dev,
- struct mt7996_vif *mvif,
+ struct mt7996_bss_conf *mconf,
struct mt7996_twt_flow *flow,
int cmd);
int mt7996_mcu_add_dev_info(struct mt7996_phy *phy,
- struct ieee80211_vif *vif, bool enable);
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf, bool enable);
int mt7996_mcu_add_bss_info(struct mt7996_phy *phy,
- struct ieee80211_vif *vif, int enable);
-int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
- struct ieee80211_sta *sta, bool enable, bool newly);
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf, int enable);
+int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf, struct ieee80211_sta *sta,
+ bool enable, bool newly);
int mt7996_mcu_add_tx_ba(struct mt7996_dev *dev,
struct ieee80211_ampdu_params *params,
bool add);
int mt7996_mcu_add_rx_ba(struct mt7996_dev *dev,
struct ieee80211_ampdu_params *params,
bool add);
-int mt7996_mcu_update_bss_color(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+int mt7996_mcu_update_bss_color(struct mt7996_dev *dev,
+ struct mt7996_bss_conf *mconf,
struct cfg80211_he_bss_color *he_bss_color);
-int mt7996_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- int enable);
+int mt7996_mcu_add_beacon(struct ieee80211_hw *hw,
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf, int en);
int mt7996_mcu_beacon_inband_discov(struct mt7996_dev *dev,
- struct ieee80211_vif *vif, u32 changed);
-int mt7996_mcu_add_obss_spr(struct mt7996_phy *phy, struct ieee80211_vif *vif,
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf, u32 changed);
+int mt7996_mcu_add_obss_spr(struct mt7996_phy *phy,
+ struct mt7996_bss_conf *mconf,
struct ieee80211_he_obss_pd *he_obss_pd);
-int mt7996_mcu_add_rate_ctrl(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+int mt7996_mcu_add_rate_ctrl(struct mt7996_dev *dev,
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf,
struct ieee80211_sta *sta, bool changed);
int mt7996_set_channel(struct mt7996_phy *phy, struct cfg80211_chan_def *chandef);
int mt7996_mcu_set_chan_info(struct mt7996_phy *phy, u16 tag);
-int mt7996_mcu_set_tx(struct mt7996_dev *dev, struct ieee80211_vif *vif);
+int mt7996_mcu_set_tx(struct mt7996_dev *dev, struct mt7996_bss_conf *mconf);
int mt7996_mcu_set_fixed_rate_ctrl(struct mt7996_dev *dev,
void *data, u16 version);
-int mt7996_mcu_set_fixed_field(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+int mt7996_mcu_set_fixed_field(struct mt7996_dev *dev,
+ struct mt7996_bss_conf *mconf,
struct ieee80211_sta *sta, void *data, u32 field);
int mt7996_mcu_set_eeprom(struct mt7996_dev *dev);
int mt7996_mcu_get_eeprom(struct mt7996_dev *dev, u32 offset, u8 *read_buf);
@@ -850,7 +874,7 @@ int mt7996_mcu_set_radar_th(struct mt7996_dev *dev, int index,
const struct mt7996_dfs_pattern *pattern);
int mt7996_mcu_set_radio_en(struct mt7996_phy *phy, bool enable);
int mt7996_mcu_set_rts_thresh(struct mt7996_phy *phy, u32 val);
-int mt7996_mcu_set_timing(struct mt7996_phy *phy, struct ieee80211_vif *vif);
+int mt7996_mcu_set_timing(struct mt7996_phy *phy, struct mt7996_bss_conf *mconf);
int mt7996_mcu_get_chan_mib_info(struct mt7996_phy *phy, bool chan_switch);
int mt7996_mcu_get_temperature(struct mt7996_phy *phy);
int mt7996_mcu_set_thermal_throttling(struct mt7996_phy *phy, u8 state);
@@ -890,8 +914,9 @@ void mt7996_tm_rf_test_event(struct mt7996_dev *dev, struct sk_buff *skb);
int mt7996_mcu_set_scs(struct mt7996_phy *phy, u8 enable);
void mt7996_mcu_scs_sta_poll(struct work_struct *work);
int mt7996_mcu_set_band_confg(struct mt7996_phy *phy, u16 option, bool enable);
-int mt7996_mcu_set_vow_drr_ctrl(struct mt7996_phy *phy, struct mt7996_sta *msta,
- enum vow_drr_ctrl_id id);
+int mt7996_mcu_set_vow_drr_ctrl(struct mt7996_phy *phy,
+ struct mt7996_bss_conf *mconf,
+ struct mt7996_sta *msta, enum vow_drr_ctrl_id id);
int mt7996_mcu_set_vow_feature_ctrl(struct mt7996_phy *phy);
void mt7996_mcu_wmm_pbc_work(struct work_struct *work);
@@ -1000,13 +1025,16 @@ void mt7996_update_channel(struct mt76_phy *mphy);
int mt7996_init_debugfs(struct mt7996_phy *phy);
void mt7996_debugfs_rx_fw_monitor(struct mt7996_dev *dev, const void *data, int len);
bool mt7996_debugfs_rx_log(struct mt7996_dev *dev, const void *data, int len);
-int mt7996_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif,
+int mt7996_mcu_add_key(struct mt76_dev *dev, struct mt7996_bss_conf *mconf,
struct ieee80211_key_conf *key, int mcu_cmd,
struct mt76_wcid *wcid, enum set_key_cmd cmd);
-int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev, struct ieee80211_vif *vif,
+int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev,
+ struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf,
struct ieee80211_key_conf *key);
int mt7996_mcu_wtbl_update_hdr_trans(struct mt7996_dev *dev,
struct ieee80211_vif *vif,
+ struct mt7996_bss_conf *mconf,
struct ieee80211_sta *sta);
int mt7996_mcu_cp_support(struct mt7996_dev *dev, u8 mode);
int mt7996_mcu_set_pp_en(struct mt7996_phy *phy, u8 mode, u16 bitmap);
diff --git a/mt7996/testmode.c b/mt7996/testmode.c
index 784a8be..bf55b43 100644
--- a/mt7996/testmode.c
+++ b/mt7996/testmode.c
@@ -223,6 +223,7 @@ static void
mt7996_tm_init(struct mt7996_phy *phy, bool en)
{
struct mt7996_dev *dev = phy->dev;
+ struct mt7996_vif *mvif = (struct mt7996_vif *)phy->monitor_vif->drv_priv;
u8 rf_test_mode = en ? RF_OPER_RF_TEST : RF_OPER_NORMAL;
if (!test_bit(MT76_STATE_RUNNING, &phy->mt76->state))
@@ -234,8 +235,8 @@ mt7996_tm_init(struct mt7996_phy *phy, bool en)
mt7996_tm_rf_switch_mode(dev, rf_test_mode);
- mt7996_mcu_add_bss_info(phy, phy->monitor_vif, en);
- mt7996_mcu_add_sta(dev, phy->monitor_vif, NULL, en, false);
+ mt7996_mcu_add_bss_info(phy, &phy->monitor_vif->bss_conf, &mvif->deflink, en);
+ mt7996_mcu_add_sta(dev, &phy->monitor_vif->bss_conf, &mvif->deflink, NULL, en, false);
mt7996_tm_set(dev, SET_ID(BAND_IDX), phy->mt76->band_idx);
@@ -1179,13 +1180,13 @@ mt7996_tm_txbf_init(struct mt7996_phy *phy, u16 *val)
mt7996_tm_set_mac_addr(dev, td->addr[2], SET_ID(BSSID));
/* bss idx & omac idx should be set to band idx for ibf cal */
- mvif->mt76.idx = band_idx;
- dev->mt76.vif_mask |= BIT_ULL(mvif->mt76.idx);
- mvif->mt76.omac_idx = band_idx;
- phy->omac_mask |= BIT_ULL(mvif->mt76.omac_idx);
+ mvif->deflink.mt76.idx = band_idx;
+ dev->mt76.vif_mask |= BIT_ULL(mvif->deflink.mt76.idx);
+ mvif->deflink.mt76.omac_idx = band_idx;
+ phy->omac_mask |= BIT_ULL(mvif->deflink.mt76.omac_idx);
- mt7996_mcu_add_dev_info(phy, phy->monitor_vif, true);
- mt7996_mcu_add_bss_info(phy, phy->monitor_vif, true);
+ mt7996_mcu_add_dev_info(phy, &phy->monitor_vif->bss_conf, &mvif->deflink, true);
+ mt7996_mcu_add_bss_info(phy, &phy->monitor_vif->bss_conf, &mvif->deflink, true);
if (td->ibf) {
if (td->is_txbf_dut) {
--
2.18.0