Parcourir la source

qcacmn: Calculate total PER value

Write a datapath function to compute total PER value and corresponding CDP
interface to get the calculated value.

Change-Id: I1c7feaf48c55689817b83185a4e6d4b8622e51c0
CRs-Fixed: 2308044
Pranita Solanke il y a 6 ans
Parent
commit
92096e4912
3 fichiers modifiés avec 44 ajouts et 0 suppressions
  1. 25 0
      dp/inc/cdp_txrx_cmn.h
  2. 1 0
      dp/inc/cdp_txrx_ops.h
  3. 18 0
      dp/wifi3.0/dp_main.c

+ 25 - 0
dp/inc/cdp_txrx_cmn.h

@@ -1328,6 +1328,31 @@ static inline void cdp_set_vdev_dscp_tid_map(ol_txrx_soc_handle soc,
 				map_id);
 }
 
+/**
+ * cdp_ath_get_total_per(): function to get hw retries
+ * @soc : soc handle
+ * @pdev: pdev handle
+ *
+ * Return: get hw retries
+ */
+static inline
+int cdp_ath_get_total_per(ol_txrx_soc_handle soc,
+			  struct cdp_pdev *pdev)
+{
+	if (!soc || !soc->ops) {
+		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
+			  "%s: Invalid Instance:", __func__);
+		QDF_BUG(0);
+		return 0;
+	}
+
+	if (!soc->ops->cmn_drv_ops ||
+	    !soc->ops->cmn_drv_ops->txrx_get_total_per)
+		return 0;
+
+	return soc->ops->cmn_drv_ops->txrx_get_total_per(pdev);
+}
+
 /**
  * cdp_set_pdev_dscp_tid_map(): function to change tid values in DSCP-tid map
  * @pdev: pdev handle

+ 1 - 0
dp/inc/cdp_txrx_ops.h

@@ -312,6 +312,7 @@ struct cdp_cmn_ops {
 
 	void (*set_vdev_dscp_tid_map)(struct cdp_vdev *vdev_handle,
 			uint8_t map_id);
+	int (*txrx_get_total_per)(struct cdp_pdev *pdev_handle);
 
 	void (*flush_cache_rx_queue)(void);
 	void (*set_pdev_dscp_tid_map)(struct cdp_pdev *pdev, uint8_t map_id,

+ 18 - 0
dp/wifi3.0/dp_main.c

@@ -7069,6 +7069,23 @@ static int  dp_txrx_get_vdev_stats(struct cdp_vdev *vdev_handle, void *buf,
 	return 0;
 }
 
+/*
+ * dp_get_total_per(): get total per
+ * @pdev_handle: DP_PDEV handle
+ *
+ * Return: % error rate using retries per packet and success packets
+ */
+static int dp_get_total_per(struct cdp_pdev *pdev_handle)
+{
+	struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
+
+	dp_aggregate_pdev_stats(pdev);
+	if ((pdev->stats.tx.tx_success.num + pdev->stats.tx.retries) == 0)
+		return 0;
+	return ((pdev->stats.tx.retries * 100) /
+		((pdev->stats.tx.tx_success.num) + (pdev->stats.tx.retries)));
+}
+
 /*
  * dp_txrx_stats_publish(): publish pdev stats into a buffer
  * @pdev_handle: DP_PDEV handle
@@ -7897,6 +7914,7 @@ static struct cdp_cmn_ops dp_ops_cmn = {
 	/* TODO: get API's for dscp-tid need to be added*/
 	.set_vdev_dscp_tid_map = dp_set_vdev_dscp_tid_map_wifi3,
 	.set_pdev_dscp_tid_map = dp_set_pdev_dscp_tid_map_wifi3,
+	.txrx_get_total_per = dp_get_total_per,
 	.txrx_stats_request = dp_txrx_stats_request,
 	.txrx_set_monitor_mode = dp_vdev_set_monitor_mode,
 	.txrx_get_pdev_id_frm_pdev = dp_get_pdev_id_frm_pdev,