From 8dc0e2a679a06b5649299bce2e0ad03ad4116d1c Mon Sep 17 00:00:00 2001 From: Ankit Kumar Date: Thu, 28 Feb 2019 18:17:15 +0530 Subject: [PATCH] qcacmn: Add time_latency check for tx_completion This patch adds support to measure latency for tx completions Change-Id: Ifda1c2f7ffaf8276f012e7a458f6f167ad931356 --- dp/inc/cdp_txrx_cmn_struct.h | 2 ++ dp/wifi3.0/dp_main.c | 6 ++++++ dp/wifi3.0/dp_tx.c | 21 +++++++++++++++++---- dp/wifi3.0/dp_tx.h | 3 ++- dp/wifi3.0/dp_types.h | 4 ++++ 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/dp/inc/cdp_txrx_cmn_struct.h b/dp/inc/cdp_txrx_cmn_struct.h index 1a68a0699b..ff14d2904a 100644 --- a/dp/inc/cdp_txrx_cmn_struct.h +++ b/dp/inc/cdp_txrx_cmn_struct.h @@ -819,6 +819,7 @@ struct cdp_soc_t { * @CDP_CONFIG_IGMPMLD_OVERRIDE: Override IGMP/MLD * @CDP_CONFIG_IGMPMLD_TID: Configurable TID value when igmmld_override is set * @CDP_CONFIG_ARP_DBG_CONF: Enable ARP debug + * @CDP_CONFIG_CAPTURE_LATENCY: Capture time latency */ enum cdp_pdev_param_type { CDP_CONFIG_DEBUG_SNIFFER, @@ -828,6 +829,7 @@ enum cdp_pdev_param_type { CDP_CONFIG_IGMPMLD_OVERRIDE, CDP_CONFIG_IGMPMLD_TID, CDP_CONFIG_ARP_DBG_CONF, + CDP_CONFIG_CAPTURE_LATENCY, }; /* diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index fa155c78b1..d6396780e7 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -7978,6 +7978,12 @@ static QDF_STATUS dp_set_pdev_param(struct cdp_pdev *pdev_handle, case CDP_CONFIG_PRIMARY_RADIO: pdev->is_primary = val; break; + case CDP_CONFIG_CAPTURE_LATENCY: + if (val == 1) + pdev->latency_capture_enable = true; + else + pdev->latency_capture_enable = false; + break; default: return QDF_STATUS_E_INVAL; } diff --git a/dp/wifi3.0/dp_tx.c b/dp/wifi3.0/dp_tx.c index 80dfd56682..15518b6c91 100644 --- a/dp/wifi3.0/dp_tx.c +++ b/dp/wifi3.0/dp_tx.c @@ -2407,7 +2407,8 @@ dp_get_completion_indication_for_stack(struct dp_soc *soc, struct dp_pdev *pdev, struct dp_peer *peer, struct hal_tx_completion_status *ts, - qdf_nbuf_t netbuf) + qdf_nbuf_t netbuf, + uint64_t time_latency) { struct tx_capture_hdr *ppdu_hdr; uint16_t peer_id = ts->peer_id; @@ -2415,7 +2416,8 @@ dp_get_completion_indication_for_stack(struct dp_soc *soc, uint8_t first_msdu = ts->first_msdu; uint8_t last_msdu = ts->last_msdu; - if (qdf_unlikely(!pdev->tx_sniffer_enable && !pdev->mcopy_mode)) + if (qdf_unlikely(!pdev->tx_sniffer_enable && !pdev->mcopy_mode && + !pdev->latency_capture_enable)) return QDF_STATUS_E_NOSUPPORT; if (!peer) { @@ -2449,6 +2451,10 @@ dp_get_completion_indication_for_stack(struct dp_soc *soc, ppdu_hdr->peer_id = peer_id; ppdu_hdr->first_msdu = first_msdu; ppdu_hdr->last_msdu = last_msdu; + if (qdf_unlikely(pdev->latency_capture_enable)) { + ppdu_hdr->tsf = ts->tsf; + ppdu_hdr->time_latency = time_latency; + } return QDF_STATUS_SUCCESS; } @@ -2479,7 +2485,8 @@ dp_get_completion_indication_for_stack(struct dp_soc *soc, struct dp_pdev *pdev, struct dp_peer *peer, struct hal_tx_completion_status *ts, - qdf_nbuf_t netbuf) + qdf_nbuf_t netbuf, + uint64_t time_latency) { return QDF_STATUS_E_NOSUPPORT; } @@ -2893,13 +2900,19 @@ dp_tx_comp_process_desc(struct dp_soc *soc, struct hal_tx_completion_status *ts, struct dp_peer *peer) { + uint64_t time_latency = 0; /* * m_copy/tx_capture modes are not supported for * scatter gather packets */ + if (qdf_unlikely(!!desc->pdev->latency_capture_enable)) { + time_latency = (qdf_ktime_to_ms(qdf_ktime_get()) - + desc->timestamp); + } if (!(desc->msdu_ext_desc) && (dp_get_completion_indication_for_stack(soc, desc->pdev, - peer, ts, desc->nbuf) + peer, ts, desc->nbuf, + time_latency) == QDF_STATUS_SUCCESS)) { qdf_nbuf_unmap(soc->osdev, desc->nbuf, QDF_DMA_TO_DEVICE); diff --git a/dp/wifi3.0/dp_tx.h b/dp/wifi3.0/dp_tx.h index d2b163475d..b1050defbd 100644 --- a/dp/wifi3.0/dp_tx.h +++ b/dp/wifi3.0/dp_tx.h @@ -206,7 +206,8 @@ dp_get_completion_indication_for_stack(struct dp_soc *soc, struct dp_pdev *pdev, struct dp_peer *peer, struct hal_tx_completion_status *ts, - qdf_nbuf_t netbuf); + qdf_nbuf_t netbuf, + uint64_t time_latency); void dp_send_completion_to_stack(struct dp_soc *soc, struct dp_pdev *pdev, uint16_t peer_id, uint32_t ppdu_id, diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index 62bd781607..521c529cee 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -1327,6 +1327,10 @@ struct dp_pdev { /* mirror copy mode */ bool mcopy_mode; bool bpr_enable; + + /* enable time latency check for tx completion */ + bool latency_capture_enable; + struct { uint16_t tx_ppdu_id; uint16_t tx_peer_id;