wifi: ath12k: move txbaddr/rxbaddr into struct ath12k_dp
authorNicolas Escande <nico.escande@gmail.com>
Fri, 30 Aug 2024 08:19:42 +0000 (10:19 +0200)
committerKalle Valo <quic_kvalo@quicinc.com>
Sat, 28 Sep 2024 09:19:37 +0000 (12:19 +0300)
Those two fields are used to store the per SPT page of tx/rx descriptors send to
the firmware for cookie conversion. Right now they are in struct ath12k_spt_info
which means they are duplicated PPT page times while we only need one instance
of them. This works for now as we always use the first spt_info as a global
storage for all PPT pages.

Let's move them into struct ath12k_dp where they belong, alongside of the
spt_info array they are tied to, to avoid waisting a good bit of memory.

Tested-on: QCN9274 hw2.0 PCI CI_WLAN.WBE.1.3-03283.1-QCAHKSWPL_SILICONZ-2
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

Signed-off-by: Nicolas Escande <nico.escande@gmail.com>
Reviewed-by: Remi Pommarel <repk@triplefau.lt>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://patch.msgid.link/20240830081942.3623380-1-nico.escande@gmail.com
drivers/net/wireless/ath/ath12k/dp.c
drivers/net/wireless/ath/ath12k/dp.h

index 61aa78d8bd8c8fef4872e15e63a32a76c927c934..ecd3b5c76d26a72b927ad66c37d3ea7c4f663ec3 100644 (file)
@@ -1162,7 +1162,7 @@ static void ath12k_dp_cc_cleanup(struct ath12k_base *ab)
        spin_lock_bh(&dp->rx_desc_lock);
 
        for (i = 0; i < ATH12K_NUM_RX_SPT_PAGES; i++) {
-               desc_info = dp->spt_info->rxbaddr[i];
+               desc_info = dp->rxbaddr[i];
 
                for (j = 0; j < ATH12K_MAX_SPT_ENTRIES; j++) {
                        if (!desc_info[j].in_use) {
@@ -1181,11 +1181,11 @@ static void ath12k_dp_cc_cleanup(struct ath12k_base *ab)
        }
 
        for (i = 0; i < ATH12K_NUM_RX_SPT_PAGES; i++) {
-               if (!dp->spt_info->rxbaddr[i])
+               if (!dp->rxbaddr[i])
                        continue;
 
-               kfree(dp->spt_info->rxbaddr[i]);
-               dp->spt_info->rxbaddr[i] = NULL;
+               kfree(dp->rxbaddr[i]);
+               dp->rxbaddr[i] = NULL;
        }
 
        spin_unlock_bh(&dp->rx_desc_lock);
@@ -1220,11 +1220,11 @@ static void ath12k_dp_cc_cleanup(struct ath12k_base *ab)
 
                for (i = 0; i < ATH12K_TX_SPT_PAGES_PER_POOL; i++) {
                        tx_spt_page = i + pool_id * ATH12K_TX_SPT_PAGES_PER_POOL;
-                       if (!dp->spt_info->txbaddr[tx_spt_page])
+                       if (!dp->txbaddr[tx_spt_page])
                                continue;
 
-                       kfree(dp->spt_info->txbaddr[tx_spt_page]);
-                       dp->spt_info->txbaddr[tx_spt_page] = NULL;
+                       kfree(dp->txbaddr[tx_spt_page]);
+                       dp->txbaddr[tx_spt_page] = NULL;
                }
 
                spin_unlock_bh(&dp->tx_desc_lock[pool_id]);
@@ -1415,7 +1415,7 @@ static int ath12k_dp_cc_desc_init(struct ath12k_base *ab)
 
                ppt_idx = ATH12K_RX_SPT_PAGE_OFFSET + i;
                cookie_ppt_idx = dp->rx_ppt_base + ppt_idx;
-               dp->spt_info->rxbaddr[i] = &rx_descs[0];
+               dp->rxbaddr[i] = &rx_descs[0];
 
                for (j = 0; j < ATH12K_MAX_SPT_ENTRIES; j++) {
                        rx_descs[j].cookie = ath12k_dp_cc_cookie_gen(cookie_ppt_idx, j);
@@ -1445,7 +1445,7 @@ static int ath12k_dp_cc_desc_init(struct ath12k_base *ab)
                        tx_spt_page = i + pool_id * ATH12K_TX_SPT_PAGES_PER_POOL;
                        ppt_idx = ATH12K_TX_SPT_PAGE_OFFSET + tx_spt_page;
 
-                       dp->spt_info->txbaddr[tx_spt_page] = &tx_descs[0];
+                       dp->txbaddr[tx_spt_page] = &tx_descs[0];
 
                        for (j = 0; j < ATH12K_MAX_SPT_ENTRIES; j++) {
                                tx_descs[j].desc_id = ath12k_dp_cc_cookie_gen(ppt_idx, j);
index 2fb18b83b3eec422f9b675aeeccdeac06dc24b46..07180eec8f2669cf2edfa62d2f4c2807632a746e 100644 (file)
@@ -300,8 +300,6 @@ struct ath12k_tx_desc_info {
 struct ath12k_spt_info {
        dma_addr_t paddr;
        u64 *vaddr;
-       struct ath12k_rx_desc_info *rxbaddr[ATH12K_NUM_RX_SPT_PAGES];
-       struct ath12k_tx_desc_info *txbaddr[ATH12K_NUM_TX_SPT_PAGES];
 };
 
 struct ath12k_reo_queue_ref {
@@ -352,6 +350,8 @@ struct ath12k_dp {
        struct ath12k_spt_info *spt_info;
        u32 num_spt_pages;
        u32 rx_ppt_base;
+       struct ath12k_rx_desc_info *rxbaddr[ATH12K_NUM_RX_SPT_PAGES];
+       struct ath12k_tx_desc_info *txbaddr[ATH12K_NUM_TX_SPT_PAGES];
        struct list_head rx_desc_free_list;
        /* protects the free desc list */
        spinlock_t rx_desc_lock;