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 9B2B041C99; Tue, 14 Feb 2023 23:48:29 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7487242FFA; Tue, 14 Feb 2023 23:48:00 +0100 (CET) Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by mails.dpdk.org (Postfix) with ESMTP id 4A21242FC6 for ; Tue, 14 Feb 2023 23:47:56 +0100 (CET) Received: by mail-pj1-f54.google.com with SMTP id kk7-20020a17090b4a0700b00234463de251so246611pjb.3 for ; Tue, 14 Feb 2023 14:47:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; 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=3ldJ1TGJozc5mJEWZuOvXWpF5n6V+gym2v8kL89wnvo=; b=Z27QZ9+r5NTI8G5qlOSImzRSv5+0CJy9v4fYLn0j4eLEAeYgwo2sOqjjAeu1dFlJV3 Q1KRxXjWznSEqIutRuX+5G3lIcb1zPcF9NNVrhacJObkp/IhgKfEzhyS9u8JcHe4L85R 5FgKXgcKO0N+P1Dt0Bl26IIGjZ/K0Yg5JYSYsHVwjlvKxrzjCgoEJnxKRTChnjF9tKGk v1UJirpJbX8jzG2hDnD1D9h1DoS+u8tKCR9QX2EQZOWEt/g5eeUBIYgg9d8Mgj2ne9IY G1gWYKhKcMTvo2tWjnZhltiXem7NSOeCLcHb01CQ/zKiuH3mqsWd0dXuVtQl0jPeLId3 XWeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=3ldJ1TGJozc5mJEWZuOvXWpF5n6V+gym2v8kL89wnvo=; b=a6YlDwrwIXXAX+BIZiVYb7Tq3kXaVwb1WZ2AOYqweoNVrTA+n9Bqq1uooywU9eh31o mYtby1njVj7ZO6ngopSWe2o6cQAJY0mcYnQXCS5NaBKQi7ooQqRCRVF+vuh9iogh03qA u3iqGPtr865gq2yLTmBpEZSacP2QSUReNkOFBAq+Usc99tPfSvM8DQp7ADtiP8qGo0re djW7xRPHUx1cdu/XoR6WPKUieFF3zWN2GITxyYAxbKjvaYxdomCxeLf0lwjCzqobqgCP WJXaeYohKHXlVicE6nK2CpIkuFhZMpVzVT/zov/Aj9fXt5Ph2g17IfyWkg7kZwnTOWXU Ituw== X-Gm-Message-State: AO0yUKWxvl38cur49HLG9uICqY9Dk8H0rr57kqaeDn8w/NxGo1LFB91v oGzI7k+iOvwaq1WcfZT9kAi/Kc9qm4p4hbkCixg= X-Google-Smtp-Source: AK7set/G+q6TcpROpSRbgSLK9G21uxfDpCwYNo/cCk6s7EnEbDYboG8oeL2OiRAbqlYLNo0O+Us8vQ== X-Received: by 2002:a17:902:d501:b0:196:704e:2c9a with SMTP id b1-20020a170902d50100b00196704e2c9amr425859plg.22.1676414875093; Tue, 14 Feb 2023 14:47:55 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id u9-20020a17090341c900b0019607984a5esm10735785ple.95.2023.02.14.14.47.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 14:47:54 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Konstantin Ananyev Subject: [PATCH v6 06/22] acl: replace LOGTYPE_ACL with dynamic type Date: Tue, 14 Feb 2023 14:47:19 -0800 Message-Id: <20230214224735.1404326-7-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214224735.1404326-1-stephen@networkplumber.org> References: <20230207204151.1503491-1-stephen@networkplumber.org> <20230214224735.1404326-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 Get rid of RTE_LOGTYPE_ACL and RTE_LOGTYPE_MALLOC. For ACL library use a dynamic type. The one message using RTE_LOGTYPE_MALLOC should have been under the ACL logtype anyway. The test code should not have been using fixed log type so just change that to stderr. Signed-off-by: Stephen Hemminger --- app/test/test_acl.c | 3 ++- lib/acl/acl_bld.c | 1 + lib/acl/acl_gen.c | 1 + lib/acl/acl_log.h | 4 ++++ lib/acl/rte_acl.c | 4 ++++ lib/acl/tb_mem.c | 3 ++- lib/eal/common/eal_common_log.c | 2 -- lib/eal/include/rte_log.h | 4 ++-- 8 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 lib/acl/acl_log.h diff --git a/app/test/test_acl.c b/app/test/test_acl.c index 623f34682e69..75588978a720 100644 --- a/app/test/test_acl.c +++ b/app/test/test_acl.c @@ -154,7 +154,8 @@ rte_acl_ipv4vlan_add_rules(struct rte_acl_ctx *ctx, for (i = 0; i != num; i++) { rc = acl_ipv4vlan_check_rule(rules + i); if (rc != 0) { - RTE_LOG(ERR, ACL, "%s: rule #%u is invalid\n", + fprintf(stderr, + "%s: rule #%u is invalid\n", __func__, i + 1); return rc; } diff --git a/lib/acl/acl_bld.c b/lib/acl/acl_bld.c index 2816632803bd..f38e6478315f 100644 --- a/lib/acl/acl_bld.c +++ b/lib/acl/acl_bld.c @@ -5,6 +5,7 @@ #include #include "tb_mem.h" #include "acl.h" +#include "acl_log.h" #define ACL_POOL_ALIGN 8 #define ACL_POOL_ALLOC_MIN 0x800000 diff --git a/lib/acl/acl_gen.c b/lib/acl/acl_gen.c index e759a2ca1598..54ec485d0c58 100644 --- a/lib/acl/acl_gen.c +++ b/lib/acl/acl_gen.c @@ -4,6 +4,7 @@ #include #include "acl.h" +#include "acl_log.h" #define QRANGE_MIN ((uint8_t)INT8_MIN) diff --git a/lib/acl/acl_log.h b/lib/acl/acl_log.h new file mode 100644 index 000000000000..b55573cbe207 --- /dev/null +++ b/lib/acl/acl_log.h @@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +extern int acl_logtype; +#define RTE_LOGTYPE_ACL acl_logtype diff --git a/lib/acl/rte_acl.c b/lib/acl/rte_acl.c index a61c3ba188da..a29decb1f6ca 100644 --- a/lib/acl/rte_acl.c +++ b/lib/acl/rte_acl.c @@ -6,8 +6,12 @@ #include #include #include +#include #include "acl.h" +#include "acl_log.h" + +RTE_LOG_REGISTER_DEFAULT(acl_logtype, INFO); TAILQ_HEAD(rte_acl_list, rte_tailq_entry); diff --git a/lib/acl/tb_mem.c b/lib/acl/tb_mem.c index f14d7b4fa26e..6a9d96aaeda2 100644 --- a/lib/acl/tb_mem.c +++ b/lib/acl/tb_mem.c @@ -3,6 +3,7 @@ */ #include "tb_mem.h" +#include "acl_log.h" /* * Memory management routines for temporary memory. @@ -25,7 +26,7 @@ tb_pool(struct tb_mem_pool *pool, size_t sz) size = sz + pool->alignment - 1; block = calloc(1, size + sizeof(*pool->block)); if (block == NULL) { - RTE_LOG(ERR, MALLOC, "%s(%zu)\n failed, currently allocated " + RTE_LOG(ERR, ACL, "%s(%zu)\n failed, currently allocated " "by pool: %zu bytes\n", __func__, sz, pool->alloc); siglongjmp(pool->fail, -ENOMEM); return NULL; diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c index d4389e436913..9e853addb717 100644 --- a/lib/eal/common/eal_common_log.c +++ b/lib/eal/common/eal_common_log.c @@ -349,14 +349,12 @@ struct logtype { static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL, "lib.eal"}, - {RTE_LOGTYPE_MALLOC, "lib.malloc"}, {RTE_LOGTYPE_RING, "lib.ring"}, {RTE_LOGTYPE_MEMPOOL, "lib.mempool"}, {RTE_LOGTYPE_PMD, "pmd"}, {RTE_LOGTYPE_HASH, "lib.hash"}, {RTE_LOGTYPE_LPM, "lib.lpm"}, {RTE_LOGTYPE_KNI, "lib.kni"}, - {RTE_LOGTYPE_ACL, "lib.acl"}, {RTE_LOGTYPE_POWER, "lib.power"}, {RTE_LOGTYPE_METER, "lib.meter"}, {RTE_LOGTYPE_SCHED, "lib.sched"}, diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h index 941fbe51fd30..1408722b2c2f 100644 --- a/lib/eal/include/rte_log.h +++ b/lib/eal/include/rte_log.h @@ -27,7 +27,7 @@ extern "C" { /* SDK log type */ #define RTE_LOGTYPE_EAL 0 /**< Log related to eal. */ -#define RTE_LOGTYPE_MALLOC 1 /**< Log related to malloc. */ + /* was RTE_LOGTYPE_MALLOC */ #define RTE_LOGTYPE_RING 2 /**< Log related to ring. */ #define RTE_LOGTYPE_MEMPOOL 3 /**< Log related to mempool. */ /* was RTE_LOGTYPE_TIMER */ @@ -35,7 +35,7 @@ extern "C" { #define RTE_LOGTYPE_HASH 6 /**< Log related to hash table. */ #define RTE_LOGTYPE_LPM 7 /**< Log related to LPM. */ #define RTE_LOGTYPE_KNI 8 /**< Log related to KNI. */ -#define RTE_LOGTYPE_ACL 9 /**< Log related to ACL. */ + /* was RTE_LOGTYPE_ACL */ #define RTE_LOGTYPE_POWER 10 /**< Log related to power. */ #define RTE_LOGTYPE_METER 11 /**< Log related to QoS meter. */ #define RTE_LOGTYPE_SCHED 12 /**< Log related to QoS port scheduler. */ -- 2.39.1