Răsfoiți Sursa

qcacmn: Add Support for msdu retry stats

Requirement to provide various msdu retry stats to host:-
1. successfully transmitted msdus
2. Retried msdus
3. msdus retried for more than once
4. failed msdus

Change-Id: I4cd7dfceae16b4223df605fa174299858a8651c8
Uraj Sasan 6 ani în urmă
părinte
comite
ff4f2d20fb

+ 7 - 0
dp/inc/cdp_txrx_stats_struct.h

@@ -226,6 +226,9 @@ struct cdp_pkt_type {
  * @is_tx_badcipher: tx failed 'cuz key type
  * @ampdu_cnt: completion of aggregation
  * @non_ampdu_cnt: tx completion not aggregated
+ * @failed_retry_count: packets failed due to retry above 802.11 retry limit
+ * @retry_count: packets successfully send after one or more retry
+ * @multiple_retry_count: packets successfully sent after more than one retry
  */
 struct cdp_tx_stats {
 	struct cdp_pkt_info comp_pkt;
@@ -299,6 +302,9 @@ struct cdp_tx_stats {
 	/*add for peer and upadted from ppdu*/
 	uint32_t ampdu_cnt;
 	uint32_t non_ampdu_cnt;
+	uint32_t failed_retry_count;
+	uint32_t retry_count;
+	uint32_t multiple_retry_count;
 };
 
 /* struct cdp_rx_stats - rx Level Stats
@@ -1507,6 +1513,7 @@ enum _ol_ath_param_t {
 	OL_ATH_PARAM_VIDEO_STATS_FC = 394,
 	OL_ATH_PARAM_VIDEO_DELAY_STATS_FC = 395,
 #endif
+	OL_ATH_PARAM_ENABLE_PEER_RETRY_STATS = 396,
 };
 
 /* Enumeration of PDEV Configuration parameter */

+ 12 - 0
wmi/inc/wmi_unified_api.h

@@ -1201,6 +1201,18 @@ QDF_STATUS wmi_extract_bcn_stats(void *wmi_hdl, void *evt_buf,
 QDF_STATUS wmi_extract_vdev_nac_rssi_stats(void *wmi_hdl, void *evt_buf,
 		struct wmi_host_vdev_nac_rssi_event *vdev_nac_rssi_stats);
 
+/**
+ * wmi_extract_peer_retry_stats() - extract peer retry stats from event
+ * @wmi_handle: wmi handle
+ * @evt_buf: pointer to event buffer
+ * @index: Index into peer retry stats
+ * @peer_retry_stats: Pointer to hold  peer retry stats
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_peer_retry_stats(void *wmi_hdl, void *evt_buf,
+	uint32_t index, struct wmi_host_peer_retry_stats *peer_retry_stats);
+
 QDF_STATUS wmi_unified_send_power_dbg_cmd(void *wmi_hdl,
 				struct wmi_power_dbg_params *param);
 

+ 21 - 0
wmi/inc/wmi_unified_param.h

@@ -959,6 +959,7 @@ typedef enum {
 	WMI_HOST_REQUEST_NAC_RSSI =  0x200,
 	WMI_HOST_REQUEST_BCN_STAT =  0x800,
 	WMI_HOST_REQUEST_BCN_STAT_RESET =  0x1000,
+	WMI_HOST_REQUEST_PEER_RETRY_STAT = 0x2000,
 } wmi_host_stats_id;
 
 typedef struct {
@@ -4464,6 +4465,25 @@ struct wmi_host_vdev_nac_rssi_event {
 	uint32_t rssi_seq_num;
 };
 
+/**
+ * structure wmi_host_peer_retry_stats - peer retry stats
+ * @peer_macaddr: peer macaddr
+ * @retry_counter_wraparnd_ind: wraparound counter indication
+ * @msdu_success: successfully transmitted msdus
+ * @msdu_retried: Retried msdus
+ * @msdu_mul_retried: msdus retried for more than once
+ * @msdu_failed: msdus failed
+ * @reserved: for furure extensions
+ */
+struct wmi_host_peer_retry_stats {
+	wmi_host_mac_addr peer_macaddr;
+	uint32_t retry_counter_wraparnd_ind;
+	uint32_t msdus_success;
+	uint32_t msdus_retried;
+	uint32_t msdus_mul_retried;
+	uint32_t msdus_failed;
+	uint32_t reserved[4];
+};
 
 /**
  * struct wmi_host_per_chain_rssi_stats - VDEV nac rssi stats
@@ -4888,6 +4908,7 @@ typedef enum {
 	wmi_pdev_param_esp_airtime_fraction,
 	wmi_pdev_param_esp_ppdu_duration,
 	wmi_pdev_param_use_nol,
+	wmi_pdev_param_enable_peer_retry_stats,
 	wmi_pdev_param_max,
 } wmi_conv_pdev_params_id;
 

+ 4 - 0
wmi/inc/wmi_unified_priv.h

@@ -1503,6 +1503,10 @@ QDF_STATUS (*extract_bcnflt_stats)(wmi_unified_t wmi_handle, void *evt_buf,
 QDF_STATUS (*extract_peer_extd_stats)(wmi_unified_t wmi_handle, void *evt_buf,
 		 uint32_t index, wmi_host_peer_extd_stats *peer_extd_stats);
 
+QDF_STATUS (*extract_peer_retry_stats)(wmi_unified_t wmi_handle, void *evt_buf,
+	    uint32_t index,
+	    struct wmi_host_peer_retry_stats *peer_retry_stats);
+
 QDF_STATUS (*extract_chan_stats)(wmi_unified_t wmi_handle, void *evt_buf,
 			 uint32_t index, wmi_host_chan_stats *chan_stats);
 

+ 12 - 0
wmi/src/wmi_unified_api.c

@@ -3598,6 +3598,18 @@ QDF_STATUS wmi_extract_peer_extd_stats(void *wmi_hdl, void *evt_buf,
 	return QDF_STATUS_E_FAILURE;
 }
 
+QDF_STATUS wmi_extract_peer_retry_stats(void *wmi_hdl, void *evt_buf,
+	uint32_t index, struct wmi_host_peer_retry_stats *peer_retry_stats)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
+
+	if (wmi_handle->ops->extract_peer_retry_stats)
+		return wmi_handle->ops->extract_peer_retry_stats(wmi_handle,
+			evt_buf, index, peer_retry_stats);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
 /**
  * wmi_extract_rtt_error_report_ev() - extract rtt error report from event
  * @wmi_handle: wmi handle

+ 77 - 30
wmi/src/wmi_unified_non_tlv.c

@@ -1533,6 +1533,8 @@ static uint32_t get_stats_id_non_tlv(wmi_host_stats_id host_stats_id)
 		stats_id |= WMI_REQUEST_PEER_EXTD_STAT;
 	if (host_stats_id & WMI_HOST_REQUEST_NAC_RSSI)
 		stats_id |= WMI_REQUEST_NAC_RSSI_STAT;
+	if (host_stats_id & WMI_HOST_REQUEST_PEER_RETRY_STAT)
+		stats_id |= WMI_REQUEST_PEER_RETRY_STAT;
 
 	return stats_id;
 }
@@ -7933,42 +7935,21 @@ static QDF_STATUS extract_all_stats_counts_non_tlv(wmi_unified_t wmi_handle,
 {
 	wmi_stats_event *ev = (wmi_stats_event *) evt_buf;
 	wmi_stats_id stats_id = ev->stats_id;
-	wmi_host_stats_id nac_rssi_ev = 0;
 
-	if (stats_id & WMI_REQUEST_NAC_RSSI_STAT) {
-		nac_rssi_ev = WMI_HOST_REQUEST_NAC_RSSI;
-		stats_id &= ~WMI_REQUEST_NAC_RSSI_STAT;
-	}
-
-	switch (stats_id) {
-	case WMI_REQUEST_PEER_STAT:
+	if (stats_id & WMI_REQUEST_PEER_STAT)
 		stats_param->stats_id |= WMI_HOST_REQUEST_PEER_STAT;
-		break;
-
-	case WMI_REQUEST_AP_STAT:
+	if (stats_id & WMI_REQUEST_AP_STAT)
 		stats_param->stats_id |= WMI_HOST_REQUEST_AP_STAT;
-		break;
-
-	case WMI_REQUEST_INST_STAT:
+	if (stats_id & WMI_REQUEST_INST_STAT)
 		stats_param->stats_id |= WMI_HOST_REQUEST_INST_STAT;
-		break;
-
-	case WMI_REQUEST_PEER_EXTD_STAT:
+	if (stats_id & WMI_REQUEST_PEER_EXTD_STAT)
 		stats_param->stats_id |= WMI_HOST_REQUEST_PEER_EXTD_STAT;
-		break;
-
-	case WMI_REQUEST_VDEV_EXTD_STAT:
+	if (stats_id & WMI_REQUEST_VDEV_EXTD_STAT)
 		stats_param->stats_id |= WMI_HOST_REQUEST_VDEV_EXTD_STAT;
-		break;
-
-	case WMI_REQUEST_PDEV_EXT2_STAT:
-		stats_param->stats_id |= nac_rssi_ev;
-		break;
-	default:
-		stats_param->stats_id = 0;
-		break;
-
-	}
+	if (stats_id & (WMI_REQUEST_PDEV_EXT2_STAT | WMI_REQUEST_NAC_RSSI_STAT))
+		stats_param->stats_id |= WMI_HOST_REQUEST_NAC_RSSI;
+	if (stats_id & WMI_REQUEST_PEER_RETRY_STAT)
+		stats_param->stats_id |= WMI_HOST_REQUEST_PEER_RETRY_STAT;
 
 	stats_param->num_pdev_stats = ev->num_pdev_stats;
 	stats_param->num_pdev_ext_stats = ev->num_pdev_ext_stats;
@@ -8256,6 +8237,69 @@ static QDF_STATUS extract_peer_extd_stats_non_tlv(wmi_unified_t wmi_handle,
 	return QDF_STATUS_SUCCESS;
 }
 
+/**
+ * extract_peer_retry_stats_non_tlv() - extract peer retry stats from event
+ * @wmi_handle: wmi handle
+ * @evt_buf: pointer to event buffer
+ * @index: Index into extended peer stats
+ * @peer_retry_stats: Pointer to hold  peer retry stats
+ *
+ * Return: 0 for success or error code
+ */
+#define OFFSET 65535
+static QDF_STATUS extract_peer_retry_stats_non_tlv(wmi_unified_t wmi_handle,
+	void *evt_buf, uint32_t index,
+	struct wmi_host_peer_retry_stats *peer_retry_stats)
+{
+	uint32_t wrap;
+	uint8_t *pdata = ((wmi_stats_event *)evt_buf)->data;
+
+	if (WMI_REQUEST_PEER_RETRY_STAT &
+		((wmi_stats_event *)evt_buf)->stats_id) {
+		if (index < ((wmi_stats_event *)evt_buf)->num_peer_stats) {
+			wmi_peer_retry_stats *ev = (wmi_peer_retry_stats *)
+			((pdata) +
+			((((wmi_stats_event *)evt_buf)->num_pdev_stats) *
+				sizeof(wmi_pdev_stats)) +
+			((((wmi_stats_event *)evt_buf)->num_pdev_ext_stats) *
+				sizeof(wmi_pdev_ext_stats)) +
+			((((wmi_stats_event *)evt_buf)->num_vdev_stats) *
+				sizeof(wmi_vdev_stats)) +
+			((((wmi_stats_event *)evt_buf)->num_peer_stats) *
+				sizeof(wmi_peer_stats)) +
+			((WMI_REQUEST_PEER_EXTD_STAT &
+			((wmi_stats_event *)evt_buf)->stats_id) ?
+			((((wmi_stats_event *)evt_buf)->num_peer_stats) *
+				sizeof(wmi_peer_extd_stats)) : 0) +
+			((WMI_REQUEST_VDEV_EXTD_STAT &
+			((wmi_stats_event *)evt_buf)->stats_id) ?
+			((((wmi_stats_event *)evt_buf)->num_vdev_stats) *
+				sizeof(wmi_vdev_extd_stats)) : 0) +
+			((((wmi_stats_event *)evt_buf)->num_pdev_stats) *
+				(sizeof(wmi_pdev_ext2_stats))) +
+			((WMI_REQUEST_NAC_RSSI_STAT &
+			((wmi_stats_event *)evt_buf)->stats_id) ?
+			((((wmi_stats_event *)evt_buf)->num_pdev_stats) *
+				sizeof(wmi_vdev_nac_rssi_event)) : 0) +
+			(index * sizeof(wmi_peer_retry_stats)));
+
+			OS_MEMCPY(peer_retry_stats, ev,
+				  sizeof(wmi_peer_retry_stats));
+			/*Add offset if wraparound of counter has occurred */
+			wrap = peer_retry_stats->retry_counter_wraparnd_ind;
+			if (IS_MSDU_RETRY_WRAPAROUND(wrap))
+				peer_retry_stats->msdus_retried += OFFSET;
+			if (IS_MSDU_SUCCESS_WRAPAROUND(wrap))
+				peer_retry_stats->msdus_success += OFFSET;
+			if (IS_MSDU_MUL_RETRY_WRAPAROUND(wrap))
+				peer_retry_stats->msdus_mul_retried += OFFSET;
+			if (IS_MSDU_FAIL_WRAPAROUND(wrap))
+				peer_retry_stats->msdus_failed += OFFSET;
+		}
+	}
+	return QDF_STATUS_SUCCESS;
+}
+
 /**
  * extract_vdev_extd_stats_non_tlv() - extract extended vdev stats from event
  * @wmi_handle: wmi handle
@@ -9034,6 +9078,7 @@ struct wmi_ops non_tlv_ops =  {
 	.extract_peer_stats = extract_peer_stats_non_tlv,
 	.extract_bcnflt_stats = extract_bcnflt_stats_non_tlv,
 	.extract_peer_extd_stats = extract_peer_extd_stats_non_tlv,
+	.extract_peer_retry_stats = extract_peer_retry_stats_non_tlv,
 	.extract_chan_stats = extract_chan_stats_non_tlv,
 	.extract_thermal_stats = extract_thermal_stats_non_tlv,
 	.extract_thermal_level_stats = extract_thermal_level_stats_non_tlv,
@@ -9632,6 +9677,8 @@ static void populate_pdev_param_non_tlv(uint32_t *pdev_param)
 	pdev_param[wmi_pdev_param_tx_chain_mask_1ss] = WMI_UNAVAILABLE_PARAM;
 	pdev_param[wmi_pdev_param_antenna_gain_half_db] =
 		WMI_PDEV_PARAM_ANTENNA_GAIN_HALF_DB;
+	pdev_param[wmi_pdev_param_enable_peer_retry_stats] =
+		WMI_PDEV_PARAM_ENABLE_PEER_RETRY_STATS;
 }
 
 /**