Pārlūkot izejas kodu

qcacmn: Update PPDU drop counter

Update PPDU drop counter from monitor ring

CRs-Fixed: 3341905
Change-Id: I63f5b4d6a3e1e0155cf0558bea18704df073e2a9
Amir Patel 2 gadi atpakaļ
vecāks
revīzija
af0472aa08

+ 8 - 0
dp/inc/cdp_txrx_mon_struct.h

@@ -413,6 +413,10 @@ enum cdp_mon_phyrx_abort_reason_code {
  * @total_ppdu_info_drop: Number of PPDUs dropped
  * @total_ppdu_info_alloc: Number of PPDU info allocated
  * @total_ppdu_info_free: Number of PPDU info freed
+ * @ppdu_drop_cnt: Total PPDU drop count
+ * @mpdu_drop_cnt: Total MPDU drop count
+ * @end_of_ppdu_drop_cnt: Total end of ppdu drop count
+ * @tlv_drop_cnt: TLV drop count
  */
 struct cdp_pdev_mon_stats {
 #ifndef REMOVE_MON_DBG_STATS
@@ -468,6 +472,10 @@ struct cdp_pdev_mon_stats {
 	uint32_t total_ppdu_info_drop;
 	uint32_t total_ppdu_info_alloc;
 	uint32_t total_ppdu_info_free;
+	uint32_t ppdu_drop_cnt;
+	uint32_t mpdu_drop_cnt;
+	uint32_t end_of_ppdu_drop_cnt;
+	uint32_t tlv_drop_cnt;
 };
 
 #ifdef QCA_SUPPORT_LITE_MONITOR

+ 44 - 1
dp/wifi3.0/monitor/2.0/dp_rx_mon_2.0.c

@@ -60,6 +60,29 @@ void dp_rx_mon_print_tag_buf(uint8_t *buf, uint16_t room)
 
 #endif
 
+/**
+ * dp_rx_mon_update_drop_cnt() - Update drop statistics
+ *
+ * @mon_pdev: monitor pdev
+ * @hal_mon_rx_desc: HAL monitor desc
+ *
+ * Return: void
+ */
+static inline void
+dp_rx_mon_update_drop_cnt(struct dp_mon_pdev *mon_pdev,
+			  struct hal_mon_desc *hal_mon_rx_desc)
+{
+	mon_pdev->rx_mon_stats.empty_desc_ppdu++;
+	mon_pdev->rx_mon_stats.ppdu_drop_cnt +=
+		hal_mon_rx_desc->ppdu_drop_count;
+	mon_pdev->rx_mon_stats.mpdu_drop_cnt +=
+		hal_mon_rx_desc->mpdu_drop_count;
+	if (hal_mon_rx_desc->end_of_ppdu_dropped)
+		mon_pdev->rx_mon_stats.end_of_ppdu_drop_cnt++;
+	mon_pdev->rx_mon_stats.tlv_drop_cnt +=
+		hal_mon_rx_desc->tlv_drop_count;
+}
+
 static
 void dp_rx_mon_set_zero(qdf_nbuf_t nbuf)
 {
@@ -1356,6 +1379,18 @@ uint8_t dp_rx_mon_process_tlv_status(struct dp_pdev *pdev,
 		ppdu_info->rx_hdr_rcvd[user_id] = false;
 	}
 	break;
+	case HAL_TLV_STATUS_MON_DROP:
+	{
+		mon_pdev->rx_mon_stats.ppdu_drop_cnt +=
+			ppdu_info->drop_cnt.ppdu_drop_cnt;
+		mon_pdev->rx_mon_stats.mpdu_drop_cnt +=
+			ppdu_info->drop_cnt.mpdu_drop_cnt;
+		mon_pdev->rx_mon_stats.end_of_ppdu_drop_cnt +=
+			ppdu_info->drop_cnt.end_of_ppdu_drop_cnt;
+		mon_pdev->rx_mon_stats.tlv_drop_cnt +=
+			ppdu_info->drop_cnt.tlv_drop_cnt;
+	}
+	break;
 	}
 	return num_buf_reaped;
 }
@@ -1704,7 +1739,7 @@ dp_rx_mon_srng_process_2_0(struct dp_soc *soc, struct dp_intr *int_ctx,
 				     mon_pdev);
 			rx_mon_dst_ring_desc =
 				hal_srng_dst_get_next(hal_soc, mon_dst_srng);
-			mon_pdev->rx_mon_stats.empty_desc_ppdu++;
+			dp_rx_mon_update_drop_cnt(mon_pdev, &hal_mon_rx_desc);
 			continue;
 		}
 		mon_desc = (struct dp_mon_desc *)(uintptr_t)(hal_mon_rx_desc.buf_addr);
@@ -2048,5 +2083,13 @@ void dp_mon_rx_print_advanced_stats_2_0(struct dp_soc *soc,
 		       mon_pdev->rx_mon_stats.mpdu_decap_type_invalid);
 	DP_PRINT_STATS("total_free_elem= %d",
 		       mon_pdev_be->total_free_elem);
