mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-20 10:51:27 +00:00
66 lines
2.2 KiB
Diff
66 lines
2.2 KiB
Diff
From f5fe62d5eb40ecb54c6a55fc60bd42e9c345ce5a Mon Sep 17 00:00:00 2001
|
|
From: Ramanathan Choodamani <quic_rchoodam@quicinc.com>
|
|
Date: Wed, 8 Mar 2023 00:18:44 -0800
|
|
Subject: [PATCH] ath12k: Add locks while processing Tx completion
|
|
|
|
Adding the locks back while processing the tx completion path, to
|
|
avoid race.
|
|
|
|
Signed-off-by: Ramanathan Choodamani <quic_rchoodam@quicinc.com>
|
|
---
|
|
drivers/net/wireless/ath/ath12k/dp_tx.c | 11 ++++++++---
|
|
1 file changed, 8 insertions(+), 3 deletions(-)
|
|
|
|
--- a/drivers/net/wireless/ath/ath12k/dp_tx.c
|
|
+++ b/drivers/net/wireless/ath/ath12k/dp_tx.c
|
|
@@ -72,25 +72,30 @@ static void ath12k_dp_tx_release_txbuf(s
|
|
{
|
|
tx_desc->skb = NULL;
|
|
tx_desc->skb_ext_desc = NULL;
|
|
+ spin_lock_bh(&dp->tx_desc_lock[ring_id]);
|
|
list_move_tail(&tx_desc->list, &dp->tx_desc_free_list[ring_id]);
|
|
+ spin_unlock_bh(&dp->tx_desc_lock[ring_id]);
|
|
}
|
|
|
|
static inline
|
|
-struct ath12k_tx_desc_info *ath12k_dp_tx_assign_buffer_nolock(struct ath12k_dp *dp,
|
|
+struct ath12k_tx_desc_info *ath12k_dp_tx_assign_buffer(struct ath12k_dp *dp,
|
|
u8 pool_id)
|
|
{
|
|
struct ath12k_tx_desc_info *desc = NULL;
|
|
|
|
+ spin_lock_bh(&dp->tx_desc_lock[pool_id]);
|
|
desc = list_first_entry_or_null(&dp->tx_desc_free_list[pool_id],
|
|
struct ath12k_tx_desc_info,
|
|
list);
|
|
if (!desc) {
|
|
ath12k_dbg(dp->ab, ATH12K_DBG_DP_TX, "failed to allocate data Tx desc\n");
|
|
+ spin_unlock_bh(&dp->tx_desc_lock[pool_id]);
|
|
return NULL;
|
|
}
|
|
|
|
prefetch(desc);
|
|
list_move_tail(&desc->list, &dp->tx_desc_used_list[pool_id]);
|
|
+ spin_unlock_bh(&dp->tx_desc_lock[pool_id]);
|
|
|
|
return desc;
|
|
}
|
|
@@ -173,7 +178,7 @@ int ath12k_dp_tx_direct(struct ath12k_li
|
|
|
|
tx_ring = &dp->tx_ring[ring_id];
|
|
|
|
- tx_desc = ath12k_dp_tx_assign_buffer_nolock(dp, ring_id);
|
|
+ tx_desc = ath12k_dp_tx_assign_buffer(dp, ring_id);
|
|
if (unlikely(!tx_desc)) {
|
|
ab->soc_stats.tx_err.txbuf_na[ring_id]++;
|
|
return -ENOSPC;
|
|
@@ -286,7 +291,7 @@ int ath12k_dp_tx(struct ath12k *ar, stru
|
|
|
|
tx_ring = &dp->tx_ring[ti.ring_id];
|
|
|
|
- tx_desc = ath12k_dp_tx_assign_buffer_nolock(dp, ti.ring_id);
|
|
+ tx_desc = ath12k_dp_tx_assign_buffer(dp, ti.ring_id);
|
|
if (unlikely(!tx_desc)) {
|
|
ab->soc_stats.tx_err.txbuf_na[ti.ring_id]++;
|
|
return -ENOMEM;
|