diff --git a/dp/inc/cdp_txrx_cmn_struct.h b/dp/inc/cdp_txrx_cmn_struct.h index b9e3e84d51..6e4646206a 100644 --- a/dp/inc/cdp_txrx_cmn_struct.h +++ b/dp/inc/cdp_txrx_cmn_struct.h @@ -996,6 +996,12 @@ typedef void (*ol_txrx_pktdump_cb)(ol_txrx_soc_handle soc, uint8_t status, uint8_t type); +/** + * ol_txrx_get_tsf_time - callback to get tsf time + */ +typedef QDF_STATUS(*ol_txrx_get_tsf_time)(void *osif_dev, uint64_t input_time, + uint64_t *tsf_time); + /** * ol_txrx_ops - (pointers to) the functions used for tx and rx * data xfer @@ -1083,6 +1089,7 @@ struct ol_txrx_ops { ol_txrx_mcast_me_fp me_convert; ol_txrx_get_key_fp get_key; + ol_txrx_get_tsf_time get_tsf_time; }; /** diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 3b4c88fd9b..0ecdb46e6f 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -6484,6 +6484,7 @@ static QDF_STATUS dp_vdev_register_wifi3(struct cdp_soc_t *soc_hdl, vdev->osif_proxy_arp = txrx_ops->proxy_arp; #endif vdev->me_convert = txrx_ops->me_convert; + vdev->get_tsf_time = txrx_ops->get_tsf_time; dp_vdev_register_rx_eapol(vdev, txrx_ops); diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index 05e04051e6..cd1fdf9534 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -2990,6 +2990,8 @@ struct dp_vdev { /* completion function used by this vdev*/ ol_txrx_completion_fp tx_comp; + ol_txrx_get_tsf_time get_tsf_time; + /* deferred vdev deletion state */ struct { /* VDEV delete pending */ diff --git a/dp/wifi3.0/li/dp_li.c b/dp/wifi3.0/li/dp_li.c index b10e0c015c..c4db7e60fd 100644 --- a/dp/wifi3.0/li/dp_li.c +++ b/dp/wifi3.0/li/dp_li.c @@ -574,3 +574,25 @@ void dp_tx_comp_get_prefetched_params_from_hal_desc( qdf_prefetch((uint8_t *)*r_tx_desc); } #endif + +#ifdef CONFIG_DP_PKT_ADD_TIMESTAMP +void dp_pkt_add_timestamp(struct dp_vdev *vdev, + enum qdf_pkt_timestamp_index index, uint64_t time, + qdf_nbuf_t nbuf) +{ + if (qdf_unlikely(qdf_is_dp_pkt_timestamp_enabled())) { + uint64_t tsf_time; + + if (vdev->get_tsf_time) { + vdev->get_tsf_time(vdev->osif_vdev, time, &tsf_time); + qdf_add_dp_pkt_timestamp(nbuf, index, tsf_time); + } + } +} + +void dp_pkt_get_timestamp(uint64_t *time) +{ + if (qdf_unlikely(qdf_is_dp_pkt_timestamp_enabled())) + *time = qdf_get_log_timestamp(); +} +#endif diff --git a/dp/wifi3.0/li/dp_li.h b/dp/wifi3.0/li/dp_li.h index 2893c72631..3c336e6d8f 100644 --- a/dp/wifi3.0/li/dp_li.h +++ b/dp/wifi3.0/li/dp_li.h @@ -23,6 +23,7 @@ #include #include #include +#include /* WBM2SW ring id for rx release */ #define WBM2SW_REL_ERR_RING_NUM 3 @@ -108,4 +109,39 @@ qdf_size_t dp_get_context_size_li(enum dp_context_type context_type); qdf_size_t dp_mon_get_context_size_li(enum dp_context_type context_type); +#ifdef CONFIG_DP_PKT_ADD_TIMESTAMP +/** + * dp_pkt_add_timestamp() - add timestamp in data payload + * + * @vdev: dp vdev + * @index: index to decide offset in payload + * @time: timestamp to add in data payload + * @nbuf: network buffer + * + * Return: none + */ +void dp_pkt_add_timestamp(struct dp_vdev *vdev, + enum qdf_pkt_timestamp_index index, uint64_t time, + qdf_nbuf_t nbuf); +/** + * dp_pkt_get_timestamp() - get current system time + * + * @time: return current system time + * + * Return: none + */ +void dp_pkt_get_timestamp(uint64_t *time); +#else +static inline +void dp_pkt_add_timestamp(struct dp_vdev *vdev, + enum qdf_pkt_timestamp_index index, uint64_t time, + qdf_nbuf_t nbuf) +{ +} + +static inline +void dp_pkt_get_timestamp(uint64_t *time) +{ +} +#endif #endif diff --git a/dp/wifi3.0/li/dp_li_rx.c b/dp/wifi3.0/li/dp_li_rx.c index 0d86fefa4d..38a44423d8 100644 --- a/dp/wifi3.0/li/dp_li_rx.c +++ b/dp/wifi3.0/li/dp_li_rx.c @@ -41,6 +41,7 @@ #endif #include "dp_hist.h" #include "dp_rx_buffer_pool.h" +#include "dp_li.h" static inline bool is_sa_da_idx_valid(uint32_t max_ast, @@ -252,6 +253,7 @@ uint32_t dp_rx_process_li(struct dp_intr *int_ctx, uint32_t peer_ext_stats; uint32_t dsf; uint32_t max_ast; + uint64_t current_time = 0; DP_HIST_INIT(); @@ -289,6 +291,8 @@ more_data: rx_pdev = NULL; tid_stats = NULL; + dp_pkt_get_timestamp(¤t_time); + if (qdf_unlikely(dp_rx_srng_access_start(int_ctx, soc, hal_ring_hdl))) { /* * Need API to convert from hal_ring pointer to @@ -882,6 +886,10 @@ done: dp_rx_fill_gro_info(soc, rx_tlv_hdr, nbuf, &rx_ol_pkt_cnt); dp_rx_update_stats(soc, nbuf); + + dp_pkt_add_timestamp(peer->vdev, QDF_PKT_RX_DRIVER_ENTRY, + current_time, nbuf); + DP_RX_LIST_APPEND(deliver_list_head, deliver_list_tail, nbuf); diff --git a/dp/wifi3.0/li/dp_li_tx.c b/dp/wifi3.0/li/dp_li_tx.c index d406292fef..aa4ebd9829 100644 --- a/dp/wifi3.0/li/dp_li_tx.c +++ b/dp/wifi3.0/li/dp_li_tx.c @@ -29,6 +29,7 @@ #ifdef FEATURE_WDS #include "dp_txrx_wds.h" #endif +#include "dp_li.h" extern uint8_t sec_type_map[MAX_CDP_SEC_TYPE]; @@ -452,6 +453,8 @@ dp_tx_hw_enqueue_li(struct dp_soc *soc, struct dp_vdev *vdev, ring_access_fail: dp_tx_ring_access_end_wrapper(soc, hal_ring_hdl, coalesce); + dp_pkt_add_timestamp(vdev, QDF_PKT_TX_DRIVER_EXIT, + qdf_get_log_timestamp(), tx_desc->nbuf); return status; }