Skip to content

Commit 1928885

Browse files
committed
Adapt nginx-1.28.0 to f-stack
1 parent 7e40d7f commit 1928885

55 files changed

Lines changed: 2118 additions & 71 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/nginx-1.28.0/auto/cc/gcc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ esac
4949
# optimizations
5050

5151
#NGX_GCC_OPT="-O2"
52-
#NGX_GCC_OPT="-Os"
53-
NGX_GCC_OPT="-O"
52+
NGX_GCC_OPT="-Os"
53+
#NGX_GCC_OPT="-O"
5454

5555
#CFLAGS="$CFLAGS -fomit-frame-pointer"
5656

app/nginx-1.28.0/auto/install

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ install: build $NGX_INSTALL_PERL_MODULES
148148
|| cp conf/nginx.conf '\$(DESTDIR)$NGX_CONF_PATH'
149149
cp conf/nginx.conf '\$(DESTDIR)$NGX_CONF_PREFIX/nginx.conf.default'
150150

151+
test -f '\$(DESTDIR)$NGX_CONF_PREFIX/f-stack.conf' \\
152+
|| cp conf/f-stack.conf '\$(DESTDIR)$NGX_CONF_PREFIX'
153+
151154
test -d '\$(DESTDIR)`dirname "$NGX_PID_PATH"`' \\
152155
|| mkdir -p '\$(DESTDIR)`dirname "$NGX_PID_PATH"`'
153156

app/nginx-1.28.0/auto/make

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,29 @@ ngx_objs_dir=$NGX_OBJS$ngx_regex_dirsep
1919
ngx_use_pch=`echo $NGX_USE_PCH | sed -e "s/\//$ngx_regex_dirsep/g"`
2020

2121

22+
if [ ! $FF_PATH ]; then
23+
FF_PATH=/usr/local
24+
echo "FF_PATH environment variable not defined, default FF_PATH=$FF_PATH"
25+
fi
26+
27+
if [ ! $(pkg-config --exists libdpdk && echo 1) ]; then
28+
echo "error: no installation of DPDK found, maybe you shuld export environment variable \`PKG_CONFIG_PATH\`"
29+
exit 1
30+
fi
31+
32+
CORE_LIBS="$CORE_LIBS \$(shell pkg-config --static --libs libdpdk)"
33+
CORE_LIBS="$CORE_LIBS -L$FF_PATH/lib -Wl,--whole-archive,-lfstack,--no-whole-archive"
34+
CORE_LIBS="$CORE_LIBS -Wl,--no-whole-archive -lrt -lm -ldl -lcrypto -lpthread -lnuma"
35+
2236
cat << END > $NGX_MAKEFILE
2337

2438
CC = $CC
2539
CFLAGS = $CFLAGS
2640
CPP = $CPP
2741
LINK = $LINK
2842

43+
CFLAGS += -I$FF_PATH/lib
44+
2945
END
3046

3147

app/nginx-1.28.0/auto/modules

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ if [ $NGX_TEST_BUILD_SOLARIS_SENDFILEV = YES ]; then
5555
CORE_SRCS="$CORE_SRCS $SOLARIS_SENDFILEV_SRCS"
5656
fi
5757

58+
if [ $USE_FSTACK = YES ]; then
59+
have=NGX_HAVE_FSTACK . auto/have
60+
have=NGX_HAVE_FSTACK . auto/have_headers
61+
have=SOCK_FSTACK value=0x1000 . auto/define
62+
CORE_SRCS="$CORE_SRCS $KQUEUE_SRCS"
63+
EVENT_MODULES="$EVENT_MODULES $KQUEUE_MODULE"
64+
fi
5865

5966
if [ $HTTP = YES ]; then
6067
HTTP_MODULES=

app/nginx-1.28.0/auto/options

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ NGX_CPU_CACHE_LINE=
179179

180180
NGX_POST_CONF_MSG=
181181

182+
USE_FSTACK=NO
183+
182184
opt=
183185

