mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 06:49:29 -04:00
wifi: mt76: mt7996: rework mt7996_sta_set_4addr and mt7996_sta_set_decap_offload to support MLO
Rework mt7996_sta_set_4addr and mt7996_sta_set_decap_offload routines in order to properly support multi-link. This is a preliminary patch to enable MLO for MT7996 driver. Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com> Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com> Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com> Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Link: https://patch.msgid.link/20250312-b4-mt7996-mlo-p2-v1-7-015b3d6fd928@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
committed by
Felix Fietkau
parent
7464b12b7d
commit
aa99241833
@@ -1540,19 +1540,37 @@ static void mt7996_sta_set_4addr(struct ieee80211_hw *hw,
|
||||
struct ieee80211_sta *sta,
|
||||
bool enabled)
|
||||
{
|
||||
struct mt7996_dev *dev = mt7996_hw_dev(hw);
|
||||
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
|
||||
struct mt7996_sta_link *msta_link = &msta->deflink;
|
||||
struct mt7996_dev *dev = mt7996_hw_dev(hw);
|
||||
struct ieee80211_link_sta *link_sta;
|
||||
unsigned int link_id;
|
||||
|
||||
if (enabled)
|
||||
set_bit(MT_WCID_FLAG_4ADDR, &msta_link->wcid.flags);
|
||||
else
|
||||
clear_bit(MT_WCID_FLAG_4ADDR, &msta_link->wcid.flags);
|
||||
mutex_lock(&dev->mt76.mutex);
|
||||
|
||||
if (!msta_link->wcid.sta)
|
||||
return;
|
||||
for_each_sta_active_link(vif, sta, link_sta, link_id) {
|
||||
struct mt7996_sta_link *msta_link;
|
||||
struct mt7996_vif_link *link;
|
||||
|
||||
mt7996_mcu_wtbl_update_hdr_trans(dev, vif, sta);
|
||||
link = mt7996_vif_link(dev, vif, link_id);
|
||||
if (!link)
|
||||
continue;
|
||||
|
||||
msta_link = mt76_dereference(msta->link[link_id], &dev->mt76);
|
||||
if (!msta_link)
|
||||
continue;
|
||||
|
||||
if (enabled)
|
||||
set_bit(MT_WCID_FLAG_4ADDR, &msta_link->wcid.flags);
|
||||
else
|
||||
clear_bit(MT_WCID_FLAG_4ADDR, &msta_link->wcid.flags);
|
||||
|
||||
if (!msta_link->wcid.sta)
|
||||
continue;
|
||||
|
||||
mt7996_mcu_wtbl_update_hdr_trans(dev, vif, link, msta_link);
|
||||
}
|
||||
|
||||
mutex_unlock(&dev->mt76.mutex);
|
||||
}
|
||||
|
||||
static void mt7996_sta_set_decap_offload(struct ieee80211_hw *hw,
|
||||
@@ -1560,19 +1578,39 @@ static void mt7996_sta_set_decap_offload(struct ieee80211_hw *hw,
|
||||
struct ieee80211_sta *sta,
|
||||
bool enabled)
|
||||
{
|
||||
struct mt7996_dev *dev = mt7996_hw_dev(hw);
|
||||
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
|
||||
struct mt7996_sta_link *msta_link = &msta->deflink;
|
||||
struct mt7996_dev *dev = mt7996_hw_dev(hw);
|
||||
struct ieee80211_link_sta *link_sta;
|
||||
unsigned int link_id;
|
||||
|
||||
if (enabled)
|
||||
set_bit(MT_WCID_FLAG_HDR_TRANS, &msta_link->wcid.flags);
|
||||
else
|
||||
clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta_link->wcid.flags);
|
||||
mutex_lock(&dev->mt76.mutex);
|
||||
|
||||
if (!msta_link->wcid.sta)
|
||||
return;
|
||||
for_each_sta_active_link(vif, sta, link_sta, link_id) {
|
||||
struct mt7996_sta_link *msta_link;
|
||||
struct mt7996_vif_link *link;
|
||||
|
||||
mt7996_mcu_wtbl_update_hdr_trans(dev, vif, sta);
|
||||
link = mt7996_vif_link(dev, vif, link_id);
|
||||
if (!link)
|
||||
continue;
|
||||
|
||||
msta_link = mt76_dereference(msta->link[link_id], &dev->mt76);
|
||||
if (!msta_link)
|
||||
continue;
|
||||
|
||||
if (enabled)
|
||||
set_bit(MT_WCID_FLAG_HDR_TRANS,
|
||||
&msta_link->wcid.flags);
|
||||
else
|
||||
clear_bit(MT_WCID_FLAG_HDR_TRANS,
|
||||
&msta_link->wcid.flags);
|
||||
|
||||
if (!msta_link->wcid.sta)
|
||||
continue;
|
||||
|
||||
mt7996_mcu_wtbl_update_hdr_trans(dev, vif, link, msta_link);
|
||||
}
|
||||
|
||||
mutex_unlock(&dev->mt76.mutex);
|
||||
}
|
||||
|
||||
static const char mt7996_gstrings_stats[][ETH_GSTRING_LEN] = {
|
||||
|
||||
@@ -4465,17 +4465,12 @@ int mt7996_mcu_rdd_cmd(struct mt7996_dev *dev, int cmd, u8 index,
|
||||
|
||||
int mt7996_mcu_wtbl_update_hdr_trans(struct mt7996_dev *dev,
|
||||
struct ieee80211_vif *vif,
|
||||
struct ieee80211_sta *sta)
|
||||
struct mt7996_vif_link *link,
|
||||
struct mt7996_sta_link *msta_link)
|
||||
{
|
||||
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
|
||||
struct mt7996_sta_link *msta_link;
|
||||
struct mt7996_sta *msta;
|
||||
struct sk_buff *skb;
|
||||
|
||||
msta = sta ? (struct mt7996_sta *)sta->drv_priv : NULL;
|
||||
msta_link = msta ? &msta->deflink : &mvif->deflink.msta_link;
|
||||
|
||||
skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->deflink.mt76,
|
||||
skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &link->mt76,
|
||||
&msta_link->wcid,
|
||||
MT7996_STA_UPDATE_MAX_SIZE);
|
||||
if (IS_ERR(skb))
|
||||
|
||||
@@ -749,7 +749,8 @@ int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev, struct ieee80211_vif *vif
|
||||
struct ieee80211_key_conf *key);
|
||||
int mt7996_mcu_wtbl_update_hdr_trans(struct mt7996_dev *dev,
|
||||
struct ieee80211_vif *vif,
|
||||
struct ieee80211_sta *sta);
|
||||
struct mt7996_vif_link *link,
|
||||
struct mt7996_sta_link *msta_link);
|
||||
int mt7996_mcu_cp_support(struct mt7996_dev *dev, u8 mode);
|
||||
#ifdef CONFIG_MAC80211_DEBUGFS
|
||||
void mt7996_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
||||
|
||||
Reference in New Issue
Block a user