]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: ath12k: handle link removal in change_vif_links()
authorAditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>
Tue, 4 Feb 2025 17:05:14 +0000 (22:35 +0530)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Tue, 11 Feb 2025 15:27:10 +0000 (07:27 -0800)
Currently, the link interface is deleted during channel unassignment, which
does not align with mac80211 link handling. Therefore, add changes to only
perform vdev stop during channel unassignment. The actual vdev deletion
will occur in change_vif_links().

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00130-QCAHKSWPL_SILICONZ-1.97421.5 # Nicolas Escande

Signed-off-by: Aditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Tested-by: Nicolas Escande <nico.escande@gmail.com>
Link: https://patch.msgid.link/20250204-unlink_link_arvif_from_chanctx-v2-8-764fb5973c1a@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath12k/mac.c

index 156ea7a975d919c6f86102c3136c74100bb4a714..c9f7bea4e04a956829c40c67b1c05b3f78d1677c 100644 (file)
@@ -3602,6 +3602,7 @@ 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);
        struct ath12k_link_vif *arvif;
@@ -3626,6 +3627,21 @@ ath12k_mac_op_change_vif_links(struct ieee80211_hw *hw,
                        return -EINVAL;
        }
 
+       for_each_set_bit(link_id, &to_remove, IEEE80211_MLD_MAX_NUM_LINKS) {
+               arvif = wiphy_dereference(hw->wiphy, ahvif->link[link_id]);
+               if (WARN_ON(!arvif))
+                       return -EINVAL;
+
+               if (!arvif->is_created)
+                       continue;
+
+               if (WARN_ON(!arvif->ar))
+                       return -EINVAL;
+
+               ath12k_mac_remove_link_interface(hw, arvif);
+               ath12k_mac_unassign_link_vif(arvif);
+       }
+
        return 0;
 }
 
@@ -9444,9 +9460,6 @@ ath12k_mac_op_unassign_vif_chanctx(struct ieee80211_hw *hw,
        if (ahvif->vdev_type != WMI_VDEV_TYPE_MONITOR &&
            ar->num_started_vdevs == 1 && ar->monitor_vdev_created)
                ath12k_mac_monitor_stop(ar);
-
-       ath12k_mac_remove_link_interface(hw, arvif);
-       ath12k_mac_unassign_link_vif(arvif);
 }
 
 static int