Эх сурвалжийг харах

qcacmn: Add support to dump Host AST table

Add support to print Host AST table contents and
AST statistics

Change-Id: I669d547657fe9d826d2aed59cf8dbb06bc100996
CRs-Fixed: 2099205
Pamidipati, Vijay 7 жил өмнө
parent
commit
899e775769

+ 1 - 0
dp/inc/cdp_txrx_cmn_struct.h

@@ -149,6 +149,7 @@ enum cdp_host_txrx_stats {
 	TXRX_TX_RATE_STATS  = 2,
 	TXRX_TX_HOST_STATS  = 3,
 	TXRX_RX_HOST_STATS  = 4,
+	TXRX_AST_STATS = 5,
 	TXRX_HOST_STATS_MAX,
 };
 

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

@@ -254,6 +254,7 @@ const int dp_stats_mapping_table[][STATS_TYPE_MAX] = {
 	{TXRX_FW_STATS_INVALID, TXRX_TX_RATE_STATS},
 	{TXRX_FW_STATS_INVALID, TXRX_TX_HOST_STATS},
 	{TXRX_FW_STATS_INVALID, TXRX_RX_HOST_STATS},
+	{TXRX_FW_STATS_INVALID, TXRX_AST_STATS},
 };
 
 /**
@@ -406,6 +407,58 @@ static void dp_srng_msi_setup(struct dp_soc *soc, struct hal_srng_params
 }
 
 /**
+ * dp_print_ast_stats() - Dump AST table contents
+ * @soc: Datapath soc handle
+ *
+ * return void
+ */
+#ifdef FEATURE_WDS
+static void dp_print_ast_stats(struct dp_soc *soc)
+{
+	uint8_t i;
+	uint8_t num_entries = 0;
+	struct dp_vdev *vdev;
+	struct dp_pdev *pdev;
+	struct dp_peer *peer;
+	struct dp_ast_entry *ase, *tmp_ase;
+
+	DP_PRINT_STATS("AST Stats:");
+	DP_PRINT_STATS("	Entries Added   = %d", soc->stats.ast.added);
+	DP_PRINT_STATS("	Entries Deleted = %d", soc->stats.ast.deleted);
+	DP_PRINT_STATS("	Entries Agedout = %d", soc->stats.ast.aged_out);
+	DP_PRINT_STATS("AST Table:");
+	for (i = 0; i < MAX_PDEV_CNT && soc->pdev_list[i]; i++) {
+		pdev = soc->pdev_list[i];
+		DP_PDEV_ITERATE_VDEV_LIST(pdev, vdev) {
+			DP_VDEV_ITERATE_PEER_LIST(vdev, peer) {
+				DP_PEER_ITERATE_ASE_LIST(peer, ase, tmp_ase) {
+					DP_PRINT_STATS("%6d mac_addr = %pM"
+							" peer_mac_addr = %pM"
+							" type = %d"
+							" next_hop = %d"
+							" is_active = %d"
+							" is_bss = %d",
+							++num_entries,
+							ase->mac_addr.raw,
+							ase->peer->mac_addr.raw,
+							ase->type,
+							ase->next_hop,
+							ase->is_active,
+							ase->is_bss);
+				}
+			}
+		}
+	}
+}
+#else
+static void dp_print_ast_stats(struct dp_soc *soc)
+{
+	DP_PRINT_STATS("AST Stats not available.Enable FEATURE_WDS");
+	return;
+}
+#endif
+
+/*
  * dp_setup_srng - Internal function to setup SRNG rings used by data path
  */
 static int dp_srng_setup(struct dp_soc *soc, struct dp_srng *srng,
@@ -1511,6 +1564,8 @@ static void dp_wds_aging_timer_fn(void *soc_hdl)
 						continue;
 					}
 
+					DP_STATS_INC(soc, ast.aged_out, 1);
+
 					soc->cdp_soc.ol_ops->peer_del_wds_entry(
 							pdev->osif_pdev,
 							ase->mac_addr.raw);
@@ -4248,6 +4303,7 @@ static inline void dp_print_peer_stats(struct dp_peer *peer)
  * TXRX_TX_RATE_STATS: Print Tx Rate Info
  * TXRX_TX_HOST_STATS: Print Tx Stats
  * TXRX_RX_HOST_STATS: Print Rx Stats
+ * TXRX_AST_STATS: Print AST Stats
  *
  * Return: 0 on success, print error message in case of failure
  */
@@ -4258,6 +4314,7 @@ dp_print_host_stats(struct cdp_vdev *vdev_handle, enum cdp_host_txrx_stats type)
 	struct dp_pdev *pdev = (struct dp_pdev *)vdev->pdev;
 
 	dp_aggregate_pdev_stats(pdev);
+
 	switch (type) {
 	case TXRX_CLEAR_STATS:
 		dp_txrx_host_stats_clr(vdev);
@@ -4276,6 +4333,9 @@ dp_print_host_stats(struct cdp_vdev *vdev_handle, enum cdp_host_txrx_stats type)
 		dp_print_pdev_rx_stats(pdev);
 		dp_print_soc_rx_stats(pdev->soc);
 		break;
+	case TXRX_AST_STATS:
+		dp_print_ast_stats(pdev->soc);
+		break;
 	default:
 		DP_TRACE(FATAL, "Wrong Input For TxRx Host Stats");
 		break;

+ 2 - 0
dp/wifi3.0/dp_peer.c

@@ -460,6 +460,7 @@ int dp_peer_add_ast(struct dp_soc *soc, struct dp_peer *peer,
 
 	ast_entry->is_active = TRUE;
 	TAILQ_INSERT_TAIL(&peer->ast_entry_list, ast_entry, ase_list_elem);
+	DP_STATS_INC(soc, ast.added, 1);
 	dp_peer_ast_hash_add(soc, ast_entry);
 	qdf_spin_unlock_bh(&soc->ast_lock);
 	return 0;
@@ -482,6 +483,7 @@ void dp_peer_del_ast(struct dp_soc *soc,
 	struct dp_peer *peer = ast_entry->peer;
 	soc->ast_table[ast_entry->ast_idx] = NULL;
 	TAILQ_REMOVE(&peer->ast_entry_list, ast_entry, ase_list_elem);
+	DP_STATS_INC(soc, ast.deleted, 1);
 	dp_peer_ast_hash_remove(soc, ast_entry);
 	qdf_mem_free(ast_entry);
 }

+ 6 - 0
dp/wifi3.0/dp_types.h

@@ -443,6 +443,12 @@ struct reo_desc_list_node {
 
 /* SoC level data path statistics */
 struct dp_soc_stats {
+	struct {
+		uint32_t added;
+		uint32_t deleted;
+		uint32_t aged_out;
+	} ast;
+
 	/* SOC level TX stats */
 	struct {
 		/* packets dropped on tx because of no peer */