All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ath11k/hal: Fix few bugs in ath11k_hal_srng_dst_num_free()
@ 2019-07-18  4:24 Vasanthakumar Thiagarajan
  2019-07-18  4:24 ` [PATCH 2/2] ath11k/dp_rx: Fix possible REO ring desc overwrite Vasanthakumar Thiagarajan
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Vasanthakumar Thiagarajan @ 2019-07-18  4:24 UTC (permalink / raw)
  To: ath11k

The logic to compute the number of available buffers in destination
ring is wrong. It should be just the different between head and
tail pointers in terms of the entry size. This functions currently
unused, this is fixed to make use of this function in follow-up
patches. Also make destination ring head pointer volatile because
it is independently updated by HW.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/hal.c | 7 +++----
 drivers/net/wireless/ath/ath11k/hal.h | 2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/hal.c b/drivers/net/wireless/ath/ath11k/hal.c
index 7da42a1..9eac311 100644
--- a/drivers/net/wireless/ath/ath11k/hal.c
+++ b/drivers/net/wireless/ath/ath11k/hal.c
@@ -745,9 +745,9 @@ int ath11k_hal_srng_dst_num_free(struct ath11k_base *ab, struct hal_srng *srng,
 	}
 
 	if (hp >= tp)
-		return ((hp - tp) / srng->entry_size) - 1;
+		return (hp - tp) / srng->entry_size;
 	else
-		return ((srng->ring_size - tp + hp) / srng->entry_size) - 1;
+		return (srng->ring_size - tp + hp) / srng->entry_size;
 }
 
 /* Returns number of available entries in src ring */
@@ -862,8 +862,7 @@ void ath11k_hal_srng_access_begin(struct ath11k_base *ab, struct hal_srng *srng)
 		srng->u.src_ring.cached_tp =
 			*(volatile u32 *)srng->u.src_ring.tp_addr;
 	else
-		srng->u.dst_ring.cached_hp =
-			*(volatile u32 *)srng->u.dst_ring.hp_addr;
+		srng->u.dst_ring.cached_hp = *srng->u.dst_ring.hp_addr;
 }
 
 /* Update cached ring head/tail pointers to HW. ath11k_hal_srng_access_begin()
diff --git a/drivers/net/wireless/ath/ath11k/hal.h b/drivers/net/wireless/ath/ath11k/hal.h
index a1e917e..d580acf 100644
--- a/drivers/net/wireless/ath/ath11k/hal.h
+++ b/drivers/net/wireless/ath/ath11k/hal.h
@@ -538,7 +538,7 @@ struct hal_srng {
 			u32 tp;
 
 			/* Shadow head pointer location to be updated by HW */
-			u32 *hp_addr;
+			volatile u32 *hp_addr;
 
 			/* Cached head pointer */
 			u32 cached_hp;
-- 
1.9.1


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

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

end of thread, other threads:[~2019-07-31 15:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-18  4:24 [PATCH 1/2] ath11k/hal: Fix few bugs in ath11k_hal_srng_dst_num_free() Vasanthakumar Thiagarajan
2019-07-18  4:24 ` [PATCH 2/2] ath11k/dp_rx: Fix possible REO ring desc overwrite Vasanthakumar Thiagarajan
2019-07-18 11:37 ` [PATCH 1/2] ath11k/hal: Fix few bugs in ath11k_hal_srng_dst_num_free() Kalle Valo
2019-07-18 12:13   ` Vasanthakumar Thiagarajan
2019-07-31 15:06 ` Kalle Valo

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.