]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: ath12k: use ath12k_buffer_addr in ath12k_dp_rx_link_desc_return()
authorKang Yang <kang.yang@oss.qualcomm.com>
Mon, 21 Apr 2025 02:34:40 +0000 (10:34 +0800)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Fri, 16 May 2025 19:38:55 +0000 (12:38 -0700)
Currently, ath12k_dp_rx_link_desc_return() takes struct
hal_reo_dest_ring as its second input. This struct is converted to
struct hal_wbm_release_ring and passed into
ath12k_hal_rx_msdu_link_desc_set(), where it is converted again.

This double conversion is both strange and inefficient.

In ath12k_hal_rx_msdu_link_desc_set(), only buf_addr_info is actually
used. To simplify the code and improve readability, directly passes
buf_addr_info when calling ath12k_dp_rx_link_desc_return().

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

Signed-off-by: Kang Yang <kang.yang@oss.qualcomm.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20250421023444.1778-10-kang.yang@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath12k/dp_rx.c
drivers/net/wireless/ath/ath12k/hal_rx.c
drivers/net/wireless/ath/ath12k/hal_rx.h

index 6bbae10f7389eaf8e5de9f403dcc809fc1128705..382d364fb3ffd632a40b2593233b26015686ccf6 100644 (file)
@@ -843,15 +843,10 @@ void ath12k_dp_rx_peer_tid_delete(struct ath12k *ar,
        rx_tid->active = false;
 }
 
