]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
wifi: ath12k: Fix tx completion ring (WBM2SW) setup failure
authorNithyanantham Paramasivam <quic_nithp@quicinc.com>
Fri, 10 May 2024 07:04:27 +0000 (12:34 +0530)
committerKalle Valo <quic_kvalo@quicinc.com>
Thu, 16 May 2024 08:25:04 +0000 (11:25 +0300)
We observe intermittent ping failures from the access point (AP) to
station (STA) in any mode (AP-STA or Mesh) configured. Specifically,
the transmission completion status is not received at tx completion
ring id 4 (WBM2SW ring4) for the packets transmitted via TCL DATA
ring id 3. This prevents freeing up tx descriptors and leads
to buffer exhaustion.

Currently, during initialization of the WBM2SW ring, we are directly
mapping the ring number to the ring mask to obtain the ring mask
group index. This approach is causing setup failures for WBM2SW
ring 4. Similarly, during runtime, when receiving incoming
transmission completion status, the validation of the ring number by
mapping the interrupted ring mask. This is resulting in
validation failure. Thereby preventing entry into the completion
handler ath12k_dp_tx_completion_handler().

The existing design assumed that the ring numbers would always be
sequential and could be directly mapped with the ring mask. However,
this assumption does not hold true for WBM2SW ring 4. Therefore,
modify the design such that, instead of mapping the ring number,
the ring ID is mapped with the ring mask.

According to this design:

1. During initialization of the WBM2SW ring, mapping the ring ID
to the ring mask will ensure obtaining the correct ring mask group
ID.

2. During runtime, validating the interrupted ring mask group ID
within the transmission completion group is sufficient. This
approach allows the ring ID to be derived from the interrupted ring
mask and enables entry into the completion handler.

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.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
Signed-off-by: Nithyanantham Paramasivam <quic_nithp@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://msgid.link/20240510070427.206152-1-quic_nithp@quicinc.com
drivers/net/wireless/ath/ath12k/dp.c
drivers/net/wireless/ath/ath12k/hw.c

index 412ab08e6cca2d39e5da17b1b15b5c230bcee3b4..c04fa3eb57d690cdbdf7a72ce33efce4311febf8 100644 (file)
@@ -132,7 +132,9 @@ static int ath12k_dp_srng_find_ring_in_mask(int ring_num, const u8 *grp_mask)
 static int ath12k_dp_srng_calculate_msi_group(struct ath12k_base *ab,
                                              enum hal_ring_type type, int ring_num)
 {
+       const struct ath12k_hal_tcl_to_wbm_rbm_map *map;
        const u8 *grp_mask;
+       int i;
 
        switch (type) {
        case HAL_WBM2SW_RELEASE:
@@ -140,6 +142,14 @@ 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->hw_params->hal_ops->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;
+                                       break;
+                               }
+                       }
+
                        grp_mask = &ab->hw_params->ring_mask->tx[0];
                }
                break;
@@ -867,11 +877,9 @@ int ath12k_dp_service_srng(struct ath12k_base *ab,
        enum dp_monitor_mode monitor_mode;
        u8 ring_mask;
 
-       while (i < ab->hw_params->max_tx_ring) {
-               if (ab->hw_params->ring_mask->tx[grp_id] &
-                       BIT(ab->hw_params->hal_ops->tcl_to_wbm_rbm_map[i].wbm_ring_num))
-                       ath12k_dp_tx_completion_handler(ab, i);
-               i++;
+       if (ab->hw_params->ring_mask->tx[grp_id]) {
+               i = fls(ab->hw_params->ring_mask->tx[grp_id]) - 1;
+               ath12k_dp_tx_completion_handler(ab, i);
        }
 
        if (ab->hw_params->ring_mask->rx_err[grp_id]) {
index b3ba753d4a855c3e1025e83e1abb0c59b8387ab2..5a1d406e6b1f9c91d0f412d2da37ca988bb7c3fc 100644 (file)
@@ -580,8 +580,8 @@ static const struct ath12k_hw_ring_mask ath12k_hw_ring_mask_qcn9274 = {
 static const struct ath12k_hw_ring_mask ath12k_hw_ring_mask_wcn7850 = {
        .tx  = {
                ATH12K_TX_RING_MASK_0,
+               ATH12K_TX_RING_MASK_1,
                ATH12K_TX_RING_MASK_2,
-               ATH12K_TX_RING_MASK_4,
        },
        .rx_mon_dest = {
        },