From: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>
To: Miaoqing Pan <miaoqing.pan@oss.qualcomm.com>, jjohnson@kernel.org
Cc: ath12k@lists.infradead.org, linux-wireless@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH ath-next 3/7] wifi: ath12k: fix ath12k_mac_op_change_vif_links() for active-link updates
Date: Wed, 25 Nov 2026 02:49:43 +0530 [thread overview]
Message-ID: <e5864418-b181-40b9-8718-2815d84d453e@oss.qualcomm.com> (raw)
In-Reply-To: <20261118025520.39269-4-miaoqing.pan@oss.qualcomm.com>
On 11/18/2026 8:25 AM, Miaoqing Pan wrote:
> Currently, ath12k_mac_op_change_vif_links() derives the links to add and
> remove from the old_links/new_links arguments: it creates a link vif
> (arvif) for each link in ~old_links & new_links and frees the arvif of
> each link in old_links & ~new_links.
>
> However, mac80211 invokes drv_change_vif_links() both when the valid
> links change and when the active links change. In the first case
> old_links/new_links are the valid links. In the second case they are
> only the active links, while vif->valid_links is not modified. A link
> that is deactivated is therefore reported as removed, although it is
> still a valid link of the MLD.
>
> To fix this, derive the arvif lifetime from vif->valid_links, which
> mac80211 updates before calling the driver and which an active-link
> change leaves untouched. Create an arvif for each link in
> valid_links & ~links_map and remove those in links_map & ~valid_links.
> A link that is only deactivated keeps its arvif. On disconnect
> (valid_links == 0) every remaining arvif is removed. The WARN_ON() for
> adding a link that already has an arvif is dropped, since links already
> in links_map are not selected for creation.
>
> Tested-on: QCC2072 hw1.0 PCI WLAN.COL.1.0.c2-00277-QCACOLSWPL_V1_TO_SILICONZ-1
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3
>
> Fixes: 315d80be304a ("wifi: ath12k: allocate new links in change_vif_links()")
> Signed-off-by: Miaoqing Pan <miaoqing.pan@oss.qualcomm.com>
> ---
> drivers/net/wireless/ath/ath12k/mac.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
> index 3f106ac6141c..28cb549b1f46 100644
> --- a/drivers/net/wireless/ath/ath12k/mac.c
> +++ b/drivers/net/wireless/ath/ath12k/mac.c
> @@ -4377,9 +4377,8 @@ ath12k_mac_op_change_vif_links(struct ieee80211_hw *hw,
> struct ieee80211_bss_conf *ol[IEEE80211_MLD_MAX_NUM_LINKS])
> {
> struct ath12k_vif *ahvif = ath12k_vif_to_ahvif(vif);
> - unsigned long to_remove = old_links & ~new_links;
> - unsigned long to_add = ~old_links & new_links;
> struct ath12k_hw *ah = ath12k_hw_to_ah(hw);
> + unsigned long to_remove, to_add;
> struct ath12k_link_vif *arvif;
> u8 link_id;
>
> @@ -4389,14 +4388,15 @@ ath12k_mac_op_change_vif_links(struct ieee80211_hw *hw,
> "mac vif link changed for MLD %pM old_links 0x%x new_links 0x%x\n",
> vif->addr, old_links, new_links);
>
> - for_each_set_bit(link_id, &to_add, IEEE80211_MLD_MAX_NUM_LINKS) {
> - arvif = wiphy_dereference(hw->wiphy, ahvif->link[link_id]);
> - /* mac80211 wants to add link but driver already has the
> - * link. This should not happen ideally.
> - */
> - if (WARN_ON(arvif))
> - return -EINVAL;
> + /*
> + * Link objects follow vif->valid_links, which mac80211 updates before
> + * calling us. old_links/new_links only describe the active links and
> + * must not be used to decide object lifetime.
> + */
This seems quite ambiguous from the mac80211 code flow,
Consider a 2-link STA associated with an AP, where one link is removed
by the AP:
wlan0: MLO Reconfiguration: work: valid=0x3, removed=0x2
In ieee80211_ml_reconf_work(),
Initially:
valid_links = 0x3
active_links = 0x3
ieee80211_set_active_links() first removes the link from active_links:
valid_links = 0x3
active_links = 0x1
This calls drv_change_vif_links() with 0x3 -> 0x1, but ath12k would not
remove the corresponding arvif/arsta since vif->valid_links is still 0x3.
Subsequently, ieee80211_vif_set_links() removes the link from valid_links:
valid_links = 0x1
active_links = 0x1
However, the call to drv_change_vif_links() uses:
old_links & old_active
new_links & sdata->vif.active_links
which evaluates to:
0x3 & 0x1 = 0x1
0x1 & 0x1 = 0x1
Since old_links == new_links, drv_change_vif_links() returns without
calling the driver.
After this, mac80211 removes/frees its link object, while ath12k still
seems to retain the corresponding arvif/arsta. Is this expected?
> + to_add = vif->valid_links & ~ahvif->links_map;
> + to_remove = ahvif->links_map & ~vif->valid_links;
>
> + for_each_set_bit(link_id, &to_add, IEEE80211_MLD_MAX_NUM_LINKS) {
> arvif = ath12k_mac_assign_link_vif(ah, vif, link_id);
> if (WARN_ON(!arvif))
> return -EINVAL;
--
Ramesh
next prev parent reply other threads:[~2026-11-24 21:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 2:55 [PATCH ath-next 0/7] wifi: ath12k: fix MLO active-links handling Miaoqing Pan
2026-11-18 2:55 ` [PATCH ath-next 1/7] wifi: ath12k: add WMI response handling for MLO link set active command Miaoqing Pan
2026-11-18 2:55 ` [PATCH ath-next 2/7] wifi: ath12k: send overwrite flags and AP MLD addr in MLO link set active Miaoqing Pan
2026-11-18 2:55 ` [PATCH ath-next 3/7] wifi: ath12k: fix ath12k_mac_op_change_vif_links() for active-link updates Miaoqing Pan
2026-11-24 21:19 ` Rameshkumar Sundaram [this message]
2026-11-18 2:55 ` [PATCH ath-next 4/7] wifi: ath12k: skip links without channel context in ath12k_mac_get_vif_up() Miaoqing Pan
2026-11-18 2:55 ` [PATCH ath-next 5/7] wifi: ath12k: restart STA link vdev on chanctx assign if channel changed Miaoqing Pan
2026-11-18 2:55 ` [PATCH ath-next 6/7] wifi: ath12k: use WMI_MLO_VDEV_BITMAP_SZ for vdev bitmap bounds check Miaoqing Pan
2026-11-18 2:55 ` [PATCH ath-next 7/7] wifi: ath12k: handle MLO active link updates Miaoqing Pan
2026-11-24 20:54 ` Rameshkumar Sundaram
2026-11-21 0:16 ` [PATCH ath-next 0/7] wifi: ath12k: fix MLO active-links handling Jeff Johnson
2026-11-24 6:01 ` Miaoqing Pan
2026-11-24 1:58 ` Baochen Qiang
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=e5864418-b181-40b9-8718-2815d84d453e@oss.qualcomm.com \
--to=rameshkumar.sundaram@oss.qualcomm.com \
--cc=ath12k@lists.infradead.org \
--cc=jjohnson@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=miaoqing.pan@oss.qualcomm.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
all inboxes | Powered by JetHome®