Adding the ath11k_hal_srng_dst_next() function allows for the separate invocation of ath11k_hal_srng_dst_peek() and ath11k_hal_srng_dst_next() in certain situations, instead of calling the ath11k_hal_srng_dst_get_next_entry() function alone. Tested-on: QCA6698AQ hw2.1 PCI WLAN.HSP.1.1-04546-QCAHSPSWPL_V1_V2_SILICONZ_IOE-1 Signed-off-by: Miaoqing Pan <quic_miaoqing@xxxxxxxxxxx> --- drivers/net/wireless/ath/ath11k/hal.c | 24 ++++++++++++++---------- drivers/net/wireless/ath/ath11k/hal.h | 3 ++- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/hal.c b/drivers/net/wireless/ath/ath11k/hal.c index 61f4b6dd5380..2fc8409897be 100644 --- a/drivers/net/wireless/ath/ath11k/hal.c +++ b/drivers/net/wireless/ath/ath11k/hal.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/dma-mapping.h> #include "hal_tx.h" @@ -656,18 +656,10 @@ static void ath11k_hal_srng_prefetch_desc(struct ath11k_base *ab, } } -u32 *ath11k_hal_srng_dst_get_next_entry(struct ath11k_base *ab, - struct hal_srng *srng) +void ath11k_hal_srng_dst_next(struct ath11k_base *ab, struct hal_srng *srng) { - u32 *desc; - lockdep_assert_held(&srng->lock); - if (srng->u.dst_ring.tp == srng->u.dst_ring.cached_hp) - return NULL; - - desc = srng->ring_base_vaddr + srng->u.dst_ring.tp; - srng->u.dst_ring.tp += srng->entry_size; /* wrap around to start of ring*/ @@ -677,6 +669,18 @@ u32 *ath11k_hal_srng_dst_get_next_entry(struct ath11k_base *ab, /* Try to prefetch the next descriptor in the ring */ if (srng->flags & HAL_SRNG_FLAGS_CACHED) ath11k_hal_srng_prefetch_desc(ab, srng); +} + +u32 *ath11k_hal_srng_dst_get_next_entry(struct ath11k_base *ab, + struct hal_srng *srng) +{ + u32 *desc; + + lockdep_assert_held(&srng->lock); + + desc = ath11k_hal_srng_dst_peek(ab, srng); + if (desc) + ath11k_hal_srng_dst_next(ab, srng); return desc; } diff --git a/drivers/net/wireless/ath/ath11k/hal.h b/drivers/net/wireless/ath/ath11k/hal.h index 601542410c75..317b09ec6c35 100644 --- a/drivers/net/wireless/ath/ath11k/hal.h +++ b/drivers/net/wireless/ath/ath11k/hal.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022, 2024-2025 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef ATH11K_HAL_H @@ -941,6 +941,7 @@ int ath11k_hal_srng_get_entrysize(struct ath11k_base *ab, u32 ring_type); int ath11k_hal_srng_get_max_entries(struct ath11k_base *ab, u32 ring_type); void ath11k_hal_srng_get_params(struct ath11k_base *ab, struct hal_srng *srng, struct hal_srng_params *params); +void ath11k_hal_srng_dst_next(struct ath11k_base *ab, struct hal_srng *srng); u32 *ath11k_hal_srng_dst_get_next_entry(struct ath11k_base *ab, struct hal_srng *srng); u32 *ath11k_hal_srng_dst_peek(struct ath11k_base *ab, struct hal_srng *srng); -- 2.25.1