wifi: ath12k: modify ath12k mac start/stop ops for single wiphy
authorSriram R <quic_srirrama@quicinc.com>
Tue, 9 Apr 2024 11:49:33 +0000 (14:49 +0300)
committerKalle Valo <quic_kvalo@quicinc.com>
Wed, 10 Apr 2024 14:12:14 +0000 (17:12 +0300)
When mac80211 does drv start/stop, apply the state change
for all the radios within the wiphy in ath12k.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
Signed-off-by: Rameshkumar Sundaram <quic_ramess@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://msgid.link/20240405194519.1337906-4-quic_ramess@quicinc.com
drivers/net/wireless/ath/ath12k/mac.c

index 1a4e35d0d5824766b0e59f06e1445853fda3173e..acd7b07ee6bb89070d82d99b08ab10a9965c1a11 100644 (file)
@@ -244,6 +244,7 @@ static const u32 ath12k_smps_map[] = {
 
 static int ath12k_start_vdev_delay(struct ath12k *ar,
                                   struct ath12k_vif *arvif);
+static void ath12k_mac_stop(struct ath12k *ar);
 
 static const char *ath12k_mac_phymode_str(enum wmi_phy_mode mode)
 {
@@ -5473,23 +5474,39 @@ err:
        return ret;
 }
 
+static void ath12k_drain_tx(struct ath12k_hw *ah)
+{
+       struct ath12k *ar;
+       int i;
+
+       for_each_ar(ah, ar, i)
+               ath12k_mac_drain_tx(ar);
+}
+
 static int ath12k_mac_op_start(struct ieee80211_hw *hw)
 {
        struct ath12k_hw *ah = ath12k_hw_to_ah(hw);
-       struct ath12k *ar = ath12k_ah_to_ar(ah, 0);
-       struct ath12k_base *ab = ar->ab;
-       int ret;
+       struct ath12k *ar;
+       int ret, i;
 
-       ath12k_mac_drain_tx(ar);
+       ath12k_drain_tx(ah);
 
-       ret = ath12k_mac_start(ar);
-       if (ret) {
-               ath12k_err(ab, "fail to start mac operations in pdev idx %d ret %d\n",
-                          ar->pdev_idx, ret);
-               return ret;
+       for_each_ar(ah, ar, i) {
+               ret = ath12k_mac_start(ar);
+               if (ret) {
+                       ath12k_err(ar->ab, "fail to start mac operations in pdev idx %d ret %d\n",
+                                  ar->pdev_idx, ret);
+                       goto fail_start;
+               }
        }
 
        return 0;
+fail_start:
+       for (; i > 0; i--) {
+               ar = ath12k_ah_to_ar(ah, i - 1);
+               ath12k_mac_stop(ar);
+       }
+       return ret;
 }
 
 int ath12k_mac_rfkill_config(struct ath12k *ar)
@@ -5585,11 +5602,13 @@ static void ath12k_mac_stop(struct ath12k *ar)
 static void ath12k_mac_op_stop(struct ieee80211_hw *hw)
 {
        struct ath12k_hw *ah = ath12k_hw_to_ah(hw);
-       struct ath12k *ar = ath12k_ah_to_ar(ah, 0);
+       struct ath12k *ar;
+       int i;
 
-       ath12k_mac_drain_tx(ar);
+       ath12k_drain_tx(ah);
 
-       ath12k_mac_stop(ar);
+       for_each_ar(ah, ar, i)
+               ath12k_mac_stop(ar);
 }
 
 static u8