Kaynağa Gözat

qcacmn: Add time_latency check for tx_completion

This patch adds support to measure latency  for tx completions

Change-Id: Ifda1c2f7ffaf8276f012e7a458f6f167ad931356
Ankit Kumar 6 yıl önce
ebeveyn
işleme
8dc0e2a679

+ 2 - 0
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,
 };
 
 /*

+ 6 - 0
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;
 	}

+ 17 - 4
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);

+ 2 - 1
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,

+ 4 - 0
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;