From 980ceb9cb9e86be32047e7f750f83d7e0a18cb3f Mon Sep 17 00:00:00 2001 From: "Pamidipati, Vijay" Date: Wed, 5 Jul 2017 05:20:17 +0530 Subject: [PATCH] qcacmn: Add new HAL API to get SRNG descriptor which is pending reap To release/flush buffers from source SRNGs which have not been reaped yet, add a new HAL API to get next descriptor which is pending reap Change-Id: Ibe490d8f8667ed046beb98fe19bfd7feb31aa286 CRs-Fixed: 2165595 --- hal/wifi3.0/hal_api.h | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/hal/wifi3.0/hal_api.h b/hal/wifi3.0/hal_api.h index 81e368061a87..8e48b24cc46c 100644 --- a/hal/wifi3.0/hal_api.h +++ b/hal/wifi3.0/hal_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -579,6 +579,33 @@ static inline void *hal_srng_src_get_next_reaped(void *hal_soc, void *hal_ring) return NULL; } +/** + * hal_srng_src_pending_reap_next - Reap next entry from a source ring and + * move reap pointer. This API is used in detach path to release any buffers + * associated with ring entries which are pending reap. + * + * @hal_soc: Opaque HAL SOC handle + * @hal_ring: Source ring pointer + * + * Return: Opaque pointer for next ring entry; NULL on failire + */ +static inline void *hal_srng_src_pending_reap_next(void *hal_soc, void *hal_ring) +{ + struct hal_srng *srng = (struct hal_srng *)hal_ring; + uint32_t *desc; + + uint32_t next_reap_hp = (srng->u.src_ring.reap_hp + srng->entry_size) % + srng->ring_size; + + if (next_reap_hp != srng->u.src_ring.hp) { + desc = &(srng->ring_base_vaddr[next_reap_hp]); + srng->u.src_ring.reap_hp = next_reap_hp; + return (void *)desc; + } + + return NULL; +} + /** * hal_srng_src_done_val - *