Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8163bb3 authored by Vevek Venkatesan's avatar Vevek Venkatesan Committed by Madan Koyyalamudi
Browse files

qcacmn: init last_desc_cleared and it should always behind tp

Initialize the last_desc_cleared pointer to -1 not 0, and
also fix the check it should always behind tp.

Change-Id: I281e066d45a99ac99d4f3c4e0bcc3f65f14bb589
CRs-Fixed: 2987029
parent 39425f6b
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -1788,8 +1788,7 @@ void *hal_srng_src_get_next_consumed(void *hal_soc,
	uint32_t next_entry = (srng->last_desc_cleared + srng->entry_size) %
			      srng->ring_size;

	if (next_entry != (srng->u.src_ring.cached_tp + srng->entry_size) %
			  srng->ring_size) {
	if (next_entry != srng->u.src_ring.cached_tp) {
		desc = &srng->ring_base_vaddr[next_entry];
		srng->last_desc_cleared = next_entry;
	}
+23 −0
Original line number Diff line number Diff line
@@ -1721,6 +1721,27 @@ static inline void hal_srng_hw_init(struct hal_soc *hal,
#define CHECK_SHADOW_REGISTERS false
#endif

#if defined(CLEAR_SW2TCL_CONSUMED_DESC)
/**
 * hal_srng_last_desc_cleared_init - Initialize SRNG last_desc_cleared ptr
 *
 * @srng: Source ring pointer
 *
 * Return: None
 */
static inline
void hal_srng_last_desc_cleared_init(struct hal_srng *srng)
{
	srng->last_desc_cleared = srng->ring_size - srng->entry_size;
}

#else
static inline
void hal_srng_last_desc_cleared_init(struct hal_srng *srng)
{
}
#endif /* CLEAR_SW2TCL_CONSUMED_DESC */

/**
 * hal_srng_setup - Initialize HW SRNG ring.
 * @hal_soc: Opaque HAL SOC handle
@@ -1799,6 +1820,8 @@ void *hal_srng_setup(void *hal_soc, int ring_type, int ring_num,
	srng->flags |= HAL_SRNG_RING_PTR_SWAP;
#endif

	hal_srng_last_desc_cleared_init(srng);

	if (srng->ring_dir == HAL_SRNG_SRC_RING) {
		srng->u.src_ring.hp = 0;
		srng->u.src_ring.reap_hp = srng->ring_size -