Testpmd is misusing EAL logtype for some errors.
Since the code directly has a macro for logging, use that.

Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
Acked-by: Huisong Li <lihuis...@huawei.com>
Acked-by: Aman Singh <aman.deep.si...@intel.com>
---
 app/test-pmd/testpmd.c | 49 ++++++++++++++++--------------------------
 1 file changed, 19 insertions(+), 30 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 70ea257fda..b1401136e4 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -3413,8 +3413,8 @@ stop_port(portid_t pid)
 
                ret = eth_dev_stop_mp(pi);
                if (ret != 0) {
-                       RTE_LOG(ERR, EAL, "rte_eth_dev_stop failed for port 
%u\n",
-                               pi);
+                       TESTPMD_LOG(ERR,
+                                   "rte_eth_dev_stop failed for port %u\n", 
pi);
                        /* Allow to retry stopping the port. */
                        port->port_status = RTE_PORT_STARTED;
                        continue;
@@ -3812,23 +3812,20 @@ pmd_test_exit(void)
        if (hot_plug) {
                ret = rte_dev_event_monitor_stop();
                if (ret) {
-                       RTE_LOG(ERR, EAL,
-                               "fail to stop device event monitor.");
+                       TESTPMD_LOG(ERR, "fail to stop device event monitor.");
                        return;
                }
 
                ret = rte_dev_event_callback_unregister(NULL,
                        dev_event_callback, NULL);
                if (ret < 0) {
-                       RTE_LOG(ERR, EAL,
-                               "fail to unregister device event callback.\n");
+                       TESTPMD_LOG(ERR, "fail to unregister device event 
callback.\n");
                        return;
                }
 
                ret = rte_dev_hotplug_handle_disable();
                if (ret) {
-                       RTE_LOG(ERR, EAL,
-                               "fail to disable hotplug handling.\n");
+                       TESTPMD_LOG(ERR, "fail to disable hotplug handling.\n");
                        return;
                }
        }
@@ -4054,20 +4051,13 @@ dev_event_callback(const char *device_name, enum 
rte_dev_event_type type,
        uint16_t port_id;
        int ret;
 
-       if (type >= RTE_DEV_EVENT_MAX) {
-               fprintf(stderr, "%s called upon invalid event %d\n",
-                       __func__, type);
-               fflush(stderr);
-       }
-
        switch (type) {
        case RTE_DEV_EVENT_REMOVE:
-               RTE_LOG(DEBUG, EAL, "The device: %s has been removed!\n",
-                       device_name);
+               TESTPMD_LOG(INFO, "The device: %s has been removed!\n", 
device_name);
                ret = rte_eth_dev_get_port_by_name(device_name, &port_id);
                if (ret) {
-                       RTE_LOG(ERR, EAL, "can not get port by device %s!\n",
-                               device_name);
+                       TESTPMD_LOG(ERR,
+                                   "Can not get port for device %s!\n", 
device_name);
                        return;
                }
                /*
@@ -4081,17 +4071,20 @@ dev_event_callback(const char *device_name, enum 
rte_dev_event_type type,
                 */
                if (rte_eal_alarm_set(100000,
                                rmv_port_callback, (void *)(intptr_t)port_id))
-                       RTE_LOG(ERR, EAL,
-                               "Could not set up deferred device removal\n");
+                       TESTPMD_LOG(ERR, "Could not set up deferred device 
removal\n");
                break;
+
        case RTE_DEV_EVENT_ADD:
-               RTE_LOG(ERR, EAL, "The device: %s has been added!\n",
-                       device_name);
+               TESTPMD_LOG(INFO, "The device: %s has been added!\n", 
device_name);
                /* TODO: After finish kernel driver binding,
                 * begin to attach port.
                 */
                break;
+
        default:
+               if (type >= RTE_DEV_EVENT_MAX)
+                       TESTPMD_LOG(ERR, "%s called upon invalid event %d\n",
+                                   __func__, type);
                break;
        }
 }
@@ -4631,23 +4624,19 @@ main(int argc, char** argv)
        if (hot_plug) {
                ret = rte_dev_hotplug_handle_enable();
                if (ret) {
-                       RTE_LOG(ERR, EAL,
-                               "fail to enable hotplug handling.");
+                       TESTPMD_LOG(ERR, "fail to enable hotplug handling.");
                        return -1;
                }
 
                ret = rte_dev_event_monitor_start();
                if (ret) {
-                       RTE_LOG(ERR, EAL,
-                               "fail to start device event monitoring.");
+                       TESTPMD_LOG(ERR, "fail to start device event 
monitoring.");
                        return -1;
                }
 
-               ret = rte_dev_event_callback_register(NULL,
-                       dev_event_callback, NULL);
+               ret = rte_dev_event_callback_register(NULL, dev_event_callback, 
NULL);
                if (ret) {
-                       RTE_LOG(ERR, EAL,
-                               "fail  to register device event callback\n");
+                       TESTPMD_LOG(ERR, "fail to register device event 
callback\n");
                        return -1;
                }
        }
-- 
2.43.0

Reply via email to