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 E452145563; Wed, 3 Jul 2024 18:30:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 368E342E8F; Wed, 3 Jul 2024 18:29:46 +0200 (CEST) Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by mails.dpdk.org (Postfix) with ESMTP id DE32C42E81 for ; Wed, 3 Jul 2024 18:29:43 +0200 (CEST) Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1fa2ea1c443so42798445ad.0 for ; Wed, 03 Jul 2024 09:29:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1720024183; x=1720628983; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=y6VxA+oxEi3vPusnv0t3j3IOh6m3T26W8Had4YMKch4=; b=npgnWZHoCdAXOC34Up8GTLJ9PI7HHUr0ATueVTZ6hJFxEziC9nanX1QgJK2RVleche z8BbxfU6bzfUjGvDwIRuHBzvbzCfnkn9hdFHAJpbCEz2C6RxfEsC1ud1Abw6sTNW9Gnz bogU52CQ5/F3tVI/WBxUdp7W4wzpm42nh7StkaO+PsFpuc1dhAGq5ojQrjXi/sbRcLlZ 2kB0nyOkNeoK6emjxbWbxlhj+XaV+LCh66n/W4NkPUuWe9OZsUhk3HymnnU6TOHxfw3E mPdbOK2j4Ql/gCjo0A2Jag1DcQQR3I6xy8iw99yH4S0dXJvVjg2XZgCJ9BvtbefNUnyT guAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720024183; x=1720628983; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=y6VxA+oxEi3vPusnv0t3j3IOh6m3T26W8Had4YMKch4=; b=wXSmQI+QCUQhC2EJeNxLgQtXqf7eykm4yxZ3Q33v4abjbKkzSyAdZBrOlZm+Df6JEj KKIdf7wc1AYZPnqcYSJJ+Lgcawel06LEaoeCT4f1GDlAQbUG7UupbJxNkft2bUEKvp4s zpXYtrl+78Uy8rcGaZjJEkIGUPB3hT+a0HtIb7QgbiJ9EcHzGEKn61OcPP3vJTzVp/VO rZXpcEFgrcedy/aLHvcd4xY3QsU7VHOzWC2j72St+UejRCql8RsHCj97XtE/EyI8mdwp AhJHe8+gKI6o9N3MnlPHbg8DPpZ69tYtce/aABAveoKftB8Gz7Lmt9x1bpSO2RMBl2wE qaHA== X-Gm-Message-State: AOJu0YyoTfZq/VIsdaseRnBTiX+ji1QL4GMFh6PODuH5nuiYO+O9x6Yt MMp6ZdOZctFpeRKmyzkz3xN2Voip0m0a7FelLXDidEIUoLnGrtg+hMGN41QcVkAKVIx/qsPdReN cYu0= X-Google-Smtp-Source: AGHT+IHy6vQO2xo2mnwpuhQ8DgfCCnNf1C7TOARMimlJALgNGCQc3qVNL+6olsGI+J2lmigKboNPHA== X-Received: by 2002:a17:902:f550:b0:1fa:f976:3b8d with SMTP id d9443c01a7336-1faf9766488mr43378125ad.24.1720024183052; Wed, 03 Jul 2024 09:29:43 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fac1578a3bsm105534885ad.233.2024.07.03.09.29.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 09:29:42 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Huisong Li , Aman Singh Subject: [PATCH v5 3/3] testpmd: replace EAL logtype TESTPMD_LOG Date: Wed, 3 Jul 2024 09:28:21 -0700 Message-ID: <20240703162929.78438-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240703162929.78438-1-stephen@networkplumber.org> References: <20231211172437.61958-1-stephen@networkplumber.org> <20240703162929.78438-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Testpmd is misusing EAL logtype for some errors. Since the code directly has a macro for logging, use that. Signed-off-by: Stephen Hemminger Acked-by: Huisong Li Acked-by: Aman Singh --- 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