From 182938a5b063364ee9717e59e46786872d375c38 Mon Sep 17 00:00:00 2001 From: nobelj Date: Mon, 25 Nov 2019 14:09:08 -0800 Subject: [PATCH] qcacmn: Modify timestamp to support 64 bits modify Tx timestamp to support 64 bits value Change-Id: I1c032b2e07a5bae94ec3a58d33dd9340f95a622e --- dp/inc/cdp_txrx_cmn_struct.h | 10 ++++---- dp/wifi3.0/dp_htt.c | 50 ++++++++++++++++++++++++------------ dp/wifi3.0/dp_htt.h | 24 +++++++++++++++++ 3 files changed, 63 insertions(+), 21 deletions(-) diff --git a/dp/inc/cdp_txrx_cmn_struct.h b/dp/inc/cdp_txrx_cmn_struct.h index 198bea1ab7..8e34e45502 100644 --- a/dp/inc/cdp_txrx_cmn_struct.h +++ b/dp/inc/cdp_txrx_cmn_struct.h @@ -1477,8 +1477,8 @@ struct cdp_tx_indication_mpdu_info { uint32_t tx_rate; uint8_t mac_address[QDF_MAC_ADDR_SIZE]; uint8_t bss_mac_address[QDF_MAC_ADDR_SIZE]; - uint32_t ppdu_start_timestamp; - uint32_t ppdu_end_timestamp; + uint64_t ppdu_start_timestamp; + uint64_t ppdu_end_timestamp; uint32_t ba_start_seq; uint32_t ba_bitmap[CDP_BA_256_BIT_MAP_SIZE_DWORDS]; uint16_t ppdu_cookie; @@ -1570,9 +1570,9 @@ struct cdp_tx_completion_ppdu { uint16_t phy_mode; uint32_t ack_rssi; uint32_t tx_duration; - uint32_t ppdu_start_timestamp; - uint32_t ppdu_end_timestamp; - uint32_t ack_timestamp; + uint64_t ppdu_start_timestamp; + uint64_t ppdu_end_timestamp; + uint64_t ack_timestamp; bool delayed_ba; struct cdp_tx_completion_ppdu_user user[CDP_MU_MAX_USERS]; qdf_nbuf_queue_t mpdu_q; diff --git a/dp/wifi3.0/dp_htt.c b/dp/wifi3.0/dp_htt.c index 318f243760..ea34bc9ecc 100644 --- a/dp/wifi3.0/dp_htt.c +++ b/dp/wifi3.0/dp_htt.c @@ -47,6 +47,9 @@ #define HTT_MGMT_CTRL_TLV_HDR_RESERVERD_LEN 16 +#define HTT_SHIFT_UPPER_TIMESTAMP 32 +#define HTT_MASK_UPPER_TIMESTAMP 0xFFFFFFFF00000000 + /* * dp_htt_get_ppdu_sniffer_ampdu_tlv_bitmap() - Get ppdu stats tlv * bitmap for sniffer mode @@ -2044,15 +2047,19 @@ static void dp_process_ppdu_stats_common_tlv(struct dp_pdev *pdev, uint16_t freq; struct dp_soc *soc = NULL; struct cdp_tx_completion_ppdu *ppdu_desc = NULL; + uint64_t ppdu_start_timestamp; + uint32_t *start_tag_buf; + start_tag_buf = tag_buf; ppdu_desc = (struct cdp_tx_completion_ppdu *)qdf_nbuf_data(ppdu_info->nbuf); - tag_buf += 2; + tag_buf = start_tag_buf + HTT_GET_STATS_CMN_INDEX(RING_ID_SCH_CMD_ID); ppdu_info->sched_cmdid = HTT_PPDU_STATS_COMMON_TLV_SCH_CMDID_GET(*tag_buf); ppdu_desc->num_users = HTT_PPDU_STATS_COMMON_TLV_NUM_USERS_GET(*tag_buf); - tag_buf++; + + tag_buf = start_tag_buf + HTT_GET_STATS_CMN_INDEX(QTYPE_FRM_TYPE); frame_type = HTT_PPDU_STATS_COMMON_TLV_FRM_TYPE_GET(*tag_buf); ppdu_desc->htt_frame_type = frame_type; @@ -2081,23 +2088,13 @@ static void dp_process_ppdu_stats_common_tlv(struct dp_pdev *pdev, break; } - tag_buf += 2; + tag_buf = start_tag_buf + HTT_GET_STATS_CMN_INDEX(FES_DUR_US); ppdu_desc->tx_duration = *tag_buf; - tag_buf += 3; + + tag_buf = start_tag_buf + HTT_GET_STATS_CMN_INDEX(START_TSTMP_L32_US); ppdu_desc->ppdu_start_timestamp = *tag_buf; - ppdu_desc->ppdu_end_timestamp = ppdu_desc->ppdu_start_timestamp + - ppdu_desc->tx_duration; - - ppdu_desc->bar_ppdu_start_timestamp = ppdu_desc->ppdu_start_timestamp; - ppdu_desc->bar_ppdu_end_timestamp = ppdu_desc->ppdu_end_timestamp; - ppdu_desc->bar_tx_duration = ppdu_desc->tx_duration; - - /* Ack time stamp is same as end time stamp*/ - ppdu_desc->ack_timestamp = ppdu_desc->ppdu_end_timestamp; - - tag_buf++; - + tag_buf = start_tag_buf + HTT_GET_STATS_CMN_INDEX(CHAN_MHZ_PHY_MODE); freq = HTT_PPDU_STATS_COMMON_TLV_CHAN_MHZ_GET(*tag_buf); if (freq != ppdu_desc->channel) { soc = pdev->soc; @@ -2111,6 +2108,27 @@ static void dp_process_ppdu_stats_common_tlv(struct dp_pdev *pdev, ppdu_desc->phy_mode = HTT_PPDU_STATS_COMMON_TLV_PHY_MODE_GET(*tag_buf); dp_tx_capture_htt_frame_counter(pdev, frame_type); + + tag_buf = start_tag_buf + HTT_GET_STATS_CMN_INDEX(START_TSTMP_U32_US); + ppdu_start_timestamp = *tag_buf; + ppdu_desc->ppdu_start_timestamp |= ((ppdu_start_timestamp << + HTT_SHIFT_UPPER_TIMESTAMP) & + HTT_MASK_UPPER_TIMESTAMP); + + ppdu_desc->ppdu_end_timestamp = ppdu_desc->ppdu_start_timestamp + + ppdu_desc->tx_duration; + /* Ack time stamp is same as end time stamp*/ + ppdu_desc->ack_timestamp = ppdu_desc->ppdu_end_timestamp; + + ppdu_desc->ppdu_end_timestamp = ppdu_desc->ppdu_start_timestamp + + ppdu_desc->tx_duration; + + ppdu_desc->bar_ppdu_start_timestamp = ppdu_desc->ppdu_start_timestamp; + ppdu_desc->bar_ppdu_end_timestamp = ppdu_desc->ppdu_end_timestamp; + ppdu_desc->bar_tx_duration = ppdu_desc->tx_duration; + + /* Ack time stamp is same as end time stamp*/ + ppdu_desc->ack_timestamp = ppdu_desc->ppdu_end_timestamp; } /* diff --git a/dp/wifi3.0/dp_htt.h b/dp/wifi3.0/dp_htt.h index c950df0cd2..5f7001f106 100644 --- a/dp/wifi3.0/dp_htt.h +++ b/dp/wifi3.0/dp_htt.h @@ -100,6 +100,30 @@ int htt_wbm_event_record(struct htt_logger *h, uint8_t tx_status, #define HTT_T2H_EXT_STATS_TLV_START_OFFSET 3 +/* + * Below offset are based on htt_ppdu_stats_common_tlv + * defined in htt_ppdu_stats.h + */ +#define HTT_PPDU_STATS_COMMON_TLV_TLV_HDR_OFFSET 0 +#define HTT_PPDU_STATS_COMMON_TLV_PPDU_ID_OFFSET 1 +#define HTT_PPDU_STATS_COMMON_TLV_RING_ID_SCH_CMD_ID_OFFSET 2 +#define HTT_PPDU_STATS_COMMON_TLV_QTYPE_FRM_TYPE_OFFSET 3 +#define HTT_PPDU_STATS_COMMON_TLV_CHAIN_MASK_OFFSET 4 +#define HTT_PPDU_STATS_COMMON_TLV_FES_DUR_US_OFFSET 5 +#define HTT_PPDU_STATS_COMMON_TLV_SCH_EVAL_START_TSTMP_L32_US_OFFSET 6 +#define HTT_PPDU_STATS_COMMON_TLV_SCH_END_TSTMP_US_OFFSET 7 +#define HTT_PPDU_STATS_COMMON_TLV_START_TSTMP_L32_US_OFFSET 8 +#define HTT_PPDU_STATS_COMMON_TLV_CHAN_MHZ_PHY_MODE_OFFSET 9 +#define HTT_PPDU_STATS_COMMON_TLV_CCA_DELTA_TIME_US_OFFSET 10 +#define HTT_PPDU_STATS_COMMON_TLV_RXFRM_DELTA_TIME_US_OFFSET 11 +#define HTT_PPDU_STATS_COMMON_TLV_TXFRM_DELTA_TIME_US_OFFSET 12 +#define HTT_PPDU_STATS_COMMON_TLV_RESV_NUM_UL_BEAM_OFFSET 13 +#define HTT_PPDU_STATS_COMMON_TLV_START_TSTMP_U32_US_OFFSET 14 + +/* get index for field in htt_ppdu_stats_common_tlv */ +#define HTT_GET_STATS_CMN_INDEX(index) \ + HTT_PPDU_STATS_COMMON_TLV_##index##_OFFSET + struct dp_htt_htc_pkt { void *soc_ctxt; qdf_dma_addr_t nbuf_paddr;