linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH mt76 0/2] wifi: mt76: mt7996: Fix connection setup for MLO-capable clients
@ 2025-07-31 10:41 Lorenzo Bianconi
  2025-07-31 10:41 ` [PATCH mt76 1/2] wifi: mt76: mt7996: Set def_wcid pointer in mt7996_mac_sta_init_link() Lorenzo Bianconi
  2025-07-31 10:41 ` [PATCH mt76 2/2] wifi: mt76: mt7996: Set proper link destination address in mt7996_tx() Lorenzo Bianconi
  0 siblings, 2 replies; 5+ messages in thread
From: Lorenzo Bianconi @ 2025-07-31 10:41 UTC (permalink / raw)
  To: Felix Fietkau, Ryder Lee, Shayne Chen, Sean Wang,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: linux-wireless, linux-arm-kernel, linux-mediatek,
	Lorenzo Bianconi

Fix connection setup for WiFi7 capable devices.

---
Lorenzo Bianconi (2):
      wifi: mt76: mt7996: Set def_wcid pointer in mt7996_mac_sta_init_link()
      wifi: mt76: mt7996: Set proper link destination address in mt7996_tx()

 drivers/net/wireless/mediatek/mt76/mt7996/main.c | 35 ++++++++++++++++++++----
 1 file changed, 30 insertions(+), 5 deletions(-)
---
base-commit: ab82ccb7840901200a8a75d32d13cc56f9597966
change-id: 20250731-mt7996-mlo-devel-9696b02a8dfb

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



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

* [PATCH mt76 1/2] wifi: mt76: mt7996: Set def_wcid pointer in mt7996_mac_sta_init_link()
  2025-07-31 10:41 [PATCH mt76 0/2] wifi: mt76: mt7996: Fix connection setup for MLO-capable clients Lorenzo Bianconi
@ 2025-07-31 10:41 ` Lorenzo Bianconi
  2025-07-31 15:33   ` Jose Ignacio Tornos Martinez
  2025-07-31 10:41 ` [PATCH mt76 2/2] wifi: mt76: mt7996: Set proper link destination address in mt7996_tx() Lorenzo Bianconi
  1 sibling, 1 reply; 5+ messages in thread
From: Lorenzo Bianconi @ 2025-07-31 10:41 UTC (permalink / raw)
  To: Felix Fietkau, Ryder Lee, Shayne Chen, Sean Wang,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: linux-wireless, linux-arm-kernel, linux-mediatek,
	Lorenzo Bianconi

In order to get the ieee80211_sta pointer from wcid struct for a MLO
client, set def_wcid pointer in mt7996_mac_sta_init_link routine.

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

diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index ed82197d8ffb74ed272b295351708b249cc543cd..662ce4bb5178a4b8765b2b337ea6baea649d3ef2 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
@@ -962,6 +962,7 @@ mt7996_mac_sta_init_link(struct mt7996_dev *dev,
 	msta_link->wcid.sta = 1;
 	msta_link->wcid.idx = idx;
 	msta_link->wcid.link_id = link_id;
+	msta_link->wcid.def_wcid = &msta->deflink.wcid;
 
 	ewma_avg_signal_init(&msta_link->avg_ack_signal);
 	ewma_signal_init(&msta_link->wcid.rssi);

-- 
2.50.1



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

* [PATCH mt76 2/2] wifi: mt76: mt7996: Set proper link destination address in mt7996_tx()
  2025-07-31 10:41 [PATCH mt76 0/2] wifi: mt76: mt7996: Fix connection setup for MLO-capable clients Lorenzo Bianconi
  2025-07-31 10:41 ` [PATCH mt76 1/2] wifi: mt76: mt7996: Set def_wcid pointer in mt7996_mac_sta_init_link() Lorenzo Bianconi
@ 2025-07-31 10:41 ` Lorenzo Bianconi
  2025-07-31 15:35   ` Jose Ignacio Tornos Martinez
  1 sibling, 1 reply; 5+ messages in thread
From: Lorenzo Bianconi @ 2025-07-31 10:41 UTC (permalink / raw)
  To: Felix Fietkau, Ryder Lee, Shayne Chen, Sean Wang,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: linux-wireless, linux-arm-kernel, linux-mediatek,
	Lorenzo Bianconi

Overwrite 802.11 destination address with in-use link address for MLD
capable VIFs in mt7996_tx routine.

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

diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index 662ce4bb5178a4b8765b2b337ea6baea649d3ef2..3d5ba568243b04465530ff788b7f625c9721e25d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
@@ -1252,21 +1252,20 @@ static void mt7996_tx(struct ieee80211_hw *hw,
 		      struct ieee80211_tx_control *control,
 		      struct sk_buff *skb)
 {
+	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
 	struct mt7996_dev *dev = mt7996_hw_dev(hw);
+	struct ieee80211_sta *sta = control->sta;
+	struct mt7996_sta *msta = sta ? (void *)sta->drv_priv : NULL;
 	struct mt76_phy *mphy = hw->priv;
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 	struct ieee80211_vif *vif = info->control.vif;
+	struct mt7996_vif *mvif = vif ? (void *)vif->drv_priv : NULL;
 	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();
 
-	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.
 	 */
@@ -1277,6 +1276,31 @@ static void mt7996_tx(struct ieee80211_hw *hw,
 			link_id = mvif->mt76.deflink_id;
 	}
 
+	if (ieee80211_vif_is_mld(vif)) {
+		struct ieee80211_bss_conf *link_conf;
+
+		if (msta) {
+			struct ieee80211_link_sta *link_sta;
+
+			link_sta = rcu_dereference(sta->link[link_id]);
+			if (!link_sta)
+				link_sta = rcu_dereference(sta->link[msta->deflink_id]);
+
+			if (link_sta) {
+				memcpy(hdr->addr1, link_sta->addr, ETH_ALEN);
+				if (ether_addr_equal(sta->addr, hdr->addr3))
+					memcpy(hdr->addr3, link_sta->addr, ETH_ALEN);
+			}
+		}
+
+		link_conf = rcu_dereference(vif->link_conf[link_id]);
+		if (link_conf) {
+			memcpy(hdr->addr2, link_conf->addr, ETH_ALEN);
+			if (ether_addr_equal(vif->addr, hdr->addr3))
+				memcpy(hdr->addr3, link_conf->addr, ETH_ALEN);
+		}
+	}
+
 	if (mvif) {
 		struct mt76_vif_link *mlink = &mvif->deflink.mt76;
 

-- 
2.50.1



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

* Re: [PATCH mt76 1/2] wifi: mt76: mt7996: Set def_wcid pointer in mt7996_mac_sta_init_link()
  2025-07-31 10:41 ` [PATCH mt76 1/2] wifi: mt76: mt7996: Set def_wcid pointer in mt7996_mac_sta_init_link() Lorenzo Bianconi
@ 2025-07-31 15:33   ` Jose Ignacio Tornos Martinez
  0 siblings, 0 replies; 5+ messages in thread
From: Jose Ignacio Tornos Martinez @ 2025-07-31 15:33 UTC (permalink / raw)
  To: lorenzo
  Cc: angelogioacchino.delregno, linux-arm-kernel, linux-mediatek,
	linux-wireless, matthias.bgg, nbd, ryder.lee, sean.wang,
	shayne.chen, Jose Ignacio Tornos Martinez

Tested-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>



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

* Re: [PATCH mt76 2/2] wifi: mt76: mt7996: Set proper link destination address in mt7996_tx()
  2025-07-31 10:41 ` [PATCH mt76 2/2] wifi: mt76: mt7996: Set proper link destination address in mt7996_tx() Lorenzo Bianconi
@ 2025-07-31 15:35   ` Jose Ignacio Tornos Martinez
  0 siblings, 0 replies; 5+ messages in thread
From: Jose Ignacio Tornos Martinez @ 2025-07-31 15:35 UTC (permalink / raw)
  To: lorenzo
  Cc: angelogioacchino.delregno, linux-arm-kernel, linux-mediatek,
	linux-wireless, matthias.bgg, nbd, ryder.lee, sean.wang,
	shayne.chen, Jose Ignacio Tornos Martinez

Tested-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>



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

end of thread, other threads:[~2025-07-31 15:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-31 10:41 [PATCH mt76 0/2] wifi: mt76: mt7996: Fix connection setup for MLO-capable clients Lorenzo Bianconi
2025-07-31 10:41 ` [PATCH mt76 1/2] wifi: mt76: mt7996: Set def_wcid pointer in mt7996_mac_sta_init_link() Lorenzo Bianconi
2025-07-31 15:33   ` Jose Ignacio Tornos Martinez
2025-07-31 10:41 ` [PATCH mt76 2/2] wifi: mt76: mt7996: Set proper link destination address in mt7996_tx() Lorenzo Bianconi
2025-07-31 15:35   ` Jose Ignacio Tornos Martinez

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