All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] wifi: ath12k: Fix Tx Completion Ring(WBM2SW) Setup Failure
@ 2024-04-09 19:09 Nithyanantham Paramasivam
  2024-04-10 20:25 ` Jeff Johnson
  0 siblings, 1 reply; 9+ messages in thread
From: Nithyanantham Paramasivam @ 2024-04-09 19:09 UTC (permalink / raw)
  To: ath12k; +Cc: linux-wireless, Nithyanantham Paramasivam

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

Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
Signed-off-by: Nithyanantham Paramasivam <quic_nithp@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/dp.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/dp.c b/drivers/net/wireless/ath/ath12k/dp.c
index a0aa8c571867..86d80fd5e2c5 100644
--- a/drivers/net/wireless/ath/ath12k/dp.c
+++ b/drivers/net/wireless/ath/ath12k/dp.c
@@ -127,7 +127,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:
@@ -135,6 +137,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;
@@ -876,11 +886,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]) {

base-commit: dc410c4accd2fe64479a1f4ebc47ec9cd3928f4a
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] wifi: ath12k: Fix Tx Completion Ring(WBM2SW) Setup Failure
  2024-04-09 19:09 [PATCH] wifi: ath12k: Fix Tx Completion Ring(WBM2SW) Setup Failure Nithyanantham Paramasivam
@ 2024-04-10 20:25 ` Jeff Johnson
  2024-04-18 17:52   ` Jeff Johnson
  0 siblings, 1 reply; 9+ messages in thread
From: Jeff Johnson @ 2024-04-10 20:25 UTC (permalink / raw)
  To: Nithyanantham Paramasivam, ath12k; +Cc: linux-wireless

On 4/9/2024 12:09 PM, Nithyanantham Paramasivam wrote:
> 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
> 
> 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>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] wifi: ath12k: Fix Tx Completion Ring(WBM2SW) Setup Failure
  2024-04-10 20:25 ` Jeff Johnson
@ 2024-04-18 17:52   ` Jeff Johnson
  2024-05-09 14:39     ` Jeff Johnson
  0 siblings, 1 reply; 9+ messages in thread
From: Jeff Johnson @ 2024-04-18 17:52 UTC (permalink / raw)
  To: Nithyanantham Paramasivam, ath12k; +Cc: linux-wireless

On 4/10/2024 1:25 PM, Jeff Johnson wrote:
> On 4/9/2024 12:09 PM, Nithyanantham Paramasivam wrote:
>> 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
>>
>> 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>
> 
> 
Please remove my Acked-by.

I've bisected a kernel crash on my laptop to this patch


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] wifi: ath12k: Fix Tx Completion Ring(WBM2SW) Setup Failure
  2024-04-18 17:52   ` Jeff Johnson
@ 2024-05-09 14:39     ` Jeff Johnson
  2024-05-09 16:01       ` Jeff Johnson
  0 siblings, 1 reply; 9+ messages in thread
From: Jeff Johnson @ 2024-05-09 14:39 UTC (permalink / raw)
  To: Nithyanantham Paramasivam, ath12k; +Cc: linux-wireless

On 4/18/2024 10:52 AM, Jeff Johnson wrote:
> On 4/10/2024 1:25 PM, Jeff Johnson wrote:
>> On 4/9/2024 12:09 PM, Nithyanantham Paramasivam wrote:
>>> 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
>>>
>>> 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>
>>
>>
> Please remove my Acked-by.
> 
> I've bisected a kernel crash on my laptop to this patch

While debugging my crash I've determined the issue isn't with this patch, so
restore my:

Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>

/jeff

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] wifi: ath12k: Fix Tx Completion Ring(WBM2SW) Setup Failure
  2024-05-09 14:39     ` Jeff Johnson
@ 2024-05-09 16:01       ` Jeff Johnson
  0 siblings, 0 replies; 9+ messages in thread
From: Jeff Johnson @ 2024-05-09 16:01 UTC (permalink / raw)
  To: Nithyanantham Paramasivam, ath12k; +Cc: linux-wireless

On 5/9/2024 7:39 AM, Jeff Johnson wrote:
> On 4/18/2024 10:52 AM, Jeff Johnson wrote:
>> On 4/10/2024 1:25 PM, Jeff Johnson wrote:
>>> On 4/9/2024 12:09 PM, Nithyanantham Paramasivam wrote:
>>>> 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
>>>>
>>>> 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>
>>>
>>>
>> Please remove my Acked-by.
>>
>> I've bisected a kernel crash on my laptop to this patch
> 
> While debugging my crash I've determined the issue isn't with this patch, so
> restore my:
> 
> Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
> 
> /jeff
> 
OK, I got confused between testing public patches & internal patches. It turns
out this version actually does have an issue, and there is a respin coming.

So reinstate the NAK on this version.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] wifi: ath12k: Fix Tx Completion Ring(WBM2SW) Setup Failure
  2024-05-09 17:32 ` Jeff Johnson
