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 3420141C34; Wed, 8 Feb 2023 00:05:09 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6CF1042D0E; Wed, 8 Feb 2023 00:04:49 +0100 (CET) Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by mails.dpdk.org (Postfix) with ESMTP id 2ADC341153 for ; Wed, 8 Feb 2023 00:04:46 +0100 (CET) Received: by mail-pj1-f42.google.com with SMTP id o13so16585678pjg.2 for ; Tue, 07 Feb 2023 15:04:46 -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=jdIPPf16hsQ4qmaE7igDIzFnAzB6o2XOoTV+RnrCWALNwsBJTg060pWLda+kCxDuzn Yk2994636gmCxg/Gl7Ornt24MVx6m1P59EQdoctvEry0Tk48v9vClkVPaogXldhr9aWD Y3rzOn89M2lHBHfKNgYcZcXBo3u1MXes3UvFgzPhKjYyeVDZisDyM5+0ZQ5miXy/Ykcq jBvfV8eiDIBAFUqiFxljf7D9y++EHIV7HEvd/CVJbIFweSBy9Oc0GhoBSAcloCOSGlvJ s3svYrfVMOCDw9kffGEq0udnmfOiHpInFKrE9wHe64xdlah5a1+kYpQtVbakkDtbCrLZ A/AQ== 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=i4czgO3d8j+7gmq1WjKNqqq4IrLB38HL5ZXg8oNmDu7dgkrj/i1q/CfzIh5bQbCrzT dF1Y1/HfJ/4isNhrS1BJx91xb9rJhNyDLJPfHU7lhQIr929BRAheP06F6o8TJA8zBzD7 rtnlJgPMjxBURUZ1dHn47KHNizZMDhkE3awmgtWQoqPOtV4ksOgok5yc1VxBv+4hYyQ+ 0skY/bhNcmYJkocRVnMa8dGAC4qI0eDSAbmO+TO9Nm++4GwhRyxyUg7A5QoV/jOGAVKp PY1HeFL7+KzBLBZuGLNGMNuPmpUxi/Gb2BuSqeY4YonliEWb3KY8KPVJghSklza+ErjE CFDw== X-Gm-Message-State: AO0yUKWYg8aPVhkfQhv5QCW/Wnupv9WFLFQrutBJxJhdecmJDut37MtE 9XCYpkBVrLvkbS4JNlAtmP32/fMr/n/UgwECz4U= X-Google-Smtp-Source: AK7set9f8+kuHHktpfC0G+vwDZ98vPS/2+Y7H4BtRxhRafa+WTm+tT43GbBEg4d1L02Xc1/bIHQvmw== X-Received: by 2002:a17:90b:1bc8:b0:230:c6b8:87c0 with SMTP id oa8-20020a17090b1bc800b00230c6b887c0mr5798843pjb.31.1675811085009; Tue, 07 Feb 2023 15:04:45 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id gq17-20020a17090b105100b0020dc318a43esm71189pjb.25.2023.02.07.15.04.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Feb 2023 15:04:44 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , sergio.gonzalez.monroy@intel.com, Reshma Pattan , Neil Horman , Declan Doherty , Richardson Bruce Subject: [RFC v2 03/17] reorder: use a dynamic logtype Date: Tue, 7 Feb 2023 15:04:24 -0800 Message-Id: <20230207230438.1617331-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230207230438.1617331-1-stephen@networkplumber.org> References: <20230207204151.1503491-1-stephen@networkplumber.org> <20230207230438.1617331-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