]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: ath12k: Move wbm_rbm_map to hw specific hal files
authorPavankumar Nandeshwar <quic_pnandesh@quicinc.com>
Thu, 9 Oct 2025 11:10:31 +0000 (16:40 +0530)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Fri, 10 Oct 2025 14:06:17 +0000 (07:06 -0700)
Move wbm_rbm_map from common hal file to
hw specific hal files, since these implementations are
specific and configurable for each hardware.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-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: Pavankumar Nandeshwar <quic_pnandesh@quicinc.com>
Signed-off-by: Ripan Deuri <quic_rdeuri@quicinc.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20251009111045.1763001-5-quic_rdeuri@quicinc.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath12k/ahb.c
drivers/net/wireless/ath/ath12k/dp.c
drivers/net/wireless/ath/ath12k/hal.c
drivers/net/wireless/ath/ath12k/hal.h
drivers/net/wireless/ath/ath12k/wifi7/dp_tx.c
drivers/net/wireless/ath/ath12k/wifi7/hal.c
drivers/net/wireless/ath/ath12k/wifi7/hal_qcn9274.c
drivers/net/wireless/ath/ath12k/wifi7/hal_qcn9274.h
drivers/net/wireless/ath/ath12k/wifi7/hal_wcn7850.c
drivers/net/wireless/ath/ath12k/wifi7/hal_wcn7850.h

