linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Shayne Chen <shayne.chen@mediatek.com>
Cc: Felix Fietkau <nbd@nbd.name>,
	linux-wireless <linux-wireless@vger.kernel.org>,
	Ryder Lee <ryder.lee@mediatek.com>,
	Evelyn Tsai <evelyn.tsai@mediatek.com>,
	linux-mediatek <linux-mediatek@lists.infradead.org>
Subject: Re: [PATCH mt76 08/12] wifi: mt76: mt7996: use correct link_id when filling TXD and TXP
Date: Wed, 5 Nov 2025 11:34:30 +0100	[thread overview]
Message-ID: <aQsoNrzQuUAusnn0@lore-desk> (raw)
In-Reply-To: <20251105093100.541408-8-shayne.chen@mediatek.com>

[-- Attachment #1: Type: text/plain, Size: 3855 bytes --]

> Obtain the correct link ID and, if needed, switch to the corresponding
> wcid before populating the TX descriptor and TX payload.
> 
> Rules for link id:
> - For QoS data from MLD peers (excluding EAPOL), select the primary or
>   secondary wcid based on whether the TID is odd or even to meet FW/HW
>   requirements
> - For other packets, use IEEE80211_TX_CTRL_MLO_LINK if specified
>   (such as multicast and broadcast packets)

Hi Shayne,

thx for the fix. I guess it is mostly fine, just few comments inline. Fixing
them:

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

Regards,
Lorenzo

> 
> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
> ---
>  .../net/wireless/mediatek/mt76/mt7996/mac.c   | 34 ++++++++++++++++---
>  .../net/wireless/mediatek/mt76/mt7996/main.c  |  6 ++++
>  .../net/wireless/mediatek/mt76/mt7996/mcu.c   |  4 +--
>  .../wireless/mediatek/mt76/mt7996/mt7996.h    |  1 +
>  4 files changed, 39 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
> index 7d5f9d9b3b62..579084cbb30f 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
> @@ -1035,15 +1035,20 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
>  			  struct ieee80211_sta *sta,
>  			  struct mt76_tx_info *tx_info)
>  {

[...]

> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
> index c26f8f49ce44..3958688d622b 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
> @@ -963,6 +963,7 @@ mt7996_mac_sta_init_link(struct mt7996_dev *dev,
>  
>  		msta_link = &msta->deflink;
>  		msta->deflink_id = link_id;
> +		msta->seclink_id = msta->deflink_id;
>  
>  		for (i = 0; i < ARRAY_SIZE(sta->txq); i++) {
>  			struct mt76_txq *mtxq;
> @@ -977,6 +978,11 @@ mt7996_mac_sta_init_link(struct mt7996_dev *dev,
>  		msta_link = kzalloc(sizeof(*msta_link), GFP_KERNEL);
>  		if (!msta_link)
>  			return -ENOMEM;
> +
> +		if (msta->seclink_id == msta->deflink_id &&
> +		    (sta->valid_links & ~(BIT(msta->deflink_id))))
> +			msta->seclink_id = __ffs(sta->valid_links &
> +						 ~(BIT(msta->deflink_id)));
nit: you do need brackets around BIT().

I think we are missing seclink_id management when the corresponding link is
removed, right?

>  	}
>  
>  	INIT_LIST_HEAD(&msta_link->rc_list);
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
> index f1892aaf6a91..2bb98df317a6 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
> @@ -2394,8 +2394,8 @@ mt7996_mcu_sta_mld_setup_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
>  	mld_setup->primary_id = cpu_to_le16(msta_link->wcid.idx);
>  
>  	if (nlinks > 1) {
> -		link_id = __ffs(sta->valid_links & ~BIT(msta->deflink_id));
> -		msta_link = mt76_dereference(msta->link[link_id], &dev->mt76);
> +		msta_link = mt76_dereference(msta->link[msta->seclink_id],
> +					     &dev->mt76);
>  		if (!msta_link)
>  			return;
>  	}
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h b/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h
> index 65eeb37ab8c7..c47820699ec8 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h
> @@ -243,6 +243,7 @@ struct mt7996_sta {
>  	struct mt7996_sta_link deflink; /* must be first */
>  	struct mt7996_sta_link __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
>  	u8 deflink_id;
> +	u8 seclink_id;
>  
>  	struct mt7996_vif *vif;
>  };
> -- 
> 2.51.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2025-11-05 10:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-05  9:30 [PATCH mt76 01/12] wifi: mt76: mt7996: fix max nss value when getting rx chainmask Shayne Chen
2025-11-05  9:30 ` [PATCH mt76 02/12] wifi: mt76: mt7996: no need to wait ACK event for SDO command Shayne Chen
2025-11-05  9:30 ` [PATCH mt76 03/12] wifi: mt76: mt7996: fix implicit beamforming support for mt7992 Shayne Chen
2025-11-05  9:30 ` [PATCH mt76 04/12] wifi: mt76: mt7996: support fixed rate for link station Shayne Chen
2025-11-05  9:30 ` [PATCH mt76 05/12] wifi: mt76: mt7996: fix several fields in mt7996_mcu_bss_basic_tlv() Shayne Chen
2025-11-05 10:04   ` Lorenzo Bianconi
2025-11-05  9:30 ` [PATCH mt76 06/12] wifi: mt76: mt7996: fix teardown command for an MLD peer Shayne Chen
2025-11-05 10:09   ` Lorenzo Bianconi
2025-11-05  9:30 ` [PATCH mt76 07/12] wifi: mt76: mt7996: set link_valid field when initializing wcid Shayne Chen
2025-11-05 10:15   ` Lorenzo Bianconi
2025-11-05  9:30 ` [PATCH mt76 08/12] wifi: mt76: mt7996: use correct link_id when filling TXD and TXP Shayne Chen
2025-11-05 10:34   ` Lorenzo Bianconi [this message]
2025-11-05  9:30 ` [PATCH mt76 09/12] wifi: mt76: mt7996: fix MLD group index assignment Shayne Chen
2025-11-05 10:42   ` Lorenzo Bianconi
2025-11-05  9:30 ` [PATCH mt76 10/12] wifi: mt76: mt7996: fix MLO set key and group key issues Shayne Chen
2025-11-05  9:30 ` [PATCH mt76 11/12] wifi: mt76: mt7996: fix using wrong phy to start in mt7996_mac_restart() Shayne Chen
2025-11-05 10:45   ` Lorenzo Bianconi
2025-11-05  9:31 ` [PATCH mt76 12/12] wifi: mt76: mt7996: fix EMI rings for RRO Shayne Chen
2025-11-05 10:57   ` Lorenzo Bianconi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aQsoNrzQuUAusnn0@lore-desk \
    --to=lorenzo@kernel.org \
    --cc=evelyn.tsai@mediatek.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@nbd.name \
    --cc=ryder.lee@mediatek.com \
    --cc=shayne.chen@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).