linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath11k: Avoid mgmt tx count underflow
@ 2020-03-30 11:17 Sriram R
  2020-04-06 16:24 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Sriram R @ 2020-03-30 11:17 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Sriram R

The mgmt tx count reference is incremented/decremented on every mgmt tx and on
tx completion event from firmware.
In case of an unexpected mgmt tx completion event from firmware,
the counter would underflow. Avoid this by decrementing
only when the tx count is greater than 0.

Signed-off-by: Sriram R <srirrama@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/wmi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index e7ce369..d999c47 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -3740,8 +3740,9 @@ static int wmi_process_mgmt_tx_comp(struct ath11k *ar, u32 desc_id,
 
 	ieee80211_tx_status_irqsafe(ar->hw, msdu);
 
-	WARN_ON_ONCE(atomic_read(&ar->num_pending_mgmt_tx) == 0);
-	atomic_dec(&ar->num_pending_mgmt_tx);
+	/* WARN when we received this event without doing any mgmt tx */
+	if (atomic_dec_if_positive(&ar->num_pending_mgmt_tx) < 0)
+		WARN_ON_ONCE(1);
 
 	return 0;
 }
-- 
2.7.4

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

* Re: [PATCH] ath11k: Avoid mgmt tx count underflow
  2020-03-30 11:17 [PATCH] ath11k: Avoid mgmt tx count underflow Sriram R
@ 2020-04-06 16:24 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2020-04-06 16:24 UTC (permalink / raw)
  To: Sriram R; +Cc: ath11k, linux-wireless, Sriram R

Sriram R <srirrama@codeaurora.org> wrote:

> The mgmt tx count reference is incremented/decremented on every mgmt tx and on
> tx completion event from firmware.
> In case of an unexpected mgmt tx completion event from firmware,
> the counter would underflow. Avoid this by decrementing
> only when the tx count is greater than 0.
> 
> Signed-off-by: Sriram R <srirrama@codeaurora.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

Patch applied to ath-next branch of ath.git, thanks.

800113ff4b1d ath11k: Avoid mgmt tx count underflow

-- 
https://patchwork.kernel.org/patch/11465279/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

end of thread, other threads:[~2020-04-06 16:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-30 11:17 [PATCH] ath11k: Avoid mgmt tx count underflow Sriram R
2020-04-06 16:24 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).