@ 2024-05-10  7:03   ` Nithyanantham Paramasivam
  0 siblings, 0 replies; 9+ messages in thread
From: Nithyanantham Paramasivam @ 2024-05-10  7:03 UTC (permalink / raw)
  To: Jeff Johnson, ath12k; +Cc: linux-wireless

On 5/9/2024 11:02 PM, Jeff Johnson wrote:
> you need to version your patches
Sure Jeff. Resending the patch with v2

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] wifi: ath12k: Fix Tx Completion Ring(WBM2SW) Setup Failure
  2024-05-09 16:16 Nithyanantham Paramasivam
@ 2024-05-09 17:32 ` Jeff Johnson
  2024-05-10  7:03   ` Nithyanantham Paramasivam
  0 siblings, 1 reply; 9+ messages in thread
From: Jeff Johnson @ 2024-05-09 17:32 UTC (permalink / raw)
  To: Nithyanantham Paramasivam, ath12k; +Cc: linux-wireless

you need to version your patches

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] wifi: ath12k: Fix Tx Completion Ring(WBM2SW) Setup Failure
@ 2024-05-09 16:16 Nithyanantham Paramasivam
  2024-05-09 17:32 ` Jeff Johnson
  0 siblings, 1 reply; 9+ messages in thread
From: Nithyanantham Paramasivam @ 2024-05-09 16:16 UTC (permalink / raw)
  To: ath12k; +Cc: linux-wireless, Nithyanantham Paramasivam

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: 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>
---
 drivers/net/wireless/ath/ath12k/dp.c | 18 +++++++++++++-----
 drivers/net/wireless/ath/ath12k/hw.c |  2 +-
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/dp.c b/drivers/net/wireless/ath/ath12k/dp.c
index 72ea9baaf8d7..14f26dd16b79 100644
--- a/drivers/net/wireless/ath/ath12k/dp.c
+++ b/drivers/net/wireless/ath/ath12k/dp.c
@@ -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;
@@ -883,11 +893,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]) {
diff --git a/drivers/net/wireless/ath/ath12k/hw.c b/drivers/net/wireless/ath/ath12k/hw.c
index f4c827015821..5ed06c0d90e2 100644
--- a/drivers/net/wireless/ath/ath12k/hw.c
+++ b/drivers/net/wireless/ath/ath12k/hw.c
@@ -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 = {
 	},

base-commit: 2c4d8e19cf060744a9db466ffbaea13ab37f25ca
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH] wifi: ath12k: Fix Tx Completion Ring(WBM2SW) Setup Failure
@ 2024-05-09 16:13 Nithyanantham Paramasivam
  0 siblings, 0 replies; 9+ messages in thread
From: Nithyanantham Paramasivam @ 2024-05-09 16:13 UTC (permalink / raw)
  To: --to=ath12k; +Cc: linux-wireless, Nithyanantham Paramasivam

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: 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>
---
 drivers/net/wireless/ath/ath12k/dp.c | 18 +++++++++++++-----
 drivers/net/wireless/ath/ath12k/hw.c |  2 +-
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/dp.c b/drivers/net/wireless/ath/ath12k/dp.c
index 72ea9baaf8d7..14f26dd16b79 100644
--- a/drivers/net/wireless/ath/ath12k/dp.c
+++ b/drivers/net/wireless/ath/ath12k/dp.c
@@ -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;
@@ -883,11 +893,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]) {
diff --git a/drivers/net/wireless/ath/ath12k/hw.c b/drivers/net/wireless/ath/ath12k/hw.c
index f4c827015821..5ed06c0d90e2 100644
--- a/drivers/net/wireless/ath/ath12k/hw.c
+++ b/drivers/net/wireless/ath/ath12k/hw.c
@@ -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 = {
 	},

base-commit: 2c4d8e19cf060744a9db466ffbaea13ab37f25ca
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-05-10  7:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-09 19:09 [PATCH] wifi: ath12k: Fix Tx Completion Ring(WBM2SW) Setup Failure Nithyanantham Paramasivam
2024-04-10 20:25 ` Jeff Johnson
2024-04-18 17:52   ` Jeff Johnson
2024-05-09 14:39     ` Jeff Johnson
2024-05-09 16:01       ` Jeff Johnson
2024-05-09 16:13 Nithyanantham Paramasivam
2024-05-09 16:16 Nithyanantham Paramasivam
2024-05-09 17:32 ` Jeff Johnson
2024-05-10  7:03   ` Nithyanantham Paramasivam

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.