1: 24d9f83e2bc3 = 1: 4ccb4c984cd4 wifi: ath12k: add WMI response handling for MLO link set active command 2: e759650fb80f = 2: b7c88ee0252a wifi: ath12k: send overwrite flags and AP MLD addr in MLO link set active 3: a05530c60a07 ! 3: b55f53823b26 wifi: ath12k: fix ath12k_mac_op_change_vif_links() for active-link updates @@ Commit message 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. + links change and when the active links change. In both cases + old_links/new_links are only the active links, and for an active-link + change 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. + A link that is only deactivated keeps its arvif. For a station, a link + removed from valid_links keeps its arvif as well: ML reconfiguration + deactivates the link first, so the removal is not reported to the + driver, and the firmware does not support deleting the vdev of a single + link while the ML association is up. On disconnect (valid_links == 0) + every remaining arvif is removed. + + A removed link has no bss_conf anymore, so skip links that are not in + vif->valid_links in the change_chanctx iterators.  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 @@ drivers/net/wireless/ath/ath12k/mac.c: ath12k_mac_op_change_vif_links(struct iee  - 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. ++ * old_links/new_links only describe the active links, so link vifs ++ * follow vif->valid_links. A link that leaves valid_links while it is ++ * inactive (ML reconfiguration deactivates it first) is not reported ++ * through this callback, and firmware can't delete the vdev/peer of a ++ * single link of an ML association. So an associated STA MLD keeps ++ * all link vifs until valid_links becomes 0.  + */  + to_add = vif->valid_links & ~ahvif->links_map;  + to_remove = ahvif->links_map & ~vif->valid_links; ++ if (vif->type == NL80211_IFTYPE_STATION && vif->valid_links) ++ to_remove = 0;   + 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; +@@ drivers/net/wireless/ath/ath12k/mac.c: ath12k_mac_change_chanctx_cnt_iter(void *data, u8 *mac, + lockdep_assert_wiphy(ahvif->ah->hw->wiphy); +  + links_map = ahvif->links_map; ++ /* ++ * skip links removed by the AP but kept until disconnect ++ */ ++ if (ieee80211_vif_is_mld(vif)) ++ links_map &= vif->valid_links; ++ + for_each_set_bit(link_id, &links_map, IEEE80211_MLD_MAX_NUM_LINKS) { + arvif = wiphy_dereference(ahvif->ah->hw->wiphy, ahvif->link[link_id]); + if (WARN_ON(!arvif)) +@@ drivers/net/wireless/ath/ath12k/mac.c: ath12k_mac_change_chanctx_fill_iter(void *data, u8 *mac, + lockdep_assert_wiphy(ahvif->ah->hw->wiphy); +  + links_map = ahvif->links_map; ++ /* ++ * skip links removed by the AP but kept until disconnect ++ */ ++ if (ieee80211_vif_is_mld(vif)) ++ links_map &= vif->valid_links; ++ + for_each_set_bit(link_id, &links_map, IEEE80211_MLD_MAX_NUM_LINKS) { + arvif = wiphy_dereference(ahvif->ah->hw->wiphy, ahvif->link[link_id]); + if (WARN_ON(!arvif)) 4: b8c905d3766e = 4: c0a530e4abad wifi: ath12k: skip links without channel context in ath12k_mac_get_vif_up() 5: 948954e6f732 = 5: 1975bfc7e6e0 wifi: ath12k: restart STA link vdev on chanctx assign if channel changed 6: 513869f0929a = 6: 83cca81d7c81 wifi: ath12k: use WMI_MLO_VDEV_BITMAP_SZ for vdev bitmap bounds check 7: 6bcba6d88ac5 ! 7: 7b94debf0e52 wifi: ath12k: handle MLO active link updates @@ drivers/net/wireless/ath/ath12k/mac.c: static struct ath12k_link_sta *ath12k_mac  +  + lockdep_assert_wiphy(hw->wiphy);  + -+ links = ahsta->links_map & ahvif->links_map; ++ links = ahsta->links_map & ahvif->links_map & ahvif->vif->valid_links;  +  + /*  + * A link holding a channel context is active. The links of an MLO STA