+	DP_PRINT_STATS("ppdu_drop_cnt= %d",
+		       mon_pdev->rx_mon_stats.ppdu_drop_cnt);
+	DP_PRINT_STATS("mpdu_drop_cnt= %d",
+		       mon_pdev->rx_mon_stats.mpdu_drop_cnt);
+	DP_PRINT_STATS("end_of_ppdu_drop_cnt= %d",
+		       mon_pdev->rx_mon_stats.end_of_ppdu_drop_cnt);
+	DP_PRINT_STATS("tlv_drop_cnt= %d",
+		       mon_pdev->rx_mon_stats.tlv_drop_cnt);
 }
 #endif

+ 22 - 0
hal/wifi3.0/be/hal_be_api_mon.h

@@ -22,6 +22,7 @@
 #ifdef QCA_MONITOR_2_0_SUPPORT
 #include <mon_ingress_ring.h>
 #include <mon_destination_ring.h>
+#include <mon_drop.h>
 #endif
 #include <hal_be_hw_headers.h>
 #include "hal_api_mon.h"
@@ -1876,6 +1877,18 @@ hal_rx_status_get_mon_buf_addr(uint8_t *rx_tlv,
 	ppdu_info->packet_info.truncated = addr->truncated;
 
 }
+
+static inline void
+hal_rx_update_ppdu_drop_cnt(uint8_t *rx_tlv,
+			    struct hal_rx_ppdu_info *ppdu_info)
+{
+	struct mon_drop *drop_cnt = (struct mon_drop *)rx_tlv;
+
+	ppdu_info->drop_cnt.ppdu_drop_cnt = drop_cnt->ppdu_drop_cnt;
+	ppdu_info->drop_cnt.mpdu_drop_cnt = drop_cnt->mpdu_drop_cnt;
+	ppdu_info->drop_cnt.end_of_ppdu_drop_cnt = drop_cnt->end_of_ppdu_seen;
+	ppdu_info->drop_cnt.tlv_drop_cnt = drop_cnt->tlv_drop_cnt;
+}
 #else
 static inline void
 hal_rx_status_get_mpdu_retry_cnt(struct hal_rx_ppdu_info *ppdu_info,
@@ -1888,6 +1901,12 @@ hal_rx_status_get_mon_buf_addr(uint8_t *rx_tlv,
 			       struct hal_rx_ppdu_info *ppdu_info)
 {
 }
+
+static inline void
+hal_rx_update_ppdu_drop_cnt(uint8_t *rx_tlv,
+			    struct hal_rx_ppdu_info *ppdu_info)
+{
+}
 #endif
 
 #ifdef WLAN_SUPPORT_CTRL_FRAME_STATS
@@ -3051,6 +3070,9 @@ hal_rx_status_get_tlv_info_generic_be(void *rx_tlv_hdr, void *ppduinfo,
 		hal_rx_status_get_mon_buf_addr(rx_tlv, ppdu_info);
 
 		return HAL_TLV_STATUS_MON_BUF_ADDR;
+	case WIFIMON_DROP_E:
+		hal_rx_update_ppdu_drop_cnt(rx_tlv, ppdu_info);
+		return HAL_TLV_STATUS_MON_DROP;
 	case 0:
 		return HAL_TLV_STATUS_PPDU_DONE;
 	case WIFIRX_STATUS_BUFFER_DONE_E:

+ 17 - 0
hal/wifi3.0/hal_api_mon.h

@@ -80,6 +80,7 @@
 #define HAL_TLV_STATUS_MSDU_END 8
 #define HAL_TLV_STATUS_MON_BUF_ADDR 9
 #define HAL_TLV_STATUS_MPDU_START 10
+#define HAL_TLV_STATUS_MON_DROP 11
 
 #define HAL_MAX_UL_MU_USERS	37
 
@@ -342,6 +343,20 @@ enum {
 	DP_PPDU_STATUS_DONE,
 };
 
+/**
+ * struct hal_rx_ppdu_drop_cnt - PPDU drop count
+ * @ppdu_drop_cnt: PPDU drop count
+ * @mpdu_drop_cnt: MPDU drop count
+ * @end_of_ppdu_drop_cnt: End of PPDU drop count
+ * @tlv_drop_cnt: TLV drop count
+ */
+struct hal_rx_ppdu_drop_cnt {
+	uint8_t ppdu_drop_cnt;
+	uint16_t mpdu_drop_cnt;
+	uint8_t end_of_ppdu_drop_cnt;
+	uint16_t tlv_drop_cnt;
+};
+
 static inline QDF_STATUS
 hal_rx_reo_ent_get_src_link_id(hal_soc_handle_t hal_soc_hdl,
 			       hal_rxdma_desc_t rx_desc,
@@ -1303,6 +1318,8 @@ struct hal_rx_ppdu_info {
 	uint8_t end_user_stats_cnt;
 	/* PPDU start user info count */
 	uint8_t start_user_info_cnt;
+	/* PPDU drop cnt */
+	struct hal_rx_ppdu_drop_cnt drop_cnt;
 };
 
 static inline uint32_t