[PATCH v2 2/6] wifi: mt76: mt7925: fix the wrong link_idx when has p2p_device

Felix Fietkau nbd at nbd.name
Sat Jan 18 01:57:55 PST 2025


On 14.01.25 03:07, sean.wang at kernel.org wrote:
> From: Ming Yen Hsieh <mingyen.hsieh at mediatek.com>
> 
> When the p2p device and MLO station concurrent, the p2p device
> will occupy the wrong link_idx when the MLO secondary link is added.
> 
> Fixes: e38a82d25b08 ("wifi: mt76: connac: Extend mt76_connac_mcu_uni_add_dev for MLO")
> Signed-off-by: Ming Yen Hsieh <mingyen.hsieh at mediatek.com>
> Signed-off-by: Sean Wang <sean.wang at mediatek.com>
> ---
> v2: generate the patch based on the latest mt76 tree
> ---
>   drivers/net/wireless/mediatek/mt76/mt76.h          |  1 +
>   .../net/wireless/mediatek/mt76/mt76_connac_mcu.c   |  4 ++--
>   drivers/net/wireless/mediatek/mt76/mt7925/main.c   | 14 ++++++++++----
>   3 files changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
> index 2082e3904d76..502b76a40ca8 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
> @@ -371,6 +376,7 @@ static int mt7925_mac_link_bss_add(struct mt792x_dev *dev,
>   	mconf->mt76.band_idx = 0xff;
>   	mconf->mt76.wmm_idx = ieee80211_vif_is_mld(vif) ?
>   			      0 : mconf->mt76.idx % MT76_CONNAC_MAX_WMM_SETS;
> +	mconf->mt76.link_idx = hweight16(mvif->valid_links);
>   
>   	if (mvif->phy->mt76->chandef.chan->band != NL80211_BAND_2GHZ)
>   		mconf->mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL + 4;

Why are you using hweight16 for the link idx? That doesn't make much 
sense to me. Shouldn't the actual link id be passed here, or is that 
index used in some other way?

- Felix



More information about the Linux-mediatek mailing list