From 26b3d560fe1e26c6dfc96710373a0cb8d6ac3940 Mon Sep 17 00:00:00 2001 From: Venkateswara Naralasetty Date: Thu, 20 Oct 2022 18:56:42 +0530 Subject: [PATCH] qcacmn: add near full logic for Tx completion ring Reap mode desc from the Tx completion ring in case the number of available entries are less than the half of the ring entries. Change-Id: I3635b88c3e98cc8a5f30fc58cf5e353f6301d4ad CRs-Fixed: 3325826 --- dp/wifi3.0/dp_tx.c | 18 +++++++++++++++++- dp/wifi3.0/dp_types.h | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/dp/wifi3.0/dp_tx.c b/dp/wifi3.0/dp_tx.c index e06b609ccc..754578c710 100644 --- a/dp/wifi3.0/dp_tx.c +++ b/dp/wifi3.0/dp_tx.c @@ -5573,9 +5573,12 @@ uint32_t dp_tx_comp_handler(struct dp_intr *int_ctx, struct dp_soc *soc, bool force_break = false; struct dp_srng *tx_comp_ring = &soc->tx_comp_ring[ring_id]; int max_reap_limit, ring_near_full; + uint32_t num_entries; DP_HIST_INIT(); + num_entries = hal_srng_get_num_entries(soc->hal_soc, hal_ring_hdl); + more_data: hal_soc = soc->hal_soc; @@ -5593,7 +5596,9 @@ more_data: return 0; } - num_avail_for_reap = hal_srng_dst_num_valid(hal_soc, hal_ring_hdl, 0); + if (!num_avail_for_reap) + num_avail_for_reap = hal_srng_dst_num_valid(hal_soc, + hal_ring_hdl, 0); if (num_avail_for_reap >= quota) num_avail_for_reap = quota; @@ -5797,6 +5802,17 @@ next_desc: if (!hif_exec_should_yield(soc->hif_handle, int_ctx->dp_intr_id)) goto more_data; + + num_avail_for_reap = + hal_srng_dst_num_valid_locked(soc->hal_soc, + hal_ring_hdl, + true); + if (qdf_unlikely(num_entries && + (num_avail_for_reap >= + num_entries >> 1))) { + DP_STATS_INC(soc, tx.near_full, 1); + goto more_data; + } } } DP_TX_HIST_STATS_PER_PDEV(); diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index 0faf073db8..a3a0be1ead 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -1110,6 +1110,8 @@ struct dp_soc_stats { uint32_t tx_comp[MAX_TCL_DATA_RINGS]; /* Number of tx completions force freed */ uint32_t tx_comp_force_freed; + /* Tx completion ring near full */ + uint32_t near_full; } tx; /* SOC level RX stats */