From 73c7a4f2a347ded585d17869604a789a761399a3 Mon Sep 17 00:00:00 2001 From: Debasis Das Date: Tue, 12 Jul 2022 13:31:49 +0530 Subject: [PATCH] qcacmn: Add support to calculate percentile delay-stats Add support to calculate percentile of delay-bound for for Tx-delay stats. Change-Id: If386e0d1c5091f260aa4281adbd3debde4bf8446 CRs-Fixed: 3243170 --- dp/inc/cdp_txrx_hist_struct.h | 2 ++ dp/wifi3.0/dp_hist.c | 43 ++++++++++++++++++++++++++++++++++- dp/wifi3.0/dp_hist.h | 1 + 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/dp/inc/cdp_txrx_hist_struct.h b/dp/inc/cdp_txrx_hist_struct.h index 7bdefa5133..16a955b41b 100644 --- a/dp/inc/cdp_txrx_hist_struct.h +++ b/dp/inc/cdp_txrx_hist_struct.h @@ -64,12 +64,14 @@ enum cdp_hist_bucket_index { * @CDP_HIST_TYPE_REAP_STACK: Rx HW reap to stack deliver delay * @CDP_HIST_TYPE_HW_TX_COMP_DELAY: Tx completion delay based on the timestamp * provided by HW + * @CDP_HIST_TYPE_DELAY_PERCENTILE: Tx completion delay based on the perctile */ enum cdp_hist_types { CDP_HIST_TYPE_SW_ENQEUE_DELAY, CDP_HIST_TYPE_HW_COMP_DELAY, CDP_HIST_TYPE_REAP_STACK, CDP_HIST_TYPE_HW_TX_COMP_DELAY, + CDP_HIST_TYPE_DELAY_PERCENTILE, CDP_HIST_TYPE_MAX, }; diff --git a/dp/wifi3.0/dp_hist.c b/dp/wifi3.0/dp_hist.c index bda5e78798..0888293e8b 100644 --- a/dp/wifi3.0/dp_hist.c +++ b/dp/wifi3.0/dp_hist.c @@ -80,7 +80,7 @@ static uint16_t dp_hist_reap2stack_bucket[CDP_HIST_BUCKET_MAX] = { 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60}; /* - * dp_hist_hw_tx_comp_dbucket: Tx HW Completion Delay bucket in us + * dp_hist_hw_tx_comp_dbucket: tx hw completion delay bucket in us * @index_0 = 0_250 us * @index_1 = 250_500 us * @index_2 = 500_750 us @@ -114,6 +114,43 @@ const char *dp_hist_tx_hw_delay_str(uint8_t index) return dp_hist_hw_tx_comp_dbucket_str[index]; } +/* + * dp_hist_delay_percentile_dbucket: tx hw completion delay bucket in delay + * bound percentile + * @index_0 = 0_10 + * @index_1 = 10_20 + * @index_2 = 20_30 + * @index_3 = 30_40 + * @index_4 = 40_50 + * @index_5 = 50_60 + * @index_6 = 60_70 + * @index_7 = 70_80 + * @index_8 = 80_100 + * @index_9 = 90_100 + * @index_10 = 100_150 + * @index_11 = 150_200 + * @index_12 = 200+ + */ +static uint16_t dp_hist_delay_percentile_dbucket[CDP_HIST_BUCKET_MAX] = { + 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 150, 200}; + +static +const char *dp_hist_delay_percentile_dbucket_str[CDP_HIST_BUCKET_MAX + 1] = { + "0 to 10%", "10 to 20%", + "20 to 30%", "30 to 40%", + "40 to 50%", "50 to 60%", + "60 to 70%", "70 to 80%", + "80 to 90% ", "90 to 100%", + "100 to 150% ", "150 to 200%", "200+%" +}; + +const char *dp_hist_delay_percentile_str(uint8_t index) +{ + if (index > CDP_HIST_BUCKET_MAX) + return "Invalid index"; + return dp_hist_delay_percentile_dbucket_str[index]; +} + /* * dp_hist_find_bucket_idx: Find the bucket index * @bucket_array: Bucket array @@ -168,6 +205,10 @@ static void dp_hist_fill_buckets(struct cdp_hist_bucket *hist_bucket, int value) idx = dp_hist_find_bucket_idx( &dp_hist_hw_tx_comp_dbucket[0], value); break; + case CDP_HIST_TYPE_DELAY_PERCENTILE: + idx = dp_hist_find_bucket_idx( + &dp_hist_delay_percentile_dbucket[0], value); + break; default: break; } diff --git a/dp/wifi3.0/dp_hist.h b/dp/wifi3.0/dp_hist.h index 8290f86375..3071f9dae9 100644 --- a/dp/wifi3.0/dp_hist.h +++ b/dp/wifi3.0/dp_hist.h @@ -42,4 +42,5 @@ void dp_accumulate_hist_stats(struct cdp_hist_stats *src_hist_stats, void dp_copy_hist_stats(struct cdp_hist_stats *src_hist_stats, struct cdp_hist_stats *dst_hist_stats); const char *dp_hist_tx_hw_delay_str(uint8_t index); +const char *dp_hist_delay_percentile_str(uint8_t index); #endif /* __DP_HIST_H_ */