184186
for option
@@ -214,6 +216,8 @@ do
214216
--with-poll_module) EVENT_POLL=YES ;;
215217
--without-poll_module) EVENT_POLL=NONE ;;
216218

219+
--with-ff_module) USE_FSTACK=YES ;;
220+
217221
--with-threads) USE_THREADS=YES ;;
218222

219223
--with-file-aio) NGX_FILE_AIO=YES ;;
@@ -450,6 +454,8 @@ cat << END
450454
--with-poll_module enable poll module
451455
--without-poll_module disable poll module
452456

457+
--with-ff_module enable F-Stack module
458+
453459
--with-threads enable thread pool support
454460

455461
--with-file-aio enable file AIO support

app/nginx-1.28.0/auto/os/linux

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ if [ $ngx_found = yes ]; then
8585
ee.events = EPOLLIN|EPOLLEXCLUSIVE;
8686
ee.data.ptr = NULL;
8787
epoll_ctl(efd, EPOLL_CTL_ADD, fd, &ee)"
88-
. auto/feature
88+
#. auto/feature
8989

9090

9191
# eventfd()
@@ -251,16 +251,16 @@ ngx_feature_test="union bpf_attr attr = { 0 };
251251
attr.map_type = BPF_MAP_TYPE_SOCKHASH;
252252

253253
syscall(__NR_bpf, 0, &attr, 0);"
254-
. auto/feature
255-
256-
if [ $ngx_found = yes ]; then
257-
CORE_SRCS="$CORE_SRCS src/core/ngx_bpf.c"
258-
CORE_DEPS="$CORE_DEPS src/core/ngx_bpf.h"
259-
260-
if [ $QUIC_BPF != NONE ]; then
261-
QUIC_BPF=YES
262-
fi
263-
fi
254+
#. auto/feature
255+
#
256+
#if [ $ngx_found = yes ]; then
257+
# CORE_SRCS="$CORE_SRCS src/core/ngx_bpf.c"
258+
# CORE_DEPS="$CORE_DEPS src/core/ngx_bpf.h"
259+
#
260+
# if [ $QUIC_BPF != NONE ]; then
261+
# QUIC_BPF=YES
262+
# fi
263+
#fi
264264

265265

266266
ngx_feature="SO_COOKIE"
@@ -273,11 +273,11 @@ ngx_feature_libs=
273273
ngx_feature_test="socklen_t optlen = sizeof(uint64_t);
274274
uint64_t cookie;
275275
getsockopt(0, SOL_SOCKET, SO_COOKIE, &cookie, &optlen)"
276-
. auto/feature
277-
278-
if [ $ngx_found = yes ]; then
279-
SO_COOKIE_FOUND=YES
280-
fi
276+
#. auto/feature
277+
#
278+
#if [ $ngx_found = yes ]; then
279+
# SO_COOKIE_FOUND=YES
280+
#fi
281281

282282

283283
# UDP segmentation offloading
@@ -292,7 +292,7 @@ ngx_feature_libs=
292292
ngx_feature_test="socklen_t optlen = sizeof(int);
293293
int val;
294294
getsockopt(0, SOL_UDP, UDP_SEGMENT, &val, &optlen)"
295-
. auto/feature
295+
#. auto/feature
296296

297297

298298
CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"

app/nginx-1.28.0/auto/sources

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ POLL_MODULE=ngx_poll_module
109109
POLL_SRCS=src/event/modules/ngx_poll_module.c
110110
WIN32_POLL_SRCS=src/event/modules/ngx_win32_poll_module.c
111111

112-
KQUEUE_MODULE=ngx_kqueue_module
113-
KQUEUE_SRCS=src/event/modules/ngx_kqueue_module.c
112+
KQUEUE_MODULE="ngx_kqueue_module ngx_ff_host_event_module"
113+
KQUEUE_SRCS="src/event/modules/ngx_kqueue_module.c src/event/modules/ngx_ff_module.c src/event/modules/ngx_ff_host_event_module.c"
114114

