From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
sergio.gonzalez.monroy@intel.com,
Reshma Pattan <reshma.pattan@intel.com>,
Declan Doherty <declan.doherty@intel.com>,
Neil Horman <nhorman@tuxdriver.com>,
Richardson Bruce <bruce.richardson@intel.com>
Subject: [PATCH 2/5] reorder: use a dynamic logtype
Date: Tue, 7 Feb 2023 20:48:22 -0800 [thread overview]
Message-ID: <20230208044825.1682620-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20230208044825.1682620-1-stephen@networkplumber.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 <stephen@networkplumber.org>
---
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
next prev parent reply other threads:[~2023-02-08 4:48 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-08 4:48 [PATCH 0/5] Fix use of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
2023-02-08 4:48 ` [PATCH 1/5] ip_frag: use a dynamic logtype Stephen Hemminger
2023-02-08 23:52 ` Konstantin Ananyev
2023-02-08 4:48 ` Stephen Hemminger [this message]
2023-02-08 4:48 ` [PATCH 3/5] latencystats: use " Stephen Hemminger
2023-02-08 4:48 ` [PATCH 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1 Stephen Hemminger
2023-02-09 7:19 ` Xia, Chenbo
2023-02-08 4:48 ` [PATCH 5/5] ipsec: fix usage " Stephen Hemminger
2023-02-10 0:22 ` [PATCH v3 0/5] Replace use of RTE_LOGTYPE_USER1 in library Stephen Hemminger
2023-02-10 0:22 ` [PATCH v3 1/5] ip_frag: use a dynamic logtype Stephen Hemminger
2023-02-10 0:22 ` [PATCH v3 2/5] reorder: " Stephen Hemminger
2023-02-10 0:22 ` [PATCH v3 3/5] latencystats: use " Stephen Hemminger
2023-02-10 0:22 ` [PATCH v3 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1 Stephen Hemminger
2023-02-10 9:58 ` Maxime Coquelin
2023-02-10 0:22 ` [PATCH v3 5/5] ipsec: fix usage " Stephen Hemminger
2023-02-10 17:15 ` [PATCH v4 0/5] Replace use of RTE_LOGTYPE_USER1 in library Stephen Hemminger
2023-02-10 17:15 ` [PATCH v4 1/5] ip_frag: use a dynamic logtype Stephen Hemminger
2023-02-10 17:15 ` [PATCH v4 2/5] reorder: " Stephen Hemminger
2023-02-10 17:15 ` [PATCH v4 3/5] latencystats: use " Stephen Hemminger
2023-02-10 17:15 ` [PATCH v4 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1 Stephen Hemminger
2023-02-10 17:15 ` [PATCH v4 5/5] ipsec: fix usage " Stephen Hemminger
2023-02-12 16:14 ` [PATCH 0/5] Replace us of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
2023-02-12 16:14 ` [PATCH 1/5] ip_frag: use a dynamic logtype Stephen Hemminger
2023-02-12 16:14 ` [PATCH 2/5] reorder: " Stephen Hemminger
2023-02-12 16:14 ` [PATCH 3/5] latencystats: use " Stephen Hemminger
2023-02-12 16:14 ` [PATCH 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1 Stephen Hemminger
2023-02-12 16:14 ` [PATCH 5/5] ipsec: fix usage " Stephen Hemminger
2023-02-20 18:49 ` [PATCH v6 0/5] Replace use of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
2023-02-20 18:49 ` [PATCH v6 1/5] ip_frag: use a dynamic logtype Stephen Hemminger
2023-02-21 10:41 ` David Marchand
2023-02-20 18:49 ` [PATCH v6 2/5] reorder: " Stephen Hemminger
2023-02-20 18:49 ` [PATCH v6 3/5] latencystats: use " Stephen Hemminger
2023-02-20 18:50 ` [PATCH v6 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1 Stephen Hemminger
2023-02-21 10:39 ` David Marchand
2023-02-20 18:50 ` [PATCH v6 5/5] ipsec: fix usage " Stephen Hemminger
2023-02-21 10:42 ` [PATCH v6 0/5] Replace use of RTE_LOGTYPE_USER1 in libraries David Marchand
2023-02-21 18:46 ` Stephen Hemminger
2023-08-14 16:31 ` [PATCH v8 0/6] Convert " Stephen Hemminger
2023-08-14 16:31 ` [PATCH v8 1/6] ip_frag: use a dynamic logtype Stephen Hemminger
2023-12-01 8:10 ` David Marchand
2023-12-01 12:16 ` Konstantin Ananyev
2023-12-01 13:11 ` David Marchand
2023-08-14 16:31 ` [PATCH v8 2/6] reorder: " Stephen Hemminger
2023-08-16 8:29 ` [EXT] " Volodymyr Fialko
2023-08-14 16:31 ` [PATCH v8 3/6] latencystats: use " Stephen Hemminger
2023-08-14 16:31 ` [PATCH v8 4/6] vhost: use logtype instead of RTE_LOGTYPE_USER1 Stephen Hemminger
2023-08-14 16:31 ` [PATCH v8 5/6] ipsec: fix usage " Stephen Hemminger
2023-08-14 16:31 ` [PATCH v8 6/6] power: use a dynamic logtype for guest channel Stephen Hemminger
2023-08-14 17:41 ` [PATCH v8 0/6] Convert use of RTE_LOGTYPE_USER1 in libraries Morten Brørup
2023-12-04 12:25 ` David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230208044825.1682620-3-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=bruce.richardson@intel.com \
--cc=declan.doherty@intel.com \
--cc=dev@dpdk.org \
--cc=nhorman@tuxdriver.com \
--cc=reshma.pattan@intel.com \
--cc=sergio.gonzalez.monroy@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).