All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
To: jjohnson@kernel.org
Cc: ath11k@lists.infradead.org, ath12k@lists.infradead.org,
	linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
Subject: [PATCH 4/5] wifi: ath12k: fix MLO beacon handling using per-link addressing
Date: Mon, 27 Jul 2026 18:27:47 +0200	[thread overview]
Message-ID: <20260727162748.963275-5-jtornosm@redhat.com> (raw)
In-Reply-To: <20260727162748.963275-1-jtornosm@redhat.com>

ath12k_mac_handle_beacon_iter() uses ahvif->deflink for both BSSID
matching and connection_loss_work cancellation. In MLO, deflink is
only the first link created for the MLD VIF and does not represent
the other links. This causes two problems:

1. Beacon BSSID matching only checks deflink's BSS config
   (vif->bss_conf.bssid), so beacons received on non-deflink links
   never match and never cancel connection_loss_work.

2. Only deflink's connection_loss_work is cancelled, leaving
   non-deflink connection_loss_work timers running even when beacons
   are being received normally.

When the firmware reports a beacon miss event on any link,
ath12k_mac_handle_beacon_miss() queues connection_loss_work on that
link with a 3-second timeout. If a beacon is received before the
timeout, ath12k_mac_handle_beacon_iter() should cancel it. But the
deflink-only handling means that for non-deflink MLO links, beacons
are never matched and connection_loss_work is never cancelled through
this path.

Fix by handling non-MLO and MLO cases separately. For non-MLO, keep
the existing deflink behavior. For MLO, iterate all active links to
match the beacon BSSID against each link's BSS config. When a match
is found, cancel connection_loss_work on all links because the
work callback calls per-VIF ieee80211_connection_loss() regardless
of which link queued it.

Tested on WCN7850 with MLO (Wi-Fi 7).

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
---
 drivers/net/wireless/ath/ath12k/mac.c | 36 ++++++++++++++++++++++++---
 1 file changed, 32 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index e36a37852fab..ebc35636b4ef 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -1946,15 +1946,43 @@ static void ath12k_mac_handle_beacon_iter(void *data, u8 *mac,
 	struct sk_buff *skb = data;
 	struct ieee80211_mgmt *mgmt = (void *)skb->data;
 	struct ath12k_vif *ahvif = ath12k_vif_to_ahvif(vif);
-	struct ath12k_link_vif *arvif = &ahvif->deflink;
+	struct ieee80211_bss_conf *link_conf;
+	struct ath12k_link_vif *arvif;
+	unsigned long links;
+	u8 link_id;
 
-	if (vif->type != NL80211_IFTYPE_STATION || !arvif->is_created)
+	if (vif->type != NL80211_IFTYPE_STATION)
 		return;
 
-	if (!ether_addr_equal(mgmt->bssid, vif->bss_conf.bssid))
+	if (!ieee80211_vif_is_mld(vif)) {
+		arvif = &ahvif->deflink;
+		if (arvif->is_created &&
+		    ether_addr_equal(mgmt->bssid, vif->bss_conf.bssid))
+			cancel_delayed_work(&arvif->connection_loss_work);
 		return;
+	}
 
-	cancel_delayed_work(&arvif->connection_loss_work);
+	/* For MLO, each link has a different AP BSSID. Check the beacon
+	 * against all link BSS configs. If any matches, cancel
+	 * connection_loss_work on all links since it calls per-VIF
+	 * ieee80211_connection_loss() regardless of which link queued it.
+	 */
+	links = ahvif->links_map;
+	for_each_set_bit(link_id, &links, IEEE80211_MLD_MAX_NUM_LINKS) {
+		link_conf = rcu_dereference(vif->link_conf[link_id]);
+		if (link_conf &&
+		    ether_addr_equal(mgmt->bssid, link_conf->bssid))
+			goto found;
+	}
+
+	return;
+
+found:
+	for_each_set_bit(link_id, &links, IEEE80211_MLD_MAX_NUM_LINKS) {
+		arvif = rcu_dereference(ahvif->link[link_id]);
+		if (arvif && arvif->is_created)
+			cancel_delayed_work(&arvif->connection_loss_work);
+	}
 }
 
 void ath12k_mac_handle_beacon(struct ath12k *ar, struct sk_buff *skb)
-- 
2.54.0



  parent reply	other threads:[~2026-07-27 16:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-27 16:27 [PATCH 0/5] wifi: ath12k: fixes to improve MLO station stability Jose Ignacio Tornos Martinez
2026-07-27 16:27 ` [PATCH 1/5] wifi: ath12k: fix MLO station firmware crash recovery Jose Ignacio Tornos Martinez
2026-07-31  8:48   ` Baochen Qiang
2026-08-03 15:02     ` Jose Ignacio Tornos Martinez
2026-07-27 16:27 ` [PATCH 2/5] wifi: ath12k: prevent scan during firmware recovery Jose Ignacio Tornos Martinez
2026-07-31  8:16   ` Baochen Qiang
2026-08-03 15:08     ` Jose Ignacio Tornos Martinez
2026-07-27 16:27 ` [PATCH 3/5] wifi: ath12k: fix MLO dp_peer ID desync with firmware Jose Ignacio Tornos Martinez
2026-07-31  8:02   ` Baochen Qiang
2026-08-03 15:12     ` Jose Ignacio Tornos Martinez
2026-07-27 16:27 ` Jose Ignacio Tornos Martinez [this message]
2026-07-31  8:48   ` [PATCH 4/5] wifi: ath12k: fix MLO beacon handling using per-link addressing Baochen Qiang
2026-08-03 15:18     ` Jose Ignacio Tornos Martinez
2026-07-27 16:27 ` [PATCH 5/5] wifi: ath12k: skip connection_loss_work for MLO beacon miss Jose Ignacio Tornos Martinez
2026-07-31  8:48   ` Baochen Qiang
2026-08-03 15:22     ` Jose Ignacio Tornos Martinez
2026-07-31 22:04 ` [PATCH 0/5] wifi: ath12k: fixes to improve MLO station stability Jeff Johnson
2026-08-03 14:56   ` Jose Ignacio Tornos Martinez

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=20260727162748.963275-5-jtornosm@redhat.com \
    --to=jtornosm@redhat.com \
    --cc=ath11k@lists.infradead.org \
    --cc=ath12k@lists.infradead.org \
    --cc=jjohnson@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.