linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH mt76 0/2] Fix MT7996 driver performance in the mixed MLO/non-MLO scenario
@ 2025-07-08  7:12 Lorenzo Bianconi
  2025-07-08  7:12 ` [PATCH mt76 1/2] wifi: mt76: mt7996: Overwrite unspecified link_id in mt7996_tx() Lorenzo Bianconi
  2025-07-08  7:12 ` [PATCH mt76 2/2] wifi: mt76: mt7996: Fix mt7996_mcu_sta_ba wcid configuration Lorenzo Bianconi
  0 siblings, 2 replies; 3+ messages in thread
From: Lorenzo Bianconi @ 2025-07-08  7:12 UTC (permalink / raw)
  To: Felix Fietkau, Ryder Lee, Shayne Chen, Sean Wang,
	Matthias Brugger, AngeloGioacchino Del Regno, Peter Chiu,
	Money Wang, Evelyn Tsai
  Cc: linux-wireless, linux-arm-kernel, linux-mediatek, MeiChia Chiu,
	Howard Hsu, Bo Jiao, Lorenzo Bianconi

Two more fixes to improve MT7996 driver performances in the mixed
MLO/non-MLO scenario

---
Lorenzo Bianconi (2):
      wifi: mt76: mt7996: Overwrite unspecified link_id in mt7996_tx()
      wifi: mt76: mt7996: Fix mt7996_mcu_sta_ba wcid configuration

 drivers/net/wireless/mediatek/mt76/mt7996/main.c   | 32 ++++++++++++++--------
 drivers/net/wireless/mediatek/mt76/mt7996/mcu.c    | 12 ++++----
 drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h |  3 +-
 3 files changed, 30 insertions(+), 17 deletions(-)
---
base-commit: e553ac0d7616d6bcd06ed0c5f6126ce83097b31a
change-id: 20250708-mt7996-mlo-fixes-v2-d59f6e12189f

Best regards,
-- 
Lorenzo Bianconi <lorenzo@kernel.org>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH mt76 1/2] wifi: mt76: mt7996: Overwrite unspecified link_id in mt7996_tx()
  2025-07-08  7:12 [PATCH mt76 0/2] Fix MT7996 driver performance in the mixed MLO/non-MLO scenario Lorenzo Bianconi
@ 2025-07-08  7:12 ` Lorenzo Bianconi
  2025-07-08  7:12 ` [PATCH mt76 2/2] wifi: mt76: mt7996: Fix mt7996_mcu_sta_ba wcid configuration Lorenzo Bianconi
  1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Bianconi @ 2025-07-08  7:12 UTC (permalink / raw)
  To: Felix Fietkau, Ryder Lee, Shayne Chen, Sean Wang,
	Matthias Brugger, AngeloGioacchino Del Regno, Peter Chiu,
	Money Wang, Evelyn Tsai
  Cc: linux-wireless, linux-arm-kernel, linux-mediatek, MeiChia Chiu,
	Howard Hsu, Bo Jiao, Lorenzo Bianconi

