Re: [PATCH 4/5] wifi: ath12k: fix MLO beacon handling using per-link addressing
Baochen Qiang <[email protected]> Fri, 31 Jul 2026 16:48:31 +0800
| Newsgroups | org.infradead.lists.ath12k,org.infradead.lists.ath11k,org.kernel.vger.linux-kernel,org.kernel.vger.linux-wireless |
|---|---|
| Message-ID | <[email protected]> |
On 7/28/2026 12:27 AM, Jose Ignacio Tornos Martinez wrote: > 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. is it legitimate to change mac80211 to support per-link connection loss? if not, better to move connection_loss_work from ath12k_link_vif to ath12k_vif ? > > Tested on WCN7850 with MLO (Wi-Fi 7). > > Signed-off-by: Jose Ignacio Tornos Martinez <[email protected]> > --- > 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)