[v3,09/12] telemetry: add ability to disable selftest

Message ID 20181010105134.48079-10-kevin.laatz@intel.com
State Superseded
Delegated to: Thomas Monjalon
Headers show
Series
  • introduce telemetry library
Related show

Checks

Context Check Description
ci/Intel-compilation fail Compilation issues
ci/checkpatch success coding style OK

Commit Message

Laatz, Kevin Oct. 10, 2018, 10:51 a.m.
From: Ciara Power <ciara.power@intel.com>

This patch adds functionality to enable/disable the selftest.

This functionality will be extended in future to make the
enabling/disabling more dynamic and remove this 'hardcoded' approach. We
are temporarily using this approach due to the design changes (vdev vs eal)
made to the library.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Brian Archbold <brian.archbold@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
---
 lib/librte_telemetry/rte_telemetry.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

Patch

diff --git a/lib/librte_telemetry/rte_telemetry.c b/lib/librte_telemetry/rte_telemetry.c
index d7f0579..8f5fb44 100644
--- a/lib/librte_telemetry/rte_telemetry.c
+++ b/lib/librte_telemetry/rte_telemetry.c
@@ -656,6 +656,7 @@  rte_telemetry_initial_accept(struct telemetry_impl *telemetry)
 {
 	uint16_t pid;
 	int ret;
+	int selftest = 0;
 
 	RTE_ETH_FOREACH_DEV(pid) {
 		telemetry->reg_index = rte_telemetry_reg_ethdev_to_metrics(pid);
@@ -668,18 +669,20 @@  rte_telemetry_initial_accept(struct telemetry_impl *telemetry)
 	}
 
 	telemetry->metrics_register_done = 1;
-	ret = rte_telemetry_socket_messaging_testing(telemetry->reg_index,
-		telemetry->server_fd);
-	if (ret < 0)
-		return -1;
+	if (selftest) {
+		ret = rte_telemetry_socket_messaging_testing(telemetry->reg_index,
+				telemetry->server_fd);
+		if (ret < 0)
+			return -1;
 
-	ret = rte_telemetry_parser_test(telemetry);
-	if (ret < 0) {
-		TELEMETRY_LOG_ERR("Parser Tests Failed");
-		return -1;
-	}
+		ret = rte_telemetry_parser_test(telemetry);
+		if (ret < 0) {
+			TELEMETRY_LOG_ERR("Parser Tests Failed");
+			return -1;
+		}
 
-	TELEMETRY_LOG_INFO("Success - All Parser Tests Passed");
+		TELEMETRY_LOG_INFO("Success - All Parser Tests Passed");
+	}
 
 	return 0;
 }