From patchwork Tue Feb 21 18:55:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 124306 X-Patchwork-Delegate: thomas@monjalon.net 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 01AC641D31; Tue, 21 Feb 2023 19:56:05 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D748241133; Tue, 21 Feb 2023 19:56:00 +0100 (CET) Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by mails.dpdk.org (Postfix) with ESMTP id 2F1A940691 for ; Tue, 21 Feb 2023 19:55:58 +0100 (CET) Received: by mail-pj1-f50.google.com with SMTP id d1-20020a17090a3b0100b00229ca6a4636so6207736pjc.0 for ; Tue, 21 Feb 2023 10:55:58 -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=V9Fgv9pn9Mh6JrbFl9Q/tkwtdGEGVwXHhKwwcv4gMUM=; b=WiQQk3S1M+2pBP/8IbpVqo3SYhbXMtZrWxhO90CoOVFFe943slXmboEk/Lkyebwabf T4hzsZ3P0GS3XDVAYFYDMdLixc+xtNV9YQ1b+epRLP2lxiE9P8106W5jyPv1mI3gzI8h PU4VmtB/smVEqUVENAZ5AEOyeyR+nIH1x7iPhsPXwlQ5UPVhKvQD3H7w2EGurkuXw2FK /1GFsOvVKxn+B1MPcxYyzArteqWJ5t7hsCUtHDAm5vNeq9TdTkElBYGnWkmpwPsqQwPL Zv827G7eowhzGmT4lXSaPQSL4IpuV6HMLw/dWjSupBCEUVpFkqqjaIBzpHltHlBIJGwS pt3Q== 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=V9Fgv9pn9Mh6JrbFl9Q/tkwtdGEGVwXHhKwwcv4gMUM=; b=E5deY0CTVDEFJqC83zuCx/0ptV7f5VHJOLyKjDrfj+3/FRJF57HmBX0tatCHN2nE0p jRLzhwGch/sm7et/YRZwzdJqoXBe+RAvzxVe381/LlXDL8Odnpx+QOB5kx2TEEEjL6/x Np9hbnU5h5gR5JV5WeHNHqAZichtAOKcd1cDPihIxZ88icIdr54PY0hhirwqRBwq3sRz KSudochb3JYluOSCpNq9K+kPGVPxaY0IWTfEUVONKIHga9vxXmSjjkXvo2FaeuX0wNpW 2sDdfZoDtn3tgvXg8w6ecH9mvWIqjRvjw402wNsY8wO1fi+e4zc6T4wJrSplhVYiqkOq eduw== X-Gm-Message-State: AO0yUKU5ui/EJdIlEq6U2PG/ZykYpZzSMDfabIQKkhWx+I/wxuqyVF51 hn1qpLLaXhOCfrKla0/psjAFtomakg+nOcEfyfE= X-Google-Smtp-Source: AK7set+2CEVnzuFPXIFbHVfNK9BLhYyPqpZz70Tq/doJrw9XDTGwa8tf6IXl8vOHlChPMJEkG8EBdA== X-Received: by 2002:a17:902:d2c4:b0:196:3db5:c08b with SMTP id n4-20020a170902d2c400b001963db5c08bmr8220475plc.69.1677005757032; Tue, 21 Feb 2023 10:55:57 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id iz15-20020a170902ef8f00b00189c4b8ca21sm6357895plb.18.2023.02.21.10.55.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 10:55:56 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Konstantin Ananyev Subject: [PATCH v7 1/5] ip_frag: use a dynamic logtype Date: Tue, 21 Feb 2023 10:55:49 -0800 Message-Id: <20230221185553.513432-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230221185553.513432-1-stephen@networkplumber.org> References: <0230208044825.1682620-1-stephen@networkplumber.org> <20230221185553.513432-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 DPDK libraries should not be reusing RTE_LOGTYPE_USER1 in lieu of doing proper logtype registration. Acked-by: Konstantin Ananyev Fixes: 416707812c03 ("ip_frag: refactor reassembly code into a proper library") Signed-off-by: Stephen Hemminger --- lib/ip_frag/ip_frag_common.h | 5 ++++- lib/ip_frag/rte_ip_frag_common.c | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/ip_frag/ip_frag_common.h b/lib/ip_frag/ip_frag_common.h index 9c0dbdeb6eb9..95f1689d476d 100644 --- a/lib/ip_frag/ip_frag_common.h +++ b/lib/ip_frag/ip_frag_common.h @@ -8,9 +8,12 @@ #include "rte_ip_frag.h" #include "ip_reassembly.h" +extern int ipfrag_logtype; +#define RTE_LOGTYPE_IPFRAG ipfrag_logtype + /* logging macros. */ #ifdef RTE_LIBRTE_IP_FRAG_DEBUG -#define IP_FRAG_LOG(lvl, fmt, args...) RTE_LOG(lvl, USER1, fmt, ##args) +#define IP_FRAG_LOG(lvl, fmt, args...) RTE_LOG(lvl, IPFRAG, fmt, ##args) #else #define IP_FRAG_LOG(lvl, fmt, args...) do {} while(0) #endif /* IP_FRAG_DEBUG */ diff --git a/lib/ip_frag/rte_ip_frag_common.c b/lib/ip_frag/rte_ip_frag_common.c index c1de2e81b6d0..eed399da6bc5 100644 --- a/lib/ip_frag/rte_ip_frag_common.c +++ b/lib/ip_frag/rte_ip_frag_common.c @@ -7,6 +7,8 @@ #include +RTE_LOG_REGISTER_DEFAULT(ipfrag_logtype, INFO); + #include "ip_frag_common.h" #define IP_FRAG_HASH_FNUM 2 @@ -52,20 +54,20 @@ rte_ip_frag_table_create(uint32_t bucket_num, uint32_t bucket_entries, if (rte_is_power_of_2(bucket_entries) == 0 || nb_entries > UINT32_MAX || nb_entries == 0 || nb_entries < max_entries) { - RTE_LOG(ERR, USER1, "%s: invalid input parameter\n", __func__); + RTE_LOG(ERR, IPFRAG, "%s: invalid input parameter\n", __func__); return NULL; } sz = sizeof (*tbl) + nb_entries * sizeof (tbl->pkt[0]); if ((tbl = rte_zmalloc_socket(__func__, sz, RTE_CACHE_LINE_SIZE, socket_id)) == NULL) { - RTE_LOG(ERR, USER1, + RTE_LOG(ERR, IPFRAG, "%s: allocation of %zu bytes at socket %d failed do\n", __func__, sz, socket_id); return NULL; } - RTE_LOG(INFO, USER1, "%s: allocated of %zu bytes at socket %d\n", + RTE_LOG(INFO, IPFRAG, "%s: allocated of %zu bytes at socket %d\n", __func__, sz, socket_id); tbl->max_cycles = max_cycles;