From patchwork Mon Aug 14 16:31:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 130285 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 5C91143066; Mon, 14 Aug 2023 18:31:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ED292432A9; Mon, 14 Aug 2023 18:31:39 +0200 (CEST) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by mails.dpdk.org (Postfix) with ESMTP id F04A840A7F for ; Mon, 14 Aug 2023 18:31:37 +0200 (CEST) Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1bddac1b7bfso8626835ad.0 for ; Mon, 14 Aug 2023 09:31:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1692030697; x=1692635497; 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=39oi0XMZ/bSiInQ/m2Fwrvucyi+D0Ge2Q9c8CWxrhRc=; b=sUxWaezaz5phh1U5tbdcdx4xFG+pSdOaFbGo/LkXNQio1EjnevgPCITvA5w9NzAzza 07mT1IJlK7hLZtwS8LH+aIbJuOaRPHZ9VZOQL5zhm0uKgbqTengwjqy00k7R6IgQYhlr y07ZzjX/CJOC4X4E2UR6WcV6ZG8hyVWDn63hZ8tlUusM6n/2jjdC6LYSu86bZl4/1xta AeC5MRqmwcpBdwM6gCekQgae8d32edDhWqIFs6FYErCMzSSoVc/eZYHlCwXR4RQuZ1VW jMWagOnNqODb7S9ijnFAZGq4OLMkUEt6m2mqLJ/BYwyd/yl+7992+G30hu2D1UxbdL9c 8oyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692030697; x=1692635497; 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=39oi0XMZ/bSiInQ/m2Fwrvucyi+D0Ge2Q9c8CWxrhRc=; b=N5R4c/7FwdLsp+VDHLlOwPqZRoEcSmFbSj5ul7S+otaGrXIfrWAovjpR2NOhuA1Tf7 tYyKiofzhuWwxCf91CnYcYteAq60FnQ52mUDxsDq+KHbcVuV61x1XwMgTzAySF5NK0So bNeM1FTZZCK9lcUj4zfpLCIPVYmnOETA/Qao+KJxUT752NLfEnkhjBpxTLl46oFJP3cO POOfQBkRwpxzHQh/KrnWx9kOaAdHAfcNP3z6MMxZ32UPoAbPPsi0jnz8F+wAGgxGKoyj N/vKvGbrvKy6UOZnXEiWlA+LitsyRVuTSSIJUvJzCPYnUmjcJYiuOlE/UScTzkVrdkRq 24BA== X-Gm-Message-State: AOJu0YyyF74hAaYCRbBuqQvpEl7hHfkRbLYChfNFwjqxI3CMg09JAZf1 96AaR8qdS6m+QaFJBG0xf3hf9y9QKOJuogm+bm6ttTwPyw0= X-Google-Smtp-Source: AGHT+IFofbekXXZ7g8DtpiuSqvKl+hi6Pv0Pjzw/Ld45OP/fU28b8cME2Z0mEJ8BQaBTjbJcFzqjVQ== X-Received: by 2002:a17:902:d50c:b0:1bb:55be:e198 with SMTP id b12-20020a170902d50c00b001bb55bee198mr10856976plg.0.1692030696850; Mon, 14 Aug 2023 09:31:36 -0700 (PDT) Received: from hermes.local (204-195-127-207.wavecable.com. [204.195.127.207]) by smtp.gmail.com with ESMTPSA id t10-20020a170902bc4a00b001bdd51748f8sm3892743plz.271.2023.08.14.09.31.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Aug 2023 09:31:36 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Konstantin Ananyev , Anatoly Burakov , Thomas Monjalon Subject: [PATCH v8 1/6] ip_frag: use a dynamic logtype Date: Mon, 14 Aug 2023 09:31:20 -0700 Message-Id: <20230814163125.63033-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230814163125.63033-1-stephen@networkplumber.org> References: <20230208044825.1682620-1-stephen@networkplumber.org> <20230814163125.63033-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 7d6c1aa98d98..537bce7c3b62 100644 --- a/lib/ip_frag/ip_frag_common.h +++ b/lib/ip_frag/ip_frag_common.h @@ -18,9 +18,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;