Prechádzať zdrojové kódy

qcacmn: Dump flow pool stats as part of periodic stats display

Dump flow pool stats even for low verbosity level as
part of periodic stats display.

Change-Id: Iea59d20b0a81cfd0bfdac65ad54a11fa33f30f2f
CRs-Fixed: 3031168
Yeshwanth Sriram Guntuka 3 rokov pred
rodič
commit
ccb6664db1

+ 12 - 0
dp/wifi3.0/dp_internal.h

@@ -2267,8 +2267,20 @@ void dp_vdev_peer_stats_update_protocol_cnt_tx(struct dp_vdev *vdev_hdl,
 
 #ifdef QCA_LL_TX_FLOW_CONTROL_V2
 void dp_tx_dump_flow_pool_info(struct cdp_soc_t *soc_hdl);
+
+/**
+ * dp_tx_dump_flow_pool_info_compact() - dump flow pool info
+ * @soc: DP soc context
+ *
+ * Return: none
+ */
+void dp_tx_dump_flow_pool_info_compact(struct dp_soc *soc);
 int dp_tx_delete_flow_pool(struct dp_soc *soc, struct dp_tx_desc_pool_s *pool,
 	bool force);
+#else
+static inline void dp_tx_dump_flow_pool_info_compact(struct dp_soc *soc)
+{
+}
 #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */
 
 #ifdef QCA_OL_DP_SRNG_LOCK_LESS_ACCESS

+ 12 - 5
dp/wifi3.0/dp_main.c

@@ -7475,7 +7475,7 @@ static struct cdp_cfg *dp_get_ctrl_pdev_from_vdev_wifi3(
  *
  * Return: outstanding tx
  */
-static uint32_t dp_get_tx_pending(struct cdp_pdev *pdev_handle)
+static int32_t dp_get_tx_pending(struct cdp_pdev *pdev_handle)
 {
 	struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
 
@@ -9564,6 +9564,8 @@ static QDF_STATUS dp_txrx_dump_stats(struct cdp_soc_t *psoc, uint16_t value,
 	case CDP_DUMP_TX_FLOW_POOL_INFO:
 		if (level == QDF_STATS_VERBOSITY_LEVEL_HIGH)
 			cdp_dump_flow_pool_info((struct cdp_soc_t *)soc);
+		else
+			dp_tx_dump_flow_pool_info_compact(soc);
 		break;
 
 	case CDP_DP_NAPI_STATS:
@@ -10899,6 +10901,7 @@ static QDF_STATUS dp_runtime_suspend(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
 	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
 	struct dp_pdev *pdev;
 	uint8_t i;
+	int32_t tx_pending;
 
 	pdev = dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id);
 	if (!pdev) {
@@ -10907,8 +10910,10 @@ static QDF_STATUS dp_runtime_suspend(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
 	}
 
 	/* Abort if there are any pending TX packets */
-	if (dp_get_tx_pending(dp_pdev_to_cdp_pdev(pdev)) > 0) {
-		dp_init_info("%pK: Abort suspend due to pending TX packets", soc);
+	tx_pending = dp_get_tx_pending(dp_pdev_to_cdp_pdev(pdev));
+	if (tx_pending) {
+		dp_init_info("%pK: Abort suspend due to pending TX packets %d",
+			     soc, tx_pending);
 
 		/* perform a force flush if tx is pending */
 		for (i = 0; i < soc->num_tcl_data_rings; i++) {
@@ -11376,6 +11381,7 @@ static QDF_STATUS dp_bus_suspend(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
 	struct dp_pdev *pdev = dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id);
 	int timeout = SUSPEND_DRAIN_WAIT;
 	int drain_wait_delay = 50; /* 50 ms */
+	int32_t tx_pending;
 
 	if (qdf_unlikely(!pdev)) {
 		dp_err("pdev is NULL");
@@ -11383,10 +11389,11 @@ static QDF_STATUS dp_bus_suspend(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
 	}
 
 	/* Abort if there are any pending TX packets */
-	while (dp_get_tx_pending((struct cdp_pdev *)pdev) > 0) {
+	while ((tx_pending = dp_get_tx_pending((struct cdp_pdev *)pdev))) {
 		qdf_sleep(drain_wait_delay);
 		if (timeout <= 0) {
-			dp_err("TX frames are pending, abort suspend");
+			dp_info("TX frames are pending %d, abort suspend",
+				tx_pending);
 			return QDF_STATUS_E_TIMEOUT;
 		}
 		timeout = timeout - drain_wait_delay;

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

@@ -5959,6 +5959,8 @@ void dp_txrx_path_stats(struct dp_soc *soc)
 			       pdev->stats.tx.dropped.fw_rem_notx);
 		DP_PRINT_STATS("Invalid peer on tx path: %u",
 			       pdev->soc->stats.tx.tx_invalid_peer.num);
+		DP_PRINT_STATS("Tx desc freed in non-completion path: %u",
+			       pdev->soc->stats.tx.tx_comp_exception);
 
 		DP_PRINT_STATS("Tx packets sent per interrupt:");
 		DP_PRINT_STATS("Single Packet: %u",

+ 1 - 0
dp/wifi3.0/dp_tx.c

@@ -4702,6 +4702,7 @@ more_data:
 				 !tx_desc->flags)) {
 				dp_tx_comp_info_rl("Descriptor freed in vdev_detach %d",
 						   tx_desc->id);
+				DP_STATS_INC(soc, tx.tx_comp_exception, 1);
 				continue;
 			}
 

+ 43 - 1
dp/wifi3.0/dp_tx_flow_control.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2021 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -29,6 +29,8 @@
 #include "dp_internal.h"
 #define INVALID_FLOW_ID 0xFF
 #define MAX_INVALID_BIN 3
+#define GLOBAL_FLOW_POOL_STATS_LEN 25
+#define FLOW_POOL_LOG_LEN 50
 
 #ifdef QCA_AC_BASED_FLOW_CONTROL
 /**
@@ -222,6 +224,46 @@ void dp_tx_dump_flow_pool_info(struct cdp_soc_t *soc_hdl)
 	qdf_spin_unlock_bh(&soc->flow_pool_array_lock);
 }
 
+void dp_tx_dump_flow_pool_info_compact(struct dp_soc *soc)
+{
+	struct dp_txrx_pool_stats *pool_stats = &soc->pool_stats;
+	struct dp_tx_desc_pool_s *pool = NULL;
+	char *comb_log_str;
+	uint32_t comb_log_str_size;
+	int bytes_written = 0;
+	int i;
+
+	comb_log_str_size = GLOBAL_FLOW_POOL_STATS_LEN +
+				(FLOW_POOL_LOG_LEN * MAX_TXDESC_POOLS) + 1;
+	comb_log_str = qdf_mem_malloc(comb_log_str_size);
+	if (!comb_log_str)
+		return;
+
+	bytes_written = qdf_snprintf(&comb_log_str[bytes_written],
+				     comb_log_str_size, "G:(%d,%d,%d) ",
+				     pool_stats->pool_map_count,
+				     pool_stats->pool_unmap_count,
+				     pool_stats->pkt_drop_no_pool);
+
+	for (i = 0; i < MAX_TXDESC_POOLS; i++) {
+		pool = &soc->tx_desc[i];
+		if (pool->status > FLOW_POOL_INVALID)
+			continue;
+		bytes_written += qdf_snprintf(&comb_log_str[bytes_written],
+				      (bytes_written >= comb_log_str_size) ? 0 :
+				      comb_log_str_size - bytes_written,
+				      "| %d %d: (%d,%d,%d)",
+				      pool->flow_pool_id, pool->status,
+				      pool->pool_size, pool->avail_desc,
+				      pool->pkt_drop_no_desc);
+	}
+
+	QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH,
+		  "FLOW_POOL_STATS %s", comb_log_str);
+
+	qdf_mem_free(comb_log_str);
+}
+
 /**
  * dp_tx_clear_flow_pool_stats() - clear flow pool statistics
  *

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

@@ -948,6 +948,8 @@ struct dp_soc_stats {
 		uint32_t tx_comp_loop_pkt_limit_hit;
 		/* Head pointer Out of sync at the end of dp_tx_comp_handler */
 		uint32_t hp_oos2;
+		/* tx desc freed as part of vdev detach */
+		uint32_t tx_comp_exception;
 	} tx;
 
 	/* SOC level RX stats */

+ 2 - 2
qdf/inc/qdf_trace.h

@@ -1143,8 +1143,8 @@ enum qdf_dp_tx_rx_status qdf_dp_get_status_from_a_status(uint8_t status)
 
 void qdf_trace_display(void);
 
-void __printf(3, 4) qdf_snprintf(char *str_buffer, unsigned int size,
-		  char *str_format, ...);
+int __printf(3, 4) qdf_snprintf(char *str_buffer, unsigned int size,
+				char *str_format, ...);
 
 #define QDF_SNPRINTF qdf_snprintf
 

+ 6 - 3
qdf/linux/src/qdf_trace.c

@@ -135,15 +135,18 @@ static char qdf_module_param[QDF_PARAM_MAX][QDF_PARAM_STR_LENGTH] = {
  * string contains printf-like replacement parameters, which follow
  * this parameter in the variable argument list.
  *
- * Return: None
+ * Return: num of bytes written to buffer
  */
-void qdf_snprintf(char *str_buffer, unsigned int size, char *str_format, ...)
+int qdf_snprintf(char *str_buffer, unsigned int size, char *str_format, ...)
 {
 	va_list args;
+	int i;
 
 	va_start(args, str_format);
-	vsnprintf(str_buffer, size, str_format, args);
+	i = vsnprintf(str_buffer, size, str_format, args);
 	va_end(args);
+
+	return i;
 }
 qdf_export_symbol(qdf_snprintf);