1195972f6Sopenharmony_ciFrom afa156f10bdabe937e37080918f669937343eb54 Mon Sep 17 00:00:00 2001
2195972f6Sopenharmony_ciFrom: yangchen <yangchen145@huawei.com>
3195972f6Sopenharmony_ciDate: Tue, 28 Nov 2023 09:22:34 +0800
4195972f6Sopenharmony_ciSubject: [PATCH] lwipopts: add lwip debug log macro
5195972f6Sopenharmony_ci
6195972f6Sopenharmony_ci---
7195972f6Sopenharmony_ci src/include/lwiplog.h  | 15 ++++++++-------
8195972f6Sopenharmony_ci src/include/lwipopts.h | 10 +++++++++-
9195972f6Sopenharmony_ci 2 files changed, 17 insertions(+), 8 deletions(-)
10195972f6Sopenharmony_ci
11195972f6Sopenharmony_cidiff --git a/src/include/lwiplog.h b/src/include/lwiplog.h
12195972f6Sopenharmony_ciindex f278ff4..80ed0fc 100644
13195972f6Sopenharmony_ci--- a/src/include/lwiplog.h
14195972f6Sopenharmony_ci+++ b/src/include/lwiplog.h
15195972f6Sopenharmony_ci@@ -43,21 +43,22 @@
16195972f6Sopenharmony_ci 
17195972f6Sopenharmony_ci #if GAZELLE_USE_DPDK_LOG
18195972f6Sopenharmony_ci 
19195972f6Sopenharmony_ci-#define LWIP_LOG_WARN   LWIP_DBG_LEVEL_WARNING
20195972f6Sopenharmony_ci-#define LWIP_LOG_ERROR  LWIP_DBG_LEVEL_SERIOUS
21195972f6Sopenharmony_ci-#define LWIP_LOG_FATAL  LWIP_DBG_LEVEL_SEVERE
22195972f6Sopenharmony_ci+#define LWIP_LOG_WARN    LWIP_DBG_LEVEL_WARNING
23195972f6Sopenharmony_ci+#define LWIP_LOG_ERROR   LWIP_DBG_LEVEL_SERIOUS
24195972f6Sopenharmony_ci+#define LWIP_LOG_FATAL   LWIP_DBG_LEVEL_SEVERE
25195972f6Sopenharmony_ci+#define RTE_LOGTYPE_LWIP RTE_LOGTYPE_USER2
26195972f6Sopenharmony_ci 
27195972f6Sopenharmony_ci #define LWIP_PLATFORM_LOG(level, fmt, ...) \
28195972f6Sopenharmony_ci do { \
29195972f6Sopenharmony_ci     if ((level) & LWIP_LOG_FATAL) { \
30195972f6Sopenharmony_ci-        RTE_LOG(ERR, EAL, fmt, ##__VA_ARGS__); \
31195972f6Sopenharmony_ci+        RTE_LOG(ERR, LWIP, fmt, ##__VA_ARGS__); \
32195972f6Sopenharmony_ci         abort();                             \
33195972f6Sopenharmony_ci     } else if ((level) & LWIP_LOG_ERROR) { \
34195972f6Sopenharmony_ci-        RTE_LOG(ERR, EAL, fmt, ##__VA_ARGS__); \
35195972f6Sopenharmony_ci+        RTE_LOG(ERR, LWIP, fmt, ##__VA_ARGS__); \
36195972f6Sopenharmony_ci     } else if ((level) & LWIP_LOG_WARN) { \
37195972f6Sopenharmony_ci-        RTE_LOG(WARNING, EAL, fmt, ##__VA_ARGS__); \
38195972f6Sopenharmony_ci+        RTE_LOG(WARNING, LWIP, fmt, ##__VA_ARGS__); \
39195972f6Sopenharmony_ci     } else { \
40195972f6Sopenharmony_ci-        RTE_LOG(INFO, EAL, fmt, ##__VA_ARGS__); \
41195972f6Sopenharmony_ci+        RTE_LOG(INFO, LWIP, fmt, ##__VA_ARGS__); \
42195972f6Sopenharmony_ci     } \
43195972f6Sopenharmony_ci } while(0)
44195972f6Sopenharmony_ci 
45195972f6Sopenharmony_cidiff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
46195972f6Sopenharmony_ciindex 9ab5cde..06b3ae5 100644
47195972f6Sopenharmony_ci--- a/src/include/lwipopts.h
48195972f6Sopenharmony_ci+++ b/src/include/lwipopts.h
49195972f6Sopenharmony_ci@@ -41,7 +41,6 @@
50195972f6Sopenharmony_ci #define LWIP_PERF 1
51195972f6Sopenharmony_ci #define LWIP_RECORD_PERF 0
52195972f6Sopenharmony_ci 
53195972f6Sopenharmony_ci-//#define LWIP_DEBUG 1
54195972f6Sopenharmony_ci #define GAZELLE_USE_DPDK_LOG 1
55195972f6Sopenharmony_ci 
56195972f6Sopenharmony_ci #define GAZELLE_ENABLE 1
57195972f6Sopenharmony_ci@@ -262,6 +261,15 @@
58195972f6Sopenharmony_ci 
59195972f6Sopenharmony_ci #define SIOCSHIWAT 1
60195972f6Sopenharmony_ci 
61195972f6Sopenharmony_ci+/*
62195972f6Sopenharmony_ci+   ------------------------------------
63195972f6Sopenharmony_ci+   --------- Debug log options --------
64195972f6Sopenharmony_ci+   ------------------------------------
65195972f6Sopenharmony_ci+*/
66195972f6Sopenharmony_ci+#define LWIP_DEBUG 1
67195972f6Sopenharmony_ci+
68195972f6Sopenharmony_ci+#define GAZELLE_DEBUG LWIP_DBG_ON
69195972f6Sopenharmony_ci+
70195972f6Sopenharmony_ci /*
71195972f6Sopenharmony_ci    ------------------------------------
72195972f6Sopenharmony_ci    ---------- Netif options ----------
73195972f6Sopenharmony_ci-- 
74195972f6Sopenharmony_ci2.23.0
75195972f6Sopenharmony_ci
76