wifi: ath12k: refactor ath12k_mac_op_start()
authorKarthikeyan Periyasamy <quic_periyasa@quicinc.com>
Sun, 14 Jan 2024 15:02:40 +0000 (17:02 +0200)
committerKalle Valo <quic_kvalo@quicinc.com>
Tue, 16 Jan 2024 12:21:35 +0000 (14:21 +0200)
To support single wiphy abstraction, introduce link/radio specific helper
function in the mac80211 callback start(). This way, the callback can be
extended to handle multiple link/radio in the future.

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-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4

Signed-off-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://msgid.link/20240103063731.3356060-5-quic_periyasa@quicinc.com
drivers/net/wireless/ath/ath12k/mac.c

index 37ae22d27ccb29cc475a70f2b8e088aa183f062e..d48161b43a4a69abb38a22bf226ffe8b1d8f2d35 100644 (file)
@@ -5081,14 +5081,12 @@ static void ath12k_mac_wait_reconfigure(struct ath12k_base *ab)
                                    ATH12K_RECONFIGURE_TIMEOUT_HZ);
 }
 
-static int ath12k_mac_op_start(struct ieee80211_hw *hw)
+static int ath12k_mac_start(struct ath12k *ar)
 {
-       struct ath12k *ar = hw->priv;
        struct ath12k_base *ab = ar->ab;
        struct ath12k_pdev *pdev = ar->pdev;
        int ret;
 
-       ath12k_mac_drain_tx(ar);
        mutex_lock(&ar->conf_mutex);
 
        switch (ar->state) {
@@ -5111,14 +5109,14 @@ static int ath12k_mac_op_start(struct ieee80211_hw *hw)
                                        1, pdev->pdev_id);
 
        if (ret) {
-               ath12k_err(ar->ab, "failed to enable PMF QOS: (%d\n", ret);
+               ath12k_err(ab, "failed to enable PMF QOS: (%d\n", ret);
                goto err;
        }
 
        ret = ath12k_wmi_pdev_set_param(ar, WMI_PDEV_PARAM_DYNAMIC_BW, 1,
                                        pdev->pdev_id);
        if (ret) {
-               ath12k_err(ar->ab, "failed to enable dynamic bw: %d\n", ret);
+               ath12k_err(ab, "failed to enable dynamic bw: %d\n", ret);
                goto err;
        }
 
@@ -5148,7 +5146,7 @@ static int ath12k_mac_op_start(struct ieee80211_hw *hw)
                                        1, pdev->pdev_id);
 
        if (ret) {
-               ath12k_err(ar->ab, "failed to enable MESH MCAST ENABLE: (%d\n", ret);
+               ath12k_err(ab, "failed to enable MESH MCAST ENABLE: (%d\n", ret);
                goto err;
        }
 
@@ -5174,7 +5172,7 @@ static int ath12k_mac_op_start(struct ieee80211_hw *hw)
        }
 
        if (ret == -ENOTSUPP)
-               ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
+               ath12k_dbg(ab, ATH12K_DBG_MAC,
                           "monitor status config is not yet supported");
 
        /* Configure the hash seed for hash based reo dest ring selection */
@@ -5196,7 +5194,6 @@ static int ath12k_mac_op_start(struct ieee80211_hw *hw)
                           &ab->pdevs[ar->pdev_idx]);
 
        return 0;
-
 err:
        ar->state = ATH12K_STATE_OFF;
        mutex_unlock(&ar->conf_mutex);
@@ -5204,6 +5201,24 @@ err:
        return ret;
 }
 
+static int ath12k_mac_op_start(struct ieee80211_hw *hw)
+{
+       struct ath12k *ar = hw->priv;
+       struct ath12k_base *ab = ar->ab;
+       int ret;
+
+       ath12k_mac_drain_tx(ar);
+
+       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;
+       }
+
+       return 0;
+}
+
 int ath12k_mac_rfkill_config(struct ath12k *ar)
 {
        struct ath12k_base *ab = ar->ab;