115115
DEVPOLL_MODULE=ngx_devpoll_module
116116
DEVPOLL_SRCS=src/event/modules/ngx_devpoll_module.c

app/nginx-1.28.0/auto/unix

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,9 @@ ngx_feature_incs="#include <sys/socket.h>
403403
ngx_feature_path=
404404
ngx_feature_libs=
405405
ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_RECVDSTADDR, NULL, 0)"
406-
. auto/feature
406+
#. auto/feature
407+
have=NGX_HAVE_IP_RECVDSTADDR . auto/have
408+
have=IP_RECVDSTADDR value=7 . auto/define
407409

408410

409411
# BSD way to set IPv4 datagram source address
@@ -416,7 +418,9 @@ ngx_feature_incs="#include <sys/socket.h>
416418
ngx_feature_path=
417419
ngx_feature_libs=
418420
ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_SENDSRCADDR, NULL, 0)"
419-
. auto/feature
421+
#. auto/feature
422+
have=NGX_HAVE_IP_SENDSRCADDR . auto/have
423+
have=IP_SENDSRCADDR value=7 . auto/define
420424

421425

422426
# Linux way to get IPv4 datagram destination address
@@ -432,7 +436,7 @@ ngx_feature_test="struct in_pktinfo pkt;
432436
pkt.ipi_spec_dst.s_addr = INADDR_ANY;
433437
(void) pkt;
434438
setsockopt(0, IPPROTO_IP, IP_PKTINFO, NULL, 0)"
435-
. auto/feature
439+
#. auto/feature
436440

437441

438442
# RFC 3542 way to get IPv6 datagram destination address
@@ -459,7 +463,7 @@ ngx_feature_path=
459463
ngx_feature_libs=
460464
ngx_feature_test="(void) IP_PMTUDISC_DO;
461465
setsockopt(0, IPPROTO_IP, IP_MTU_DISCOVER, NULL, 0)"
462-
. auto/feature
466+
#. auto/feature
463467

464468

465469
ngx_feature="IPV6_MTU_DISCOVER"
@@ -471,7 +475,7 @@ ngx_feature_path=
471475
ngx_feature_libs=
472476
ngx_feature_test="(void) IPV6_PMTUDISC_DO;
473477
setsockopt(0, IPPROTO_IPV6, IPV6_MTU_DISCOVER, NULL, 0)"
474-
. auto/feature
478+
#. auto/feature
475479

476480

477481
ngx_feature="IP_DONTFRAG"
@@ -482,7 +486,9 @@ ngx_feature_incs="#include <sys/socket.h>
482486
ngx_feature_path=
483487
ngx_feature_libs=
484488
ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_DONTFRAG, NULL, 0)"
485-
. auto/feature
489+
#. auto/feature
490+
have=NGX_HAVE_IP_DONTFRAG . auto/have
491+
have=IP_DONTFRAG value=67 . auto/define
486492

487493

488494
ngx_feature="IPV6_DONTFRAG"
@@ -493,7 +499,9 @@ ngx_feature_incs="#include <sys/socket.h>
493499
ngx_feature_path=
494500
ngx_feature_libs=
495501
ngx_feature_test="setsockopt(0, IPPROTO_IP, IPV6_DONTFRAG, NULL, 0)"
496-
. auto/feature
502+
#. auto/feature
503+
have=NGX_HAVE_IPV6_DONTFRAG . auto/have
504+
have=IPV6_DONTFRAG value=62 . auto/define
497505

498506

499507
ngx_feature="TCP_DEFER_ACCEPT"
@@ -559,7 +567,7 @@ ngx_feature_incs="#include <sys/socket.h>"
559567
ngx_feature_path=
560568
ngx_feature_libs=
561569
ngx_feature_test="accept4(0, NULL, NULL, SOCK_NONBLOCK)"
562-
. auto/feature
570+
#. auto/feature
563571

564572
if [ $NGX_FILE_AIO = YES ]; then
565573

0 commit comments

Comments
 (0)