From patchwork Wed Jul 3 16:28:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 142097 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 228E245563; Wed, 3 Jul 2024 18:29:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 791F642E7F; Wed, 3 Jul 2024 18:29:43 +0200 (CEST) Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mails.dpdk.org (Postfix) with ESMTP id 2BC114111C for ; Wed, 3 Jul 2024 18:29:42 +0200 (CEST) Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1fafb9a33b3so12611845ad.1 for ; Wed, 03 Jul 2024 09:29:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1720024181; x=1720628981; 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=Zu7NxkLoCYtcFgCFFubO5vgkcwj4rlqNv9GhTBKAROE=; b=Al3ZJtkDwfCJMhcIRZGJ6ZMxsrWGuD3gz0LP2zqLHWFgnv4nmJvpzup6F2NMUd9SbM GVlA88Rgt2BYvYFMGsVrBbDFgXuWATZZw+0WjE7pop8ZEk62N+gPMAiVOfuwPeY2H602 H15YFhJLnOVHwhTs+1ZJv13J2PWa8tjZq4jQbzXifkzZTIiPfuVSobBZa2mMTzmWHSoX R0qDKaXdx4MIm9lMvK/3gRLyJ45aUS84gACrv14L9b1QEzLZicPENsPUG2+idTK/fIq1 XiFr2CLx5Wl6t8Uv20jmqKxOQI2PNg5cjWEw1N9v7dy8pmdQVAM8nYFhk6GfwpnLyrlb 9wzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720024181; x=1720628981; 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=Zu7NxkLoCYtcFgCFFubO5vgkcwj4rlqNv9GhTBKAROE=; b=OHkofkDL5T3LtykyQcg+Z69E04tov6ydINjvYPhiboyn5vffvIA6KEOkoEwjAc50BU ITmWTFLUQ+2wcQiNKQosKN0Hdr8NCqhn6tpM57Mv97WwiJLYpvRcZd00RLBBuLZVM9Be 1DqhJoxIUzpxzhfp1/h3T6Xqv4t+ClqTfXV228pp3ldkenKWqbzbao8JcU+GJR9Ph5Z7 NMZ1RsVn0HAxwfZBS4O/fAOdjRBxicNBedGbUEu/uNVLM5i4X/hPKRzvAem58gdGjscm cGuYwkir/ln5Q0adVInKgC19Sz1O0jK+tOnBIpuCfBlkbrxxEllJMn2ehOUkSF4hgZM6 u74A== X-Gm-Message-State: AOJu0Yy+HKV8ZjOyxB5KXAx2y3csCIcDJRLyPXk4Pn9PHCoX8WLZwQfa awkBqus3qm8T/pU0YOhBI0AIt3vLdfTR12+ZJaBm2dHpPrhxK6wHkg2vANHneoFwenX8JjMKr4d Sn4Y= X-Google-Smtp-Source: AGHT+IFsUxuhHr7PmYu3btWFQYfrDHAYd4iIuBSuA9W7KRYsEk/CQ99LmUcpoQnahQDc2UbW5QBNLA== X-Received: by 2002:a17:902:c944:b0:1f7:38a2:f1ec with SMTP id d9443c01a7336-1fadbcb7b57mr98420505ad.36.1720024181199; Wed, 03 Jul 2024 09:29:41 -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.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 09:29:40 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Huisong Li , =?utf-8?q?Morten_Br=C3=B8rup?= Subject: [PATCH v5 1/3] examples/l2fwd-keepalive: don't use EAL logtype Date: Wed, 3 Jul 2024 09:28:19 -0700 Message-ID: <20240703162929.78438-2-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 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 EAL logtype should be reserved for EAL library. This example is already has a log wrapper so use it. Signed-off-by: Stephen Hemminger Acked-by: Huisong Li Acked-by: Morten Brørup --- examples/l2fwd-keepalive/main.c | 2 -- examples/l2fwd-keepalive/shm.c | 29 ++++++++++++----------------- examples/l2fwd-keepalive/shm.h | 3 +++ 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c index c3ead9e8b7..bff2b99531 100644 --- a/examples/l2fwd-keepalive/main.c +++ b/examples/l2fwd-keepalive/main.c @@ -41,8 +41,6 @@ #include "shm.h" -#define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1 - #define NB_MBUF_PER_PORT 3000 #define MAX_PKT_BURST 32 diff --git a/examples/l2fwd-keepalive/shm.c b/examples/l2fwd-keepalive/shm.c index 7c7a9ea8ea..865a19a57f 100644 --- a/examples/l2fwd-keepalive/shm.c +++ b/examples/l2fwd-keepalive/shm.c @@ -5,7 +5,6 @@ #include #include -#include #include #include "shm.h" @@ -22,34 +21,30 @@ struct rte_keepalive_shm *rte_keepalive_shm_create(void) * will get the new block mapped below. */ if (shm_unlink(RTE_KEEPALIVE_SHM_NAME) == -1 && errno != ENOENT) - printf("Warning: Error unlinking stale %s (%s)\n", + RTE_LOG(NOTICE, L2FWD, + "Warning: Error unlinking stale %s (%s)\n", RTE_KEEPALIVE_SHM_NAME, strerror(errno)); fd = shm_open(RTE_KEEPALIVE_SHM_NAME, O_CREAT | O_TRUNC | O_RDWR, 0666); if (fd < 0) - RTE_LOG(INFO, EAL, - "Failed to open %s as SHM (%s)\n", - RTE_KEEPALIVE_SHM_NAME, - strerror(errno)); + RTE_LOG(ERR, L2FWD, "Failed to open %s as SHM (%s)\n", + RTE_KEEPALIVE_SHM_NAME, strerror(errno)); else if (ftruncate(fd, sizeof(struct rte_keepalive_shm)) != 0) - RTE_LOG(INFO, EAL, - "Failed to resize SHM (%s)\n", strerror(errno)); + RTE_LOG(ERR, L2FWD, "Failed to resize SHM (%s)\n", strerror(errno)); else { ka_shm = (struct rte_keepalive_shm *) mmap( 0, sizeof(struct rte_keepalive_shm), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); close(fd); if (ka_shm == MAP_FAILED) - RTE_LOG(INFO, EAL, - "Failed to mmap SHM (%s)\n", strerror(errno)); + RTE_LOG(ERR, L2FWD, "Failed to mmap SHM (%s)\n", strerror(errno)); else { memset(ka_shm, 0, sizeof(struct rte_keepalive_shm)); /* Initialize the semaphores for IPC/SHM use */ if (sem_init(&ka_shm->core_died, 1, 0) != 0) { - RTE_LOG(INFO, EAL, - "Failed to setup SHM semaphore (%s)\n", + RTE_LOG(ERR, L2FWD, "Failed to setup SHM semaphore (%s)\n", strerror(errno)); munmap(ka_shm, sizeof(struct rte_keepalive_shm)); @@ -87,7 +82,7 @@ void rte_keepalive_relayed_state(struct rte_keepalive_shm *shm, * ka_agent is not active. */ if (sem_getvalue(&shm->core_died, &count) == -1) { - RTE_LOG(INFO, EAL, "Semaphore check failed(%s)\n", + RTE_LOG(ERR, L2FWD, "Semaphore check failed(%s)\n", strerror(errno)); return; } @@ -95,8 +90,7 @@ void rte_keepalive_relayed_state(struct rte_keepalive_shm *shm, return; if (sem_post(&shm->core_died) != 0) - RTE_LOG(INFO, EAL, - "Failed to increment semaphore (%s)\n", + RTE_LOG(ERR, L2FWD, "Failed to increment semaphore (%s)\n", strerror(errno)); } } @@ -104,9 +98,10 @@ void rte_keepalive_relayed_state(struct rte_keepalive_shm *shm, void rte_keepalive_shm_cleanup(struct rte_keepalive_shm *ka_shm) { if (shm_unlink(RTE_KEEPALIVE_SHM_NAME) == -1 && errno != ENOENT) - printf("Warning: Error unlinking %s (%s)\n", + RTE_LOG(NOTICE, L2FWD, "Warning: Error unlinking %s (%s)\n", RTE_KEEPALIVE_SHM_NAME, strerror(errno)); if (ka_shm && munmap(ka_shm, sizeof(struct rte_keepalive_shm)) != 0) - printf("Warning: munmap() failed\n"); + RTE_LOG(ERR, L2FWD, "Warning: munmap() failed: %s\n", + strerror(errno)); } diff --git a/examples/l2fwd-keepalive/shm.h b/examples/l2fwd-keepalive/shm.h index 7a9d597295..f7644336e5 100644 --- a/examples/l2fwd-keepalive/shm.h +++ b/examples/l2fwd-keepalive/shm.h @@ -14,6 +14,9 @@ #include #include #include +#include + +#define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1 /** * Keepalive SHM structure. From patchwork Wed Jul 3 16:28:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 142098 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3543345563; Wed, 3 Jul 2024 18:29:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0A2E242E8B; Wed, 3 Jul 2024 18:29:45 +0200 (CEST) Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) by mails.dpdk.org (Postfix) with ESMTP id 3383C42E7A for ; Wed, 3 Jul 2024 18:29:43 +0200 (CEST) Received: by mail-pg1-f175.google.com with SMTP id 41be03b00d2f7-75c5bdab7faso315173a12.1 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=1720024182; x=1720628982; 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=nNSXjuAIAuOZSdJcKf9mqKnkjxwByojVOaFmSdQwSVI=; b=p7zhX6BBQPx6IxA6RZkM/gB+rxT4+YCVRo2PoIBvqbrcTVyENNNisRoL+A5rzHErDI 19z3mZvBE7wk+z0fS3vIYh/1xb7JjNGBP50bde0hWBtgEvGypFsIBLoeZT6wrDMQeB/F FykOeTJxo5a5asfkPKU9x/jYDiWFu1StmdHj1YBqqqac7L6Eu3wKYt7SJUpn0553GsjF MBO1Bsk63qB2Qu3vBNh9UInpzRccmMR6cROBEF+4xkvuKplObLSKqTmhk4a82bfJkaHa b7ZlS+OZbxRXVS1tEaGNKxqRVhh7yGon5j4nuq2i9DH+OIK11RzJm04hHag46aY1Oo/W S7zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720024182; x=1720628982; 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=nNSXjuAIAuOZSdJcKf9mqKnkjxwByojVOaFmSdQwSVI=; b=g8Sq7iaVRJ1L0CUkbCBMHxjxGN6fYH9TZDNU4zWwKlSQNq4Nu2RK2e8khCBMchen1K IEIrWGYdNfOvFYlpi6yuy324F/a20vVYGmQATV+CNe+10wNTFZonXWxj8L7Fo/tJsVUG qxAQilOML5Cl9cwa3GIKPzNcXZoixU4PfgTef91Tc24XWonphJksjjJIMHi4dd66UVo+ H9I6N7yFfF7Lg0jj9Jif5ePmxOCSE1fUPIo4GHPF0iCIfi2nMwMZHNbFQcSCSB9j8WHo 9r2HslxZ87JLfv2TthLPhSPiNkfd3g9WklCACII2lluHd5FSud4NbAatO3Kkjh0kuxme J1SA== X-Gm-Message-State: AOJu0YyZrExM1UGvAzciOQ5AXJUTjfbSwp2G8VH8UTWwxmo96Jn+qHB2 v+hOUaNG9fmUyVRPOG5aEHVmB7BgROo8bNtG4ttVX5q7Ajw5jSVNiDYFASy8M7fBEW4ECWegZOz /pBA= X-Google-Smtp-Source: AGHT+IEQ9RrQiyNPk1vaVRpxSaXyGPv+QNZ/9lV2ko9/D5IrEGi9YM6PoLCPUUk2t2bYH42kI4whpA== X-Received: by 2002:a05:6a20:734c:b0:1bd:2782:3cda with SMTP id adf61e73a8af0-1bef61999b7mr14337280637.35.1720024182231; Wed, 03 Jul 2024 09:29:42 -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.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 09:29:41 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , David Hunt , Huisong Li , Anatoly Burakov , Sivaprasad Tummala Subject: [PATCH v5 2/3] examples/vm_power_manager: do not use EAL logtype Date: Wed, 3 Jul 2024 09:28:20 -0700 Message-ID: <20240703162929.78438-3-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 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 Be consistent for all the error printouts and use fprintf(). The EAL logtype is reserved for internal use by EAL. Signed-off-by: Stephen Hemminger Acked-by: David Hunt Acked-by: Huisong Li --- examples/vm_power_manager/main.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c index b159291d77..c141382020 100644 --- a/examples/vm_power_manager/main.c +++ b/examples/vm_power_manager/main.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -425,8 +424,7 @@ main(int argc, char **argv) lcore_id = rte_get_next_lcore(-1, 1, 0); if (lcore_id == RTE_MAX_LCORE) { - RTE_LOG(ERR, EAL, "A minimum of three cores are required to run " - "application\n"); + fprintf(stderr, "A minimum of three cores are required to run application\n"); return 0; } printf("Running channel monitor on lcore id %d\n", lcore_id); @@ -434,16 +432,15 @@ main(int argc, char **argv) lcore_id = rte_get_next_lcore(lcore_id, 1, 0); if (lcore_id == RTE_MAX_LCORE) { - RTE_LOG(ERR, EAL, "A minimum of three cores are required to run " - "application\n"); + fprintf(stderr, "A minimum of three cores are required to run application\n"); return 0; } if (power_manager_init() < 0) { - printf("Unable to initialize power manager\n"); + fprintf(stderr, "Unable to initialize power manager\n"); return -1; } if (channel_manager_init(CHANNEL_MGR_DEFAULT_HV_PATH) < 0) { - printf("Unable to initialize channel manager\n"); + fprintf(stderr, "Unable to initialize channel manager\n"); return -1; } From patchwork Wed Jul 3 16:28:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 142099 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org 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 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; } }