DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>,
	Anatoly Burakov <anatoly.burakov@intel.com>,
	Thomas Monjalon <thomas@monjalon.net>
Subject: [PATCH 1/5] ip_frag: use a dynamic logtype
Date: Tue,  7 Feb 2023 20:48:21 -0800	[thread overview]
Message-ID: <20230208044825.1682620-2-stephen@networkplumber.org> (raw)
In-Reply-To: <20230208044825.1682620-1-stephen@networkplumber.org>

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


  reply	other threads:[~2023-02-08  4:48 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08  4:48 [PATCH 0/5] Fix use of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
2023-02-08  4:48 ` Stephen Hemminger [this message]
2023-02-08 23:52   ` [PATCH 1/5] ip_frag: use a dynamic logtype 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230208044825.1682620-2-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.v.ananyev@yandex.ru \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).