* [PATCH 0/5] Fix use of RTE_LOGTYPE_USER1 in libraries.
@ 2023-02-08 4:48 Stephen Hemminger
2023-02-08 4:48 ` [PATCH 1/5] ip_frag: use a dynamic logtype Stephen Hemminger
` (9 more replies)
0 siblings, 10 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-08 4:48 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
This is split out of other rte_log patchset.
The DPDK libraries and drivers should not be using the USER1 logtype.
Stephen Hemminger (5):
ip_frag: use a dynamic logtype
reorder: use a dynamic logtype
latencystats: use dynamic logtype
vhost: use logtype instead of RTE_LOGTYPE_USER1
ipsec: fix usage of RTE_LOGTYPE_USER1
drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 3 +-
lib/ip_frag/ip_frag_common.h | 16 ++-
lib/ip_frag/ip_frag_internal.c | 174 ++++++++++++-------------
lib/ip_frag/rte_ip_frag_common.c | 13 +-
lib/ip_frag/rte_ipv4_reassembly.c | 14 +-
lib/ip_frag/rte_ipv6_reassembly.c | 59 ++++-----
lib/latencystats/rte_latencystats.c | 55 ++++----
lib/reorder/rte_reorder.c | 35 ++---
lib/vhost/fd_man.c | 16 ++-
lib/vhost/vhost_crypto.c | 24 ++--
10 files changed, 206 insertions(+), 203 deletions(-)
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 1/5] ip_frag: use a dynamic logtype
2023-02-08 4:48 [PATCH 0/5] Fix use of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
@ 2023-02-08 4:48 ` Stephen Hemminger
2023-02-08 23:52 ` Konstantin Ananyev
2023-02-08 4:48 ` [PATCH 2/5] reorder: " Stephen Hemminger
` (8 subsequent siblings)
9 siblings, 1 reply; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-08 4:48 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, Konstantin Ananyev, Anatoly Burakov, Thomas Monjalon
DPDK libraries should not be reusing RTE_LOGTYPE_USER1 in
lieu of doing proper logtype registration.
Fixes: 416707812c03 ("ip_frag: refactor reassembly code into a proper library")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/ip_frag/ip_frag_common.h | 16 ++-
lib/ip_frag/ip_frag_internal.c | 174 +++++++++++++++---------------
lib/ip_frag/rte_ip_frag_common.c | 13 +--
lib/ip_frag/rte_ipv4_reassembly.c | 14 ++-
lib/ip_frag/rte_ipv6_reassembly.c | 59 +++++-----
5 files changed, 138 insertions(+), 138 deletions(-)
diff --git a/lib/ip_frag/ip_frag_common.h b/lib/ip_frag/ip_frag_common.h
index 9c0dbdeb6eb9..134072f3e810 100644
--- a/lib/ip_frag/ip_frag_common.h
+++ b/lib/ip_frag/ip_frag_common.h
@@ -9,8 +9,16 @@
#include "ip_reassembly.h"
/* logging macros. */
+extern int ipfrag_logtype;
+
+#define IP_FRAG_ERR(fmt, args...) \
+ rte_log(RTE_LOG_ERR, ipfrag_logtype, \
+ "%s: " fmt "\n", __func__, ## args)
+
#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(RTE_LOG ## lvl, ipfrag_logtype, \
+ "%s: " fmt "\n", __func__, ## args)
#else
#define IP_FRAG_LOG(lvl, fmt, args...) do {} while(0)
#endif /* IP_FRAG_DEBUG */
@@ -111,9 +119,9 @@ ip_frag_free_immediate(struct ip_frag_pkt *fp)
for (i = 0; i < fp->last_idx; i++) {
if (fp->frags[i].mb != NULL) {
- IP_FRAG_LOG(DEBUG, "%s:%d\n"
- "mbuf: %p, tms: %" PRIu64", key: <%" PRIx64 ", %#x>\n",
- __func__, __LINE__, fp->frags[i].mb, fp->start,
+ IP_FRAG_LOG(DEBUG,
+ "mbuf: %p, tms: %" PRIu64", key: <%" PRIx64 ", %#x>",
+ fp->frags[i].mb, fp->start,
fp->key.src_dst[0], fp->key.id);
rte_pktmbuf_free(fp->frags[i].mb);
fp->frags[i].mb = NULL;
diff --git a/lib/ip_frag/ip_frag_internal.c b/lib/ip_frag/ip_frag_internal.c
index b436a4c9313b..c633216419a2 100644
--- a/lib/ip_frag/ip_frag_internal.c
+++ b/lib/ip_frag/ip_frag_internal.c
@@ -89,7 +89,7 @@ ipv6_frag_hash(const struct ip_frag_key *key, uint32_t *v1, uint32_t *v2)
struct rte_mbuf *
ip_frag_process(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr,
- struct rte_mbuf *mb, uint16_t ofs, uint16_t len, uint16_t more_frags)
+ struct rte_mbuf *mb, uint16_t ofs, uint16_t len, uint16_t more_frags)
{
uint32_t idx;
@@ -98,15 +98,15 @@ ip_frag_process(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr,
/* this is the first fragment. */
if (ofs == 0) {
idx = (fp->frags[IP_FIRST_FRAG_IDX].mb == NULL) ?
- IP_FIRST_FRAG_IDX : UINT32_MAX;
+ IP_FIRST_FRAG_IDX : UINT32_MAX;
- /* this is the last fragment. */
+ /* this is the last fragment. */
} else if (more_frags == 0) {
fp->total_size = ofs + len;
idx = (fp->frags[IP_LAST_FRAG_IDX].mb == NULL) ?
- IP_LAST_FRAG_IDX : UINT32_MAX;
+ IP_LAST_FRAG_IDX : UINT32_MAX;
- /* this is the intermediate fragment. */
+ /* this is the intermediate fragment. */
} else if ((idx = fp->last_idx) < RTE_DIM(fp->frags)) {
fp->last_idx++;
}
@@ -119,31 +119,31 @@ ip_frag_process(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr,
/* report an error. */
if (fp->key.key_len == IPV4_KEYLEN)
- IP_FRAG_LOG(DEBUG, "%s:%d invalid fragmented packet:\n"
- "ipv4_frag_pkt: %p, key: <%" PRIx64 ", %#x>, "
- "total_size: %u, frag_size: %u, last_idx: %u\n"
- "first fragment: ofs: %u, len: %u\n"
- "last fragment: ofs: %u, len: %u\n\n",
- __func__, __LINE__,
- fp, fp->key.src_dst[0], fp->key.id,
- fp->total_size, fp->frag_size, fp->last_idx,
- fp->frags[IP_FIRST_FRAG_IDX].ofs,
- fp->frags[IP_FIRST_FRAG_IDX].len,
- fp->frags[IP_LAST_FRAG_IDX].ofs,
- fp->frags[IP_LAST_FRAG_IDX].len);
+ IP_FRAG_LOG(DEBUG,
+ "invalid fragmented packet:\n"
+ "ipv4_frag_pkt: %p, key: <%" PRIx64 ", %#x>, "
+ "total_size: %u, frag_size: %u, last_idx: %u\n"
+ "first fragment: ofs: %u, len: %u\n"
+ "last fragment: ofs: %u, len: %u\n",
+ fp, fp->key.src_dst[0], fp->key.id,
+ fp->total_size, fp->frag_size, fp->last_idx,
+ fp->frags[IP_FIRST_FRAG_IDX].ofs,
+ fp->frags[IP_FIRST_FRAG_IDX].len,
+ fp->frags[IP_LAST_FRAG_IDX].ofs,
+ fp->frags[IP_LAST_FRAG_IDX].len);
else
- IP_FRAG_LOG(DEBUG, "%s:%d invalid fragmented packet:\n"
- "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, "
- "total_size: %u, frag_size: %u, last_idx: %u\n"
- "first fragment: ofs: %u, len: %u\n"
- "last fragment: ofs: %u, len: %u\n\n",
- __func__, __LINE__,
- fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id,
- fp->total_size, fp->frag_size, fp->last_idx,
- fp->frags[IP_FIRST_FRAG_IDX].ofs,
- fp->frags[IP_FIRST_FRAG_IDX].len,
- fp->frags[IP_LAST_FRAG_IDX].ofs,
- fp->frags[IP_LAST_FRAG_IDX].len);
+ IP_FRAG_LOG(DEBUG,
+ "invalid fragmented packet:\n"
+ "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, "
+ "total_size: %u, frag_size: %u, last_idx: %u\n"
+ "first fragment: ofs: %u, len: %u\n"
+ "last fragment: ofs: %u, len: %u\n",
+ fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id,
+ fp->total_size, fp->frag_size, fp->last_idx,
+ fp->frags[IP_FIRST_FRAG_IDX].ofs,
+ fp->frags[IP_FIRST_FRAG_IDX].len,
+ fp->frags[IP_LAST_FRAG_IDX].ofs,
+ fp->frags[IP_LAST_FRAG_IDX].len);
/* free all fragments, invalidate the entry. */
ip_frag_free(fp, dr);
@@ -163,9 +163,9 @@ ip_frag_process(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr,
if (likely (fp->frag_size < fp->total_size)) {
return mb;
- /* if we collected all fragments, then try to reassemble. */
+ /* if we collected all fragments, then try to reassemble. */
} else if (fp->frag_size == fp->total_size &&
- fp->frags[IP_FIRST_FRAG_IDX].mb != NULL) {
+ fp->frags[IP_FIRST_FRAG_IDX].mb != NULL) {
if (fp->key.key_len == IPV4_KEYLEN)
mb = ipv4_frag_reassemble(fp);
else
@@ -177,31 +177,31 @@ ip_frag_process(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr,
/* report an error. */
if (fp->key.key_len == IPV4_KEYLEN)
- IP_FRAG_LOG(DEBUG, "%s:%d invalid fragmented packet:\n"
- "ipv4_frag_pkt: %p, key: <%" PRIx64 ", %#x>, "
- "total_size: %u, frag_size: %u, last_idx: %u\n"
- "first fragment: ofs: %u, len: %u\n"
- "last fragment: ofs: %u, len: %u\n\n",
- __func__, __LINE__,
- fp, fp->key.src_dst[0], fp->key.id,
- fp->total_size, fp->frag_size, fp->last_idx,
- fp->frags[IP_FIRST_FRAG_IDX].ofs,
- fp->frags[IP_FIRST_FRAG_IDX].len,
- fp->frags[IP_LAST_FRAG_IDX].ofs,
- fp->frags[IP_LAST_FRAG_IDX].len);
+ IP_FRAG_LOG(DEBUG,
+ "invalid fragmented packet:\n"
+ "ipv4_frag_pkt: %p, key: <%" PRIx64 ", %#x>, "
+ "total_size: %u, frag_size: %u, last_idx: %u\n"
+ "first fragment: ofs: %u, len: %u\n"
+ "last fragment: ofs: %u, len: %u\n,
+ fp, fp->key.src_dst[0], fp->key.id,
+ fp->total_size, fp->frag_size, fp->last_idx,
+ fp->frags[IP_FIRST_FRAG_IDX].ofs,
+ fp->frags[IP_FIRST_FRAG_IDX].len,
+ fp->frags[IP_LAST_FRAG_IDX].ofs,
+ fp->frags[IP_LAST_FRAG_IDX].len);
else
- IP_FRAG_LOG(DEBUG, "%s:%d invalid fragmented packet:\n"
- "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, "
- "total_size: %u, frag_size: %u, last_idx: %u\n"
- "first fragment: ofs: %u, len: %u\n"
- "last fragment: ofs: %u, len: %u\n\n",
- __func__, __LINE__,
- fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id,
- fp->total_size, fp->frag_size, fp->last_idx,
- fp->frags[IP_FIRST_FRAG_IDX].ofs,
- fp->frags[IP_FIRST_FRAG_IDX].len,
- fp->frags[IP_LAST_FRAG_IDX].ofs,
- fp->frags[IP_LAST_FRAG_IDX].len);
+ IP_FRAG_LOG(DEBUG,
+ "invalid fragmented packet:\n"
+ "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, "
+ "total_size: %u, frag_size: %u, last_idx: %u\n"
+ "first fragment: ofs: %u, len: %u\n"
+ "last fragment: ofs: %u, len: %u\n",
+ fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id,
+ fp->total_size, fp->frag_size, fp->last_idx,
+ fp->frags[IP_FIRST_FRAG_IDX].ofs,
+ fp->frags[IP_FIRST_FRAG_IDX].len,
+ fp->frags[IP_LAST_FRAG_IDX].ofs,
+ fp->frags[IP_LAST_FRAG_IDX].len);
/* free associated resources. */
ip_frag_free(fp, dr);
@@ -282,8 +282,8 @@ ip_frag_find(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr,
struct ip_frag_pkt *
ip_frag_lookup(struct rte_ip_frag_tbl *tbl,
- const struct ip_frag_key *key, uint64_t tms,
- struct ip_frag_pkt **free, struct ip_frag_pkt **stale)
+ const struct ip_frag_key *key, uint64_t tms,
+ struct ip_frag_pkt **free, struct ip_frag_pkt **stale)
{
struct ip_frag_pkt *p1, *p2;
struct ip_frag_pkt *empty, *old;
@@ -310,23 +310,21 @@ ip_frag_lookup(struct rte_ip_frag_tbl *tbl,
for (i = 0; i != assoc; i++) {
if (p1->key.key_len == IPV4_KEYLEN)
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
- "tbl: %p, max_entries: %u, use_entries: %u\n"
- "ipv4_frag_pkt line0: %p, index: %u from %u\n"
- "key: <%" PRIx64 ", %#x>, start: %" PRIu64 "\n",
- __func__, __LINE__,
- tbl, tbl->max_entries, tbl->use_entries,
- p1, i, assoc,
- p1[i].key.src_dst[0], p1[i].key.id, p1[i].start);
+ IP_FRAG_LOG(DEBUG,
+ "tbl: %p, max_entries: %u, use_entries: %u\n"
+ "ipv4_frag_pkt line0: %p, index: %u from %u\n"
+ "key: <%" PRIx64 ", %#x>, start: %" PRIu64,
+ tbl, tbl->max_entries, tbl->use_entries,
+ p1, i, assoc,
+ p1[i].key.src_dst[0], p1[i].key.id, p1[i].start);
else
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
- "tbl: %p, max_entries: %u, use_entries: %u\n"
- "ipv6_frag_pkt line0: %p, index: %u from %u\n"
- "key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64 "\n",
- __func__, __LINE__,
- tbl, tbl->max_entries, tbl->use_entries,
- p1, i, assoc,
- IPv6_KEY_BYTES(p1[i].key.src_dst), p1[i].key.id, p1[i].start);
+ IP_FRAG_LOG(DEBUG,
+ "tbl: %p, max_entries: %u, use_entries: %u\n"
+ "ipv6_frag_pkt line0: %p, index: %u from %u\n"
+ "key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64,
+ tbl, tbl->max_entries, tbl->use_entries,
+ p1, i, assoc,
+ IPv6_KEY_BYTES(p1[i].key.src_dst), p1[i].key.id, p1[i].start);
if (ip_frag_key_cmp(key, &p1[i].key) == 0)
return p1 + i;
@@ -336,23 +334,21 @@ ip_frag_lookup(struct rte_ip_frag_tbl *tbl,
old = (old == NULL) ? (p1 + i) : old;
if (p2->key.key_len == IPV4_KEYLEN)
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
- "tbl: %p, max_entries: %u, use_entries: %u\n"
- "ipv4_frag_pkt line1: %p, index: %u from %u\n"
- "key: <%" PRIx64 ", %#x>, start: %" PRIu64 "\n",
- __func__, __LINE__,
- tbl, tbl->max_entries, tbl->use_entries,
- p2, i, assoc,
- p2[i].key.src_dst[0], p2[i].key.id, p2[i].start);
+ IP_FRAG_LOG(DEBUG,
+ "tbl: %p, max_entries: %u, use_entries: %u\n"
+ "ipv4_frag_pkt line1: %p, index: %u from %u\n"
+ "key: <%" PRIx64 ", %#x>, start: %" PRIu64,
+ tbl, tbl->max_entries, tbl->use_entries,
+ p2, i, assoc,
+ p2[i].key.src_dst[0], p2[i].key.id, p2[i].start);
else
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
- "tbl: %p, max_entries: %u, use_entries: %u\n"
- "ipv6_frag_pkt line1: %p, index: %u from %u\n"
- "key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64 "\n",
- __func__, __LINE__,
- tbl, tbl->max_entries, tbl->use_entries,
- p2, i, assoc,
- IPv6_KEY_BYTES(p2[i].key.src_dst), p2[i].key.id, p2[i].start);
+ IP_FRAG_LOG(DEBUG,
+ "tbl: %p, max_entries: %u, use_entries: %u\n"
+ "ipv6_frag_pkt line1: %p, index: %u from %u\n"
+ "key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64,
+ tbl, tbl->max_entries, tbl->use_entries,
+ p2, i, assoc,
+ IPv6_KEY_BYTES(p2[i].key.src_dst), p2[i].key.id, p2[i].start);
if (ip_frag_key_cmp(key, &p2[i].key) == 0)
return p2 + i;
diff --git a/lib/ip_frag/rte_ip_frag_common.c b/lib/ip_frag/rte_ip_frag_common.c
index c1de2e81b6d0..b8ca9e019c54 100644
--- a/lib/ip_frag/rte_ip_frag_common.c
+++ b/lib/ip_frag/rte_ip_frag_common.c
@@ -52,21 +52,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__);
+ IP_FRAG_ERR("invalid input parameter");
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,
- "%s: allocation of %zu bytes at socket %d failed do\n",
- __func__, sz, socket_id);
+ IP_FRAG_ERR("allocation of %zu bytes at socket %d failed do",
+ sz, socket_id);
return NULL;
}
- RTE_LOG(INFO, USER1, "%s: allocated of %zu bytes at socket %d\n",
- __func__, sz, socket_id);
+ IP_FRAG_LOG(INFO, "allocated of %zu bytes at socket %d",
+ sz, socket_id);
tbl->max_cycles = max_cycles;
tbl->max_entries = max_entries;
@@ -142,3 +141,5 @@ rte_ip_frag_table_del_expired_entries(struct rte_ip_frag_tbl *tbl,
} else
return;
}
+
+RTE_LOG_REGISTER_DEFAULT(ipfrag_logtype, INFO);
diff --git a/lib/ip_frag/rte_ipv4_reassembly.c b/lib/ip_frag/rte_ipv4_reassembly.c
index 4a89a5f5365a..2cdbdc4ee87f 100644
--- a/lib/ip_frag/rte_ipv4_reassembly.c
+++ b/lib/ip_frag/rte_ipv4_reassembly.c
@@ -120,12 +120,11 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
ip_len = rte_be_to_cpu_16(ip_hdr->total_length) - mb->l3_len;
trim = mb->pkt_len - (ip_len + mb->l3_len + mb->l2_len);
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
+ IP_FRAG_LOG(DEBUG,
"mbuf: %p, tms: %" PRIu64 ", key: <%" PRIx64 ", %#x>"
"ofs: %u, len: %d, padding: %d, flags: %#x\n"
"tbl: %p, max_cycles: %" PRIu64 ", entry_mask: %#x, "
- "max_entries: %u, use_entries: %u\n\n",
- __func__, __LINE__,
+ "max_entries: %u, use_entries: %u\n",
mb, tms, key.src_dst[0], key.id, ip_ofs, ip_len, trim, ip_flag,
tbl, tbl->max_cycles, tbl->entry_mask, tbl->max_entries,
tbl->use_entries);
@@ -145,11 +144,10 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
return NULL;
}
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
+ IP_FRAG_LOG(DEBUG,
"tbl: %p, max_entries: %u, use_entries: %u\n"
"ipv4_frag_pkt: %p, key: <%" PRIx64 ", %#x>, start: %" PRIu64
- ", total_size: %u, frag_size: %u, last_idx: %u\n\n",
- __func__, __LINE__,
+ ", total_size: %u, frag_size: %u, last_idx: %u\n",
tbl, tbl->max_entries, tbl->use_entries,
fp, fp->key.src_dst[0], fp->key.id, fp->start,
fp->total_size, fp->frag_size, fp->last_idx);
@@ -159,11 +157,11 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
mb = ip_frag_process(fp, dr, mb, ip_ofs, ip_len, ip_flag);
ip_frag_inuse(tbl, fp);
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
+ IP_FRAG_LOG(DEBUG,
"mbuf: %p\n"
"tbl: %p, max_entries: %u, use_entries: %u\n"
"ipv4_frag_pkt: %p, key: <%" PRIx64 ", %#x>, start: %" PRIu64
- ", total_size: %u, frag_size: %u, last_idx: %u\n\n",
+ ", total_size: %u, frag_size: %u, last_idx: %u\n",
__func__, __LINE__, mb,
tbl, tbl->max_entries, tbl->use_entries,
fp, fp->key.src_dst[0], fp->key.id, fp->start,
diff --git a/lib/ip_frag/rte_ipv6_reassembly.c b/lib/ip_frag/rte_ipv6_reassembly.c
index d4019e87e63a..c3e369f4ce42 100644
--- a/lib/ip_frag/rte_ipv6_reassembly.c
+++ b/lib/ip_frag/rte_ipv6_reassembly.c
@@ -135,8 +135,8 @@ ipv6_frag_reassemble(struct ip_frag_pkt *fp)
#define FRAG_OFFSET(x) (rte_cpu_to_be_16(x) >> 3)
struct rte_mbuf *
rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
- struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms,
- struct rte_ipv6_hdr *ip_hdr, struct rte_ipv6_fragment_ext *frag_hdr)
+ struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms,
+ struct rte_ipv6_hdr *ip_hdr, struct rte_ipv6_fragment_ext *frag_hdr)
{
struct ip_frag_pkt *fp;
struct ip_frag_key key;
@@ -161,17 +161,16 @@ rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
ip_len = rte_be_to_cpu_16(ip_hdr->payload_len) - sizeof(*frag_hdr);
trim = mb->pkt_len - (ip_len + mb->l3_len + mb->l2_len);
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
- "mbuf: %p, tms: %" PRIu64
- ", key: <" IPv6_KEY_BYTES_FMT ", %#x>, "
- "ofs: %u, len: %d, padding: %d, flags: %#x\n"
- "tbl: %p, max_cycles: %" PRIu64 ", entry_mask: %#x, "
- "max_entries: %u, use_entries: %u\n\n",
- __func__, __LINE__,
- mb, tms, IPv6_KEY_BYTES(key.src_dst), key.id, ip_ofs, ip_len,
- trim, RTE_IPV6_GET_MF(frag_hdr->frag_data),
- tbl, tbl->max_cycles, tbl->entry_mask, tbl->max_entries,
- tbl->use_entries);
+ IP_FRAG_LOG(DEBUG,
+ "mbuf: %p, tms: %" PRIu64
+ ", key: <" IPv6_KEY_BYTES_FMT ", %#x>, "
+ "ofs: %u, len: %d, padding: %d, flags: %#x\n"
+ "tbl: %p, max_cycles: %" PRIu64 ", entry_mask: %#x, "
+ "max_entries: %u, use_entries: %u\n",
+ mb, tms, IPv6_KEY_BYTES(key.src_dst), key.id, ip_ofs, ip_len,
+ trim, RTE_IPV6_GET_MF(frag_hdr->frag_data),
+ tbl, tbl->max_cycles, tbl->entry_mask, tbl->max_entries,
+ tbl->use_entries);
/* check that fragment length is greater then zero. */
if (ip_len <= 0) {
@@ -189,30 +188,28 @@ rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
return NULL;
}
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
- "tbl: %p, max_entries: %u, use_entries: %u\n"
- "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64
- ", total_size: %u, frag_size: %u, last_idx: %u\n\n",
- __func__, __LINE__,
- tbl, tbl->max_entries, tbl->use_entries,
- fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id, fp->start,
- fp->total_size, fp->frag_size, fp->last_idx);
+ IP_FRAG_LOG(DEBUG,
+ "tbl: %p, max_entries: %u, use_entries: %u\n"
+ "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64
+ ", total_size: %u, frag_size: %u, last_idx: %u\n",
+ tbl, tbl->max_entries, tbl->use_entries,
+ fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id, fp->start,
+ fp->total_size, fp->frag_size, fp->last_idx);
/* process the fragmented packet. */
mb = ip_frag_process(fp, dr, mb, ip_ofs, ip_len,
- MORE_FRAGS(frag_hdr->frag_data));
+ MORE_FRAGS(frag_hdr->frag_data));
ip_frag_inuse(tbl, fp);
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
- "mbuf: %p\n"
- "tbl: %p, max_entries: %u, use_entries: %u\n"
- "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64
- ", total_size: %u, frag_size: %u, last_idx: %u\n\n",
- __func__, __LINE__, mb,
- tbl, tbl->max_entries, tbl->use_entries,
- fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id, fp->start,
- fp->total_size, fp->frag_size, fp->last_idx);
+ IP_FRAG_LOG(DEBUG,
+ "mbuf: %p\n"
+ "tbl: %p, max_entries: %u, use_entries: %u\n"
+ "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64
+ ", total_size: %u, frag_size: %u, last_idx: %u\n",
+ mb, tbl, tbl->max_entries, tbl->use_entries,
+ fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id, fp->start,
+ fp->total_size, fp->frag_size, fp->last_idx);
return mb;
}
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 2/5] reorder: use a dynamic logtype
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 4:48 ` Stephen Hemminger
2023-02-08 4:48 ` [PATCH 3/5] latencystats: use " Stephen Hemminger
` (7 subsequent siblings)
9 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-08 4:48 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, sergio.gonzalez.monroy, Reshma Pattan,
Declan Doherty, Neil Horman, Richardson Bruce
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
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 3/5] latencystats: use dynamic logtype
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 4:48 ` [PATCH 2/5] reorder: " Stephen Hemminger
@ 2023-02-08 4:48 ` Stephen Hemminger
2023-02-08 4:48 ` [PATCH 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1 Stephen Hemminger
` (6 subsequent siblings)
9 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-08 4:48 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, reshma.pattan, Remy Horton, Harry van Haaren
Libraries should not reuse RTE_LOGTYPE_USER1 for their
logging. Instead they should register their own type.
Fixes: 5cd3cac9ed22 ("latency: added new library for latency stats")
Cc: reshma.pattan@intel.com
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/latencystats/rte_latencystats.c | 55 +++++++++++++++--------------
1 file changed, 28 insertions(+), 27 deletions(-)
diff --git a/lib/latencystats/rte_latencystats.c b/lib/latencystats/rte_latencystats.c
index 8985a377db4e..3a4c47e2b34a 100644
--- a/lib/latencystats/rte_latencystats.c
+++ b/lib/latencystats/rte_latencystats.c
@@ -26,7 +26,10 @@ latencystat_cycles_per_ns(void)
}
/* Macros for printing using RTE_LOG */
-#define RTE_LOGTYPE_LATENCY_STATS RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER_DEFAULT(latencystat_logtype, INFO);
+#define LATENCYSTATS_LOG(level, fmt, args...) \
+ rte_log(RTE_LOG_ ## level, latencystat_logtype, \
+ "%s(): " fmt "\n", __func__, ## args)
static uint64_t timestamp_dynflag;
static int timestamp_dynfield_offset = -1;
@@ -95,7 +98,7 @@ rte_latencystats_update(void)
latency_stats_index,
values, NUM_LATENCY_STATS);
if (ret < 0)
- RTE_LOG(INFO, LATENCY_STATS, "Failed to push the stats\n");
+ LATENCYSTATS_LOG(INFO, "Failed to push the stats");
return ret;
}
@@ -227,8 +230,7 @@ rte_latencystats_init(uint64_t app_samp_intvl,
mz = rte_memzone_reserve(MZ_RTE_LATENCY_STATS, sizeof(*glob_stats),
rte_socket_id(), flags);
if (mz == NULL) {
- RTE_LOG(ERR, LATENCY_STATS, "Cannot reserve memory: %s:%d\n",
- __func__, __LINE__);
+ LATENCYSTATS_LOG(ERR, "Cannot reserve memory");
return -ENOMEM;
}
@@ -243,8 +245,7 @@ rte_latencystats_init(uint64_t app_samp_intvl,
latency_stats_index = rte_metrics_reg_names(ptr_strings,
NUM_LATENCY_STATS);
if (latency_stats_index < 0) {
- RTE_LOG(DEBUG, LATENCY_STATS,
- "Failed to register latency stats names\n");
+ LATENCYSTATS_LOG(ERR, "Failed to register latency stats names");
return -1;
}
@@ -252,8 +253,8 @@ rte_latencystats_init(uint64_t app_samp_intvl,
ret = rte_mbuf_dyn_rx_timestamp_register(×tamp_dynfield_offset,
×tamp_dynflag);
if (ret != 0) {
- RTE_LOG(ERR, LATENCY_STATS,
- "Cannot register mbuf field/flag for timestamp\n");
+ LATENCYSTATS_LOG(ERR,
+ "Cannot register mbuf field/flag for timestamp");
return -rte_errno;
}
@@ -263,9 +264,9 @@ rte_latencystats_init(uint64_t app_samp_intvl,
ret = rte_eth_dev_info_get(pid, &dev_info);
if (ret != 0) {
- RTE_LOG(INFO, LATENCY_STATS,
- "Error during getting device (port %u) info: %s\n",
- pid, strerror(-ret));
+ LATENCYSTATS_LOG(INFO,
+ "Error during getting device (port %u) info: %s",
+ pid, strerror(-ret));
continue;
}
@@ -275,18 +276,18 @@ rte_latencystats_init(uint64_t app_samp_intvl,
cbs->cb = rte_eth_add_first_rx_callback(pid, qid,
add_time_stamps, user_cb);
if (!cbs->cb)
- RTE_LOG(INFO, LATENCY_STATS, "Failed to "
- "register Rx callback for pid=%d, "
- "qid=%d\n", pid, qid);
+ LATENCYSTATS_LOG(INFO,
+ "Failed to register Rx callback for pid=%d, qid=%d",
+ pid, qid);
}
for (qid = 0; qid < dev_info.nb_tx_queues; qid++) {
cbs = &tx_cbs[pid][qid];
cbs->cb = rte_eth_add_tx_callback(pid, qid,
calc_latency, user_cb);
if (!cbs->cb)
- RTE_LOG(INFO, LATENCY_STATS, "Failed to "
- "register Tx callback for pid=%d, "
- "qid=%d\n", pid, qid);
+ LATENCYSTATS_LOG(INFO,
+ "Failed to register Tx callback for pid=%d, qid=%d",
+ pid, qid);
}
}
return 0;
@@ -307,8 +308,8 @@ rte_latencystats_uninit(void)
ret = rte_eth_dev_info_get(pid, &dev_info);
if (ret != 0) {
- RTE_LOG(INFO, LATENCY_STATS,
- "Error during getting device (port %u) info: %s\n",
+ LATENCYSTATS_LOG(INFO,
+ "Error during getting device (port %u) info: %s",
pid, strerror(-ret));
continue;
@@ -318,17 +319,17 @@ rte_latencystats_uninit(void)
cbs = &rx_cbs[pid][qid];
ret = rte_eth_remove_rx_callback(pid, qid, cbs->cb);
if (ret)
- RTE_LOG(INFO, LATENCY_STATS, "failed to "
- "remove Rx callback for pid=%d, "
- "qid=%d\n", pid, qid);
+ LATENCYSTATS_LOG(INFO,
+ "failed to remove Rx callback for pid=%d, qid=%d",
+ pid, qid);
}
for (qid = 0; qid < dev_info.nb_tx_queues; qid++) {
cbs = &tx_cbs[pid][qid];
ret = rte_eth_remove_tx_callback(pid, qid, cbs->cb);
if (ret)
- RTE_LOG(INFO, LATENCY_STATS, "failed to "
- "remove Tx callback for pid=%d, "
- "qid=%d\n", pid, qid);
+ LATENCYSTATS_LOG(INFO,
+ "failed to remove Tx callback for pid=%d, qid=%d",
+ pid, qid);
}
}
@@ -365,8 +366,8 @@ rte_latencystats_get(struct rte_metric_value *values, uint16_t size)
const struct rte_memzone *mz;
mz = rte_memzone_lookup(MZ_RTE_LATENCY_STATS);
if (mz == NULL) {
- RTE_LOG(ERR, LATENCY_STATS,
- "Latency stats memzone not found\n");
+ LATENCYSTATS_LOG(ERR,
+ "Latency stats memzone not found");
return -ENOMEM;
}
glob_stats = mz->addr;
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1
2023-02-08 4:48 [PATCH 0/5] Fix use of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
` (2 preceding siblings ...)
2023-02-08 4:48 ` [PATCH 3/5] latencystats: use " Stephen Hemminger
@ 2023-02-08 4:48 ` Stephen Hemminger
2023-02-09 7:19 ` Xia, Chenbo
2023-02-08 4:48 ` [PATCH 5/5] ipsec: fix usage " Stephen Hemminger
` (5 subsequent siblings)
9 siblings, 1 reply; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-08 4:48 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Maxime Coquelin, Chenbo Xia
Fix instances of USER1 logtype in fdset and crypto
sections.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/vhost/fd_man.c | 16 +++++++++-------
lib/vhost/vhost_crypto.c | 24 ++++++++++--------------
2 files changed, 19 insertions(+), 21 deletions(-)
diff --git a/lib/vhost/fd_man.c b/lib/vhost/fd_man.c
index 1876fada3354..172f7dc03ab2 100644
--- a/lib/vhost/fd_man.c
+++ b/lib/vhost/fd_man.c
@@ -10,8 +10,10 @@
#include "fd_man.h"
-
-#define RTE_LOGTYPE_VHOST_FDMAN RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER_SUFFIX(vhost_fdset_logtype, fdset, INFO);
+#define FDSET_LOG(level, fmt, args...) \
+ rte_log(RTE_LOG_ ## level, vhost_fdset_logtype, \
+ "%s(): " fmt "\n", __func__, ## args)
#define FDPOLLERR (POLLERR | POLLHUP | POLLNVAL)
@@ -334,8 +336,8 @@ fdset_pipe_init(struct fdset *fdset)
int ret;
if (pipe(fdset->u.pipefd) < 0) {
- RTE_LOG(ERR, VHOST_FDMAN,
- "failed to create pipe for vhost fdset\n");
+ FDSET_LOG(ERR,
+ "failed to create pipe for vhost fdset");
return -1;
}
@@ -343,9 +345,9 @@ fdset_pipe_init(struct fdset *fdset)
fdset_pipe_read_cb, NULL, NULL);
if (ret < 0) {
- RTE_LOG(ERR, VHOST_FDMAN,
- "failed to add pipe readfd %d into vhost server fdset\n",
- fdset->u.readfd);
+ FDSET_LOG(ERR,
+ "failed to add pipe readfd %d into vhost server fdset",
+ fdset->u.readfd);
fdset_pipe_uninit(fdset);
return -1;
diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index b448b6685dd2..923c7c0e10d2 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -16,22 +16,18 @@
#define IV_OFFSET (sizeof(struct rte_crypto_op) + \
sizeof(struct rte_crypto_sym_op))
+RTE_LOG_REGISTER_SUFFIX(vhost_crypto_logtype, crypto, INFO);
+
+#define VC_LOG(level, fmt, args...) \
+ rte_log(RTE_LOG_ ## level, vhost_crypto_logtype, \
+ "%s():%u: " fmt "\n", __func__, ## args)
+
+#define VC_LOG_ERR(fmt, args...) VC_LOG(ERR, fmt, ## args)
+#define VC_LOG_INFO(fmt, args...) VC_LOG(INFO, fmt, ## args)
+
#ifdef RTE_LIBRTE_VHOST_DEBUG
-#define VC_LOG_ERR(fmt, args...) \
- RTE_LOG(ERR, USER1, "[%s] %s() line %u: " fmt "\n", \
- "Vhost-Crypto", __func__, __LINE__, ## args)
-#define VC_LOG_INFO(fmt, args...) \
- RTE_LOG(INFO, USER1, "[%s] %s() line %u: " fmt "\n", \
- "Vhost-Crypto", __func__, __LINE__, ## args)
-
-#define VC_LOG_DBG(fmt, args...) \
- RTE_LOG(DEBUG, USER1, "[%s] %s() line %u: " fmt "\n", \
- "Vhost-Crypto", __func__, __LINE__, ## args)
+#define VC_LOG_DBG(fmt, args...) VC_LOG(DEBUG, fmt, ## args)
#else
-#define VC_LOG_ERR(fmt, args...) \
- RTE_LOG(ERR, USER1, "[VHOST-Crypto]: " fmt "\n", ## args)
-#define VC_LOG_INFO(fmt, args...) \
- RTE_LOG(INFO, USER1, "[VHOST-Crypto]: " fmt "\n", ## args)
#define VC_LOG_DBG(fmt, args...)
#endif
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 5/5] ipsec: fix usage of RTE_LOGTYPE_USER1
2023-02-08 4:48 [PATCH 0/5] Fix use of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
` (3 preceding siblings ...)
2023-02-08 4:48 ` [PATCH 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1 Stephen Hemminger
@ 2023-02-08 4:48 ` Stephen Hemminger
2023-02-10 0:22 ` [PATCH v3 0/5] Replace use of RTE_LOGTYPE_USER1 in library Stephen Hemminger
` (4 subsequent siblings)
9 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-08 4:48 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, kai.ji, Pablo de Lara, Arkadiusz Kusztal
There already is a logtype in this driver, use it!
Fixes: b35848bc01f6 ("crypto/ipsec_mb: add multi-process IPC request handler")
Cc: kai.ji@intel.com
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
index 3e52f9567401..e9eb0d15b794 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
@@ -7,6 +7,7 @@
#include <rte_common.h>
#include <rte_malloc.h>
+#include <rte_log.h>
#include "ipsec_mb_private.h"
@@ -125,7 +126,7 @@ ipsec_mb_secondary_qp_op(int dev_id, int qp_id,
qp_req_msg.num_fds = 0;
ret = rte_mp_request_sync(&qp_req_msg, &qp_resp, &ts);
if (ret) {
- RTE_LOG(ERR, USER1, "Create MR request to primary process failed.");
+ IPSEC_MB_LOG(ERR, "Create MR request to primary process failed.");
return -1;
}
qp_resp_msg = &qp_resp.msgs[0];
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 1/5] ip_frag: use a dynamic logtype
2023-02-08 4:48 ` [PATCH 1/5] ip_frag: use a dynamic logtype Stephen Hemminger
@ 2023-02-08 23:52 ` Konstantin Ananyev
0 siblings, 0 replies; 50+ messages in thread
From: Konstantin Ananyev @ 2023-02-08 23:52 UTC (permalink / raw)
To: Stephen Hemminger, dev; +Cc: Anatoly Burakov, Thomas Monjalon
08/02/2023 04:48, Stephen Hemminger пишет:
> DPDK libraries should not be reusing RTE_LOGTYPE_USER1 in
> lieu of doing proper logtype registration.
>
> Fixes: 416707812c03 ("ip_frag: refactor reassembly code into a proper library")
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> lib/ip_frag/ip_frag_common.h | 16 ++-
> lib/ip_frag/ip_frag_internal.c | 174 +++++++++++++++---------------
> lib/ip_frag/rte_ip_frag_common.c | 13 +--
> lib/ip_frag/rte_ipv4_reassembly.c | 14 ++-
> lib/ip_frag/rte_ipv6_reassembly.c | 59 +++++-----
> 5 files changed, 138 insertions(+), 138 deletions(-)
Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
^ permalink raw reply [flat|nested] 50+ messages in thread
* RE: [PATCH 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1
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
0 siblings, 0 replies; 50+ messages in thread
From: Xia, Chenbo @ 2023-02-09 7:19 UTC (permalink / raw)
To: Stephen Hemminger, dev; +Cc: Maxime Coquelin
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Wednesday, February 8, 2023 12:48 PM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>; Maxime Coquelin
> <maxime.coquelin@redhat.com>; Xia, Chenbo <chenbo.xia@intel.com>
> Subject: [PATCH 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1
>
> Fix instances of USER1 logtype in fdset and crypto
> sections.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> lib/vhost/fd_man.c | 16 +++++++++-------
> lib/vhost/vhost_crypto.c | 24 ++++++++++--------------
> 2 files changed, 19 insertions(+), 21 deletions(-)
>
> diff --git a/lib/vhost/fd_man.c b/lib/vhost/fd_man.c
> index 1876fada3354..172f7dc03ab2 100644
> --- a/lib/vhost/fd_man.c
> +++ b/lib/vhost/fd_man.c
> @@ -10,8 +10,10 @@
>
> #include "fd_man.h"
>
> -
> -#define RTE_LOGTYPE_VHOST_FDMAN RTE_LOGTYPE_USER1
> +RTE_LOG_REGISTER_SUFFIX(vhost_fdset_logtype, fdset, INFO);
> +#define FDSET_LOG(level, fmt, args...) \
> + rte_log(RTE_LOG_ ## level, vhost_fdset_logtype, \
> + "%s(): " fmt "\n", __func__, ## args)
>
> #define FDPOLLERR (POLLERR | POLLHUP | POLLNVAL)
>
> @@ -334,8 +336,8 @@ fdset_pipe_init(struct fdset *fdset)
> int ret;
>
> if (pipe(fdset->u.pipefd) < 0) {
> - RTE_LOG(ERR, VHOST_FDMAN,
> - "failed to create pipe for vhost fdset\n");
> + FDSET_LOG(ERR,
> + "failed to create pipe for vhost fdset");
> return -1;
> }
>
> @@ -343,9 +345,9 @@ fdset_pipe_init(struct fdset *fdset)
> fdset_pipe_read_cb, NULL, NULL);
>
> if (ret < 0) {
> - RTE_LOG(ERR, VHOST_FDMAN,
> - "failed to add pipe readfd %d into vhost server fdset\n",
> - fdset->u.readfd);
> + FDSET_LOG(ERR,
> + "failed to add pipe readfd %d into vhost server fdset",
> + fdset->u.readfd);
>
> fdset_pipe_uninit(fdset);
> return -1;
> diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
> index b448b6685dd2..923c7c0e10d2 100644
> --- a/lib/vhost/vhost_crypto.c
> +++ b/lib/vhost/vhost_crypto.c
> @@ -16,22 +16,18 @@
> #define IV_OFFSET (sizeof(struct rte_crypto_op) + \
> sizeof(struct rte_crypto_sym_op))
>
> +RTE_LOG_REGISTER_SUFFIX(vhost_crypto_logtype, crypto, INFO);
> +
> +#define VC_LOG(level, fmt, args...) \
> + rte_log(RTE_LOG_ ## level, vhost_crypto_logtype, \
> + "%s():%u: " fmt "\n", __func__, ## args)
> +
> +#define VC_LOG_ERR(fmt, args...) VC_LOG(ERR, fmt, ## args)
> +#define VC_LOG_INFO(fmt, args...) VC_LOG(INFO, fmt, ## args)
> +
> #ifdef RTE_LIBRTE_VHOST_DEBUG
> -#define VC_LOG_ERR(fmt, args...) \
> - RTE_LOG(ERR, USER1, "[%s] %s() line %u: " fmt "\n", \
> - "Vhost-Crypto", __func__, __LINE__, ## args)
> -#define VC_LOG_INFO(fmt, args...) \
> - RTE_LOG(INFO, USER1, "[%s] %s() line %u: " fmt "\n", \
> - "Vhost-Crypto", __func__, __LINE__, ## args)
> -
> -#define VC_LOG_DBG(fmt, args...) \
> - RTE_LOG(DEBUG, USER1, "[%s] %s() line %u: " fmt "\n", \
> - "Vhost-Crypto", __func__, __LINE__, ## args)
> +#define VC_LOG_DBG(fmt, args...) VC_LOG(DEBUG, fmt, ## args)
> #else
> -#define VC_LOG_ERR(fmt, args...) \
> - RTE_LOG(ERR, USER1, "[VHOST-Crypto]: " fmt "\n", ## args)
> -#define VC_LOG_INFO(fmt, args...) \
> - RTE_LOG(INFO, USER1, "[VHOST-Crypto]: " fmt "\n", ## args)
> #define VC_LOG_DBG(fmt, args...)
> #endif
>
> --
> 2.39.1
Acked-by: Chenbo Xia <chenbo.xia@intel.com>
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v3 0/5] Replace use of RTE_LOGTYPE_USER1 in library
2023-02-08 4:48 [PATCH 0/5] Fix use of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
` (4 preceding siblings ...)
2023-02-08 4:48 ` [PATCH 5/5] ipsec: fix usage " Stephen Hemminger
@ 2023-02-10 0:22 ` Stephen Hemminger
2023-02-10 0:22 ` [PATCH v3 1/5] ip_frag: use a dynamic logtype Stephen Hemminger
` (4 more replies)
2023-02-10 17:15 ` [PATCH v4 0/5] Replace use of RTE_LOGTYPE_USER1 in library Stephen Hemminger
` (3 subsequent siblings)
9 siblings, 5 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-10 0:22 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
The DPDK libraries and drivers should not be using the USER1 logtype.
v3 - fix typo in ip_frag
v2 - fix some compiler warnings
Stephen Hemminger (5):
ip_frag: use a dynamic logtype
reorder: use a dynamic logtype
latencystats: use dynamic logtype
vhost: use logtype instead of RTE_LOGTYPE_USER1
ipsec: fix usage of RTE_LOGTYPE_USER1
drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 3 +-
lib/ip_frag/ip_frag_common.h | 16 ++-
lib/ip_frag/ip_frag_internal.c | 174 ++++++++++++-------------
lib/ip_frag/rte_ip_frag_common.c | 13 +-
lib/ip_frag/rte_ipv4_reassembly.c | 14 +-
lib/ip_frag/rte_ipv6_reassembly.c | 59 ++++-----
lib/latencystats/rte_latencystats.c | 55 ++++----
lib/reorder/rte_reorder.c | 35 ++---
lib/vhost/fd_man.c | 16 ++-
lib/vhost/vhost_crypto.c | 25 ++--
10 files changed, 207 insertions(+), 203 deletions(-)
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v3 1/5] ip_frag: use a dynamic logtype
2023-02-10 0:22 ` [PATCH v3 0/5] Replace use of RTE_LOGTYPE_USER1 in library Stephen Hemminger
@ 2023-02-10 0:22 ` Stephen Hemminger
2023-02-10 0:22 ` [PATCH v3 2/5] reorder: " Stephen Hemminger
` (3 subsequent siblings)
4 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-10 0:22 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, Konstantin Ananyev, Anatoly Burakov, Thomas Monjalon
DPDK libraries should not be reusing RTE_LOGTYPE_USER1 in
lieu of doing proper logtype registration.
Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
Fixes: 416707812c03 ("ip_frag: refactor reassembly code into a proper library")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/ip_frag/ip_frag_common.h | 16 ++-
lib/ip_frag/ip_frag_internal.c | 174 +++++++++++++++---------------
lib/ip_frag/rte_ip_frag_common.c | 13 +--
lib/ip_frag/rte_ipv4_reassembly.c | 14 ++-
lib/ip_frag/rte_ipv6_reassembly.c | 59 +++++-----
5 files changed, 138 insertions(+), 138 deletions(-)
diff --git a/lib/ip_frag/ip_frag_common.h b/lib/ip_frag/ip_frag_common.h
index 9c0dbdeb6eb9..134072f3e810 100644
--- a/lib/ip_frag/ip_frag_common.h
+++ b/lib/ip_frag/ip_frag_common.h
@@ -9,8 +9,16 @@
#include "ip_reassembly.h"
/* logging macros. */
+extern int ipfrag_logtype;
+
+#define IP_FRAG_ERR(fmt, args...) \
+ rte_log(RTE_LOG_ERR, ipfrag_logtype, \
+ "%s: " fmt "\n", __func__, ## args)
+
#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(RTE_LOG ## lvl, ipfrag_logtype, \
+ "%s: " fmt "\n", __func__, ## args)
#else
#define IP_FRAG_LOG(lvl, fmt, args...) do {} while(0)
#endif /* IP_FRAG_DEBUG */
@@ -111,9 +119,9 @@ ip_frag_free_immediate(struct ip_frag_pkt *fp)
for (i = 0; i < fp->last_idx; i++) {
if (fp->frags[i].mb != NULL) {
- IP_FRAG_LOG(DEBUG, "%s:%d\n"
- "mbuf: %p, tms: %" PRIu64", key: <%" PRIx64 ", %#x>\n",
- __func__, __LINE__, fp->frags[i].mb, fp->start,
+ IP_FRAG_LOG(DEBUG,
+ "mbuf: %p, tms: %" PRIu64", key: <%" PRIx64 ", %#x>",
+ fp->frags[i].mb, fp->start,
fp->key.src_dst[0], fp->key.id);
rte_pktmbuf_free(fp->frags[i].mb);
fp->frags[i].mb = NULL;
diff --git a/lib/ip_frag/ip_frag_internal.c b/lib/ip_frag/ip_frag_internal.c
index b436a4c9313b..dffaa41734c9 100644
--- a/lib/ip_frag/ip_frag_internal.c
+++ b/lib/ip_frag/ip_frag_internal.c
@@ -89,7 +89,7 @@ ipv6_frag_hash(const struct ip_frag_key *key, uint32_t *v1, uint32_t *v2)
struct rte_mbuf *
ip_frag_process(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr,
- struct rte_mbuf *mb, uint16_t ofs, uint16_t len, uint16_t more_frags)
+ struct rte_mbuf *mb, uint16_t ofs, uint16_t len, uint16_t more_frags)
{
uint32_t idx;
@@ -98,15 +98,15 @@ ip_frag_process(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr,
/* this is the first fragment. */
if (ofs == 0) {
idx = (fp->frags[IP_FIRST_FRAG_IDX].mb == NULL) ?
- IP_FIRST_FRAG_IDX : UINT32_MAX;
+ IP_FIRST_FRAG_IDX : UINT32_MAX;
- /* this is the last fragment. */
+ /* this is the last fragment. */
} else if (more_frags == 0) {
fp->total_size = ofs + len;
idx = (fp->frags[IP_LAST_FRAG_IDX].mb == NULL) ?
- IP_LAST_FRAG_IDX : UINT32_MAX;
+ IP_LAST_FRAG_IDX : UINT32_MAX;
- /* this is the intermediate fragment. */
+ /* this is the intermediate fragment. */
} else if ((idx = fp->last_idx) < RTE_DIM(fp->frags)) {
fp->last_idx++;
}
@@ -119,31 +119,31 @@ ip_frag_process(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr,
/* report an error. */
if (fp->key.key_len == IPV4_KEYLEN)
- IP_FRAG_LOG(DEBUG, "%s:%d invalid fragmented packet:\n"
- "ipv4_frag_pkt: %p, key: <%" PRIx64 ", %#x>, "
- "total_size: %u, frag_size: %u, last_idx: %u\n"
- "first fragment: ofs: %u, len: %u\n"
- "last fragment: ofs: %u, len: %u\n\n",
- __func__, __LINE__,
- fp, fp->key.src_dst[0], fp->key.id,
- fp->total_size, fp->frag_size, fp->last_idx,
- fp->frags[IP_FIRST_FRAG_IDX].ofs,
- fp->frags[IP_FIRST_FRAG_IDX].len,
- fp->frags[IP_LAST_FRAG_IDX].ofs,
- fp->frags[IP_LAST_FRAG_IDX].len);
+ IP_FRAG_LOG(DEBUG,
+ "invalid fragmented packet:\n"
+ "ipv4_frag_pkt: %p, key: <%" PRIx64 ", %#x>, "
+ "total_size: %u, frag_size: %u, last_idx: %u\n"
+ "first fragment: ofs: %u, len: %u\n"
+ "last fragment: ofs: %u, len: %u\n",
+ fp, fp->key.src_dst[0], fp->key.id,
+ fp->total_size, fp->frag_size, fp->last_idx,
+ fp->frags[IP_FIRST_FRAG_IDX].ofs,
+ fp->frags[IP_FIRST_FRAG_IDX].len,
+ fp->frags[IP_LAST_FRAG_IDX].ofs,
+ fp->frags[IP_LAST_FRAG_IDX].len);
else
- IP_FRAG_LOG(DEBUG, "%s:%d invalid fragmented packet:\n"
- "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, "
- "total_size: %u, frag_size: %u, last_idx: %u\n"
- "first fragment: ofs: %u, len: %u\n"
- "last fragment: ofs: %u, len: %u\n\n",
- __func__, __LINE__,
- fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id,
- fp->total_size, fp->frag_size, fp->last_idx,
- fp->frags[IP_FIRST_FRAG_IDX].ofs,
- fp->frags[IP_FIRST_FRAG_IDX].len,
- fp->frags[IP_LAST_FRAG_IDX].ofs,
- fp->frags[IP_LAST_FRAG_IDX].len);
+ IP_FRAG_LOG(DEBUG,
+ "invalid fragmented packet:\n"
+ "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, "
+ "total_size: %u, frag_size: %u, last_idx: %u\n"
+ "first fragment: ofs: %u, len: %u\n"
+ "last fragment: ofs: %u, len: %u\n",
+ fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id,
+ fp->total_size, fp->frag_size, fp->last_idx,
+ fp->frags[IP_FIRST_FRAG_IDX].ofs,
+ fp->frags[IP_FIRST_FRAG_IDX].len,
+ fp->frags[IP_LAST_FRAG_IDX].ofs,
+ fp->frags[IP_LAST_FRAG_IDX].len);
/* free all fragments, invalidate the entry. */
ip_frag_free(fp, dr);
@@ -163,9 +163,9 @@ ip_frag_process(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr,
if (likely (fp->frag_size < fp->total_size)) {
return mb;
- /* if we collected all fragments, then try to reassemble. */
+ /* if we collected all fragments, then try to reassemble. */
} else if (fp->frag_size == fp->total_size &&
- fp->frags[IP_FIRST_FRAG_IDX].mb != NULL) {
+ fp->frags[IP_FIRST_FRAG_IDX].mb != NULL) {
if (fp->key.key_len == IPV4_KEYLEN)
mb = ipv4_frag_reassemble(fp);
else
@@ -177,31 +177,31 @@ ip_frag_process(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr,
/* report an error. */
if (fp->key.key_len == IPV4_KEYLEN)
- IP_FRAG_LOG(DEBUG, "%s:%d invalid fragmented packet:\n"
- "ipv4_frag_pkt: %p, key: <%" PRIx64 ", %#x>, "
- "total_size: %u, frag_size: %u, last_idx: %u\n"
- "first fragment: ofs: %u, len: %u\n"
- "last fragment: ofs: %u, len: %u\n\n",
- __func__, __LINE__,
- fp, fp->key.src_dst[0], fp->key.id,
- fp->total_size, fp->frag_size, fp->last_idx,
- fp->frags[IP_FIRST_FRAG_IDX].ofs,
- fp->frags[IP_FIRST_FRAG_IDX].len,
- fp->frags[IP_LAST_FRAG_IDX].ofs,
- fp->frags[IP_LAST_FRAG_IDX].len);
+ IP_FRAG_LOG(DEBUG,
+ "invalid fragmented packet:\n"
+ "ipv4_frag_pkt: %p, key: <%" PRIx64 ", %#x>, "
+ "total_size: %u, frag_size: %u, last_idx: %u\n"
+ "first fragment: ofs: %u, len: %u\n"
+ "last fragment: ofs: %u, len: %u\n",
+ fp, fp->key.src_dst[0], fp->key.id,
+ fp->total_size, fp->frag_size, fp->last_idx,
+ fp->frags[IP_FIRST_FRAG_IDX].ofs,
+ fp->frags[IP_FIRST_FRAG_IDX].len,
+ fp->frags[IP_LAST_FRAG_IDX].ofs,
+ fp->frags[IP_LAST_FRAG_IDX].len);
else
- IP_FRAG_LOG(DEBUG, "%s:%d invalid fragmented packet:\n"
- "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, "
- "total_size: %u, frag_size: %u, last_idx: %u\n"
- "first fragment: ofs: %u, len: %u\n"
- "last fragment: ofs: %u, len: %u\n\n",
- __func__, __LINE__,
- fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id,
- fp->total_size, fp->frag_size, fp->last_idx,
- fp->frags[IP_FIRST_FRAG_IDX].ofs,
- fp->frags[IP_FIRST_FRAG_IDX].len,
- fp->frags[IP_LAST_FRAG_IDX].ofs,
- fp->frags[IP_LAST_FRAG_IDX].len);
+ IP_FRAG_LOG(DEBUG,
+ "invalid fragmented packet:\n"
+ "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, "
+ "total_size: %u, frag_size: %u, last_idx: %u\n"
+ "first fragment: ofs: %u, len: %u\n"
+ "last fragment: ofs: %u, len: %u\n",
+ fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id,
+ fp->total_size, fp->frag_size, fp->last_idx,
+ fp->frags[IP_FIRST_FRAG_IDX].ofs,
+ fp->frags[IP_FIRST_FRAG_IDX].len,
+ fp->frags[IP_LAST_FRAG_IDX].ofs,
+ fp->frags[IP_LAST_FRAG_IDX].len);
/* free associated resources. */
ip_frag_free(fp, dr);
@@ -282,8 +282,8 @@ ip_frag_find(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr,
struct ip_frag_pkt *
ip_frag_lookup(struct rte_ip_frag_tbl *tbl,
- const struct ip_frag_key *key, uint64_t tms,
- struct ip_frag_pkt **free, struct ip_frag_pkt **stale)
+ const struct ip_frag_key *key, uint64_t tms,
+ struct ip_frag_pkt **free, struct ip_frag_pkt **stale)
{
struct ip_frag_pkt *p1, *p2;
struct ip_frag_pkt *empty, *old;
@@ -310,23 +310,21 @@ ip_frag_lookup(struct rte_ip_frag_tbl *tbl,
for (i = 0; i != assoc; i++) {
if (p1->key.key_len == IPV4_KEYLEN)
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
- "tbl: %p, max_entries: %u, use_entries: %u\n"
- "ipv4_frag_pkt line0: %p, index: %u from %u\n"
- "key: <%" PRIx64 ", %#x>, start: %" PRIu64 "\n",
- __func__, __LINE__,
- tbl, tbl->max_entries, tbl->use_entries,
- p1, i, assoc,
- p1[i].key.src_dst[0], p1[i].key.id, p1[i].start);
+ IP_FRAG_LOG(DEBUG,
+ "tbl: %p, max_entries: %u, use_entries: %u\n"
+ "ipv4_frag_pkt line0: %p, index: %u from %u\n"
+ "key: <%" PRIx64 ", %#x>, start: %" PRIu64,
+ tbl, tbl->max_entries, tbl->use_entries,
+ p1, i, assoc,
+ p1[i].key.src_dst[0], p1[i].key.id, p1[i].start);
else
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
- "tbl: %p, max_entries: %u, use_entries: %u\n"
- "ipv6_frag_pkt line0: %p, index: %u from %u\n"
- "key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64 "\n",
- __func__, __LINE__,
- tbl, tbl->max_entries, tbl->use_entries,
- p1, i, assoc,
- IPv6_KEY_BYTES(p1[i].key.src_dst), p1[i].key.id, p1[i].start);
+ IP_FRAG_LOG(DEBUG,
+ "tbl: %p, max_entries: %u, use_entries: %u\n"
+ "ipv6_frag_pkt line0: %p, index: %u from %u\n"
+ "key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64,
+ tbl, tbl->max_entries, tbl->use_entries,
+ p1, i, assoc,
+ IPv6_KEY_BYTES(p1[i].key.src_dst), p1[i].key.id, p1[i].start);
if (ip_frag_key_cmp(key, &p1[i].key) == 0)
return p1 + i;
@@ -336,23 +334,21 @@ ip_frag_lookup(struct rte_ip_frag_tbl *tbl,
old = (old == NULL) ? (p1 + i) : old;
if (p2->key.key_len == IPV4_KEYLEN)
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
- "tbl: %p, max_entries: %u, use_entries: %u\n"
- "ipv4_frag_pkt line1: %p, index: %u from %u\n"
- "key: <%" PRIx64 ", %#x>, start: %" PRIu64 "\n",
- __func__, __LINE__,
- tbl, tbl->max_entries, tbl->use_entries,
- p2, i, assoc,
- p2[i].key.src_dst[0], p2[i].key.id, p2[i].start);
+ IP_FRAG_LOG(DEBUG,
+ "tbl: %p, max_entries: %u, use_entries: %u\n"
+ "ipv4_frag_pkt line1: %p, index: %u from %u\n"
+ "key: <%" PRIx64 ", %#x>, start: %" PRIu64,
+ tbl, tbl->max_entries, tbl->use_entries,
+ p2, i, assoc,
+ p2[i].key.src_dst[0], p2[i].key.id, p2[i].start);
else
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
- "tbl: %p, max_entries: %u, use_entries: %u\n"
- "ipv6_frag_pkt line1: %p, index: %u from %u\n"
- "key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64 "\n",
- __func__, __LINE__,
- tbl, tbl->max_entries, tbl->use_entries,
- p2, i, assoc,
- IPv6_KEY_BYTES(p2[i].key.src_dst), p2[i].key.id, p2[i].start);
+ IP_FRAG_LOG(DEBUG,
+ "tbl: %p, max_entries: %u, use_entries: %u\n"
+ "ipv6_frag_pkt line1: %p, index: %u from %u\n"
+ "key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64,
+ tbl, tbl->max_entries, tbl->use_entries,
+ p2, i, assoc,
+ IPv6_KEY_BYTES(p2[i].key.src_dst), p2[i].key.id, p2[i].start);
if (ip_frag_key_cmp(key, &p2[i].key) == 0)
return p2 + i;
diff --git a/lib/ip_frag/rte_ip_frag_common.c b/lib/ip_frag/rte_ip_frag_common.c
index c1de2e81b6d0..b8ca9e019c54 100644
--- a/lib/ip_frag/rte_ip_frag_common.c
+++ b/lib/ip_frag/rte_ip_frag_common.c
@@ -52,21 +52,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__);
+ IP_FRAG_ERR("invalid input parameter");
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,
- "%s: allocation of %zu bytes at socket %d failed do\n",
- __func__, sz, socket_id);
+ IP_FRAG_ERR("allocation of %zu bytes at socket %d failed do",
+ sz, socket_id);
return NULL;
}
- RTE_LOG(INFO, USER1, "%s: allocated of %zu bytes at socket %d\n",
- __func__, sz, socket_id);
+ IP_FRAG_LOG(INFO, "allocated of %zu bytes at socket %d",
+ sz, socket_id);
tbl->max_cycles = max_cycles;
tbl->max_entries = max_entries;
@@ -142,3 +141,5 @@ rte_ip_frag_table_del_expired_entries(struct rte_ip_frag_tbl *tbl,
} else
return;
}
+
+RTE_LOG_REGISTER_DEFAULT(ipfrag_logtype, INFO);
diff --git a/lib/ip_frag/rte_ipv4_reassembly.c b/lib/ip_frag/rte_ipv4_reassembly.c
index 4a89a5f5365a..2cdbdc4ee87f 100644
--- a/lib/ip_frag/rte_ipv4_reassembly.c
+++ b/lib/ip_frag/rte_ipv4_reassembly.c
@@ -120,12 +120,11 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
ip_len = rte_be_to_cpu_16(ip_hdr->total_length) - mb->l3_len;
trim = mb->pkt_len - (ip_len + mb->l3_len + mb->l2_len);
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
+ IP_FRAG_LOG(DEBUG,
"mbuf: %p, tms: %" PRIu64 ", key: <%" PRIx64 ", %#x>"
"ofs: %u, len: %d, padding: %d, flags: %#x\n"
"tbl: %p, max_cycles: %" PRIu64 ", entry_mask: %#x, "
- "max_entries: %u, use_entries: %u\n\n",
- __func__, __LINE__,
+ "max_entries: %u, use_entries: %u\n",
mb, tms, key.src_dst[0], key.id, ip_ofs, ip_len, trim, ip_flag,
tbl, tbl->max_cycles, tbl->entry_mask, tbl->max_entries,
tbl->use_entries);
@@ -145,11 +144,10 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
return NULL;
}
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
+ IP_FRAG_LOG(DEBUG,
"tbl: %p, max_entries: %u, use_entries: %u\n"
"ipv4_frag_pkt: %p, key: <%" PRIx64 ", %#x>, start: %" PRIu64
- ", total_size: %u, frag_size: %u, last_idx: %u\n\n",
- __func__, __LINE__,
+ ", total_size: %u, frag_size: %u, last_idx: %u\n",
tbl, tbl->max_entries, tbl->use_entries,
fp, fp->key.src_dst[0], fp->key.id, fp->start,
fp->total_size, fp->frag_size, fp->last_idx);
@@ -159,11 +157,11 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
mb = ip_frag_process(fp, dr, mb, ip_ofs, ip_len, ip_flag);
ip_frag_inuse(tbl, fp);
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
+ IP_FRAG_LOG(DEBUG,
"mbuf: %p\n"
"tbl: %p, max_entries: %u, use_entries: %u\n"
"ipv4_frag_pkt: %p, key: <%" PRIx64 ", %#x>, start: %" PRIu64
- ", total_size: %u, frag_size: %u, last_idx: %u\n\n",
+ ", total_size: %u, frag_size: %u, last_idx: %u\n",
__func__, __LINE__, mb,
tbl, tbl->max_entries, tbl->use_entries,
fp, fp->key.src_dst[0], fp->key.id, fp->start,
diff --git a/lib/ip_frag/rte_ipv6_reassembly.c b/lib/ip_frag/rte_ipv6_reassembly.c
index d4019e87e63a..c3e369f4ce42 100644
--- a/lib/ip_frag/rte_ipv6_reassembly.c
+++ b/lib/ip_frag/rte_ipv6_reassembly.c
@@ -135,8 +135,8 @@ ipv6_frag_reassemble(struct ip_frag_pkt *fp)
#define FRAG_OFFSET(x) (rte_cpu_to_be_16(x) >> 3)
struct rte_mbuf *
rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
- struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms,
- struct rte_ipv6_hdr *ip_hdr, struct rte_ipv6_fragment_ext *frag_hdr)
+ struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms,
+ struct rte_ipv6_hdr *ip_hdr, struct rte_ipv6_fragment_ext *frag_hdr)
{
struct ip_frag_pkt *fp;
struct ip_frag_key key;
@@ -161,17 +161,16 @@ rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
ip_len = rte_be_to_cpu_16(ip_hdr->payload_len) - sizeof(*frag_hdr);
trim = mb->pkt_len - (ip_len + mb->l3_len + mb->l2_len);
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
- "mbuf: %p, tms: %" PRIu64
- ", key: <" IPv6_KEY_BYTES_FMT ", %#x>, "
- "ofs: %u, len: %d, padding: %d, flags: %#x\n"
- "tbl: %p, max_cycles: %" PRIu64 ", entry_mask: %#x, "
- "max_entries: %u, use_entries: %u\n\n",
- __func__, __LINE__,
- mb, tms, IPv6_KEY_BYTES(key.src_dst), key.id, ip_ofs, ip_len,
- trim, RTE_IPV6_GET_MF(frag_hdr->frag_data),
- tbl, tbl->max_cycles, tbl->entry_mask, tbl->max_entries,
- tbl->use_entries);
+ IP_FRAG_LOG(DEBUG,
+ "mbuf: %p, tms: %" PRIu64
+ ", key: <" IPv6_KEY_BYTES_FMT ", %#x>, "
+ "ofs: %u, len: %d, padding: %d, flags: %#x\n"
+ "tbl: %p, max_cycles: %" PRIu64 ", entry_mask: %#x, "
+ "max_entries: %u, use_entries: %u\n",
+ mb, tms, IPv6_KEY_BYTES(key.src_dst), key.id, ip_ofs, ip_len,
+ trim, RTE_IPV6_GET_MF(frag_hdr->frag_data),
+ tbl, tbl->max_cycles, tbl->entry_mask, tbl->max_entries,
+ tbl->use_entries);
/* check that fragment length is greater then zero. */
if (ip_len <= 0) {
@@ -189,30 +188,28 @@ rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
return NULL;
}
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
- "tbl: %p, max_entries: %u, use_entries: %u\n"
- "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64
- ", total_size: %u, frag_size: %u, last_idx: %u\n\n",
- __func__, __LINE__,
- tbl, tbl->max_entries, tbl->use_entries,
- fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id, fp->start,
- fp->total_size, fp->frag_size, fp->last_idx);
+ IP_FRAG_LOG(DEBUG,
+ "tbl: %p, max_entries: %u, use_entries: %u\n"
+ "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64
+ ", total_size: %u, frag_size: %u, last_idx: %u\n",
+ tbl, tbl->max_entries, tbl->use_entries,
+ fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id, fp->start,
+ fp->total_size, fp->frag_size, fp->last_idx);
/* process the fragmented packet. */
mb = ip_frag_process(fp, dr, mb, ip_ofs, ip_len,
- MORE_FRAGS(frag_hdr->frag_data));
+ MORE_FRAGS(frag_hdr->frag_data));
ip_frag_inuse(tbl, fp);
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
- "mbuf: %p\n"
- "tbl: %p, max_entries: %u, use_entries: %u\n"
- "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64
- ", total_size: %u, frag_size: %u, last_idx: %u\n\n",
- __func__, __LINE__, mb,
- tbl, tbl->max_entries, tbl->use_entries,
- fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id, fp->start,
- fp->total_size, fp->frag_size, fp->last_idx);
+ IP_FRAG_LOG(DEBUG,
+ "mbuf: %p\n"
+ "tbl: %p, max_entries: %u, use_entries: %u\n"
+ "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64
+ ", total_size: %u, frag_size: %u, last_idx: %u\n",
+ mb, tbl, tbl->max_entries, tbl->use_entries,
+ fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id, fp->start,
+ fp->total_size, fp->frag_size, fp->last_idx);
return mb;
}
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v3 2/5] reorder: use a dynamic logtype
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 ` Stephen Hemminger
2023-02-10 0:22 ` [PATCH v3 3/5] latencystats: use " Stephen Hemminger
` (2 subsequent siblings)
4 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-10 0:22 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, sergio.gonzalez.monroy, Reshma Pattan,
Neil Horman, Richardson Bruce, Declan Doherty
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
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v3 3/5] latencystats: use dynamic logtype
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 ` Stephen Hemminger
2023-02-10 0:22 ` [PATCH v3 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1 Stephen Hemminger
2023-02-10 0:22 ` [PATCH v3 5/5] ipsec: fix usage " Stephen Hemminger
4 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-10 0:22 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, reshma.pattan, Remy Horton, Harry van Haaren
Libraries should not reuse RTE_LOGTYPE_USER1 for their
logging. Instead they should register their own type.
Fixes: 5cd3cac9ed22 ("latency: added new library for latency stats")
Cc: reshma.pattan@intel.com
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/latencystats/rte_latencystats.c | 55 +++++++++++++++--------------
1 file changed, 28 insertions(+), 27 deletions(-)
diff --git a/lib/latencystats/rte_latencystats.c b/lib/latencystats/rte_latencystats.c
index 8985a377db4e..3a4c47e2b34a 100644
--- a/lib/latencystats/rte_latencystats.c
+++ b/lib/latencystats/rte_latencystats.c
@@ -26,7 +26,10 @@ latencystat_cycles_per_ns(void)
}
/* Macros for printing using RTE_LOG */
-#define RTE_LOGTYPE_LATENCY_STATS RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER_DEFAULT(latencystat_logtype, INFO);
+#define LATENCYSTATS_LOG(level, fmt, args...) \
+ rte_log(RTE_LOG_ ## level, latencystat_logtype, \
+ "%s(): " fmt "\n", __func__, ## args)
static uint64_t timestamp_dynflag;
static int timestamp_dynfield_offset = -1;
@@ -95,7 +98,7 @@ rte_latencystats_update(void)
latency_stats_index,
values, NUM_LATENCY_STATS);
if (ret < 0)
- RTE_LOG(INFO, LATENCY_STATS, "Failed to push the stats\n");
+ LATENCYSTATS_LOG(INFO, "Failed to push the stats");
return ret;
}
@@ -227,8 +230,7 @@ rte_latencystats_init(uint64_t app_samp_intvl,
mz = rte_memzone_reserve(MZ_RTE_LATENCY_STATS, sizeof(*glob_stats),
rte_socket_id(), flags);
if (mz == NULL) {
- RTE_LOG(ERR, LATENCY_STATS, "Cannot reserve memory: %s:%d\n",
- __func__, __LINE__);
+ LATENCYSTATS_LOG(ERR, "Cannot reserve memory");
return -ENOMEM;
}
@@ -243,8 +245,7 @@ rte_latencystats_init(uint64_t app_samp_intvl,
latency_stats_index = rte_metrics_reg_names(ptr_strings,
NUM_LATENCY_STATS);
if (latency_stats_index < 0) {
- RTE_LOG(DEBUG, LATENCY_STATS,
- "Failed to register latency stats names\n");
+ LATENCYSTATS_LOG(ERR, "Failed to register latency stats names");
return -1;
}
@@ -252,8 +253,8 @@ rte_latencystats_init(uint64_t app_samp_intvl,
ret = rte_mbuf_dyn_rx_timestamp_register(×tamp_dynfield_offset,
×tamp_dynflag);
if (ret != 0) {
- RTE_LOG(ERR, LATENCY_STATS,
- "Cannot register mbuf field/flag for timestamp\n");
+ LATENCYSTATS_LOG(ERR,
+ "Cannot register mbuf field/flag for timestamp");
return -rte_errno;
}
@@ -263,9 +264,9 @@ rte_latencystats_init(uint64_t app_samp_intvl,
ret = rte_eth_dev_info_get(pid, &dev_info);
if (ret != 0) {
- RTE_LOG(INFO, LATENCY_STATS,
- "Error during getting device (port %u) info: %s\n",
- pid, strerror(-ret));
+ LATENCYSTATS_LOG(INFO,
+ "Error during getting device (port %u) info: %s",
+ pid, strerror(-ret));
continue;
}
@@ -275,18 +276,18 @@ rte_latencystats_init(uint64_t app_samp_intvl,
cbs->cb = rte_eth_add_first_rx_callback(pid, qid,
add_time_stamps, user_cb);
if (!cbs->cb)
- RTE_LOG(INFO, LATENCY_STATS, "Failed to "
- "register Rx callback for pid=%d, "
- "qid=%d\n", pid, qid);
+ LATENCYSTATS_LOG(INFO,
+ "Failed to register Rx callback for pid=%d, qid=%d",
+ pid, qid);
}
for (qid = 0; qid < dev_info.nb_tx_queues; qid++) {
cbs = &tx_cbs[pid][qid];
cbs->cb = rte_eth_add_tx_callback(pid, qid,
calc_latency, user_cb);
if (!cbs->cb)
- RTE_LOG(INFO, LATENCY_STATS, "Failed to "
- "register Tx callback for pid=%d, "
- "qid=%d\n", pid, qid);
+ LATENCYSTATS_LOG(INFO,
+ "Failed to register Tx callback for pid=%d, qid=%d",
+ pid, qid);
}
}
return 0;
@@ -307,8 +308,8 @@ rte_latencystats_uninit(void)
ret = rte_eth_dev_info_get(pid, &dev_info);
if (ret != 0) {
- RTE_LOG(INFO, LATENCY_STATS,
- "Error during getting device (port %u) info: %s\n",
+ LATENCYSTATS_LOG(INFO,
+ "Error during getting device (port %u) info: %s",
pid, strerror(-ret));
continue;
@@ -318,17 +319,17 @@ rte_latencystats_uninit(void)
cbs = &rx_cbs[pid][qid];
ret = rte_eth_remove_rx_callback(pid, qid, cbs->cb);
if (ret)
- RTE_LOG(INFO, LATENCY_STATS, "failed to "
- "remove Rx callback for pid=%d, "
- "qid=%d\n", pid, qid);
+ LATENCYSTATS_LOG(INFO,
+ "failed to remove Rx callback for pid=%d, qid=%d",
+ pid, qid);
}
for (qid = 0; qid < dev_info.nb_tx_queues; qid++) {
cbs = &tx_cbs[pid][qid];
ret = rte_eth_remove_tx_callback(pid, qid, cbs->cb);
if (ret)
- RTE_LOG(INFO, LATENCY_STATS, "failed to "
- "remove Tx callback for pid=%d, "
- "qid=%d\n", pid, qid);
+ LATENCYSTATS_LOG(INFO,
+ "failed to remove Tx callback for pid=%d, qid=%d",
+ pid, qid);
}
}
@@ -365,8 +366,8 @@ rte_latencystats_get(struct rte_metric_value *values, uint16_t size)
const struct rte_memzone *mz;
mz = rte_memzone_lookup(MZ_RTE_LATENCY_STATS);
if (mz == NULL) {
- RTE_LOG(ERR, LATENCY_STATS,
- "Latency stats memzone not found\n");
+ LATENCYSTATS_LOG(ERR,
+ "Latency stats memzone not found");
return -ENOMEM;
}
glob_stats = mz->addr;
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v3 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1
2023-02-10 0:22 ` [PATCH v3 0/5] Replace use of RTE_LOGTYPE_USER1 in library Stephen Hemminger
` (2 preceding siblings ...)
2023-02-10 0:22 ` [PATCH v3 3/5] latencystats: use " Stephen Hemminger
@ 2023-02-10 0:22 ` Stephen Hemminger
2023-02-10 9:58 ` Maxime Coquelin
2023-02-10 0:22 ` [PATCH v3 5/5] ipsec: fix usage " Stephen Hemminger
4 siblings, 1 reply; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-10 0:22 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Chenbo Xia, Maxime Coquelin
Fix instances of USER1 logtype in fdset and crypto
sections.
Acked-by: Chenbo Xia <chenbo.xia@intel.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/vhost/fd_man.c | 16 +++++++++-------
lib/vhost/vhost_crypto.c | 25 +++++++++++--------------
2 files changed, 20 insertions(+), 21 deletions(-)
diff --git a/lib/vhost/fd_man.c b/lib/vhost/fd_man.c
index 1876fada3354..172f7dc03ab2 100644
--- a/lib/vhost/fd_man.c
+++ b/lib/vhost/fd_man.c
@@ -10,8 +10,10 @@
#include "fd_man.h"
-
-#define RTE_LOGTYPE_VHOST_FDMAN RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER_SUFFIX(vhost_fdset_logtype, fdset, INFO);
+#define FDSET_LOG(level, fmt, args...) \
+ rte_log(RTE_LOG_ ## level, vhost_fdset_logtype, \
+ "%s(): " fmt "\n", __func__, ## args)
#define FDPOLLERR (POLLERR | POLLHUP | POLLNVAL)
@@ -334,8 +336,8 @@ fdset_pipe_init(struct fdset *fdset)
int ret;
if (pipe(fdset->u.pipefd) < 0) {
- RTE_LOG(ERR, VHOST_FDMAN,
- "failed to create pipe for vhost fdset\n");
+ FDSET_LOG(ERR,
+ "failed to create pipe for vhost fdset");
return -1;
}
@@ -343,9 +345,9 @@ fdset_pipe_init(struct fdset *fdset)
fdset_pipe_read_cb, NULL, NULL);
if (ret < 0) {
- RTE_LOG(ERR, VHOST_FDMAN,
- "failed to add pipe readfd %d into vhost server fdset\n",
- fdset->u.readfd);
+ FDSET_LOG(ERR,
+ "failed to add pipe readfd %d into vhost server fdset",
+ fdset->u.readfd);
fdset_pipe_uninit(fdset);
return -1;
diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index f02bf865c349..3be46614c22a 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -4,6 +4,7 @@
#include <rte_malloc.h>
#include <rte_hash.h>
#include <rte_jhash.h>
+#include <rte_log.h>
#include <rte_mbuf.h>
#include <rte_cryptodev.h>
@@ -16,22 +17,18 @@
#define IV_OFFSET (sizeof(struct rte_crypto_op) + \
sizeof(struct rte_crypto_sym_op))
+RTE_LOG_REGISTER_SUFFIX(vhost_crypto_logtype, crypto, INFO);
+
+#define VC_LOG(level, fmt, args...) \
+ rte_log(RTE_LOG_ ## level, vhost_crypto_logtype, \
+ "%s():%u: " fmt "\n", __func__, __LINE__, ## args)
+
+#define VC_LOG_ERR(fmt, args...) VC_LOG(ERR, fmt, ## args)
+#define VC_LOG_INFO(fmt, args...) VC_LOG(INFO, fmt, ## args)
+
#ifdef RTE_LIBRTE_VHOST_DEBUG
-#define VC_LOG_ERR(fmt, args...) \
- RTE_LOG(ERR, USER1, "[%s] %s() line %u: " fmt "\n", \
- "Vhost-Crypto", __func__, __LINE__, ## args)
-#define VC_LOG_INFO(fmt, args...) \
- RTE_LOG(INFO, USER1, "[%s] %s() line %u: " fmt "\n", \
- "Vhost-Crypto", __func__, __LINE__, ## args)
-
-#define VC_LOG_DBG(fmt, args...) \
- RTE_LOG(DEBUG, USER1, "[%s] %s() line %u: " fmt "\n", \
- "Vhost-Crypto", __func__, __LINE__, ## args)
+#define VC_LOG_DBG(fmt, args...) VC_LOG(DEBUG, fmt, ## args)
#else
-#define VC_LOG_ERR(fmt, args...) \
- RTE_LOG(ERR, USER1, "[VHOST-Crypto]: " fmt "\n", ## args)
-#define VC_LOG_INFO(fmt, args...) \
- RTE_LOG(INFO, USER1, "[VHOST-Crypto]: " fmt "\n", ## args)
#define VC_LOG_DBG(fmt, args...)
#endif
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v3 5/5] ipsec: fix usage of RTE_LOGTYPE_USER1
2023-02-10 0:22 ` [PATCH v3 0/5] Replace use of RTE_LOGTYPE_USER1 in library Stephen Hemminger
` (3 preceding siblings ...)
2023-02-10 0:22 ` [PATCH v3 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1 Stephen Hemminger
@ 2023-02-10 0:22 ` Stephen Hemminger
4 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-10 0:22 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, kai.ji, Pablo de Lara, Arkadiusz Kusztal
There already is a logtype in this driver, use it!
Fixes: b35848bc01f6 ("crypto/ipsec_mb: add multi-process IPC request handler")
Cc: kai.ji@intel.com
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
index 3e52f9567401..e9eb0d15b794 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
@@ -7,6 +7,7 @@
#include <rte_common.h>
#include <rte_malloc.h>
+#include <rte_log.h>
#include "ipsec_mb_private.h"
@@ -125,7 +126,7 @@ ipsec_mb_secondary_qp_op(int dev_id, int qp_id,
qp_req_msg.num_fds = 0;
ret = rte_mp_request_sync(&qp_req_msg, &qp_resp, &ts);
if (ret) {
- RTE_LOG(ERR, USER1, "Create MR request to primary process failed.");
+ IPSEC_MB_LOG(ERR, "Create MR request to primary process failed.");
return -1;
}
qp_resp_msg = &qp_resp.msgs[0];
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v3 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1
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
0 siblings, 0 replies; 50+ messages in thread
From: Maxime Coquelin @ 2023-02-10 9:58 UTC (permalink / raw)
To: Stephen Hemminger, dev; +Cc: Chenbo Xia
On 2/10/23 01:22, Stephen Hemminger wrote:
> Fix instances of USER1 logtype in fdset and crypto
> sections.
>
> Acked-by: Chenbo Xia <chenbo.xia@intel.com>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> lib/vhost/fd_man.c | 16 +++++++++-------
> lib/vhost/vhost_crypto.c | 25 +++++++++++--------------
> 2 files changed, 20 insertions(+), 21 deletions(-)
>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v4 0/5] Replace use of RTE_LOGTYPE_USER1 in library
2023-02-08 4:48 [PATCH 0/5] Fix use of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
` (5 preceding siblings ...)
2023-02-10 0:22 ` [PATCH v3 0/5] Replace use of RTE_LOGTYPE_USER1 in library Stephen Hemminger
@ 2023-02-10 17:15 ` Stephen Hemminger
2023-02-10 17:15 ` [PATCH v4 1/5] ip_frag: use a dynamic logtype Stephen Hemminger
` (4 more replies)
2023-02-12 16:14 ` [PATCH 0/5] Replace us of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
` (2 subsequent siblings)
9 siblings, 5 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-10 17:15 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
The DPDK libraries and drivers should not be using the USER1 logtype.
v4 - fix build compile error with debug enabled
v3 - fix typo in ip_frag
v2 - fix some compiler warnings
Stephen Hemminger (5):
ip_frag: use a dynamic logtype
reorder: use a dynamic logtype
latencystats: use dynamic logtype
vhost: use logtype instead of RTE_LOGTYPE_USER1
ipsec: fix usage of RTE_LOGTYPE_USER1
drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 3 +-
lib/ip_frag/ip_frag_common.h | 16 ++-
lib/ip_frag/ip_frag_internal.c | 174 ++++++++++++-------------
lib/ip_frag/rte_ip_frag_common.c | 13 +-
lib/ip_frag/rte_ipv4_reassembly.c | 14 +-
lib/ip_frag/rte_ipv6_reassembly.c | 59 ++++-----
lib/latencystats/rte_latencystats.c | 55 ++++----
lib/reorder/rte_reorder.c | 35 ++---
lib/vhost/fd_man.c | 16 ++-
lib/vhost/vhost_crypto.c | 25 ++--
10 files changed, 207 insertions(+), 203 deletions(-)
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v4 1/5] ip_frag: use a dynamic logtype
2023-02-10 17:15 ` [PATCH v4 0/5] Replace use of RTE_LOGTYPE_USER1 in library Stephen Hemminger
@ 2023-02-10 17:15 ` Stephen Hemminger
2023-02-10 17:15 ` [PATCH v4 2/5] reorder: " Stephen Hemminger
` (3 subsequent siblings)
4 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-10 17:15 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, Konstantin Ananyev, Anatoly Burakov, Thomas Monjalon
DPDK libraries should not be reusing RTE_LOGTYPE_USER1 in
lieu of doing proper logtype registration.
Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
Fixes: 416707812c03 ("ip_frag: refactor reassembly code into a proper library")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/ip_frag/ip_frag_common.h | 16 ++-
lib/ip_frag/ip_frag_internal.c | 174 +++++++++++++++---------------
lib/ip_frag/rte_ip_frag_common.c | 13 +--
lib/ip_frag/rte_ipv4_reassembly.c | 14 ++-
lib/ip_frag/rte_ipv6_reassembly.c | 59 +++++-----
5 files changed, 138 insertions(+), 138 deletions(-)
diff --git a/lib/ip_frag/ip_frag_common.h b/lib/ip_frag/ip_frag_common.h
index 9c0dbdeb6eb9..a20510a8345d 100644
--- a/lib/ip_frag/ip_frag_common.h
+++ b/lib/ip_frag/ip_frag_common.h
@@ -9,8 +9,16 @@
#include "ip_reassembly.h"
/* logging macros. */
+extern int ipfrag_logtype;
+
+#define IP_FRAG_ERR(fmt, args...) \
+ rte_log(RTE_LOG_ERR, ipfrag_logtype, \
+ "%s: " fmt "\n", __func__, ## args)
+
#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(RTE_LOG_ ## lvl, ipfrag_logtype, \
+ "%s: " fmt "\n", __func__, ## args)
#else
#define IP_FRAG_LOG(lvl, fmt, args...) do {} while(0)
#endif /* IP_FRAG_DEBUG */
@@ -111,9 +119,9 @@ ip_frag_free_immediate(struct ip_frag_pkt *fp)
for (i = 0; i < fp->last_idx; i++) {
if (fp->frags[i].mb != NULL) {
- IP_FRAG_LOG(DEBUG, "%s:%d\n"
- "mbuf: %p, tms: %" PRIu64", key: <%" PRIx64 ", %#x>\n",
- __func__, __LINE__, fp->frags[i].mb, fp->start,
+ IP_FRAG_LOG(DEBUG,
+ "mbuf: %p, tms: %" PRIu64", key: <%" PRIx64 ", %#x>",
+ fp->frags[i].mb, fp->start,
fp->key.src_dst[0], fp->key.id);
rte_pktmbuf_free(fp->frags[i].mb);
fp->frags[i].mb = NULL;
diff --git a/lib/ip_frag/ip_frag_internal.c b/lib/ip_frag/ip_frag_internal.c
index b436a4c9313b..dffaa41734c9 100644
--- a/lib/ip_frag/ip_frag_internal.c
+++ b/lib/ip_frag/ip_frag_internal.c
@@ -89,7 +89,7 @@ ipv6_frag_hash(const struct ip_frag_key *key, uint32_t *v1, uint32_t *v2)
struct rte_mbuf *
ip_frag_process(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr,
- struct rte_mbuf *mb, uint16_t ofs, uint16_t len, uint16_t more_frags)
+ struct rte_mbuf *mb, uint16_t ofs, uint16_t len, uint16_t more_frags)
{
uint32_t idx;
@@ -98,15 +98,15 @@ ip_frag_process(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr,
/* this is the first fragment. */
if (ofs == 0) {
idx = (fp->frags[IP_FIRST_FRAG_IDX].mb == NULL) ?
- IP_FIRST_FRAG_IDX : UINT32_MAX;
+ IP_FIRST_FRAG_IDX : UINT32_MAX;
- /* this is the last fragment. */
+ /* this is the last fragment. */
} else if (more_frags == 0) {
fp->total_size = ofs + len;
idx = (fp->frags[IP_LAST_FRAG_IDX].mb == NULL) ?
- IP_LAST_FRAG_IDX : UINT32_MAX;
+ IP_LAST_FRAG_IDX : UINT32_MAX;
- /* this is the intermediate fragment. */
+ /* this is the intermediate fragment. */
} else if ((idx = fp->last_idx) < RTE_DIM(fp->frags)) {
fp->last_idx++;
}
@@ -119,31 +119,31 @@ ip_frag_process(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr,
/* report an error. */
if (fp->key.key_len == IPV4_KEYLEN)
- IP_FRAG_LOG(DEBUG, "%s:%d invalid fragmented packet:\n"
- "ipv4_frag_pkt: %p, key: <%" PRIx64 ", %#x>, "
- "total_size: %u, frag_size: %u, last_idx: %u\n"
- "first fragment: ofs: %u, len: %u\n"
- "last fragment: ofs: %u, len: %u\n\n",
- __func__, __LINE__,
- fp, fp->key.src_dst[0], fp->key.id,
- fp->total_size, fp->frag_size, fp->last_idx,
- fp->frags[IP_FIRST_FRAG_IDX].ofs,
- fp->frags[IP_FIRST_FRAG_IDX].len,
- fp->frags[IP_LAST_FRAG_IDX].ofs,
- fp->frags[IP_LAST_FRAG_IDX].len);
+ IP_FRAG_LOG(DEBUG,
+ "invalid fragmented packet:\n"
+ "ipv4_frag_pkt: %p, key: <%" PRIx64 ", %#x>, "
+ "total_size: %u, frag_size: %u, last_idx: %u\n"
+ "first fragment: ofs: %u, len: %u\n"
+ "last fragment: ofs: %u, len: %u\n",
+ fp, fp->key.src_dst[0], fp->key.id,
+ fp->total_size, fp->frag_size, fp->last_idx,
+ fp->frags[IP_FIRST_FRAG_IDX].ofs,
+ fp->frags[IP_FIRST_FRAG_IDX].len,
+ fp->frags[IP_LAST_FRAG_IDX].ofs,
+ fp->frags[IP_LAST_FRAG_IDX].len);
else
- IP_FRAG_LOG(DEBUG, "%s:%d invalid fragmented packet:\n"
- "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, "
- "total_size: %u, frag_size: %u, last_idx: %u\n"
- "first fragment: ofs: %u, len: %u\n"
- "last fragment: ofs: %u, len: %u\n\n",
- __func__, __LINE__,
- fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id,
- fp->total_size, fp->frag_size, fp->last_idx,
- fp->frags[IP_FIRST_FRAG_IDX].ofs,
- fp->frags[IP_FIRST_FRAG_IDX].len,
- fp->frags[IP_LAST_FRAG_IDX].ofs,
- fp->frags[IP_LAST_FRAG_IDX].len);
+ IP_FRAG_LOG(DEBUG,
+ "invalid fragmented packet:\n"
+ "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, "
+ "total_size: %u, frag_size: %u, last_idx: %u\n"
+ "first fragment: ofs: %u, len: %u\n"
+ "last fragment: ofs: %u, len: %u\n",
+ fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id,
+ fp->total_size, fp->frag_size, fp->last_idx,
+ fp->frags[IP_FIRST_FRAG_IDX].ofs,
+ fp->frags[IP_FIRST_FRAG_IDX].len,
+ fp->frags[IP_LAST_FRAG_IDX].ofs,
+ fp->frags[IP_LAST_FRAG_IDX].len);
/* free all fragments, invalidate the entry. */
ip_frag_free(fp, dr);
@@ -163,9 +163,9 @@ ip_frag_process(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr,
if (likely (fp->frag_size < fp->total_size)) {
return mb;
- /* if we collected all fragments, then try to reassemble. */
+ /* if we collected all fragments, then try to reassemble. */
} else if (fp->frag_size == fp->total_size &&
- fp->frags[IP_FIRST_FRAG_IDX].mb != NULL) {
+ fp->frags[IP_FIRST_FRAG_IDX].mb != NULL) {
if (fp->key.key_len == IPV4_KEYLEN)
mb = ipv4_frag_reassemble(fp);
else
@@ -177,31 +177,31 @@ ip_frag_process(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr,
/* report an error. */
if (fp->key.key_len == IPV4_KEYLEN)
- IP_FRAG_LOG(DEBUG, "%s:%d invalid fragmented packet:\n"
- "ipv4_frag_pkt: %p, key: <%" PRIx64 ", %#x>, "
- "total_size: %u, frag_size: %u, last_idx: %u\n"
- "first fragment: ofs: %u, len: %u\n"
- "last fragment: ofs: %u, len: %u\n\n",
- __func__, __LINE__,
- fp, fp->key.src_dst[0], fp->key.id,
- fp->total_size, fp->frag_size, fp->last_idx,
- fp->frags[IP_FIRST_FRAG_IDX].ofs,
- fp->frags[IP_FIRST_FRAG_IDX].len,
- fp->frags[IP_LAST_FRAG_IDX].ofs,
- fp->frags[IP_LAST_FRAG_IDX].len);
+ IP_FRAG_LOG(DEBUG,
+ "invalid fragmented packet:\n"
+ "ipv4_frag_pkt: %p, key: <%" PRIx64 ", %#x>, "
+ "total_size: %u, frag_size: %u, last_idx: %u\n"
+ "first fragment: ofs: %u, len: %u\n"
+ "last fragment: ofs: %u, len: %u\n",
+ fp, fp->key.src_dst[0], fp->key.id,
+ fp->total_size, fp->frag_size, fp->last_idx,
+ fp->frags[IP_FIRST_FRAG_IDX].ofs,
+ fp->frags[IP_FIRST_FRAG_IDX].len,
+ fp->frags[IP_LAST_FRAG_IDX].ofs,
+ fp->frags[IP_LAST_FRAG_IDX].len);
else
- IP_FRAG_LOG(DEBUG, "%s:%d invalid fragmented packet:\n"
- "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, "
- "total_size: %u, frag_size: %u, last_idx: %u\n"
- "first fragment: ofs: %u, len: %u\n"
- "last fragment: ofs: %u, len: %u\n\n",
- __func__, __LINE__,
- fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id,
- fp->total_size, fp->frag_size, fp->last_idx,
- fp->frags[IP_FIRST_FRAG_IDX].ofs,
- fp->frags[IP_FIRST_FRAG_IDX].len,
- fp->frags[IP_LAST_FRAG_IDX].ofs,
- fp->frags[IP_LAST_FRAG_IDX].len);
+ IP_FRAG_LOG(DEBUG,
+ "invalid fragmented packet:\n"
+ "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, "
+ "total_size: %u, frag_size: %u, last_idx: %u\n"
+ "first fragment: ofs: %u, len: %u\n"
+ "last fragment: ofs: %u, len: %u\n",
+ fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id,
+ fp->total_size, fp->frag_size, fp->last_idx,
+ fp->frags[IP_FIRST_FRAG_IDX].ofs,
+ fp->frags[IP_FIRST_FRAG_IDX].len,
+ fp->frags[IP_LAST_FRAG_IDX].ofs,
+ fp->frags[IP_LAST_FRAG_IDX].len);
/* free associated resources. */
ip_frag_free(fp, dr);
@@ -282,8 +282,8 @@ ip_frag_find(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr,
struct ip_frag_pkt *
ip_frag_lookup(struct rte_ip_frag_tbl *tbl,
- const struct ip_frag_key *key, uint64_t tms,
- struct ip_frag_pkt **free, struct ip_frag_pkt **stale)
+ const struct ip_frag_key *key, uint64_t tms,
+ struct ip_frag_pkt **free, struct ip_frag_pkt **stale)
{
struct ip_frag_pkt *p1, *p2;
struct ip_frag_pkt *empty, *old;
@@ -310,23 +310,21 @@ ip_frag_lookup(struct rte_ip_frag_tbl *tbl,
for (i = 0; i != assoc; i++) {
if (p1->key.key_len == IPV4_KEYLEN)
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
- "tbl: %p, max_entries: %u, use_entries: %u\n"
- "ipv4_frag_pkt line0: %p, index: %u from %u\n"
- "key: <%" PRIx64 ", %#x>, start: %" PRIu64 "\n",
- __func__, __LINE__,
- tbl, tbl->max_entries, tbl->use_entries,
- p1, i, assoc,
- p1[i].key.src_dst[0], p1[i].key.id, p1[i].start);
+ IP_FRAG_LOG(DEBUG,
+ "tbl: %p, max_entries: %u, use_entries: %u\n"
+ "ipv4_frag_pkt line0: %p, index: %u from %u\n"
+ "key: <%" PRIx64 ", %#x>, start: %" PRIu64,
+ tbl, tbl->max_entries, tbl->use_entries,
+ p1, i, assoc,
+ p1[i].key.src_dst[0], p1[i].key.id, p1[i].start);
else
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
- "tbl: %p, max_entries: %u, use_entries: %u\n"
- "ipv6_frag_pkt line0: %p, index: %u from %u\n"
- "key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64 "\n",
- __func__, __LINE__,
- tbl, tbl->max_entries, tbl->use_entries,
- p1, i, assoc,
- IPv6_KEY_BYTES(p1[i].key.src_dst), p1[i].key.id, p1[i].start);
+ IP_FRAG_LOG(DEBUG,
+ "tbl: %p, max_entries: %u, use_entries: %u\n"
+ "ipv6_frag_pkt line0: %p, index: %u from %u\n"
+ "key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64,
+ tbl, tbl->max_entries, tbl->use_entries,
+ p1, i, assoc,
+ IPv6_KEY_BYTES(p1[i].key.src_dst), p1[i].key.id, p1[i].start);
if (ip_frag_key_cmp(key, &p1[i].key) == 0)
return p1 + i;
@@ -336,23 +334,21 @@ ip_frag_lookup(struct rte_ip_frag_tbl *tbl,
old = (old == NULL) ? (p1 + i) : old;
if (p2->key.key_len == IPV4_KEYLEN)
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
- "tbl: %p, max_entries: %u, use_entries: %u\n"
- "ipv4_frag_pkt line1: %p, index: %u from %u\n"
- "key: <%" PRIx64 ", %#x>, start: %" PRIu64 "\n",
- __func__, __LINE__,
- tbl, tbl->max_entries, tbl->use_entries,
- p2, i, assoc,
- p2[i].key.src_dst[0], p2[i].key.id, p2[i].start);
+ IP_FRAG_LOG(DEBUG,
+ "tbl: %p, max_entries: %u, use_entries: %u\n"
+ "ipv4_frag_pkt line1: %p, index: %u from %u\n"
+ "key: <%" PRIx64 ", %#x>, start: %" PRIu64,
+ tbl, tbl->max_entries, tbl->use_entries,
+ p2, i, assoc,
+ p2[i].key.src_dst[0], p2[i].key.id, p2[i].start);
else
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
- "tbl: %p, max_entries: %u, use_entries: %u\n"
- "ipv6_frag_pkt line1: %p, index: %u from %u\n"
- "key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64 "\n",
- __func__, __LINE__,
- tbl, tbl->max_entries, tbl->use_entries,
- p2, i, assoc,
- IPv6_KEY_BYTES(p2[i].key.src_dst), p2[i].key.id, p2[i].start);
+ IP_FRAG_LOG(DEBUG,
+ "tbl: %p, max_entries: %u, use_entries: %u\n"
+ "ipv6_frag_pkt line1: %p, index: %u from %u\n"
+ "key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64,
+ tbl, tbl->max_entries, tbl->use_entries,
+ p2, i, assoc,
+ IPv6_KEY_BYTES(p2[i].key.src_dst), p2[i].key.id, p2[i].start);
if (ip_frag_key_cmp(key, &p2[i].key) == 0)
return p2 + i;
diff --git a/lib/ip_frag/rte_ip_frag_common.c b/lib/ip_frag/rte_ip_frag_common.c
index c1de2e81b6d0..b8ca9e019c54 100644
--- a/lib/ip_frag/rte_ip_frag_common.c
+++ b/lib/ip_frag/rte_ip_frag_common.c
@@ -52,21 +52,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__);
+ IP_FRAG_ERR("invalid input parameter");
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,
- "%s: allocation of %zu bytes at socket %d failed do\n",
- __func__, sz, socket_id);
+ IP_FRAG_ERR("allocation of %zu bytes at socket %d failed do",
+ sz, socket_id);
return NULL;
}
- RTE_LOG(INFO, USER1, "%s: allocated of %zu bytes at socket %d\n",
- __func__, sz, socket_id);
+ IP_FRAG_LOG(INFO, "allocated of %zu bytes at socket %d",
+ sz, socket_id);
tbl->max_cycles = max_cycles;
tbl->max_entries = max_entries;
@@ -142,3 +141,5 @@ rte_ip_frag_table_del_expired_entries(struct rte_ip_frag_tbl *tbl,
} else
return;
}
+
+RTE_LOG_REGISTER_DEFAULT(ipfrag_logtype, INFO);
diff --git a/lib/ip_frag/rte_ipv4_reassembly.c b/lib/ip_frag/rte_ipv4_reassembly.c
index 4a89a5f5365a..2cdbdc4ee87f 100644
--- a/lib/ip_frag/rte_ipv4_reassembly.c
+++ b/lib/ip_frag/rte_ipv4_reassembly.c
@@ -120,12 +120,11 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
ip_len = rte_be_to_cpu_16(ip_hdr->total_length) - mb->l3_len;
trim = mb->pkt_len - (ip_len + mb->l3_len + mb->l2_len);
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
+ IP_FRAG_LOG(DEBUG,
"mbuf: %p, tms: %" PRIu64 ", key: <%" PRIx64 ", %#x>"
"ofs: %u, len: %d, padding: %d, flags: %#x\n"
"tbl: %p, max_cycles: %" PRIu64 ", entry_mask: %#x, "
- "max_entries: %u, use_entries: %u\n\n",
- __func__, __LINE__,
+ "max_entries: %u, use_entries: %u\n",
mb, tms, key.src_dst[0], key.id, ip_ofs, ip_len, trim, ip_flag,
tbl, tbl->max_cycles, tbl->entry_mask, tbl->max_entries,
tbl->use_entries);
@@ -145,11 +144,10 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
return NULL;
}
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
+ IP_FRAG_LOG(DEBUG,
"tbl: %p, max_entries: %u, use_entries: %u\n"
"ipv4_frag_pkt: %p, key: <%" PRIx64 ", %#x>, start: %" PRIu64
- ", total_size: %u, frag_size: %u, last_idx: %u\n\n",
- __func__, __LINE__,
+ ", total_size: %u, frag_size: %u, last_idx: %u\n",
tbl, tbl->max_entries, tbl->use_entries,
fp, fp->key.src_dst[0], fp->key.id, fp->start,
fp->total_size, fp->frag_size, fp->last_idx);
@@ -159,11 +157,11 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
mb = ip_frag_process(fp, dr, mb, ip_ofs, ip_len, ip_flag);
ip_frag_inuse(tbl, fp);
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
+ IP_FRAG_LOG(DEBUG,
"mbuf: %p\n"
"tbl: %p, max_entries: %u, use_entries: %u\n"
"ipv4_frag_pkt: %p, key: <%" PRIx64 ", %#x>, start: %" PRIu64
- ", total_size: %u, frag_size: %u, last_idx: %u\n\n",
+ ", total_size: %u, frag_size: %u, last_idx: %u\n",
__func__, __LINE__, mb,
tbl, tbl->max_entries, tbl->use_entries,
fp, fp->key.src_dst[0], fp->key.id, fp->start,
diff --git a/lib/ip_frag/rte_ipv6_reassembly.c b/lib/ip_frag/rte_ipv6_reassembly.c
index d4019e87e63a..c3e369f4ce42 100644
--- a/lib/ip_frag/rte_ipv6_reassembly.c
+++ b/lib/ip_frag/rte_ipv6_reassembly.c
@@ -135,8 +135,8 @@ ipv6_frag_reassemble(struct ip_frag_pkt *fp)
#define FRAG_OFFSET(x) (rte_cpu_to_be_16(x) >> 3)
struct rte_mbuf *
rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
- struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms,
- struct rte_ipv6_hdr *ip_hdr, struct rte_ipv6_fragment_ext *frag_hdr)
+ struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms,
+ struct rte_ipv6_hdr *ip_hdr, struct rte_ipv6_fragment_ext *frag_hdr)
{
struct ip_frag_pkt *fp;
struct ip_frag_key key;
@@ -161,17 +161,16 @@ rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
ip_len = rte_be_to_cpu_16(ip_hdr->payload_len) - sizeof(*frag_hdr);
trim = mb->pkt_len - (ip_len + mb->l3_len + mb->l2_len);
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
- "mbuf: %p, tms: %" PRIu64
- ", key: <" IPv6_KEY_BYTES_FMT ", %#x>, "
- "ofs: %u, len: %d, padding: %d, flags: %#x\n"
- "tbl: %p, max_cycles: %" PRIu64 ", entry_mask: %#x, "
- "max_entries: %u, use_entries: %u\n\n",
- __func__, __LINE__,
- mb, tms, IPv6_KEY_BYTES(key.src_dst), key.id, ip_ofs, ip_len,
- trim, RTE_IPV6_GET_MF(frag_hdr->frag_data),
- tbl, tbl->max_cycles, tbl->entry_mask, tbl->max_entries,
- tbl->use_entries);
+ IP_FRAG_LOG(DEBUG,
+ "mbuf: %p, tms: %" PRIu64
+ ", key: <" IPv6_KEY_BYTES_FMT ", %#x>, "
+ "ofs: %u, len: %d, padding: %d, flags: %#x\n"
+ "tbl: %p, max_cycles: %" PRIu64 ", entry_mask: %#x, "
+ "max_entries: %u, use_entries: %u\n",
+ mb, tms, IPv6_KEY_BYTES(key.src_dst), key.id, ip_ofs, ip_len,
+ trim, RTE_IPV6_GET_MF(frag_hdr->frag_data),
+ tbl, tbl->max_cycles, tbl->entry_mask, tbl->max_entries,
+ tbl->use_entries);
/* check that fragment length is greater then zero. */
if (ip_len <= 0) {
@@ -189,30 +188,28 @@ rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
return NULL;
}
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
- "tbl: %p, max_entries: %u, use_entries: %u\n"
- "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64
- ", total_size: %u, frag_size: %u, last_idx: %u\n\n",
- __func__, __LINE__,
- tbl, tbl->max_entries, tbl->use_entries,
- fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id, fp->start,
- fp->total_size, fp->frag_size, fp->last_idx);
+ IP_FRAG_LOG(DEBUG,
+ "tbl: %p, max_entries: %u, use_entries: %u\n"
+ "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64
+ ", total_size: %u, frag_size: %u, last_idx: %u\n",
+ tbl, tbl->max_entries, tbl->use_entries,
+ fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id, fp->start,
+ fp->total_size, fp->frag_size, fp->last_idx);
/* process the fragmented packet. */
mb = ip_frag_process(fp, dr, mb, ip_ofs, ip_len,
- MORE_FRAGS(frag_hdr->frag_data));
+ MORE_FRAGS(frag_hdr->frag_data));
ip_frag_inuse(tbl, fp);
- IP_FRAG_LOG(DEBUG, "%s:%d:\n"
- "mbuf: %p\n"
- "tbl: %p, max_entries: %u, use_entries: %u\n"
- "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64
- ", total_size: %u, frag_size: %u, last_idx: %u\n\n",
- __func__, __LINE__, mb,
- tbl, tbl->max_entries, tbl->use_entries,
- fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id, fp->start,
- fp->total_size, fp->frag_size, fp->last_idx);
+ IP_FRAG_LOG(DEBUG,
+ "mbuf: %p\n"
+ "tbl: %p, max_entries: %u, use_entries: %u\n"
+ "ipv6_frag_pkt: %p, key: <" IPv6_KEY_BYTES_FMT ", %#x>, start: %" PRIu64
+ ", total_size: %u, frag_size: %u, last_idx: %u\n",
+ mb, tbl, tbl->max_entries, tbl->use_entries,
+ fp, IPv6_KEY_BYTES(fp->key.src_dst), fp->key.id, fp->start,
+ fp->total_size, fp->frag_size, fp->last_idx);
return mb;
}
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v4 2/5] reorder: use a dynamic logtype
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 ` Stephen Hemminger
2023-02-10 17:15 ` [PATCH v4 3/5] latencystats: use " Stephen Hemminger
` (2 subsequent siblings)
4 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-10 17:15 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, sergio.gonzalez.monroy, Reshma Pattan,
Declan Doherty, Richardson Bruce, Neil Horman
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
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v4 3/5] latencystats: use dynamic logtype
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 ` 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
4 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-10 17:15 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, reshma.pattan, Remy Horton, Harry van Haaren
Libraries should not reuse RTE_LOGTYPE_USER1 for their
logging. Instead they should register their own type.
Fixes: 5cd3cac9ed22 ("latency: added new library for latency stats")
Cc: reshma.pattan@intel.com
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/latencystats/rte_latencystats.c | 55 +++++++++++++++--------------
1 file changed, 28 insertions(+), 27 deletions(-)
diff --git a/lib/latencystats/rte_latencystats.c b/lib/latencystats/rte_latencystats.c
index 8985a377db4e..3a4c47e2b34a 100644
--- a/lib/latencystats/rte_latencystats.c
+++ b/lib/latencystats/rte_latencystats.c
@@ -26,7 +26,10 @@ latencystat_cycles_per_ns(void)
}
/* Macros for printing using RTE_LOG */
-#define RTE_LOGTYPE_LATENCY_STATS RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER_DEFAULT(latencystat_logtype, INFO);
+#define LATENCYSTATS_LOG(level, fmt, args...) \
+ rte_log(RTE_LOG_ ## level, latencystat_logtype, \
+ "%s(): " fmt "\n", __func__, ## args)
static uint64_t timestamp_dynflag;
static int timestamp_dynfield_offset = -1;
@@ -95,7 +98,7 @@ rte_latencystats_update(void)
latency_stats_index,
values, NUM_LATENCY_STATS);
if (ret < 0)
- RTE_LOG(INFO, LATENCY_STATS, "Failed to push the stats\n");
+ LATENCYSTATS_LOG(INFO, "Failed to push the stats");
return ret;
}
@@ -227,8 +230,7 @@ rte_latencystats_init(uint64_t app_samp_intvl,
mz = rte_memzone_reserve(MZ_RTE_LATENCY_STATS, sizeof(*glob_stats),
rte_socket_id(), flags);
if (mz == NULL) {
- RTE_LOG(ERR, LATENCY_STATS, "Cannot reserve memory: %s:%d\n",
- __func__, __LINE__);
+ LATENCYSTATS_LOG(ERR, "Cannot reserve memory");
return -ENOMEM;
}
@@ -243,8 +245,7 @@ rte_latencystats_init(uint64_t app_samp_intvl,
latency_stats_index = rte_metrics_reg_names(ptr_strings,
NUM_LATENCY_STATS);
if (latency_stats_index < 0) {
- RTE_LOG(DEBUG, LATENCY_STATS,
- "Failed to register latency stats names\n");
+ LATENCYSTATS_LOG(ERR, "Failed to register latency stats names");
return -1;
}
@@ -252,8 +253,8 @@ rte_latencystats_init(uint64_t app_samp_intvl,
ret = rte_mbuf_dyn_rx_timestamp_register(×tamp_dynfield_offset,
×tamp_dynflag);
if (ret != 0) {
- RTE_LOG(ERR, LATENCY_STATS,
- "Cannot register mbuf field/flag for timestamp\n");
+ LATENCYSTATS_LOG(ERR,
+ "Cannot register mbuf field/flag for timestamp");
return -rte_errno;
}
@@ -263,9 +264,9 @@ rte_latencystats_init(uint64_t app_samp_intvl,
ret = rte_eth_dev_info_get(pid, &dev_info);
if (ret != 0) {
- RTE_LOG(INFO, LATENCY_STATS,
- "Error during getting device (port %u) info: %s\n",
- pid, strerror(-ret));
+ LATENCYSTATS_LOG(INFO,
+ "Error during getting device (port %u) info: %s",
+ pid, strerror(-ret));
continue;
}
@@ -275,18 +276,18 @@ rte_latencystats_init(uint64_t app_samp_intvl,
cbs->cb = rte_eth_add_first_rx_callback(pid, qid,
add_time_stamps, user_cb);
if (!cbs->cb)
- RTE_LOG(INFO, LATENCY_STATS, "Failed to "
- "register Rx callback for pid=%d, "
- "qid=%d\n", pid, qid);
+ LATENCYSTATS_LOG(INFO,
+ "Failed to register Rx callback for pid=%d, qid=%d",
+ pid, qid);
}
for (qid = 0; qid < dev_info.nb_tx_queues; qid++) {
cbs = &tx_cbs[pid][qid];
cbs->cb = rte_eth_add_tx_callback(pid, qid,
calc_latency, user_cb);
if (!cbs->cb)
- RTE_LOG(INFO, LATENCY_STATS, "Failed to "
- "register Tx callback for pid=%d, "
- "qid=%d\n", pid, qid);
+ LATENCYSTATS_LOG(INFO,
+ "Failed to register Tx callback for pid=%d, qid=%d",
+ pid, qid);
}
}
return 0;
@@ -307,8 +308,8 @@ rte_latencystats_uninit(void)
ret = rte_eth_dev_info_get(pid, &dev_info);
if (ret != 0) {
- RTE_LOG(INFO, LATENCY_STATS,
- "Error during getting device (port %u) info: %s\n",
+ LATENCYSTATS_LOG(INFO,
+ "Error during getting device (port %u) info: %s",
pid, strerror(-ret));
continue;
@@ -318,17 +319,17 @@ rte_latencystats_uninit(void)
cbs = &rx_cbs[pid][qid];
ret = rte_eth_remove_rx_callback(pid, qid, cbs->cb);
if (ret)
- RTE_LOG(INFO, LATENCY_STATS, "failed to "
- "remove Rx callback for pid=%d, "
- "qid=%d\n", pid, qid);
+ LATENCYSTATS_LOG(INFO,
+ "failed to remove Rx callback for pid=%d, qid=%d",
+ pid, qid);
}
for (qid = 0; qid < dev_info.nb_tx_queues; qid++) {
cbs = &tx_cbs[pid][qid];
ret = rte_eth_remove_tx_callback(pid, qid, cbs->cb);
if (ret)
- RTE_LOG(INFO, LATENCY_STATS, "failed to "
- "remove Tx callback for pid=%d, "
- "qid=%d\n", pid, qid);
+ LATENCYSTATS_LOG(INFO,
+ "failed to remove Tx callback for pid=%d, qid=%d",
+ pid, qid);
}
}
@@ -365,8 +366,8 @@ rte_latencystats_get(struct rte_metric_value *values, uint16_t size)
const struct rte_memzone *mz;
mz = rte_memzone_lookup(MZ_RTE_LATENCY_STATS);
if (mz == NULL) {
- RTE_LOG(ERR, LATENCY_STATS,
- "Latency stats memzone not found\n");
+ LATENCYSTATS_LOG(ERR,
+ "Latency stats memzone not found");
return -ENOMEM;
}
glob_stats = mz->addr;
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v4 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1
2023-02-10 17:15 ` [PATCH v4 0/5] Replace use of RTE_LOGTYPE_USER1 in library Stephen Hemminger
` (2 preceding siblings ...)
2023-02-10 17:15 ` [PATCH v4 3/5] latencystats: use " Stephen Hemminger
@ 2023-02-10 17:15 ` Stephen Hemminger
2023-02-10 17:15 ` [PATCH v4 5/5] ipsec: fix usage " Stephen Hemminger
4 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-10 17:15 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Chenbo Xia, Maxime Coquelin
Fix instances of USER1 logtype in fdset and crypto
sections.
Acked-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/vhost/fd_man.c | 16 +++++++++-------
lib/vhost/vhost_crypto.c | 25 +++++++++++--------------
2 files changed, 20 insertions(+), 21 deletions(-)
diff --git a/lib/vhost/fd_man.c b/lib/vhost/fd_man.c
index 1876fada3354..172f7dc03ab2 100644
--- a/lib/vhost/fd_man.c
+++ b/lib/vhost/fd_man.c
@@ -10,8 +10,10 @@
#include "fd_man.h"
-
-#define RTE_LOGTYPE_VHOST_FDMAN RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER_SUFFIX(vhost_fdset_logtype, fdset, INFO);
+#define FDSET_LOG(level, fmt, args...) \
+ rte_log(RTE_LOG_ ## level, vhost_fdset_logtype, \
+ "%s(): " fmt "\n", __func__, ## args)
#define FDPOLLERR (POLLERR | POLLHUP | POLLNVAL)
@@ -334,8 +336,8 @@ fdset_pipe_init(struct fdset *fdset)
int ret;
if (pipe(fdset->u.pipefd) < 0) {
- RTE_LOG(ERR, VHOST_FDMAN,
- "failed to create pipe for vhost fdset\n");
+ FDSET_LOG(ERR,
+ "failed to create pipe for vhost fdset");
return -1;
}
@@ -343,9 +345,9 @@ fdset_pipe_init(struct fdset *fdset)
fdset_pipe_read_cb, NULL, NULL);
if (ret < 0) {
- RTE_LOG(ERR, VHOST_FDMAN,
- "failed to add pipe readfd %d into vhost server fdset\n",
- fdset->u.readfd);
+ FDSET_LOG(ERR,
+ "failed to add pipe readfd %d into vhost server fdset",
+ fdset->u.readfd);
fdset_pipe_uninit(fdset);
return -1;
diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index f02bf865c349..3be46614c22a 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -4,6 +4,7 @@
#include <rte_malloc.h>
#include <rte_hash.h>
#include <rte_jhash.h>
+#include <rte_log.h>
#include <rte_mbuf.h>
#include <rte_cryptodev.h>
@@ -16,22 +17,18 @@
#define IV_OFFSET (sizeof(struct rte_crypto_op) + \
sizeof(struct rte_crypto_sym_op))
+RTE_LOG_REGISTER_SUFFIX(vhost_crypto_logtype, crypto, INFO);
+
+#define VC_LOG(level, fmt, args...) \
+ rte_log(RTE_LOG_ ## level, vhost_crypto_logtype, \
+ "%s():%u: " fmt "\n", __func__, __LINE__, ## args)
+
+#define VC_LOG_ERR(fmt, args...) VC_LOG(ERR, fmt, ## args)
+#define VC_LOG_INFO(fmt, args...) VC_LOG(INFO, fmt, ## args)
+
#ifdef RTE_LIBRTE_VHOST_DEBUG
-#define VC_LOG_ERR(fmt, args...) \
- RTE_LOG(ERR, USER1, "[%s] %s() line %u: " fmt "\n", \
- "Vhost-Crypto", __func__, __LINE__, ## args)
-#define VC_LOG_INFO(fmt, args...) \
- RTE_LOG(INFO, USER1, "[%s] %s() line %u: " fmt "\n", \
- "Vhost-Crypto", __func__, __LINE__, ## args)
-
-#define VC_LOG_DBG(fmt, args...) \
- RTE_LOG(DEBUG, USER1, "[%s] %s() line %u: " fmt "\n", \
- "Vhost-Crypto", __func__, __LINE__, ## args)
+#define VC_LOG_DBG(fmt, args...) VC_LOG(DEBUG, fmt, ## args)
#else
-#define VC_LOG_ERR(fmt, args...) \
- RTE_LOG(ERR, USER1, "[VHOST-Crypto]: " fmt "\n", ## args)
-#define VC_LOG_INFO(fmt, args...) \
- RTE_LOG(INFO, USER1, "[VHOST-Crypto]: " fmt "\n", ## args)
#define VC_LOG_DBG(fmt, args...)
#endif
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v4 5/5] ipsec: fix usage of RTE_LOGTYPE_USER1
2023-02-10 17:15 ` [PATCH v4 0/5] Replace use of RTE_LOGTYPE_USER1 in library Stephen Hemminger
` (3 preceding siblings ...)
2023-02-10 17:15 ` [PATCH v4 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1 Stephen Hemminger
@ 2023-02-10 17:15 ` Stephen Hemminger
4 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-10 17:15 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, kai.ji, Pablo de Lara, Arkadiusz Kusztal
There already is a logtype in this driver, use it!
Fixes: b35848bc01f6 ("crypto/ipsec_mb: add multi-process IPC request handler")
Cc: kai.ji@intel.com
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
index 3e52f9567401..e9eb0d15b794 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
@@ -7,6 +7,7 @@
#include <rte_common.h>
#include <rte_malloc.h>
+#include <rte_log.h>
#include "ipsec_mb_private.h"
@@ -125,7 +126,7 @@ ipsec_mb_secondary_qp_op(int dev_id, int qp_id,
qp_req_msg.num_fds = 0;
ret = rte_mp_request_sync(&qp_req_msg, &qp_resp, &ts);
if (ret) {
- RTE_LOG(ERR, USER1, "Create MR request to primary process failed.");
+ IPSEC_MB_LOG(ERR, "Create MR request to primary process failed.");
return -1;
}
qp_resp_msg = &qp_resp.msgs[0];
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 0/5] Replace us of RTE_LOGTYPE_USER1 in libraries
2023-02-08 4:48 [PATCH 0/5] Fix use of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
` (6 preceding siblings ...)
2023-02-10 17:15 ` [PATCH v4 0/5] Replace use of RTE_LOGTYPE_USER1 in library Stephen Hemminger
@ 2023-02-12 16:14 ` Stephen Hemminger
2023-02-12 16:14 ` [PATCH 1/5] ip_frag: use a dynamic logtype Stephen Hemminger
` (4 more replies)
2023-02-20 18:49 ` [PATCH v6 0/5] Replace use of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
2023-08-14 16:31 ` [PATCH v8 0/6] Convert " Stephen Hemminger
9 siblings, 5 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-12 16:14 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
The DPDK libraries and drivers should not be using the USER1 logtype.
v5 - minimize the size of patches
Stephen Hemminger (5):
ip_frag: use a dynamic logtype
reorder: use a dynamic logtype
latencystats: use dynamic logtype
vhost: use logtype instead of RTE_LOGTYPE_USER1
ipsec: fix usage of RTE_LOGTYPE_USER1
drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 3 ++-
lib/ip_frag/ip_frag_common.h | 5 ++++-
lib/ip_frag/rte_ip_frag_common.c | 2 ++
lib/latencystats/rte_latencystats.c | 3 ++-
lib/reorder/rte_reorder.c | 6 +++---
lib/vhost/fd_man.c | 4 ++--
lib/vhost/vhost_crypto.c | 4 ++++
7 files changed, 19 insertions(+), 8 deletions(-)
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 1/5] ip_frag: use a dynamic logtype
2023-02-12 16:14 ` [PATCH 0/5] Replace us of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
@ 2023-02-12 16:14 ` Stephen Hemminger
2023-02-12 16:14 ` [PATCH 2/5] reorder: " Stephen Hemminger
` (3 subsequent siblings)
4 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-12 16:14 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, Konstantin Ananyev, Anatoly Burakov, Thomas Monjalon
DPDK libraries should not be reusing RTE_LOGTYPE_USER1 in
lieu of doing proper logtype registration.
Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
Fixes: 416707812c03 ("ip_frag: refactor reassembly code into a proper library")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/ip_frag/ip_frag_common.h | 5 ++++-
lib/ip_frag/rte_ip_frag_common.c | 2 ++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/ip_frag/ip_frag_common.h b/lib/ip_frag/ip_frag_common.h
index 9c0dbdeb6eb9..95f1689d476d 100644
--- a/lib/ip_frag/ip_frag_common.h
+++ b/lib/ip_frag/ip_frag_common.h
@@ -8,9 +8,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..e4af8d23ad10 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.h>
+RTE_LOG_REGISTER_DEFAULT(ipfrag_logtype, INFO);
+
#include "ip_frag_common.h"
#define IP_FRAG_HASH_FNUM 2
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 2/5] reorder: use a dynamic logtype
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 ` Stephen Hemminger
2023-02-12 16:14 ` [PATCH 3/5] latencystats: use " Stephen Hemminger
` (2 subsequent siblings)
4 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-12 16:14 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, sergio.gonzalez.monroy, Reshma Pattan,
Declan Doherty, Neil Horman, Richardson Bruce
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 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/reorder/rte_reorder.c b/lib/reorder/rte_reorder.c
index 385ee479da42..37bf132946b7 100644
--- a/lib/reorder/rte_reorder.c
+++ b/lib/reorder/rte_reorder.c
@@ -15,6 +15,9 @@
#include "rte_reorder.h"
+RTE_LOG_REGISTER_DEFAULT(reorder_logtype, INFO);
+#define RTE_LOGTYPE_REORDER reorder_logtype
+
TAILQ_HEAD(rte_reorder_list, rte_tailq_entry);
static struct rte_tailq_elem rte_reorder_tailq = {
@@ -26,9 +29,6 @@ EAL_REGISTER_TAILQ(rte_reorder_tailq)
#define RTE_REORDER_PREFIX "RO_"
#define RTE_REORDER_NAMESIZE 32
-/* Macros for printing using RTE_LOG */
-#define RTE_LOGTYPE_REORDER RTE_LOGTYPE_USER1
-
#define RTE_REORDER_SEQN_DYNFIELD_NAME "rte_reorder_seqn_dynfield"
int rte_reorder_seqn_dynfield_offset = -1;
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 3/5] latencystats: use dynamic logtype
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 ` 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
4 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-12 16:14 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, reshma.pattan, Remy Horton, Harry van Haaren
Libraries should not reuse RTE_LOGTYPE_USER1 for their
logging. Instead they should register their own type.
Fixes: 5cd3cac9ed22 ("latency: added new library for latency stats")
Cc: reshma.pattan@intel.com
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/latencystats/rte_latencystats.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/latencystats/rte_latencystats.c b/lib/latencystats/rte_latencystats.c
index 8985a377db4e..f3c1746cca00 100644
--- a/lib/latencystats/rte_latencystats.c
+++ b/lib/latencystats/rte_latencystats.c
@@ -26,7 +26,8 @@ latencystat_cycles_per_ns(void)
}
/* Macros for printing using RTE_LOG */
-#define RTE_LOGTYPE_LATENCY_STATS RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER_DEFAULT(latencystat_logtype, INFO);
+#define RTE_LOGTYPE_LATENCY_STATS latencystat_logtype
static uint64_t timestamp_dynflag;
static int timestamp_dynfield_offset = -1;
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1
2023-02-12 16:14 ` [PATCH 0/5] Replace us of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
` (2 preceding siblings ...)
2023-02-12 16:14 ` [PATCH 3/5] latencystats: use " Stephen Hemminger
@ 2023-02-12 16:14 ` Stephen Hemminger
2023-02-12 16:14 ` [PATCH 5/5] ipsec: fix usage " Stephen Hemminger
4 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-12 16:14 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Chenbo Xia, Maxime Coquelin
Fix instances of USER1 logtype in fdset and crypto
sections.
Acked-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/vhost/fd_man.c | 4 ++--
lib/vhost/vhost_crypto.c | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/vhost/fd_man.c b/lib/vhost/fd_man.c
index 1876fada3354..46037d02784e 100644
--- a/lib/vhost/fd_man.c
+++ b/lib/vhost/fd_man.c
@@ -10,8 +10,8 @@
#include "fd_man.h"
-
-#define RTE_LOGTYPE_VHOST_FDMAN RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER_SUFFIX(vhost_fdset_logtype, fdset, INFO);
+#define RTE_LOGTYPE_VHOST_FDMAN vhost_fdset_logtype
#define FDPOLLERR (POLLERR | POLLHUP | POLLNVAL)
diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index f02bf865c349..ad420ea012d0 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -4,6 +4,7 @@
#include <rte_malloc.h>
#include <rte_hash.h>
#include <rte_jhash.h>
+#include <rte_log.h>
#include <rte_mbuf.h>
#include <rte_cryptodev.h>
@@ -16,6 +17,9 @@
#define IV_OFFSET (sizeof(struct rte_crypto_op) + \
sizeof(struct rte_crypto_sym_op))
+RTE_LOG_REGISTER_SUFFIX(vhost_crypto_logtype, crypto, INFO);
+#define RTE_LOGTYPE_VHOST_CRYPTO vhost_crypto_logtype
+
#ifdef RTE_LIBRTE_VHOST_DEBUG
#define VC_LOG_ERR(fmt, args...) \
RTE_LOG(ERR, USER1, "[%s] %s() line %u: " fmt "\n", \
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 5/5] ipsec: fix usage of RTE_LOGTYPE_USER1
2023-02-12 16:14 ` [PATCH 0/5] Replace us of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
` (3 preceding siblings ...)
2023-02-12 16:14 ` [PATCH 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1 Stephen Hemminger
@ 2023-02-12 16:14 ` Stephen Hemminger
4 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-12 16:14 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, kai.ji, Pablo de Lara, Arkadiusz Kusztal
There already is a logtype in this driver, use it!
Fixes: b35848bc01f6 ("crypto/ipsec_mb: add multi-process IPC request handler")
Cc: kai.ji@intel.com
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
index 3e52f9567401..e9eb0d15b794 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
@@ -7,6 +7,7 @@
#include <rte_common.h>
#include <rte_malloc.h>
+#include <rte_log.h>
#include "ipsec_mb_private.h"
@@ -125,7 +126,7 @@ ipsec_mb_secondary_qp_op(int dev_id, int qp_id,
qp_req_msg.num_fds = 0;
ret = rte_mp_request_sync(&qp_req_msg, &qp_resp, &ts);
if (ret) {
- RTE_LOG(ERR, USER1, "Create MR request to primary process failed.");
+ IPSEC_MB_LOG(ERR, "Create MR request to primary process failed.");
return -1;
}
qp_resp_msg = &qp_resp.msgs[0];
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v6 0/5] Replace use of RTE_LOGTYPE_USER1 in libraries
2023-02-08 4:48 [PATCH 0/5] Fix use of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
` (7 preceding siblings ...)
2023-02-12 16:14 ` [PATCH 0/5] Replace us of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
@ 2023-02-20 18:49 ` Stephen Hemminger
2023-02-20 18:49 ` [PATCH v6 1/5] ip_frag: use a dynamic logtype Stephen Hemminger
` (5 more replies)
2023-08-14 16:31 ` [PATCH v8 0/6] Convert " Stephen Hemminger
9 siblings, 6 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-20 18:49 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
The DPDK libraries and drivers should not be using the USER1 logtype.
v6 - fix checkpatch warnings
Stephen Hemminger (5):
ip_frag: use a dynamic logtype
reorder: use a dynamic logtype
latencystats: use dynamic logtype
vhost: use logtype instead of RTE_LOGTYPE_USER1
ipsec: fix usage of RTE_LOGTYPE_USER1
drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 3 ++-
lib/ip_frag/ip_frag_common.h | 5 ++++-
lib/ip_frag/rte_ip_frag_common.c | 2 ++
lib/latencystats/rte_latencystats.c | 3 ++-
lib/reorder/rte_reorder.c | 6 +++---
lib/vhost/fd_man.c | 4 ++--
lib/vhost/vhost_crypto.c | 4 ++++
7 files changed, 19 insertions(+), 8 deletions(-)
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v6 1/5] ip_frag: use a dynamic logtype
2023-02-20 18:49 ` [PATCH v6 0/5] Replace use of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
@ 2023-02-20 18:49 ` Stephen Hemminger
2023-02-21 10:41 ` David Marchand
2023-02-20 18:49 ` [PATCH v6 2/5] reorder: " Stephen Hemminger
` (4 subsequent siblings)
5 siblings, 1 reply; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-20 18:49 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Konstantin Ananyev
DPDK libraries should not be reusing RTE_LOGTYPE_USER1 in
lieu of doing proper logtype registration.
Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
Fixes: 416707812c03 ("ip_frag: refactor reassembly code into a proper library")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/ip_frag/ip_frag_common.h | 5 ++++-
lib/ip_frag/rte_ip_frag_common.c | 2 ++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/ip_frag/ip_frag_common.h b/lib/ip_frag/ip_frag_common.h
index 9c0dbdeb6eb9..95f1689d476d 100644
--- a/lib/ip_frag/ip_frag_common.h
+++ b/lib/ip_frag/ip_frag_common.h
@@ -8,9 +8,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..e4af8d23ad10 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.h>
+RTE_LOG_REGISTER_DEFAULT(ipfrag_logtype, INFO);
+
#include "ip_frag_common.h"
#define IP_FRAG_HASH_FNUM 2
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v6 2/5] reorder: use a dynamic logtype
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-20 18:49 ` Stephen Hemminger
2023-02-20 18:49 ` [PATCH v6 3/5] latencystats: use " Stephen Hemminger
` (3 subsequent siblings)
5 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-20 18:49 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, sergio.gonzalez.monroy
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 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/reorder/rte_reorder.c b/lib/reorder/rte_reorder.c
index 6e029c9e02fd..7a3a97972cb7 100644
--- a/lib/reorder/rte_reorder.c
+++ b/lib/reorder/rte_reorder.c
@@ -15,6 +15,9 @@
#include "rte_reorder.h"
+RTE_LOG_REGISTER_DEFAULT(reorder_logtype, INFO);
+#define RTE_LOGTYPE_REORDER reorder_logtype
+
TAILQ_HEAD(rte_reorder_list, rte_tailq_entry);
static struct rte_tailq_elem rte_reorder_tailq = {
@@ -26,9 +29,6 @@ EAL_REGISTER_TAILQ(rte_reorder_tailq)
#define RTE_REORDER_PREFIX "RO_"
#define RTE_REORDER_NAMESIZE 32
-/* Macros for printing using RTE_LOG */
-#define RTE_LOGTYPE_REORDER RTE_LOGTYPE_USER1
-
#define RTE_REORDER_SEQN_DYNFIELD_NAME "rte_reorder_seqn_dynfield"
int rte_reorder_seqn_dynfield_offset = -1;
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v6 3/5] latencystats: use dynamic logtype
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-20 18:49 ` [PATCH v6 2/5] reorder: " Stephen Hemminger
@ 2023-02-20 18:49 ` Stephen Hemminger
2023-02-20 18:50 ` [PATCH v6 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1 Stephen Hemminger
` (2 subsequent siblings)
5 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-20 18:49 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, reshma.pattan
Libraries should not reuse RTE_LOGTYPE_USER1 for their
logging. Instead they should register their own type.
Fixes: 5cd3cac9ed22 ("latency: added new library for latency stats")
Cc: reshma.pattan@intel.com
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/latencystats/rte_latencystats.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/latencystats/rte_latencystats.c b/lib/latencystats/rte_latencystats.c
index 8985a377db4e..f3c1746cca00 100644
--- a/lib/latencystats/rte_latencystats.c
+++ b/lib/latencystats/rte_latencystats.c
@@ -26,7 +26,8 @@ latencystat_cycles_per_ns(void)
}
/* Macros for printing using RTE_LOG */
-#define RTE_LOGTYPE_LATENCY_STATS RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER_DEFAULT(latencystat_logtype, INFO);
+#define RTE_LOGTYPE_LATENCY_STATS latencystat_logtype
static uint64_t timestamp_dynflag;
static int timestamp_dynfield_offset = -1;
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v6 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1
2023-02-20 18:49 ` [PATCH v6 0/5] Replace use of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
` (2 preceding siblings ...)
2023-02-20 18:49 ` [PATCH v6 3/5] latencystats: use " Stephen Hemminger
@ 2023-02-20 18:50 ` 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
5 siblings, 1 reply; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-20 18:50 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Chenbo Xia, Maxime Coquelin
Fix instances of USER1 logtype in fdset and crypto
sections.
Acked-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/vhost/fd_man.c | 4 ++--
lib/vhost/vhost_crypto.c | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/vhost/fd_man.c b/lib/vhost/fd_man.c
index 1876fada3354..46037d02784e 100644
--- a/lib/vhost/fd_man.c
+++ b/lib/vhost/fd_man.c
@@ -10,8 +10,8 @@
#include "fd_man.h"
-
-#define RTE_LOGTYPE_VHOST_FDMAN RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER_SUFFIX(vhost_fdset_logtype, fdset, INFO);
+#define RTE_LOGTYPE_VHOST_FDMAN vhost_fdset_logtype
#define FDPOLLERR (POLLERR | POLLHUP | POLLNVAL)
diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index f02bf865c349..ad420ea012d0 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -4,6 +4,7 @@
#include <rte_malloc.h>
#include <rte_hash.h>
#include <rte_jhash.h>
+#include <rte_log.h>
#include <rte_mbuf.h>
#include <rte_cryptodev.h>
@@ -16,6 +17,9 @@
#define IV_OFFSET (sizeof(struct rte_crypto_op) + \
sizeof(struct rte_crypto_sym_op))
+RTE_LOG_REGISTER_SUFFIX(vhost_crypto_logtype, crypto, INFO);
+#define RTE_LOGTYPE_VHOST_CRYPTO vhost_crypto_logtype
+
#ifdef RTE_LIBRTE_VHOST_DEBUG
#define VC_LOG_ERR(fmt, args...) \
RTE_LOG(ERR, USER1, "[%s] %s() line %u: " fmt "\n", \
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v6 5/5] ipsec: fix usage of RTE_LOGTYPE_USER1
2023-02-20 18:49 ` [PATCH v6 0/5] Replace use of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
` (3 preceding siblings ...)
2023-02-20 18:50 ` [PATCH v6 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1 Stephen Hemminger
@ 2023-02-20 18:50 ` Stephen Hemminger
2023-02-21 10:42 ` [PATCH v6 0/5] Replace use of RTE_LOGTYPE_USER1 in libraries David Marchand
5 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-20 18:50 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, kai.ji
There already is a logtype in this driver, use it!
Fixes: b35848bc01f6 ("crypto/ipsec_mb: add multi-process IPC request handler")
Cc: kai.ji@intel.com
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
index 3e52f9567401..e9eb0d15b794 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
@@ -7,6 +7,7 @@
#include <rte_common.h>
#include <rte_malloc.h>
+#include <rte_log.h>
#include "ipsec_mb_private.h"
@@ -125,7 +126,7 @@ ipsec_mb_secondary_qp_op(int dev_id, int qp_id,
qp_req_msg.num_fds = 0;
ret = rte_mp_request_sync(&qp_req_msg, &qp_resp, &ts);
if (ret) {
- RTE_LOG(ERR, USER1, "Create MR request to primary process failed.");
+ IPSEC_MB_LOG(ERR, "Create MR request to primary process failed.");
return -1;
}
qp_resp_msg = &qp_resp.msgs[0];
--
2.39.1
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v6 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1
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
0 siblings, 0 replies; 50+ messages in thread
From: David Marchand @ 2023-02-21 10:39 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, Chenbo Xia, Maxime Coquelin
On Mon, Feb 20, 2023 at 7:50 PM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> Fix instances of USER1 logtype in fdset and crypto
> sections.
>
> Acked-by: Chenbo Xia <chenbo.xia@intel.com>
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> lib/vhost/fd_man.c | 4 ++--
> lib/vhost/vhost_crypto.c | 4 ++++
> 2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/lib/vhost/fd_man.c b/lib/vhost/fd_man.c
> index 1876fada3354..46037d02784e 100644
> --- a/lib/vhost/fd_man.c
> +++ b/lib/vhost/fd_man.c
> @@ -10,8 +10,8 @@
>
> #include "fd_man.h"
>
> -
> -#define RTE_LOGTYPE_VHOST_FDMAN RTE_LOGTYPE_USER1
> +RTE_LOG_REGISTER_SUFFIX(vhost_fdset_logtype, fdset, INFO);
> +#define RTE_LOGTYPE_VHOST_FDMAN vhost_fdset_logtype
Oh, I did not follow the previous revisions, but now that I see this, nice hack.
>
> #define FDPOLLERR (POLLERR | POLLHUP | POLLNVAL)
>
> diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
> index f02bf865c349..ad420ea012d0 100644
> --- a/lib/vhost/vhost_crypto.c
> +++ b/lib/vhost/vhost_crypto.c
> @@ -4,6 +4,7 @@
> #include <rte_malloc.h>
> #include <rte_hash.h>
> #include <rte_jhash.h>
> +#include <rte_log.h>
> #include <rte_mbuf.h>
> #include <rte_cryptodev.h>
>
> @@ -16,6 +17,9 @@
> #define IV_OFFSET (sizeof(struct rte_crypto_op) + \
> sizeof(struct rte_crypto_sym_op))
>
> +RTE_LOG_REGISTER_SUFFIX(vhost_crypto_logtype, crypto, INFO);
> +#define RTE_LOGTYPE_VHOST_CRYPTO vhost_crypto_logtype
> +
> #ifdef RTE_LIBRTE_VHOST_DEBUG
> #define VC_LOG_ERR(fmt, args...) \
> RTE_LOG(ERR, USER1, "[%s] %s() line %u: " fmt "\n", \
However, there is something missing here.
Existing code was directly using RTE_LOGTYPE_USER1.
We still need to update:
diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index ad420ea012..d2b4af1d1c 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -22,20 +22,20 @@ RTE_LOG_REGISTER_SUFFIX(vhost_crypto_logtype, crypto, INFO);
#ifdef RTE_LIBRTE_VHOST_DEBUG
#define VC_LOG_ERR(fmt, args...) \
- RTE_LOG(ERR, USER1, "[%s] %s() line %u: " fmt "\n", \
+ RTE_LOG(ERR, VHOST_CRYPTO, "[%s] %s() line %u: " fmt "\n", \
"Vhost-Crypto", __func__, __LINE__, ## args)
#define VC_LOG_INFO(fmt, args...) \
- RTE_LOG(INFO, USER1, "[%s] %s() line %u: " fmt "\n", \
+ RTE_LOG(INFO, VHOST_CRYPTO, "[%s] %s() line %u: " fmt "\n", \
"Vhost-Crypto", __func__, __LINE__, ## args)
#define VC_LOG_DBG(fmt, args...) \
- RTE_LOG(DEBUG, USER1, "[%s] %s() line %u: " fmt "\n", \
+ RTE_LOG(DEBUG, VHOST_CRYPTO, "[%s] %s() line %u: " fmt "\n", \
"Vhost-Crypto", __func__, __LINE__, ## args)
#else
#define VC_LOG_ERR(fmt, args...) \
- RTE_LOG(ERR, USER1, "[VHOST-Crypto]: " fmt "\n", ## args)
+ RTE_LOG(ERR, VHOST_CRYPTO, "[VHOST-Crypto]: " fmt "\n", ## args)
#define VC_LOG_INFO(fmt, args...) \
- RTE_LOG(INFO, USER1, "[VHOST-Crypto]: " fmt "\n", ## args)
+ RTE_LOG(INFO, VHOST_CRYPTO, "[VHOST-Crypto]: " fmt "\n", ## args)
#define VC_LOG_DBG(fmt, args...)
#endif
--
David Marchand
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v6 1/5] ip_frag: use a dynamic logtype
2023-02-20 18:49 ` [PATCH v6 1/5] ip_frag: use a dynamic logtype Stephen Hemminger
@ 2023-02-21 10:41 ` David Marchand
0 siblings, 0 replies; 50+ messages in thread
From: David Marchand @ 2023-02-21 10:41 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, Konstantin Ananyev
On Mon, Feb 20, 2023 at 7:50 PM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> DPDK libraries should not be reusing RTE_LOGTYPE_USER1 in
> lieu of doing proper logtype registration.
>
> Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
> Fixes: 416707812c03 ("ip_frag: refactor reassembly code into a proper library")
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> lib/ip_frag/ip_frag_common.h | 5 ++++-
> lib/ip_frag/rte_ip_frag_common.c | 2 ++
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/lib/ip_frag/ip_frag_common.h b/lib/ip_frag/ip_frag_common.h
> index 9c0dbdeb6eb9..95f1689d476d 100644
> --- a/lib/ip_frag/ip_frag_common.h
> +++ b/lib/ip_frag/ip_frag_common.h
> @@ -8,9 +8,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..e4af8d23ad10 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.h>
>
> +RTE_LOG_REGISTER_DEFAULT(ipfrag_logtype, INFO);
> +
> #include "ip_frag_common.h"
>
> #define IP_FRAG_HASH_FNUM 2
There are still some parts using USER1 in this library:
lib/ip_frag/rte_ip_frag_common.c: RTE_LOG(ERR, USER1,
"%s: invalid input parameter\n", __func__);
lib/ip_frag/rte_ip_frag_common.c: RTE_LOG(ERR, USER1,
lib/ip_frag/rte_ip_frag_common.c: RTE_LOG(INFO, USER1, "%s:
allocated of %zu bytes at socket %d\n",
--
David Marchand
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v6 0/5] Replace use of RTE_LOGTYPE_USER1 in libraries
2023-02-20 18:49 ` [PATCH v6 0/5] Replace use of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
` (4 preceding siblings ...)
2023-02-20 18:50 ` [PATCH v6 5/5] ipsec: fix usage " Stephen Hemminger
@ 2023-02-21 10:42 ` David Marchand
2023-02-21 18:46 ` Stephen Hemminger
5 siblings, 1 reply; 50+ messages in thread
From: David Marchand @ 2023-02-21 10:42 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev
On Mon, Feb 20, 2023 at 7:50 PM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> The DPDK libraries and drivers should not be using the USER1 logtype.
>
> v6 - fix checkpatch warnings
>
> Stephen Hemminger (5):
> ip_frag: use a dynamic logtype
> reorder: use a dynamic logtype
> latencystats: use dynamic logtype
> vhost: use logtype instead of RTE_LOGTYPE_USER1
> ipsec: fix usage of RTE_LOGTYPE_USER1
>
> drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 3 ++-
> lib/ip_frag/ip_frag_common.h | 5 ++++-
> lib/ip_frag/rte_ip_frag_common.c | 2 ++
> lib/latencystats/rte_latencystats.c | 3 ++-
> lib/reorder/rte_reorder.c | 6 +++---
> lib/vhost/fd_man.c | 4 ++--
> lib/vhost/vhost_crypto.c | 4 ++++
> 7 files changed, 19 insertions(+), 8 deletions(-)
Could you update the power library too?
lib/power/guest_channel.c:#define RTE_LOGTYPE_GUEST_CHANNEL RTE_LOGTYPE_USER1
Thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v6 0/5] Replace use of RTE_LOGTYPE_USER1 in libraries
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
0 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-02-21 18:46 UTC (permalink / raw)
To: David Marchand; +Cc: dev
On Tue, 21 Feb 2023 11:42:45 +0100
David Marchand <david.marchand@redhat.com> wrote:
> On Mon, Feb 20, 2023 at 7:50 PM Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> >
> > The DPDK libraries and drivers should not be using the USER1 logtype.
> >
> > v6 - fix checkpatch warnings
> >
> > Stephen Hemminger (5):
> > ip_frag: use a dynamic logtype
> > reorder: use a dynamic logtype
> > latencystats: use dynamic logtype
> > vhost: use logtype instead of RTE_LOGTYPE_USER1
> > ipsec: fix usage of RTE_LOGTYPE_USER1
> >
> > drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 3 ++-
> > lib/ip_frag/ip_frag_common.h | 5 ++++-
> > lib/ip_frag/rte_ip_frag_common.c | 2 ++
> > lib/latencystats/rte_latencystats.c | 3 ++-
> > lib/reorder/rte_reorder.c | 6 +++---
> > lib/vhost/fd_man.c | 4 ++--
> > lib/vhost/vhost_crypto.c | 4 ++++
> > 7 files changed, 19 insertions(+), 8 deletions(-)
>
> Could you update the power library too?
>
> lib/power/guest_channel.c:#define RTE_LOGTYPE_GUEST_CHANNEL RTE_LOGTYPE_USER1
I picked that up in the other patch set because lib/power should be using
its own logtype.
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v8 0/6] Convert use of RTE_LOGTYPE_USER1 in libraries
2023-02-08 4:48 [PATCH 0/5] Fix use of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
` (8 preceding siblings ...)
2023-02-20 18:49 ` [PATCH v6 0/5] Replace use of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
@ 2023-08-14 16:31 ` Stephen Hemminger
2023-08-14 16:31 ` [PATCH v8 1/6] ip_frag: use a dynamic logtype Stephen Hemminger
` (7 more replies)
9 siblings, 8 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-08-14 16:31 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
Libraries in DPDK should be using dynamic logtype instead
of overloading the static logtype RTE_LOGTYPE_USER1
v8 - rebase and add power library
Stephen Hemminger (6):
ip_frag: use a dynamic logtype
reorder: use a dynamic logtype
latencystats: use dynamic logtype
vhost: use logtype instead of RTE_LOGTYPE_USER1
ipsec: fix usage of RTE_LOGTYPE_USER1
power: use a dynamic logtype for guest channel
drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 3 ++-
lib/ip_frag/ip_frag_common.h | 5 ++++-
lib/ip_frag/rte_ip_frag_common.c | 8 +++++---
lib/latencystats/rte_latencystats.c | 3 ++-
lib/power/guest_channel.c | 3 ++-
lib/reorder/rte_reorder.c | 6 +++---
lib/vhost/fd_man.c | 4 ++--
lib/vhost/vhost_crypto.c | 22 +++++++++++-----------
8 files changed, 31 insertions(+), 23 deletions(-)
--
2.39.2
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v8 1/6] ip_frag: use a dynamic logtype
2023-08-14 16:31 ` [PATCH v8 0/6] Convert " Stephen Hemminger
@ 2023-08-14 16:31 ` Stephen Hemminger
2023-12-01 8:10 ` David Marchand
2023-08-14 16:31 ` [PATCH v8 2/6] reorder: " Stephen Hemminger
` (6 subsequent siblings)
7 siblings, 1 reply; 50+ messages in thread
From: Stephen Hemminger @ 2023-08-14 16:31 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, Konstantin Ananyev, Anatoly Burakov, Thomas Monjalon
DPDK libraries should not be reusing RTE_LOGTYPE_USER1 in
lieu of doing proper logtype registration.
Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
Fixes: 416707812c03 ("ip_frag: refactor reassembly code into a proper library")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
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.h>
+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;
--
2.39.2
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v8 2/6] reorder: use a dynamic logtype
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-08-14 16:31 ` Stephen Hemminger
2023-08-16 8:29 ` [EXT] " Volodymyr Fialko
2023-08-14 16:31 ` [PATCH v8 3/6] latencystats: use " Stephen Hemminger
` (5 subsequent siblings)
7 siblings, 1 reply; 50+ messages in thread
From: Stephen Hemminger @ 2023-08-14 16:31 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, sergio.gonzalez.monroy, Volodymyr Fialko,
Reshma Pattan, Neil Horman, Richardson Bruce, Declan Doherty
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 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/reorder/rte_reorder.c b/lib/reorder/rte_reorder.c
index b5428d1f7bfa..640719c3ecf9 100644
--- a/lib/reorder/rte_reorder.c
+++ b/lib/reorder/rte_reorder.c
@@ -16,6 +16,9 @@
#include "rte_reorder.h"
+RTE_LOG_REGISTER_DEFAULT(reorder_logtype, INFO);
+#define RTE_LOGTYPE_REORDER reorder_logtype
+
TAILQ_HEAD(rte_reorder_list, rte_tailq_entry);
static struct rte_tailq_elem rte_reorder_tailq = {
@@ -27,9 +30,6 @@ EAL_REGISTER_TAILQ(rte_reorder_tailq)
#define RTE_REORDER_PREFIX "RO_"
#define RTE_REORDER_NAMESIZE 32
-/* Macros for printing using RTE_LOG */
-#define RTE_LOGTYPE_REORDER RTE_LOGTYPE_USER1
-
#define RTE_REORDER_SEQN_DYNFIELD_NAME "rte_reorder_seqn_dynfield"
int rte_reorder_seqn_dynfield_offset = -1;
--
2.39.2
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v8 3/6] latencystats: use dynamic logtype
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-08-14 16:31 ` [PATCH v8 2/6] reorder: " Stephen Hemminger
@ 2023-08-14 16:31 ` Stephen Hemminger
2023-08-14 16:31 ` [PATCH v8 4/6] vhost: use logtype instead of RTE_LOGTYPE_USER1 Stephen Hemminger
` (4 subsequent siblings)
7 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-08-14 16:31 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, reshma.pattan, Harry van Haaren, Remy Horton
Libraries should not reuse RTE_LOGTYPE_USER1 for their
logging. Instead they should register their own type.
Fixes: 5cd3cac9ed22 ("latency: added new library for latency stats")
Cc: reshma.pattan@intel.com
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/latencystats/rte_latencystats.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/latencystats/rte_latencystats.c b/lib/latencystats/rte_latencystats.c
index 8985a377db4e..f3c1746cca00 100644
--- a/lib/latencystats/rte_latencystats.c
+++ b/lib/latencystats/rte_latencystats.c
@@ -26,7 +26,8 @@ latencystat_cycles_per_ns(void)
}
/* Macros for printing using RTE_LOG */
-#define RTE_LOGTYPE_LATENCY_STATS RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER_DEFAULT(latencystat_logtype, INFO);
+#define RTE_LOGTYPE_LATENCY_STATS latencystat_logtype
static uint64_t timestamp_dynflag;
static int timestamp_dynfield_offset = -1;
--
2.39.2
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v8 4/6] vhost: use logtype instead of RTE_LOGTYPE_USER1
2023-08-14 16:31 ` [PATCH v8 0/6] Convert " Stephen Hemminger
` (2 preceding siblings ...)
2023-08-14 16:31 ` [PATCH v8 3/6] latencystats: use " Stephen Hemminger
@ 2023-08-14 16:31 ` Stephen Hemminger
2023-08-14 16:31 ` [PATCH v8 5/6] ipsec: fix usage " Stephen Hemminger
` (3 subsequent siblings)
7 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-08-14 16:31 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Chenbo Xia, Maxime Coquelin
Fix instances of USER1 logtype in fdset and crypto
sections.
Acked-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/vhost/fd_man.c | 4 ++--
lib/vhost/vhost_crypto.c | 22 +++++++++++-----------
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/lib/vhost/fd_man.c b/lib/vhost/fd_man.c
index 1876fada3354..46037d02784e 100644
--- a/lib/vhost/fd_man.c
+++ b/lib/vhost/fd_man.c
@@ -10,8 +10,8 @@
#include "fd_man.h"
-
-#define RTE_LOGTYPE_VHOST_FDMAN RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER_SUFFIX(vhost_fdset_logtype, fdset, INFO);
+#define RTE_LOGTYPE_VHOST_FDMAN vhost_fdset_logtype
#define FDPOLLERR (POLLERR | POLLHUP | POLLNVAL)
diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index 9bf5ef67b9ad..3e1ef1ac25eb 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -4,6 +4,7 @@
#include <rte_malloc.h>
#include <rte_hash.h>
#include <rte_jhash.h>
+#include <rte_log.h>
#include <rte_mbuf.h>
#include <rte_cryptodev.h>
@@ -16,22 +17,21 @@
#define IV_OFFSET (sizeof(struct rte_crypto_op) + \
sizeof(struct rte_crypto_sym_op))
-#ifdef RTE_LIBRTE_VHOST_DEBUG
+RTE_LOG_REGISTER_SUFFIX(vhost_crypto_logtype, crypto, INFO);
+#define RTE_LOGTYPE_VHOST_CRYPTO vhost_crypto_logtype
+
#define VC_LOG_ERR(fmt, args...) \
- RTE_LOG(ERR, USER1, "[%s] %s() line %u: " fmt "\n", \
- "Vhost-Crypto", __func__, __LINE__, ## args)
+ RTE_LOG(ERR, VHOST_CRYPTO, "%s() line %u: " fmt "\n", \
+ __func__, __LINE__, ## args)
#define VC_LOG_INFO(fmt, args...) \
- RTE_LOG(INFO, USER1, "[%s] %s() line %u: " fmt "\n", \
- "Vhost-Crypto", __func__, __LINE__, ## args)
+ RTE_LOG(INFO, VHOST_CRYPTO, "%s() line %u: " fmt "\n", \
+ __func__, __LINE__, ## args)
+#ifdef RTE_LIBRTE_VHOST_DEBUG
#define VC_LOG_DBG(fmt, args...) \
- RTE_LOG(DEBUG, USER1, "[%s] %s() line %u: " fmt "\n", \
- "Vhost-Crypto", __func__, __LINE__, ## args)
+ RTE_LOG(DEBUG, VHOST_CRYPTO, "%s() line %u: " fmt "\n", \
+ __func__, __LINE__, ## args)
#else
-#define VC_LOG_ERR(fmt, args...) \
- RTE_LOG(ERR, USER1, "[VHOST-Crypto]: " fmt "\n", ## args)
-#define VC_LOG_INFO(fmt, args...) \
- RTE_LOG(INFO, USER1, "[VHOST-Crypto]: " fmt "\n", ## args)
#define VC_LOG_DBG(fmt, args...)
#endif
--
2.39.2
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v8 5/6] ipsec: fix usage of RTE_LOGTYPE_USER1
2023-08-14 16:31 ` [PATCH v8 0/6] Convert " Stephen Hemminger
` (3 preceding siblings ...)
2023-08-14 16:31 ` [PATCH v8 4/6] vhost: use logtype instead of RTE_LOGTYPE_USER1 Stephen Hemminger
@ 2023-08-14 16:31 ` Stephen Hemminger
2023-08-14 16:31 ` [PATCH v8 6/6] power: use a dynamic logtype for guest channel Stephen Hemminger
` (2 subsequent siblings)
7 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-08-14 16:31 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, kai.ji, Pablo de Lara, Arkadiusz Kusztal
There already is a logtype in this driver, use it!
Fixes: b35848bc01f6 ("crypto/ipsec_mb: add multi-process IPC request handler")
Cc: kai.ji@intel.com
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
index 30f919cd402d..52d6d010c788 100644
--- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
+++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
@@ -7,6 +7,7 @@
#include <rte_common.h>
#include <rte_malloc.h>
+#include <rte_log.h>
#include "ipsec_mb_private.h"
@@ -125,7 +126,7 @@ ipsec_mb_secondary_qp_op(int dev_id, int qp_id,
qp_req_msg.num_fds = 0;
ret = rte_mp_request_sync(&qp_req_msg, &qp_resp, &ts);
if (ret) {
- RTE_LOG(ERR, USER1, "Create MR request to primary process failed.");
+ IPSEC_MB_LOG(ERR, "Create MR request to primary process failed.");
return -1;
}
qp_resp_msg = &qp_resp.msgs[0];
--
2.39.2
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v8 6/6] power: use a dynamic logtype for guest channel
2023-08-14 16:31 ` [PATCH v8 0/6] Convert " Stephen Hemminger
` (4 preceding siblings ...)
2023-08-14 16:31 ` [PATCH v8 5/6] ipsec: fix usage " Stephen Hemminger
@ 2023-08-14 16:31 ` 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
7 siblings, 0 replies; 50+ messages in thread
From: Stephen Hemminger @ 2023-08-14 16:31 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, Anatoly Burakov, David Hunt, Alan Carew,
Pablo de Lara
DPDK libraries should not be reusing RTE_LOGTYPE_USER1 in
lieu of doing proper logtype registration.
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/power/guest_channel.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/power/guest_channel.c b/lib/power/guest_channel.c
index 7b2ae0b6506f..cc05347425da 100644
--- a/lib/power/guest_channel.c
+++ b/lib/power/guest_channel.c
@@ -17,7 +17,8 @@
#include "guest_channel.h"
-#define RTE_LOGTYPE_GUEST_CHANNEL RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER_SUFFIX(guest_channel_logtype, guest_channel, INFO);
+#define RTE_LOGTYPE_GUEST_CHANNEL guest_channel_logtype
/* Timeout for incoming message in milliseconds. */
#define TIMEOUT 10
--
2.39.2
^ permalink raw reply [flat|nested] 50+ messages in thread
* RE: [PATCH v8 0/6] Convert use of RTE_LOGTYPE_USER1 in libraries
2023-08-14 16:31 ` [PATCH v8 0/6] Convert " Stephen Hemminger
` (5 preceding siblings ...)
2023-08-14 16:31 ` [PATCH v8 6/6] power: use a dynamic logtype for guest channel Stephen Hemminger
@ 2023-08-14 17:41 ` Morten Brørup
2023-12-04 12:25 ` David Marchand
7 siblings, 0 replies; 50+ messages in thread
From: Morten Brørup @ 2023-08-14 17:41 UTC (permalink / raw)
To: Stephen Hemminger, dev
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Monday, 14 August 2023 18.31
>
> Libraries in DPDK should be using dynamic logtype instead
> of overloading the static logtype RTE_LOGTYPE_USER1
>
> v8 - rebase and add power library
>
> Stephen Hemminger (6):
> ip_frag: use a dynamic logtype
> reorder: use a dynamic logtype
> latencystats: use dynamic logtype
> vhost: use logtype instead of RTE_LOGTYPE_USER1
> ipsec: fix usage of RTE_LOGTYPE_USER1
> power: use a dynamic logtype for guest channel
Series-acked-by: Morten Brørup <mb@smartsharesystems.com>
^ permalink raw reply [flat|nested] 50+ messages in thread
* RE: [EXT] [PATCH v8 2/6] reorder: use a dynamic logtype
2023-08-14 16:31 ` [PATCH v8 2/6] reorder: " Stephen Hemminger
@ 2023-08-16 8:29 ` Volodymyr Fialko
0 siblings, 0 replies; 50+ messages in thread
From: Volodymyr Fialko @ 2023-08-16 8:29 UTC (permalink / raw)
To: Stephen Hemminger, dev
Cc: sergio.gonzalez.monroy, Reshma Pattan, Neil Horman,
Richardson Bruce, Declan Doherty
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Monday, August 14, 2023 6:31 PM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>; sergio.gonzalez.monroy@intel.com;
> Volodymyr Fialko <vfialko@marvell.com>; Reshma Pattan <reshma.pattan@intel.com>; Neil Horman
> <nhorman@tuxdriver.com>; Richardson Bruce <bruce.richardson@intel.com>; Declan Doherty
> <declan.doherty@intel.com>
> Subject: [EXT] [PATCH v8 2/6] reorder: use a dynamic logtype
>
> 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>
Acked-by: Volodymyr Fialko <vfialko@marvell.com>
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v8 1/6] ip_frag: use a dynamic logtype
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
0 siblings, 1 reply; 50+ messages in thread
From: David Marchand @ 2023-12-01 8:10 UTC (permalink / raw)
To: Stephen Hemminger
Cc: dev, Konstantin Ananyev, Anatoly Burakov, Thomas Monjalon
On Mon, Aug 14, 2023 at 6:31 PM Stephen Hemminger
<stephen@networkplumber.org> wrote:
> @@ -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;
> --
> 2.39.2
>
Any reason not to use the IP_FRAG_LOG macro?
This is easy for me to fix when applying if you have no objection.
--
David Marchand
^ permalink raw reply [flat|nested] 50+ messages in thread
* RE: [PATCH v8 1/6] ip_frag: use a dynamic logtype
2023-12-01 8:10 ` David Marchand
@ 2023-12-01 12:16 ` Konstantin Ananyev
2023-12-01 13:11 ` David Marchand
0 siblings, 1 reply; 50+ messages in thread
From: Konstantin Ananyev @ 2023-12-01 12:16 UTC (permalink / raw)
To: David Marchand, Stephen Hemminger
Cc: dev, Konstantin Ananyev, Anatoly Burakov, Thomas Monjalon
Hi David,
> On Mon, Aug 14, 2023 at 6:31 PM Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> > @@ -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;
> > --
> > 2.39.2
> >
>
> Any reason not to use the IP_FRAG_LOG macro?
> This is easy for me to fix when applying if you have no objection.
As I remember, IP_FRAG_LOG is disabled by default.
To enable it, user has to build it with -DRTE_LIBRTE_IP_FRAG_DEBUG or so.
Konstantin
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v8 1/6] ip_frag: use a dynamic logtype
2023-12-01 12:16 ` Konstantin Ananyev
@ 2023-12-01 13:11 ` David Marchand
0 siblings, 0 replies; 50+ messages in thread
From: David Marchand @ 2023-12-01 13:11 UTC (permalink / raw)
To: Konstantin Ananyev
Cc: Stephen Hemminger, dev, Konstantin Ananyev, Anatoly Burakov,
Thomas Monjalon
Hello Konstantin,
On Fri, Dec 1, 2023 at 1:17 PM Konstantin Ananyev
<konstantin.ananyev@huawei.com> wrote:
>
> Hi David,
>
> > On Mon, Aug 14, 2023 at 6:31 PM Stephen Hemminger
> > <stephen@networkplumber.org> wrote:
> > > @@ -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;
> > > --
> > > 2.39.2
> > >
> >
> > Any reason not to use the IP_FRAG_LOG macro?
> > This is easy for me to fix when applying if you have no objection.
>
> As I remember, IP_FRAG_LOG is disabled by default.
> To enable it, user has to build it with -DRTE_LIBRTE_IP_FRAG_DEBUG or so.
Indeed, so nothing to do here, thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v8 0/6] Convert use of RTE_LOGTYPE_USER1 in libraries
2023-08-14 16:31 ` [PATCH v8 0/6] Convert " Stephen Hemminger
` (6 preceding siblings ...)
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
7 siblings, 0 replies; 50+ messages in thread
From: David Marchand @ 2023-12-04 12:25 UTC (permalink / raw)
To: Stephen Hemminger
Cc: dev, Morten Brørup, Konstantin Ananyev, Volodymyr Fialko,
Chenbo Xia, Maxime Coquelin
Hello Stephen,
On Mon, Aug 14, 2023 at 6:31 PM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> Libraries in DPDK should be using dynamic logtype instead
> of overloading the static logtype RTE_LOGTYPE_USER1
>
> v8 - rebase and add power library
>
> Stephen Hemminger (6):
> ip_frag: use a dynamic logtype
> reorder: use a dynamic logtype
> latencystats: use dynamic logtype
> vhost: use logtype instead of RTE_LOGTYPE_USER1
> ipsec: fix usage of RTE_LOGTYPE_USER1
> power: use a dynamic logtype for guest channel
>
> drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 3 ++-
> lib/ip_frag/ip_frag_common.h | 5 ++++-
> lib/ip_frag/rte_ip_frag_common.c | 8 +++++---
> lib/latencystats/rte_latencystats.c | 3 ++-
> lib/power/guest_channel.c | 3 ++-
> lib/reorder/rte_reorder.c | 6 +++---
> lib/vhost/fd_man.c | 4 ++--
> lib/vhost/vhost_crypto.c | 22 +++++++++++-----------
> 8 files changed, 31 insertions(+), 23 deletions(-)
Series applied, thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 50+ messages in thread
end of thread, other threads:[~2023-12-04 12:25 UTC | newest]
Thread overview: 50+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 2/5] reorder: " Stephen Hemminger
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
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).