From patchwork Fri Feb 16 03:36:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 136838 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 7083843B24; Fri, 16 Feb 2024 04:38:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BC52142E02; Fri, 16 Feb 2024 04:37:57 +0100 (CET) Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by mails.dpdk.org (Postfix) with ESMTP id 178CD4027C for ; Fri, 16 Feb 2024 04:37:55 +0100 (CET) Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1d780a392fdso2640695ad.3 for ; Thu, 15 Feb 2024 19:37:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1708054674; x=1708659474; 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=yEyFCFdHHlQZ/CKt1fbFi+8lYhpJpVF6Z0sukUpRvLk=; b=BciVHt/MYEbA3fg312YBOP5UKk6pUvY+FGRO9jrfF3VeLCbvvb4yPeB3W53IezmQLM XgGrbqhHKVzAHXyNqqwCn7ai3S9oq7/Fh9saoRbJkDjHJsYvKPRON1bUAEC0MkyUcH2a ok+U/s0C+qYFjcPRkTBj8LyfXKzwm9EnZnCqjGxinSrPkm9RXKPbMhiefb9cUQLRSaRD FewGuSQwPVmAwoyOTBcefeCC1buAvM5JRcZoeAZWa2H6vUjF/nzVosLvUyozuFcrpjAC gsE+qWMW91l0YvCy4GQXcbalaue1W7EUD3wv3Lkbcgfs85Ndsp+fBemugaO0k4BDXVh5 fS3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708054674; x=1708659474; 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=yEyFCFdHHlQZ/CKt1fbFi+8lYhpJpVF6Z0sukUpRvLk=; b=NxEAvorTuhQmTKoJjO43CMKaFoLL5Z2NH3JNBUn1fE0/HnWWnlRDUXmWH6S+mDqPqr eVj3DB//2TE8MYKQwyr5pUNMQW09BS6V4z42k6SHLaaX3bTN1+EJu+JU8NliMIVjYm+O rHFG7G9U1cBKz7JqAxvy+LwqnBi2fDQtW5h1tKL1kxgVlakQFSWVh6ZV8h+8CtC9ZuJn h8LZbJG7CIEEPZifY1XRpvDWHBwdq8mlaQ74q3hQF+jO/7Fe7tv/iTybj+ZxKTxxnGTH fsM0Jqkprk7fRJRQTMmuVKwioh0pXd/m9jL+YDSsnFTwXWjDH2oo5hzB/Xb8FD8IjGVv wsxA== X-Gm-Message-State: AOJu0YyykNIe3MazzsjXm6D2+4blBX182rrju3Uv2Ruv0hAGYasaLbFs DohQI3OflV4c0TrIvDSFLzZJD2sWKv0+Sl/U6EHkQsZAM+1tXckllCp2D7/4mWHGkmCTYjpHEF9 O X-Google-Smtp-Source: AGHT+IEinZZaEeJFL9qIimU6Y3Jh79QbPKt6nVp+2ImRP+eZnLV1p1a1OyMLuB5aO1oJARqo239sIw== X-Received: by 2002:a17:903:2352:b0:1d9:bf90:2f1b with SMTP id c18-20020a170903235200b001d9bf902f1bmr4384390plh.53.1708054674218; Thu, 15 Feb 2024 19:37:54 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id x9-20020a170902e04900b001db561fa164sm1967871plx.25.2024.02.15.19.37.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 19:37:53 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Huisong Li Subject: [PATCH v2 1/3] examples/l2fwd-keepalive: don't use EAL logtype Date: Thu, 15 Feb 2024 19:36:17 -0800 Message-ID: <20240216033743.150800-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240216033743.150800-1-stephen@networkplumber.org> References: <20231211172437.61958-1-stephen@networkplumber.org> <20240216033743.150800-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 using printf() so just print errors to stderr. Signed-off-by: Stephen Hemminger Acked-by: Huisong Li Acked-by: Morten Brørup --- examples/l2fwd-keepalive/shm.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/examples/l2fwd-keepalive/shm.c b/examples/l2fwd-keepalive/shm.c index 7c7a9ea8ea3c..cbeeb511ef07 100644 --- a/examples/l2fwd-keepalive/shm.c +++ b/examples/l2fwd-keepalive/shm.c @@ -5,7 +5,6 @@ #include #include -#include #include #include "shm.h" @@ -28,28 +27,23 @@ struct rte_keepalive_shm *rte_keepalive_shm_create(void) 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)); + fprintf(stderr, "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)); + fprintf(stderr, "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)); + fprintf(stderr, "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", + fprintf(stderr, "Failed to setup SHM semaphore (%s)\n", strerror(errno)); munmap(ka_shm, sizeof(struct rte_keepalive_shm)); @@ -87,7 +81,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", + fprintf(stderr, "Semaphore check failed(%s)\n", strerror(errno)); return; } @@ -95,8 +89,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", + fprintf(stderr, "Failed to increment semaphore (%s)\n", strerror(errno)); } }