telemetry: fix init log printing
authorCiara Power <ciara.power@intel.com>
Fri, 22 May 2020 13:48:39 +0000 (14:48 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Sun, 24 May 2020 16:01:31 +0000 (18:01 +0200)
Initially, printf was used to indicate and error/warning resulting from
telemetry initialisation. This is now fixed to use EAL logs for
notices, and the unnecessary printf for an error is removed.

Fixes: eeb486f3ba65 ("eal: add telemetry as dependency")
Fixes: dd6275a424ac ("telemetry: fix error log output")

Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
lib/librte_eal/freebsd/eal.c
lib/librte_eal/linux/eal.c
lib/librte_telemetry/rte_telemetry.h
lib/librte_telemetry/telemetry.c

index 14b5216..c41f265 100644 (file)
@@ -956,13 +956,15 @@ rte_eal_init(int argc, char **argv)
                return -1;
        }
        if (!internal_config.no_telemetry) {
-               const char *error_str;
+               const char *error_str = NULL;
                if (rte_telemetry_init(rte_eal_get_runtime_dir(),
                                &internal_config.ctrl_cpuset, &error_str)
                                != 0) {
                        rte_eal_init_alert(error_str);
                        return -1;
                }
+               if (error_str != NULL)
+                       RTE_LOG(NOTICE, EAL, "%s\n", error_str);
        }
 
        eal_mcfg_complete();
index 9620d25..f162124 100644 (file)
@@ -1294,13 +1294,15 @@ rte_eal_init(int argc, char **argv)
                return -1;
        }
        if (!internal_config.no_telemetry) {
-               const char *error_str;
+               const char *error_str = NULL;
                if (rte_telemetry_init(rte_eal_get_runtime_dir(),
                                &internal_config.ctrl_cpuset, &error_str)
                                != 0) {
                        rte_eal_init_alert(error_str);
                        return -1;
                }
+               if (error_str != NULL)
+                       RTE_LOG(NOTICE, EAL, "%s\n", error_str);
        }
 
        eal_mcfg_complete();
index 2c3c96c..eb7f2c9 100644 (file)
@@ -241,8 +241,17 @@ int
 rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help);
 
 /**
+ * @internal
  * Initialize Telemetry.
  *
+ * @param runtime_dir
+ * The runtime directory of DPDK.
+ * @param cpuset
+ * The CPU set to be used for setting the thread affinity.
+ * @param err_str
+ * This err_str pointer should point to NULL on entry. In the case of an error
+ * or warning, it will be non-NULL on exit.
+ *
  * @return
  *  0 on success.
  * @return
index 7b6f8a7..e7e3d86 100644 (file)
@@ -403,12 +403,10 @@ rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset,
 {
        if (telemetry_v2_init(runtime_dir, cpuset) != 0) {
                *err_str = telemetry_log_error;
-               printf("Error initialising telemetry - %s\n", *err_str);
                return -1;
        }
        if (telemetry_legacy_init(runtime_dir, cpuset) != 0) {
                *err_str = telemetry_log_error;
-               printf("No telemetry legacy support - %s\n", *err_str);
        }
        return 0;
 }