Skip to content

Commit 2f4716d

Browse files
shemmingerdavid-marchand
authored andcommitted
ip_frag: use a dynamic logtype
DPDK libraries should not be reusing RTE_LOGTYPE_USER1 in lieu of doing proper logtype registration. Fixes: 4167078 ("ip_frag: refactor reassembly code into a proper library") Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru> Acked-by: Morten Brørup <mb@smartsharesystems.com>
1 parent f59851e commit 2f4716d

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

lib/ip_frag/ip_frag_common.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@
1818
#include "rte_ip_frag.h"
1919
#include "ip_reassembly.h"
2020

21+
extern int ipfrag_logtype;
22+
#define RTE_LOGTYPE_IPFRAG ipfrag_logtype
23+
2124
/* logging macros. */
2225
#ifdef RTE_LIBRTE_IP_FRAG_DEBUG
23-
#define IP_FRAG_LOG(lvl, fmt, args...) RTE_LOG(lvl, USER1, fmt, ##args)
26+
#define IP_FRAG_LOG(lvl, fmt, args...) RTE_LOG(lvl, IPFRAG, fmt, ##args)
2427
#else
2528
#define IP_FRAG_LOG(lvl, fmt, args...) do {} while(0)
2629
#endif /* IP_FRAG_DEBUG */

lib/ip_frag/rte_ip_frag_common.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#include <rte_log.h>
99

10+
RTE_LOG_REGISTER_DEFAULT(ipfrag_logtype, INFO);
11+
1012
#include "ip_frag_common.h"
1113

1214
#define IP_FRAG_HASH_FNUM 2
@@ -52,20 +54,20 @@ rte_ip_frag_table_create(uint32_t bucket_num, uint32_t bucket_entries,
5254
if (rte_is_power_of_2(bucket_entries) == 0 ||
5355
nb_entries > UINT32_MAX || nb_entries == 0 ||
5456
nb_entries < max_entries) {
55-
RTE_LOG(ERR, USER1, "%s: invalid input parameter\n", __func__);
57+
RTE_LOG(ERR, IPFRAG, "%s: invalid input parameter\n", __func__);
5658
return NULL;
5759
}
5860

5961
sz = sizeof (*tbl) + nb_entries * sizeof (tbl->pkt[0]);
6062
if ((tbl = rte_zmalloc_socket(__func__, sz, RTE_CACHE_LINE_SIZE,
6163
socket_id)) == NULL) {
62-
RTE_LOG(ERR, USER1,
64+
RTE_LOG(ERR, IPFRAG,
6365
"%s: allocation of %zu bytes at socket %d failed do\n",
6466
__func__, sz, socket_id);
6567
return NULL;
6668
}
6769

68-
RTE_LOG(INFO, USER1, "%s: allocated of %zu bytes at socket %d\n",
70+
RTE_LOG(INFO, IPFRAG, "%s: allocated of %zu bytes at socket %d\n",
6971
__func__, sz, socket_id);
7072

7173
tbl->max_cycles = max_cycles;

0 commit comments

Comments
 (0)