1 Star 0 Fork 48

yc555/lwip

forked from src-openEuler/lwip 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0053-cleancode-improve-lwipopts.h-readability.patch 68.97 KB
一键复制 编辑 原始数据 按行查看 历史
jinag12 提交于 2024-02-06 10:45 . adapt lwip-2.2.0
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239
From b42299206a917ed5876c27617de59fb71f8437a7 Mon Sep 17 00:00:00 2001
From: Lemmy Huang <huangliming5@huawei.com>
Date: Thu, 9 Mar 2023 10:57:16 +0800
Subject: [PATCH] cleancode: improve lwipopts.h readability
Signed-off-by: Lemmy Huang <huangliming5@huawei.com>
---
src/api/api_msg.c | 12 +-
src/api/sockets.c | 66 ++++-----
src/api/tcpip.c | 18 +--
src/core/ipv4/etharp.c | 4 +-
src/core/ipv4/icmp.c | 2 +-
src/core/ipv4/ip4.c | 6 +-
src/core/ipv4/ip4_frag.c | 4 +-
src/core/memp.c | 4 +-
src/core/pbuf.c | 8 +-
src/core/tcp.c | 66 ++++-----
src/core/tcp_in.c | 46 +++---
src/core/tcp_out.c | 36 ++---
src/core/timeouts.c | 4 +-
src/include/arch/sys_arch.h | 2 +-
src/include/dpdk_cksum.h | 4 +-
src/include/hlist.h | 4 +-
src/include/lwip/api.h | 10 +-
src/include/lwip/ip.h | 4 +-
src/include/lwip/memp.h | 10 +-
src/include/lwip/opt.h | 8 +-
src/include/lwip/pbuf.h | 6 +-
src/include/lwip/priv/memp_std.h | 4 +-
src/include/lwip/priv/tcp_priv.h | 24 ++--
src/include/lwip/sockets.h | 30 ++--
src/include/lwip/tcp.h | 16 +--
src/include/lwip/timeouts.h | 4 +-
src/include/lwiplog.h | 4 +-
src/include/lwipopts.h | 240 +++++++++++++++++--------------
src/include/lwipsock.h | 8 +-
src/netif/ethernet.c | 2 +-
30 files changed, 339 insertions(+), 317 deletions(-)
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
index 1162f90..5a2e689 100644
--- a/src/api/api_msg.c
+++ b/src/api/api_msg.c
@@ -54,7 +54,7 @@
#include "lwip/mld6.h"
#include "lwip/priv/tcpip_priv.h"
-#if USE_LIBOS
+#if GAZELLE_ENABLE
#include "lwip/sockets.h"
#include "lwipsock.h"
#include "posix_api.h"
@@ -344,7 +344,7 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
#if LWIP_SO_RCVBUF
SYS_ARCH_INC(conn->recv_avail, len);
#endif /* LWIP_SO_RCVBUF */
-#if USE_LIBOS
+#if GAZELLE_ENABLE
add_recv_list(conn->socket);
LWIP_UNUSED_ARG(len);
#else
@@ -480,7 +480,7 @@ err_tcp(void *arg, err_t err)
if (NETCONN_MBOX_VALID(conn, &conn->recvmbox)) {
/* use trypost to prevent deadlock */
sys_mbox_trypost(&conn->recvmbox, mbox_msg);
-#if USE_LIBOS
+#if GAZELLE_ENABLE
add_recv_list(conn->socket);
#endif
}
@@ -612,7 +612,7 @@ accept_function(void *arg, struct tcp_pcb *newpcb, err_t err)
API_EVENT(conn, NETCONN_EVT_RCVPLUS, 0);
}
-#if USE_LIBOS
+#if GAZELLE_ENABLE
LWIP_DEBUGF(API_MSG_DEBUG, ("libos incoming connection established\n"));
SET_CONN_TYPE_LIBOS(newconn);
#endif
@@ -1334,7 +1334,7 @@ lwip_netconn_do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
return ERR_VAL;
}
-#if USE_LIBOS
+#if GAZELLE_ENABLE
gazelle_connected_callback(conn);
#endif
@@ -1739,7 +1739,7 @@ lwip_netconn_do_writemore(struct netconn *conn WRITE_DELAYED_PARAM)
} else {
write_more = 0;
}
-#if USE_LIBOS
+#if GAZELLE_ENABLE
/* vector->ptr is private arg sock */
LWIP_UNUSED_ARG(dataptr);
write_more = 0;
diff --git a/src/api/sockets.c b/src/api/sockets.c
index de6c701..e525c9d 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -62,7 +62,7 @@
#include <stdarg.h>
#endif
-#if USE_LIBOS
+#if GAZELLE_ENABLE
#include <stdarg.h>
#include "lwipsock.h"
#include "posix_api.h"
@@ -137,7 +137,7 @@
#endif /* LWIP_SOCKET_HAVE_SA_LEN */
#if LWIP_IPV4
-#if USE_LIBOS
+#if GAZELLE_ENABLE
#define IP4ADDR_PORT_TO_SOCKADDR(sin, ipaddr, port) do { \
(sin)->sin_family = AF_INET; \
(sin)->sin_port = lwip_htons((port)); \
@@ -150,7 +150,7 @@
(sin)->sin_port = lwip_htons((port)); \
inet_addr_from_ip4addr(&(sin)->sin_addr, ipaddr); \
memset((sin)->sin_zero, 0, SIN_ZERO_LEN); }while(0)
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
#define SOCKADDR4_TO_IP4ADDR_PORT(sin, ipaddr, port) do { \
inet_addr_to_ip4addr(ip_2_ip4(ipaddr), &((sin)->sin_addr)); \
(port) = lwip_ntohs((sin)->sin_port); }while(0)
@@ -316,12 +316,12 @@ static void lwip_socket_drop_registered_mld6_memberships(int s);
#endif /* LWIP_IPV6_MLD */
/** The global array of available sockets */
-#if USE_LIBOS
+#if GAZELLE_ENABLE
uint32_t sockets_num;
struct lwip_sock *sockets;
#else
static struct lwip_sock sockets[NUM_SOCKETS];
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
#if LWIP_SOCKET_SELECT || LWIP_SOCKET_POLL
#if LWIP_TCPIP_CORE_LOCKING
@@ -471,11 +471,11 @@ tryget_socket_unconn_nouse(int fd)
{
int s = fd - LWIP_SOCKET_OFFSET;
-#if USE_LIBOS
+#if GAZELLE_ENABLE
if ((s < 0) || (s >= sockets_num))
#else
if ((s < 0) || (s >= NUM_SOCKETS))
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
{
LWIP_DEBUGF(SOCKETS_DEBUG, ("tryget_socket_unconn(%d): invalid\n", fd));
return NULL;
@@ -540,13 +540,13 @@ tryget_socket(int fd)
* @param fd externally used socket index
* @return struct lwip_sock for the socket or NULL if not found
*/
-#if USE_LIBOS
+#if GAZELLE_ENABLE
struct lwip_sock *
get_socket(int fd)
#else
static struct lwip_sock *
get_socket(int fd)
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
{
struct lwip_sock *sock = tryget_socket(fd);
if (!sock) {
@@ -559,7 +559,7 @@ get_socket(int fd)
return sock;
}
-#if USE_LIBOS
+#if GAZELLE_ENABLE
/**
* Map a externally used socket index to the internal socket representation.
*
@@ -575,7 +575,7 @@ get_socket_by_fd(int fd)
}
return &sockets[fd - LWIP_SOCKET_OFFSET];
}
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
/**
* Allocate a new socket for a given netconn.
@@ -593,7 +593,7 @@ alloc_socket(struct netconn *newconn, int accepted, int flags)
SYS_ARCH_DECL_PROTECT(lev);
LWIP_UNUSED_ARG(accepted);
-#if USE_LIBOS
+#if GAZELLE_ENABLE
int type, protocol = 0, domain = AF_INET;
switch (NETCONNTYPE_GROUP(newconn->type)) {
case NETCONN_RAW:
@@ -655,7 +655,7 @@ err:
posix_api->close_fn(i);
SYS_ARCH_UNPROTECT(lev);
return -1;
-#else /* USE_LIBOS */
+#else /* GAZELLE_ENABLE */
/* allocate a new socket identifier */
for (i = 0; i < NUM_SOCKETS; ++i) {
@@ -689,7 +689,7 @@ err:
}
return -1;
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
}
/** Free a socket (under lock)
@@ -812,12 +812,12 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
done_socket(sock);
return -1;
}
-#if USE_LIBOS
+#if GAZELLE_ENABLE
LWIP_ASSERT("invalid socket index", (newsock >= LWIP_SOCKET_OFFSET) && (newsock < sockets_num + LWIP_SOCKET_OFFSET));
gazelle_init_sock(newsock);
#else
LWIP_ASSERT("invalid socket index", (newsock >= LWIP_SOCKET_OFFSET) && (newsock < NUM_SOCKETS + LWIP_SOCKET_OFFSET));
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
nsock = &sockets[newsock - LWIP_SOCKET_OFFSET];
/* See event_callback: If data comes in right away after an accept, even
@@ -855,13 +855,13 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
}
IPADDR_PORT_TO_SOCKADDR(&tempaddr, &naddr, port);
-#if !USE_LIBOS
+#if !GAZELLE_ENABLE
if (*addrlen > IPADDR_SOCKADDR_GET_LEN(&tempaddr)) {
*addrlen = IPADDR_SOCKADDR_GET_LEN(&tempaddr);
}
#else
*addrlen = LWIP_MIN(*addrlen, sizeof(tempaddr));
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
MEMCPY(addr, &tempaddr, *addrlen);
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d) returning new sock=%d addr=", s, newsock));
@@ -1030,10 +1030,10 @@ lwip_connect(int s, const struct sockaddr *name, socklen_t namelen)
return -1;
}
-#if USE_LIBOS
+#if GAZELLE_ENABLE
LWIP_DEBUGF(SOCKETS_DEBUG, ("libos connect succeed fd=%d\n",s));
SET_CONN_TYPE_LIBOS(sock->conn);
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_connect(%d) succeeded\n", s));
set_errno(0);
@@ -1102,7 +1102,7 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
apiflags |= NETCONN_DONTBLOCK;
}
-#if !USE_LIBOS
+#if !GAZELLE_ENABLE
do {
struct pbuf *p;
err_t err;
@@ -1182,13 +1182,13 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
/* @todo: do we need to support peeking more than one pbuf? */
} while ((recv_left > 0) && !(flags & MSG_PEEK));
lwip_recv_tcp_done:
-#else /* USE_LIBOS */
+#else /* GAZELLE_ENABLE */
LWIP_UNUSED_ARG(recv_left);
recvd = read_lwip_data(sock, flags, apiflags);
if (recvd <= 0) {
return recvd;
}
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
if (apiflags & NETCONN_NOAUTORCVD) {
if ((recvd > 0) && !(flags & MSG_PEEK)) {
/* ensure window update after copying all data */
@@ -1223,7 +1223,7 @@ lwip_sock_make_addr(struct netconn *conn, ip_addr_t *fromaddr, u16_t port,
#endif /* LWIP_IPV4 && LWIP_IPV6 */
IPADDR_PORT_TO_SOCKADDR(&saddr, fromaddr, port);
-#if !USE_LIBOS
+#if !GAZELLE_ENABLE
if (*fromlen < IPADDR_SOCKADDR_GET_LEN(&saddr)) {
truncated = 1;
} else if (*fromlen > IPADDR_SOCKADDR_GET_LEN(&saddr)) {
@@ -2725,7 +2725,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
if (sock->rcvevent > 1) {
check_waiters = 0;
}
-#if USE_LIBOS
+#if GAZELLE_ENABLE
if (conn->acceptmbox != NULL && !sys_mbox_empty(conn->acceptmbox)) {
add_sock_event(sock, POLLIN);
}
@@ -2747,7 +2747,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
break;
case NETCONN_EVT_ERROR:
sock->errevent = 1;
-#if USE_LIBOS
+#if GAZELLE_ENABLE
add_sock_event(sock, EPOLLERR);
#endif
break;
@@ -2944,7 +2944,7 @@ lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen, u8_t local)
ip_addr_debug_print_val(SOCKETS_DEBUG, naddr);
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%"U16_F")\n", port));
-#if !USE_LIBOS
+#if !GAZELLE_ENABLE
if (*namelen > IPADDR_SOCKADDR_GET_LEN(&saddr)) {
*namelen = IPADDR_SOCKADDR_GET_LEN(&saddr);
}
@@ -3085,7 +3085,7 @@ lwip_sockopt_to_ipopt(int optname)
return SOF_KEEPALIVE;
case SO_REUSEADDR:
return SOF_REUSEADDR;
-#if USE_LIBOS
+#if GAZELLE_ENABLE
case SO_REUSEPORT:
return SO_REUSEPORT;
#endif
@@ -3961,7 +3961,7 @@ lwip_setsockopt_impl(int s, int level, int optname, const void *optval, socklen_
return err;
}
-#if USE_LIBOS
+#if GAZELLE_ENABLE
int
lwip_ioctl(int s, long cmd, ...)
{
@@ -3996,7 +3996,7 @@ lwip_ioctl(int s, long cmd, void *argp)
if (!sock) {
return -1;
}
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
switch (cmd) {
#if LWIP_SO_RCVBUF || LWIP_FIONREAD_LINUXMODE
@@ -4140,7 +4140,7 @@ lwip_fcntl(int s, int cmd, int val)
break;
default:
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_fcntl(%d, UNIMPL: %d, %d)\n", s, cmd, val));
-#if USE_LIBOS
+#if GAZELLE_ENABLE
sock_errno(sock, 0); /* not yet implemented, but we return 0 for compatilbe with app */
ret = 0;
#else
@@ -4408,7 +4408,7 @@ lwip_socket_drop_registered_mld6_memberships(int s)
}
#endif /* LWIP_IPV6_MLD */
-#if USE_LIBOS
+#if GAZELLE_ENABLE
void lwip_sock_init(void)
{
if (sockets_num == 0) {
@@ -4433,6 +4433,6 @@ void lwip_exit(void)
return;
}
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
#endif /* LWIP_SOCKET */
diff --git a/src/api/tcpip.c b/src/api/tcpip.c
index 05adfe0..d0d3cba 100644
--- a/src/api/tcpip.c
+++ b/src/api/tcpip.c
@@ -123,13 +123,13 @@ again:
*
* @param arg unused argument
*/
-#if USE_LIBOS
+#if GAZELLE_ENABLE
__attribute__((unused)) static void
tcpip_thread(void *arg)
#else
static void
tcpip_thread(void *arg)
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
{
struct tcpip_msg *msg;
LWIP_UNUSED_ARG(arg);
@@ -252,7 +252,7 @@ tcpip_inpkt(struct pbuf *p, struct netif *inp, netif_input_fn input_fn)
#if LWIP_TCPIP_CORE_LOCKING_INPUT
err_t ret;
LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_inpkt: PACKET %p/%p\n", (void *)p, (void *)inp));
-#if USE_LIBOS && LWIP_TIMERS
+#if GAZELLE_ENABLE && LWIP_TIMERS
sys_timer_run();
#endif
LOCK_TCPIP_CORE();
@@ -334,7 +334,7 @@ tcpip_callback(tcpip_callback_fn function, void *ctx)
msg->msg.cb.function = function;
msg->msg.cb.ctx = ctx;
-#if USE_LIBOS && LWIP_TIMER
+#if GAZELLE_ENABLE && LWIP_TIMER
sys_timer_run();
#endif
sys_mbox_post(&tcpip_mbox, msg);
@@ -373,7 +373,7 @@ tcpip_try_callback(tcpip_callback_fn function, void *ctx)
msg->msg.cb.function = function;
msg->msg.cb.ctx = ctx;
-#if USE_LIBOS && LWIP_TIMER
+#if GAZELLE_ENABLE && LWIP_TIMER
sys_timer_run();
#endif
if (sys_mbox_trypost(&tcpip_mbox, msg) != ERR_OK) {
@@ -457,7 +457,7 @@ tcpip_send_msg_wait_sem(tcpip_callback_fn fn, void *apimsg, sys_sem_t *sem)
{
#if LWIP_TCPIP_CORE_LOCKING
LWIP_UNUSED_ARG(sem);
-#if USE_LIBOS && LWIP_TIMERS
+#if GAZELLE_ENABLE && LWIP_TIMERS
sys_timer_run();
#endif
LOCK_TCPIP_CORE();
@@ -497,7 +497,7 @@ tcpip_api_call(tcpip_api_call_fn fn, struct tcpip_api_call_data *call)
#if LWIP_TCPIP_CORE_LOCKING
err_t err;
LOCK_TCPIP_CORE();
-#if USE_LIBOS && LWIP_TIMERS
+#if GAZELLE_ENABLE && LWIP_TIMERS
sys_timer_run();
#endif
err = fn(call);
@@ -563,7 +563,7 @@ tcpip_callbackmsg_new(tcpip_callback_fn function, void *ctx)
msg->msg.cb.function = function;
msg->msg.cb.ctx = ctx;
-#if USE_LIBOS && LWIP_TIMER
+#if GAZELLE_ENABLE && LWIP_TIMER
sys_timer_run();
#endif
return (struct tcpip_callback_msg *)msg;
@@ -686,7 +686,7 @@ tcpip_init(tcpip_init_done_fn initfunc, void *arg)
}
#endif /* LWIP_TCPIP_CORE_LOCKING */
-#if !USE_LIBOS
+#if !GAZELLE_ENABLE
sys_thread_new(TCPIP_THREAD_NAME, tcpip_thread, NULL, TCPIP_THREAD_STACKSIZE, TCPIP_THREAD_PRIO);
#endif
}
diff --git a/src/core/ipv4/etharp.c b/src/core/ipv4/etharp.c
index 2d477bd..6a9117a 100644
--- a/src/core/ipv4/etharp.c
+++ b/src/core/ipv4/etharp.c
@@ -483,7 +483,7 @@ etharp_update_arp_entry(struct netif *netif, const ip4_addr_t *ipaddr, struct et
struct pbuf *p = arp_table[i].q;
arp_table[i].q = NULL;
#endif /* ARP_QUEUEING */
-#if USE_LIBOS
+#if GAZELLE_ENABLE
struct pbuf *tmp = p->next;
while (tmp != NULL) {
tmp->ref--;
@@ -1035,7 +1035,7 @@ etharp_query(struct netif *netif, const ip4_addr_t *ipaddr, struct pbuf *q)
} else {
/* referencing the old pbuf is enough */
p = q;
-#if USE_LIBOS
+#if GAZELLE_ENABLE
struct pbuf *tmp = p;
while (tmp != NULL) {
pbuf_ref(tmp);
diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c
index 0404608..0a3b1c3 100644
--- a/src/core/ipv4/icmp.c
+++ b/src/core/ipv4/icmp.c
@@ -51,7 +51,7 @@
#include <string.h>
-#if USE_LIBOS && CHECKSUM_GEN_IP_HW
+#if GAZELLE_ENABLE && CHECKSUM_GEN_IP_HW
#include "dpdk_cksum.h"
#endif
diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c
index 8ef1a55..42f4bd5 100644
--- a/src/core/ipv4/ip4.c
+++ b/src/core/ipv4/ip4.c
@@ -59,7 +59,7 @@
#include <string.h>
-#if USE_LIBOS && (CHECKSUM_CHECK_IP_HW || CHECKSUM_GEN_IP_HW)
+#if GAZELLE_ENABLE && (CHECKSUM_CHECK_IP_HW || CHECKSUM_GEN_IP_HW)
#include "dpdk_cksum.h"
#endif
@@ -1068,13 +1068,13 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
#endif /* ENABLE_LOOPBACK */
#if IP_FRAG
/* don't fragment if interface has mtu set to 0 [loopif] */
-#if USE_LIBOS
+#if GAZELLE_ENABLE
if (!(get_eth_params_tx_ol() & DEV_TX_OFFLOAD_TCP_TSO)) {
#endif
if (netif->mtu && (p->tot_len > netif->mtu)) {
return ip4_frag(p, netif, dest);
}
-#if USE_LIBOS
+#if GAZELLE_ENABLE
}
#endif
#endif /* IP_FRAG */
diff --git a/src/core/ipv4/ip4_frag.c b/src/core/ipv4/ip4_frag.c
index 727a257..dadf395 100644
--- a/src/core/ipv4/ip4_frag.c
+++ b/src/core/ipv4/ip4_frag.c
@@ -51,7 +51,7 @@
#include <string.h>
-#if USE_LIBOS && CHECKSUM_GEN_IP_HW
+#if GAZELLE_ENABLE && CHECKSUM_GEN_IP_HW
#include "dpdk_cksum.h"
#endif
@@ -115,7 +115,7 @@ PACK_STRUCT_END
IPH_ID(iphdrA) == IPH_ID(iphdrB)) ? 1 : 0
/* global variables */
-#if USE_LIBOS
+#if GAZELLE_ENABLE
static PER_THREAD struct ip_reassdata *reassdatagrams;
static PER_THREAD u16_t ip_reass_pbufcount;
#else
diff --git a/src/core/memp.c b/src/core/memp.c
index 454ba32..fca1b0c 100644
--- a/src/core/memp.c
+++ b/src/core/memp.c
@@ -78,14 +78,14 @@
#define LWIP_MEMPOOL(name,num,size,desc) LWIP_MEMPOOL_DECLARE(name,num,size,desc)
#include "lwip/priv/memp_std.h"
-#if USE_LIBOS
+#if GAZELLE_ENABLE
PER_THREAD struct memp_desc* memp_pools[MEMP_MAX] = {NULL};
#else
const struct memp_desc *const memp_pools[MEMP_MAX] = {
#define LWIP_MEMPOOL(name,num,size,desc) &memp_ ## name,
#include "lwip/priv/memp_std.h"
};
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
#ifdef LWIP_HOOK_FILENAME
#include LWIP_HOOK_FILENAME
diff --git a/src/core/pbuf.c b/src/core/pbuf.c
index 9da050a..112baeb 100644
--- a/src/core/pbuf.c
+++ b/src/core/pbuf.c
@@ -83,7 +83,7 @@
#if LWIP_CHECKSUM_ON_COPY
#include "lwip/inet_chksum.h"
#endif
-#if USE_LIBOS
+#if GAZELLE_ENABLE
#include <rte_prefetch.h>
#endif
@@ -284,7 +284,7 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
}
/* If pbuf is to be allocated in RAM, allocate memory for it. */
-#if USE_LIBOS
+#if GAZELLE_ENABLE
/* alloc mbuf avoid send copy */
p = lwip_alloc_pbuf(layer, length, type);
#else
@@ -755,7 +755,7 @@ pbuf_free(struct pbuf *p)
/* de-allocate all consecutive pbufs from the head of the chain that
* obtain a zero reference count after decrementing*/
while (p != NULL) {
-#if USE_LIBOS
+#if GAZELLE_ENABLE
if (p->next)
rte_prefetch0(p->next);
#endif
@@ -1024,7 +1024,7 @@ pbuf_copy_partial_pbuf(struct pbuf *p_to, const struct pbuf *p_from, u16_t copy_
len = p_to->len - offset_to;
}
-#if USE_LIBOS && (CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW)
+#if GAZELLE_ENABLE && (CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW)
p_to->l2_len = p_from->l2_len;
p_to->l3_len = p_from->l3_len;
p_to->ol_flags = p_from->ol_flags;
diff --git a/src/core/tcp.c b/src/core/tcp.c
index 2cc1174..9023dde 100644
--- a/src/core/tcp.c
+++ b/src/core/tcp.c
@@ -183,7 +183,7 @@ PER_THREAD struct tcp_pcb *tcp_tw_pcbs;
/** An array with all (non-temporary) PCB lists, mainly used for smaller code size */
PER_THREAD struct tcp_pcb ** tcp_pcb_lists[NUM_TCP_PCB_LISTS] = {NULL, NULL, NULL, NULL};
-#if TCP_PCB_HASH
+#if GAZELLE_TCP_PCB_HASH
#define INIT_TCP_HTABLE(ht_ptr) \
do { \
int _i; \
@@ -203,7 +203,7 @@ PER_THREAD u8_t tcp_active_pcbs_changed;
/** Timer counter to handle calling slow-timer from tcp_tmr() */
static PER_THREAD u8_t tcp_timer;
static PER_THREAD u8_t tcp_timer_ctr;
-#if USE_LIBOS
+#if GAZELLE_ENABLE
static u16_t tcp_new_port(struct tcp_pcb *pcb);
#else
static u16_t tcp_new_port(void);
@@ -214,7 +214,7 @@ static err_t tcp_close_shutdown_fin(struct tcp_pcb *pcb);
static void tcp_ext_arg_invoke_callbacks_destroyed(struct tcp_pcb_ext_args *ext_args);
#endif
-#if USE_LIBOS
+#if GAZELLE_ENABLE
static u8_t port_state[TCP_LOCAL_PORT_RANGE_END - TCP_LOCAL_PORT_RANGE_START + 1] = {0};
void release_port(u16_t port)
{
@@ -238,7 +238,7 @@ tcp_init(void)
tcp_port = TCP_ENSURE_LOCAL_PORT_RANGE(LWIP_RAND());
#endif /* LWIP_RAND */
-#if TCP_PCB_HASH
+#if GAZELLE_TCP_PCB_HASH
tcp_active_htable = (struct tcp_hash_table*)mem_malloc(sizeof(struct tcp_hash_table));
LWIP_ASSERT("malloc tcp_active_htable mem failed.", tcp_active_htable != NULL);
INIT_TCP_HTABLE(tcp_active_htable);
@@ -249,7 +249,7 @@ tcp_init(void)
void
tcp_free(struct tcp_pcb *pcb)
{
-#if USE_LIBOS
+#if GAZELLE_ENABLE
vdev_unreg_done(pcb);
release_port(pcb->local_port);
#endif
@@ -405,7 +405,7 @@ tcp_close_shutdown(struct tcp_pcb *pcb, u8_t rst_on_unacked_data)
pcb->local_port, pcb->remote_port);
tcp_pcb_purge(pcb);
-#if TCP_PCB_HASH
+#if GAZELLE_TCP_PCB_HASH
TCP_RMV_ACTIVE_HASH(pcb);
#endif
TCP_RMV_ACTIVE(pcb);
@@ -442,7 +442,7 @@ tcp_close_shutdown(struct tcp_pcb *pcb, u8_t rst_on_unacked_data)
tcp_free_listen(pcb);
break;
case SYN_SENT:
-#if TCP_PCB_HASH
+#if GAZELLE_TCP_PCB_HASH
TCP_PCB_REMOVE_ACTIVE_HASH(pcb);
#endif
TCP_PCB_REMOVE_ACTIVE(pcb);
@@ -650,7 +650,7 @@ tcp_abandon(struct tcp_pcb *pcb, int reset)
} else {
send_rst = reset;
local_port = pcb->local_port;
-#if TCP_PCB_HASH
+#if GAZELLE_TCP_PCB_HASH
TCP_PCB_REMOVE_ACTIVE_HASH(pcb);
#endif
TCP_PCB_REMOVE_ACTIVE(pcb);
@@ -761,7 +761,7 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
#endif /* LWIP_IPV6 && LWIP_IPV6_SCOPES */
if (port == 0) {
-#if USE_LIBOS
+#if GAZELLE_ENABLE
port = tcp_new_port(pcb);
#else
port = tcp_new_port();
@@ -773,7 +773,7 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
/* Check if the address already is in use (on all lists) */
for (i = 0; i < max_pcb_list; i++) {
for (cpcb = *tcp_pcb_lists[i]; cpcb != NULL; cpcb = cpcb->next) {
-#if REUSE_IPPORT
+#if GAZELLE_TCP_REUSE_IPPORT
continue;
#else
if (cpcb->local_port == port) {
@@ -927,7 +927,7 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err)
goto done;
}
-#if REUSE_IPPORT
+#if GAZELLE_TCP_REUSE_IPPORT
struct tcp_pcb_listen *first_same_port_pcb = NULL;
for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
if ((lpcb->local_port == pcb->local_port) &&
@@ -952,9 +952,9 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err)
}
}
}
-#endif /* REUSE_IPPORT */
+#endif /* GAZELLE_TCP_REUSE_IPPORT */
-#if USE_LIBOS
+#if GAZELLE_ENABLE
vdev_reg_done(REG_RING_TCP_LISTEN, pcb);
#endif
@@ -972,7 +972,7 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err)
lpcb->ttl = pcb->ttl;
lpcb->tos = pcb->tos;
-#if REUSE_IPPORT
+#if GAZELLE_TCP_REUSE_IPPORT
lpcb->connect_num = 0;
lpcb->next_same_port_pcb = NULL;
@@ -995,7 +995,7 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err)
/* copy over ext_args to listening pcb */
memcpy(&lpcb->ext_args, &pcb->ext_args, sizeof(pcb->ext_args));
#endif
-#if USE_LIBOS
+#if GAZELLE_ENABLE
/* pcb transfer to lpcb and reg into tcp_listen_pcbs. freeing pcb shouldn't release sock table in here.
* local_port=0 avoid to release sock table in tcp_free */
pcb->local_port = 0;
@@ -1009,7 +1009,7 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err)
tcp_backlog_set(lpcb, backlog);
#endif /* TCP_LISTEN_BACKLOG */
-#if REUSE_IPPORT
+#if GAZELLE_TCP_REUSE_IPPORT
if (first_same_port_pcb != NULL) {
TCP_REG_SAMEPORT((struct tcp_pcb_listen *)first_same_port_pcb, (struct tcp_pcb_listen *)lpcb);
} else
@@ -1112,7 +1112,7 @@ tcp_recved(struct tcp_pcb *pcb, u16_t len)
*
* @return a new (free) local TCP port number
*/
-#if USE_LIBOS
+#if GAZELLE_ENABLE
static u16_t
tcp_new_port(struct tcp_pcb *pcb)
#else
@@ -1131,7 +1131,7 @@ tcp_new_port(void)
}
if (__atomic_load_n(&port_state[tcp_port - TCP_LOCAL_PORT_RANGE_START], __ATOMIC_ACQUIRE) == 0) {
-#if USE_LIBOS
+#if GAZELLE_ENABLE
if (port_in_stack_queue(pcb->remote_ip.addr, pcb->local_ip.addr, pcb->remote_port, tcp_port)) {
tmp_port = tcp_port;
__atomic_store_n(&port_state[tcp_port - TCP_LOCAL_PORT_RANGE_START], 1, __ATOMIC_RELEASE);
@@ -1234,7 +1234,7 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port,
old_local_port = pcb->local_port;
if (pcb->local_port == 0) {
-#if USE_LIBOS
+#if GAZELLE_ENABLE
pcb->local_port = tcp_new_port(pcb);
#else
pcb->local_port = tcp_new_port();
@@ -1292,7 +1292,7 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port,
/* Send a SYN together with the MSS option. */
ret = tcp_enqueue_flags(pcb, TCP_SYN);
if (ret == ERR_OK) {
-#if USE_LIBOS
+#if GAZELLE_ENABLE
vdev_reg_done(REG_RING_TCP_CONNECT, pcb);
#endif
@@ -1301,7 +1301,7 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port,
if (old_local_port != 0) {
TCP_RMV(&tcp_bound_pcbs, pcb);
}
-#if TCP_PCB_HASH
+#if GAZELLE_TCP_PCB_HASH
TCP_REG_ACTIVE_HASH(pcb);
#endif
TCP_REG_ACTIVE(pcb);
@@ -1519,7 +1519,7 @@ tcp_slowtmr_start:
if (prev != NULL) {
LWIP_ASSERT("tcp_slowtmr: middle tcp != tcp_active_pcbs", pcb != tcp_active_pcbs);
prev->next = pcb->next;
-#if USE_LIBOS
+#if GAZELLE_ENABLE
if (pcb->next)
pcb->next->prev = prev;
//dont set next NULL, it will be used below
@@ -1529,14 +1529,14 @@ tcp_slowtmr_start:
/* This PCB was the first. */
LWIP_ASSERT("tcp_slowtmr: first pcb == tcp_active_pcbs", tcp_active_pcbs == pcb);
tcp_active_pcbs = pcb->next;
-#if USE_LIBOS
+#if GAZELLE_ENABLE
if (pcb->next)
pcb->next->prev = NULL;
//dont set next NULL, it will be used below
pcb->prev = NULL;
#endif
}
-#if TCP_PCB_HASH
+#if GAZELLE_TCP_PCB_HASH
TCP_RMV_ACTIVE_HASH(pcb);
#endif
@@ -1549,7 +1549,7 @@ tcp_slowtmr_start:
last_state = pcb->state;
pcb2 = pcb;
pcb = pcb->next;
-#if USE_LIBOS
+#if GAZELLE_ENABLE
pcb2->next = NULL;
#endif
tcp_free(pcb2);
@@ -1603,7 +1603,7 @@ tcp_slowtmr_start:
if (prev != NULL) {
LWIP_ASSERT("tcp_slowtmr: middle tcp != tcp_tw_pcbs", pcb != tcp_tw_pcbs);
prev->next = pcb->next;
-#if USE_LIBOS
+#if GAZELLE_ENABLE
if (pcb->next)
pcb->next->prev = prev;
//dont set next NULL, it will be used below
@@ -1613,7 +1613,7 @@ tcp_slowtmr_start:
/* This PCB was the first. */
LWIP_ASSERT("tcp_slowtmr: first pcb == tcp_tw_pcbs", tcp_tw_pcbs == pcb);
tcp_tw_pcbs = pcb->next;
-#if USE_LIBOS
+#if GAZELLE_ENABLE
if (pcb->next)
pcb->next->prev = NULL;
//dont set next NULL, it will be used below
@@ -1622,7 +1622,7 @@ tcp_slowtmr_start:
}
pcb2 = pcb;
pcb = pcb->next;
-#if USE_LIBOS
+#if GAZELLE_ENABLE
pcb2->next = NULL;
#endif
tcp_free(pcb2);
@@ -1793,7 +1793,7 @@ tcp_seg_free(struct tcp_seg *seg)
seg->p = NULL;
#endif /* TCP_DEBUG */
}
-#if !USE_LIBOS
+#if !GAZELLE_ENABLE
memp_free(MEMP_TCP_SEG, seg);
#endif
}
@@ -1831,7 +1831,7 @@ tcp_seg_copy(struct tcp_seg *seg)
LWIP_ASSERT("tcp_seg_copy: invalid seg", seg != NULL);
-#if USE_LIBOS
+#if GAZELLE_ENABLE
cseg = (struct tcp_seg *)((uint8_t *)seg->p + sizeof(struct pbuf_custom));
#else
cseg = (struct tcp_seg *)memp_malloc(MEMP_TCP_SEG);
@@ -2377,7 +2377,7 @@ tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb)
#endif /* TCP_QUEUE_OOSEQ */
}
-#if USE_LIBOS
+#if GAZELLE_ENABLE
vdev_unreg_done(pcb);
release_port(pcb->local_port);
#endif
@@ -2389,13 +2389,13 @@ tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb)
LWIP_ASSERT("tcp_pcb_remove: tcp_pcbs_sane()", tcp_pcbs_sane());
}
-#if TCP_PCB_HASH
+#if GAZELLE_TCP_PCB_HASH
void
tcp_pcb_remove_hash(struct tcp_hash_table *htb, struct tcp_pcb *pcb)
{
TCP_RMV_HASH(htb, pcb);
}
-#endif /* TCP_PCB_HASH */
+#endif /* GAZELLE_TCP_PCB_HASH */
/**
* Calculates a new initial sequence number for new connections.
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 77dd235..7126eed 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -58,13 +58,13 @@
#if LWIP_ND6_TCP_REACHABILITY_HINTS
#include "lwip/nd6.h"
#endif /* LWIP_ND6_TCP_REACHABILITY_HINTS */
-#if USE_LIBOS
+#if GAZELLE_ENABLE
#include "lwip/api.h"
#endif
#include <string.h>
-#if USE_LIBOS && CHECKSUM_CHECK_TCP_HW
+#if GAZELLE_ENABLE && CHECKSUM_CHECK_TCP_HW
#include <dpdk_cksum.h>
#endif /* CHECKSUM_CHECK_TCP_HW */
@@ -134,7 +134,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
u8_t hdrlen_bytes;
err_t err;
-#if TCP_PCB_HASH
+#if GAZELLE_TCP_PCB_HASH
u32_t idx;
struct hlist_head *head;
struct hlist_node *node;
@@ -277,7 +277,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
for an active connection. */
prev = NULL;
-#if TCP_PCB_HASH
+#if GAZELLE_TCP_PCB_HASH
idx = TUPLE4_HASH_FN( ip_current_dest_addr()->addr, tcphdr->dest,
ip_current_src_addr()->addr, tcphdr->src) &
(tcp_active_htable->size - 1);
@@ -301,7 +301,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
pcb->local_port == tcphdr->dest &&
ip_addr_eq(&pcb->remote_ip, ip_current_src_addr()) &&
ip_addr_eq(&pcb->local_ip, ip_current_dest_addr())) {
-#if !TCP_PCB_HASH
+#if !GAZELLE_TCP_PCB_HASH
/* Move this PCB to the front of the list so that subsequent
lookups will be faster (we exploit locality in TCP segment
arrivals). */
@@ -317,7 +317,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
#endif
break;
}
-#if TCP_PCB_HASH
+#if GAZELLE_TCP_PCB_HASH
pcb = NULL;
#else
prev = pcb;
@@ -356,7 +356,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
}
}
-#if REUSE_IPPORT
+#if GAZELLE_TCP_REUSE_IPPORT
struct tcp_pcb_listen *min_cnts_lpcb = NULL;
#endif
/* Finally, if we still did not get a match, we check all PCBs that
@@ -382,7 +382,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
} else if (IP_ADDR_PCB_VERSION_MATCH_EXACT(lpcb, ip_current_dest_addr())) {
if (ip_addr_eq(&lpcb->local_ip, ip_current_dest_addr())) {
/* found an exact match */
-#if REUSE_IPPORT
+#if GAZELLE_TCP_REUSE_IPPORT
// check master fd
struct tcp_pcb_listen *tmp_lpcb = lpcb;
u8_t have_master_fd = 0;
@@ -395,7 +395,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
tmp_lpcb = lpcb;
min_cnts_lpcb = lpcb;
- u16_t min_conn_num = MAX_CONN_NUM_PER_THREAD;
+ u16_t min_conn_num = GAZELLE_TCP_MAX_CONN_PER_THREAD;
while (tmp_lpcb != NULL) {
if (!have_master_fd || tmp_lpcb->master_lpcb) {
if (tmp_lpcb->connect_num < min_conn_num) {
@@ -434,13 +434,13 @@ tcp_input(struct pbuf *p, struct netif *inp)
arrivals). */
if (prev != NULL) {
((struct tcp_pcb_listen *)prev)->next = lpcb->next;
-#if USE_LIBOS
+#if GAZELLE_ENABLE
if (lpcb->next)
lpcb->next->prev = (struct tcp_pcb_listen *)prev;
#endif
/* our successor is the remainder of the listening list */
lpcb->next = tcp_listen_pcbs.listen_pcbs;
-#if USE_LIBOS
+#if GAZELLE_ENABLE
lpcb->prev = NULL;
#endif
/* put this listening pcb at the head of the listening list */
@@ -455,7 +455,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
tcphdr_opt1len, tcphdr_opt2, p) == ERR_OK)
#endif
{
-#if REUSE_IPPORT
+#if GAZELLE_TCP_REUSE_IPPORT
tcp_listen_input(min_cnts_lpcb);
min_cnts_lpcb->connect_num++;
#else
@@ -528,7 +528,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
application that the connection is dead before we
deallocate the PCB. */
TCP_EVENT_ERR(pcb->state, pcb->errf, pcb->callback_arg, ERR_RST);
-#if TCP_PCB_HASH
+#if GAZELLE_TCP_PCB_HASH
tcp_pcb_remove_hash(tcp_active_htable, pcb);
#endif
tcp_pcb_remove(&tcp_active_pcbs, pcb);
@@ -710,7 +710,7 @@ tcp_input_delayed_close(struct tcp_pcb *pcb)
ensure the application doesn't continue using the PCB. */
TCP_EVENT_ERR(pcb->state, pcb->errf, pcb->callback_arg, ERR_CLSD);
}
-#if TCP_PCB_HASH
+#if GAZELLE_TCP_PCB_HASH
tcp_pcb_remove_hash(tcp_active_htable, pcb);
#endif
tcp_pcb_remove(&tcp_active_pcbs, pcb);
@@ -802,12 +802,12 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
npcb->netif_idx = pcb->netif_idx;
/* Register the new PCB so that we can begin receiving segments
for it. */
-#if TCP_PCB_HASH
+#if GAZELLE_TCP_PCB_HASH
TCP_REG_ACTIVE_HASH(npcb);
#endif
TCP_REG_ACTIVE(npcb);
-#if USE_LIBOS
+#if GAZELLE_ENABLE
vdev_reg_done(REG_RING_TCP_CONNECT, npcb);
#endif
@@ -1105,7 +1105,7 @@ tcp_process(struct tcp_pcb *pcb)
if (recv_flags & TF_GOT_FIN) {
tcp_ack_now(pcb);
pcb->state = CLOSE_WAIT;
-#if USE_LIBOS
+#if GAZELLE_ENABLE
API_EVENT(((struct netconn *)pcb->callback_arg), NETCONN_EVT_ERROR, 0);
#endif
}
@@ -1123,7 +1123,7 @@ tcp_process(struct tcp_pcb *pcb)
if (recv_flags & TF_GOT_FIN) { /* passive close */
tcp_ack_now(pcb);
pcb->state = CLOSE_WAIT;
-#if USE_LIBOS
+#if GAZELLE_ENABLE
API_EVENT(((struct netconn *)pcb->callback_arg), NETCONN_EVT_ERROR, 0);
#endif
}
@@ -1137,7 +1137,7 @@ tcp_process(struct tcp_pcb *pcb)
("TCP connection closed: FIN_WAIT_1 %"U16_F" -> %"U16_F".\n", inseg.tcphdr->src, inseg.tcphdr->dest));
tcp_ack_now(pcb);
tcp_pcb_purge(pcb);
-#if TCP_PCB_HASH
+#if GAZELLE_TCP_PCB_HASH
TCP_RMV_ACTIVE_HASH(pcb);
#endif
TCP_RMV_ACTIVE(pcb);
@@ -1158,7 +1158,7 @@ tcp_process(struct tcp_pcb *pcb)
LWIP_DEBUGF(TCP_DEBUG, ("TCP connection closed: FIN_WAIT_2 %"U16_F" -> %"U16_F".\n", inseg.tcphdr->src, inseg.tcphdr->dest));
tcp_ack_now(pcb);
tcp_pcb_purge(pcb);
-#if TCP_PCB_HASH
+#if GAZELLE_TCP_PCB_HASH
TCP_RMV_ACTIVE_HASH(pcb);
#endif
TCP_RMV_ACTIVE(pcb);
@@ -1171,7 +1171,7 @@ tcp_process(struct tcp_pcb *pcb)
if ((flags & TCP_ACK) && ackno == pcb->snd_nxt && pcb->unsent == NULL) {
LWIP_DEBUGF(TCP_DEBUG, ("TCP connection closed: CLOSING %"U16_F" -> %"U16_F".\n", inseg.tcphdr->src, inseg.tcphdr->dest));
tcp_pcb_purge(pcb);
-#if TCP_PCB_HASH
+#if GAZELLE_TCP_PCB_HASH
TCP_RMV_ACTIVE_HASH(pcb);
#endif
TCP_RMV_ACTIVE(pcb);
@@ -1749,7 +1749,7 @@ tcp_receive(struct tcp_pcb *pcb)
recv_flags |= TF_GOT_FIN;
if (pcb->state == ESTABLISHED) { /* force passive close or we can move to active close */
pcb->state = CLOSE_WAIT;
-#if USE_LIBOS
+#if GAZELLE_ENABLE
API_EVENT(((struct netconn *)pcb->callback_arg), NETCONN_EVT_ERROR, 0);
#endif
}
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index eafa5a6..240148b 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -80,7 +80,7 @@
#include <string.h>
-#if USE_LIBOS
+#if GAZELLE_ENABLE
#include "lwipsock.h"
#include <rte_prefetch.h>
#if CHECKSUM_GEN_TCP_HW
@@ -165,7 +165,7 @@ tcp_route(const struct tcp_pcb *pcb, const ip_addr_t *src, const ip_addr_t *dst)
* The TCP header is filled in except ackno and wnd.
* p is freed on failure.
*/
-#if USE_LIBOS
+#if GAZELLE_ENABLE
void tcp_init_segment(struct tcp_seg *seg, const struct tcp_pcb *pcb, struct pbuf *p, u8_t hdrflags,
u32_t seqno, u8_t optflags)
{
@@ -518,7 +518,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
* pos records progress as data is segmented.
*/
-#if !USE_LIBOS
+#if !GAZELLE_ENABLE
/* Find the tail of the unsent queue. */
if (pcb->unsent != NULL) {
u16_t space;
@@ -634,9 +634,9 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
pcb->unsent_oversize == 0);
#endif /* TCP_OVERSIZE */
}
-#else /* USE_LIBOS */
+#else /* GAZELLE_ENABLE */
last_unsent = pcb->last_unsent;
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
/*
* Phase 3: Create new segments.
@@ -654,7 +654,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
u8_t chksum_swapped = 0;
#endif /* TCP_CHECKSUM_ON_COPY */
-#if !USE_LIBOS
+#if !GAZELLE_ENABLE
if (apiflags & TCP_WRITE_FLAG_COPY) {
/* If copy is set, memory should be allocated and data copied
* into pbuf */
@@ -701,13 +701,13 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
/* Concatenate the headers and data pbufs together. */
pbuf_cat(p/*header*/, p2/*data*/);
}
-#else /* USE_LIBOS */
+#else /* GAZELLE_ENABLE */
p = write_lwip_data((struct lwip_sock *)arg, len - pos, &apiflags);
if (p == NULL) {
break;
}
seglen = p->tot_len;
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
queuelen += pbuf_clen(p);
@@ -717,7 +717,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
if (queuelen > LWIP_MIN(TCP_SND_QUEUELEN, TCP_SNDQUEUELEN_OVERFLOW)) {
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("tcp_write: queue too long %"U16_F" (%d)\n",
queuelen, (int)TCP_SND_QUEUELEN));
-#if USE_LIBOS
+#if GAZELLE_ENABLE
if (pos > 0) {
queuelen -= pbuf_clen(p);
break;
@@ -729,7 +729,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
}
if ((seg = tcp_create_segment(pcb, p, 0, pcb->snd_lbb + pos, optflags)) == NULL) {
-#if USE_LIBOS
+#if GAZELLE_ENABLE
if (pos > 0) {
queuelen -= pbuf_clen(p);
break;
@@ -762,7 +762,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
lwip_ntohl(seg->tcphdr->seqno) + TCP_TCPLEN(seg)));
pos += seglen;
-#if USE_LIBOS
+#if GAZELLE_ENABLE
write_lwip_over((struct lwip_sock*)arg);
#endif
}
@@ -850,7 +850,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
/*
* Finally update the pcb state.
*/
-#if USE_LIBOS
+#if GAZELLE_ENABLE
if (queue) {
pcb->last_unsent = prev_seg;
}
@@ -879,7 +879,7 @@ memerr:
tcp_set_flags(pcb, TF_NAGLEMEMERR);
TCP_STATS_INC(tcp.memerr);
-#if !USE_LIBOS
+#if !GAZELLE_ENABLE
if (concat_p != NULL) {
pbuf_free(concat_p);
}
@@ -1310,7 +1310,7 @@ tcp_build_wnd_scale_option(u32_t *opts)
}
#endif
-#if USE_LIBOS
+#if GAZELLE_ENABLE
static struct tcp_seg *tcp_output_over(struct tcp_pcb *pcb, struct tcp_seg *seg, struct tcp_seg *useg)
{
if (TCP_TCPLEN(seg) > 0) {
@@ -1475,7 +1475,7 @@ tcp_output(struct tcp_pcb *pcb)
/* data available and window allows it to be sent? */
u32_t send_len = 0;
-#if USE_LIBOS
+#if GAZELLE_ENABLE
if ((get_eth_params_tx_ol() & DEV_TX_OFFLOAD_TCP_TSO) && pcb->need_tso_send) {
while(seg && send_len < 0xffff) {
/**
@@ -1488,7 +1488,7 @@ tcp_output(struct tcp_pcb *pcb)
struct pbuf *pre_pbuf = NULL;
u8_t pbuf_chain_len = 0;
u32_t next_seqno = lwip_ntohl(seg->tcphdr->seqno);
- while (seg != NULL && pbuf_chain_len < MAX_PBUF_CHAIN_LEN) {
+ while (seg != NULL && pbuf_chain_len < GAZELLE_TCP_MAX_PBUF_CHAIN_LEN) {
u32_t seg_seqno = lwip_ntohl(seg->tcphdr->seqno);
if (seg_seqno - pcb->lastack + seg->len > wnd) {
if (first_pbuf)
@@ -1504,7 +1504,7 @@ tcp_output(struct tcp_pcb *pcb)
goto output_done;
}
- if (seg->len < TCP_MSS || next_seqno != seg_seqno || pbuf_chain_len >= MAX_PBUF_CHAIN_LEN) {
+ if (seg->len < TCP_MSS || next_seqno != seg_seqno || pbuf_chain_len >= GAZELLE_TCP_MAX_PBUF_CHAIN_LEN) {
break;
}
if (first_pbuf == NULL && (seg->next == NULL || seg->next->len < TCP_MSS)) {
@@ -1774,7 +1774,7 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
}
#endif
-#if USE_LIBOS
+#if GAZELLE_ENABLE
/* pbuf into mbuf. ref dpdk_common.h */
rte_prefetch0((uint8_t *)(seg->p) - sizeof(struct rte_mbuf) - sizeof(uint64_t) * 2);
#endif
diff --git a/src/core/timeouts.c b/src/core/timeouts.c
index 477369f..610a2d7 100644
--- a/src/core/timeouts.c
+++ b/src/core/timeouts.c
@@ -442,7 +442,7 @@ sys_timeouts_sleeptime(void)
}
}
-#if USE_LIBOS
+#if GAZELLE_ENABLE
void sys_timer_run(void)
{
u32_t sleeptime;
@@ -452,7 +452,7 @@ void sys_timer_run(void)
sys_check_timeouts();
}
}
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
#else /* LWIP_TIMERS && !LWIP_TIMERS_CUSTOM */
/* Satisfy the TCP code which calls this function */
diff --git a/src/include/arch/sys_arch.h b/src/include/arch/sys_arch.h
index fc4a9fd..04e3192 100644
--- a/src/include/arch/sys_arch.h
+++ b/src/include/arch/sys_arch.h
@@ -76,7 +76,7 @@ int sys_mbox_empty(struct sys_mbox *);
struct sys_thread;
typedef struct sys_thread *sys_thread_t;
-#if USE_LIBOS
+#if GAZELLE_ENABLE
extern int eth_dev_poll(void);
#include <rte_ring.h>
diff --git a/src/include/dpdk_cksum.h b/src/include/dpdk_cksum.h
index 83c9c38..df2e2a5 100644
--- a/src/include/dpdk_cksum.h
+++ b/src/include/dpdk_cksum.h
@@ -34,7 +34,7 @@
#define __DPDK_CKSUM_H__
#include "lwipopts.h"
-#if USE_LIBOS
+#if GAZELLE_ENABLE
#include <rte_ethdev.h>
#if CHECKSUM_OFFLOAD_ALL
@@ -103,5 +103,5 @@ static inline u16_t ip_chksum_pseudo_offload(u8_t proto, u16_t proto_len,
}
#endif /* CHECKSUM_GEN_TCP_HW */
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
#endif /* __DPDK_CKSUM_H__ */
diff --git a/src/include/hlist.h b/src/include/hlist.h
index 7059488..988b017 100644
--- a/src/include/hlist.h
+++ b/src/include/hlist.h
@@ -35,7 +35,7 @@
#include "list.h"
-//#if TCP_PCB_HASH
+//#if GAZELLE_TCP_PCB_HASH
struct hlist_node {
/**
* @pprev: point the previous node's next pointer
@@ -228,6 +228,6 @@ static inline void hlist_ctl_add_after(struct hlist_node *n, struct hlist_node *
ctl->tail.end = next;
}
}
-//#endif /* TCP_PCB_HASH */
+//#endif /* GAZELLE_TCP_PCB_HASH */
#endif /* __HLIST_H__ */
diff --git a/src/include/lwip/api.h b/src/include/lwip/api.h
index d12312c..6bf8b6a 100644
--- a/src/include/lwip/api.h
+++ b/src/include/lwip/api.h
@@ -141,16 +141,16 @@ enum netconn_type {
, NETCONN_RAW_IPV6 = NETCONN_RAW | NETCONN_TYPE_IPV6 /* 0x48 */
#endif /* LWIP_IPV6 */
-#if USE_LIBOS
+#if GAZELLE_ENABLE
/*here must bigger than 0xff, because (type & 0xff) is for lwip inner use*/
, NETCONN_LIBOS = 0x100
, NETCONN_HOST = 0x200
, NETCONN_INPRG = 0x400
, NETCONN_STACK = NETCONN_LIBOS | NETCONN_HOST | NETCONN_INPRG
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
};
-#ifdef USE_LIBOS
+#ifdef GAZELLE_ENABLE
#define SET_CONN_TYPE_LIBOS_OR_HOST(conn) do { \
conn->type &= ~(NETCONN_STACK); \
conn->type |= (NETCONN_LIBOS | NETCONN_HOST); } while (0)
@@ -175,7 +175,7 @@ enum netconn_type {
#define CONN_TYPE_HAS_LIBOS_AND_HOST(conn) (0)
#define CONN_TYPE_HAS_LIBOS(conn) (0)
#define CONN_TYPE_HAS_HOST(conn) (0)
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
/** Current state of the netconn. Non-TCP netconns are always
* in state NETCONN_NONE! */
@@ -319,7 +319,7 @@ struct netconn {
/** A callback function that is informed about events for this netconn */
netconn_callback callback;
-#if REUSE_IPPORT
+#if GAZELLE_TCP_REUSE_IPPORT
u8_t is_master_fd;
#endif
};
diff --git a/src/include/lwip/ip.h b/src/include/lwip/ip.h
index ef11160..b6ab031 100644
--- a/src/include/lwip/ip.h
+++ b/src/include/lwip/ip.h
@@ -108,7 +108,7 @@ struct ip_pcb {
/*
* Option flags per-socket. These are the same like SO_XXX in sockets.h
*/
-#if USE_LIBOS
+#if GAZELLE_ENABLE
#define SOF_REUSEADDR 0x02U /* allow local address reuse */
#define SOF_KEEPALIVE 0x09U /* keep connections alive */
#define SOF_BROADCAST 0x06U /* permit to send and to receive broadcast messages (see IP_SOF_BROADCAST option) */
@@ -116,7 +116,7 @@ struct ip_pcb {
#define SOF_REUSEADDR 0x04U /* allow local address reuse */
#define SOF_KEEPALIVE 0x08U /* keep connections alive */
#define SOF_BROADCAST 0x20U /* permit to send and to receive broadcast messages (see IP_SOF_BROADCAST option) */
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
/* These flags are inherited (e.g. from a listen-pcb to a connection-pcb): */
#define SOF_INHERITED (SOF_REUSEADDR|SOF_KEEPALIVE)
diff --git a/src/include/lwip/memp.h b/src/include/lwip/memp.h
index 64d8f31..1763836 100644
--- a/src/include/lwip/memp.h
+++ b/src/include/lwip/memp.h
@@ -58,11 +58,11 @@ typedef enum {
#include "lwip/priv/memp_priv.h"
#include "lwip/stats.h"
-#if USE_LIBOS
+#if GAZELLE_ENABLE
extern PER_THREAD struct memp_desc* memp_pools[MEMP_MAX];
#else
extern const struct memp_desc* const memp_pools[MEMP_MAX];
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
/**
* @ingroup mempool
@@ -96,7 +96,7 @@ extern const struct memp_desc* const memp_pools[MEMP_MAX];
* To relocate a pool, declare it as extern in cc.h. Example for GCC:
* extern u8_t \_\_attribute\_\_((section(".onchip_mem"))) memp_memory_my_private_pool_base[];
*/
-#if USE_LIBOS
+#if GAZELLE_ENABLE
#define LWIP_MEMPOOL_DECLARE(name,num,size,desc) \
PER_THREAD struct memp_desc memp_ ## name = {0}; \
PER_THREAD char memp_desc_ ## name[] = desc; \
@@ -106,7 +106,7 @@ extern const struct memp_desc* const memp_pools[MEMP_MAX];
PER_THREAD struct memp *memp_tab_ ## name = NULL; \
LWIP_DECLARE_MEMP_BASE_ALIGNED(name, ((num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size))));
-#else /* USE_LIBOS */
+#else /* GAZELLE_ENABLE */
#define LWIP_MEMPOOL_DECLARE(name,num,size,desc) \
LWIP_DECLARE_MEMORY_ALIGNED(memp_memory_ ## name ## _base, ((num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size)))); \
@@ -124,7 +124,7 @@ extern const struct memp_desc* const memp_pools[MEMP_MAX];
&memp_tab_ ## name \
};
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
#endif /* MEMP_MEM_MALLOC */
/**
diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h
index 1d97816..527f2d7 100644
--- a/src/include/lwip/opt.h
+++ b/src/include/lwip/opt.h
@@ -3594,7 +3594,7 @@
/**
* EPOLL_DEBUG: Enable debugging in epoll.c.
*/
-#if !defined EPOLL_DEBUG || defined __DOXYGEN__ && USE_LIBOS
+#if !defined EPOLL_DEBUG || defined __DOXYGEN__ && GAZELLE_ENABLE
#define EPOLL_DEBUG LWIP_DBG_OFF
#endif
/**
@@ -3604,7 +3604,7 @@
/**
* ETHDEV_DEBUG: Enable debugging in ethdev.c.
*/
-#if !defined ETHDEV_DEBUG || defined __DOXYGEN__ && USE_LIBOS
+#if !defined ETHDEV_DEBUG || defined __DOXYGEN__ && GAZELLE_ENABLE
#define ETHDEV_DEBUG LWIP_DBG_OFF
#endif
/**
@@ -3614,7 +3614,7 @@
/**
* ETHDEV_DEBUG: Enable debugging in ethdev.c.
*/
-#if !defined SYSCALL_DEBUG || defined __DOXYGEN__ && USE_LIBOS
+#if !defined SYSCALL_DEBUG || defined __DOXYGEN__ && GAZELLE_ENABLE
#define SYSCALL_DEBUG LWIP_DBG_OFF
#endif
/**
@@ -3624,7 +3624,7 @@
/**
* CONTROL_DEBUG: Enable debugging in control_plane.c.
*/
-#if !defined CONTROL_DEBUG || defined __DOXYGEN__ && USE_LIBOS
+#if !defined CONTROL_DEBUG || defined __DOXYGEN__ && GAZELLE_ENABLE
#define CONTROL_DEBUG LWIP_DBG_ON
#endif
/**
diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h
index f817126..168250e 100644
--- a/src/include/lwip/pbuf.h
+++ b/src/include/lwip/pbuf.h
@@ -220,7 +220,7 @@ struct pbuf {
/** For incoming packets, this contains the input netif's index */
u8_t if_idx;
-#if USE_LIBOS && CHECKSUM_OFFLOAD_ALL
+#if GAZELLE_ENABLE && CHECKSUM_OFFLOAD_ALL
/** checksum offload ol_flags */
u64_t ol_flags;
/* < L2 (MAC) Header Length for non-tunneling pkt. */
@@ -234,7 +234,7 @@ struct pbuf {
u8_t in_write;
u8_t head;
struct pbuf *last;
-#endif /* USE_LIBOS CHECKSUM_OFFLOAD_SWITCH */
+#endif /* GAZELLE_ENABLE CHECKSUM_OFFLOAD_SWITCH */
/** In case the user needs to store data custom data on a pbuf */
LWIP_PBUF_CUSTOM_DATA
@@ -287,7 +287,7 @@ void pbuf_free_ooseq(void);
/* Initializes the pbuf module. This call is empty for now, but may not be in future. */
#define pbuf_init()
-#if USE_LIBOS
+#if GAZELLE_ENABLE
struct pbuf *lwip_alloc_pbuf(pbuf_layer layer, uint16_t length, pbuf_type type);
#endif
struct pbuf *pbuf_alloc(pbuf_layer l, u16_t length, pbuf_type type);
diff --git a/src/include/lwip/priv/memp_std.h b/src/include/lwip/priv/memp_std.h
index 395ac0c..66d7e4e 100644
--- a/src/include/lwip/priv/memp_std.h
+++ b/src/include/lwip/priv/memp_std.h
@@ -122,13 +122,13 @@ LWIP_MEMPOOL(MLD6_GROUP, MEMP_NUM_MLD6_GROUP, sizeof(struct mld_group),
#endif /* LWIP_IPV6 && LWIP_IPV6_MLD */
-#if USE_LIBOS
+#if GAZELLE_ENABLE
#if !LWIP_NETCONN_SEM_PER_THREAD
LWIP_MEMPOOL(SYS_SEM, MEMP_NUM_SYS_SEM, sizeof(struct sys_sem), "SYS_SEM")
#endif
LWIP_MEMPOOL(SYS_MBOX, MEMP_NUM_SYS_MBOX, sizeof(struct sys_mbox), "SYS_MBOX")
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
/*
* A list of pools of pbuf's used by LWIP.
*
diff --git a/src/include/lwip/priv/tcp_priv.h b/src/include/lwip/priv/tcp_priv.h
index 02481da..537683f 100644
--- a/src/include/lwip/priv/tcp_priv.h
+++ b/src/include/lwip/priv/tcp_priv.h
@@ -340,7 +340,7 @@ extern PER_THREAD struct tcp_pcb *tcp_tw_pcbs; /* List of all TCP PCBs in T
#define NUM_TCP_PCB_LISTS 4
extern PER_THREAD struct tcp_pcb ** tcp_pcb_lists[NUM_TCP_PCB_LISTS];
-#if USE_LIBOS
+#if GAZELLE_ENABLE
#include "reg_sock.h"
static inline int vdev_reg_done(enum reg_ring_type reg_type, const struct tcp_pcb *pcb)
{
@@ -353,7 +353,7 @@ static inline int vdev_reg_done(enum reg_ring_type reg_type, const struct tcp_pc
qtuple.dst_ip = pcb->remote_ip.addr;
qtuple.dst_port = lwip_htons(pcb->remote_port);
-#if REUSE_IPPORT
+#if GAZELLE_TCP_REUSE_IPPORT
if (reg_type == REG_RING_TCP_CONNECT_CLOSE) {
struct tcp_pcb_listen* lpcb = pcb->listener;
if (lpcb != NULL) {
@@ -389,7 +389,7 @@ static inline void vdev_unreg_done(const struct tcp_pcb *pcb)
#define TCP_DEBUG_PCB_LISTS 0
#endif
#if TCP_DEBUG_PCB_LISTS
-#if USE_LIBOS
+#if GAZELLE_ENABLE
#define TCP_REG(pcbs, npcb) do {\
struct tcp_pcb *tcp_tmp_pcb; \
LWIP_DEBUGF(TCP_DEBUG, ("TCP_REG %p local port %d\n", (npcb), (npcb)->local_port)); \
@@ -432,7 +432,7 @@ static inline void vdev_unreg_done(const struct tcp_pcb *pcb)
LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removed %p from %p\n", (npcb), *(pcbs))); \
} while(0)
-#else /* USE_LIBOS */
+#else /* GAZELLE_ENABLE */
#define TCP_REG(pcbs, npcb) do {\
struct tcp_pcb *tcp_tmp_pcb; \
LWIP_DEBUGF(TCP_DEBUG, ("TCP_REG %p local port %"U16_F"\n", (void *)(npcb), (npcb)->local_port)); \
@@ -465,10 +465,10 @@ static inline void vdev_unreg_done(const struct tcp_pcb *pcb)
LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removed %p from %p\n", (void *)(npcb), (void *)(*(pcbs)))); \
} while(0)
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
#else /* LWIP_DEBUG */
-#if TCP_PCB_HASH
+#if GAZELLE_TCP_PCB_HASH
#define TCP_REG_HASH(pcbs, npcb) \
do { \
u32_t idx; \
@@ -496,9 +496,9 @@ static inline void vdev_unreg_done(const struct tcp_pcb *pcb)
do { \
hlist_del_init(&(npcb)->tcp_node); \
} while (0)
-#endif /* TCP_PCB_HASH */
+#endif /* GAZELLE_TCP_PCB_HASH */
-#if USE_LIBOS
+#if GAZELLE_ENABLE
#define TCP_REG(pcbs, npcb) \
do { \
if (*pcbs) \
@@ -529,7 +529,7 @@ static inline void vdev_unreg_done(const struct tcp_pcb *pcb)
(npcb)->next = NULL; \
} while(0)
-#else /* USE_LIBOS */
+#else /* GAZELLE_ENABLE */
#define TCP_REG(pcbs, npcb) \
do { \
(npcb)->next = *pcbs; \
@@ -556,11 +556,11 @@ static inline void vdev_unreg_done(const struct tcp_pcb *pcb)
(npcb)->next = NULL; \
} while(0)
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
#endif /* LWIP_DEBUG */
-#if TCP_PCB_HASH
+#if GAZELLE_TCP_PCB_HASH
#define TCP_REG_ACTIVE_HASH(npcb) \
do { \
TCP_REG_HASH(tcp_active_htable, npcb); \
@@ -580,7 +580,7 @@ static inline void vdev_unreg_done(const struct tcp_pcb *pcb)
} while (0)
void tcp_pcb_remove_hash(struct tcp_hash_table *htb, struct tcp_pcb *pcb);
-#endif /* TCP_PCB_HASH */
+#endif /* GAZELLE_TCP_PCB_HASH */
#define TCP_REG_ACTIVE(npcb) \
do { \
diff --git a/src/include/lwip/sockets.h b/src/include/lwip/sockets.h
index ca5bf6e..8e41155 100644
--- a/src/include/lwip/sockets.h
+++ b/src/include/lwip/sockets.h
@@ -64,7 +64,7 @@ extern "C" {
/* If your port already typedef's sa_family_t, define SA_FAMILY_T_DEFINED
to prevent this code from redefining it. */
-#if USE_LIBOS
+#if GAZELLE_ENABLE
#define SA_FAMILY_T_DEFINED
typedef u16_t sa_family_t;
#endif
@@ -81,7 +81,7 @@ typedef u16_t in_port_t;
#if LWIP_IPV4
/* members are in network byte order */
struct sockaddr_in {
-#if !USE_LIBOS
+#if !GAZELLE_ENABLE
u8_t sin_len;
#endif
sa_family_t sin_family;
@@ -104,7 +104,7 @@ struct sockaddr_in6 {
#endif /* LWIP_IPV6 */
struct sockaddr {
-#if !USE_LIBOS
+#if !GAZELLE_ENABLE
u8_t sa_len;
#endif
sa_family_t sa_family;
@@ -207,7 +207,7 @@ struct ifreq {
#define SOCK_DGRAM 2
#define SOCK_RAW 3
-#if USE_LIBOS
+#if GAZELLE_ENABLE
#include <asm/socket.h>
#else
/*
@@ -245,7 +245,7 @@ struct ifreq {
* Level number for (get/set)sockopt() to apply to socket itself.
*/
#define SOL_SOCKET 0xfff /* options for socket level */
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
/*
* Structure used for manipulating linger option.
@@ -298,20 +298,20 @@ struct linger {
/*
* Options for level IPPROTO_TCP
*/
-#if USE_LIBOS
+#if GAZELLE_ENABLE
/* come from netinet/tcp.h */
#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */
#define TCP_KEEPALIVE 0x24 /* send KEEPALIVE probes when idle for pcb->keep_idle milliseconds */
#define TCP_KEEPIDLE 0x04 /* set pcb->keep_idle - Same as TCP_KEEPALIVE, but use seconds for get/setsockopt */
#define TCP_KEEPINTVL 0x05 /* set pcb->keep_intvl - Use seconds for get/setsockopt */
#define TCP_KEEPCNT 0x06 /* set pcb->keep_cnt - Use number of probes sent for get/setsockopt */
-#else /* USE_LIBOS */
+#else /* GAZELLE_ENABLE */
#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */
#define TCP_KEEPALIVE 0x02 /* send KEEPALIVE probes when idle for pcb->keep_idle milliseconds */
#define TCP_KEEPIDLE 0x03 /* set pcb->keep_idle - Same as TCP_KEEPALIVE, but use seconds for get/setsockopt */
#define TCP_KEEPINTVL 0x04 /* set pcb->keep_intvl - Use seconds for get/setsockopt */
#define TCP_KEEPCNT 0x05 /* set pcb->keep_cnt - Use number of probes sent for get/setsockopt */
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
#endif /* LWIP_TCP */
#if LWIP_IPV6
@@ -514,13 +514,13 @@ typedef struct fd_set
unsigned char fd_bits [(FD_SETSIZE+7)/8];
} fd_set;
-#elif FD_SETSIZE < (LWIP_SOCKET_OFFSET + MEMP_NUM_NETCONN) && !USE_LIBOS
+#elif FD_SETSIZE < (LWIP_SOCKET_OFFSET + MEMP_NUM_NETCONN) && !GAZELLE_ENABLE
#error "external FD_SETSIZE too small for number of sockets"
#else
#define LWIP_SELECT_MAXNFDS FD_SETSIZE
#endif /* FD_SET */
-#if USE_LIBOS
+#if GAZELLE_ENABLE
#if !defined(POLLIN) && !defined(POLLOUT)
/* come from bits/poll.h */
#define POLLIN 0x001
@@ -535,7 +535,7 @@ typedef struct fd_set
#define POLLWRBAND 0x200
#define POLLHUP 0x010
#endif
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
#if LWIP_SOCKET_POLL
/* poll-related defines and types */
@@ -683,13 +683,13 @@ int lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptse
int lwip_poll(struct pollfd *fds, nfds_t nfds, int timeout);
#endif
-#if USE_LIBOS
+#if GAZELLE_ENABLE
int lwip_ioctl(int s, long cmd, ...);
int lwip_fcntl(int s, int cmd, int val);
#else
int lwip_ioctl(int s, long cmd, void *argp);
int lwip_fcntl(int s, int cmd, int val);
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
const char *lwip_inet_ntop(int af, const void *src, char *dst, socklen_t size);
int lwip_inet_pton(int af, const char *src, void *dst);
@@ -759,7 +759,7 @@ int lwip_inet_pton(int af, const char *src, void *dst);
/** @ingroup socket */
#define close(s) lwip_close(s)
-#if USE_LIBOS
+#if GAZELLE_ENABLE
#define fcntl(s,cmd...) lwip_fcntl(s,cmd)
#define ioctl(s,cmd...) lwip_ioctl(s,cmd)
#else
@@ -767,7 +767,7 @@ int lwip_inet_pton(int af, const char *src, void *dst);
#define fcntl(s,cmd,val) lwip_fcntl(s,cmd,val)
/** @ingroup socket */
#define ioctl(s,cmd,argp) lwip_ioctl(s,cmd,argp)
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
#endif /* LWIP_POSIX_SOCKETS_IO_NAMES */
#endif /* LWIP_COMPAT_SOCKETS != 2 */
diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
index 53ebd24..edfdb68 100644
--- a/src/include/lwip/tcp.h
+++ b/src/include/lwip/tcp.h
@@ -51,7 +51,7 @@
#include "lwip/ip6.h"
#include "lwip/ip6_addr.h"
-#if TCP_PCB_HASH
+#if GAZELLE_TCP_PCB_HASH
#include "lwip/sys.h"
#include "hlist.h"
#endif
@@ -214,7 +214,7 @@ typedef u16_t tcpflags_t;
/**
* members common to struct tcp_pcb and struct tcp_listen_pcb
*/
-#if USE_LIBOS
+#if GAZELLE_ENABLE
#define TCP_PCB_COMMON(type) \
type *next; /* for the linked list */ \
type *prev; /* for the linked list */ \
@@ -225,7 +225,7 @@ typedef u16_t tcpflags_t;
/* ports are in host byte order */ \
u16_t local_port
-#else /* USE_LIBOS */
+#else /* GAZELLE_ENABLE */
#define TCP_PCB_COMMON(type) \
type *next; /* for the linked list */ \
void *callback_arg; \
@@ -234,7 +234,7 @@ typedef u16_t tcpflags_t;
u8_t prio; \
/* ports are in host byte order */ \
u16_t local_port
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
/** the TCP protocol control block for listening pcbs */
struct tcp_pcb_listen {
@@ -253,7 +253,7 @@ struct tcp_pcb_listen {
u8_t accepts_pending;
#endif /* TCP_LISTEN_BACKLOG */
-#if REUSE_IPPORT
+#if GAZELLE_TCP_REUSE_IPPORT
struct tcp_pcb_listen* next_same_port_pcb;
u16_t connect_num;
int socket_fd;
@@ -269,7 +269,7 @@ struct tcp_pcb {
IP_PCB;
/** protocol specific PCB members */
TCP_PCB_COMMON(struct tcp_pcb);
-#if TCP_PCB_HASH
+#if GAZELLE_TCP_PCB_HASH
struct hlist_node tcp_node;
#endif
@@ -420,7 +420,7 @@ struct tcp_pcb {
u8_t need_tso_send;
};
-#if TCP_PCB_HASH
+#if GAZELLE_TCP_PCB_HASH
#define TCP_HTABLE_SIZE MEMP_NUM_NETCONN*12
struct tcp_hashbucket
@@ -470,7 +470,7 @@ static inline unsigned int jhash_3words(unsigned int a, unsigned int b, unsigned
#define tcppcb_hlist_for_each(tcppcb, node, list) \
hlist_for_each_entry(tcppcb, node, list, tcp_node)
-#endif /* TCP_PCB_HASH */
+#endif /* GAZELLE_TCP_PCB_HASH */
#if LWIP_EVENT_API
diff --git a/src/include/lwip/timeouts.h b/src/include/lwip/timeouts.h
index b451554..f7ffc5e 100644
--- a/src/include/lwip/timeouts.h
+++ b/src/include/lwip/timeouts.h
@@ -119,9 +119,9 @@ struct sys_timeo** sys_timeouts_get_next_timeout(void);
void lwip_cyclic_timer(void *arg);
#endif
-#if USE_LIBOS
+#if GAZELLE_ENABLE
void sys_timer_run(void);
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
#endif /* LWIP_TIMERS */
diff --git a/src/include/lwiplog.h b/src/include/lwiplog.h
index 011ed21..f278ff4 100644
--- a/src/include/lwiplog.h
+++ b/src/include/lwiplog.h
@@ -41,7 +41,7 @@
#include "lwipopts.h"
-#if USE_DPDK_LOG
+#if GAZELLE_USE_DPDK_LOG
#define LWIP_LOG_WARN LWIP_DBG_LEVEL_WARNING
#define LWIP_LOG_ERROR LWIP_DBG_LEVEL_SERIOUS
@@ -75,6 +75,6 @@ do { LWIP_PLATFORM_LOG(LWIP_LOG_FATAL, "Assertion \"%s\" failed at line %d in %s
#define LWIP_PLATFORM_LOG(debug, message)
-#endif /* USE_DPDK_LOG */
+#endif /* GAZELLE_USE_DPDK_LOG */
#endif /* __LWIPLOG_H__ */
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index f8b3294..326edc1 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -33,180 +33,196 @@
#ifndef __LWIPOPTS_H__
#define __LWIPOPTS_H__
-#define LWIP_TCPIP_CORE_LOCKING 1
+/*
+ -------------------------------------
+ ---------- gazelle options ----------
+ -------------------------------------
+*/
+#define LWIP_PERF 1
+#define LWIP_RECORD_PERF 0
-#define LWIP_NETCONN_SEM_PER_THREAD 0
+//#define LWIP_DEBUG 1
+#define GAZELLE_USE_DPDK_LOG 1
-#define LWIP_TCP 1
+#define GAZELLE_ENABLE 1
+#define PER_THREAD __thread
-#define LWIP_SO_SENTIMEO 0
+#define FRAME_MTU 1500
-#define LIP_SO_LINGER 0
+#define GAZELLE_TCP_PCB_HASH 1
-#define MEMP_USE_CUSTOM_POOLS 0
-#define MEM_USE_POOLS 0
+#define GAZELLE_TCP_MAX_DATA_ACK_NUM 256
+#define GAZELLE_TCP_MAX_PBUF_CHAIN_LEN 40
-#define PER_TCP_PCB_BUFFER (16 * 128)
+/*
+ ----------------------------------
+ ---------- NIC offloads ----------
+ ----------------------------------
+*/
+#define LWIP_CHECKSUM_CTRL_PER_NETIF 1 /* checksum ability check before checksum*/
-#define MAX_CLIENTS (20000)
+// rx cksum
+#define CHECKSUM_CHECK_IP 1 /* master switch */
+#define CHECKSUM_CHECK_TCP 1 /* master switch */
+// tx cksum
+#define CHECKSUM_GEN_IP 1 /* master switch */
+#define CHECKSUM_GEN_TCP 1 /* master switch */
-#define RESERVED_CLIENTS (2000)
+// rx offload cksum
+#define CHECKSUM_CHECK_IP_HW (1 && CHECKSUM_CHECK_IP) /* hardware switch */
+#define CHECKSUM_CHECK_TCP_HW (1 && CHECKSUM_CHECK_TCP) /* hardware switch */
+// tx offload cksum
+#define CHECKSUM_GEN_IP_HW (1 && CHECKSUM_GEN_IP) /* hardware switch */
+#define CHECKSUM_GEN_TCP_HW (1 && CHECKSUM_GEN_TCP) /* hardware switch */
-#define MEMP_NUM_TCP_PCB (MAX_CLIENTS + RESERVED_CLIENTS)
+#define CHECKSUM_OFFLOAD_ALL (CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW || CHECKSUM_CHECK_IP_HW || CHECKSUM_CHECK_TCP_HW)
-/* we use PBUF_POOL instead of PBUF_RAM in tcp_write, so reduce PBUF_RAM size,
- * and do NOT let PBUF_POOL_BUFSIZE less then TCP_MSS
+/*
+ ---------------------------------------
+ ---------- lwIP APIs options ----------
+ ---------------------------------------
*/
-#define MEM_SIZE (((PER_TCP_PCB_BUFFER + 128) * MEMP_NUM_TCP_SEG) >> 2)
+#define LWIP_TCPIP_CORE_LOCKING 1
-#define MEMP_NUM_TCP_PCB_LISTEN 3000
+#define LWIP_TCPIP_TIMEOUT 0
-#define MEMP_NUM_TCP_SEG (128 * 128 * 2)
+#define TCPIP_MBOX_SIZE (MEMP_NUM_TCPIP_MSG_API)
-#define MEMP_NUM_NETCONN (MAX_CLIENTS + RESERVED_CLIENTS)
+#define LWIP_NETCONN 1
-#define MEMP_NUM_SYS_SEM (MAX_CLIENTS + RESERVED_CLIENTS)
+#define LWIP_NETCONN_SEM_PER_THREAD 0
-#define MEMP_NUM_SYS_MBOX (MAX_CLIENTS + RESERVED_CLIENTS)
+#define LWIP_STATS 1
-#define PBUF_POOL_SIZE (MAX_CLIENTS * 2)
+#define LWIP_STATS_DISPLAY 1
-#define MEMP_MEM_MALLOC 0
+#define LWIP_TIMERS 1
-#define LWIP_ARP 1
+#define TCP_SND_BUF (2500 * TCP_MSS)
-#define ETHARP_SUPPORT_STATIC_ENTRIES 1
+/*
+ ------------------------------------------------
+ ---------- Internal Memory Pool Sizes ----------
+ ------------------------------------------------
+*/
+#define GAZELLE_MAX_CLIENTS (20000)
+#define GAZELLE_RESERVED_CLIENTS (2000)
-#define LWIP_IPV4 1
+#define LWIP_SUPPORT_CUSTOM_PBUF 1
-#define IP_FORWARD 0
+#define MEMP_MEM_MALLOC 0
+#define MEM_LIBC_MALLOC 0
+#define MEM_USE_POOLS 0
+#define MEMP_USE_CUSTOM_POOLS 0
-#define IP_REASSEMBLY 1
+#define MEMP_NUM_TCP_PCB_LISTEN 3000
-#define LWIP_UDP 0
+#define MEMP_NUM_TCP_PCB (GAZELLE_MAX_CLIENTS + GAZELLE_RESERVED_CLIENTS)
-#define LWIP_TCP 1
+#define MEMP_NUM_NETCONN (GAZELLE_MAX_CLIENTS + GAZELLE_RESERVED_CLIENTS)
-#define IP_HLEN 20
+#define MEMP_NUM_SYS_SEM (GAZELLE_MAX_CLIENTS + GAZELLE_RESERVED_CLIENTS)
-#define TCP_HLEN 20
+#define MEMP_NUM_SYS_MBOX (GAZELLE_MAX_CLIENTS + GAZELLE_RESERVED_CLIENTS)
-#define FRAME_MTU 1500
+#define PBUF_POOL_SIZE (GAZELLE_MAX_CLIENTS * 2)
-#define TCP_MSS (FRAME_MTU - IP_HLEN - TCP_HLEN)
+/* we use PBUF_POOL instead of PBUF_RAM in tcp_write, so reduce PBUF_RAM size,
+ * and do NOT let PBUF_POOL_BUFSIZE less then TCP_MSS
+*/
+#define MEMP_NUM_TCP_SEG (128 * 128 * 2)
+#define PER_TCP_PCB_BUFFER (16 * 128)
+#define MEM_SIZE (((PER_TCP_PCB_BUFFER + 128) * MEMP_NUM_TCP_SEG) >> 2)
-#define TCP_WND (2500 * TCP_MSS)
+/*
+ ---------------------------------
+ ---------- ARP options ----------
+ ---------------------------------
+*/
+#define LWIP_ARP 1
-#define TCP_SND_BUF (2500 * TCP_MSS)
+#define ARP_TABLE_SIZE 512
-#define TCP_SND_QUEUELEN (8191)
+#define ARP_QUEUEING 1
-#define TCP_SNDLOWAT (TCP_SND_BUF / 5)
+#define ARP_QUEUE_LEN 32
-#define TCP_SNDQUEUELOWAT (TCP_SND_QUEUELEN / 5)
+#define ETHARP_SUPPORT_STATIC_ENTRIES 1
-#define TCP_LISTEN_BACKLOG 1
+/*
+ ---------------------------------
+ ---------- IP options ----------
+ ---------------------------------
+*/
+#define LWIP_IPV4 1
-#define TCP_DEFAULT_LISTEN_BACKLOG 0xff
+#define IP_FORWARD 0
-#define TCP_OVERSIZE 0
+#define IP_REASSEMBLY 1
-#define LWIP_NETIF_API 1
+#define IP_HLEN 20
-#define DEFAULT_TCP_RECVMBOX_SIZE 4096
+/*
+ ---------------------------------
+ ---------- UDP options ----------
+ ---------------------------------
+*/
+#define LWIP_UDP 0
+
+/*
+ ---------------------------------
+ ---------- TCP options ----------
+ ---------------------------------
+*/
+#define LWIP_TCP 1
+
+#define TCP_HLEN 20
#define DEFAULT_ACCEPTMBOX_SIZE 1024
+#define DEFAULT_TCP_RECVMBOX_SIZE 4096
-#define LWIP_NETCONN 1
+#define TCP_LISTEN_BACKLOG 1
+#define TCP_DEFAULT_LISTEN_BACKLOG 0xff
-#define LWIP_TCPIP_TIMEOUT 0
+#define TCP_OVERSIZE 0
+#define LWIP_NETIF_TX_SINGLE_PBUF 0
-#define LWIP_SOCKET 1
+#define TCP_MSS (FRAME_MTU - IP_HLEN - TCP_HLEN)
-#define LWIP_TCP_KEEPALIVE 1
+#define TCP_WND (2500 * TCP_MSS)
-#define LWIP_STATS 1
+#define TCP_SND_BUF (2500 * TCP_MSS)
-#define LWIP_STATS_DISPLAY 1
+#define TCP_SND_QUEUELEN (8191)
-#define LWIP_TIMEVAL_PRIVATE 0
+#define TCP_SNDLOWAT (TCP_SND_BUF / 5)
-#define USE_LIBOS 1
+#define TCP_SNDQUEUELOWAT (TCP_SND_QUEUELEN / 5)
-//#define LWIP_DEBUG 1
+#define LWIP_TCP_KEEPALIVE 1
-#define LWIP_PERF 1
+#define GAZELLE_TCP_MAX_CONN_PER_THREAD 65535
+#define GAZELLE_TCP_REUSE_IPPORT 1
-#define LWIP_RECORD_PERF 0
+/*
+ ------------------------------------
+ ---------- Socket options ----------
+ ------------------------------------
+*/
+#define LWIP_SOCKET 1
#define LWIP_SOCKET_POLL 0
-#define USE_LIBOS_ZC_RING 0
-
-#define REUSE_IPPORT 1
+#define LWIP_SO_SNDTIMEO 0
-#define MAX_CONN_NUM_PER_THREAD 65535
+#define LWIP_SO_LINGER 0
#define SO_REUSE 1
-#define SIOCSHIWAT 1
-
-#define O_NONBLOCK 04000 /* same as define in bits/fcntl-linux.h */
-
-#define O_NDELAY O_NONBLOCK
-
#define FIONBIO 0x5421 /* same as define in asm-generic/ioctls.h */
-#define LWIP_SUPPORT_CUSTOM_PBUF 1
-
-#define MEM_LIBC_MALLOC 0
-
-#define LWIP_TIMERS 1
-
-#define TCPIP_MBOX_SIZE (MEMP_NUM_TCPIP_MSG_API)
-
-#define TCP_PCB_HASH 1
-
-#define USE_DPDK_LOG 1
-
-#define LWIP_EPOOL_WAIT_MAX_EVENTS 30
-
-#define ARP_TABLE_SIZE 512
-
-#define ARP_QUEUEING 1
-
-#define ARP_QUEUE_LEN 32
-
-#define MAX_PBUF_CHAIN_LEN 40
-
-#define MIN_TSO_SEG_LEN 256
-
-/* ---------------------------------------
- * ------- NIC offloads --------
- * ---------------------------------------
- */
-#define LWIP_CHECKSUM_CTRL_PER_NETIF 1 /* checksum ability check before checksum*/
-
-// rx cksum
-#define CHECKSUM_CHECK_IP 1 /* master switch */
-#define CHECKSUM_CHECK_TCP 1 /* master switch */
-// tx cksum
-#define CHECKSUM_GEN_IP 1 /* master switch */
-#define CHECKSUM_GEN_TCP 1 /* master switch */
-
-// rx offload cksum
-#define CHECKSUM_CHECK_IP_HW (1 && CHECKSUM_CHECK_IP) /* hardware switch */
-#define CHECKSUM_CHECK_TCP_HW (1 && CHECKSUM_CHECK_TCP) /* hardware switch */
-// tx offload cksum
-#define CHECKSUM_GEN_IP_HW (1 && CHECKSUM_GEN_IP) /* hardware switch */
-#define CHECKSUM_GEN_TCP_HW (1 && CHECKSUM_GEN_TCP) /* hardware switch */
-
-#define CHECKSUM_OFFLOAD_ALL (CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW || CHECKSUM_CHECK_IP_HW || CHECKSUM_CHECK_TCP_HW)
+#define O_NONBLOCK 04000 /* same as define in bits/fcntl-linux.h */
-#if USE_LIBOS
-#define PER_THREAD __thread
-#else
-#define PER_THREAD
-#endif
+#define SIOCSHIWAT 1
#endif /* __LWIPOPTS_H__ */
diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h
index a807e3e..f78c9cf 100644
--- a/src/include/lwipsock.h
+++ b/src/include/lwipsock.h
@@ -59,7 +59,7 @@ union lwip_sock_lastdata {
struct pbuf *pbuf;
};
-#if USE_LIBOS
+#if GAZELLE_ENABLE
struct protocol_stack;
struct wakeup_poll;
struct rte_ring;
@@ -92,7 +92,7 @@ struct lwip_sock {
#define LWIP_SOCK_FD_FREE_FREE 2
#endif
-#if USE_LIBOS
+#if GAZELLE_ENABLE
char pad0 __rte_cache_aligned;
/* app thread use */
struct pbuf *recv_lastdata; /* unread data in one pbuf */
@@ -131,7 +131,7 @@ struct lwip_sock {
* --------------- LIBNET references ----------------
* --------------------------------------------------
*/
-#if USE_LIBOS
+#if GAZELLE_ENABLE
extern uint32_t sockets_num;
extern struct lwip_sock *sockets;
extern void gazelle_connected_callback(struct netconn *conn);
@@ -141,7 +141,7 @@ extern struct pbuf *write_lwip_data(struct lwip_sock *sock, uint16_t remain_size
extern void gazelle_init_sock(int32_t fd);
extern void gazelle_clean_sock(int32_t fd);
extern void write_lwip_over(struct lwip_sock *sock);
-#endif /* USE_LIBOS */
+#endif /* GAZELLE_ENABLE */
struct lwip_sock *get_socket(int s);
struct lwip_sock *get_socket_by_fd(int s);
diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c
index 0f21ad3..c8bfd19 100644
--- a/src/netif/ethernet.c
+++ b/src/netif/ethernet.c
@@ -56,7 +56,7 @@
#include "netif/ppp/pppoe.h"
#endif /* PPPOE_SUPPORT */
-#if USE_LIBOS && (CHECKSUM_GEN_TCP_HW || CHECKSUM_GEN_IP_HW)
+#if GAZELLE_ENABLE && (CHECKSUM_GEN_TCP_HW || CHECKSUM_GEN_IP_HW)
#include "dpdk_cksum.h"
#endif
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yangchen555/lwip.git
git@gitee.com:yangchen555/lwip.git
yangchen555
lwip
lwip
master

搜索帮助