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 4477541C37; Wed, 8 Feb 2023 05:48:44 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3427842B8C; Wed, 8 Feb 2023 05:48:34 +0100 (CET) Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by mails.dpdk.org (Postfix) with ESMTP id 9BC3F41151 for ; Wed, 8 Feb 2023 05:48:31 +0100 (CET) Received: by mail-pl1-f182.google.com with SMTP id g17so507408ply.11 for ; Tue, 07 Feb 2023 20:48:31 -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=v5OfJzc6k6o73cOmQarkhKJl6pC80Fc9LYhjueeKzUfxPKsmbXXnAczJ41eYni0LNt hobau4aXjZso2zGEfz6Lld76sL4QOEYVl9Ov5fwOUTACwKwfCJUJZdVXtHNlFHwgia0z o/AIiuTmbCXbdsBcGxYuUJbFzvfBu61eV+cvPkVtq2zSg5ZJ5s78sF3p0sobDIWWMxbQ c5L3+atDMAuuZF75ooyNejarwvb9XVAj+lE73KVeh2VaPwk56WmGHj1ToZJMY4L0Z+Bu qzbZ+yZtq9LjQmLGOHlvL7Pd5Gab4PzGTOtWKhXRJN+pVXxSu8PPFOzIzWzQicVWewlL /5Jw== 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=Ji7SF+iAJ8nXPIOPyct64ZavQLqOfMAZ4MfZUp+dXtOFBDb8B3psucuEx/bp4XebFx dcnCq5J9uw1XZyUqpY46Yi1+MIhRvdVidHSIkuaGCTOaykYq0h+a2U/bxlmVVyOSEvKP GF8GC5BrxB1T272t4lyzMdU2rjOYAhBvt+h5qidHoEYhjtDnbB6RzWxI1jS+SbOGsY/g bv1Y6DqT73rcVGoJyJu/NMZy5oJL949QdVbhBqDE6P/POcELj1p7rqCow3F5+JoOQLPB nRf9eMqtuEAXT8PcVeLU3JOApWKaCRYGyaIHD5m8BXXxYAUTbWGws1Tu+TvnvvEJD1IB 2xbg== X-Gm-Message-State: AO0yUKUd31637PXPDlQ8j/9fR5/ehCNC89tqoGxfhC7D1kZ2iSeUbtJ6 aCPdaO7ZrrB6wCroee1nfQIQjTPex3fz0CM+d+s= X-Google-Smtp-Source: AK7set8q5MHSsroK30ZfrJuU5EXGY6e66bFJVELYvE/naianQJe7YVnDme/g4Gv++ihzHpYarheU6w== X-Received: by 2002:a17:903:234a:b0:199:2353:1eff with SMTP id c10-20020a170903234a00b0019923531effmr7026374plh.21.1675831710448; Tue, 07 Feb 2023 20:48:30 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id bu14-20020a63294e000000b004dff15fc121sm8838641pgb.36.2023.02.07.20.48.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Feb 2023 20:48:29 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , sergio.gonzalez.monroy@intel.com, Reshma Pattan , Declan Doherty , Neil Horman , Richardson Bruce Subject: [PATCH 2/5] reorder: use a dynamic logtype Date: Tue, 7 Feb 2023 20:48:22 -0800 Message-Id: <20230208044825.1682620-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230208044825.1682620-1-stephen@networkplumber.org> References: <20230208044825.1682620-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