Ver Fonte

qcacmn: Use HP instead of loop count in dst rings

SRNG loop count is not restored after LMAC resets, and hence can't
be used to reap entries from destination rings. Modify the SRNG API
to use head pointer instead.

Change-Id: I3b05948d531cc3d1a5ccb7f01e38f8f36ae69da9
CRs-Fixed: 2091809
Karunakar Dasineni há 7 anos atrás
pai
commit
6bcbdd5a27
1 ficheiros alterados com 6 adições e 16 exclusões
  1. 6 16
      hal/wifi3.0/hal_api.h

+ 6 - 16
hal/wifi3.0/hal_api.h

@@ -410,13 +410,10 @@ static inline int hal_srng_access_start(void *hal_soc, void *hal_ring)
 static inline void *hal_srng_dst_get_next(void *hal_soc, void *hal_ring)
 {
 	struct hal_srng *srng = (struct hal_srng *)hal_ring;
-	volatile uint32_t *desc = &(srng->ring_base_vaddr[srng->u.dst_ring.tp]);
-	uint32_t desc_loop_cnt;
-
-	desc_loop_cnt = (desc[srng->entry_size - 1] & SRNG_LOOP_CNT_MASK)
-		>> SRNG_LOOP_CNT_LSB;
+	uint32_t *desc;
 
-	if (srng->u.dst_ring.loop_cnt == desc_loop_cnt) {
+	if (srng->u.dst_ring.tp != srng->u.dst_ring.cached_hp) {
+		desc = &(srng->ring_base_vaddr[srng->u.dst_ring.tp]);
 		/* TODO: Using % is expensive, but we have to do this since
 		 * size of some SRNG rings is not power of 2 (due to descriptor
 		 * sizes). Need to create separate API for rings used
@@ -426,12 +423,9 @@ static inline void *hal_srng_dst_get_next(void *hal_soc, void *hal_ring)
 		srng->u.dst_ring.tp = (srng->u.dst_ring.tp + srng->entry_size) %
 			srng->ring_size;
 
-		srng->u.dst_ring.loop_cnt = (srng->u.dst_ring.loop_cnt +
-			!srng->u.dst_ring.tp) &
-			(SRNG_LOOP_CNT_MASK >> SRNG_LOOP_CNT_LSB);
-		/* TODO: Confirm if loop count mask is same for all rings */
 		return (void *)desc;
 	}
+
 	return NULL;
 }
 
@@ -449,14 +443,10 @@ static inline void *hal_srng_dst_get_next(void *hal_soc, void *hal_ring)
 static inline void *hal_srng_dst_peek(void *hal_soc, void *hal_ring)
 {
 	struct hal_srng *srng = (struct hal_srng *)hal_ring;
-	uint32_t *desc = &(srng->ring_base_vaddr[srng->u.dst_ring.tp]);
-	uint32_t desc_loop_cnt;
 
-	desc_loop_cnt = (desc[srng->entry_size - 1] & SRNG_LOOP_CNT_MASK)
-		>> SRNG_LOOP_CNT_LSB;
+	if (srng->u.dst_ring.tp != srng->u.dst_ring.cached_hp)
+		return (void *)(&(srng->ring_base_vaddr[srng->u.dst_ring.tp]));
 
-	if (srng->u.dst_ring.loop_cnt == desc_loop_cnt)
-		return (void *)desc;
 	return NULL;
 }