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 171D041C50; Fri, 10 Feb 2023 18:16:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3159C42D0B; Fri, 10 Feb 2023 18:15:50 +0100 (CET) Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by mails.dpdk.org (Postfix) with ESMTP id BC077410D3 for ; Fri, 10 Feb 2023 18:15:47 +0100 (CET) Received: by mail-pj1-f41.google.com with SMTP id pj3so5845471pjb.1 for ; Fri, 10 Feb 2023 09:15:47 -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=KZgfsFOvebHmT9+dLkYUNEfM3BYjfInGf2AA4yLuCd4=; b=cpojYTc3Tb9zVNjO8MYZlxvPYwilXWSliMOIvc2uOl6qf8M1smG5GNFY6ABb5buXSA cyhGrARrCEf2b9GU7thRiJKTiqxMbWYuEwEPtvNu1IFIb/HWVcFQMn0hllTWeujBvffo MYC2NqWs7ldxl8wT1BTFdypwT/yzma1brpR2dBZ2T7FGDubhnL93yaS6sYiT0D6FYN/W LlLDeaqR2DnAoNoi8OKJKWGBZMyDcsPOdgkbTIsxrTBoV80VaFa8JkCyjGkbV9ZWeQCL wDZKX0poM1WO43gBk7zHl4+gobbjPul8M4RnGPmvZh9z/FJ1r0noxdIQeYqOnVk0Nw7k Kgqg== 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=KZgfsFOvebHmT9+dLkYUNEfM3BYjfInGf2AA4yLuCd4=; b=5StpW5VpUR7EBwugnXAphipyFLNoCQhoeT6SovmCaYIqF8aY9omiI0oHnO10MzhBw5 a4f19qLdfT+pCBzT/ckXlGXL2yAP3yiT2Li15aMjrguJ6DzRArtlrGY+5uo2kSD4zoNe CXv0Zf+1UgUidnOVC3l/lNCF4qR06bli3JGsDxJGceDNjARmov8P2yzdnDb8O8kTkBo2 aYqTpqyuxXCIT+YGOIo5zUgdbilQTis87W1azGnJcULDWCx9bGb89exe0XfOz+nCZ8AJ D3xHqdAeZhcazeOBI4dIs07yjh6qdzHzAWjlLqKne2NuOiztDOMXWHZES8i5OvhZ5vLe wV2Q== X-Gm-Message-State: AO0yUKUhWKApAQJz9TSVNYS7o7MKMVc+fE7dnEEJ2mmQtutDIq60DXgM h/sO5VpEitJoDXYETqbupAwk7mDz/wBy1TTJRu0= X-Google-Smtp-Source: AK7set/16Z3DUpFLzkHCRUFSRkJDy1flwVbcNZ0Bj729Q0q2Gam8CQpvpd+BsRxZQCAjvhHLc0AtGg== X-Received: by 2002:a17:903:3093:b0:19a:7e36:f507 with SMTP id u19-20020a170903309300b0019a7e36f507mr460453plc.16.1676049346918; Fri, 10 Feb 2023 09:15:46 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id c1-20020a170902b68100b0019a6e8ceb49sm1955669pls.259.2023.02.10.09.15.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Feb 2023 09:15:46 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , sergio.gonzalez.monroy@intel.com, Reshma Pattan , Declan Doherty , Richardson Bruce , Neil Horman Subject: [PATCH v4 2/5] reorder: use a dynamic logtype Date: Fri, 10 Feb 2023 09:15:39 -0800 Message-Id: <20230210171542.115434-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230210171542.115434-1-stephen@networkplumber.org> References: <20230208044825.1682620-1-stephen@networkplumber.org> <20230210171542.115434-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 Libraries should not be reusing RTE_LOGTYPE_USER1 instead of doing proper logtype registration. Fixes: b70b56032bff ("reorder: new library") Cc: sergio.gonzalez.monroy@intel.com Signed-off-by: Stephen Hemminger --- lib/reorder/rte_reorder.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/lib/reorder/rte_reorder.c b/lib/reorder/rte_reorder.c index 385ee479da42..c9ae42e71783 100644 --- a/lib/reorder/rte_reorder.c +++ b/lib/reorder/rte_reorder.c @@ -27,7 +27,11 @@ EAL_REGISTER_TAILQ(rte_reorder_tailq) #define RTE_REORDER_NAMESIZE 32 /* Macros for printing using RTE_LOG */ -#define RTE_LOGTYPE_REORDER RTE_LOGTYPE_USER1 +RTE_LOG_REGISTER_DEFAULT(reorder_logtype, INFO); + +#define REORDER_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, reorder_logtype, \ + "%s(): " fmt "\n", __func__, ##args) #define RTE_REORDER_SEQN_DYNFIELD_NAME "rte_reorder_seqn_dynfield" int rte_reorder_seqn_dynfield_offset = -1; @@ -62,26 +66,25 @@ rte_reorder_init(struct rte_reorder_buffer *b, unsigned int bufsize, (2 * size * sizeof(struct rte_mbuf *)); if (b == NULL) { - RTE_LOG(ERR, REORDER, "Invalid reorder buffer parameter:" - " NULL\n"); + REORDER_LOG(ERR, "Invalid reorder buffer parameter: NULL"); rte_errno = EINVAL; return NULL; } if (!rte_is_power_of_2(size)) { - RTE_LOG(ERR, REORDER, "Invalid reorder buffer size" - " - Not a power of 2\n"); + REORDER_LOG(ERR, + "Invalid reorder buffer size - Not a power of 2"); rte_errno = EINVAL; return NULL; } if (name == NULL) { - RTE_LOG(ERR, REORDER, "Invalid reorder buffer name ptr:" - " NULL\n"); + REORDER_LOG(ERR, "Invalid reorder buffer name ptr: NULL"); rte_errno = EINVAL; return NULL; } if (bufsize < min_bufsize) { - RTE_LOG(ERR, REORDER, "Invalid reorder buffer memory size: %u, " - "minimum required: %u\n", bufsize, min_bufsize); + REORDER_LOG(ERR, + "Invalid reorder buffer memory size: %u, minimum required: %u", + bufsize, min_bufsize); rte_errno = EINVAL; return NULL; } @@ -116,14 +119,13 @@ rte_reorder_create(const char *name, unsigned socket_id, unsigned int size) /* Check user arguments. */ if (!rte_is_power_of_2(size)) { - RTE_LOG(ERR, REORDER, "Invalid reorder buffer size" - " - Not a power of 2\n"); + REORDER_LOG(ERR, + "Invalid reorder buffer size - Not a power of 2"); rte_errno = EINVAL; return NULL; } if (name == NULL) { - RTE_LOG(ERR, REORDER, "Invalid reorder buffer name ptr:" - " NULL\n"); + REORDER_LOG(ERR, "Invalid reorder buffer name ptr: NULL"); rte_errno = EINVAL; return NULL; } @@ -131,7 +133,8 @@ rte_reorder_create(const char *name, unsigned socket_id, unsigned int size) rte_reorder_seqn_dynfield_offset = rte_mbuf_dynfield_register(&reorder_seqn_dynfield_desc); if (rte_reorder_seqn_dynfield_offset < 0) { - RTE_LOG(ERR, REORDER, "Failed to register mbuf field for reorder sequence number\n"); + REORDER_LOG(ERR, + "Failed to register mbuf field for reorder sequence number"); rte_errno = ENOMEM; return NULL; } @@ -150,7 +153,7 @@ rte_reorder_create(const char *name, unsigned socket_id, unsigned int size) /* allocate tailq entry */ te = rte_zmalloc("REORDER_TAILQ_ENTRY", sizeof(*te), 0); if (te == NULL) { - RTE_LOG(ERR, REORDER, "Failed to allocate tailq entry\n"); + REORDER_LOG(ERR, "Failed to allocate tailq entry"); rte_errno = ENOMEM; b = NULL; goto exit; @@ -159,7 +162,7 @@ rte_reorder_create(const char *name, unsigned socket_id, unsigned int size) /* Allocate memory to store the reorder buffer structure. */ b = rte_zmalloc_socket("REORDER_BUFFER", bufsize, 0, socket_id); if (b == NULL) { - RTE_LOG(ERR, REORDER, "Memzone allocation failed\n"); + REORDER_LOG(ERR, "Memzone allocation failed"); rte_errno = ENOMEM; rte_free(te); } else { -- 2.39.1