telemetry: add ability to disable selftest
authorCiara Power <ciara.power@intel.com>
Sat, 27 Oct 2018 09:17:47 +0000 (10:17 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Sat, 27 Oct 2018 13:18:23 +0000 (15:18 +0200)
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>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
lib/librte_telemetry/rte_telemetry.c

index dc085fe..016431f 100644 (file)
@@ -660,6 +660,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);
@@ -672,18 +673,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;
 }