From patchwork Mon Dec 11 17:23:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 135043 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 30906436C8; Mon, 11 Dec 2023 18:25:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AB65642DB6; Mon, 11 Dec 2023 18:24:51 +0100 (CET) Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by mails.dpdk.org (Postfix) with ESMTP id D1E0242D7B for ; Mon, 11 Dec 2023 18:24:49 +0100 (CET) Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-6ce6b62746dso2836586b3a.2 for ; Mon, 11 Dec 2023 09:24:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1702315489; x=1702920289; 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=25ZoFARyOPtyYoPI2e1WyYevGR77sAKqv+bkoIW2fRE=; b=JLAlTtcomAicZ1T0ThspN13FfjGIct9zz05LZQflSGdV05+hhwCU1Gf0iJO3BRmlNE 5vn3L9fMUeGQKsyH3rUffjdOstZE1kBWINKipgmAVYCmKhm3drvWSnomi11bD67ViulZ CnsAEG3Y2+Rpl2e8cKquG+RdmFekUxkSVumEjGS1qVtYa/XdHAf2rsvU9Dr8Fc+v71ns Sqf5RAIMpor0J+oYktiOtfW88tsY+NLY9WNYObz+3QnTG1I9xcRtPZP5v928R1wvSvWF WTXZ3AYh8uqY0LYGtk43Xyc54arU3eQU22N0Qbm125lP2cMcjgpcSDI60mAzW/sMD7zX RiIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702315489; x=1702920289; 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=25ZoFARyOPtyYoPI2e1WyYevGR77sAKqv+bkoIW2fRE=; b=HBvxbzK/865DISAhebRSmV1T1/ZvZOV1oEXITy9Z6RpOCOhXB8VZk7yBCFL1Y5Io10 skyKdjloWU6Br2locLCCFmvMXi4II94fkqhRsDci+yRSg6oDpgefzfismcq2ub0zGPpS yW5Eg2Me6rTzWCsBqUZKO0xRlYyaKIAS8lyy1fPHVZ+TVrRK6wzY1cwVkflT1VSfRpSs pOYRl5FSdzLrt+r3A1XiroYubl9pnSH7446Sv+nPyWGppu8HJjboxo5UUYyE9cmgMne5 CAGeGt7RItcwQIi4aT+uyHuqU3JrHeZMqPh5hNyesTKRc8N3/6LyARlgHffvjKQhvERw /RGg== X-Gm-Message-State: AOJu0Yx4hmDyYRdHud3Mz/gI4iQAOCEi/PjpKyAUfbJtGKzfhCXzTt0B 7qbUAMfgBkLSkqb06ImuUJ6yUz3nvwUpwngs9SQ2qg== X-Google-Smtp-Source: AGHT+IG2pHjwrkZpTGBwOEn0tdelUn0zS8W1wl+d/r2xggey/zn7gJ3ikUMHm9qe+crPEAvw95DvXQ== X-Received: by 2002:aa7:8502:0:b0:6ce:2731:d5cb with SMTP id v2-20020aa78502000000b006ce2731d5cbmr1949971pfn.60.1702315488983; Mon, 11 Dec 2023 09:24:48 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id f16-20020aa782d0000000b006ce6878b274sm6494425pfn.216.2023.12.11.09.24.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 09:24:48 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH 2/3] examples/l2fwd-keepalive: don't use EAL logtype Date: Mon, 11 Dec 2023 09:23:24 -0800 Message-ID: <20231211172437.61958-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231211172437.61958-1-stephen@networkplumber.org> References: <20231211172437.61958-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 --- 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)); } }