Set link_id to msta or mvif primary value if it is set to
IEEE80211_LINK_UNSPECIFIED by mac80211 in mt7996_tx routine.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt7996/main.c | 26 ++++++++++++++++--------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index f846b8309ae2e9c39f9d5f2a21ca1edd89dcdf0c..03ec3edc9a632390cb6d86d75b2e65a302a9a372 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
@@ -1217,21 +1217,30 @@ static void mt7996_tx(struct ieee80211_hw *hw,
 	struct mt76_wcid *wcid = &dev->mt76.global_wcid;
 	u8 link_id = u32_get_bits(info->control.flags,
 				  IEEE80211_TX_CTRL_MLO_LINK);
+	struct mt7996_sta *msta;
+	struct mt7996_vif *mvif;
 
 	rcu_read_lock();
 
-	if (vif) {
-		struct mt7996_vif *mvif = (void *)vif->drv_priv;
+	msta = control->sta ? (void *)control->sta->drv_priv : NULL;
+	mvif = vif ? (void *)vif->drv_priv : NULL;
+
+	/* Use primary link_id if the value from mac80211 is set to
+	 * IEEE80211_LINK_UNSPECIFIED.
+	 */
+	if (link_id == IEEE80211_LINK_UNSPECIFIED) {
+		if (msta)
+			link_id = msta->deflink_id;
+		else if (mvif)
+			link_id = mvif->mt76.deflink_id;
+	}
+
+	if (mvif) {
 		struct mt76_vif_link *mlink = &mvif->deflink.mt76;
 
 		if (link_id < IEEE80211_LINK_UNSPECIFIED)
 			mlink = rcu_dereference(mvif->mt76.link[link_id]);
 
-		if (!mlink) {
-			ieee80211_free_txskb(hw, skb);
-			goto unlock;
-		}
-
 		if (mlink->wcid)
 			wcid = mlink->wcid;
 
@@ -1250,8 +1259,7 @@ static void mt7996_tx(struct ieee80211_hw *hw,
 		goto unlock;
 	}
 
-	if (control->sta && link_id < IEEE80211_LINK_UNSPECIFIED) {
-		struct mt7996_sta *msta = (void *)control->sta->drv_priv;
+	if (msta && link_id < IEEE80211_LINK_UNSPECIFIED) {
 		struct mt7996_sta_link *msta_link;
 
 		msta_link = rcu_dereference(msta->link[link_id]);

-- 
2.50.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH mt76 2/2] wifi: mt76: mt7996: Fix mt7996_mcu_sta_ba wcid configuration
  2025-07-08  7:12 [PATCH mt76 0/2] Fix MT7996 driver performance in the mixed MLO/non-MLO scenario Lorenzo Bianconi
  2025-07-08  7:12 ` [PATCH mt76 1/2] wifi: mt76: mt7996: Overwrite unspecified link_id in mt7996_tx() Lorenzo Bianconi
@ 2025-07-08  7:12 ` Lorenzo Bianconi
  1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Bianconi @ 2025-07-08  7:12 UTC (permalink / raw)
  To: Felix Fietkau, Ryder Lee, Shayne Chen, Sean Wang,
	Matthias Brugger, AngeloGioacchino Del Regno, Peter Chiu,
	Money Wang, Evelyn Tsai
  Cc: linux-wireless, linux-arm-kernel, linux-mediatek, MeiChia Chiu,
	Howard Hsu, Bo Jiao, Lorenzo Bianconi

Fix the wcid pointer used in mt7996_mcu_sta_ba routine to properly
support MLO scenario.

Fixes: 98686cd21624c ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt7996/main.c   |  6 ++++--
 drivers/net/wireless/mediatek/mt76/mt7996/mcu.c    | 12 +++++++-----
 drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h |  3 ++-
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index 03ec3edc9a632390cb6d86d75b2e65a302a9a372..4f7db05902fb35641ee5e5d1d921a7ca437ec3dd 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
@@ -1331,11 +1331,13 @@ mt7996_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		case IEEE80211_AMPDU_RX_START:
 			mt76_rx_aggr_start(&dev->mt76, &msta_link->wcid, tid,
 					   ssn, params->buf_size);
-			ret = mt7996_mcu_add_rx_ba(dev, params, link, true);
+			ret = mt7996_mcu_add_rx_ba(dev, params, link,
+						   msta_link, true);
 			break;
 		case IEEE80211_AMPDU_RX_STOP:
 			mt76_rx_aggr_stop(&dev->mt76, &msta_link->wcid, tid);
-			ret = mt7996_mcu_add_rx_ba(dev, params, link, false);
+			ret = mt7996_mcu_add_rx_ba(dev, params, link,
+						   msta_link, false);
 			break;
 		case IEEE80211_AMPDU_TX_OPERATIONAL:
 			mtxq->aggr = true;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
index 0374872db4777cc85eed594f7d977dd822927b6d..edfbea813bfc0e5edbe4c33e90bf4ceacb533ac1 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
@@ -1152,9 +1152,8 @@ int mt7996_mcu_set_timing(struct mt7996_phy *phy, struct ieee80211_vif *vif,
 static int
 mt7996_mcu_sta_ba(struct mt7996_dev *dev, struct mt76_vif_link *mvif,
 		  struct ieee80211_ampdu_params *params,
-		  bool enable, bool tx)
+		  struct mt76_wcid *wcid, bool enable, bool tx)
 {
-	struct mt76_wcid *wcid = (struct mt76_wcid *)params->sta->drv_priv;
 	struct sta_rec_ba_uni *ba;
 	struct sk_buff *skb;
 	struct tlv *tlv;
@@ -1188,14 +1187,17 @@ int mt7996_mcu_add_tx_ba(struct mt7996_dev *dev,
 	if (enable && !params->amsdu)
 		msta_link->wcid.amsdu = false;
 
-	return mt7996_mcu_sta_ba(dev, &link->mt76, params, enable, true);
+	return mt7996_mcu_sta_ba(dev, &link->mt76, params, &msta_link->wcid,
+				 enable, true);
 }
 
 int mt7996_mcu_add_rx_ba(struct mt7996_dev *dev,
 			 struct ieee80211_ampdu_params *params,
-			 struct mt7996_vif_link *link, bool enable)
+			 struct mt7996_vif_link *link,
+			 struct mt7996_sta_link *msta_link, bool enable)
 {
-	return mt7996_mcu_sta_ba(dev, &link->mt76, params, enable, false);
+	return mt7996_mcu_sta_ba(dev, &link->mt76, params, &msta_link->wcid,
+				 enable, false);
 }
 
 static void
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h b/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h
index 1ad6bc046f7c01d43452252ed46677d42e0c8850..19e115e316df05640062ca9fa56d4bcc8d41956e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h
@@ -608,7 +608,8 @@ int mt7996_mcu_add_tx_ba(struct mt7996_dev *dev,
 			 struct mt7996_sta_link *msta_link, bool enable);
 int mt7996_mcu_add_rx_ba(struct mt7996_dev *dev,
 			 struct ieee80211_ampdu_params *params,
-			 struct mt7996_vif_link *link, bool enable);
+			 struct mt7996_vif_link *link,
+			 struct mt7996_sta_link *msta_link, bool enable);
 int mt7996_mcu_update_bss_color(struct mt7996_dev *dev,
 				struct mt76_vif_link *mlink,
 				struct cfg80211_he_bss_color *he_bss_color);

-- 
2.50.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-08  7:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-08  7:12 [PATCH mt76 0/2] Fix MT7996 driver performance in the mixed MLO/non-MLO scenario Lorenzo Bianconi
2025-07-08  7:12 ` [PATCH mt76 1/2] wifi: mt76: mt7996: Overwrite unspecified link_id in mt7996_tx() Lorenzo Bianconi
2025-07-08  7:12 ` [PATCH mt76 2/2] wifi: mt76: mt7996: Fix mt7996_mcu_sta_ba wcid configuration Lorenzo Bianconi

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).