qcacmn: dp: Add support to update tsf timestamp in data packet

Add support to update tsf timestamp on driver entry and
exit in data packet. This helps debug latency issue in
XR usecases

Change-Id: I9c966c1b8cb09dc5eab6104fdad36c19a1d68045
CRs-Fixed: 3090108
This commit is contained in:
Nirav Shah
2022-01-24 18:38:30 +05:30
committed by Madan Koyyalamudi
parent 3e4c2182ff
commit 33528eaa41
7 changed files with 79 additions and 0 deletions

View File

@@ -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;
};
/**

View File

@@ -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);

View File

@@ -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 */

View File

@@ -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

View File

@@ -23,6 +23,7 @@
#include <dp_mon.h>
#include <hal_li_tx.h>
#include <hal_li_rx.h>
#include <qdf_pkt_add_timestamp.h>
/* 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

View File

@@ -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(&current_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);

View File

@@ -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;
}