-/* TODO: it's strange (and ugly) that struct hal_reo_dest_ring is converted
- * to struct hal_wbm_release_ring, I couldn't figure out the logic behind
- * that.
- */
 static int ath12k_dp_rx_link_desc_return(struct ath12k_base *ab,
-                                        struct hal_reo_dest_ring *ring,
+                                        struct ath12k_buffer_addr *buf_addr_info,
                                         enum hal_wbm_rel_bm_act action)
 {
-       struct hal_wbm_release_ring *link_desc = (struct hal_wbm_release_ring *)ring;
        struct hal_wbm_release_ring *desc;
        struct ath12k_dp *dp = &ab->dp;
        struct hal_srng *srng;
@@ -869,7 +864,7 @@ static int ath12k_dp_rx_link_desc_return(struct ath12k_base *ab,
                goto exit;
        }
 
-       ath12k_hal_rx_msdu_link_desc_set(ab, desc, link_desc, action);
+       ath12k_hal_rx_msdu_link_desc_set(ab, desc, buf_addr_info, action);
 
 exit:
        ath12k_hal_srng_access_end(ab, srng);
@@ -882,14 +877,17 @@ exit:
 static void ath12k_dp_rx_frags_cleanup(struct ath12k_dp_rx_tid *rx_tid,
                                       bool rel_link_desc)
 {
+       struct ath12k_buffer_addr *buf_addr_info;
        struct ath12k_base *ab = rx_tid->ab;
 
        lockdep_assert_held(&ab->base_lock);
 
        if (rx_tid->dst_ring_desc) {
-               if (rel_link_desc)
-                       ath12k_dp_rx_link_desc_return(ab, rx_tid->dst_ring_desc,
+               if (rel_link_desc) {
+                       buf_addr_info = &rx_tid->dst_ring_desc->buf_addr_info;
+                       ath12k_dp_rx_link_desc_return(ab, buf_addr_info,
                                                      HAL_WBM_REL_BM_ACT_PUT_IN_IDLE);
+               }
                kfree(rx_tid->dst_ring_desc);
                rx_tid->dst_ring_desc = NULL;
        }
@@ -3507,7 +3505,7 @@ static int ath12k_dp_rx_frag_h_mpdu(struct ath12k *ar,
                        goto out_unlock;
                }
        } else {
-               ath12k_dp_rx_link_desc_return(ab, ring_desc,
+               ath12k_dp_rx_link_desc_return(ab, &ring_desc->buf_addr_info,
                                              HAL_WBM_REL_BM_ACT_PUT_IN_IDLE);
        }
 
@@ -3620,7 +3618,7 @@ ath12k_dp_process_rx_err_buf(struct ath12k *ar, struct hal_reo_dest_ring *desc,
 
        if (ath12k_dp_rx_frag_h_mpdu(ar, msdu, desc)) {
                dev_kfree_skb_any(msdu);
-               ath12k_dp_rx_link_desc_return(ar->ab, desc,
+               ath12k_dp_rx_link_desc_return(ar->ab, &desc->buf_addr_info,
                                              HAL_WBM_REL_BM_ACT_PUT_IN_IDLE);
        }
 exit:
@@ -3699,7 +3697,8 @@ int ath12k_dp_rx_process_err(struct ath12k_base *ab, struct napi_struct *napi,
                    rbm != partner_ab->hw_params->hal_params->rx_buf_rbm) {
                        ab->soc_stats.invalid_rbm++;
                        ath12k_warn(ab, "invalid return buffer manager %d\n", rbm);
-                       ath12k_dp_rx_link_desc_return(partner_ab, reo_desc,
+                       ath12k_dp_rx_link_desc_return(partner_ab,
+                                                     &reo_desc->buf_addr_info,
                                                      HAL_WBM_REL_BM_ACT_REL_MSDU);
                        continue;
                }
@@ -3717,7 +3716,8 @@ int ath12k_dp_rx_process_err(struct ath12k_base *ab, struct napi_struct *napi,
                        drop = true;
 
                        /* Return the link desc back to wbm idle list */
-                       ath12k_dp_rx_link_desc_return(partner_ab, reo_desc,
+                       ath12k_dp_rx_link_desc_return(partner_ab,
+                                                     &reo_desc->buf_addr_info,
                                                      HAL_WBM_REL_BM_ACT_PUT_IN_IDLE);
                }
 
index 98eeccc68fcdb6d8b7e8b12d18d960474f5d1245..837284992cd9104c5772482c08c6bfa75b5c0468 100644 (file)
@@ -447,16 +447,16 @@ void ath12k_hal_rx_reo_ent_paddr_get(struct ath12k_base *ab,
 }
 
 void ath12k_hal_rx_msdu_link_desc_set(struct ath12k_base *ab,
-                                     struct hal_wbm_release_ring *dst_desc,
-                                     struct hal_wbm_release_ring *src_desc,
+                                     struct hal_wbm_release_ring *desc,
+                                     struct ath12k_buffer_addr *buf_addr_info,
                                      enum hal_wbm_rel_bm_act action)
 {
-       dst_desc->buf_addr_info = src_desc->buf_addr_info;
-       dst_desc->info0 |= le32_encode_bits(HAL_WBM_REL_SRC_MODULE_SW,
-                                           HAL_WBM_RELEASE_INFO0_REL_SRC_MODULE) |
-                          le32_encode_bits(action, HAL_WBM_RELEASE_INFO0_BM_ACTION) |
-                          le32_encode_bits(HAL_WBM_REL_DESC_TYPE_MSDU_LINK,
-                                           HAL_WBM_RELEASE_INFO0_DESC_TYPE);
+       desc->buf_addr_info = *buf_addr_info;
+       desc->info0 |= le32_encode_bits(HAL_WBM_REL_SRC_MODULE_SW,
+                                       HAL_WBM_RELEASE_INFO0_REL_SRC_MODULE) |
+                   le32_encode_bits(action, HAL_WBM_RELEASE_INFO0_BM_ACTION) |
+                   le32_encode_bits(HAL_WBM_REL_DESC_TYPE_MSDU_LINK,
+                                    HAL_WBM_RELEASE_INFO0_DESC_TYPE);
 }
 
 void ath12k_hal_reo_status_queue_stats(struct ath12k_base *ab, struct hal_tlv_64_hdr *tlv,
index c753eb2a03ad24f809eac79652fc9af65937abaf..ef8bda3c0fc23d08fc5f18d223c16b2b3b90bb97 100644 (file)
@@ -1141,8 +1141,8 @@ void ath12k_hal_rx_msdu_link_info_get(struct hal_rx_msdu_link *link, u32 *num_ms
                                      u32 *msdu_cookies,
                                      enum hal_rx_buf_return_buf_manager *rbm);
 void ath12k_hal_rx_msdu_link_desc_set(struct ath12k_base *ab,
-                                     struct hal_wbm_release_ring *dst_desc,
-                                     struct hal_wbm_release_ring *src_desc,
+                                     struct hal_wbm_release_ring *desc,
+                                     struct ath12k_buffer_addr *buf_addr_info,
                                      enum hal_wbm_rel_bm_act action);
 void ath12k_hal_rx_buf_addr_info_set(struct ath12k_buffer_addr *binfo,
                                     dma_addr_t paddr, u32 cookie, u8 manager);