From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 96600436D1; Tue, 12 Dec 2023 12:52:04 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 647B142E1A; Tue, 12 Dec 2023 12:52:04 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id D72EC42E18 for ; Tue, 12 Dec 2023 12:52:02 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4SqH5h4x7nz14LCy; Tue, 12 Dec 2023 19:51:52 +0800 (CST) Received: from kwepemm000004.china.huawei.com (unknown [7.193.23.18]) by mail.maildlp.com (Postfix) with ESMTPS id 2738518002F; Tue, 12 Dec 2023 19:51:59 +0800 (CST) Received: from [10.67.121.59] (10.67.121.59) by kwepemm000004.china.huawei.com (7.193.23.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 12 Dec 2023 19:51:58 +0800 Message-ID: <53d8c11d-1d05-0a29-69b1-6ab43ec84975@huawei.com> Date: Tue, 12 Dec 2023 19:51:58 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH 1/3] testpmd: replace EAL logtype with fprintf To: Stephen Hemminger , CC: Aman Singh , Yuying Zhang References: <20231211172437.61958-1-stephen@networkplumber.org> <20231211172437.61958-2-stephen@networkplumber.org> From: "lihuisong (C)" In-Reply-To: <20231211172437.61958-2-stephen@networkplumber.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.121.59] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm000004.china.huawei.com (7.193.23.18) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org With belows to changes, Acked-by: Huisong Li 在 2023/12/12 1:23, Stephen Hemminger 写道: > Testpmd is misusing EAL logtype for its own errors. > Since the code directly calls fprintf in other places, > change to use that everywhere. This has the added benefit > of not having testpmd output clutter up syslog(). > > Signed-off-by: Stephen Hemminger > --- > app/test-pmd/testpmd.c | 33 +++++++++++---------------------- > 1 file changed, 11 insertions(+), 22 deletions(-) > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c > index 9e4e99e53b9a..aa350d61e451 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -3413,8 +3413,7 @@ 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); > + fprintf(stderr, "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 +3811,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."); > + fprintf(stderr, "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"); > + fprintf(stderr, "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"); > + fprintf(stderr, "fail to disable hotplug handling.\n"); > return; > } > } > @@ -4062,12 +4058,10 @@ dev_event_callback(const char *device_name, enum rte_dev_event_type type, > > switch (type) { > case RTE_DEV_EVENT_REMOVE: > - RTE_LOG(DEBUG, EAL, "The device: %s has been removed!\n", > - device_name); > + fprintf(stderr, "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); > + fprintf(stderr, "Can not get port by device %s!\n", device_name); > return; > } > /* > @@ -4081,12 +4075,10 @@ 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"); > + fprintf(stderr, "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); > + fprintf(stderr, "The device: %s has been added!\n", device_name); > /* TODO: After finish kernel driver binding, > * begin to attach port. > */ > @@ -4632,23 +4624,20 @@ 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."); > + fprintf(stderr, "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."); > + fprintf(stderr, "fail to start device event monitoring."); > return -1; > } > > ret = rte_dev_event_callback_register(NULL, > dev_event_callback, NULL); > if (ret) { > - RTE_LOG(ERR, EAL, > - "fail to register device event callback\n"); > + fprintf(stderr, "fail to register device event callback\n"); two space is here. Can you fix it by the way? > return -1; > } > }