[PATCH mt76 05/12] wifi: mt76: mt7996: fix several fields in mt7996_mcu_bss_basic_tlv()

Lorenzo Bianconi lorenzo at kernel.org
Wed Nov 5 02:04:40 PST 2025


> Fix several fields in mt7996_mcu_bss_basic_tlv() that were not obtained
> from the correct link. Without this patch, the MLD station interface
> does not function properly.
> 
> Fixes: 34a41bfbcb71 ("wifi: mt76: mt7996: prepare mt7996_mcu_add_dev/bss_info for MLO support")
> Signed-off-by: Shayne Chen <shayne.chen at mediatek.com>

Acked-by: Lorenzo Bianconi <lorenzo at kernel.org>

> ---
>  .../net/wireless/mediatek/mt76/mt7996/mcu.c   | 21 ++++++++++---------
>  1 file changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
> index 82dd34a8780f..f1892aaf6a91 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
> @@ -1037,7 +1037,6 @@ mt7996_mcu_bss_basic_tlv(struct sk_buff *skb,
>  	struct mt76_connac_bss_basic_tlv *bss;
>  	u32 type = CONNECTION_INFRA_AP;
>  	u16 sta_wlan_idx = wlan_idx;
> -	struct ieee80211_sta *sta;
>  	struct tlv *tlv;
>  	int idx;
>  
> @@ -1048,14 +1047,18 @@ mt7996_mcu_bss_basic_tlv(struct sk_buff *skb,
>  		break;
>  	case NL80211_IFTYPE_STATION:
>  		if (enable) {
> +			struct ieee80211_sta *sta;
> +
>  			rcu_read_lock();
> -			sta = ieee80211_find_sta(vif, vif->bss_conf.bssid);
> -			/* TODO: enable BSS_INFO_UAPSD & BSS_INFO_PM */
> +			sta = ieee80211_find_sta(vif, link_conf->bssid);
>  			if (sta) {
> -				struct mt76_wcid *wcid;
> +				struct mt7996_sta *msta = (void *)sta->drv_priv;
> +				struct mt7996_sta_link *msta_link;
> +				int link_id = link_conf->link_id;
>  
> -				wcid = (struct mt76_wcid *)sta->drv_priv;
> -				sta_wlan_idx = wcid->idx;
> +				msta_link = rcu_dereference(msta->link[link_id]);
> +				if (msta_link)
> +					sta_wlan_idx = msta_link->wcid.idx;
>  			}
>  			rcu_read_unlock();
>  		}
> @@ -1072,8 +1075,6 @@ 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(link_conf->beacon_int);
> -	bss->dtim_period = link_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);
> @@ -1093,10 +1094,10 @@ mt7996_mcu_bss_basic_tlv(struct sk_buff *skb,
>  
>  	memcpy(bss->bssid, link_conf->bssid, ETH_ALEN);
>  	bss->bcn_interval = cpu_to_le16(link_conf->beacon_int);
> -	bss->dtim_period = vif->bss_conf.dtim_period;
> +	bss->dtim_period = link_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->bss_conf,
> +	bss->phymode_ext = mt76_connac_get_phy_mode_ext(phy, link_conf,
>  							chandef->chan->band);
>  
>  	return 0;
> -- 
> 2.51.0
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mediatek/attachments/20251105/bf33894d/attachment.sig>


More information about the Linux-mediatek mailing list