Thread (16 messages) flat view 16 messages, 4 authors, 2021-06-30
STALE1861d

[PATCH 09/12] ath11k: remove mod operator in dst ring processing

From: Jouni Malinen <hidden>
Date: 2021-06-15 22:45:06
Also in: ath11k
Subsystem: atheros ath generic utilities, qualcomm atheros ath11k wireless driver, the rest · Maintainers: Jeff Johnson, Linus Torvalds

From: P Praneesh <redacted>

Replace use of the mod operator with a manual wrap around to avoid
additional cost of using the mod operation.

Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01734-QCAHKSWPL_SILICONZ-1 v2

Co-developed-by: Sriram R <redacted>
Signed-off-by: Sriram R <redacted>
Signed-off-by: P Praneesh <redacted>
Signed-off-by: Jouni Malinen <redacted>
---
 drivers/net/wireless/ath/ath11k/hal.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath11k/hal.c b/drivers/net/wireless/ath/ath11k/hal.c
index a58e86e42b5b..0326c2fed374 100644
--- a/drivers/net/wireless/ath/ath11k/hal.c
+++ b/drivers/net/wireless/ath/ath11k/hal.c
@@ -654,8 +654,11 @@ u32 *ath11k_hal_srng_dst_get_next_entry(struct ath11k_base *ab,
 
 	desc = srng->ring_base_vaddr + srng->u.dst_ring.tp;
 
-	srng->u.dst_ring.tp = (srng->u.dst_ring.tp + srng->entry_size) %
-			      srng->ring_size;
+	srng->u.dst_ring.tp += srng->entry_size;
+
+	/* wrap around to start of ring */
+	if (srng->u.dst_ring.tp == srng->ring_size)
+		srng->u.dst_ring.tp = 0;
 
 	/* Try to prefetch the next descriptor in the ring */
 	if (srng->flags & HAL_SRNG_FLAGS_CACHED)
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help