qcacmn: Calculate Tx delay stat in microsecond

Add changes for computing wifi host and hardware Tx delay
in microsecond.

Change-Id: I7a54e9ee9785d878660f9e5226c315cf96064572
CRs-Fixed: 3254259
This commit is contained in:
Ripan Deuri
2022-09-08 01:40:54 +05:30
committed by Madan Koyyalamudi
parent 0f046983ec
commit 94c2c62746
3 changed files with 107 additions and 7 deletions

View File

@@ -22,6 +22,7 @@
#include <cdp_txrx_hist_struct.h> #include <cdp_txrx_hist_struct.h>
#include "dp_hist.h" #include "dp_hist.h"
#ifndef WLAN_CONFIG_TX_DELAY
/* /*
* dp_hist_sw_enq_dbucket: Sofware enqueue delay bucket in ms * dp_hist_sw_enq_dbucket: Sofware enqueue delay bucket in ms
* @index_0 = 0_1 ms * @index_0 = 0_1 ms
@@ -59,6 +60,46 @@ static uint16_t dp_hist_sw_enq_dbucket[CDP_HIST_BUCKET_MAX] = {
*/ */
static uint16_t dp_hist_fw2hw_dbucket[CDP_HIST_BUCKET_MAX] = { static uint16_t dp_hist_fw2hw_dbucket[CDP_HIST_BUCKET_MAX] = {
0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 250, 500}; 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 250, 500};
#else
/*
* dp_hist_sw_enq_dbucket: Sofware enqueue delay bucket in us
* @index_0 = 0_250 us
* @index_1 = 250_500 us
* @index_2 = 500_750 us
* @index_3 = 750_1000 us
* @index_4 = 1000_1500 us
* @index_5 = 1500_2000 us
* @index_6 = 2000_2500 us
* @index_7 = 2500_5000 us
* @index_8 = 5000_6000 us
* @index_9 = 6000_7000 us
* @index_10 = 7000_8000 us
* @index_11 = 8000_9000 us
* @index_12 = 9000+ us
*/
static uint16_t dp_hist_sw_enq_dbucket[CDP_HIST_BUCKET_MAX] = {
0, 250, 500, 750, 1000, 1500, 2000, 2500, 5000, 6000, 7000, 8000, 9000};
/*
* cdp_hist_fw2hw_dbucket: HW enqueue to Completion Delay in us
* @index_0 = 0_250 us
* @index_1 = 250_500 us
* @index_2 = 500_750 us
* @index_3 = 750_1000 us
* @index_4 = 1000_1500 us
* @index_5 = 1500_2000 us
* @index_6 = 2000_2500 us
* @index_7 = 2500_5000 us
* @index_8 = 5000_6000 us
* @index_9 = 6000_7000 us
* @index_10 = 7000_8000 us
* @index_11 = 8000_9000 us
* @index_12 = 9000+ us
*/
static uint16_t dp_hist_fw2hw_dbucket[CDP_HIST_BUCKET_MAX] = {
0, 250, 500, 750, 1000, 1500, 2000, 2500, 5000, 6000, 7000, 8000, 9000};
#endif
/* /*
* dp_hist_reap2stack_bucket: Reap to stack bucket * dp_hist_reap2stack_bucket: Reap to stack bucket

View File

@@ -284,6 +284,7 @@ const char *mu_reception_mode[TXRX_TYPE_MU_MAX] = {
}; };
#ifdef QCA_ENH_V3_STATS_SUPPORT #ifdef QCA_ENH_V3_STATS_SUPPORT
#ifndef WLAN_CONFIG_TX_DELAY
const char *fw_to_hw_delay_bucket[CDP_DELAY_BUCKET_MAX + 1] = { const char *fw_to_hw_delay_bucket[CDP_DELAY_BUCKET_MAX + 1] = {
"0 to 9 ms", "10 to 19 ms", "0 to 9 ms", "10 to 19 ms",
"20 to 29 ms", "30 to 39 ms", "20 to 29 ms", "30 to 39 ms",
@@ -292,6 +293,16 @@ const char *fw_to_hw_delay_bucket[CDP_DELAY_BUCKET_MAX + 1] = {
"80 to 89 ms", "90 to 99 ms", "80 to 89 ms", "90 to 99 ms",
"101 to 249 ms", "250 to 499 ms", "500+ ms" "101 to 249 ms", "250 to 499 ms", "500+ ms"
}; };
#else
const char *fw_to_hw_delay_bucket[CDP_DELAY_BUCKET_MAX + 1] = {
"0 to 250 us", "250 to 500 us",
"500 to 750 us", "750 to 1000 us",
"1000 to 1500 us", "1500 to 2000 us",
"2000 to 2500 us", "2500 to 5000 us",
"5000 to 6000 us", "6000 to 7000 ms",
"7000 to 8000 us", "8000 to 9000 us", "9000+ us"
};
#endif
#elif defined(HW_TX_DELAY_STATS_ENABLE) #elif defined(HW_TX_DELAY_STATS_ENABLE)
const char *fw_to_hw_delay_bucket[CDP_DELAY_BUCKET_MAX + 1] = { const char *fw_to_hw_delay_bucket[CDP_DELAY_BUCKET_MAX + 1] = {
"0 to 2 ms", "2 to 4 ms", "0 to 2 ms", "2 to 4 ms",
@@ -304,6 +315,7 @@ const char *fw_to_hw_delay_bucket[CDP_DELAY_BUCKET_MAX + 1] = {
#endif #endif
#ifdef QCA_ENH_V3_STATS_SUPPORT #ifdef QCA_ENH_V3_STATS_SUPPORT
#ifndef WLAN_CONFIG_TX_DELAY
const char *sw_enq_delay_bucket[CDP_DELAY_BUCKET_MAX + 1] = { const char *sw_enq_delay_bucket[CDP_DELAY_BUCKET_MAX + 1] = {
"0 to 1 ms", "1 to 2 ms", "0 to 1 ms", "1 to 2 ms",
"2 to 3 ms", "3 to 4 ms", "2 to 3 ms", "3 to 4 ms",
@@ -312,6 +324,16 @@ const char *sw_enq_delay_bucket[CDP_DELAY_BUCKET_MAX + 1] = {
"8 to 9 ms", "9 to 10 ms", "8 to 9 ms", "9 to 10 ms",
"10 to 11 ms", "11 to 12 ms", "12+ ms" "10 to 11 ms", "11 to 12 ms", "12+ ms"
}; };
#else
const char *sw_enq_delay_bucket[CDP_DELAY_BUCKET_MAX + 1] = {
"0 to 250 us", "250 to 500 us",
"500 to 750 us", "750 to 1000 us",
"1000 to 1500 us", "1500 to 2000 us",
"2000 to 2500 us", "2500 to 5000 us",
"5000 to 6000 us", "6000 to 7000 ms",
"7000 to 8000 us", "8000 to 9000 us", "9000+ us"
};
#endif
const char *intfrm_delay_bucket[CDP_DELAY_BUCKET_MAX + 1] = { const char *intfrm_delay_bucket[CDP_DELAY_BUCKET_MAX + 1] = {
"0 to 4 ms", "5 to 9 ms", "0 to 4 ms", "5 to 9 ms",

View File

@@ -3971,10 +3971,39 @@ static void dp_tx_update_peer_sawf_stats(struct dp_soc *soc,
#endif #endif
#ifdef QCA_PEER_EXT_STATS #ifdef QCA_PEER_EXT_STATS
#ifdef WLAN_CONFIG_TX_DELAY
static void dp_tx_compute_tid_delay(struct cdp_delay_tid_stats *stats,
struct dp_tx_desc_s *tx_desc,
struct hal_tx_completion_status *ts,
struct dp_vdev *vdev)
{
struct dp_soc *soc = vdev->pdev->soc;
struct cdp_delay_tx_stats *tx_delay = &stats->tx_delay;
int64_t timestamp_ingress, timestamp_hw_enqueue;
uint32_t sw_enqueue_delay, fwhw_transmit_delay = 0;
if (!ts->valid)
return;
timestamp_ingress = qdf_nbuf_get_timestamp_us(tx_desc->nbuf);
timestamp_hw_enqueue = qdf_ktime_to_us(tx_desc->timestamp);
sw_enqueue_delay = (uint32_t)(timestamp_hw_enqueue - timestamp_ingress);
dp_hist_update_stats(&tx_delay->tx_swq_delay, sw_enqueue_delay);
if (soc->arch_ops.dp_tx_compute_hw_delay)
if (!soc->arch_ops.dp_tx_compute_hw_delay(soc, vdev, ts,
&fwhw_transmit_delay))
dp_hist_update_stats(&tx_delay->hwtx_delay,
fwhw_transmit_delay);
}
#else
/* /*
* dp_tx_compute_tid_delay() - Compute per TID delay * dp_tx_compute_tid_delay() - Compute per TID delay
* @stats: Per TID delay stats * @stats: Per TID delay stats
* @tx_desc: Software Tx descriptor * @tx_desc: Software Tx descriptor
* @ts: Tx completion status
* @vdev: vdev
* *
* Compute the software enqueue and hw enqueue delays and * Compute the software enqueue and hw enqueue delays and
* update the respective histograms * update the respective histograms
@@ -3982,7 +4011,9 @@ static void dp_tx_update_peer_sawf_stats(struct dp_soc *soc,
* Return: void * Return: void
*/ */
static void dp_tx_compute_tid_delay(struct cdp_delay_tid_stats *stats, static void dp_tx_compute_tid_delay(struct cdp_delay_tid_stats *stats,
struct dp_tx_desc_s *tx_desc) struct dp_tx_desc_s *tx_desc,
struct hal_tx_completion_status *ts,
struct dp_vdev *vdev)
{ {
struct cdp_delay_tx_stats *tx_delay = &stats->tx_delay; struct cdp_delay_tx_stats *tx_delay = &stats->tx_delay;
int64_t current_timestamp, timestamp_ingress, timestamp_hw_enqueue; int64_t current_timestamp, timestamp_ingress, timestamp_hw_enqueue;
@@ -4001,6 +4032,7 @@ static void dp_tx_compute_tid_delay(struct cdp_delay_tid_stats *stats,
dp_hist_update_stats(&tx_delay->tx_swq_delay, sw_enqueue_delay); dp_hist_update_stats(&tx_delay->tx_swq_delay, sw_enqueue_delay);
dp_hist_update_stats(&tx_delay->hwtx_delay, fwhw_transmit_delay); dp_hist_update_stats(&tx_delay->hwtx_delay, fwhw_transmit_delay);
} }
#endif
/* /*
* dp_tx_update_peer_delay_stats() - Update the peer delay stats * dp_tx_update_peer_delay_stats() - Update the peer delay stats
@@ -4016,16 +4048,19 @@ static void dp_tx_compute_tid_delay(struct cdp_delay_tid_stats *stats,
*/ */
static void dp_tx_update_peer_delay_stats(struct dp_txrx_peer *txrx_peer, static void dp_tx_update_peer_delay_stats(struct dp_txrx_peer *txrx_peer,
struct dp_tx_desc_s *tx_desc, struct dp_tx_desc_s *tx_desc,
uint8_t tid, uint8_t ring_id) struct hal_tx_completion_status *ts,
uint8_t ring_id)
{ {
struct dp_pdev *pdev = txrx_peer->vdev->pdev; struct dp_pdev *pdev = txrx_peer->vdev->pdev;
struct dp_soc *soc = NULL; struct dp_soc *soc = NULL;
struct dp_peer_delay_stats *delay_stats = NULL; struct dp_peer_delay_stats *delay_stats = NULL;
uint8_t tid;
soc = pdev->soc; soc = pdev->soc;
if (qdf_likely(!wlan_cfg_is_peer_ext_stats_enabled(soc->wlan_cfg_ctx))) if (qdf_likely(!wlan_cfg_is_peer_ext_stats_enabled(soc->wlan_cfg_ctx)))
return; return;
tid = ts->tid;
delay_stats = txrx_peer->delay_stats; delay_stats = txrx_peer->delay_stats;
qdf_assert(delay_stats); qdf_assert(delay_stats);
@@ -4038,12 +4073,14 @@ static void dp_tx_update_peer_delay_stats(struct dp_txrx_peer *txrx_peer,
tid = CDP_MAX_DATA_TIDS - 1; tid = CDP_MAX_DATA_TIDS - 1;
dp_tx_compute_tid_delay(&delay_stats->delay_tid_stats[tid][ring_id], dp_tx_compute_tid_delay(&delay_stats->delay_tid_stats[tid][ring_id],
tx_desc); tx_desc, ts, txrx_peer->vdev);
} }
#else #else
static inline void dp_tx_update_peer_delay_stats(struct dp_txrx_peer *txrx_peer, static inline
struct dp_tx_desc_s *tx_desc, void dp_tx_update_peer_delay_stats(struct dp_txrx_peer *txrx_peer,
uint8_t tid, uint8_t ring_id) struct dp_tx_desc_s *tx_desc,
struct hal_tx_completion_status *ts,
uint8_t ring_id)
{ {
} }
#endif #endif
@@ -4926,7 +4963,7 @@ void dp_tx_comp_process_tx_status(struct dp_soc *soc,
} }
dp_tx_update_peer_stats(tx_desc, ts, txrx_peer, ring_id); dp_tx_update_peer_stats(tx_desc, ts, txrx_peer, ring_id);
dp_tx_update_peer_delay_stats(txrx_peer, tx_desc, ts->tid, ring_id); dp_tx_update_peer_delay_stats(txrx_peer, tx_desc, ts, ring_id);
dp_tx_update_peer_sawf_stats(soc, vdev, txrx_peer, tx_desc, dp_tx_update_peer_sawf_stats(soc, vdev, txrx_peer, tx_desc,
ts, ts->tid); ts, ts->tid);
dp_tx_send_pktlog(soc, vdev->pdev, tx_desc, nbuf, dp_status); dp_tx_send_pktlog(soc, vdev->pdev, tx_desc, nbuf, dp_status);