lwip/0064-cleancode-rename-gazelle-files-in-lwip.patch
Lemmy Huang 22196b24ad cleancode: remove perf
cleancode: rename gazelle files in lwip

Signed-off-by: Lemmy Huang <huangliming5@huawei.com>
(cherry picked from commit bc082ccc24d6a46ff9eadf3bc0e8d068a34b3654)
2023-05-29 20:34:49 +08:00

477 lines
13 KiB
Diff

From d41efd0c2f8f899daed9acfac86ac57738994bf1 Mon Sep 17 00:00:00 2001
From: Lemmy Huang <huangliming5@huawei.com>
Date: Fri, 19 May 2023 09:39:16 +0800
Subject: [PATCH 2/3] cleancode: rename gazelle files in lwip
Signed-off-by: Lemmy Huang <huangliming5@huawei.com>
---
src/api/api_msg.c | 2 +-
src/api/gazelle_dir.mk | 2 +-
src/api/{posix_api.c => gazelle_posix_api.c} | 2 +-
src/api/sockets.c | 2 +-
src/core/ipv4/icmp.c | 2 +-
src/core/ipv4/ip4.c | 2 +-
src/core/ipv4/ip4_frag.c | 2 +-
src/core/tcp_in.c | 2 +-
src/core/tcp_out.c | 2 +-
src/core/udp.c | 2 +-
src/include/arch/cc.h | 6 +++---
src/include/arch/sys_arch.h | 6 +++---
src/include/{dpdk_cksum.h => gazelle_dpdk_offload.h} | 6 +++---
src/include/{eventpoll.h => gazelle_event.h} | 8 ++++----
src/include/{hlist.h => gazelle_hlist.h} | 8 ++++----
src/include/{list.h => gazelle_list.h} | 6 +++---
src/include/{posix_api.h => gazelle_posix_api.h} | 6 +++---
src/include/{reg_sock.h => gazelle_tcp_reg.h} | 6 +++---
src/include/lwip/priv/tcp_priv.h | 2 +-
src/include/lwip/tcp.h | 2 +-
src/include/lwiplog.h | 6 +++---
src/include/lwipopts.h | 6 +++---
src/include/lwipsock.h | 8 ++++----
src/netif/ethernet.c | 2 +-
24 files changed, 49 insertions(+), 49 deletions(-)
rename src/api/{posix_api.c => gazelle_posix_api.c} (99%)
rename src/include/{dpdk_cksum.h => gazelle_dpdk_offload.h} (97%)
rename src/include/{eventpoll.h => gazelle_event.h} (95%)
rename src/include/{hlist.h => gazelle_hlist.h} (98%)
rename src/include/{list.h => gazelle_list.h} (97%)
rename src/include/{posix_api.h => gazelle_posix_api.h} (97%)
rename src/include/{reg_sock.h => gazelle_tcp_reg.h} (96%)
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
index f0572af..18f33ef 100644
--- a/src/api/api_msg.c
+++ b/src/api/api_msg.c
@@ -57,7 +57,7 @@
#if GAZELLE_ENABLE
#include "lwip/sockets.h"
#include "lwipsock.h"
-#include "posix_api.h"
+#include "gazelle_posix_api.h"
#endif
#include <string.h>
diff --git a/src/api/gazelle_dir.mk b/src/api/gazelle_dir.mk
index c069a29..d51ad43 100644
--- a/src/api/gazelle_dir.mk
+++ b/src/api/gazelle_dir.mk
@@ -1,3 +1,3 @@
-SRC = api_lib.c api_msg.c err.c netbuf.c netdb.c netifapi.c sockets.c tcpip.c posix_api.c sys_arch.c
+SRC = api_lib.c api_msg.c err.c netbuf.c netdb.c netifapi.c sockets.c tcpip.c sys_arch.c gazelle_posix_api.c
$(eval $(call register_dir, api, $(SRC)))
diff --git a/src/api/posix_api.c b/src/api/gazelle_posix_api.c
similarity index 99%
rename from src/api/posix_api.c
rename to src/api/gazelle_posix_api.c
index d9b983c..8bd4ce0 100644
--- a/src/api/posix_api.c
+++ b/src/api/gazelle_posix_api.c
@@ -41,7 +41,7 @@
#include "lwip/err.h"
#include "lwipsock.h"
-#include "posix_api.h"
+#include "gazelle_posix_api.h"
posix_api_t *posix_api;
posix_api_t posix_api_val;
diff --git a/src/api/sockets.c b/src/api/sockets.c
index a0f9d50..f402db8 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -66,7 +66,7 @@
#if GAZELLE_ENABLE
#include <stdarg.h>
#include "lwipsock.h"
-#include "posix_api.h"
+#include "gazelle_posix_api.h"
#endif
#include <string.h>
diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c
index 402ba69..2b15ed4 100644
--- a/src/core/ipv4/icmp.c
+++ b/src/core/ipv4/icmp.c
@@ -52,7 +52,7 @@
#include <string.h>
#if GAZELLE_ENABLE && CHECKSUM_GEN_IP_HW
-#include "dpdk_cksum.h"
+#include "gazelle_dpdk_offload.h"
#endif
#ifdef LWIP_HOOK_FILENAME
diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c
index 1496289..079716d 100644
--- a/src/core/ipv4/ip4.c
+++ b/src/core/ipv4/ip4.c
@@ -60,7 +60,7 @@
#include <string.h>
#if GAZELLE_ENABLE && (CHECKSUM_CHECK_IP_HW || CHECKSUM_GEN_IP_HW)
-#include "dpdk_cksum.h"
+#include "gazelle_dpdk_offload.h"
#endif
#ifdef LWIP_HOOK_FILENAME
diff --git a/src/core/ipv4/ip4_frag.c b/src/core/ipv4/ip4_frag.c
index e01ea51..4d697c8 100644
--- a/src/core/ipv4/ip4_frag.c
+++ b/src/core/ipv4/ip4_frag.c
@@ -52,7 +52,7 @@
#include <string.h>
#if GAZELLE_ENABLE && CHECKSUM_GEN_IP_HW
-#include "dpdk_cksum.h"
+#include "gazelle_dpdk_offload.h"
#endif
#if IP_REASSEMBLY
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 3e635aa..9585965 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -66,7 +66,7 @@
#include <string.h>
#if GAZELLE_ENABLE && CHECKSUM_CHECK_TCP_HW
-#include <dpdk_cksum.h>
+#include <gazelle_dpdk_offload.h>
#endif /* CHECKSUM_CHECK_TCP_HW */
#ifdef LWIP_HOOK_FILENAME
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index ebbc417..fde3b8f 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -84,7 +84,7 @@
#include "lwipsock.h"
#include <rte_prefetch.h>
#if CHECKSUM_GEN_TCP_HW
-#include "dpdk_cksum.h"
+#include "gazelle_dpdk_offload.h"
#endif
#endif
diff --git a/src/core/udp.c b/src/core/udp.c
index d632de8..fc86ac5 100644
--- a/src/core/udp.c
+++ b/src/core/udp.c
@@ -68,7 +68,7 @@
#if GAZELLE_ENABLE
#include "lwipsock.h"
#include <rte_prefetch.h>
-#include "dpdk_cksum.h"
+#include "gazelle_dpdk_offload.h"
#endif
#ifndef UDP_LOCAL_PORT_RANGE_START
diff --git a/src/include/arch/cc.h b/src/include/arch/cc.h
index 10d667b..0b454bb 100644
--- a/src/include/arch/cc.h
+++ b/src/include/arch/cc.h
@@ -30,8 +30,8 @@
*
*/
-#ifndef LWIP_ARCH_CC_H
-#define LWIP_ARCH_CC_H
+#ifndef _LWIP_ARCH_CC_H_
+#define _LWIP_ARCH_CC_H_
#include <stdint.h>
#include <stdlib.h>
@@ -78,4 +78,4 @@ void alloc_memory_##variable_name(void) \
sys_hugepage_malloc(mpname, LWIP_MEM_ALIGN_BUFFER(size)); \
}
-#endif /* LWIP_ARCH_CC_H */
+#endif /* _LWIP_ARCH_CC_H_ */
diff --git a/src/include/arch/sys_arch.h b/src/include/arch/sys_arch.h
index 04e3192..907c116 100644
--- a/src/include/arch/sys_arch.h
+++ b/src/include/arch/sys_arch.h
@@ -30,8 +30,8 @@
*
*/
-#ifndef LWIP_ARCH_SYS_ARCH_H
-#define LWIP_ARCH_SYS_ARCH_H
+#ifndef _LWIP_ARCH_SYS_ARCH_H_
+#define _LWIP_ARCH_SYS_ARCH_H_
#include <rte_cycles.h>
#include <rte_debug.h>
@@ -136,4 +136,4 @@ __attribute__((always_inline)) inline int update_timeout(int timeout, uint32_t p
}
}
-#endif /* LWIP_ARCH_SYS_ARCH_H */
+#endif /* _LWIP_ARCH_SYS_ARCH_H_ */
diff --git a/src/include/dpdk_cksum.h b/src/include/gazelle_dpdk_offload.h
similarity index 97%
rename from src/include/dpdk_cksum.h
rename to src/include/gazelle_dpdk_offload.h
index e41644b..0548258 100644
--- a/src/include/dpdk_cksum.h
+++ b/src/include/gazelle_dpdk_offload.h
@@ -30,8 +30,8 @@
*
*/
-#ifndef __DPDK_CKSUM_H__
-#define __DPDK_CKSUM_H__
+#ifndef _GAZELLE_DPDK_OFFLOAD_H_
+#define _GAZELLE_DPDK_OFFLOAD_H_
#include "lwipopts.h"
#if GAZELLE_ENABLE
@@ -108,4 +108,4 @@ static inline u16_t ip_chksum_pseudo_offload(u8_t proto, u16_t proto_len,
#endif /* CHECKSUM_GEN_TCP_HW */
#endif /* GAZELLE_ENABLE */
-#endif /* __DPDK_CKSUM_H__ */
+#endif /* _GAZELLE_DPDK_OFFLOAD_H_ */
diff --git a/src/include/eventpoll.h b/src/include/gazelle_event.h
similarity index 95%
rename from src/include/eventpoll.h
rename to src/include/gazelle_event.h
index a10c84b..e31ec4b 100644
--- a/src/include/eventpoll.h
+++ b/src/include/gazelle_event.h
@@ -30,13 +30,13 @@
*
*/
-#ifndef __EVENTPOLL_H__
-#define __EVENTPOLL_H__
+#ifndef _GAZELLE_EVENT_H_
+#define _GAZELLE_EVENT_H_
#include <sys/epoll.h>
#include "lwip/api.h"
-#include "list.h"
+#include "gazelle_list.h"
#define MAX_EPOLLFDS 32
@@ -67,4 +67,4 @@ struct lwip_sock;
extern void add_sock_event(struct lwip_sock *sock, uint32_t event);
extern int32_t lstack_epoll_close(int32_t);
-#endif /* __EVENTPOLL_H__ */
+#endif /* _GAZELLE_EVENT_H_ */
diff --git a/src/include/hlist.h b/src/include/gazelle_hlist.h
similarity index 98%
rename from src/include/hlist.h
rename to src/include/gazelle_hlist.h
index 988b017..86b5c6d 100644
--- a/src/include/hlist.h
+++ b/src/include/gazelle_hlist.h
@@ -30,10 +30,10 @@
*
*/
-#ifndef __HLIST_H__
-#define __HLIST_H__
+#ifndef _GAZELLE_HLIST_H_
+#define _GAZELLE_HLIST_H_
-#include "list.h"
+#include "gazelle_list.h"
//#if GAZELLE_TCP_PCB_HASH
struct hlist_node {
@@ -230,4 +230,4 @@ static inline void hlist_ctl_add_after(struct hlist_node *n, struct hlist_node *
}
//#endif /* GAZELLE_TCP_PCB_HASH */
-#endif /* __HLIST_H__ */
+#endif /* _GAZELLE_HLIST_H_ */
diff --git a/src/include/list.h b/src/include/gazelle_list.h
similarity index 97%
rename from src/include/list.h
rename to src/include/gazelle_list.h
index 11f94c2..a40c17f 100644
--- a/src/include/list.h
+++ b/src/include/gazelle_list.h
@@ -30,8 +30,8 @@
*
*/
-#ifndef __LIST_H__
-#define __LIST_H__
+#ifndef _GAZELLE_LIST_H_
+#define _GAZELLE_LIST_H_
#ifndef NULL
#ifdef __cplusplus
@@ -107,4 +107,4 @@ static inline int list_is_empty(const struct list_node *h)
(type *)((char *)__mptr - offsetof(type,member));})
#endif /* container_of */
-#endif /* __LIST_H__ */
+#endif /* _GAZELLE_LIST_H_ */
diff --git a/src/include/posix_api.h b/src/include/gazelle_posix_api.h
similarity index 97%
rename from src/include/posix_api.h
rename to src/include/gazelle_posix_api.h
index a73e2ec..0bed1de 100644
--- a/src/include/posix_api.h
+++ b/src/include/gazelle_posix_api.h
@@ -30,8 +30,8 @@
*
*/
-#ifndef __POSIX_API_H__
-#define __POSIX_API_H__
+#ifndef _GAZELLE_POSIX_API_H_
+#define _GAZELLE_POSIX_API_H_
#include <signal.h>
#include <sys/poll.h>
@@ -88,4 +88,4 @@ int posix_api_init(void);
void posix_api_free(void);
void posix_api_fork(void);
-#endif /* __POSIX_API_H__ */
+#endif /* _GAZELLE_POSIX_API_H_ */
diff --git a/src/include/reg_sock.h b/src/include/gazelle_tcp_reg.h
similarity index 96%
rename from src/include/reg_sock.h
rename to src/include/gazelle_tcp_reg.h
index e349e85..6a9f5f9 100644
--- a/src/include/reg_sock.h
+++ b/src/include/gazelle_tcp_reg.h
@@ -30,8 +30,8 @@
*
*/
-#ifndef __REG_SOCK_H__
-#define __REG_SOCK_H__
+#ifndef _GAZELLE_TCP_REG_
+#define _GAZELLE_TCP_REG_
enum reg_ring_type {
REG_RING_TCP_LISTEN = 0,
@@ -60,4 +60,4 @@ struct reg_ring_msg {
extern int vdev_reg_xmit(enum reg_ring_type type, struct gazelle_quintuple *qtuple);
extern bool port_in_stack_queue(uint32_t src_ip, uint32_t dst_ip, uint16_t src_port, uint16_t dst_port);
-#endif /* __REG_SOCK_H__ */
+#endif /* _GAZELLE_TCP_REG_ */
diff --git a/src/include/lwip/priv/tcp_priv.h b/src/include/lwip/priv/tcp_priv.h
index ddae3fd..44200ff 100644
--- a/src/include/lwip/priv/tcp_priv.h
+++ b/src/include/lwip/priv/tcp_priv.h
@@ -341,7 +341,7 @@ extern PER_THREAD struct tcp_pcb *tcp_tw_pcbs; /* List of all TCP PCBs in T
extern PER_THREAD struct tcp_pcb ** tcp_pcb_lists[NUM_TCP_PCB_LISTS];
#if GAZELLE_ENABLE
-#include "reg_sock.h"
+#include "gazelle_tcp_reg.h"
static inline int vdev_reg_done(enum reg_ring_type reg_type, const struct tcp_pcb *pcb)
{
LWIP_ASSERT("Invalid parameter", pcb != NULL);
diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
index e13099c..11ddd25 100644
--- a/src/include/lwip/tcp.h
+++ b/src/include/lwip/tcp.h
@@ -53,7 +53,7 @@
#if GAZELLE_TCP_PCB_HASH
#include "lwip/sys.h"
-#include "hlist.h"
+#include "gazelle_hlist.h"
#endif
#ifdef __cplusplus
diff --git a/src/include/lwiplog.h b/src/include/lwiplog.h
index f278ff4..2cf68f9 100644
--- a/src/include/lwiplog.h
+++ b/src/include/lwiplog.h
@@ -30,8 +30,8 @@
*
*/
-#ifndef __LWIPLOG_H__
-#define __LWIPLOG_H__
+#ifndef _LWIPLOG_H_
+#define _LWIPLOG_H_
#include <stdio.h>
#include <sys/syscall.h>
@@ -77,4 +77,4 @@ do { LWIP_PLATFORM_LOG(LWIP_LOG_FATAL, "Assertion \"%s\" failed at line %d in %s
#endif /* GAZELLE_USE_DPDK_LOG */
-#endif /* __LWIPLOG_H__ */
+#endif /* _LWIPLOG_H_ */
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index 828a2d1..bc85eae 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -30,8 +30,8 @@
*
*/
-#ifndef __LWIPOPTS_H__
-#define __LWIPOPTS_H__
+#ifndef _LWIPOPTS_H_
+#define _LWIPOPTS_H_
/*
-------------------------------------
@@ -241,4 +241,4 @@
*/
#define LWIP_NETIF_LOOPBACK 1
-#endif /* __LWIPOPTS_H__ */
+#endif /* _LWIPOPTS_H_ */
diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h
index f8480c5..1814f76 100644
--- a/src/include/lwipsock.h
+++ b/src/include/lwipsock.h
@@ -30,14 +30,14 @@
*
*/
-#ifndef __LWIPSOCK_H__
-#define __LWIPSOCK_H__
+#ifndef _LWIPSOCK_H_
+#define _LWIPSOCK_H_
#include <semaphore.h>
#include "lwip/opt.h"
#include "lwip/api.h"
-#include "eventpoll.h"
+#include "gazelle_event.h"
/* move some definitions to the lwipsock.h for libnet to use, and
* at the same time avoid conflict between lwip/sockets.h and sys/socket.h
@@ -187,4 +187,4 @@ struct lwip_sock *get_socket_by_fd(int s);
void lwip_sock_init(void);
void lwip_exit(void);
-#endif /* __LWIPSOCK_H__ */
+#endif /* _LWIPSOCK_H_ */
diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c
index fd13f00..deddf3f 100644
--- a/src/netif/ethernet.c
+++ b/src/netif/ethernet.c
@@ -57,7 +57,7 @@
#endif /* PPPOE_SUPPORT */
#if GAZELLE_ENABLE && (CHECKSUM_GEN_TCP_HW || CHECKSUM_GEN_IP_HW)
-#include "dpdk_cksum.h"
+#include "gazelle_dpdk_offload.h"
#endif
#ifdef LWIP_HOOK_FILENAME
--
2.22.0.windows.1