ath10k: high latency fixes for beacon buffer
authorAlagu Sankar <alagusankar@silex-india.com>
Tue, 28 Sep 2021 11:00:47 +0000 (14:00 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 28 Sep 2021 14:34:32 +0000 (17:34 +0300)
Beacon buffer for high latency devices does not use DMA. other similar
buffer allocation methods in the driver have already been modified for
high latency path. Fix the beacon buffer allocation left out in the
earlier high latency changes.

Signed-off-by: Alagu Sankar <alagusankar@silex-india.com>
Signed-off-by: Erik Stromdahl <erik.stromdahl@gmail.com>
[fabio: adapt it to use ar->bus_param.dev_type ]
Signed-off-by: Fabio Estevam <festevam@denx.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210818232627.2040121-1-festevam@denx.de
drivers/net/wireless/ath/ath10k/mac.c

index c272b29..7ca68c8 100644 (file)
@@ -993,8 +993,12 @@ static void ath10k_mac_vif_beacon_cleanup(struct ath10k_vif *arvif)
        ath10k_mac_vif_beacon_free(arvif);
 
        if (arvif->beacon_buf) {
-               dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN,
-                                 arvif->beacon_buf, arvif->beacon_paddr);
+               if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL)
+                       kfree(arvif->beacon_buf);
+               else
+                       dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN,
+                                         arvif->beacon_buf,
+                                         arvif->beacon_paddr);
                arvif->beacon_buf = NULL;
        }
 }
@@ -5576,10 +5580,17 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
        if (vif->type == NL80211_IFTYPE_ADHOC ||
            vif->type == NL80211_IFTYPE_MESH_POINT ||
            vif->type == NL80211_IFTYPE_AP) {
-               arvif->beacon_buf = dma_alloc_coherent(ar->dev,
-                                                      IEEE80211_MAX_FRAME_LEN,
-                                                      &arvif->beacon_paddr,
-                                                      GFP_ATOMIC);
+               if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL) {
+                       arvif->beacon_buf = kmalloc(IEEE80211_MAX_FRAME_LEN,
+                                                   GFP_KERNEL);
+                       arvif->beacon_paddr = (dma_addr_t)arvif->beacon_buf;
+               } else {
+                       arvif->beacon_buf =
+                               dma_alloc_coherent(ar->dev,
+                                                  IEEE80211_MAX_FRAME_LEN,
+                                                  &arvif->beacon_paddr,
+                                                  GFP_ATOMIC);
+               }
                if (!arvif->beacon_buf) {
                        ret = -ENOMEM;
                        ath10k_warn(ar, "failed to allocate beacon buffer: %d\n",
@@ -5794,8 +5805,12 @@ err_vdev_delete:
 
 err:
        if (arvif->beacon_buf) {
-               dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN,
-                                 arvif->beacon_buf, arvif->beacon_paddr);
+               if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL)
+                       kfree(arvif->beacon_buf);
+               else
+                       dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN,
+                                         arvif->beacon_buf,
+                                         arvif->beacon_paddr);
                arvif->beacon_buf = NULL;
        }