From 112813c1b7abc1ff32e807f0ea46edcddf18eaa2 Mon Sep 17 00:00:00 2001 From: Yu Tian Date: Tue, 28 Sep 2021 17:06:24 +0800 Subject: [PATCH] qcacmn: Add API to get TX pending in WoW state This change is used to provide an API for PMO module to check whether there are pending TX frames before HOST sends wake up indication to FW. PMO module uses this to indicate FW whehter to discard HWDTIM. Change-Id: Icc3271e87e376e3313fddc5f4f99e39daeaf6af7 CRs-Fixed: 3046947 --- dp/inc/cdp_txrx_cmn.h | 15 +++++++++++++++ dp/inc/cdp_txrx_ops.h | 1 + dp/wifi3.0/dp_main.c | 1 + dp/wifi3.0/dp_tx.c | 2 ++ dp/wifi3.0/dp_types.h | 3 +++ 5 files changed, 22 insertions(+) diff --git a/dp/inc/cdp_txrx_cmn.h b/dp/inc/cdp_txrx_cmn.h index ee820826e3..566d8477bf 100644 --- a/dp/inc/cdp_txrx_cmn.h +++ b/dp/inc/cdp_txrx_cmn.h @@ -2700,4 +2700,19 @@ cdp_set_pkt_capture_mode(ol_txrx_soc_handle soc, bool val) { } #endif + +/** + * cdp_rx_get_pending() - Get number of pending frames of RX threads + * @soc: opaque soc handle + * Return: number of pending frames + */ +static inline uint32_t +cdp_get_tx_inqueue(ol_txrx_soc_handle soc) +{ + if (!soc || !soc->ol_ops || + !soc->ol_ops->dp_get_tx_inqueue) + return 0; + + return soc->ol_ops->dp_get_tx_inqueue(soc); +} #endif /* _CDP_TXRX_CMN_H_ */ diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index 2dd1ae0846..f74b88d30b 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -1232,6 +1232,7 @@ struct ol_if_ops { uint32_t service_interval_ul, uint32_t burst_size_ul, uint8_t add_or_sub, uint8_t ac); #endif + uint32_t (*dp_get_tx_inqueue)(ol_txrx_soc_handle soc); }; #ifdef DP_PEER_EXTENDED_API diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 46073ab9b8..b8543f4ea0 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -11218,6 +11218,7 @@ void dp_flush_ring_hptp(struct dp_soc *soc, hal_ring_handle_t hal_srng) hal_srng_access_end(soc->hal_soc, hal_srng); hal_srng_set_flush_last_ts(hal_srng); + qdf_atomic_set(&soc->tx_pending_rtpm, 0); dp_debug("flushed"); } } diff --git a/dp/wifi3.0/dp_tx.c b/dp/wifi3.0/dp_tx.c index d78c9f0525..b48353e4fe 100644 --- a/dp/wifi3.0/dp_tx.c +++ b/dp/wifi3.0/dp_tx.c @@ -1458,6 +1458,7 @@ dp_tx_ring_access_end_wrapper(struct dp_soc *soc, } else { dp_tx_hal_ring_access_end_reap(soc, hal_ring_hdl); hal_srng_set_event(hal_ring_hdl, HAL_SRNG_FLUSH_EVENT); + qdf_atomic_inc(&soc->tx_pending_rtpm); hal_srng_inc_flush_cnt(hal_ring_hdl); } dp_runtime_put(soc); @@ -1466,6 +1467,7 @@ dp_tx_ring_access_end_wrapper(struct dp_soc *soc, dp_runtime_get(soc); dp_tx_hal_ring_access_end_reap(soc, hal_ring_hdl); hal_srng_set_event(hal_ring_hdl, HAL_SRNG_FLUSH_EVENT); + qdf_atomic_inc(&soc->tx_pending_rtpm); hal_srng_inc_flush_cnt(hal_ring_hdl); dp_runtime_put(soc); } diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index 1ee451d40b..1ddadce8bf 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -2126,6 +2126,9 @@ struct dp_soc { #ifdef FEATURE_RUNTIME_PM /* Dp runtime refcount */ qdf_atomic_t dp_runtime_refcount; + + /* Dp tx pending count in RTPM */ + qdf_atomic_t tx_pending_rtpm; #endif /* Invalid buffer that allocated for RX buffer */ qdf_nbuf_queue_t invalid_buf_queue;