index 2c991580571c0557640b420c8af8a99ad2331349..91ee962ebc243002831af909ce70802deac7126b 100644 (file)
@@ -558,12 +558,10 @@ static int ath12k_ahb_config_ext_irq(struct ath12k_base *ab)
 {
        const struct ath12k_hw_ring_mask *ring_mask;
        struct ath12k_ext_irq_grp *irq_grp;
-       const struct hal_ops *hal_ops;
        int i, j, irq, irq_idx, ret;
        u32 num_irq;
 
        ring_mask = ab->hw_params->ring_mask;
-       hal_ops = ab->hal.hal_ops;
        for (i = 0; i < ATH12K_EXT_IRQ_GRP_NUM_MAX; i++) {
                irq_grp = &ab->ext_irq_grp[i];
                num_irq = 0;
@@ -583,7 +581,7 @@ static int ath12k_ahb_config_ext_irq(struct ath12k_base *ab)
                         * tcl_to_wbm_rbm_map point to the same ring number.
                         */
                        if (ring_mask->tx[i] &
-                           BIT(hal_ops->tcl_to_wbm_rbm_map[j].wbm_ring_num)) {
+                           BIT(ab->hal.tcl_to_wbm_rbm_map[j].wbm_ring_num)) {
                                irq_grp->irqs[num_irq++] =
                                        wbm2host_tx_completions_ring1 - j;
                        }
index 167878e9964cbabcc6e59875841cdab5d30ebca2..b2a60b6c06efd2bbf18c9be650d0693ba26e4183 100644 (file)
@@ -142,7 +142,7 @@ static int ath12k_dp_srng_calculate_msi_group(struct ath12k_base *ab,
                        grp_mask = &ab->hw_params->ring_mask->rx_wbm_rel[0];
                        ring_num = 0;
                } else {
-                       map = ab->hal.hal_ops->tcl_to_wbm_rbm_map;
+                       map = ab->hal.tcl_to_wbm_rbm_map;
                        for (i = 0; i < ab->hw_params->max_tx_ring; i++) {
                                if (ring_num == map[i].wbm_ring_num) {
                                        ring_num = i;
@@ -508,7 +508,7 @@ static int ath12k_dp_srng_common_setup(struct ath12k_base *ab)
        }
 
        for (i = 0; i < ab->hw_params->max_tx_ring; i++) {
-               map = ab->hal.hal_ops->tcl_to_wbm_rbm_map;
+               map = ab->hal.tcl_to_wbm_rbm_map;
                tx_comp_ring_num = map[i].wbm_ring_num;
 
                ret = ath12k_dp_srng_setup(ab, &dp->tx_ring[i].tcl_data_ring,
index 338a4e5244ddfbc4e140bd647f5e13e10d71c8d9..d1dfbe2f9a654dae1a7be0e0800d41d19ed1521c 100644 (file)
 #include "wifi7/hal_qcn9274.h"
 #include "wifi7/hal_wcn7850.h"
 
-const struct ath12k_hal_tcl_to_wbm_rbm_map
-ath12k_hal_qcn9274_tcl_to_wbm_rbm_map[DP_TCL_NUM_RING_MAX] = {
-       {
-               .wbm_ring_num = 0,
-               .rbm_id = HAL_RX_BUF_RBM_SW0_BM,
-       },
-       {
-               .wbm_ring_num = 1,
-               .rbm_id = HAL_RX_BUF_RBM_SW1_BM,
-       },
-       {
-               .wbm_ring_num = 2,
-               .rbm_id = HAL_RX_BUF_RBM_SW2_BM,
-       },
-       {
-               .wbm_ring_num = 4,
-               .rbm_id = HAL_RX_BUF_RBM_SW4_BM,
-       }
-};
-
-const struct ath12k_hal_tcl_to_wbm_rbm_map
-ath12k_hal_wcn7850_tcl_to_wbm_rbm_map[DP_TCL_NUM_RING_MAX] = {
-       {
-               .wbm_ring_num = 0,
-               .rbm_id = HAL_RX_BUF_RBM_SW0_BM,
-       },
-       {
-               .wbm_ring_num = 2,
-               .rbm_id = HAL_RX_BUF_RBM_SW2_BM,
-       },
-       {
-               .wbm_ring_num = 4,
-               .rbm_id = HAL_RX_BUF_RBM_SW4_BM,
-       },
-};
-
 static unsigned int ath12k_hal_reo1_ring_id_offset(struct ath12k_base *ab)
 {
        return HAL_REO1_RING_ID(ab) - HAL_REO1_RING_BASE_LSB(ab);
index 4874bebc11f7faea382212d1f56f0d40b6428a73..5763a18ac0462b74394b1a1e1bed9d0f171db961 100644 (file)
@@ -1473,6 +1473,8 @@ struct ath12k_hal {
        int num_shadow_reg_configured;
 
        u32 hal_desc_sz;
+
+       const struct ath12k_hal_tcl_to_wbm_rbm_map *tcl_to_wbm_rbm_map;
 };
 
 /* Maps WBM ring number and Return Buffer Manager Id per TCL ring */
@@ -1582,11 +1584,11 @@ enum nl80211_he_ru_alloc ath12k_he_ru_tones_to_nl80211_he_ru_alloc(u16 ru_tones)
 struct ath12k_hw_version_map {
        const struct hal_ops *hal_ops;
        u32 hal_desc_sz;
+       const struct ath12k_hal_tcl_to_wbm_rbm_map *tcl_to_wbm_rbm_map;
 };
 
 struct hal_ops {
        int (*create_srng_config)(struct ath12k_base *ab);
-       const struct ath12k_hal_tcl_to_wbm_rbm_map *tcl_to_wbm_rbm_map;
        void (*rx_desc_set_msdu_len)(struct hal_rx_desc *desc, u16 len);
        void (*rx_desc_get_dot11_hdr)(struct hal_rx_desc *desc,
                                      struct ieee80211_hdr *hdr);
index 036bacd704e92a3e9970b77afd0e5e4409fee699..b3c0f8a6a5ce09130cf032c280bb536c628e83a8 100644 (file)
@@ -107,7 +107,7 @@ tcl_ring_sel:
        ti.ring_id = ring_selector % ab->hw_params->max_tx_ring;
 
        ring_map |= BIT(ti.ring_id);
-       ti.rbm_id = ab->hal.hal_ops->tcl_to_wbm_rbm_map[ti.ring_id].rbm_id;
+       ti.rbm_id = ab->hal.tcl_to_wbm_rbm_map[ti.ring_id].rbm_id;
 
        tx_ring = &dp->tx_ring[ti.ring_id];
 
index 0e3930c8575a2a740bea98cb50de19bcb4ae7a56..53ea3792ef518d6b237b09b3b78c5fb061d09fdf 100644 (file)
@@ -14,18 +14,22 @@ static const struct ath12k_hw_version_map ath12k_wifi7_hw_ver_map[] = {
        [ATH12K_HW_QCN9274_HW10] = {
                .hal_ops = &hal_qcn9274_ops,
                .hal_desc_sz = sizeof(struct hal_rx_desc_qcn9274_compact),
+               .tcl_to_wbm_rbm_map = ath12k_hal_tcl_to_wbm_rbm_map_qcn9274,
        },
        [ATH12K_HW_QCN9274_HW20] = {
                .hal_ops = &hal_qcn9274_ops,
                .hal_desc_sz = sizeof(struct hal_rx_desc_qcn9274_compact),
+               .tcl_to_wbm_rbm_map = ath12k_hal_tcl_to_wbm_rbm_map_qcn9274,
        },
        [ATH12K_HW_WCN7850_HW20] = {
                .hal_ops = &hal_wcn7850_ops,
                .hal_desc_sz = sizeof(struct hal_rx_desc_wcn7850),
+               .tcl_to_wbm_rbm_map = ath12k_hal_tcl_to_wbm_rbm_map_wcn7850,
        },
        [ATH12K_HW_IPQ5332_HW10] = {
                .hal_ops = &hal_qcn9274_ops,
                .hal_desc_sz = sizeof(struct hal_rx_desc_qcn9274_compact),
+               .tcl_to_wbm_rbm_map = ath12k_hal_tcl_to_wbm_rbm_map_qcn9274,
        },
 };
 
@@ -37,6 +41,7 @@ int ath12k_wifi7_hal_init(struct ath12k_base *ab)
 
        hal->hal_ops = ath12k_wifi7_hw_ver_map[ab->hw_rev].hal_ops;
        hal->hal_desc_sz = ath12k_wifi7_hw_ver_map[ab->hw_rev].hal_desc_sz;
+       hal->tcl_to_wbm_rbm_map = ath12k_wifi7_hw_ver_map[ab->hw_rev].tcl_to_wbm_rbm_map;
 
        return 0;
 }
index 6a1c13565700bd20ec5482ad21920508c5ec1725..fefa151efaefce9a5f42b048db20e346ae5ab255 100644 (file)
@@ -681,9 +681,28 @@ static int ath12k_hal_srng_create_config_qcn9274(struct ath12k_base *ab)
        return 0;
 }
 
+const struct ath12k_hal_tcl_to_wbm_rbm_map
+ath12k_hal_tcl_to_wbm_rbm_map_qcn9274[DP_TCL_NUM_RING_MAX] = {
+       {
+               .wbm_ring_num = 0,
+               .rbm_id = HAL_RX_BUF_RBM_SW0_BM,
+       },
+       {
+               .wbm_ring_num = 1,
+               .rbm_id = HAL_RX_BUF_RBM_SW1_BM,
+       },
+       {
+               .wbm_ring_num = 2,
+               .rbm_id = HAL_RX_BUF_RBM_SW2_BM,
+       },
+       {
+               .wbm_ring_num = 4,
+               .rbm_id = HAL_RX_BUF_RBM_SW4_BM,
+       },
+};
+
 const struct hal_ops hal_qcn9274_ops = {
        .create_srng_config = ath12k_hal_srng_create_config_qcn9274,
-       .tcl_to_wbm_rbm_map = ath12k_hal_qcn9274_tcl_to_wbm_rbm_map,
        .rx_desc_set_msdu_len = ath12k_hal_rx_desc_set_msdu_len_qcn9274,
        .rx_desc_get_dot11_hdr = ath12k_hal_rx_desc_get_dot11_hdr_qcn9274,
        .rx_desc_get_crypto_header = ath12k_hal_rx_desc_get_crypto_hdr_qcn9274,
index 4d08292d8a7f975d671b98e8edebbc416566a74f..1b431d5b641702e9f735e04929353c75f3bfd792 100644 (file)
@@ -14,7 +14,7 @@
 
 extern const struct hal_ops hal_qcn9274_ops;
 extern const struct ath12k_hal_tcl_to_wbm_rbm_map
-ath12k_hal_qcn9274_tcl_to_wbm_rbm_map[DP_TCL_NUM_RING_MAX];
+ath12k_hal_tcl_to_wbm_rbm_map_qcn9274[DP_TCL_NUM_RING_MAX];
 
 u8 ath12k_hal_rx_desc_get_l3_pad_bytes_qcn9274(struct hal_rx_desc *desc);
 void ath12k_hal_rx_desc_copy_end_tlv_qcn9274(struct hal_rx_desc *fdesc,
index 275de9c1a359d9b9680a1861b2d675f53d85a771..3e88a1e68b87b0f96d3271bda76980ec569f3551 100644 (file)
@@ -690,9 +690,24 @@ static int ath12k_hal_srng_create_config_wcn7850(struct ath12k_base *ab)
        return 0;
 }
 
+const struct ath12k_hal_tcl_to_wbm_rbm_map
+ath12k_hal_tcl_to_wbm_rbm_map_wcn7850[DP_TCL_NUM_RING_MAX] = {
+       {
+               .wbm_ring_num = 0,
+               .rbm_id = HAL_RX_BUF_RBM_SW0_BM,
+       },
+       {
+               .wbm_ring_num = 2,
+               .rbm_id = HAL_RX_BUF_RBM_SW2_BM,
+       },
+       {
+               .wbm_ring_num = 4,
+               .rbm_id = HAL_RX_BUF_RBM_SW4_BM,
+       },
+};
+
 const struct hal_ops hal_wcn7850_ops = {
        .create_srng_config = ath12k_hal_srng_create_config_wcn7850,
-       .tcl_to_wbm_rbm_map = ath12k_hal_wcn7850_tcl_to_wbm_rbm_map,
        .rx_desc_set_msdu_len = ath12k_hal_rx_desc_set_msdu_len_wcn7850,
        .rx_desc_get_dot11_hdr = ath12k_hal_rx_desc_get_dot11_hdr_wcn7850,
        .rx_desc_get_crypto_header = ath12k_hal_rx_desc_get_crypto_hdr_wcn7850,
index 8207e73602b3c4ae1b1a78326a52f923435b9164..2df4976f59aa40d7ff86651bf0bc58f053c2b770 100644 (file)
@@ -12,7 +12,7 @@
 
 extern const struct hal_ops hal_wcn7850_ops;
 extern const struct ath12k_hal_tcl_to_wbm_rbm_map
-ath12k_hal_wcn7850_tcl_to_wbm_rbm_map[DP_TCL_NUM_RING_MAX];
+ath12k_hal_tcl_to_wbm_rbm_map_wcn7850[DP_TCL_NUM_RING_MAX];
 
 u8 ath12k_hal_rx_desc_get_l3_pad_bytes_wcn7850(struct hal_rx_desc *desc);
 void ath12k_hal_rx_desc_copy_end_tlv_wcn7850(struct hal_rx_desc *fdesc,