├── .vscode ├── c_cpp_properties.json ├── configurationCache.log ├── dryrun.log ├── launch.json ├── settings.json ├── targets.log ├── tasks.json └── test.c ├── Makefile ├── README.md ├── build ├── .common.o.cmd ├── .common.o.d ├── .netfamily.o.cmd ├── .netfamily.o.d ├── .tcp.o.cmd ├── .tcp.o.d ├── .tcp.o.d.tmp ├── .test.cmd ├── .test.o.cmd ├── .test.o.d ├── .udp.o.cmd ├── .udp.o.d ├── _install ├── _postbuild ├── _postinstall ├── _preinstall ├── app │ ├── test │ └── test.map ├── common.o ├── netfamily.o ├── tcp.o ├── test ├── test.map ├── test.o └── udp.o ├── common.c ├── common.h ├── netfamily.c ├── nty_tree.h ├── run.sh ├── tcp.c ├── tcp.h ├── udp.c └── udp.h /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "linux-gcc-x64", 5 | "includePath": [ 6 | "${workspaceFolder}/**", 7 | "/media/dpdk-stable-19.11.12/lib/**", 8 | "/media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/**" 9 | ], 10 | "defines": [], 11 | "compilerPath": "/opt/rh/devtoolset-9/root/usr/bin/gcc", 12 | "cStandard": "${default}", 13 | "cppStandard": "${default}", 14 | "intelliSenseMode": "linux-gcc-x64" 15 | } 16 | ], 17 | "version": 4 18 | } -------------------------------------------------------------------------------- /.vscode/configurationCache.log: -------------------------------------------------------------------------------- 1 | {"buildTargets":["all"],"launchTargets":[],"customConfigurationProvider":{"workspaceBrowse":{"browsePath":[],"compilerArgs":[]},"fileIndex":[]}} -------------------------------------------------------------------------------- /.vscode/dryrun.log: -------------------------------------------------------------------------------- 1 | make.exe all --dry-run --keep-going --print-directory 2 | 'make.exe' �����ڲ����ⲿ���Ҳ���ǿ����еij��� 3 | ���������ļ��� 4 | 5 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C/C++ Runner: Debug Session", 6 | "type": "cppdbg", 7 | "request": "launch", 8 | "args": [], 9 | "stopAtEntry": false, 10 | "cwd": "e:/codeTest/test_netfamily", 11 | "environment": [], 12 | "program": "e:/codeTest/test_netfamily/build/Debug/outDebug", 13 | "internalConsoleOptions": "openOnSessionStart", 14 | "MIMode": "gdb", 15 | "miDebuggerPath": "D:/DevC++/DevCpp/MinGW64/bin/gdb.exe", 16 | "console": "integratedTerminal", 17 | "setupCommands": [ 18 | { 19 | "description": "Enable pretty-printing for gdb", 20 | "text": "-enable-pretty-printing", 21 | "ignoreFailures": true 22 | } 23 | ] 24 | } 25 | ] 26 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "C_Cpp_Runner.cCompilerPath": "D:/DevC++/DevCpp/MinGW64/bin/gcc.exe", 3 | "C_Cpp_Runner.cppCompilerPath": "D:/DevC++/DevCpp/MinGW64/bin/g++.exe", 4 | "C_Cpp_Runner.debuggerPath": "D:/DevC++/DevCpp/MinGW64/bin/gdb.exe", 5 | "C_Cpp_Runner.cStandard": "", 6 | "C_Cpp_Runner.cppStandard": "", 7 | "C_Cpp_Runner.msvcBatchPath": "", 8 | "C_Cpp_Runner.warnings": [ 9 | "-Wall", 10 | "-Wextra", 11 | "-Wpedantic" 12 | ], 13 | "C_Cpp_Runner.enableWarnings": true, 14 | "C_Cpp_Runner.warningsAsError": false, 15 | "C_Cpp_Runner.compilerArgs": [], 16 | "C_Cpp_Runner.linkerArgs": [], 17 | "C_Cpp_Runner.includePaths": [], 18 | "C_Cpp_Runner.includeSearch": [ 19 | "*", 20 | "**/*" 21 | ], 22 | "C_Cpp_Runner.excludeSearch": [ 23 | "**/build", 24 | "**/build/**", 25 | "**/.*", 26 | "**/.*/**", 27 | "**/.vscode", 28 | "**/.vscode/**" 29 | ], 30 | "files.associations": { 31 | "*.c": "c", 32 | "stdio.h": "c", 33 | "math.h": "c", 34 | "common.h": "c", 35 | "cstdlib": "c", 36 | "tcp.h": "c", 37 | "bitset": "c", 38 | "chrono": "c", 39 | "cstring": "c", 40 | "list": "c", 41 | "stdlib.h": "c", 42 | "inet.h": "c", 43 | "udp.h": "c" 44 | }, 45 | "C_Cpp_Runner.useMsvc": false, 46 | "C_Cpp_Runner.msvcWarnings": [ 47 | "/W4", 48 | "/permissive-", 49 | "/w14242", 50 | "/w14287", 51 | "/w14296", 52 | "/w14311", 53 | "/w14826", 54 | "/w44062", 55 | "/w44242", 56 | "/w14905", 57 | "/w14906", 58 | "/w14263", 59 | "/w44265", 60 | "/w14928" 61 | ], 62 | "C_Cpp_Runner.useAddressSanitizer": false, 63 | "C_Cpp_Runner.useUndefinedSanitizer": false, 64 | "C_Cpp_Runner.useLeakSanitizer": false, 65 | "C_Cpp_Runner.showCompilationTime": false, 66 | "C_Cpp_Runner.useLinkTimeOptimization": false, 67 | "C_Cpp_Runner.msvcSecureNoWarnings": false 68 | } -------------------------------------------------------------------------------- /.vscode/targets.log: -------------------------------------------------------------------------------- 1 | make.exe all --print-data-base --no-builtin-variables --no-builtin-rules --question 2 | 'make.exe' �����ڲ����ⲿ���Ҳ���ǿ����еij��� 3 | ���������ļ��� 4 | 5 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "shell", 6 | "label":"dpdk-build", 7 | "command": "/usr/bin/make", 8 | "args": [], 9 | "options":{ 10 | "cwd":"${workspaceFolder}" 11 | }, 12 | "problemMatcher":[ 13 | "$gcc" 14 | ], 15 | "group":"build", 16 | "detail": "" 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | include $(RTE_SDK)/mk/rte.vars.mk 2 | 3 | # binary name 4 | APP = test 5 | 6 | # all source are stored in SRCS-y 7 | SRCS-y := netfamily.c 8 | SRCS-y += common.c 9 | SRCS-y += tcp.c 10 | SRCS-y += udp.c 11 | CFLAGS += -Wall -g 12 | # CFLAGS += -D ENABLE_SINGLE_EPOLL 13 | CFLAGS += -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -Wformat=0 14 | LDLIBS += -lpthread 15 | 16 | INC += $(sort $(wildcard *.h)) 17 | 18 | include $(RTE_SDK)/mk/rte.extapp.mk 19 | 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DPDK-TCP-UDP_Protocol_Stack 2 | Simple protocol stack based on dpdk(使用dpdk搭建协议栈) 3 | 4 | 为了对协议栈了解更深入一些,借助dpdk-19.11实现一个简易协议栈。 5 | 6 | 本项目要完成的工作如下: 7 | 1. dpdk相关配置 8 | 2. 实现协议栈,主要针对TCP与UDP,包含三次握手、四次挥手 9 | 3. 实现服务端socket系统调用api:socket、bind、listen、accept、recv、send、recvfrom、sendto、recv、send、close 10 | 4. 实现epoll多线程 11 | 12 | ## 使用 13 | 1. 环境:安装dpdp-19.11,多队列网卡 14 | 2. make clean;make 15 | 3. sh run.sh 16 | 17 | ## 测试 18 | 1. 在虚拟机中执行该代码 19 | 2. windows中可以使用类似网络调试助手的工具软件给虚拟机发送tcp/udp数据包 20 | 测试时,需要在客户端增加一条arp表项,目的是为了客户端能根据mac地址将数据包发送至服务端 21 | 具体方法如下: 22 | https://www.sohu.com/a/502006584_121258626 23 | 24 | ## 注意 25 | 本项目目前正在逐步优化,欢迎同学们指出不足哈! 26 | -------------------------------------------------------------------------------- /build/.common.o.cmd: -------------------------------------------------------------------------------- 1 | cmd_common.o = gcc -Wp,-MD,./.common.o.d.tmp -m64 -pthread -I/media/dpdk-stable-19.11.12/lib/librte_eal/linux/eal/include -march=native -DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_AES -DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX -DRTE_MACHINE_CPUFLAG_RDRAND -DRTE_MACHINE_CPUFLAG_RDSEED -DRTE_MACHINE_CPUFLAG_FSGSBASE -DRTE_MACHINE_CPUFLAG_F16C -DRTE_MACHINE_CPUFLAG_AVX2 -I/mnt/hj/codeTest/stack_finaly/DPDK-TCP-UDP_Protocol_Stack/build/include -DRTE_USE_FUNCTION_VERSIONING -I/media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include -include /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_config.h -D_GNU_SOURCE -Wall -g -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -Wformat=0 -o common.o -c /mnt/hj/codeTest/stack_finaly/DPDK-TCP-UDP_Protocol_Stack/common.c 2 | -------------------------------------------------------------------------------- /build/.common.o.d: -------------------------------------------------------------------------------- 1 | dep_common.o = \ 2 | /mnt/hj/codeTest/stack_finaly/DPDK-TCP-UDP_Protocol_Stack/common.c \ 3 | /usr/include/stdc-predef.h \ 4 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_config.h \ 5 | /mnt/hj/codeTest/stack_finaly/DPDK-TCP-UDP_Protocol_Stack/common.h \ 6 | /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ 7 | /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 8 | /usr/include/gnu/stubs-64.h \ 9 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/stddef.h \ 10 | /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 11 | /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 12 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/stdarg.h \ 13 | /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 14 | /usr/include/stdlib.h /usr/include/bits/waitflags.h \ 15 | /usr/include/bits/waitstatus.h /usr/include/endian.h \ 16 | /usr/include/bits/endian.h /usr/include/bits/byteswap.h \ 17 | /usr/include/bits/byteswap-16.h /usr/include/xlocale.h \ 18 | /usr/include/sys/types.h /usr/include/time.h /usr/include/sys/select.h \ 19 | /usr/include/bits/select.h /usr/include/bits/sigset.h \ 20 | /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ 21 | /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ 22 | /usr/include/bits/stdlib-float.h /usr/include/math.h \ 23 | /usr/include/bits/huge_val.h /usr/include/bits/huge_valf.h \ 24 | /usr/include/bits/huge_vall.h /usr/include/bits/inf.h \ 25 | /usr/include/bits/nan.h /usr/include/bits/mathdef.h \ 26 | /usr/include/bits/mathcalls.h /usr/include/string.h \ 27 | /usr/include/arpa/inet.h /usr/include/netinet/in.h \ 28 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/stdint.h \ 29 | /usr/include/stdint.h /usr/include/bits/wchar.h \ 30 | /usr/include/sys/socket.h /usr/include/sys/uio.h /usr/include/bits/uio.h \ 31 | /usr/include/bits/socket.h /usr/include/bits/socket_type.h \ 32 | /usr/include/bits/sockaddr.h /usr/include/asm/socket.h \ 33 | /usr/include/asm-generic/socket.h /usr/include/asm/sockios.h \ 34 | /usr/include/asm-generic/sockios.h /usr/include/bits/in.h \ 35 | /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ 36 | /usr/include/bits/timex.h /usr/include/bits/setjmp.h \ 37 | /mnt/hj/codeTest/stack_finaly/DPDK-TCP-UDP_Protocol_Stack/nty_tree.h \ 38 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_eal.h \ 39 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_config.h \ 40 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_compat.h \ 41 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_per_lcore.h \ 42 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_bus.h \ 43 | /usr/include/sys/queue.h \ 44 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_log.h \ 45 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_common.h \ 46 | /usr/include/ctype.h /usr/include/errno.h /usr/include/bits/errno.h \ 47 | /usr/include/linux/errno.h /usr/include/asm/errno.h \ 48 | /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ 49 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/limits.h \ 50 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/syslimits.h \ 51 | /usr/include/limits.h /usr/include/bits/posix1_lim.h \ 52 | /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ 53 | /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ 54 | /media/dpdk-stable-19.11.12/lib/librte_eal/linux/eal/include/rte_os.h \ 55 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_dev.h \ 56 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pci_dev_feature_defs.h \ 57 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ethdev.h \ 58 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_interrupts.h \ 59 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_eal_interrupts.h \ 60 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_devargs.h \ 61 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_errno.h \ 62 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ether.h \ 63 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_memcpy.h \ 64 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_vect.h \ 65 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_vect.h \ 66 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/x86intrin.h \ 67 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/ia32intrin.h \ 68 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/immintrin.h \ 69 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/mmintrin.h \ 70 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/xmmintrin.h \ 71 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/mm_malloc.h \ 72 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/emmintrin.h \ 73 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/pmmintrin.h \ 74 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/tmmintrin.h \ 75 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/smmintrin.h \ 76 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/popcntintrin.h \ 77 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/wmmintrin.h \ 78 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/fxsrintrin.h \ 79 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/xsaveintrin.h \ 80 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/xsaveoptintrin.h \ 81 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/xsavesintrin.h \ 82 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/xsavecintrin.h \ 83 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avxintrin.h \ 84 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx2intrin.h \ 85 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512fintrin.h \ 86 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512erintrin.h \ 87 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512pfintrin.h \ 88 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512cdintrin.h \ 89 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vlintrin.h \ 90 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512bwintrin.h \ 91 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512dqintrin.h \ 92 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vlbwintrin.h \ 93 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vldqintrin.h \ 94 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512ifmaintrin.h \ 95 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512ifmavlintrin.h \ 96 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vbmiintrin.h \ 97 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vbmivlintrin.h \ 98 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx5124fmapsintrin.h \ 99 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx5124vnniwintrin.h \ 100 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vpopcntdqintrin.h \ 101 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vbmi2intrin.h \ 102 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vbmi2vlintrin.h \ 103 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vnniintrin.h \ 104 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vnnivlintrin.h \ 105 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vpopcntdqvlintrin.h \ 106 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512bitalgintrin.h \ 107 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/shaintrin.h \ 108 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/lzcntintrin.h \ 109 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/bmiintrin.h \ 110 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/bmi2intrin.h \ 111 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/fmaintrin.h \ 112 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/f16cintrin.h \ 113 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/rtmintrin.h \ 114 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/xtestintrin.h \ 115 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/cetintrin.h \ 116 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/gfniintrin.h \ 117 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/vaesintrin.h \ 118 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/vpclmulqdqintrin.h \ 119 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/movdirintrin.h \ 120 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/sgxintrin.h \ 121 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/pconfigintrin.h \ 122 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/waitpkgintrin.h \ 123 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/cldemoteintrin.h \ 124 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/rdseedintrin.h \ 125 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/prfchwintrin.h \ 126 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/adxintrin.h \ 127 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/clwbintrin.h \ 128 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/clflushoptintrin.h \ 129 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/wbnoinvdintrin.h \ 130 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/pkuintrin.h \ 131 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/mm3dnow.h \ 132 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/fma4intrin.h \ 133 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/ammintrin.h \ 134 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/xopintrin.h \ 135 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/lwpintrin.h \ 136 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/tbmintrin.h \ 137 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/mwaitxintrin.h \ 138 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/clzerointrin.h \ 139 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_random.h \ 140 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf.h \ 141 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mempool.h \ 142 | /usr/include/inttypes.h \ 143 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_spinlock.h \ 144 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_spinlock.h \ 145 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_lcore.h \ 146 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_launch.h \ 147 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pause.h \ 148 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_pause.h \ 149 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_rtm.h \ 150 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_cpuflags.h \ 151 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h \ 152 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_branch_prediction.h \ 153 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_common.h \ 154 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pause.h \ 155 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_cycles.h \ 156 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_cycles.h \ 157 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_debug.h \ 158 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_log.h \ 159 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_atomic.h \ 160 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_atomic.h \ 161 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_atomic_64.h \ 162 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_branch_prediction.h \ 163 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_memory.h \ 164 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_fbarray.h \ 165 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_rwlock.h \ 166 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_rwlock.h \ 167 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_spinlock.h \ 168 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ring.h \ 169 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_memzone.h \ 170 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ring_generic.h \ 171 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_prefetch.h \ 172 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_prefetch.h \ 173 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_byteorder.h \ 174 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_byteorder.h \ 175 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_byteorder_64.h \ 176 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf_ptype.h \ 177 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf_core.h \ 178 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_atomic.h \ 179 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_dev_info.h \ 180 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_eth_ctrl.h \ 181 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_flow.h \ 182 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_arp.h \ 183 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_icmp.h \ 184 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ip.h \ 185 | /usr/include/netinet/ip.h \ 186 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_sctp.h \ 187 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_tcp.h \ 188 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_udp.h \ 189 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_esp.h \ 190 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_higig.h \ 191 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf_dyn.h \ 192 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ethdev.h \ 193 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ethdev_core.h \ 194 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_flow.h \ 195 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_malloc.h \ 196 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_timer.h \ 197 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_kni.h \ 198 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pci.h \ 199 | /media/dpdk-stable-19.11.12/lib/librte_eal/linux/eal/include/rte_kni_common.h \ 200 | /mnt/hj/codeTest/stack_finaly/DPDK-TCP-UDP_Protocol_Stack/udp.h \ 201 | /mnt/hj/codeTest/stack_finaly/DPDK-TCP-UDP_Protocol_Stack/tcp.h 202 | -------------------------------------------------------------------------------- /build/.netfamily.o.cmd: -------------------------------------------------------------------------------- 1 | cmd_netfamily.o = gcc -Wp,-MD,./.netfamily.o.d.tmp -m64 -pthread -I/media/dpdk-stable-19.11.12/lib/librte_eal/linux/eal/include -march=native -DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_AES -DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX -DRTE_MACHINE_CPUFLAG_RDRAND -DRTE_MACHINE_CPUFLAG_RDSEED -DRTE_MACHINE_CPUFLAG_FSGSBASE -DRTE_MACHINE_CPUFLAG_F16C -DRTE_MACHINE_CPUFLAG_AVX2 -I/mnt/hj/codeTest/stack_finaly/DPDK-TCP-UDP_Protocol_Stack/build/include -DRTE_USE_FUNCTION_VERSIONING -I/media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include -include /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_config.h -D_GNU_SOURCE -Wall -g -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -Wformat=0 -o netfamily.o -c /mnt/hj/codeTest/stack_finaly/DPDK-TCP-UDP_Protocol_Stack/netfamily.c 2 | -------------------------------------------------------------------------------- /build/.netfamily.o.d: -------------------------------------------------------------------------------- 1 | dep_netfamily.o = \ 2 | /mnt/hj/codeTest/stack_finaly/DPDK-TCP-UDP_Protocol_Stack/netfamily.c \ 3 | /usr/include/stdc-predef.h \ 4 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_config.h \ 5 | /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ 6 | /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 7 | /usr/include/gnu/stubs-64.h \ 8 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/stddef.h \ 9 | /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 10 | /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 11 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/stdarg.h \ 12 | /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 13 | /usr/include/math.h /usr/include/bits/huge_val.h \ 14 | /usr/include/bits/huge_valf.h /usr/include/bits/huge_vall.h \ 15 | /usr/include/bits/inf.h /usr/include/bits/nan.h \ 16 | /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \ 17 | /usr/include/arpa/inet.h /usr/include/netinet/in.h \ 18 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/stdint.h \ 19 | /usr/include/stdint.h /usr/include/bits/wchar.h \ 20 | /usr/include/sys/socket.h /usr/include/sys/uio.h \ 21 | /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \ 22 | /usr/include/bits/endian.h /usr/include/bits/byteswap.h \ 23 | /usr/include/bits/byteswap-16.h /usr/include/sys/select.h \ 24 | /usr/include/bits/select.h /usr/include/bits/sigset.h \ 25 | /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ 26 | /usr/include/bits/pthreadtypes.h /usr/include/bits/uio.h \ 27 | /usr/include/bits/socket.h /usr/include/bits/socket_type.h \ 28 | /usr/include/bits/sockaddr.h /usr/include/asm/socket.h \ 29 | /usr/include/asm-generic/socket.h /usr/include/asm/sockios.h \ 30 | /usr/include/asm-generic/sockios.h /usr/include/bits/in.h \ 31 | /mnt/hj/codeTest/stack_finaly/DPDK-TCP-UDP_Protocol_Stack/common.h \ 32 | /usr/include/stdlib.h /usr/include/bits/waitflags.h \ 33 | /usr/include/bits/waitstatus.h /usr/include/xlocale.h \ 34 | /usr/include/alloca.h /usr/include/bits/stdlib-float.h \ 35 | /usr/include/string.h /usr/include/pthread.h /usr/include/sched.h \ 36 | /usr/include/bits/sched.h /usr/include/bits/timex.h \ 37 | /usr/include/bits/setjmp.h \ 38 | /mnt/hj/codeTest/stack_finaly/DPDK-TCP-UDP_Protocol_Stack/nty_tree.h \ 39 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_eal.h \ 40 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_config.h \ 41 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_compat.h \ 42 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_per_lcore.h \ 43 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_bus.h \ 44 | /usr/include/sys/queue.h \ 45 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_log.h \ 46 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_common.h \ 47 | /usr/include/ctype.h /usr/include/errno.h /usr/include/bits/errno.h \ 48 | /usr/include/linux/errno.h /usr/include/asm/errno.h \ 49 | /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ 50 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/limits.h \ 51 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/syslimits.h \ 52 | /usr/include/limits.h /usr/include/bits/posix1_lim.h \ 53 | /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ 54 | /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ 55 | /media/dpdk-stable-19.11.12/lib/librte_eal/linux/eal/include/rte_os.h \ 56 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_dev.h \ 57 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pci_dev_feature_defs.h \ 58 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ethdev.h \ 59 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_interrupts.h \ 60 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_eal_interrupts.h \ 61 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_devargs.h \ 62 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_errno.h \ 63 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ether.h \ 64 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_memcpy.h \ 65 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_vect.h \ 66 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_vect.h \ 67 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/x86intrin.h \ 68 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/ia32intrin.h \ 69 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/immintrin.h \ 70 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/mmintrin.h \ 71 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/xmmintrin.h \ 72 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/mm_malloc.h \ 73 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/emmintrin.h \ 74 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/pmmintrin.h \ 75 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/tmmintrin.h \ 76 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/smmintrin.h \ 77 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/popcntintrin.h \ 78 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/wmmintrin.h \ 79 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/fxsrintrin.h \ 80 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/xsaveintrin.h \ 81 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/xsaveoptintrin.h \ 82 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/xsavesintrin.h \ 83 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/xsavecintrin.h \ 84 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avxintrin.h \ 85 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx2intrin.h \ 86 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512fintrin.h \ 87 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512erintrin.h \ 88 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512pfintrin.h \ 89 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512cdintrin.h \ 90 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vlintrin.h \ 91 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512bwintrin.h \ 92 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512dqintrin.h \ 93 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vlbwintrin.h \ 94 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vldqintrin.h \ 95 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512ifmaintrin.h \ 96 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512ifmavlintrin.h \ 97 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vbmiintrin.h \ 98 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vbmivlintrin.h \ 99 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx5124fmapsintrin.h \ 100 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx5124vnniwintrin.h \ 101 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vpopcntdqintrin.h \ 102 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vbmi2intrin.h \ 103 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vbmi2vlintrin.h \ 104 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vnniintrin.h \ 105 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vnnivlintrin.h \ 106 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vpopcntdqvlintrin.h \ 107 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512bitalgintrin.h \ 108 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/shaintrin.h \ 109 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/lzcntintrin.h \ 110 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/bmiintrin.h \ 111 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/bmi2intrin.h \ 112 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/fmaintrin.h \ 113 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/f16cintrin.h \ 114 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/rtmintrin.h \ 115 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/xtestintrin.h \ 116 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/cetintrin.h \ 117 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/gfniintrin.h \ 118 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/vaesintrin.h \ 119 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/vpclmulqdqintrin.h \ 120 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/movdirintrin.h \ 121 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/sgxintrin.h \ 122 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/pconfigintrin.h \ 123 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/waitpkgintrin.h \ 124 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/cldemoteintrin.h \ 125 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/rdseedintrin.h \ 126 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/prfchwintrin.h \ 127 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/adxintrin.h \ 128 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/clwbintrin.h \ 129 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/clflushoptintrin.h \ 130 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/wbnoinvdintrin.h \ 131 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/pkuintrin.h \ 132 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/mm3dnow.h \ 133 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/fma4intrin.h \ 134 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/ammintrin.h \ 135 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/xopintrin.h \ 136 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/lwpintrin.h \ 137 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/tbmintrin.h \ 138 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/mwaitxintrin.h \ 139 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/clzerointrin.h \ 140 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_random.h \ 141 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf.h \ 142 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mempool.h \ 143 | /usr/include/inttypes.h \ 144 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_spinlock.h \ 145 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_spinlock.h \ 146 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_lcore.h \ 147 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_launch.h \ 148 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pause.h \ 149 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_pause.h \ 150 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_rtm.h \ 151 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_cpuflags.h \ 152 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h \ 153 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_branch_prediction.h \ 154 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_common.h \ 155 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pause.h \ 156 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_cycles.h \ 157 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_cycles.h \ 158 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_debug.h \ 159 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_log.h \ 160 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_atomic.h \ 161 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_atomic.h \ 162 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_atomic_64.h \ 163 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_branch_prediction.h \ 164 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_memory.h \ 165 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_fbarray.h \ 166 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_rwlock.h \ 167 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_rwlock.h \ 168 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_spinlock.h \ 169 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ring.h \ 170 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_memzone.h \ 171 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ring_generic.h \ 172 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_prefetch.h \ 173 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_prefetch.h \ 174 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_byteorder.h \ 175 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_byteorder.h \ 176 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_byteorder_64.h \ 177 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf_ptype.h \ 178 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf_core.h \ 179 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_atomic.h \ 180 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_dev_info.h \ 181 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_eth_ctrl.h \ 182 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_flow.h \ 183 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_arp.h \ 184 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_icmp.h \ 185 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ip.h \ 186 | /usr/include/netinet/ip.h \ 187 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_sctp.h \ 188 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_tcp.h \ 189 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_udp.h \ 190 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_esp.h \ 191 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_higig.h \ 192 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf_dyn.h \ 193 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ethdev.h \ 194 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ethdev_core.h \ 195 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_flow.h \ 196 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_malloc.h \ 197 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_timer.h \ 198 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_kni.h \ 199 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pci.h \ 200 | /media/dpdk-stable-19.11.12/lib/librte_eal/linux/eal/include/rte_kni_common.h \ 201 | /mnt/hj/codeTest/stack_finaly/DPDK-TCP-UDP_Protocol_Stack/tcp.h \ 202 | /mnt/hj/codeTest/stack_finaly/DPDK-TCP-UDP_Protocol_Stack/udp.h 203 | -------------------------------------------------------------------------------- /build/.tcp.o.cmd: -------------------------------------------------------------------------------- 1 | cmd_tcp.o = gcc -Wp,-MD,./.tcp.o.d.tmp -m64 -pthread -I/media/dpdk-stable-19.11.12/lib/librte_eal/linux/eal/include -march=native -DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_AES -DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX -DRTE_MACHINE_CPUFLAG_RDRAND -DRTE_MACHINE_CPUFLAG_RDSEED -DRTE_MACHINE_CPUFLAG_FSGSBASE -DRTE_MACHINE_CPUFLAG_F16C -DRTE_MACHINE_CPUFLAG_AVX2 -I/mnt/hj/codeTest/test_netfamily/build/include -DRTE_USE_FUNCTION_VERSIONING -I/media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include -include /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_config.h -D_GNU_SOURCE -Wall -g -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -Wformat=0 -o tcp.o -c /mnt/hj/codeTest/test_netfamily/tcp.c 2 | -------------------------------------------------------------------------------- /build/.tcp.o.d: -------------------------------------------------------------------------------- 1 | dep_tcp.o = /mnt/hj/codeTest/test_netfamily/tcp.c /usr/include/stdc-predef.h \ 2 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_config.h \ 3 | /mnt/hj/codeTest/test_netfamily/tcp.h \ 4 | /mnt/hj/codeTest/test_netfamily/common.h /usr/include/stdio.h \ 5 | /usr/include/features.h /usr/include/sys/cdefs.h \ 6 | /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 7 | /usr/include/gnu/stubs-64.h \ 8 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/stddef.h \ 9 | /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 10 | /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 11 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/stdarg.h \ 12 | /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 13 | /usr/include/stdlib.h /usr/include/bits/waitflags.h \ 14 | /usr/include/bits/waitstatus.h /usr/include/endian.h \ 15 | /usr/include/bits/endian.h /usr/include/bits/byteswap.h \ 16 | /usr/include/bits/byteswap-16.h /usr/include/xlocale.h \ 17 | /usr/include/sys/types.h /usr/include/time.h /usr/include/sys/select.h \ 18 | /usr/include/bits/select.h /usr/include/bits/sigset.h \ 19 | /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ 20 | /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ 21 | /usr/include/bits/stdlib-float.h /usr/include/math.h \ 22 | /usr/include/bits/huge_val.h /usr/include/bits/huge_valf.h \ 23 | /usr/include/bits/huge_vall.h /usr/include/bits/inf.h \ 24 | /usr/include/bits/nan.h /usr/include/bits/mathdef.h \ 25 | /usr/include/bits/mathcalls.h /usr/include/string.h \ 26 | /usr/include/arpa/inet.h /usr/include/netinet/in.h \ 27 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/stdint.h \ 28 | /usr/include/stdint.h /usr/include/bits/wchar.h \ 29 | /usr/include/sys/socket.h /usr/include/sys/uio.h /usr/include/bits/uio.h \ 30 | /usr/include/bits/socket.h /usr/include/bits/socket_type.h \ 31 | /usr/include/bits/sockaddr.h /usr/include/asm/socket.h \ 32 | /usr/include/asm-generic/socket.h /usr/include/asm/sockios.h \ 33 | /usr/include/asm-generic/sockios.h /usr/include/bits/in.h \ 34 | /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ 35 | /usr/include/bits/timex.h /usr/include/bits/setjmp.h \ 36 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_eal.h \ 37 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_config.h \ 38 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_compat.h \ 39 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_per_lcore.h \ 40 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_bus.h \ 41 | /usr/include/sys/queue.h \ 42 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_log.h \ 43 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_common.h \ 44 | /usr/include/ctype.h /usr/include/errno.h /usr/include/bits/errno.h \ 45 | /usr/include/linux/errno.h /usr/include/asm/errno.h \ 46 | /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ 47 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include-fixed/limits.h \ 48 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include-fixed/syslimits.h \ 49 | /usr/include/limits.h /usr/include/bits/posix1_lim.h \ 50 | /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ 51 | /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ 52 | /media/dpdk-stable-19.11.12/lib/librte_eal/linux/eal/include/rte_os.h \ 53 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_dev.h \ 54 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pci_dev_feature_defs.h \ 55 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ethdev.h \ 56 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_interrupts.h \ 57 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_eal_interrupts.h \ 58 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_devargs.h \ 59 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_errno.h \ 60 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ether.h \ 61 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_memcpy.h \ 62 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_vect.h \ 63 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_vect.h \ 64 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/x86intrin.h \ 65 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/ia32intrin.h \ 66 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/mmintrin.h \ 67 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/xmmintrin.h \ 68 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/mm_malloc.h \ 69 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/emmintrin.h \ 70 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/pmmintrin.h \ 71 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/tmmintrin.h \ 72 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/ammintrin.h \ 73 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/smmintrin.h \ 74 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/popcntintrin.h \ 75 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/wmmintrin.h \ 76 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/immintrin.h \ 77 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avxintrin.h \ 78 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx2intrin.h \ 79 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512fintrin.h \ 80 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512erintrin.h \ 81 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512pfintrin.h \ 82 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512cdintrin.h \ 83 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512vlintrin.h \ 84 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512bwintrin.h \ 85 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512dqintrin.h \ 86 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512vlbwintrin.h \ 87 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512vldqintrin.h \ 88 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512ifmaintrin.h \ 89 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512ifmavlintrin.h \ 90 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512vbmiintrin.h \ 91 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512vbmivlintrin.h \ 92 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/shaintrin.h \ 93 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/lzcntintrin.h \ 94 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/bmiintrin.h \ 95 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/bmi2intrin.h \ 96 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/fmaintrin.h \ 97 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/f16cintrin.h \ 98 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/rtmintrin.h \ 99 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/xtestintrin.h \ 100 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/mm3dnow.h \ 101 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/prfchwintrin.h \ 102 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/fma4intrin.h \ 103 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/xopintrin.h \ 104 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/lwpintrin.h \ 105 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/tbmintrin.h \ 106 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/rdseedintrin.h \ 107 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/fxsrintrin.h \ 108 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/xsaveintrin.h \ 109 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/xsaveoptintrin.h \ 110 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/adxintrin.h \ 111 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/clwbintrin.h \ 112 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/pcommitintrin.h \ 113 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/clflushoptintrin.h \ 114 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/xsavesintrin.h \ 115 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/xsavecintrin.h \ 116 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/mwaitxintrin.h \ 117 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_random.h \ 118 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf.h \ 119 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mempool.h \ 120 | /usr/include/inttypes.h \ 121 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_spinlock.h \ 122 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_spinlock.h \ 123 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_lcore.h \ 124 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_launch.h \ 125 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pause.h \ 126 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_pause.h \ 127 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_rtm.h \ 128 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_cpuflags.h \ 129 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h \ 130 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_branch_prediction.h \ 131 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_common.h \ 132 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pause.h \ 133 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_cycles.h \ 134 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_cycles.h \ 135 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_debug.h \ 136 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_log.h \ 137 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_atomic.h \ 138 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_atomic.h \ 139 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_atomic_64.h \ 140 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_branch_prediction.h \ 141 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_memory.h \ 142 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_fbarray.h \ 143 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_rwlock.h \ 144 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_rwlock.h \ 145 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_spinlock.h \ 146 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ring.h \ 147 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_memzone.h \ 148 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ring_generic.h \ 149 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_prefetch.h \ 150 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_prefetch.h \ 151 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_byteorder.h \ 152 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_byteorder.h \ 153 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_byteorder_64.h \ 154 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf_ptype.h \ 155 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf_core.h \ 156 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_atomic.h \ 157 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_dev_info.h \ 158 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_eth_ctrl.h \ 159 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_flow.h \ 160 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_arp.h \ 161 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_icmp.h \ 162 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ip.h \ 163 | /usr/include/netinet/ip.h \ 164 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_sctp.h \ 165 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_tcp.h \ 166 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_udp.h \ 167 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_esp.h \ 168 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_higig.h \ 169 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf_dyn.h \ 170 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ethdev.h \ 171 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ethdev_core.h \ 172 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_flow.h \ 173 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_malloc.h \ 174 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_timer.h \ 175 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_kni.h \ 176 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pci.h \ 177 | /media/dpdk-stable-19.11.12/lib/librte_eal/linux/eal/include/rte_kni_common.h 178 | -------------------------------------------------------------------------------- /build/.tcp.o.d.tmp: -------------------------------------------------------------------------------- 1 | tcp.o: /mnt/hj/codeTest/stack_finaly/DPDK-TCP-UDP_Protocol_Stack/tcp.c \ 2 | /usr/include/stdc-predef.h \ 3 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_config.h \ 4 | /mnt/hj/codeTest/stack_finaly/DPDK-TCP-UDP_Protocol_Stack/tcp.h \ 5 | /mnt/hj/codeTest/stack_finaly/DPDK-TCP-UDP_Protocol_Stack/common.h \ 6 | /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ 7 | /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 8 | /usr/include/gnu/stubs-64.h \ 9 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/stddef.h \ 10 | /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 11 | /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 12 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/stdarg.h \ 13 | /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 14 | /usr/include/stdlib.h /usr/include/bits/waitflags.h \ 15 | /usr/include/bits/waitstatus.h /usr/include/endian.h \ 16 | /usr/include/bits/endian.h /usr/include/bits/byteswap.h \ 17 | /usr/include/bits/byteswap-16.h /usr/include/xlocale.h \ 18 | /usr/include/sys/types.h /usr/include/time.h /usr/include/sys/select.h \ 19 | /usr/include/bits/select.h /usr/include/bits/sigset.h \ 20 | /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ 21 | /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ 22 | /usr/include/bits/stdlib-float.h /usr/include/math.h \ 23 | /usr/include/bits/huge_val.h /usr/include/bits/huge_valf.h \ 24 | /usr/include/bits/huge_vall.h /usr/include/bits/inf.h \ 25 | /usr/include/bits/nan.h /usr/include/bits/mathdef.h \ 26 | /usr/include/bits/mathcalls.h /usr/include/string.h \ 27 | /usr/include/arpa/inet.h /usr/include/netinet/in.h \ 28 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/stdint.h \ 29 | /usr/include/stdint.h /usr/include/bits/wchar.h \ 30 | /usr/include/sys/socket.h /usr/include/sys/uio.h /usr/include/bits/uio.h \ 31 | /usr/include/bits/socket.h /usr/include/bits/socket_type.h \ 32 | /usr/include/bits/sockaddr.h /usr/include/asm/socket.h \ 33 | /usr/include/asm-generic/socket.h /usr/include/asm/sockios.h \ 34 | /usr/include/asm-generic/sockios.h /usr/include/bits/in.h \ 35 | /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ 36 | /usr/include/bits/timex.h /usr/include/bits/setjmp.h \ 37 | /mnt/hj/codeTest/stack_finaly/DPDK-TCP-UDP_Protocol_Stack/nty_tree.h \ 38 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_eal.h \ 39 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_config.h \ 40 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_compat.h \ 41 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_per_lcore.h \ 42 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_bus.h \ 43 | /usr/include/sys/queue.h \ 44 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_log.h \ 45 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_common.h \ 46 | /usr/include/ctype.h /usr/include/errno.h /usr/include/bits/errno.h \ 47 | /usr/include/linux/errno.h /usr/include/asm/errno.h \ 48 | /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ 49 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/limits.h \ 50 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/syslimits.h \ 51 | /usr/include/limits.h /usr/include/bits/posix1_lim.h \ 52 | /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ 53 | /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ 54 | /media/dpdk-stable-19.11.12/lib/librte_eal/linux/eal/include/rte_os.h \ 55 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_dev.h \ 56 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pci_dev_feature_defs.h \ 57 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ethdev.h \ 58 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_interrupts.h \ 59 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_eal_interrupts.h \ 60 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_devargs.h \ 61 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_errno.h \ 62 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ether.h \ 63 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_memcpy.h \ 64 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_vect.h \ 65 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_vect.h \ 66 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/x86intrin.h \ 67 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/ia32intrin.h \ 68 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/immintrin.h \ 69 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/mmintrin.h \ 70 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/xmmintrin.h \ 71 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/mm_malloc.h \ 72 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/emmintrin.h \ 73 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/pmmintrin.h \ 74 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/tmmintrin.h \ 75 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/smmintrin.h \ 76 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/popcntintrin.h \ 77 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/wmmintrin.h \ 78 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/fxsrintrin.h \ 79 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/xsaveintrin.h \ 80 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/xsaveoptintrin.h \ 81 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/xsavesintrin.h \ 82 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/xsavecintrin.h \ 83 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avxintrin.h \ 84 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx2intrin.h \ 85 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512fintrin.h \ 86 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512erintrin.h \ 87 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512pfintrin.h \ 88 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512cdintrin.h \ 89 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vlintrin.h \ 90 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512bwintrin.h \ 91 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512dqintrin.h \ 92 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vlbwintrin.h \ 93 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vldqintrin.h \ 94 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512ifmaintrin.h \ 95 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512ifmavlintrin.h \ 96 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vbmiintrin.h \ 97 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vbmivlintrin.h \ 98 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx5124fmapsintrin.h \ 99 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx5124vnniwintrin.h \ 100 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vpopcntdqintrin.h \ 101 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vbmi2intrin.h \ 102 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vbmi2vlintrin.h \ 103 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vnniintrin.h \ 104 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vnnivlintrin.h \ 105 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512vpopcntdqvlintrin.h \ 106 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/avx512bitalgintrin.h \ 107 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/shaintrin.h \ 108 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/lzcntintrin.h \ 109 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/bmiintrin.h \ 110 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/bmi2intrin.h \ 111 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/fmaintrin.h \ 112 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/f16cintrin.h \ 113 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/rtmintrin.h \ 114 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/xtestintrin.h \ 115 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/cetintrin.h \ 116 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/gfniintrin.h \ 117 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/vaesintrin.h \ 118 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/vpclmulqdqintrin.h \ 119 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/movdirintrin.h \ 120 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/sgxintrin.h \ 121 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/pconfigintrin.h \ 122 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/waitpkgintrin.h \ 123 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/cldemoteintrin.h \ 124 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/rdseedintrin.h \ 125 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/prfchwintrin.h \ 126 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/adxintrin.h \ 127 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/clwbintrin.h \ 128 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/clflushoptintrin.h \ 129 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/wbnoinvdintrin.h \ 130 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/pkuintrin.h \ 131 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/mm3dnow.h \ 132 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/fma4intrin.h \ 133 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/ammintrin.h \ 134 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/xopintrin.h \ 135 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/lwpintrin.h \ 136 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/tbmintrin.h \ 137 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/mwaitxintrin.h \ 138 | /opt/rh/devtoolset-9/root/usr/lib/gcc/x86_64-redhat-linux/9/include/clzerointrin.h \ 139 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_random.h \ 140 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf.h \ 141 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mempool.h \ 142 | /usr/include/inttypes.h \ 143 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_spinlock.h \ 144 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_spinlock.h \ 145 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_lcore.h \ 146 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_launch.h \ 147 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pause.h \ 148 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_pause.h \ 149 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_rtm.h \ 150 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_cpuflags.h \ 151 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h \ 152 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_branch_prediction.h \ 153 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_common.h \ 154 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pause.h \ 155 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_cycles.h \ 156 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_cycles.h \ 157 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_debug.h \ 158 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_log.h \ 159 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_atomic.h \ 160 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_atomic.h \ 161 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_atomic_64.h \ 162 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_branch_prediction.h \ 163 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_memory.h \ 164 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_fbarray.h \ 165 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_rwlock.h \ 166 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_rwlock.h \ 167 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_spinlock.h \ 168 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ring.h \ 169 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_memzone.h \ 170 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ring_generic.h \ 171 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_prefetch.h \ 172 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_prefetch.h \ 173 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_byteorder.h \ 174 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_byteorder.h \ 175 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_byteorder_64.h \ 176 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf_ptype.h \ 177 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf_core.h \ 178 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_atomic.h \ 179 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_dev_info.h \ 180 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_eth_ctrl.h \ 181 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_flow.h \ 182 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_arp.h \ 183 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_icmp.h \ 184 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ip.h \ 185 | /usr/include/netinet/ip.h \ 186 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_sctp.h \ 187 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_tcp.h \ 188 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_udp.h \ 189 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_esp.h \ 190 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_higig.h \ 191 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf_dyn.h \ 192 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ethdev.h \ 193 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ethdev_core.h \ 194 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_flow.h \ 195 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_malloc.h \ 196 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_timer.h \ 197 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_kni.h \ 198 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pci.h \ 199 | /media/dpdk-stable-19.11.12/lib/librte_eal/linux/eal/include/rte_kni_common.h 200 | -------------------------------------------------------------------------------- /build/.test.cmd: -------------------------------------------------------------------------------- 1 | cmd_test = gcc -o test -m64 -pthread -I/media/dpdk-stable-19.11.12/lib/librte_eal/linux/eal/include -march=native -DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_AES -DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX -DRTE_MACHINE_CPUFLAG_RDRAND -DRTE_MACHINE_CPUFLAG_RDSEED -DRTE_MACHINE_CPUFLAG_FSGSBASE -DRTE_MACHINE_CPUFLAG_F16C -DRTE_MACHINE_CPUFLAG_AVX2 -I/mnt/hj/codeTest/test_netfamily/build/include -DRTE_USE_FUNCTION_VERSIONING -I/media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include -include /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_config.h -D_GNU_SOURCE -Wall -g -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -Wformat=0 netfamily.o common.o tcp.o udp.o -Wl,-lnspsmapi -Wl,-lpthread -L/media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/lib -Wl,-lrte_flow_classify -Wl,--whole-archive -Wl,-lrte_pipeline -Wl,--no-whole-archive -Wl,--whole-archive -Wl,-lrte_table -Wl,--no-whole-archive -Wl,--whole-archive -Wl,-lrte_port -Wl,--no-whole-archive -Wl,-lrte_pdump -Wl,-lrte_distributor -Wl,-lrte_ip_frag -Wl,-lrte_meter -Wl,-lrte_fib -Wl,-lrte_rib -Wl,-lrte_lpm -Wl,-lrte_acl -Wl,-lrte_jobstats -Wl,-lrte_metrics -Wl,-lrte_bitratestats -Wl,-lrte_latencystats -Wl,-lrte_power -Wl,-lrte_efd -Wl,-lrte_bpf -Wl,-lrte_ipsec -Wl,--whole-archive -Wl,-lrte_cfgfile -Wl,-lrte_gro -Wl,-lrte_gso -Wl,-lrte_hash -Wl,-lrte_member -Wl,-lrte_vhost -Wl,-lrte_kvargs -Wl,-lrte_mbuf -Wl,-lrte_net -Wl,-lrte_ethdev -Wl,-lrte_bbdev -Wl,-lrte_cryptodev -Wl,-lrte_security -Wl,-lrte_compressdev -Wl,-lrte_eventdev -Wl,-lrte_rawdev -Wl,-lrte_timer -Wl,-lrte_mempool -Wl,-lrte_stack -Wl,-lrte_mempool_ring -Wl,-lrte_mempool_octeontx2 -Wl,-lrte_ring -Wl,-lrte_pci -Wl,-lrte_eal -Wl,-lrte_cmdline -Wl,-lrte_reorder -Wl,-lrte_sched -Wl,-lrte_rcu -Wl,-lrte_kni -Wl,-lrte_common_cpt -Wl,-lrte_common_octeontx -Wl,-lrte_common_octeontx2 -Wl,-lrte_common_dpaax -Wl,-lrte_bus_pci -Wl,-lrte_bus_vdev -Wl,-lrte_bus_dpaa -Wl,-lrte_bus_fslmc -Wl,-lrte_mempool_bucket -Wl,-lrte_mempool_stack -Wl,-lrte_mempool_dpaa -Wl,-lrte_mempool_dpaa2 -Wl,-lrte_pmd_af_packet -Wl,-lrte_pmd_ark -Wl,-lrte_pmd_atlantic -Wl,-lrte_pmd_avp -Wl,-lrte_pmd_axgbe -Wl,-lrte_pmd_bnxt -Wl,-lrte_pmd_bond -Wl,-lrte_pmd_cxgbe -Wl,-lrte_pmd_dpaa -Wl,-lrte_pmd_dpaa2 -Wl,-lrte_pmd_e1000 -Wl,-lrte_pmd_ena -Wl,-lrte_pmd_enetc -Wl,-lrte_pmd_enic -Wl,-lrte_pmd_fm10k -Wl,-lrte_pmd_failsafe -Wl,-lrte_pmd_hinic -Wl,-lrte_pmd_hns3 -Wl,-lrte_pmd_i40e -Wl,-lrte_pmd_iavf -Wl,-lrte_pmd_ice -Wl,-lrte_pmd_ixgbe -Wl,-lrte_pmd_kni -Wl,-lrte_pmd_lio -Wl,-lrte_pmd_memif -Wl,-lrte_pmd_nfp -Wl,-lrte_pmd_null -Wl,-lrte_pmd_octeontx2 -Wl,-lrte_pmd_qede -Wl,-lrte_pmd_ring -Wl,-lrte_pmd_softnic -Wl,-lrte_pmd_sfc_efx -Wl,-lrte_pmd_tap -Wl,-lrte_pmd_thunderx_nicvf -Wl,-lrte_pmd_vdev_netvsc -Wl,-lrte_pmd_virtio -Wl,-lrte_pmd_vhost -Wl,-lrte_pmd_ifc -Wl,-lrte_pmd_vmxnet3_uio -Wl,-lrte_bus_vmbus -Wl,-lrte_pmd_netvsc -Wl,-lrte_pmd_bbdev_null -Wl,-lrte_pmd_bbdev_fpga_lte_fec -Wl,-lrte_pmd_bbdev_turbo_sw -Wl,-lrte_pmd_null_crypto -Wl,-lrte_pmd_nitrox -Wl,-lrte_pmd_octeontx_crypto -Wl,-lrte_pmd_octeontx2_crypto -Wl,-lrte_pmd_crypto_scheduler -Wl,-lrte_pmd_dpaa2_sec -Wl,-lrte_pmd_dpaa_sec -Wl,-lrte_pmd_caam_jr -Wl,-lrte_pmd_virtio_crypto -Wl,-lrte_pmd_octeontx_zip -Wl,-lrte_pmd_qat -Wl,-lrte_pmd_skeleton_event -Wl,-lrte_pmd_sw_event -Wl,-lrte_pmd_dsw_event -Wl,-lrte_pmd_octeontx_ssovf -Wl,-lrte_pmd_dpaa_event -Wl,-lrte_pmd_dpaa2_event -Wl,-lrte_mempool_octeontx -Wl,-lrte_pmd_octeontx -Wl,-lrte_pmd_octeontx2_event -Wl,-lrte_pmd_opdl_event -Wl,-lrte_rawdev_skeleton -Wl,-lrte_rawdev_dpaa2_cmdif -Wl,-lrte_rawdev_dpaa2_qdma -Wl,-lrte_bus_ifpga -Wl,-lrte_rawdev_ioat -Wl,-lrte_rawdev_ntb -Wl,-lrte_rawdev_octeontx2_dma -Wl,--no-whole-archive -Wl,-lrt -Wl,-lm -Wl,-lnuma -Wl,-ldl -Wl,-export-dynamic -Wl,-export-dynamic -L/mnt/hj/codeTest/test_netfamily/build/lib -L/media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/lib -Wl,--as-needed -Wl,-Map=test.map -Wl,--cref 2 | -------------------------------------------------------------------------------- /build/.test.o.cmd: -------------------------------------------------------------------------------- 1 | cmd_test.o = gcc -Wp,-MD,./.test.o.d.tmp -m64 -pthread -I/media/dpdk-stable-19.11.12/lib/librte_eal/linux/eal/include -march=native -DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_AES -DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX -DRTE_MACHINE_CPUFLAG_RDRAND -DRTE_MACHINE_CPUFLAG_RDSEED -DRTE_MACHINE_CPUFLAG_FSGSBASE -DRTE_MACHINE_CPUFLAG_F16C -DRTE_MACHINE_CPUFLAG_AVX2 -I/mnt/hj/codeTest/test_netfamily/build/include -DRTE_USE_FUNCTION_VERSIONING -I/media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include -include /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_config.h -D_GNU_SOURCE -Wall -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -Wformat=0 -o test.o -c /mnt/hj/codeTest/test_netfamily/test.c 2 | -------------------------------------------------------------------------------- /build/.test.o.d: -------------------------------------------------------------------------------- 1 | dep_test.o = /mnt/hj/codeTest/test_netfamily/test.c /usr/include/stdc-predef.h \ 2 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_config.h \ 3 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_eal.h \ 4 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/stdint.h \ 5 | /usr/include/stdint.h /usr/include/features.h /usr/include/sys/cdefs.h \ 6 | /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 7 | /usr/include/gnu/stubs-64.h /usr/include/bits/wchar.h \ 8 | /usr/include/sched.h /usr/include/bits/types.h \ 9 | /usr/include/bits/typesizes.h \ 10 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/stddef.h \ 11 | /usr/include/time.h /usr/include/bits/sched.h /usr/include/bits/time.h \ 12 | /usr/include/bits/timex.h /usr/include/xlocale.h \ 13 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_config.h \ 14 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_compat.h \ 15 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_per_lcore.h \ 16 | /usr/include/pthread.h /usr/include/endian.h /usr/include/bits/endian.h \ 17 | /usr/include/bits/byteswap.h /usr/include/bits/byteswap-16.h \ 18 | /usr/include/bits/pthreadtypes.h /usr/include/bits/setjmp.h \ 19 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_bus.h \ 20 | /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h \ 21 | /usr/include/wchar.h \ 22 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/stdarg.h \ 23 | /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 24 | /usr/include/sys/queue.h \ 25 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_log.h \ 26 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_common.h \ 27 | /usr/include/stdlib.h /usr/include/bits/waitflags.h \ 28 | /usr/include/bits/waitstatus.h /usr/include/sys/types.h \ 29 | /usr/include/sys/select.h /usr/include/bits/select.h \ 30 | /usr/include/bits/sigset.h /usr/include/sys/sysmacros.h \ 31 | /usr/include/alloca.h /usr/include/bits/stdlib-float.h \ 32 | /usr/include/ctype.h /usr/include/errno.h /usr/include/bits/errno.h \ 33 | /usr/include/linux/errno.h /usr/include/asm/errno.h \ 34 | /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ 35 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include-fixed/limits.h \ 36 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include-fixed/syslimits.h \ 37 | /usr/include/limits.h /usr/include/bits/posix1_lim.h \ 38 | /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ 39 | /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ 40 | /media/dpdk-stable-19.11.12/lib/librte_eal/linux/eal/include/rte_os.h \ 41 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_dev.h \ 42 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pci_dev_feature_defs.h \ 43 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ethdev.h \ 44 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_interrupts.h \ 45 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_eal_interrupts.h \ 46 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_devargs.h \ 47 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_errno.h \ 48 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ether.h \ 49 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_memcpy.h \ 50 | /usr/include/string.h \ 51 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_vect.h \ 52 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_vect.h \ 53 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/x86intrin.h \ 54 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/ia32intrin.h \ 55 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/mmintrin.h \ 56 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/xmmintrin.h \ 57 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/mm_malloc.h \ 58 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/emmintrin.h \ 59 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/pmmintrin.h \ 60 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/tmmintrin.h \ 61 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/ammintrin.h \ 62 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/smmintrin.h \ 63 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/popcntintrin.h \ 64 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/wmmintrin.h \ 65 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/immintrin.h \ 66 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avxintrin.h \ 67 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx2intrin.h \ 68 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512fintrin.h \ 69 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512erintrin.h \ 70 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512pfintrin.h \ 71 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512cdintrin.h \ 72 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512vlintrin.h \ 73 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512bwintrin.h \ 74 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512dqintrin.h \ 75 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512vlbwintrin.h \ 76 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512vldqintrin.h \ 77 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512ifmaintrin.h \ 78 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512ifmavlintrin.h \ 79 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512vbmiintrin.h \ 80 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512vbmivlintrin.h \ 81 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/shaintrin.h \ 82 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/lzcntintrin.h \ 83 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/bmiintrin.h \ 84 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/bmi2intrin.h \ 85 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/fmaintrin.h \ 86 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/f16cintrin.h \ 87 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/rtmintrin.h \ 88 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/xtestintrin.h \ 89 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/mm3dnow.h \ 90 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/prfchwintrin.h \ 91 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/fma4intrin.h \ 92 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/xopintrin.h \ 93 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/lwpintrin.h \ 94 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/tbmintrin.h \ 95 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/rdseedintrin.h \ 96 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/fxsrintrin.h \ 97 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/xsaveintrin.h \ 98 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/xsaveoptintrin.h \ 99 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/adxintrin.h \ 100 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/clwbintrin.h \ 101 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/pcommitintrin.h \ 102 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/clflushoptintrin.h \ 103 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/xsavesintrin.h \ 104 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/xsavecintrin.h \ 105 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/mwaitxintrin.h \ 106 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_random.h \ 107 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf.h \ 108 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mempool.h \ 109 | /usr/include/inttypes.h \ 110 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_spinlock.h \ 111 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_spinlock.h \ 112 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_lcore.h \ 113 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_launch.h \ 114 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pause.h \ 115 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_pause.h \ 116 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_rtm.h \ 117 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_cpuflags.h \ 118 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h \ 119 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_branch_prediction.h \ 120 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_common.h \ 121 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pause.h \ 122 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_cycles.h \ 123 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_cycles.h \ 124 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_debug.h \ 125 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_log.h \ 126 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_atomic.h \ 127 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_atomic.h \ 128 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_atomic_64.h \ 129 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_branch_prediction.h \ 130 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_memory.h \ 131 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_fbarray.h \ 132 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_rwlock.h \ 133 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_rwlock.h \ 134 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_spinlock.h \ 135 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ring.h \ 136 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_memzone.h \ 137 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ring_generic.h \ 138 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_prefetch.h \ 139 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_prefetch.h \ 140 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_byteorder.h \ 141 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_byteorder.h \ 142 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_byteorder_64.h \ 143 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf_ptype.h \ 144 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf_core.h \ 145 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_atomic.h \ 146 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_dev_info.h \ 147 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_eth_ctrl.h \ 148 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_flow.h \ 149 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_arp.h \ 150 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_icmp.h \ 151 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ip.h \ 152 | /usr/include/netinet/in.h /usr/include/sys/socket.h \ 153 | /usr/include/sys/uio.h /usr/include/bits/uio.h \ 154 | /usr/include/bits/socket.h /usr/include/bits/socket_type.h \ 155 | /usr/include/bits/sockaddr.h /usr/include/asm/socket.h \ 156 | /usr/include/asm-generic/socket.h /usr/include/asm/sockios.h \ 157 | /usr/include/asm-generic/sockios.h /usr/include/bits/in.h \ 158 | /usr/include/netinet/ip.h \ 159 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_sctp.h \ 160 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_tcp.h \ 161 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_udp.h \ 162 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_esp.h \ 163 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_higig.h \ 164 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf_dyn.h \ 165 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ethdev.h \ 166 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ethdev_core.h \ 167 | /usr/include/arpa/inet.h 168 | -------------------------------------------------------------------------------- /build/.udp.o.cmd: -------------------------------------------------------------------------------- 1 | cmd_udp.o = gcc -Wp,-MD,./.udp.o.d.tmp -m64 -pthread -I/media/dpdk-stable-19.11.12/lib/librte_eal/linux/eal/include -march=native -DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_AES -DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX -DRTE_MACHINE_CPUFLAG_RDRAND -DRTE_MACHINE_CPUFLAG_RDSEED -DRTE_MACHINE_CPUFLAG_FSGSBASE -DRTE_MACHINE_CPUFLAG_F16C -DRTE_MACHINE_CPUFLAG_AVX2 -I/mnt/hj/codeTest/test_netfamily/build/include -DRTE_USE_FUNCTION_VERSIONING -I/media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include -include /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_config.h -D_GNU_SOURCE -Wall -g -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -Wformat=0 -o udp.o -c /mnt/hj/codeTest/test_netfamily/udp.c 2 | -------------------------------------------------------------------------------- /build/.udp.o.d: -------------------------------------------------------------------------------- 1 | dep_udp.o = /mnt/hj/codeTest/test_netfamily/udp.c /usr/include/stdc-predef.h \ 2 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_config.h \ 3 | /mnt/hj/codeTest/test_netfamily/udp.h \ 4 | /mnt/hj/codeTest/test_netfamily/common.h /usr/include/stdio.h \ 5 | /usr/include/features.h /usr/include/sys/cdefs.h \ 6 | /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ 7 | /usr/include/gnu/stubs-64.h \ 8 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/stddef.h \ 9 | /usr/include/bits/types.h /usr/include/bits/typesizes.h \ 10 | /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ 11 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/stdarg.h \ 12 | /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ 13 | /usr/include/stdlib.h /usr/include/bits/waitflags.h \ 14 | /usr/include/bits/waitstatus.h /usr/include/endian.h \ 15 | /usr/include/bits/endian.h /usr/include/bits/byteswap.h \ 16 | /usr/include/bits/byteswap-16.h /usr/include/xlocale.h \ 17 | /usr/include/sys/types.h /usr/include/time.h /usr/include/sys/select.h \ 18 | /usr/include/bits/select.h /usr/include/bits/sigset.h \ 19 | /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ 20 | /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ 21 | /usr/include/bits/stdlib-float.h /usr/include/math.h \ 22 | /usr/include/bits/huge_val.h /usr/include/bits/huge_valf.h \ 23 | /usr/include/bits/huge_vall.h /usr/include/bits/inf.h \ 24 | /usr/include/bits/nan.h /usr/include/bits/mathdef.h \ 25 | /usr/include/bits/mathcalls.h /usr/include/string.h \ 26 | /usr/include/arpa/inet.h /usr/include/netinet/in.h \ 27 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/stdint.h \ 28 | /usr/include/stdint.h /usr/include/bits/wchar.h \ 29 | /usr/include/sys/socket.h /usr/include/sys/uio.h /usr/include/bits/uio.h \ 30 | /usr/include/bits/socket.h /usr/include/bits/socket_type.h \ 31 | /usr/include/bits/sockaddr.h /usr/include/asm/socket.h \ 32 | /usr/include/asm-generic/socket.h /usr/include/asm/sockios.h \ 33 | /usr/include/asm-generic/sockios.h /usr/include/bits/in.h \ 34 | /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ 35 | /usr/include/bits/timex.h /usr/include/bits/setjmp.h \ 36 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_eal.h \ 37 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_config.h \ 38 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_compat.h \ 39 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_per_lcore.h \ 40 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_bus.h \ 41 | /usr/include/sys/queue.h \ 42 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_log.h \ 43 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_common.h \ 44 | /usr/include/ctype.h /usr/include/errno.h /usr/include/bits/errno.h \ 45 | /usr/include/linux/errno.h /usr/include/asm/errno.h \ 46 | /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ 47 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include-fixed/limits.h \ 48 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include-fixed/syslimits.h \ 49 | /usr/include/limits.h /usr/include/bits/posix1_lim.h \ 50 | /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ 51 | /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ 52 | /media/dpdk-stable-19.11.12/lib/librte_eal/linux/eal/include/rte_os.h \ 53 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_dev.h \ 54 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pci_dev_feature_defs.h \ 55 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ethdev.h \ 56 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_interrupts.h \ 57 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_eal_interrupts.h \ 58 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_devargs.h \ 59 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_errno.h \ 60 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ether.h \ 61 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_memcpy.h \ 62 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_vect.h \ 63 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_vect.h \ 64 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/x86intrin.h \ 65 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/ia32intrin.h \ 66 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/mmintrin.h \ 67 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/xmmintrin.h \ 68 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/mm_malloc.h \ 69 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/emmintrin.h \ 70 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/pmmintrin.h \ 71 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/tmmintrin.h \ 72 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/ammintrin.h \ 73 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/smmintrin.h \ 74 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/popcntintrin.h \ 75 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/wmmintrin.h \ 76 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/immintrin.h \ 77 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avxintrin.h \ 78 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx2intrin.h \ 79 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512fintrin.h \ 80 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512erintrin.h \ 81 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512pfintrin.h \ 82 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512cdintrin.h \ 83 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512vlintrin.h \ 84 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512bwintrin.h \ 85 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512dqintrin.h \ 86 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512vlbwintrin.h \ 87 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512vldqintrin.h \ 88 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512ifmaintrin.h \ 89 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512ifmavlintrin.h \ 90 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512vbmiintrin.h \ 91 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/avx512vbmivlintrin.h \ 92 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/shaintrin.h \ 93 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/lzcntintrin.h \ 94 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/bmiintrin.h \ 95 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/bmi2intrin.h \ 96 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/fmaintrin.h \ 97 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/f16cintrin.h \ 98 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/rtmintrin.h \ 99 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/xtestintrin.h \ 100 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/mm3dnow.h \ 101 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/prfchwintrin.h \ 102 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/fma4intrin.h \ 103 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/xopintrin.h \ 104 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/lwpintrin.h \ 105 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/tbmintrin.h \ 106 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/rdseedintrin.h \ 107 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/fxsrintrin.h \ 108 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/xsaveintrin.h \ 109 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/xsaveoptintrin.h \ 110 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/adxintrin.h \ 111 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/clwbintrin.h \ 112 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/pcommitintrin.h \ 113 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/clflushoptintrin.h \ 114 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/xsavesintrin.h \ 115 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/xsavecintrin.h \ 116 | /usr/local/gcc/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/mwaitxintrin.h \ 117 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_random.h \ 118 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf.h \ 119 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mempool.h \ 120 | /usr/include/inttypes.h \ 121 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_spinlock.h \ 122 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_spinlock.h \ 123 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_lcore.h \ 124 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_launch.h \ 125 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pause.h \ 126 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_pause.h \ 127 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_rtm.h \ 128 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_cpuflags.h \ 129 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h \ 130 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_branch_prediction.h \ 131 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_common.h \ 132 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pause.h \ 133 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_cycles.h \ 134 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_cycles.h \ 135 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_debug.h \ 136 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_log.h \ 137 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_atomic.h \ 138 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_atomic.h \ 139 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_atomic_64.h \ 140 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_branch_prediction.h \ 141 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_memory.h \ 142 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_fbarray.h \ 143 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_rwlock.h \ 144 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_rwlock.h \ 145 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_spinlock.h \ 146 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ring.h \ 147 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_memzone.h \ 148 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ring_generic.h \ 149 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_prefetch.h \ 150 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_prefetch.h \ 151 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_byteorder.h \ 152 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_byteorder.h \ 153 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_byteorder_64.h \ 154 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf_ptype.h \ 155 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf_core.h \ 156 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/generic/rte_atomic.h \ 157 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_dev_info.h \ 158 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_eth_ctrl.h \ 159 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_flow.h \ 160 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_arp.h \ 161 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_icmp.h \ 162 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ip.h \ 163 | /usr/include/netinet/ip.h \ 164 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_sctp.h \ 165 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_tcp.h \ 166 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_udp.h \ 167 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_esp.h \ 168 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_higig.h \ 169 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_mbuf_dyn.h \ 170 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ethdev.h \ 171 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_ethdev_core.h \ 172 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_flow.h \ 173 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_malloc.h \ 174 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_timer.h \ 175 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_kni.h \ 176 | /media/dpdk-stable-19.11.12/x86_64-native-linuxapp-gcc/include/rte_pci.h \ 177 | /media/dpdk-stable-19.11.12/lib/librte_eal/linux/eal/include/rte_kni_common.h 178 | -------------------------------------------------------------------------------- /build/_install: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hjlogzw/DPDK-TCP-UDP_Protocol_Stack/31022822034b536466dc6dbc1c1dab8ba8dd2234/build/_install -------------------------------------------------------------------------------- /build/_postbuild: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hjlogzw/DPDK-TCP-UDP_Protocol_Stack/31022822034b536466dc6dbc1c1dab8ba8dd2234/build/_postbuild -------------------------------------------------------------------------------- /build/_postinstall: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hjlogzw/DPDK-TCP-UDP_Protocol_Stack/31022822034b536466dc6dbc1c1dab8ba8dd2234/build/_postinstall -------------------------------------------------------------------------------- /build/_preinstall: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hjlogzw/DPDK-TCP-UDP_Protocol_Stack/31022822034b536466dc6dbc1c1dab8ba8dd2234/build/_preinstall -------------------------------------------------------------------------------- /build/app/test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hjlogzw/DPDK-TCP-UDP_Protocol_Stack/31022822034b536466dc6dbc1c1dab8ba8dd2234/build/app/test -------------------------------------------------------------------------------- /build/common.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hjlogzw/DPDK-TCP-UDP_Protocol_Stack/31022822034b536466dc6dbc1c1dab8ba8dd2234/build/common.o -------------------------------------------------------------------------------- /build/netfamily.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hjlogzw/DPDK-TCP-UDP_Protocol_Stack/31022822034b536466dc6dbc1c1dab8ba8dd2234/build/netfamily.o -------------------------------------------------------------------------------- /build/tcp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hjlogzw/DPDK-TCP-UDP_Protocol_Stack/31022822034b536466dc6dbc1c1dab8ba8dd2234/build/tcp.o -------------------------------------------------------------------------------- /build/test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hjlogzw/DPDK-TCP-UDP_Protocol_Stack/31022822034b536466dc6dbc1c1dab8ba8dd2234/build/test -------------------------------------------------------------------------------- /build/test.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hjlogzw/DPDK-TCP-UDP_Protocol_Stack/31022822034b536466dc6dbc1c1dab8ba8dd2234/build/test.o -------------------------------------------------------------------------------- /build/udp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hjlogzw/DPDK-TCP-UDP_Protocol_Stack/31022822034b536466dc6dbc1c1dab8ba8dd2234/build/udp.o -------------------------------------------------------------------------------- /common.c: -------------------------------------------------------------------------------- 1 | #include "common.h" 2 | #include "udp.h" 3 | #include "tcp.h" 4 | 5 | 6 | void dbg_print(char *info, unsigned char *dat, int dat_len) 7 | { 8 | int i; 9 | 10 | printf("\n%s:%d\n", info, dat_len); 11 | for (i = 0; i < dat_len; i++) 12 | { 13 | if (i && (i % 16 == 0)) 14 | printf("\n"); 15 | printf("%02x ", dat[i]); 16 | } 17 | printf("\n"); 18 | } 19 | 20 | struct tcp_table *tcpInstance(void) 21 | { 22 | if (g_pstTcpTbl == NULL) 23 | { 24 | g_pstTcpTbl = rte_malloc("tcp_table", sizeof(struct tcp_table), 0); 25 | memset(g_pstTcpTbl, 0, sizeof(struct tcp_table)); 26 | } 27 | return g_pstTcpTbl; 28 | } 29 | 30 | // todo:分割establish和listen为两个函数 31 | struct tcp_stream * tcp_stream_search(uint32_t sip, uint32_t dip, uint16_t sport, uint16_t dport) 32 | { 33 | struct tcp_table *pstTable = tcpInstance(); 34 | struct tcp_stream *iter = NULL; 35 | 36 | for (iter = pstTable->tcb_set; iter != NULL; iter = iter->next) // established 37 | { 38 | if (iter->sip == sip && iter->dip == dip && 39 | iter->sport == sport && iter->dport == dport) 40 | { 41 | return iter; 42 | } 43 | 44 | } 45 | 46 | for (iter = pstTable->tcb_set; iter != NULL; iter = iter->next) 47 | { 48 | if (iter->dport == dport && iter->status == TCP_STATUS_LISTEN) // listen 49 | { 50 | return iter; 51 | } 52 | } 53 | 54 | return NULL; 55 | } 56 | 57 | // 从全连接队列中取 58 | static struct tcp_stream *get_accept_tcb(uint16_t dport) 59 | { 60 | struct tcp_stream *apt; 61 | for (apt = g_pstTcpTbl->tcb_set; apt != NULL; apt = apt->next) 62 | { 63 | if (dport == apt->dport && apt->fd == -1) 64 | { 65 | return apt; 66 | } 67 | } 68 | 69 | return NULL; 70 | } 71 | 72 | int get_fd_frombitmap(void) 73 | { 74 | int fd = D_DEFAULT_FD_NUM; 75 | for (; fd < D_MAX_FD_COUNT; fd ++) 76 | { 77 | if ((g_ucFdTable[fd/8] & (0x1 << (fd % 8))) == 0) 78 | { 79 | g_ucFdTable[fd/8] |= (0x1 << (fd % 8)); 80 | return fd; 81 | } 82 | } 83 | 84 | return -1; 85 | } 86 | 87 | int set_fd_frombitmap(int fd) 88 | { 89 | if (fd >= D_MAX_FD_COUNT) 90 | return -1; 91 | 92 | g_ucFdTable[fd/8] &= ~(0x1 << (fd % 8)); 93 | 94 | return 0; 95 | } 96 | 97 | struct localhost *get_hostinfo_fromip_port(uint32_t dip, uint16_t port, unsigned char proto) 98 | { 99 | struct localhost *pstHost = NULL; 100 | 101 | for (pstHost = g_pstHost; pstHost != NULL; pstHost = pstHost->next) 102 | { 103 | if (dip == pstHost->localip && port == pstHost->localport && proto == pstHost->protocol) 104 | return pstHost; 105 | } 106 | 107 | return NULL; 108 | } 109 | 110 | // todo: 改成三个接口 111 | void* get_hostinfo_fromfd(int iSockFd) 112 | { 113 | struct localhost *pstHost = NULL; 114 | struct tcp_stream *pstStream = NULL; 115 | 116 | for (pstHost = g_pstHost; pstHost != NULL; pstHost = g_pstHost->next) 117 | { 118 | if (iSockFd == pstHost->fd) 119 | return pstHost; 120 | } 121 | 122 | for (pstStream = g_pstTcpTbl->tcb_set; pstStream != NULL; pstStream = pstStream->next) { 123 | if (iSockFd == pstStream->fd) { 124 | return pstStream; 125 | } 126 | } 127 | 128 | 129 | #if ENABLE_SINGLE_EPOLL 130 | 131 | struct eventpoll *ep = g_pstTcpTbl->ep; 132 | if (ep != NULL) 133 | { 134 | if (ep->fd == iSockFd) 135 | { 136 | return ep; 137 | } 138 | } 139 | 140 | #endif 141 | 142 | return NULL; 143 | } 144 | 145 | static struct arp_table *arp_table_instance(void) 146 | { 147 | if (g_pstArpTbl == NULL) 148 | { 149 | g_pstArpTbl = rte_malloc("arp table", sizeof(struct arp_table), 0); 150 | if (g_pstArpTbl == NULL) 151 | rte_exit(EXIT_FAILURE, "rte_malloc arp table failed\n"); 152 | 153 | memset(g_pstArpTbl, 0, sizeof(struct arp_table)); 154 | 155 | pthread_spin_init(&g_pstArpTbl->spinlock, PTHREAD_PROCESS_SHARED); 156 | } 157 | 158 | return g_pstArpTbl; 159 | } 160 | 161 | unsigned char* ng_get_dst_macaddr(uint32_t dip) 162 | { 163 | struct arp_entry *pstIter; 164 | struct arp_table *pstTbl = arp_table_instance(); 165 | 166 | int count = pstTbl->count; 167 | 168 | for (pstIter = pstTbl->entries; count-- != 0 && pstIter != NULL; pstIter = pstIter->next) 169 | { 170 | if (dip == pstIter->ip) 171 | return pstIter->hwaddr; 172 | } 173 | 174 | return NULL; 175 | } 176 | 177 | int ng_arp_entry_insert(uint32_t ip, unsigned char *mac) 178 | { 179 | struct arp_table *pstTbl = arp_table_instance(); 180 | struct arp_entry *pstEntry = NULL; 181 | unsigned char *pstHwaddr = NULL; 182 | 183 | pstHwaddr = ng_get_dst_macaddr(ip); 184 | if(pstHwaddr == NULL) 185 | { 186 | pstEntry = rte_malloc("arp_entry", sizeof(struct arp_entry), 0); 187 | if (pstEntry) 188 | { 189 | memset(pstEntry, 0, sizeof(struct arp_entry)); 190 | 191 | pstEntry->ip = ip; 192 | rte_memcpy(pstEntry->hwaddr, mac, RTE_ETHER_ADDR_LEN); 193 | pstEntry->type = 0; 194 | 195 | pthread_spin_lock(&pstTbl->spinlock); 196 | LL_ADD(pstEntry, pstTbl->entries); 197 | pstTbl->count ++; 198 | pthread_spin_unlock(&pstTbl->spinlock); 199 | } 200 | return 1; 201 | } 202 | 203 | return 0; 204 | } 205 | 206 | static int ng_encode_arp_pkt(unsigned char *msg, uint16_t opcode, unsigned char *dst_mac, 207 | uint32_t sip, uint32_t dip) 208 | { 209 | struct rte_ether_hdr *pstEth = NULL; 210 | struct rte_arp_hdr *pstArp = NULL; 211 | unsigned char aucMac[RTE_ETHER_ADDR_LEN] = {0x0}; 212 | 213 | // eth 214 | pstEth = (struct rte_ether_hdr*)msg; 215 | rte_memcpy(pstEth->s_addr.addr_bytes, &g_stCpuMac, RTE_ETHER_ADDR_LEN); 216 | if (!strncmp((const char *)dst_mac, (const char *)g_aucDefaultArpMac, RTE_ETHER_ADDR_LEN)) 217 | { 218 | rte_memcpy(pstEth->d_addr.addr_bytes, aucMac, RTE_ETHER_ADDR_LEN); 219 | } 220 | else 221 | { 222 | rte_memcpy(pstEth->d_addr.addr_bytes, dst_mac, RTE_ETHER_ADDR_LEN); 223 | } 224 | pstEth->ether_type = htons(RTE_ETHER_TYPE_ARP); 225 | 226 | // arp 227 | pstArp = (struct rte_arp_hdr *)(pstEth + 1); 228 | pstArp->arp_hardware = htons(1); // 硬件类型:1 以太网 229 | pstArp->arp_protocol = htons(RTE_ETHER_TYPE_IPV4); // 协议类型:0x0800 IP地址 230 | pstArp->arp_hlen = RTE_ETHER_ADDR_LEN; // 硬件地址长度:6 231 | pstArp->arp_plen = sizeof(uint32_t); // 协议地址长度:4 232 | pstArp->arp_opcode = htons(opcode); // OP 233 | 234 | rte_memcpy(pstArp->arp_data.arp_sha.addr_bytes, &g_stCpuMac, RTE_ETHER_ADDR_LEN); 235 | rte_memcpy(pstArp->arp_data.arp_tha.addr_bytes, dst_mac, RTE_ETHER_ADDR_LEN); 236 | 237 | pstArp->arp_data.arp_sip = sip; 238 | pstArp->arp_data.arp_tip = dip; 239 | 240 | return 0; 241 | } 242 | 243 | struct rte_mbuf *ng_send_arp(struct rte_mempool *mbuf_pool, uint16_t opcode, unsigned char *dst_mac, 244 | uint32_t sip, uint32_t dip) 245 | { 246 | const unsigned int uiTotalLen = sizeof(struct rte_ether_hdr) + sizeof(struct rte_arp_hdr); 247 | unsigned char *pucPktData; 248 | 249 | struct rte_mbuf *pstMbuf = rte_pktmbuf_alloc(mbuf_pool); 250 | if (!pstMbuf) 251 | rte_exit(EXIT_FAILURE, "ng_send_arp rte_pktmbuf_alloc\n"); 252 | 253 | pstMbuf->pkt_len = uiTotalLen; 254 | pstMbuf->data_len = uiTotalLen; 255 | 256 | pucPktData = rte_pktmbuf_mtod(pstMbuf, unsigned char *); 257 | ng_encode_arp_pkt(pucPktData, opcode, dst_mac, sip, dip); 258 | 259 | return pstMbuf; 260 | } 261 | 262 | int nsocket(__attribute__((unused)) int domain, int type, __attribute__((unused)) int protocol) 263 | { 264 | int iFd; 265 | struct localhost *pstHost; 266 | pthread_cond_t pctCond = PTHREAD_COND_INITIALIZER; 267 | pthread_mutex_t pmtMutex = PTHREAD_MUTEX_INITIALIZER; 268 | 269 | iFd = get_fd_frombitmap(); 270 | if(type == SOCK_DGRAM) // udp 271 | { 272 | pstHost = rte_malloc("localhost", sizeof(struct localhost), 0); 273 | if(pstHost == NULL) 274 | { 275 | printf("[%s][%d]: rte_malloc fail!\n", __FUNCTION__, __LINE__); 276 | return -1; 277 | } 278 | 279 | memset(pstHost, 0x00, sizeof(struct localhost)); 280 | pstHost->fd = iFd; 281 | pstHost->protocol = IPPROTO_UDP; 282 | pstHost->rcvbuf = rte_ring_create("recv buffer", D_RING_SIZE, rte_socket_id(), RING_F_SP_ENQ | RING_F_SC_DEQ); 283 | if (pstHost->rcvbuf == NULL) 284 | { 285 | printf("[%s][%d]: rte_ring_create fail!\n", __FUNCTION__, __LINE__); 286 | rte_free(pstHost); 287 | return -1; 288 | } 289 | pstHost->sndbuf = rte_ring_create("send buffer", D_RING_SIZE, rte_socket_id(), RING_F_SP_ENQ | RING_F_SC_DEQ); 290 | if (pstHost->sndbuf == NULL) 291 | { 292 | printf("[%s][%d]: rte_ring_create fail!\n", __FUNCTION__, __LINE__); 293 | rte_ring_free(pstHost->rcvbuf); 294 | rte_free(pstHost); 295 | return -1; 296 | } 297 | 298 | rte_memcpy(&pstHost->cond, &pctCond, sizeof(pthread_cond_t)); 299 | 300 | rte_memcpy(&pstHost->mutex, &pmtMutex, sizeof(pthread_mutex_t)); 301 | 302 | LL_ADD(pstHost, g_pstHost); 303 | } 304 | else if(type == SOCK_STREAM) // tcp 305 | { 306 | struct tcp_stream *pstStream = rte_malloc("tcp_stream", sizeof(struct tcp_stream), 0); 307 | if (pstStream == NULL) 308 | return -1; 309 | 310 | memset(pstStream, 0, sizeof(struct tcp_stream)); 311 | pstStream->fd = iFd; 312 | pstStream->protocol = IPPROTO_TCP; 313 | pstStream->next = pstStream->prev = NULL; 314 | 315 | pstStream->rcvbuf = rte_ring_create("tcp recv buffer", D_RING_SIZE, rte_socket_id(), RING_F_SP_ENQ | RING_F_SC_DEQ); 316 | if (pstStream->rcvbuf == NULL) 317 | { 318 | rte_free(pstStream); 319 | return -1; 320 | } 321 | pstStream->sndbuf = rte_ring_create("tcp send buffer", D_RING_SIZE, rte_socket_id(), RING_F_SP_ENQ | RING_F_SC_DEQ); 322 | if (pstStream->sndbuf == NULL) 323 | { 324 | rte_ring_free(pstStream->rcvbuf); 325 | rte_free(pstStream); 326 | return -1; 327 | } 328 | 329 | pthread_cond_t blank_cond = PTHREAD_COND_INITIALIZER; 330 | rte_memcpy(&pstStream->cond, &blank_cond, sizeof(pthread_cond_t)); 331 | 332 | pthread_mutex_t blank_mutex = PTHREAD_MUTEX_INITIALIZER; 333 | rte_memcpy(&pstStream->mutex, &blank_mutex, sizeof(pthread_mutex_t)); 334 | 335 | g_pstTcpTbl = tcpInstance(); 336 | LL_ADD(pstStream, g_pstTcpTbl->tcb_set); // todo :hash 337 | } 338 | 339 | return iFd; 340 | } 341 | 342 | int nbind(int sockfd, const struct sockaddr *addr, __attribute__((unused)) socklen_t addrlen) 343 | { 344 | void *info = NULL; 345 | 346 | info = get_hostinfo_fromfd(sockfd); 347 | if(info == NULL) 348 | return -1; 349 | 350 | struct localhost *pstHostInfo = (struct localhost *)info; 351 | if(pstHostInfo->protocol == IPPROTO_UDP) 352 | { 353 | const struct sockaddr_in *pstAddr = (const struct sockaddr_in *)addr; 354 | pstHostInfo->localport = pstAddr->sin_port; 355 | rte_memcpy(&pstHostInfo->localip, &pstAddr->sin_addr.s_addr, sizeof(uint32_t)); 356 | rte_memcpy(pstHostInfo->localmac, &g_stCpuMac, RTE_ETHER_ADDR_LEN); 357 | } 358 | else if(pstHostInfo->protocol == IPPROTO_TCP) 359 | { 360 | struct tcp_stream* pstStream = (struct tcp_stream*)pstHostInfo; 361 | 362 | const struct sockaddr_in *pstAddr = (const struct sockaddr_in *)addr; 363 | pstStream->dport = pstAddr->sin_port; 364 | rte_memcpy(&pstStream->dip, &pstAddr->sin_addr.s_addr, sizeof(uint32_t)); 365 | rte_memcpy(pstStream->localmac, &g_stCpuMac, RTE_ETHER_ADDR_LEN); 366 | 367 | pstStream->status = TCP_STATUS_CLOSED; 368 | } 369 | 370 | return 0; 371 | } 372 | 373 | int nlisten(int sockfd, __attribute__((unused)) int backlog) 374 | { 375 | void *pstHostInfo = get_hostinfo_fromfd(sockfd); 376 | if (pstHostInfo == NULL) 377 | return -1; 378 | 379 | struct tcp_stream *pstStream = (struct tcp_stream *)pstHostInfo; 380 | if (pstStream->protocol == IPPROTO_TCP) 381 | { 382 | pstStream->status = TCP_STATUS_LISTEN; 383 | } 384 | 385 | return 0; 386 | } 387 | 388 | int naccept(int sockfd, struct sockaddr *addr, __attribute__((unused)) socklen_t *addrlen) 389 | { 390 | void *pstHostInfo = get_hostinfo_fromfd(sockfd); 391 | if (pstHostInfo == NULL) 392 | return -1; 393 | 394 | struct tcp_stream *pstStream = (struct tcp_stream *)pstHostInfo; 395 | if (pstStream->protocol == IPPROTO_TCP) 396 | { 397 | struct tcp_stream *pstAccept = NULL; 398 | 399 | pthread_mutex_lock(&pstStream->mutex); 400 | while((pstAccept = get_accept_tcb(pstStream->dport)) == NULL) 401 | { 402 | pthread_cond_wait(&pstStream->cond, &pstStream->mutex); 403 | } 404 | pthread_mutex_unlock(&pstStream->mutex); 405 | 406 | pstAccept->fd = get_fd_frombitmap(); 407 | 408 | struct sockaddr_in *saddr = (struct sockaddr_in *)addr; 409 | saddr->sin_port = pstAccept->sport; 410 | rte_memcpy(&saddr->sin_addr.s_addr, &pstAccept->sip, sizeof(uint32_t)); 411 | 412 | return pstAccept->fd; 413 | } 414 | 415 | return -1; 416 | } 417 | 418 | ssize_t nsend(int sockfd, const void *buf, size_t len,__attribute__((unused)) int flags) 419 | { 420 | unsigned int uiLength = 0; 421 | void *pstHostInfo = get_hostinfo_fromfd(sockfd); 422 | if (pstHostInfo == NULL) 423 | return -1; 424 | 425 | struct tcp_stream *pstStream = (struct tcp_stream *)pstHostInfo; 426 | if(pstStream->protocol == IPPROTO_TCP) 427 | { 428 | struct tcp_fragment *pstFragment = rte_malloc("tcp_fragment", sizeof(struct tcp_fragment), 0); 429 | if (pstFragment == NULL) 430 | { 431 | return -2; 432 | } 433 | 434 | memset(pstFragment, 0, sizeof(struct tcp_fragment)); 435 | pstFragment->dport = pstStream->sport; 436 | pstFragment->sport = pstStream->dport; 437 | pstFragment->acknum = pstStream->rcv_nxt; 438 | pstFragment->seqnum = pstStream->snd_nxt; 439 | pstFragment->tcp_flags = RTE_TCP_ACK_FLAG | RTE_TCP_PSH_FLAG; 440 | pstFragment->windows = D_TCP_INITIAL_WINDOW; 441 | pstFragment->hdrlen_off = 0x50; 442 | 443 | pstFragment->data = rte_malloc("unsigned char *", len + 1, 0); 444 | if (pstFragment->data == NULL) 445 | { 446 | rte_free(pstFragment); 447 | return -1; 448 | } 449 | memset(pstFragment->data, 0, len+1); 450 | 451 | rte_memcpy(pstFragment->data, buf, len); 452 | pstFragment->length = len; 453 | uiLength = pstFragment->length; 454 | 455 | puts("ready to send!"); 456 | rte_ring_mp_enqueue(pstStream->sndbuf, pstFragment); 457 | } 458 | 459 | return uiLength; 460 | } 461 | 462 | ssize_t nrecv(int sockfd, void *buf, size_t len, __attribute__((unused)) int flags) 463 | { 464 | ssize_t length = 0; 465 | void *pstHostInfo = get_hostinfo_fromfd(sockfd); 466 | if (pstHostInfo == NULL) 467 | return -1; 468 | 469 | struct tcp_stream *pstStream = (struct tcp_stream *)pstHostInfo; 470 | if(pstStream->protocol == IPPROTO_TCP) 471 | { 472 | struct tcp_fragment *pstFragment = NULL; 473 | int iRcvNum = 0; 474 | 475 | // 等待接收队列中的数据到来 476 | pthread_mutex_lock(&pstStream->mutex); 477 | while ((iRcvNum = rte_ring_mc_dequeue(pstStream->rcvbuf, (void **)&pstFragment)) < 0) 478 | { 479 | pthread_cond_wait(&pstStream->cond, &pstStream->mutex); 480 | } 481 | pthread_mutex_unlock(&pstStream->mutex); 482 | 483 | if (pstFragment->length > len) 484 | { 485 | rte_memcpy(buf, pstFragment->data, len); 486 | 487 | uint32_t i = 0; 488 | for(i = 0; i < pstFragment->length - len; i ++) 489 | { 490 | pstFragment->data[i] = pstFragment->data[len + i]; 491 | } 492 | pstFragment->length = pstFragment->length - len; 493 | length = pstFragment->length; 494 | 495 | rte_ring_mp_enqueue(pstStream->rcvbuf, pstFragment); 496 | } 497 | else if(pstFragment->length == 0) 498 | { 499 | rte_free(pstFragment); 500 | return 0; 501 | } 502 | else 503 | { 504 | rte_memcpy(buf, pstFragment->data, pstFragment->length); 505 | length = pstFragment->length; 506 | 507 | rte_free(pstFragment->data); 508 | pstFragment->data = NULL; 509 | 510 | rte_free(pstFragment); 511 | } 512 | } 513 | 514 | return length; 515 | } 516 | 517 | ssize_t nrecvfrom(int sockfd, void *buf, size_t len, __attribute__((unused)) int flags, 518 | struct sockaddr *src_addr, __attribute__((unused)) socklen_t *addrlen) 519 | { 520 | struct localhost *pstHostInfo = NULL; 521 | struct offload *pstOffLoad = NULL; 522 | struct sockaddr_in *pstAddr = NULL; 523 | unsigned char *pucPtr = NULL; 524 | int iLen = 0; 525 | int iRet = -1; 526 | 527 | pstHostInfo = (struct localhost *)get_hostinfo_fromfd(sockfd); 528 | if(pstHostInfo == NULL) 529 | return -1; 530 | 531 | pthread_mutex_lock(&pstHostInfo->mutex); 532 | while((iRet = rte_ring_mc_dequeue(pstHostInfo->rcvbuf, (void**)&pstOffLoad)) < 0) 533 | { 534 | pthread_cond_wait(&pstHostInfo->cond, &pstHostInfo->mutex); 535 | } 536 | pthread_mutex_unlock(&pstHostInfo->mutex); 537 | 538 | pstAddr = (struct sockaddr_in *)src_addr; 539 | pstAddr->sin_port = pstOffLoad->sport; 540 | rte_memcpy(&pstAddr->sin_addr.s_addr, &pstOffLoad->sip, sizeof(uint32_t)); 541 | 542 | if(len < pstOffLoad->length) 543 | { 544 | rte_memcpy(buf, pstOffLoad->data, len); 545 | 546 | pucPtr = rte_malloc("unsigned char *", pstOffLoad->length - len, 0); 547 | rte_memcpy(pucPtr, pstOffLoad->data + len, pstOffLoad->length - len); 548 | 549 | pstOffLoad->length -= len; 550 | rte_free(pstOffLoad->data); 551 | pstOffLoad->data = pucPtr; 552 | 553 | rte_ring_mp_enqueue(pstHostInfo->rcvbuf, pstOffLoad); 554 | 555 | return len; 556 | } 557 | 558 | iLen = pstOffLoad->length; 559 | rte_memcpy(buf, pstOffLoad->data, pstOffLoad->length); 560 | 561 | rte_free(pstOffLoad->data); 562 | rte_free(pstOffLoad); 563 | 564 | return iLen; 565 | } 566 | 567 | ssize_t nsendto(int sockfd, const void *buf, size_t len, __attribute__((unused)) int flags, 568 | const struct sockaddr *dest_addr, __attribute__((unused)) socklen_t addrlen) 569 | { 570 | struct localhost *pstHostInfo = NULL; 571 | struct offload *pstOffLoad = NULL; 572 | const struct sockaddr_in *pstAddr = (const struct sockaddr_in *)dest_addr; 573 | 574 | pstHostInfo = (struct localhost *)get_hostinfo_fromfd(sockfd); 575 | if(pstHostInfo == NULL) 576 | return -1; 577 | 578 | pstOffLoad = rte_malloc("offload", sizeof(struct offload), 0); 579 | if (pstOffLoad == NULL) 580 | return -1; 581 | 582 | pstOffLoad->dip = pstAddr->sin_addr.s_addr; 583 | pstOffLoad->dport = pstAddr->sin_port; 584 | pstOffLoad->sip = pstHostInfo->localip; 585 | pstOffLoad->sport = pstHostInfo->localport; 586 | pstOffLoad->length = len; 587 | 588 | 589 | struct in_addr addr; 590 | addr.s_addr = pstOffLoad->dip; 591 | printf("nsendto ---> src: %s:%d \n", inet_ntoa(addr), ntohs(pstOffLoad->dport)); 592 | 593 | 594 | pstOffLoad->data = rte_malloc("unsigned char *", len, 0); 595 | if (pstOffLoad->data == NULL) { 596 | rte_free(pstOffLoad); 597 | return -1; 598 | } 599 | 600 | rte_memcpy(pstOffLoad->data, buf, len); 601 | 602 | puts("rte_ring_mp_enqueue before !"); 603 | rte_ring_mp_enqueue(pstHostInfo->sndbuf, pstOffLoad); 604 | puts("rte_ring_mp_enqueue after !"); 605 | 606 | return len; 607 | } 608 | 609 | int nclose(int fd) 610 | { 611 | void *info = NULL; 612 | 613 | info = (struct localhost *)get_hostinfo_fromfd(fd); 614 | if(info == NULL) 615 | return -1; 616 | 617 | struct localhost *pstHostInfo = (struct localhost *)info; 618 | if(pstHostInfo->protocol == IPPROTO_UDP) 619 | { 620 | LL_REMOVE(pstHostInfo, g_pstHost); 621 | 622 | if (pstHostInfo->rcvbuf) 623 | rte_ring_free(pstHostInfo->rcvbuf); 624 | if (pstHostInfo->sndbuf) 625 | rte_ring_free(pstHostInfo->sndbuf); 626 | 627 | rte_free(pstHostInfo); 628 | 629 | set_fd_frombitmap(fd); 630 | } 631 | else if(pstHostInfo->protocol == IPPROTO_TCP) 632 | { 633 | struct tcp_stream *pstStream = (struct tcp_stream*)info; 634 | if (pstStream->status != TCP_STATUS_LISTEN) 635 | { 636 | struct tcp_fragment *pstFragment = rte_malloc("tcp_fragment", sizeof(struct tcp_fragment), 0); 637 | if (pstFragment == NULL) 638 | return -1; 639 | 640 | memset(pstFragment, 0x00, sizeof(struct tcp_fragment)); 641 | pstFragment->data = NULL; 642 | pstFragment->length = 0; 643 | pstFragment->sport = pstStream->dport; 644 | pstFragment->dport = pstStream->sport; 645 | 646 | pstFragment->seqnum = pstStream->snd_nxt; 647 | pstFragment->acknum = pstStream->rcv_nxt; 648 | 649 | pstFragment->tcp_flags = RTE_TCP_FIN_FLAG | RTE_TCP_ACK_FLAG; // 发送FIN 650 | pstFragment->windows = D_TCP_INITIAL_WINDOW; 651 | pstFragment->hdrlen_off = 0x50; 652 | 653 | rte_ring_mp_enqueue(pstStream->sndbuf, pstFragment); 654 | pstStream->status = TCP_STATUS_LAST_ACK; 655 | 656 | set_fd_frombitmap(fd); 657 | } 658 | else 659 | { 660 | LL_REMOVE(pstStream, g_pstTcpTbl->tcb_set); 661 | rte_free(pstStream); 662 | } 663 | } 664 | 665 | return 0; 666 | } 667 | 668 | #if ENABLE_SINGLE_EPOLL 669 | 670 | int epoll_event_callback(struct eventpoll *ep, int sockid, uint32_t event) 671 | { 672 | struct epitem tmp; 673 | tmp.sockfd = sockid; 674 | struct epitem *epi = RB_FIND(_epoll_rb_socket, &ep->rbr, &tmp); 675 | if (!epi) 676 | { 677 | printf("rbtree not exist\n"); 678 | return -1; 679 | } 680 | if (epi->rdy) 681 | { 682 | epi->event.events |= event; 683 | return 1; 684 | } 685 | 686 | printf("epoll_event_callback --> %d\n", epi->sockfd); 687 | 688 | pthread_spin_lock(&ep->lock); 689 | epi->rdy = 1; 690 | LIST_INSERT_HEAD(&ep->rdlist, epi, rdlink); 691 | ep->rdnum ++; 692 | pthread_spin_unlock(&ep->lock); 693 | 694 | pthread_mutex_lock(&ep->cdmtx); 695 | 696 | pthread_cond_signal(&ep->cond); 697 | pthread_mutex_unlock(&ep->cdmtx); 698 | } 699 | 700 | int nepoll_create(int size) 701 | { 702 | if (size <= 0) return -1; 703 | // epfd --> struct eventpoll 704 | int epfd = get_fd_frombitmap(); //tcp, udp 705 | 706 | struct eventpoll *ep = (struct eventpoll*)rte_malloc("eventpoll", sizeof(struct eventpoll), 0); 707 | if (!ep) 708 | { 709 | set_fd_frombitmap(epfd); 710 | return -1; 711 | } 712 | 713 | g_pstTcpTbl->ep = ep; 714 | 715 | ep->fd = epfd; 716 | ep->rbcnt = 0; 717 | RB_INIT(&ep->rbr); 718 | LIST_INIT(&ep->rdlist); 719 | 720 | if (pthread_mutex_init(&ep->mtx, NULL)) 721 | { 722 | rte_free(ep); 723 | set_fd_frombitmap(epfd); 724 | 725 | return -2; 726 | } 727 | 728 | if (pthread_mutex_init(&ep->cdmtx, NULL)) 729 | { 730 | pthread_mutex_destroy(&ep->mtx); 731 | rte_free(ep); 732 | set_fd_frombitmap(epfd); 733 | return -2; 734 | } 735 | 736 | if (pthread_cond_init(&ep->cond, NULL)) 737 | { 738 | pthread_mutex_destroy(&ep->cdmtx); 739 | pthread_mutex_destroy(&ep->mtx); 740 | rte_free(ep); 741 | set_fd_frombitmap(epfd); 742 | return -2; 743 | } 744 | 745 | if (pthread_spin_init(&ep->lock, PTHREAD_PROCESS_SHARED)) 746 | { 747 | pthread_cond_destroy(&ep->cond); 748 | pthread_mutex_destroy(&ep->cdmtx); 749 | pthread_mutex_destroy(&ep->mtx); 750 | rte_free(ep); 751 | 752 | set_fd_frombitmap(epfd); 753 | return -2; 754 | } 755 | 756 | return epfd; 757 | } 758 | 759 | int nepoll_ctl(int epfd, int op, int sockid, struct epoll_event *event) 760 | { 761 | struct eventpoll *ep = (struct eventpoll*)get_hostinfo_fromfd(epfd); 762 | if (!ep || (!event && op != EPOLL_CTL_DEL)) 763 | { 764 | errno = -EINVAL; 765 | return -1; 766 | } 767 | 768 | if (op == EPOLL_CTL_ADD) 769 | { 770 | pthread_mutex_lock(&ep->mtx); 771 | 772 | struct epitem tmp; 773 | tmp.sockfd = sockid; 774 | struct epitem *epi = RB_FIND(_epoll_rb_socket, &ep->rbr, &tmp); 775 | if (epi) 776 | { 777 | pthread_mutex_unlock(&ep->mtx); 778 | return -1; 779 | } 780 | 781 | epi = (struct epitem*)rte_malloc("epitem", sizeof(struct epitem), 0); 782 | if (!epi) 783 | { 784 | pthread_mutex_unlock(&ep->mtx); 785 | rte_errno = -ENOMEM; 786 | return -1; 787 | } 788 | 789 | epi->sockfd = sockid; 790 | memcpy(&epi->event, event, sizeof(struct epoll_event)); 791 | 792 | epi = RB_INSERT(_epoll_rb_socket, &ep->rbr, epi); 793 | 794 | ep->rbcnt ++; 795 | 796 | pthread_mutex_unlock(&ep->mtx); 797 | } 798 | else if(op == EPOLL_CTL_DEL) 799 | { 800 | pthread_mutex_lock(&ep->mtx); 801 | 802 | struct epitem tmp; 803 | tmp.sockfd = sockid; 804 | struct epitem *epi = RB_FIND(_epoll_rb_socket, &ep->rbr, &tmp); 805 | if (!epi) 806 | { 807 | pthread_mutex_unlock(&ep->mtx); 808 | return -1; 809 | } 810 | 811 | epi = RB_REMOVE(_epoll_rb_socket, &ep->rbr, epi); 812 | if (!epi) 813 | { 814 | pthread_mutex_unlock(&ep->mtx); 815 | return -1; 816 | } 817 | 818 | ep->rbcnt --; 819 | rte_free(epi); 820 | 821 | pthread_mutex_unlock(&ep->mtx); 822 | } 823 | else if (op == EPOLL_CTL_MOD) 824 | { 825 | struct epitem tmp; 826 | tmp.sockfd = sockid; 827 | struct epitem *epi = RB_FIND(_epoll_rb_socket, &ep->rbr, &tmp); 828 | if (epi) 829 | { 830 | epi->event.events = event->events; 831 | epi->event.events |= EPOLLERR | EPOLLHUP; 832 | } 833 | else 834 | { 835 | rte_errno = -ENOENT; 836 | return -1; 837 | } 838 | } 839 | 840 | return 0; 841 | } 842 | 843 | int nepoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout) 844 | { 845 | struct eventpoll *ep = (struct eventpoll*)get_hostinfo_fromfd(epfd);; 846 | if (!ep || !events || maxevents <= 0) 847 | { 848 | rte_errno = -EINVAL; 849 | return -1; 850 | } 851 | 852 | if (pthread_mutex_lock(&ep->cdmtx)) 853 | { 854 | if (rte_errno == EDEADLK) 855 | printf("epoll lock blocked\n"); 856 | } 857 | 858 | while (ep->rdnum == 0 && timeout != 0) 859 | { 860 | ep->waiting = 1; 861 | if (timeout > 0) 862 | { 863 | struct timespec deadline; 864 | 865 | clock_gettime(CLOCK_REALTIME, &deadline); 866 | if (timeout >= 1000) 867 | { 868 | int sec; 869 | sec = timeout / 1000; 870 | deadline.tv_sec += sec; 871 | timeout -= sec * 1000; 872 | } 873 | 874 | deadline.tv_nsec += timeout * 1000000; 875 | 876 | if (deadline.tv_nsec >= 1000000000) 877 | { 878 | deadline.tv_sec++; 879 | deadline.tv_nsec -= 1000000000; 880 | } 881 | 882 | int ret = pthread_cond_timedwait(&ep->cond, &ep->cdmtx, &deadline); 883 | if (ret && ret != ETIMEDOUT) 884 | { 885 | printf("pthread_cond_timewait\n"); 886 | 887 | pthread_mutex_unlock(&ep->cdmtx); 888 | 889 | return -1; 890 | } 891 | timeout = 0; 892 | } 893 | else if (timeout < 0) 894 | { 895 | int ret = pthread_cond_wait(&ep->cond, &ep->cdmtx); 896 | if (ret) 897 | { 898 | printf("pthread_cond_wait\n"); 899 | pthread_mutex_unlock(&ep->cdmtx); 900 | 901 | return -1; 902 | } 903 | } 904 | ep->waiting = 0; 905 | } 906 | 907 | pthread_mutex_unlock(&ep->cdmtx); 908 | 909 | pthread_spin_lock(&ep->lock); 910 | int cnt = 0; 911 | int num = (ep->rdnum > maxevents ? maxevents : ep->rdnum); 912 | int i = 0; 913 | 914 | while (num != 0 && !LIST_EMPTY(&ep->rdlist)) // EPOLLET 915 | { 916 | struct epitem *epi = LIST_FIRST(&ep->rdlist); 917 | LIST_REMOVE(epi, rdlink); 918 | epi->rdy = 0; 919 | 920 | memcpy(&events[i++], &epi->event, sizeof(struct epoll_event)); 921 | 922 | num --; 923 | cnt ++; 924 | ep->rdnum --; 925 | } 926 | pthread_spin_unlock(&ep->lock); 927 | 928 | return cnt; 929 | } 930 | 931 | 932 | #endif -------------------------------------------------------------------------------- /common.h: -------------------------------------------------------------------------------- 1 | #ifndef __COMMON_H__ 2 | #define __COMMON_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "nty_tree.h" 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #define D_PORT_ID 0 27 | 28 | #define D_MAX_PACKET_SIZE 2048 29 | #define D_RING_SIZE 1024 30 | #define D_BURST_SIZE 32 31 | 32 | #define D_DEFAULT_FD_NUM 3 33 | #define D_MAX_FD_COUNT 1024 34 | 35 | #define D_NUM_MBUFS (4096-1) 36 | #define D_UDP_BUFFER_SIZE 1024 37 | 38 | #define D_TCP_OPTION_LENGTH 10 39 | #define D_TCP_INITIAL_WINDOW 14600 40 | #define D_TCP_MAX_SEQ 0xffffffff 41 | #define D_TCP_BUFFER_SIZE 1024 42 | // 头插法 43 | #define LL_ADD(item, list) do \ 44 | { \ 45 | item->prev = NULL; \ 46 | item->next = list; \ 47 | if (list != NULL) list->prev = item; \ 48 | list = item; \ 49 | } while(0) 50 | 51 | #define LL_REMOVE(item, list) do \ 52 | { \ 53 | if (item->prev != NULL) item->prev->next = item->next; \ 54 | if (item->next != NULL) item->next->prev = item->prev; \ 55 | if (list == item) list = item->next; \ 56 | item->prev = item->next = NULL; \ 57 | } while(0) 58 | 59 | // 网卡的输入、输出队列 60 | struct St_InOut_Ring 61 | { 62 | struct rte_ring *pstInRing; 63 | struct rte_ring *pstOutRing; 64 | }; 65 | 66 | // arp表的单个条目 67 | struct arp_entry 68 | { 69 | uint32_t ip; 70 | unsigned char hwaddr[RTE_ETHER_ADDR_LEN]; 71 | 72 | unsigned char type; 73 | 74 | struct arp_entry *next; 75 | struct arp_entry *prev; 76 | }; 77 | 78 | // arp表结构 79 | struct arp_table 80 | { 81 | struct arp_entry *entries; 82 | int count; 83 | 84 | pthread_spinlock_t spinlock; 85 | }; 86 | 87 | enum EPOLL_EVENTS 88 | { 89 | EPOLLNONE = 0x0000, 90 | EPOLLIN = 0x0001, 91 | EPOLLPRI = 0x0002, 92 | EPOLLOUT = 0x0004, 93 | EPOLLRDNORM = 0x0040, 94 | EPOLLRDBAND = 0x0080, 95 | EPOLLWRNORM = 0x0100, 96 | EPOLLWRBAND = 0x0200, 97 | EPOLLMSG = 0x0400, 98 | EPOLLERR = 0x0008, 99 | EPOLLHUP = 0x0010, 100 | EPOLLRDHUP = 0x2000, 101 | EPOLLONESHOT = (1 << 30), 102 | EPOLLET = (1 << 31) 103 | 104 | }; 105 | 106 | #define EPOLL_CTL_ADD 1 107 | #define EPOLL_CTL_DEL 2 108 | #define EPOLL_CTL_MOD 3 109 | 110 | typedef union epoll_data 111 | { 112 | void *ptr; 113 | int fd; 114 | uint32_t u32; 115 | uint64_t u64; 116 | } epoll_data_t; 117 | 118 | struct epoll_event 119 | { 120 | uint32_t events; 121 | epoll_data_t data; 122 | }; 123 | 124 | struct epitem 125 | { 126 | RB_ENTRY(epitem) rbn; 127 | LIST_ENTRY(epitem) rdlink; 128 | int rdy; //exist in list 129 | 130 | int sockfd; 131 | struct epoll_event event; 132 | }; 133 | 134 | static int sockfd_cmp(struct epitem *ep1, struct epitem *ep2) 135 | { 136 | if (ep1->sockfd < ep2->sockfd) return -1; 137 | else if (ep1->sockfd == ep2->sockfd) return 0; 138 | return 1; 139 | } 140 | 141 | RB_HEAD(_epoll_rb_socket, epitem); 142 | RB_GENERATE_STATIC(_epoll_rb_socket, epitem, rbn, sockfd_cmp); 143 | 144 | typedef struct _epoll_rb_socket ep_rb_tree; 145 | 146 | struct eventpoll 147 | { 148 | int fd; 149 | 150 | ep_rb_tree rbr; 151 | int rbcnt; 152 | 153 | LIST_HEAD( ,epitem) rdlist; 154 | int rdnum; 155 | 156 | int waiting; 157 | 158 | pthread_mutex_t mtx; //rbtree update 159 | pthread_spinlock_t lock; //rdlist update 160 | 161 | pthread_cond_t cond; //block for event 162 | pthread_mutex_t cdmtx; //mutex for cond 163 | 164 | }; 165 | 166 | extern struct St_InOut_Ring *g_pstRingIns; 167 | extern unsigned char g_ucFdTable[D_MAX_FD_COUNT]; 168 | extern struct localhost *g_pstHost; 169 | extern struct rte_ether_addr g_stCpuMac; 170 | extern struct arp_table *g_pstArpTbl; 171 | extern struct tcp_table *g_pstTcpTbl; 172 | extern unsigned char g_aucDefaultArpMac[RTE_ETHER_ADDR_LEN]; 173 | 174 | void dbg_print(char *info, unsigned char *dat, int dat_len); 175 | 176 | // arp相关 177 | int ng_arp_entry_insert(uint32_t ip, unsigned char *mac); 178 | unsigned char* ng_get_dst_macaddr(uint32_t dip); 179 | struct rte_mbuf *ng_send_arp(struct rte_mempool *mbuf_pool, uint16_t opcode, unsigned char *dst_mac, 180 | uint32_t sip, uint32_t dip); 181 | 182 | // search 183 | struct localhost * get_hostinfo_fromip_port(uint32_t dip, uint16_t port, unsigned char proto); 184 | void* get_hostinfo_fromfd(int iSockFd); 185 | 186 | struct tcp_table *tcpInstance(void); 187 | struct tcp_stream * tcp_stream_search(uint32_t sip, uint32_t dip, uint16_t sport, uint16_t dport); 188 | 189 | // socket api 190 | int nsocket(__attribute__((unused)) int domain, int type, __attribute__((unused)) int protocol); 191 | int nbind(int sockfd, const struct sockaddr *addr, __attribute__((unused)) socklen_t addrlen); 192 | int nlisten(int sockfd, __attribute__((unused)) int backlog); 193 | int naccept(int sockfd, struct sockaddr *addr, __attribute__((unused)) socklen_t *addrlen); 194 | ssize_t nsend(int sockfd, const void *buf, size_t len,__attribute__((unused)) int flags); 195 | ssize_t nrecv(int sockfd, void *buf, size_t len, __attribute__((unused)) int flags); 196 | ssize_t nrecvfrom(int sockfd, void *buf, size_t len, __attribute__((unused)) int flags, 197 | struct sockaddr *src_addr, __attribute__((unused)) socklen_t *addrlen); 198 | ssize_t nsendto(int sockfd, const void *buf, size_t len, __attribute__((unused)) int flags, 199 | const struct sockaddr *dest_addr, __attribute__((unused)) socklen_t addrlen); 200 | int nclose(int fd); 201 | 202 | // epoll 203 | int epoll_event_callback(struct eventpoll *ep, int sockid, uint32_t event); 204 | int nepoll_create(int size); 205 | int nepoll_ctl(int epfd, int op, int sockid, struct epoll_event *event); 206 | int nepoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout); 207 | 208 | 209 | #endif -------------------------------------------------------------------------------- /netfamily.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "common.h" 6 | #include "tcp.h" 7 | #include "udp.h" 8 | 9 | #define MAKE_IPV4_ADDR(a, b, c, d) (a + (b<<8) + (c<<16) + (d<<24)) 10 | 11 | static uint32_t gLocalIp = MAKE_IPV4_ADDR(192, 168, 100, 77); 12 | 13 | struct rte_ether_addr g_stCpuMac; 14 | struct rte_kni *g_pstKni; // todo:后续将全局变量统一初始化,不再使用getInstance() 15 | struct St_InOut_Ring *g_pstRingIns = NULL; // todo:后续将全局变量统一初始化,不再使用getInstance() 16 | struct localhost *g_pstHost = NULL; // todo:后续将全局变量统一初始化,不再使用getInstance() 17 | struct arp_table *g_pstArpTbl = NULL; // todo:后续将全局变量统一初始化,不再使用getInstance() 18 | struct tcp_table *g_pstTcpTbl = NULL; // todo:后续将全局变量统一初始化,不再使用getInstance() 19 | 20 | unsigned char g_aucDefaultArpMac[RTE_ETHER_ADDR_LEN] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; 21 | 22 | unsigned char g_ucFdTable[D_MAX_FD_COUNT] = {0}; 23 | 24 | static struct St_InOut_Ring *ringInstance(void) 25 | { 26 | if (g_pstRingIns == NULL) 27 | { 28 | g_pstRingIns = rte_malloc("in/out ring", sizeof(struct St_InOut_Ring), 0); 29 | memset(g_pstRingIns, 0, sizeof(struct St_InOut_Ring)); 30 | } 31 | 32 | return g_pstRingIns; 33 | } 34 | 35 | void ng_init_port(struct rte_mempool *pstMbufPoolPub) 36 | { 37 | unsigned int uiPortsNum; 38 | const int iRxQueueNum = 1; 39 | const int iTxQueueNum = 1; 40 | int iRet; 41 | struct rte_eth_dev_info stDevInfo; 42 | struct rte_eth_txconf stTxConf; 43 | struct rte_eth_conf stPortConf = // 端口配置信息 44 | { 45 | .rxmode = {.max_rx_pkt_len = 1518 } // RTE_ETHER_MAX_LEN = 1518 46 | }; 47 | 48 | uiPortsNum = rte_eth_dev_count_avail(); 49 | if (uiPortsNum == 0) 50 | rte_exit(EXIT_FAILURE, "No Supported eth found\n"); 51 | 52 | rte_eth_dev_info_get(D_PORT_ID, &stDevInfo); 53 | 54 | // 配置以太网设备 55 | rte_eth_dev_configure(D_PORT_ID, iRxQueueNum, iTxQueueNum, &stPortConf); 56 | 57 | iRet = rte_eth_rx_queue_setup(D_PORT_ID, 0 , 1024, rte_eth_dev_socket_id(D_PORT_ID), NULL, pstMbufPoolPub); 58 | if(iRet < 0) 59 | rte_exit(EXIT_FAILURE, "Could not setup RX queue!\n"); 60 | 61 | stTxConf = stDevInfo.default_txconf; 62 | stTxConf.offloads = stPortConf.txmode.offloads; 63 | iRet = rte_eth_tx_queue_setup(D_PORT_ID, 0 , 1024, rte_eth_dev_socket_id(D_PORT_ID), &stTxConf); 64 | if (iRet < 0) 65 | rte_exit(EXIT_FAILURE, "Could not setup TX queue\n"); 66 | 67 | if (rte_eth_dev_start(D_PORT_ID) < 0 ) 68 | rte_exit(EXIT_FAILURE, "Could not start\n"); 69 | 70 | rte_eth_promiscuous_enable(D_PORT_ID); 71 | } 72 | 73 | static int ng_config_network_if(uint16_t port_id, unsigned char if_up) { 74 | 75 | if (!rte_eth_dev_is_valid_port(port_id)) { 76 | return -EINVAL; 77 | } 78 | 79 | int ret = 0; 80 | if (if_up) { 81 | 82 | rte_eth_dev_stop(port_id); 83 | ret = rte_eth_dev_start(port_id); 84 | 85 | } else { 86 | 87 | rte_eth_dev_stop(port_id); 88 | 89 | } 90 | 91 | if (ret < 0) { 92 | printf("Failed to start port : %d\n", port_id); 93 | } 94 | 95 | return 0; 96 | } 97 | 98 | static struct rte_kni *ng_alloc_kni(struct rte_mempool *mbuf_pool) { 99 | 100 | struct rte_kni *kni_hanlder = NULL; 101 | 102 | struct rte_kni_conf conf; 103 | memset(&conf, 0, sizeof(conf)); 104 | 105 | snprintf(conf.name, RTE_KNI_NAMESIZE, "vEth%u", D_PORT_ID); 106 | conf.group_id = D_PORT_ID; 107 | conf.mbuf_size = D_MAX_PACKET_SIZE; 108 | rte_eth_macaddr_get(D_PORT_ID, (struct rte_ether_addr *)conf.mac_addr); 109 | rte_eth_dev_get_mtu(D_PORT_ID, &conf.mtu); 110 | 111 | // print_ethaddr("ng_alloc_kni: ", (struct ether_addr *)conf.mac_addr); 112 | 113 | /* 114 | struct rte_eth_dev_info dev_info; 115 | memset(&dev_info, 0, sizeof(dev_info)); 116 | rte_eth_dev_info_get(D_PORT_ID, &dev_info); 117 | */ 118 | 119 | 120 | struct rte_kni_ops ops; 121 | memset(&ops, 0, sizeof(ops)); 122 | 123 | ops.port_id = D_PORT_ID; 124 | ops.config_network_if = ng_config_network_if; 125 | 126 | kni_hanlder = rte_kni_alloc(mbuf_pool, &conf, &ops); 127 | if (!kni_hanlder) { 128 | rte_exit(EXIT_FAILURE, "Failed to create kni for port : %d\n", D_PORT_ID); 129 | } 130 | 131 | return kni_hanlder; 132 | } 133 | 134 | static int pkt_process(void *arg) 135 | { 136 | struct rte_mempool *pstMbufPool; 137 | int iRxNum; 138 | int i; 139 | struct rte_ether_hdr *pstEthHdr; 140 | struct rte_arp_hdr *pstArpHdr; 141 | struct rte_ipv4_hdr *pstIpHdr; 142 | 143 | pstMbufPool = (struct rte_mempool *)arg; 144 | while(1) 145 | { 146 | struct rte_mbuf *pstMbuf[32]; 147 | iRxNum = rte_ring_mc_dequeue_burst(g_pstRingIns->pstInRing, (void**)pstMbuf, D_BURST_SIZE, NULL); 148 | 149 | if(iRxNum <= 0) 150 | continue; 151 | 152 | for(i = 0; i < iRxNum; ++i) 153 | { 154 | pstEthHdr = rte_pktmbuf_mtod_offset(pstMbuf[i], struct rte_ether_hdr *, 0); 155 | 156 | if (pstEthHdr->ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP)){ 157 | pstArpHdr = rte_pktmbuf_mtod_offset(pstMbuf[i], struct rte_arp_hdr *, 158 | sizeof(struct rte_ether_hdr)); 159 | 160 | struct in_addr addr; 161 | addr.s_addr = pstArpHdr->arp_data.arp_tip; 162 | printf("arp ---> src: %s ", inet_ntoa(addr)); 163 | 164 | addr.s_addr = gLocalIp; 165 | printf(" local: %s \n", inet_ntoa(addr)); 166 | 167 | if (pstArpHdr->arp_data.arp_tip == gLocalIp){ 168 | ng_arp_entry_insert(pstIpHdr->src_addr, pstEthHdr->s_addr.addr_bytes); 169 | } 170 | } 171 | 172 | if (pstEthHdr->ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4)) //IPv4: 0800 173 | { 174 | pstIpHdr = rte_pktmbuf_mtod_offset(pstMbuf[i], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); 175 | 176 | // 维护一个arp表 177 | // ng_arp_entry_insert(pstIpHdr->src_addr, pstEthHdr->s_addr.addr_bytes); 178 | if(pstIpHdr->next_proto_id == IPPROTO_UDP) // udp 179 | { 180 | // udp process 181 | udp_process(pstMbuf[i]); 182 | } 183 | else if(pstIpHdr->next_proto_id == IPPROTO_TCP) // tcp 184 | { 185 | // printf("tcp_process ---\n"); 186 | tcp_process(pstMbuf[i]); 187 | } 188 | else 189 | { 190 | rte_kni_tx_burst(g_pstKni, pstMbuf, iRxNum); 191 | // printf("tcp/udp --> rte_kni_handle_request\n"); 192 | } 193 | } 194 | else 195 | { 196 | // ifconfig vEth0 192.168.181.169 up 197 | rte_kni_tx_burst(g_pstKni, pstMbuf, iRxNum); 198 | // printf("ip --> rte_kni_handle_request\n"); 199 | } 200 | } 201 | 202 | rte_kni_handle_request(g_pstKni); 203 | 204 | // to send 205 | udp_out(pstMbufPool); 206 | tcp_out(pstMbufPool); 207 | } 208 | return 0; 209 | } 210 | 211 | int udp_server_entry(__attribute__((unused)) void *arg) 212 | { 213 | int iConnfd; 214 | struct sockaddr_in stLocalAddr, stClientAddr; 215 | socklen_t uiAddrLen = sizeof(stClientAddr);; 216 | char acBuf[D_UDP_BUFFER_SIZE] = {0}; 217 | 218 | iConnfd = nsocket(AF_INET, SOCK_DGRAM, 0); 219 | if (iConnfd == -1) 220 | { 221 | printf("nsocket failed\n"); 222 | return -1; 223 | } 224 | 225 | memset(&stLocalAddr, 0, sizeof(struct sockaddr_in)); 226 | 227 | stLocalAddr.sin_port = htons(8889); 228 | stLocalAddr.sin_family = AF_INET; 229 | stLocalAddr.sin_addr.s_addr = inet_addr("192.168.100.77"); 230 | 231 | nbind(iConnfd, (struct sockaddr*)&stLocalAddr, sizeof(stLocalAddr)); 232 | 233 | while (1) 234 | { 235 | if (nrecvfrom(iConnfd, acBuf, D_UDP_BUFFER_SIZE, 0, 236 | (struct sockaddr*)&stClientAddr, &uiAddrLen) < 0) 237 | { 238 | continue; 239 | } 240 | else 241 | { 242 | printf("recv from %s:%d, data:%s\n", inet_ntoa(stClientAddr.sin_addr), 243 | ntohs(stClientAddr.sin_port), acBuf); 244 | nsendto(iConnfd, acBuf, strlen(acBuf), 0, 245 | (struct sockaddr*)&stClientAddr, sizeof(stClientAddr)); 246 | } 247 | } 248 | 249 | nclose(iConnfd); 250 | 251 | return 0; 252 | } 253 | 254 | #define BUFFER_SIZE 1024 255 | 256 | #ifdef ENABLE_SINGLE_EPOLL 257 | 258 | int tcp_server_entry(__attribute__((unused)) void *arg) 259 | { 260 | int listenfd = nsocket(AF_INET, SOCK_STREAM, 0); 261 | if (listenfd == -1) 262 | { 263 | return -1; 264 | } 265 | 266 | struct sockaddr_in servaddr; 267 | memset(&servaddr, 0, sizeof(struct sockaddr)); 268 | servaddr.sin_family = AF_INET; 269 | servaddr.sin_addr.s_addr = htonl(INADDR_ANY); 270 | servaddr.sin_port = htons(9999); 271 | nbind(listenfd, (struct sockaddr*)&servaddr, sizeof(servaddr)); 272 | 273 | nlisten(listenfd, 10); 274 | 275 | int epfd = nepoll_create(1); 276 | struct epoll_event ev, events[1024]; 277 | ev.data.fd = listenfd; 278 | ev.events |= EPOLLIN; 279 | nepoll_ctl(epfd, EPOLL_CTL_ADD, listenfd, &ev); 280 | 281 | char buff[BUFFER_SIZE] = {'\0'}; 282 | while(1) 283 | { 284 | int nready = nepoll_wait(epfd, events, 1024, 5); 285 | if(nready < 0) 286 | continue; 287 | 288 | for(int i = 0; i < nready; ++i) 289 | { 290 | int fd = events[i].data.fd; 291 | if(listenfd == fd) 292 | { 293 | struct sockaddr_in client; 294 | socklen_t len = sizeof(client); 295 | int connfd = naccept(listenfd, (struct sockaddr*)&client, &len); 296 | 297 | struct epoll_event ev; 298 | ev.events = EPOLLIN; 299 | ev.data.fd = connfd; 300 | nepoll_ctl(epfd, EPOLL_CTL_ADD, connfd, &ev); 301 | } 302 | else 303 | { 304 | int n = nrecv(fd, buff, BUFFER_SIZE, 0); //block 305 | if (n > 0) 306 | { 307 | printf(" arno --> recv: %s\n", buff); 308 | nsend(fd, buff, n, 0); 309 | } 310 | else 311 | { 312 | printf("error: %s\n", strerror(errno)); 313 | nepoll_ctl(epfd, EPOLL_CTL_DEL, fd, NULL); 314 | nclose(fd); 315 | } 316 | } 317 | } 318 | } 319 | 320 | return 0; 321 | } 322 | 323 | #else 324 | int tcp_server_entry(__attribute__((unused)) void *arg) 325 | { 326 | int listenfd; 327 | int iRet = -1; 328 | struct sockaddr_in servaddr; 329 | 330 | listenfd = nsocket(AF_INET, SOCK_STREAM, 0); 331 | if (listenfd == -1) 332 | { 333 | printf("[%s][%d] nsocket error!\n", __FUNCTION__, __LINE__); 334 | return -1; 335 | } 336 | 337 | memset(&servaddr, 0, sizeof(struct sockaddr)); 338 | servaddr.sin_family = AF_INET; 339 | servaddr.sin_addr.s_addr = htonl(INADDR_ANY); 340 | servaddr.sin_port = htons(9999); 341 | iRet = nbind(listenfd, (struct sockaddr*)&servaddr, sizeof(servaddr)); 342 | if(iRet < 0) 343 | { 344 | printf("nbind error!\n"); 345 | return -1; 346 | } 347 | 348 | nlisten(listenfd, 10); 349 | 350 | while (1) 351 | { 352 | struct sockaddr_in client; 353 | socklen_t len = sizeof(client); 354 | int connfd = naccept(listenfd, (struct sockaddr*)&client, &len); 355 | 356 | char buff[D_TCP_BUFFER_SIZE] = {0}; 357 | while (1) 358 | { 359 | int n = nrecv(connfd, buff, D_TCP_BUFFER_SIZE, 0); //block 360 | if (n > 0) 361 | { 362 | printf("recv: %s\n", buff); 363 | nsend(connfd, buff, n, 0); 364 | } 365 | else if (n == 0) 366 | { 367 | printf("nclose()\n"); 368 | nclose(connfd); 369 | break; 370 | } 371 | else 372 | { //nonblock 373 | 374 | } 375 | } 376 | 377 | } 378 | nclose(listenfd); 379 | 380 | return 0; 381 | } 382 | 383 | #endif 384 | 385 | int main(int argc, char *argv[]) 386 | { 387 | struct rte_mempool *pstMbufPoolPub; 388 | struct St_InOut_Ring *pstRing; 389 | struct rte_mbuf *pstRecvMbuf[32] = {NULL}; 390 | struct rte_mbuf *pstSendMbuf[32] = {NULL}; 391 | int iRxNum; 392 | int iTotalNum; 393 | int iOffset; 394 | int iTxNum; 395 | 396 | unsigned int uiCoreId; 397 | 398 | if(rte_eal_init(argc, argv) < 0) 399 | rte_exit(EXIT_FAILURE, "Error with EAL init\n"); 400 | 401 | pstMbufPoolPub = rte_pktmbuf_pool_create("MBUF_POOL_PUB", D_NUM_MBUFS, 0, 0, 402 | RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); 403 | if(pstMbufPoolPub == NULL) 404 | { 405 | printf("rte_errno = %x, errmsg = %s\n", rte_errno, rte_strerror(rte_errno)); 406 | return -1; 407 | } 408 | 409 | if (rte_kni_init(D_PORT_ID) < 0) 410 | rte_exit(EXIT_FAILURE, "kni init failed\n"); 411 | 412 | ng_init_port(pstMbufPoolPub); 413 | g_pstKni = ng_alloc_kni(pstMbufPoolPub); 414 | 415 | rte_eth_macaddr_get(D_PORT_ID, &g_stCpuMac); 416 | 417 | pstRing = ringInstance(); 418 | if(pstRing == NULL) 419 | rte_exit(EXIT_FAILURE, "ring buffer init failed\n"); 420 | 421 | pstRing->pstInRing = rte_ring_create("in ring", D_RING_SIZE, rte_socket_id(), RING_F_SP_ENQ | RING_F_SC_DEQ); 422 | pstRing->pstOutRing = rte_ring_create("out ring", D_RING_SIZE, rte_socket_id(), RING_F_SP_ENQ | RING_F_SC_DEQ); 423 | 424 | uiCoreId = rte_lcore_id(); 425 | 426 | uiCoreId = rte_get_next_lcore(uiCoreId, 1, 0); 427 | rte_eal_remote_launch(pkt_process, pstMbufPoolPub, uiCoreId); 428 | 429 | uiCoreId = rte_get_next_lcore(uiCoreId, 1, 0); 430 | rte_eal_remote_launch(udp_server_entry, pstMbufPoolPub, uiCoreId); 431 | 432 | // uiCoreId = rte_get_next_lcore(uiCoreId, 1, 0); 433 | // rte_eal_remote_launch(tcp_server_entry, pstMbufPoolPub, uiCoreId); 434 | 435 | while (1) 436 | { 437 | // rx 438 | iRxNum = rte_eth_rx_burst(D_PORT_ID, 0, pstRecvMbuf, D_BURST_SIZE); 439 | if(iRxNum > 0) 440 | rte_ring_sp_enqueue_burst(pstRing->pstInRing, (void**)pstRecvMbuf, iRxNum, NULL); 441 | 442 | // tx 443 | iTotalNum = rte_ring_sc_dequeue_burst(pstRing->pstOutRing, (void**)pstSendMbuf, D_BURST_SIZE, NULL); 444 | if(iTotalNum > 0) 445 | { 446 | iOffset = 0; 447 | while(iOffset < iTotalNum) 448 | { 449 | iTxNum = rte_eth_tx_burst(D_PORT_ID, 0, &pstSendMbuf[iOffset], iTotalNum - iOffset); 450 | if(iTxNum > 0) 451 | iOffset += iTxNum; 452 | } 453 | } 454 | } 455 | 456 | } 457 | -------------------------------------------------------------------------------- /nty_tree.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) [2018] [WangBoJing] 5 | 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | * 25 | * 26 | **** ***** ************ 27 | *** * ** ** * 28 | *** * * * ** ** 29 | * ** * * * ** * 30 | * ** * * * ** * 31 | * ** * ** ** 32 | * ** * *** ** 33 | * ** * *********** ***** ***** ** ***** * **** 34 | * ** * ** ** ** ** *** * **** * ** 35 | * ** * ** ** * ** ** ** *** ** 36 | * ** * ** * * ** ** ** ** * 37 | * ** * ** ** * ** ** ** ** ** 38 | * ** * ** * * ** ** ** ** 39 | * ** * ** ** * ** ** ** ** 40 | * ** * ** ** * ** ** ** ** 41 | * ** * ** * * ** ** ** ** 42 | * ** * ** ** * ** ** ** ** 43 | * *** ** * * ** ** * ** ** 44 | * *** ** * ** ** ** * ** ** 45 | * ** ** * ** ** ** * *** ** 46 | * ** ** * * ** ** * **** ** 47 | ***** * **** * ****** ***** ** **** 48 | * ** 49 | * ** 50 | ***** ** 51 | **** ****** 52 | 53 | * 54 | */ 55 | 56 | 57 | 58 | #ifndef __NTY_TREE_H__ 59 | #define __NTY_TREE_H__ 60 | 61 | 62 | #define SPLAY_HEAD(name, type) \ 63 | struct name { \ 64 | struct type *sph_root; /* root of the tree */ \ 65 | } 66 | 67 | #define SPLAY_INITIALIZER(root) \ 68 | { NULL } 69 | 70 | #define SPLAY_INIT(root) do { \ 71 | (root)->sph_root = NULL; \ 72 | } while (/*CONSTCOND*/ 0) 73 | 74 | #define SPLAY_ENTRY(type) \ 75 | struct { \ 76 | struct type *spe_left; /* left element */ \ 77 | struct type *spe_right; /* right element */ \ 78 | } 79 | 80 | #define SPLAY_LEFT(elm, field) (elm)->field.spe_left 81 | #define SPLAY_RIGHT(elm, field) (elm)->field.spe_right 82 | #define SPLAY_ROOT(head) (head)->sph_root 83 | #define SPLAY_EMPTY(head) (SPLAY_ROOT(head) == NULL) 84 | 85 | /* SPLAY_ROTATE_{LEFT,RIGHT} expect that tmp hold SPLAY_{RIGHT,LEFT} */ 86 | #define SPLAY_ROTATE_RIGHT(head, tmp, field) do { \ 87 | SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(tmp, field); \ 88 | SPLAY_RIGHT(tmp, field) = (head)->sph_root; \ 89 | (head)->sph_root = tmp; \ 90 | } while (/*CONSTCOND*/ 0) 91 | 92 | #define SPLAY_ROTATE_LEFT(head, tmp, field) do { \ 93 | SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(tmp, field); \ 94 | SPLAY_LEFT(tmp, field) = (head)->sph_root; \ 95 | (head)->sph_root = tmp; \ 96 | } while (/*CONSTCOND*/ 0) 97 | 98 | #define SPLAY_LINKLEFT(head, tmp, field) do { \ 99 | SPLAY_LEFT(tmp, field) = (head)->sph_root; \ 100 | tmp = (head)->sph_root; \ 101 | (head)->sph_root = SPLAY_LEFT((head)->sph_root, field); \ 102 | } while (/*CONSTCOND*/ 0) 103 | 104 | #define SPLAY_LINKRIGHT(head, tmp, field) do { \ 105 | SPLAY_RIGHT(tmp, field) = (head)->sph_root; \ 106 | tmp = (head)->sph_root; \ 107 | (head)->sph_root = SPLAY_RIGHT((head)->sph_root, field);\ 108 | } while (/*CONSTCOND*/ 0) 109 | 110 | #define SPLAY_ASSEMBLE(head, node, left, right, field) do { \ 111 | SPLAY_RIGHT(left, field) = SPLAY_LEFT((head)->sph_root, field); \ 112 | SPLAY_LEFT(right, field) = SPLAY_RIGHT((head)->sph_root, field);\ 113 | SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(node, field); \ 114 | SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(node, field); \ 115 | } while (/*CONSTCOND*/ 0) 116 | 117 | 118 | 119 | #define SPLAY_PROTOTYPE(name, type, field, cmp) \ 120 | void name##_SPLAY(struct name *, struct type *); \ 121 | void name##_SPLAY_MINMAX(struct name *, int); \ 122 | struct type *name##_SPLAY_INSERT(struct name *, struct type *); \ 123 | struct type *name##_SPLAY_REMOVE(struct name *, struct type *); \ 124 | \ 125 | /* Finds the node with the same key as elm */ \ 126 | static __inline struct type * \ 127 | name##_SPLAY_FIND(struct name *head, struct type *elm) { \ \ 128 | if (SPLAY_EMPTY(head)) \ 129 | return(NULL); \ 130 | name##_SPLAY(head, elm); \ 131 | if ((cmp)(elm, (head)->sph_root) == 0) \ 132 | return (head->sph_root); \ 133 | return (NULL); \ 134 | } \ 135 | \ 136 | static __inline struct type * \ 137 | name##_SPLAY_NEXT(struct name *head, struct type *elm) { \ 138 | name##_SPLAY(head, elm); \ 139 | if (SPLAY_RIGHT(elm, field) != NULL) { \ 140 | elm = SPLAY_RIGHT(elm, field); \ 141 | while (SPLAY_LEFT(elm, field) != NULL) { \ 142 | elm = SPLAY_LEFT(elm, field); \ 143 | } \ 144 | } else \ 145 | elm = NULL; \ 146 | return (elm); \ 147 | } \ 148 | \ 149 | static __inline struct type * \ 150 | name##_SPLAY_MIN_MAX(struct name *head, int val) { \ 151 | name##_SPLAY_MINMAX(head, val); \ 152 | return (SPLAY_ROOT(head)); \ 153 | } 154 | 155 | /* Main splay operation. 156 | * Moves node close to the key of elm to top 157 | */ 158 | #define SPLAY_GENERATE(name, type, field, cmp) \ 159 | struct type * \ 160 | name##_SPLAY_INSERT(struct name *head, struct type *elm) { \ 161 | if (SPLAY_EMPTY(head)) { \ 162 | SPLAY_LEFT(elm, field) = SPLAY_RIGHT(elm, field) = NULL; \ 163 | } else { \ 164 | int __comp; \ 165 | name##_SPLAY(head, elm); \ 166 | __comp = (cmp)(elm, (head)->sph_root); \ 167 | if(__comp < 0) { \ 168 | SPLAY_LEFT(elm, field) = SPLAY_LEFT((head)->sph_root, field);\ 169 | SPLAY_RIGHT(elm, field) = (head)->sph_root; \ 170 | SPLAY_LEFT((head)->sph_root, field) = NULL; \ 171 | } else if (__comp > 0) { \ 172 | SPLAY_RIGHT(elm, field) = SPLAY_RIGHT((head)->sph_root, field);\ 173 | SPLAY_LEFT(elm, field) = (head)->sph_root; \ 174 | SPLAY_RIGHT((head)->sph_root, field) = NULL; \ 175 | } else \ 176 | return ((head)->sph_root); \ 177 | } \ 178 | (head)->sph_root = (elm); \ 179 | return (NULL); \ 180 | } \ 181 | \ 182 | struct type * \ 183 | name##_SPLAY_REMOVE(struct name *head, struct type *elm) { \ 184 | struct type *__tmp; \ 185 | if (SPLAY_EMPTY(head)) \ 186 | return (NULL); \ 187 | name##_SPLAY(head, elm); \ 188 | if ((cmp)(elm, (head)->sph_root) == 0) { \ 189 | if (SPLAY_LEFT((head)->sph_root, field) == NULL) { \ 190 | (head)->sph_root = SPLAY_RIGHT((head)->sph_root, field);\ 191 | } else { \ 192 | __tmp = SPLAY_RIGHT((head)->sph_root, field); \ 193 | (head)->sph_root = SPLAY_LEFT((head)->sph_root, field);\ 194 | name##_SPLAY(head, elm); \ 195 | SPLAY_RIGHT((head)->sph_root, field) = __tmp; \ 196 | } \ 197 | return (elm); \ 198 | } \ 199 | return (NULL); \ 200 | } \ 201 | \ 202 | void \ 203 | name##_SPLAY(struct name *head, struct type *elm) { \ 204 | struct type __node, *__left, *__right, *__tmp; \ 205 | int __comp; \ 206 | \ 207 | SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\ 208 | __left = __right = &__node; \ 209 | \ 210 | while ((__comp = (cmp)(elm, (head)->sph_root)) != 0) {\ 211 | if (__comp < 0) { \ 212 | __tmp = SPLAY_LEFT((head)->sph_root, field); \ 213 | if (__tmp == NULL) \ 214 | break; \ 215 | if ((cmp)(elm, __tmp) < 0){ \ 216 | SPLAY_ROTATE_RIGHT(head, __tmp, field); \ 217 | if (SPLAY_LEFT((head)->sph_root, field) == NULL)\ 218 | break; \ 219 | } \ 220 | SPLAY_LINKLEFT(head, __right, field); \ 221 | } else if (__comp > 0) { \ 222 | __tmp = SPLAY_RIGHT((head)->sph_root, field); \ 223 | if (__tmp == NULL) \ 224 | break; \ 225 | if ((cmp)(elm, __tmp) > 0){ \ 226 | SPLAY_ROTATE_LEFT(head, __tmp, field); \ 227 | if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\ 228 | break; \ 229 | } \ 230 | SPLAY_LINKRIGHT(head, __left, field); \ 231 | } \ 232 | } \ 233 | SPLAY_ASSEMBLE(head, &__node, __left, __right, field); \ 234 | } \ 235 | \ 236 | void name##_SPLAY_MINMAX(struct name *head, int __comp) \ 237 | { \ 238 | struct type __node, *__left, *__right, *__tmp; \ 239 | \ 240 | SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\ 241 | __left = __right = &__node; \ 242 | \ 243 | while (1) { \ 244 | if (__comp < 0) { \ 245 | __tmp = SPLAY_LEFT((head)->sph_root, field); \ 246 | if (__tmp == NULL) \ 247 | break; \ 248 | if (__comp < 0){ \ 249 | SPLAY_ROTATE_RIGHT(head, __tmp, field); \ 250 | if (SPLAY_LEFT((head)->sph_root, field) == NULL)\ 251 | break; \ 252 | } \ 253 | SPLAY_LINKLEFT(head, __right, field); \ 254 | } else if (__comp > 0) { \ 255 | __tmp = SPLAY_RIGHT((head)->sph_root, field); \ 256 | if (__tmp == NULL) \ 257 | break; \ 258 | if (__comp > 0) { \ 259 | SPLAY_ROTATE_LEFT(head, __tmp, field); \ 260 | if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\ 261 | break; \ 262 | } \ 263 | SPLAY_LINKRIGHT(head, __left, field); \ 264 | } \ 265 | } \ 266 | SPLAY_ASSEMBLE(head, &__node, __left, __right, field); \ 267 | } 268 | 269 | #define SPLAY_NEGINF -1 270 | #define SPLAY_INF 1 271 | 272 | #define SPLAY_INSERT(name, x, y) name##_SPLAY_INSERT(x, y) 273 | #define SPLAY_REMOVE(name, x, y) name##_SPLAY_REMOVE(x, y) 274 | #define SPLAY_FIND(name, x, y) name##_SPLAY_FIND(x, y) 275 | #define SPLAY_NEXT(name, x, y) name##_SPLAY_NEXT(x, y) 276 | #define SPLAY_MIN(name, x) (SPLAY_EMPTY(x) ? NULL \ 277 | : name##_SPLAY_MIN_MAX(x, SPLAY_NEGINF)) 278 | #define SPLAY_MAX(name, x) (SPLAY_EMPTY(x) ? NULL \ 279 | : name##_SPLAY_MIN_MAX(x, SPLAY_INF)) 280 | 281 | #define SPLAY_FOREACH(x, name, head) \ 282 | for ((x) = SPLAY_MIN(name, head); \ 283 | (x) != NULL; \ 284 | (x) = SPLAY_NEXT(name, head, x)) 285 | 286 | 287 | 288 | 289 | /* Macros that define a red-black tree */ 290 | #define RB_HEAD(name, type) \ 291 | struct name { \ 292 | struct type *rbh_root; /* root of the tree */ \ 293 | } 294 | 295 | #define RB_INITIALIZER(root) \ 296 | { NULL } 297 | 298 | #define RB_INIT(root) do { \ 299 | (root)->rbh_root = NULL; \ 300 | } while (0) 301 | 302 | 303 | #define RB_BLACK 0 304 | #define RB_RED 1 305 | 306 | #define RB_ENTRY(type) \ 307 | struct { \ 308 | struct type *rbe_left; /* left element */ \ 309 | struct type *rbe_right; /* right element */ \ 310 | struct type *rbe_parent; /* parent element */ \ 311 | int rbe_color; /* node color */ \ 312 | } 313 | 314 | #define RB_LEFT(elm, field) (elm)->field.rbe_left 315 | #define RB_RIGHT(elm, field) (elm)->field.rbe_right 316 | #define RB_PARENT(elm, field) (elm)->field.rbe_parent 317 | #define RB_COLOR(elm, field) (elm)->field.rbe_color 318 | #define RB_ROOT(head) (head)->rbh_root 319 | #define RB_EMPTY(head) (RB_ROOT(head) == NULL) 320 | 321 | #define RB_SET(elm, parent, field) do { \ 322 | RB_PARENT(elm, field) = parent; \ 323 | RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; \ 324 | RB_COLOR(elm, field) = RB_RED; \ 325 | } while (0) 326 | 327 | #define RB_SET_BLACKRED(black, red, field) do { \ 328 | RB_COLOR(black, field) = RB_BLACK; \ 329 | RB_COLOR(red, field) = RB_RED; \ 330 | } while (0) 331 | 332 | #ifndef RB_AUGMENT 333 | #define RB_AUGMENT(x) do {} while (0) 334 | #endif 335 | 336 | 337 | 338 | #define RB_ROTATE_LEFT(head, elm, tmp, field) do { \ 339 | (tmp) = RB_RIGHT(elm, field); \ 340 | if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) { \ 341 | RB_PARENT(RB_LEFT(tmp, field), field) = (elm); \ 342 | } \ 343 | RB_AUGMENT(elm); \ 344 | if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \ 345 | if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ 346 | RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ 347 | else \ 348 | RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \ 349 | } else \ 350 | (head)->rbh_root = (tmp); \ 351 | RB_LEFT(tmp, field) = (elm); \ 352 | RB_PARENT(elm, field) = (tmp); \ 353 | RB_AUGMENT(tmp); \ 354 | if ((RB_PARENT(tmp, field))) \ 355 | RB_AUGMENT(RB_PARENT(tmp, field)); \ 356 | } while (0) 357 | 358 | 359 | #define RB_ROTATE_RIGHT(head, elm, tmp, field) do { \ 360 | (tmp) = RB_LEFT(elm, field); \ 361 | if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) { \ 362 | RB_PARENT(RB_RIGHT(tmp, field), field) = (elm); \ 363 | } \ 364 | RB_AUGMENT(elm); \ 365 | if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \ 366 | if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ 367 | RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ 368 | else \ 369 | RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \ 370 | } else \ 371 | (head)->rbh_root = (tmp); \ 372 | RB_RIGHT(tmp, field) = (elm); \ 373 | RB_PARENT(elm, field) = (tmp); \ 374 | RB_AUGMENT(tmp); \ 375 | if ((RB_PARENT(tmp, field))) \ 376 | RB_AUGMENT(RB_PARENT(tmp, field)); \ 377 | } while (0) 378 | 379 | 380 | #define RB_PROTOTYPE(name, type, field, cmp) \ 381 | RB_PROTOTYPE_INTERNAL(name, type, field, cmp,) 382 | #define RB_PROTOTYPE_STATIC(name, type, field, cmp) \ 383 | RB_PROTOTYPE_INTERNAL(name, type, field, cmp, __unused static) 384 | #define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \ 385 | attr void name##_RB_INSERT_COLOR(struct name *, struct type *); \ 386 | attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\ 387 | attr struct type *name##_RB_REMOVE(struct name *, struct type *); \ 388 | attr struct type *name##_RB_INSERT(struct name *, struct type *); \ 389 | attr struct type *name##_RB_FIND(struct name *, struct type *); \ 390 | attr struct type *name##_RB_NFIND(struct name *, struct type *); \ 391 | attr struct type *name##_RB_NEXT(struct type *); \ 392 | attr struct type *name##_RB_PREV(struct type *); \ 393 | attr struct type *name##_RB_MINMAX(struct name *, int); \ 394 | 395 | /* Main rb operation. 396 | * Moves node close to the key of elm to top 397 | */ 398 | #define RB_GENERATE(name, type, field, cmp) \ 399 | RB_GENERATE_INTERNAL(name, type, field, cmp,) 400 | #define RB_GENERATE_STATIC(name, type, field, cmp) \ 401 | RB_GENERATE_INTERNAL(name, type, field, cmp, static) 402 | #define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) \ 403 | attr void \ 404 | name##_RB_INSERT_COLOR(struct name *head, struct type *elm) { \ 405 | struct type *parent, *gparent, *tmp; \ 406 | while ((parent = RB_PARENT(elm, field)) != NULL && \ 407 | RB_COLOR(parent, field) == RB_RED) { \ 408 | gparent = RB_PARENT(parent, field); \ 409 | if (parent == RB_LEFT(gparent, field)) { \ 410 | tmp = RB_RIGHT(gparent, field); \ 411 | if (tmp && RB_COLOR(tmp, field) == RB_RED) { \ 412 | RB_COLOR(tmp, field) = RB_BLACK; \ 413 | RB_SET_BLACKRED(parent, gparent, field); \ 414 | elm = gparent; \ 415 | continue; \ 416 | } \ 417 | if (RB_RIGHT(parent, field) == elm) { \ 418 | RB_ROTATE_LEFT(head, parent, tmp, field); \ 419 | tmp = parent; \ 420 | parent = elm; \ 421 | elm = tmp; \ 422 | } \ 423 | RB_SET_BLACKRED(parent, gparent, field); \ 424 | RB_ROTATE_RIGHT(head, gparent, tmp, field); \ 425 | } else { \ 426 | tmp = RB_LEFT(gparent, field); \ 427 | if (tmp && RB_COLOR(tmp, field) == RB_RED) { \ 428 | RB_COLOR(tmp, field) = RB_BLACK; \ 429 | RB_SET_BLACKRED(parent, gparent, field); \ 430 | elm = gparent; \ 431 | continue; \ 432 | } \ 433 | if (RB_LEFT(parent, field) == elm) { \ 434 | RB_ROTATE_RIGHT(head, parent, tmp, field); \ 435 | tmp = parent; \ 436 | parent = elm; \ 437 | elm = tmp; \ 438 | } \ 439 | RB_SET_BLACKRED(parent, gparent, field); \ 440 | RB_ROTATE_LEFT(head, gparent, tmp, field); \ 441 | } \ 442 | } \ 443 | RB_COLOR(head->rbh_root, field) = RB_BLACK; \ 444 | } \ 445 | \ 446 | attr void \ 447 | name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) \ 448 | { \ 449 | struct type *tmp; \ 450 | while ((elm == NULL || RB_COLOR(elm, field) == RB_BLACK) && \ 451 | elm != RB_ROOT(head)) { \ 452 | if (RB_LEFT(parent, field) == elm) { \ 453 | tmp = RB_RIGHT(parent, field); \ 454 | if (RB_COLOR(tmp, field) == RB_RED) { \ 455 | RB_SET_BLACKRED(tmp, parent, field); \ 456 | RB_ROTATE_LEFT(head, parent, tmp, field); \ 457 | tmp = RB_RIGHT(parent, field); \ 458 | } \ 459 | if ((RB_LEFT(tmp, field) == NULL || \ 460 | RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) && \ 461 | (RB_RIGHT(tmp, field) == NULL || \ 462 | RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) { \ 463 | RB_COLOR(tmp, field) = RB_RED; \ 464 | elm = parent; \ 465 | parent = RB_PARENT(elm, field); \ 466 | } else { \ 467 | if (RB_RIGHT(tmp, field) == NULL || \ 468 | RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK) { \ 469 | struct type *oleft; \ 470 | if ((oleft = RB_LEFT(tmp, field)) \ 471 | != NULL) \ 472 | RB_COLOR(oleft, field) = RB_BLACK; \ 473 | RB_COLOR(tmp, field) = RB_RED; \ 474 | RB_ROTATE_RIGHT(head, tmp, oleft, field); \ 475 | tmp = RB_RIGHT(parent, field); \ 476 | } \ 477 | RB_COLOR(tmp, field) = RB_COLOR(parent, field); \ 478 | RB_COLOR(parent, field) = RB_BLACK; \ 479 | if (RB_RIGHT(tmp, field)) \ 480 | RB_COLOR(RB_RIGHT(tmp, field), field) = RB_BLACK; \ 481 | RB_ROTATE_LEFT(head, parent, tmp, field); \ 482 | elm = RB_ROOT(head); \ 483 | break; \ 484 | } \ 485 | } else { \ 486 | tmp = RB_LEFT(parent, field); \ 487 | if (RB_COLOR(tmp, field) == RB_RED) { \ 488 | RB_SET_BLACKRED(tmp, parent, field); \ 489 | RB_ROTATE_RIGHT(head, parent, tmp, field); \ 490 | tmp = RB_LEFT(parent, field); \ 491 | } \ 492 | if ((RB_LEFT(tmp, field) == NULL || \ 493 | RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) && \ 494 | (RB_RIGHT(tmp, field) == NULL || \ 495 | RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) { \ 496 | RB_COLOR(tmp, field) = RB_RED; \ 497 | elm = parent; \ 498 | parent = RB_PARENT(elm, field); \ 499 | } else { \ 500 | if (RB_LEFT(tmp, field) == NULL || \ 501 | RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) { \ 502 | struct type *oright; \ 503 | if ((oright = RB_RIGHT(tmp, field)) \ 504 | != NULL) \ 505 | RB_COLOR(oright, field) = RB_BLACK; \ 506 | RB_COLOR(tmp, field) = RB_RED; \ 507 | RB_ROTATE_LEFT(head, tmp, oright, field); \ 508 | tmp = RB_LEFT(parent, field); \ 509 | } \ 510 | RB_COLOR(tmp, field) = RB_COLOR(parent, field); \ 511 | RB_COLOR(parent, field) = RB_BLACK; \ 512 | if (RB_LEFT(tmp, field)) \ 513 | RB_COLOR(RB_LEFT(tmp, field), field) = RB_BLACK; \ 514 | RB_ROTATE_RIGHT(head, parent, tmp, field); \ 515 | elm = RB_ROOT(head); \ 516 | break; \ 517 | } \ 518 | } \ 519 | } \ 520 | if (elm) \ 521 | RB_COLOR(elm, field) = RB_BLACK; \ 522 | } \ 523 | \ 524 | attr struct type * \ 525 | name##_RB_REMOVE(struct name *head, struct type *elm) \ 526 | { \ 527 | struct type *child, *parent, *old = elm; \ 528 | int color; \ 529 | if (RB_LEFT(elm, field) == NULL) \ 530 | child = RB_RIGHT(elm, field); \ 531 | else if (RB_RIGHT(elm, field) == NULL) \ 532 | child = RB_LEFT(elm, field); \ 533 | else { \ 534 | struct type *left; \ 535 | elm = RB_RIGHT(elm, field); \ 536 | while ((left = RB_LEFT(elm, field)) != NULL) \ 537 | elm = left; \ 538 | child = RB_RIGHT(elm, field); \ 539 | parent = RB_PARENT(elm, field); \ 540 | color = RB_COLOR(elm, field); \ 541 | if (child) \ 542 | RB_PARENT(child, field) = parent; \ 543 | if (parent) { \ 544 | if (RB_LEFT(parent, field) == elm) \ 545 | RB_LEFT(parent, field) = child; \ 546 | else \ 547 | RB_RIGHT(parent, field) = child; \ 548 | RB_AUGMENT(parent); \ 549 | } else \ 550 | RB_ROOT(head) = child; \ 551 | if (RB_PARENT(elm, field) == old) \ 552 | parent = elm; \ 553 | (elm)->field = (old)->field; \ 554 | if (RB_PARENT(old, field)) { \ 555 | if (RB_LEFT(RB_PARENT(old, field), field) == old) \ 556 | RB_LEFT(RB_PARENT(old, field), field) = elm; \ 557 | else \ 558 | RB_RIGHT(RB_PARENT(old, field), field) = elm; \ 559 | RB_AUGMENT(RB_PARENT(old, field)); \ 560 | } else \ 561 | RB_ROOT(head) = elm; \ 562 | RB_PARENT(RB_LEFT(old, field), field) = elm; \ 563 | if (RB_RIGHT(old, field)) \ 564 | RB_PARENT(RB_RIGHT(old, field), field) = elm; \ 565 | if (parent) { \ 566 | left = parent; \ 567 | do { \ 568 | RB_AUGMENT(left); \ 569 | } while ((left = RB_PARENT(left, field)) != NULL); \ 570 | } \ 571 | goto color; \ 572 | } \ 573 | parent = RB_PARENT(elm, field); \ 574 | color = RB_COLOR(elm, field); \ 575 | if (child) \ 576 | RB_PARENT(child, field) = parent; \ 577 | if (parent) { \ 578 | if (RB_LEFT(parent, field) == elm) \ 579 | RB_LEFT(parent, field) = child; \ 580 | else \ 581 | RB_RIGHT(parent, field) = child; \ 582 | RB_AUGMENT(parent); \ 583 | } else \ 584 | RB_ROOT(head) = child; \ 585 | color: \ 586 | if (color == RB_BLACK) \ 587 | name##_RB_REMOVE_COLOR(head, parent, child); \ 588 | return (old); \ 589 | } \ 590 | \ 591 | /* Inserts a node into the RB tree */ \ 592 | attr struct type * \ 593 | name##_RB_INSERT(struct name *head, struct type *elm) { \ 594 | struct type *tmp; \ 595 | struct type *parent = NULL; \ 596 | int comp = 0; \ 597 | tmp = RB_ROOT(head); \ 598 | while (tmp) { \ 599 | parent = tmp; \ 600 | comp = (cmp)(elm, parent); \ 601 | if (comp < 0) \ 602 | tmp = RB_LEFT(tmp, field); \ 603 | else if (comp > 0) \ 604 | tmp = RB_RIGHT(tmp, field); \ 605 | else \ 606 | return (tmp); \ 607 | } \ 608 | RB_SET(elm, parent, field); \ 609 | if (parent != NULL) { \ 610 | if (comp < 0) \ 611 | RB_LEFT(parent, field) = elm; \ 612 | else \ 613 | RB_RIGHT(parent, field) = elm; \ 614 | RB_AUGMENT(parent); \ 615 | } else \ 616 | RB_ROOT(head) = elm; \ 617 | name##_RB_INSERT_COLOR(head, elm); \ 618 | return (NULL); \ 619 | } \ 620 | \ 621 | /* Finds the node with the same key as elm */ \ 622 | attr struct type * \ 623 | name##_RB_FIND(struct name *head, struct type *elm) { \ 624 | struct type *tmp = RB_ROOT(head); \ 625 | int comp; \ 626 | while (tmp) { \ 627 | comp = cmp(elm, tmp); \ 628 | if (comp < 0) \ 629 | tmp = RB_LEFT(tmp, field); \ 630 | else if (comp > 0) \ 631 | tmp = RB_RIGHT(tmp, field); \ 632 | else \ 633 | return (tmp); \ 634 | } \ 635 | return (NULL); \ 636 | } \ 637 | \ 638 | /* Finds the first node greater than or equal to the search key */ \ 639 | attr struct type * \ 640 | name##_RB_NFIND(struct name *head, struct type *elm) \ 641 | { \ 642 | struct type *tmp = RB_ROOT(head); \ 643 | struct type *res = NULL; \ 644 | int comp; \ 645 | while (tmp) { \ 646 | comp = cmp(elm, tmp); \ 647 | if (comp < 0) { \ 648 | res = tmp; \ 649 | tmp = RB_LEFT(tmp, field); \ 650 | } \ 651 | else if (comp > 0) \ 652 | tmp = RB_RIGHT(tmp, field); \ 653 | else \ 654 | return (tmp); \ 655 | } \ 656 | return (res); \ 657 | } \ 658 | \ 659 | /* ARGSUSED */ \ 660 | attr struct type * \ 661 | name##_RB_NEXT(struct type *elm) \ 662 | { \ 663 | if (RB_RIGHT(elm, field)) { \ 664 | elm = RB_RIGHT(elm, field); \ 665 | while (RB_LEFT(elm, field)) \ 666 | elm = RB_LEFT(elm, field); \ 667 | } else { \ 668 | if (RB_PARENT(elm, field) && \ 669 | (elm == RB_LEFT(RB_PARENT(elm, field), field))) \ 670 | elm = RB_PARENT(elm, field); \ 671 | else { \ 672 | while (RB_PARENT(elm, field) && \ 673 | (elm == RB_RIGHT(RB_PARENT(elm, field), field))) \ 674 | elm = RB_PARENT(elm, field); \ 675 | elm = RB_PARENT(elm, field); \ 676 | } \ 677 | } \ 678 | return (elm); \ 679 | } \ 680 | \ 681 | /* ARGSUSED */ \ 682 | attr struct type * \ 683 | name##_RB_PREV(struct type *elm) \ 684 | { \ 685 | if (RB_LEFT(elm, field)) { \ 686 | elm = RB_LEFT(elm, field); \ 687 | while (RB_RIGHT(elm, field)) \ 688 | elm = RB_RIGHT(elm, field); \ 689 | } else { \ 690 | if (RB_PARENT(elm, field) && \ 691 | (elm == RB_RIGHT(RB_PARENT(elm, field), field))) \ 692 | elm = RB_PARENT(elm, field); \ 693 | else { \ 694 | while (RB_PARENT(elm, field) && \ 695 | (elm == RB_LEFT(RB_PARENT(elm, field), field))) \ 696 | elm = RB_PARENT(elm, field); \ 697 | elm = RB_PARENT(elm, field); \ 698 | } \ 699 | } \ 700 | return (elm); \ 701 | } \ 702 | \ 703 | attr struct type * \ 704 | name##_RB_MINMAX(struct name *head, int val) \ 705 | { \ 706 | struct type *tmp = RB_ROOT(head); \ 707 | struct type *parent = NULL; \ 708 | while (tmp) { \ 709 | parent = tmp; \ 710 | if (val < 0) \ 711 | tmp = RB_LEFT(tmp, field); \ 712 | else \ 713 | tmp = RB_RIGHT(tmp, field); \ 714 | } \ 715 | return (parent); \ 716 | } 717 | 718 | #define RB_NEGINF -1 719 | #define RB_INF 1 720 | 721 | #define RB_INSERT(name, x, y) name##_RB_INSERT(x, y) 722 | #define RB_REMOVE(name, x, y) name##_RB_REMOVE(x, y) 723 | #define RB_FIND(name, x, y) name##_RB_FIND(x, y) 724 | #define RB_NFIND(name, x, y) name##_RB_NFIND(x, y) 725 | #define RB_NEXT(name, x, y) name##_RB_NEXT(y) 726 | #define RB_PREV(name, x, y) name##_RB_PREV(y) 727 | #define RB_MIN(name, x) name##_RB_MINMAX(x, RB_NEGINF) 728 | #define RB_MAX(name, x) name##_RB_MINMAX(x, RB_INF) 729 | 730 | #define RB_FOREACH(x, name, head) \ 731 | for ((x) = RB_MIN(name, head); \ 732 | (x) != NULL; \ 733 | (x) = name##_RB_NEXT(x)) 734 | 735 | #define RB_FOREACH_FROM(x, name, y) \ 736 | for ((x) = (y); \ 737 | ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \ 738 | (x) = (y)) 739 | 740 | #define RB_FOREACH_SAFE(x, name, head, y) \ 741 | for ((x) = RB_MIN(name, head); \ 742 | ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \ 743 | (x) = (y)) 744 | 745 | #define RB_FOREACH_REVERSE(x, name, head) \ 746 | for ((x) = RB_MAX(name, head); \ 747 | (x) != NULL; \ 748 | (x) = name##_RB_PREV(x)) 749 | 750 | #define RB_FOREACH_REVERSE_FROM(x, name, y) \ 751 | for ((x) = (y); \ 752 | ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \ 753 | (x) = (y)) 754 | 755 | #define RB_FOREACH_REVERSE_SAFE(x, name, head, y) \ 756 | for ((x) = RB_MAX(name, head); \ 757 | ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \ 758 | (x) = (y)) 759 | 760 | 761 | 762 | #endif 763 | 764 | 765 | 766 | 767 | 768 | -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | #服务名称 2 | ./build/test -------------------------------------------------------------------------------- /tcp.c: -------------------------------------------------------------------------------- 1 | #include "tcp.h" 2 | 3 | static struct tcp_stream * tcp_stream_create(uint32_t sip, uint32_t dip, uint16_t sport, uint16_t dport) 4 | { 5 | char acBuf[32] = {0}; 6 | unsigned int uiSeed; 7 | struct tcp_stream *pstStream = rte_malloc("tcp_stream", sizeof(struct tcp_stream), 0); 8 | if (pstStream == NULL) 9 | return NULL; 10 | 11 | <<<<<<< HEAD 12 | printf("tcp_stream_create!\n"); 13 | 14 | ======= 15 | >>>>>>> c472b4b5fbedc52450a9bd050d196d2515ca995f 16 | pstStream->sip = sip; 17 | pstStream->dip = dip; 18 | pstStream->sport = sport; 19 | pstStream->dport = dport; 20 | pstStream->protocol = IPPROTO_TCP; 21 | pstStream->fd = -1; 22 | pstStream->status = TCP_STATUS_LISTEN; 23 | 24 | sprintf(acBuf, "sndbuf%x%d", sip, sport); 25 | pstStream->sndbuf = rte_ring_create(acBuf, D_RING_SIZE, rte_socket_id(), 0); 26 | sprintf(acBuf, "rcvbuf%x%d", sip, sport); 27 | pstStream->rcvbuf = rte_ring_create(acBuf, D_RING_SIZE, rte_socket_id(), 0); 28 | 29 | // seq num 30 | uiSeed = time(NULL); 31 | pstStream->snd_nxt = rand_r(&uiSeed) % D_TCP_MAX_SEQ; 32 | rte_memcpy(pstStream->localmac, &g_stCpuMac, RTE_ETHER_ADDR_LEN); 33 | 34 | pthread_cond_t blank_cond = PTHREAD_COND_INITIALIZER; 35 | rte_memcpy(&pstStream->cond, &blank_cond, sizeof(pthread_cond_t)); 36 | 37 | pthread_mutex_t blank_mutex = PTHREAD_MUTEX_INITIALIZER; 38 | rte_memcpy(&pstStream->mutex, &blank_mutex, sizeof(pthread_mutex_t)); 39 | 40 | return pstStream; 41 | } 42 | 43 | static int tcp_handle_listen(struct tcp_stream *pstStream, struct rte_tcp_hdr *pstTcphdr, 44 | struct rte_ipv4_hdr *pstIphdr) 45 | { 46 | if (pstTcphdr->tcp_flags & RTE_TCP_SYN_FLAG) 47 | { 48 | if (pstStream->status == TCP_STATUS_LISTEN) 49 | { 50 | struct tcp_stream *pstSyn = tcp_stream_create(pstIphdr->src_addr, pstIphdr->dst_addr, 51 | pstTcphdr->src_port, pstTcphdr->dst_port); 52 | LL_ADD(pstSyn, g_pstTcpTbl->tcb_set); 53 | 54 | struct tcp_fragment *pstFragment = rte_malloc("tcp_fragment", sizeof(struct tcp_fragment), 0); 55 | if (pstFragment == NULL) 56 | return -1; 57 | memset(pstFragment, 0, sizeof(struct tcp_fragment)); 58 | 59 | pstFragment->sport = pstTcphdr->dst_port; 60 | pstFragment->dport = pstTcphdr->src_port; 61 | 62 | struct in_addr addr; 63 | addr.s_addr = pstSyn->sip; 64 | printf("tcp ---> src: %s:%d ", inet_ntoa(addr), ntohs(pstTcphdr->src_port)); 65 | 66 | addr.s_addr = pstSyn->dip; 67 | printf(" ---> dst: %s:%d \n", inet_ntoa(addr), ntohs(pstTcphdr->dst_port)); 68 | 69 | pstFragment->seqnum = pstSyn->snd_nxt; 70 | pstFragment->acknum = ntohl(pstTcphdr->sent_seq) + 1; 71 | pstSyn->rcv_nxt = pstFragment->acknum; 72 | 73 | pstFragment->tcp_flags = (RTE_TCP_SYN_FLAG | RTE_TCP_ACK_FLAG); 74 | pstFragment->windows = D_TCP_INITIAL_WINDOW; 75 | pstFragment->hdrlen_off = 0x50; 76 | 77 | pstFragment->data = NULL; 78 | pstFragment->length = 0; 79 | 80 | rte_ring_mp_enqueue(pstSyn->sndbuf, pstFragment); 81 | 82 | pstSyn->status = TCP_STATUS_SYN_RCVD; 83 | } 84 | } 85 | 86 | return 0; 87 | } 88 | 89 | static int tcp_handle_syn_rcvd(struct tcp_stream *pstStream, struct rte_tcp_hdr *pstTcphdr) 90 | { 91 | if (pstTcphdr->tcp_flags & RTE_TCP_ACK_FLAG) 92 | { 93 | if (pstStream->status == TCP_STATUS_SYN_RCVD) 94 | { 95 | uint32_t acknum = ntohl(pstTcphdr->recv_ack); 96 | if (acknum == pstStream->snd_nxt + 1) 97 | { 98 | printf("ack response success!\n"); 99 | } 100 | else 101 | { 102 | printf("ack response error! \n"); 103 | } 104 | 105 | pstStream->status = TCP_STATUS_ESTABLISHED; 106 | 107 | // accept 108 | struct tcp_stream *pstListener = tcp_stream_search(0, 0, 0, pstStream->dport); 109 | if (pstListener == NULL) 110 | { 111 | rte_exit(EXIT_FAILURE, "tcp_stream_search failed\n"); 112 | } 113 | 114 | pthread_mutex_lock(&pstListener->mutex); 115 | pthread_cond_signal(&pstListener->cond); // 唤醒accept中的等待 116 | pthread_mutex_unlock(&pstListener->mutex); 117 | 118 | #if ENABLE_SINGLE_EPOLL 119 | 120 | <<<<<<< HEAD 121 | epoll_event_callback(g_pstTcpTbl->ep, pstListener->fd, EPOLLIN); 122 | ======= 123 | struct ng_tcp_table *table = tcpInstance(); 124 | epoll_event_callback(table->ep, listener->fd, EPOLLIN); 125 | >>>>>>> c472b4b5fbedc52450a9bd050d196d2515ca995f 126 | #endif 127 | } 128 | } 129 | 130 | return 0; 131 | } 132 | 133 | static int ng_tcp_enqueue_recvbuffer(struct tcp_stream *pstStream, struct rte_tcp_hdr *pstTcphdr, int iTcplen) 134 | { 135 | struct tcp_fragment *pstFragment = rte_malloc("tcp_fragment", sizeof(struct tcp_fragment), 0); 136 | if (pstFragment == NULL) 137 | return -1; 138 | 139 | memset(pstFragment, 0, sizeof(struct tcp_fragment)); 140 | pstFragment->dport = ntohs(pstTcphdr->dst_port); 141 | pstFragment->sport = ntohs(pstTcphdr->src_port); 142 | 143 | // data_off:前4位表示包头到数据域起始位置之间的大小 144 | // 每一位表示4Byte,最大表示为 15*4Byte 大小 145 | uint8_t hdrlen = pstTcphdr->data_off >> 4; 146 | int payloadlen = iTcplen - hdrlen * 4; // 数据域长度 147 | <<<<<<< HEAD 148 | // if (pstTcphdr->tcp_flags & RTE_TCP_FIN_FLAG) 149 | // printf("iTcplen = %d\n", iTcplen); 150 | // printf("payloadlen = %d\n", payloadlen); 151 | 152 | ======= 153 | if (pstTcphdr->tcp_flags & RTE_TCP_FIN_FLAG) 154 | printf("iTcplen = %d\n", iTcplen); 155 | printf("payloadlen = %d\n", payloadlen); 156 | >>>>>>> c472b4b5fbedc52450a9bd050d196d2515ca995f 157 | if(payloadlen > 0) 158 | { 159 | uint8_t *payload = (uint8_t*)pstTcphdr + hdrlen * 4; 160 | 161 | pstFragment->data = rte_malloc("unsigned char *", payloadlen+1, 0); 162 | if (pstFragment->data == NULL) 163 | { 164 | rte_free(pstFragment); 165 | return -1; 166 | } 167 | 168 | memset(pstFragment->data, 0, payloadlen + 1); 169 | rte_memcpy(pstFragment->data, payload, payloadlen); 170 | pstFragment->length = payloadlen; 171 | } 172 | else if(payloadlen == 0) 173 | { 174 | pstFragment->length = 0; 175 | pstFragment->data = NULL; 176 | } 177 | 178 | rte_ring_mp_enqueue(pstStream->rcvbuf, pstFragment); 179 | 180 | pthread_mutex_lock(&pstStream->mutex); 181 | pthread_cond_signal(&pstStream->cond); 182 | pthread_mutex_unlock(&pstStream->mutex); 183 | 184 | return 0; 185 | } 186 | 187 | static int ng_tcp_send_ackpkt(struct tcp_stream *pstStream, struct rte_tcp_hdr *pstTcphdr) 188 | { 189 | struct tcp_fragment *pstAckFrag = rte_malloc("tcp_fragment", sizeof(struct tcp_fragment), 0); 190 | if (pstAckFrag == NULL) 191 | return -1; 192 | 193 | memset(pstAckFrag, 0, sizeof(struct tcp_fragment)); 194 | pstAckFrag->dport = pstTcphdr->src_port; 195 | pstAckFrag->sport = pstTcphdr->dst_port; 196 | 197 | // remote 198 | 199 | <<<<<<< HEAD 200 | printf("tcp_send_ackpkt: %d, %d\n", ntohs(pstStream->rcv_nxt), ntohs(pstTcphdr->sent_seq)); 201 | ======= 202 | printf("tcp_send_ackpkt: %d, %d\n", pstStream->rcv_nxt, ntohs(pstTcphdr->sent_seq)); 203 | >>>>>>> c472b4b5fbedc52450a9bd050d196d2515ca995f 204 | 205 | pstAckFrag->acknum = pstStream->rcv_nxt; 206 | pstAckFrag->seqnum = pstStream->snd_nxt; 207 | pstAckFrag->tcp_flags = RTE_TCP_ACK_FLAG; 208 | pstAckFrag->windows = D_TCP_INITIAL_WINDOW; 209 | pstAckFrag->hdrlen_off = 0x50; 210 | pstAckFrag->data = NULL; 211 | pstAckFrag->length = 0; 212 | 213 | rte_ring_mp_enqueue(pstStream->sndbuf, pstAckFrag); 214 | 215 | return 0; 216 | } 217 | 218 | static int tcp_handle_established(struct tcp_stream *pstStream, struct rte_tcp_hdr *pstTcphdr, int iTcplen) 219 | { 220 | if (pstTcphdr->tcp_flags & RTE_TCP_SYN_FLAG) // 异常:收到对端的SYN重传包 221 | { 222 | <<<<<<< HEAD 223 | // printf("RTE_TCP_SYN_FLAG\n"); 224 | ======= 225 | printf("RTE_TCP_SYN_FLAG\n"); 226 | >>>>>>> c472b4b5fbedc52450a9bd050d196d2515ca995f 227 | } 228 | if(pstTcphdr->tcp_flags & RTE_TCP_PSH_FLAG) // 收到对端的数据包,TCP数据域不为0 229 | { 230 | ng_tcp_enqueue_recvbuffer(pstStream, pstTcphdr, iTcplen); 231 | 232 | #if ENABLE_SINGLE_EPOLL 233 | <<<<<<< HEAD 234 | epoll_event_callback(g_pstTcpTbl->ep, pstStream->fd, EPOLLIN); 235 | ======= 236 | struct ng_tcp_table *table = tcpInstance(); 237 | epoll_event_callback(table->ep, stream->fd, EPOLLIN); 238 | >>>>>>> c472b4b5fbedc52450a9bd050d196d2515ca995f 239 | #endif 240 | 241 | uint8_t hdrlen = pstTcphdr->data_off >> 4; 242 | int payloadlen = iTcplen - hdrlen * 4; 243 | 244 | <<<<<<< HEAD 245 | pstStream->rcv_nxt = pstStream->rcv_nxt + payloadlen; // ntohl(pstStream->rcv_nxt + payloadlen); 246 | ======= 247 | pstStream->rcv_nxt = ntohl(pstStream->rcv_nxt + payloadlen); 248 | >>>>>>> c472b4b5fbedc52450a9bd050d196d2515ca995f 249 | pstStream->snd_nxt = ntohl(pstTcphdr->recv_ack); 250 | 251 | ng_tcp_send_ackpkt(pstStream, pstTcphdr); 252 | } 253 | if(pstTcphdr->tcp_flags & RTE_TCP_ACK_FLAG) // 异常:收到对端的ACK重传包 254 | { 255 | <<<<<<< HEAD 256 | // printf("RTE_TCP_ACK_FLAG\n"); 257 | ======= 258 | printf("RTE_TCP_ACK_FLAG\n"); 259 | >>>>>>> c472b4b5fbedc52450a9bd050d196d2515ca995f 260 | } 261 | if (pstTcphdr->tcp_flags & RTE_TCP_FIN_FLAG) // 对端关闭连接 262 | { 263 | printf("RTE_TCP_FIN_FLAG\n"); 264 | pstStream->status = TCP_STATUS_CLOSE_WAIT; 265 | 266 | <<<<<<< HEAD 267 | // 通知recv函数接收数据包 268 | ng_tcp_enqueue_recvbuffer(pstStream, pstTcphdr, pstTcphdr->data_off >> 4); 269 | 270 | #if ENABLE_SINGLE_EPOLL 271 | epoll_event_callback(g_pstTcpTbl->ep, pstStream->fd, EPOLLIN); 272 | #endif 273 | // send ack ptk 274 | pstStream->rcv_nxt = pstStream->rcv_nxt + 1;// ntohl(pstStream->rcv_nxt + 1); 275 | pstStream->snd_nxt = ntohl(pstTcphdr->recv_ack); 276 | 277 | // 发送ACK响应至对端 278 | ng_tcp_send_ackpkt(pstStream, pstTcphdr); 279 | ======= 280 | ng_tcp_enqueue_recvbuffer(pstStream, pstTcphdr, pstTcphdr->data_off >> 4); 281 | 282 | #if ENABLE_SINGLE_EPOLL 283 | 284 | struct ng_tcp_table *table = tcpInstance(); 285 | epoll_event_callback(table->ep, stream->fd, EPOLLIN); 286 | 287 | #endif 288 | // send ack ptk 289 | pstStream->rcv_nxt = ntohl(pstStream->rcv_nxt + 1); 290 | pstStream->snd_nxt = ntohl(pstTcphdr->recv_ack); 291 | 292 | ng_tcp_send_ackpkt(pstStream, pstTcphdr); 293 | >>>>>>> c472b4b5fbedc52450a9bd050d196d2515ca995f 294 | } 295 | 296 | return 0; 297 | } 298 | 299 | static int tcp_handle_close_wait(struct tcp_stream *stream, struct rte_tcp_hdr *tcphdr) 300 | { 301 | if (tcphdr->tcp_flags & RTE_TCP_FIN_FLAG) 302 | { 303 | if (stream->status == TCP_STATUS_CLOSE_WAIT) 304 | { 305 | 306 | } 307 | } 308 | 309 | return 0; 310 | } 311 | 312 | static int tcp_handle_last_ack(struct tcp_stream *stream, struct rte_tcp_hdr *tcphdr) 313 | { 314 | if (tcphdr->tcp_flags & RTE_TCP_ACK_FLAG) 315 | { 316 | if (stream->status == TCP_STATUS_LAST_ACK) 317 | { 318 | stream->status = TCP_STATUS_CLOSED; 319 | printf("tcp_handle_last_ack\n"); 320 | 321 | LL_REMOVE(stream, g_pstTcpTbl->tcb_set); 322 | 323 | rte_ring_free(stream->sndbuf); 324 | rte_ring_free(stream->rcvbuf); 325 | 326 | rte_free(stream); 327 | } 328 | } 329 | 330 | return 0; 331 | } 332 | 333 | int tcp_process(struct rte_mbuf *pstTcpMbuf) 334 | { 335 | struct rte_ipv4_hdr *pstIpHdr; 336 | struct rte_tcp_hdr *pstTcpHdr; 337 | struct tcp_stream *pstTcpStream; 338 | <<<<<<< HEAD 339 | unsigned short usOldTcpCkSum; 340 | ======= 341 | unsigned short usOldTcpCkSum; 342 | >>>>>>> c472b4b5fbedc52450a9bd050d196d2515ca995f 343 | unsigned short usNewTcpCkSum; 344 | 345 | pstIpHdr = rte_pktmbuf_mtod_offset(pstTcpMbuf, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); 346 | pstTcpHdr = (struct rte_tcp_hdr *)(pstIpHdr + 1); 347 | 348 | // 校验和 349 | usOldTcpCkSum = pstTcpHdr->cksum; 350 | pstTcpHdr->cksum = 0; 351 | usNewTcpCkSum = rte_ipv4_udptcp_cksum(pstIpHdr, pstTcpHdr); 352 | if (usOldTcpCkSum != usNewTcpCkSum) 353 | { 354 | printf("cksum: %x, tcp cksum: %x\n", usOldTcpCkSum, usNewTcpCkSum); 355 | rte_pktmbuf_free(pstTcpMbuf); 356 | return -1; 357 | } 358 | 359 | // 搜索涵盖了半连接队列和全连接队列 360 | // 搜索的stream,根据status状态调用对应处理函数 361 | pstTcpStream = tcp_stream_search(pstIpHdr->src_addr, pstIpHdr->dst_addr, 362 | pstTcpHdr->src_port, pstTcpHdr->dst_port); 363 | if (pstTcpStream == NULL) 364 | { 365 | <<<<<<< HEAD 366 | ======= 367 | puts("no tcb create!"); 368 | >>>>>>> c472b4b5fbedc52450a9bd050d196d2515ca995f 369 | rte_pktmbuf_free(pstTcpMbuf); 370 | return -2; 371 | } 372 | 373 | switch(pstTcpStream->status) 374 | { 375 | case TCP_STATUS_CLOSED: //client 376 | break; 377 | 378 | case TCP_STATUS_LISTEN: // server 379 | tcp_handle_listen(pstTcpStream, pstTcpHdr, pstIpHdr); 380 | break; 381 | 382 | case TCP_STATUS_SYN_RCVD: // server 383 | tcp_handle_syn_rcvd(pstTcpStream, pstTcpHdr); 384 | break; 385 | 386 | case TCP_STATUS_SYN_SENT: // client 387 | break; 388 | 389 | case TCP_STATUS_ESTABLISHED: // server | client 390 | { 391 | int tcplen = ntohs(pstIpHdr->total_length) - sizeof(struct rte_ipv4_hdr); 392 | tcp_handle_established(pstTcpStream, pstTcpHdr, tcplen); 393 | printf("tcplen = %d\n", tcplen); 394 | break; 395 | } 396 | case TCP_STATUS_FIN_WAIT_1: // ~client 397 | break; 398 | 399 | case TCP_STATUS_FIN_WAIT_2: // ~client 400 | break; 401 | 402 | case TCP_STATUS_CLOSING: // ~client 403 | break; 404 | 405 | case TCP_STATUS_TIME_WAIT: // ~client 406 | break; 407 | 408 | case TCP_STATUS_CLOSE_WAIT: // ~server 409 | tcp_handle_close_wait(pstTcpStream, pstTcpHdr); 410 | break; 411 | 412 | case TCP_STATUS_LAST_ACK: // ~server 413 | tcp_handle_last_ack(pstTcpStream, pstTcpHdr); 414 | break; 415 | } 416 | 417 | return 0; 418 | } 419 | 420 | static int ng_encode_tcp_apppkt(uint8_t *msg, uint32_t sip, uint32_t dip, 421 | uint8_t *srcmac, uint8_t *dstmac, struct tcp_fragment *fragment, unsigned int total_len) 422 | { 423 | struct rte_ether_hdr *pstEth; 424 | struct rte_ipv4_hdr *pstIp; 425 | struct rte_tcp_hdr *pstTcp; 426 | 427 | // 1 ethhdr 428 | pstEth = (struct rte_ether_hdr *)msg; 429 | rte_memcpy(pstEth->s_addr.addr_bytes, srcmac, RTE_ETHER_ADDR_LEN); 430 | rte_memcpy(pstEth->d_addr.addr_bytes, dstmac, RTE_ETHER_ADDR_LEN); 431 | pstEth->ether_type = htons(RTE_ETHER_TYPE_IPV4); 432 | 433 | // 2 iphdr 434 | pstIp = (struct rte_ipv4_hdr *)(pstEth + 1); 435 | pstIp->version_ihl = 0x45; 436 | pstIp->type_of_service = 0; 437 | pstIp->total_length = htons(total_len - sizeof(struct rte_ether_hdr)); 438 | pstIp->packet_id = 0; 439 | pstIp->fragment_offset = 0; 440 | pstIp->time_to_live = 64; // ttl = 64 441 | pstIp->next_proto_id = IPPROTO_TCP; 442 | pstIp->src_addr = sip; 443 | pstIp->dst_addr = dip; 444 | pstIp->hdr_checksum = 0; 445 | pstIp->hdr_checksum = rte_ipv4_cksum(pstIp); 446 | 447 | // 3 tcphdr 448 | pstTcp = (struct rte_tcp_hdr *)(pstIp + 1); 449 | pstTcp->src_port = fragment->sport; 450 | pstTcp->dst_port = fragment->dport; 451 | pstTcp->sent_seq = htonl(fragment->seqnum); 452 | pstTcp->recv_ack = htonl(fragment->acknum); 453 | pstTcp->data_off = fragment->hdrlen_off; 454 | pstTcp->rx_win = fragment->windows; 455 | pstTcp->tcp_urp = fragment->tcp_urp; 456 | pstTcp->tcp_flags = fragment->tcp_flags; 457 | if (fragment->data != NULL) 458 | { 459 | uint8_t *payload = (uint8_t*)(pstTcp + 1) + fragment->optlen * sizeof(uint32_t); 460 | rte_memcpy(payload, fragment->data, fragment->length); 461 | } 462 | pstTcp->cksum = 0; 463 | pstTcp->cksum = rte_ipv4_udptcp_cksum(pstIp, pstTcp); 464 | 465 | return 0; 466 | } 467 | 468 | 469 | static struct rte_mbuf * ng_tcp_pkt(struct rte_mempool *mbuf_pool, uint32_t sip, uint32_t dip, 470 | uint8_t *srcmac, uint8_t *dstmac, struct tcp_fragment *fragment) 471 | { 472 | unsigned int uiTotalLen; 473 | struct rte_mbuf *pstMbuf; 474 | unsigned char *pucPktData; 475 | 476 | uiTotalLen = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_tcp_hdr) + 477 | fragment->optlen * sizeof(uint32_t) + fragment->length; 478 | 479 | pstMbuf = rte_pktmbuf_alloc(mbuf_pool); 480 | if (!pstMbuf) 481 | rte_exit(EXIT_FAILURE, "rte_pktmbuf_alloc\n"); 482 | 483 | pstMbuf->pkt_len = uiTotalLen; 484 | pstMbuf->data_len = uiTotalLen; 485 | pucPktData = rte_pktmbuf_mtod(pstMbuf, unsigned char*); 486 | 487 | ng_encode_tcp_apppkt(pucPktData, sip, dip, srcmac, dstmac, fragment, uiTotalLen); 488 | 489 | return pstMbuf; 490 | } 491 | 492 | int tcp_out(struct rte_mempool *pstMbufPool) 493 | { 494 | struct tcp_table *pstTable = tcpInstance(); 495 | struct tcp_stream *pstStream = NULL; 496 | <<<<<<< HEAD 497 | 498 | ======= 499 | 500 | >>>>>>> c472b4b5fbedc52450a9bd050d196d2515ca995f 501 | for(pstStream = pstTable->tcb_set; pstStream != NULL; pstStream = pstStream->next) 502 | { 503 | if(pstStream->sndbuf == NULL) 504 | continue; 505 | 506 | struct tcp_fragment *pstFragment = NULL; 507 | int iSendCnt = rte_ring_mc_dequeue(pstStream->sndbuf, (void**)&pstFragment); 508 | if (iSendCnt < 0) 509 | continue; 510 | 511 | <<<<<<< HEAD 512 | // struct in_addr addr; 513 | // addr.s_addr = pstStream->sip; 514 | // printf("tcp_out ---> src: %s:%d \n", inet_ntoa(addr), ntohs(pstFragment->dport)); 515 | ======= 516 | struct in_addr addr; 517 | addr.s_addr = pstStream->sip; 518 | printf("tcp_out ---> src: %s:%d \n", inet_ntoa(addr), ntohs(pstFragment->dport)); 519 | >>>>>>> c472b4b5fbedc52450a9bd050d196d2515ca995f 520 | 521 | uint8_t *dstmac = ng_get_dst_macaddr(pstStream->sip); // 这里的源ip指的是对端ip 522 | if (dstmac == NULL) // 先广播发个arp包确定对端mac地址 523 | { 524 | <<<<<<< HEAD 525 | printf("ng_send_arp\n"); 526 | ======= 527 | //printf("ng_send_arp\n"); 528 | >>>>>>> c472b4b5fbedc52450a9bd050d196d2515ca995f 529 | struct rte_mbuf *pstArpbuf = ng_send_arp(pstMbufPool, RTE_ARP_OP_REQUEST, g_aucDefaultArpMac, 530 | pstStream->dip, pstStream->sip); 531 | 532 | rte_ring_mp_enqueue_burst(g_pstRingIns->pstOutRing, (void **)&pstArpbuf, 1, NULL); 533 | 534 | rte_ring_mp_enqueue(pstStream->sndbuf, pstFragment); // 将取出的数据再次放入队列 535 | } 536 | else 537 | { 538 | <<<<<<< HEAD 539 | printf("ng_send_data\n"); 540 | ======= 541 | >>>>>>> c472b4b5fbedc52450a9bd050d196d2515ca995f 542 | struct rte_mbuf *pstTcpBuf = ng_tcp_pkt(pstMbufPool, pstStream->dip, pstStream->sip, 543 | pstStream->localmac, dstmac, pstFragment); 544 | 545 | rte_ring_mp_enqueue_burst(g_pstRingIns->pstOutRing, (void **)&pstTcpBuf, 1, NULL); 546 | 547 | if (pstFragment->data != NULL) 548 | rte_free(pstFragment->data); 549 | 550 | rte_free(pstFragment); 551 | } 552 | } 553 | 554 | return 0; 555 | } -------------------------------------------------------------------------------- /tcp.h: -------------------------------------------------------------------------------- 1 | #ifndef __TCP_H__ 2 | #define __TCP_H__ 3 | 4 | #include "common.h" 5 | 6 | int tcp_process(struct rte_mbuf *pstTcpMbuf); 7 | int tcp_out(struct rte_mempool *pstMbufPool); 8 | 9 | // 11种tcp连接状态 10 | typedef enum _ENUM_TCP_STATUS 11 | { 12 | TCP_STATUS_CLOSED = 0, 13 | TCP_STATUS_LISTEN, 14 | TCP_STATUS_SYN_RCVD, 15 | TCP_STATUS_SYN_SENT, 16 | TCP_STATUS_ESTABLISHED, 17 | 18 | TCP_STATUS_FIN_WAIT_1, 19 | TCP_STATUS_FIN_WAIT_2, 20 | TCP_STATUS_CLOSING, 21 | TCP_STATUS_TIME_WAIT, 22 | 23 | TCP_STATUS_CLOSE_WAIT, 24 | TCP_STATUS_LAST_ACK 25 | 26 | }TCP_STATUS; 27 | 28 | // tcb control block 29 | struct tcp_stream 30 | { 31 | int fd; 32 | 33 | uint32_t dip; 34 | uint8_t localmac[RTE_ETHER_ADDR_LEN]; 35 | uint16_t dport; 36 | 37 | uint8_t protocol; 38 | 39 | uint16_t sport; 40 | uint32_t sip; 41 | 42 | uint32_t snd_nxt; // seqnum 43 | uint32_t rcv_nxt; // acknum 44 | 45 | TCP_STATUS status; 46 | 47 | struct rte_ring *sndbuf; 48 | struct rte_ring *rcvbuf; 49 | 50 | struct tcp_stream *prev; 51 | struct tcp_stream *next; 52 | 53 | pthread_cond_t cond; 54 | pthread_mutex_t mutex; 55 | }; 56 | 57 | struct tcp_table 58 | { 59 | int count; 60 | //struct tcp_stream *listener_set; // 61 | #if ENABLE_SINGLE_EPOLL 62 | struct eventpoll *ep; // single epoll 63 | #endif 64 | struct tcp_stream *tcb_set; 65 | }; 66 | 67 | struct tcp_fragment 68 | { 69 | uint16_t sport; 70 | uint16_t dport; 71 | uint32_t seqnum; 72 | uint32_t acknum; 73 | uint8_t hdrlen_off; 74 | uint8_t tcp_flags; 75 | uint16_t windows; 76 | uint16_t cksum; 77 | uint16_t tcp_urp; 78 | 79 | int optlen; 80 | uint32_t option[D_TCP_OPTION_LENGTH]; 81 | 82 | unsigned char *data; 83 | uint32_t length; 84 | }; 85 | 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /udp.c: -------------------------------------------------------------------------------- 1 | #include "udp.h" 2 | 3 | 4 | int udp_process(struct rte_mbuf *pstUdpMbuf) 5 | { 6 | struct rte_ipv4_hdr *pstIpHdr; 7 | struct rte_udp_hdr *pstUdpHdr; 8 | struct localhost *pstHost; 9 | struct offload *pstOffLoad; 10 | 11 | pstIpHdr = rte_pktmbuf_mtod_offset(pstUdpMbuf, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); 12 | pstUdpHdr = (struct rte_udp_hdr *)(pstIpHdr + 1); 13 | 14 | pstHost = get_hostinfo_fromip_port(pstIpHdr->dst_addr, pstUdpHdr->dst_port, pstIpHdr->next_proto_id); 15 | if (pstHost == NULL) 16 | { 17 | rte_pktmbuf_free(pstUdpMbuf); 18 | return -3; 19 | } 20 | 21 | struct in_addr addr; 22 | addr.s_addr = pstIpHdr->src_addr; 23 | printf("udp_process ---> src: %s:%d \n", inet_ntoa(addr), ntohs(pstUdpHdr->src_port)); 24 | 25 | pstOffLoad = rte_malloc("offload", sizeof(struct offload), 0); 26 | if (pstOffLoad == NULL) 27 | { 28 | rte_pktmbuf_free(pstUdpMbuf); 29 | return -1; 30 | } 31 | 32 | pstOffLoad->dip = pstIpHdr->dst_addr; 33 | pstOffLoad->sip = pstIpHdr->src_addr; 34 | pstOffLoad->sport = pstUdpHdr->src_port; 35 | pstOffLoad->dport = pstUdpHdr->dst_port; 36 | pstOffLoad->protocol = IPPROTO_UDP; 37 | pstOffLoad->length = ntohs(pstUdpHdr->dgram_len); 38 | pstOffLoad->data = rte_malloc("unsigned char*", pstOffLoad->length - sizeof(struct rte_udp_hdr), 0); 39 | if (pstOffLoad->data == NULL) 40 | { 41 | rte_pktmbuf_free(pstUdpMbuf); 42 | rte_free(pstOffLoad); 43 | return -2; 44 | } 45 | 46 | rte_memcpy(pstOffLoad->data, (unsigned char *)(pstUdpHdr+1), pstOffLoad->length - sizeof(struct rte_udp_hdr)); 47 | 48 | rte_ring_mp_enqueue(pstHost->rcvbuf, pstOffLoad); // recv buffer 49 | 50 | pthread_mutex_lock(&pstHost->mutex); 51 | pthread_cond_signal(&pstHost->cond); 52 | pthread_mutex_unlock(&pstHost->mutex); 53 | 54 | rte_pktmbuf_free(pstUdpMbuf); 55 | 56 | return 0; 57 | } 58 | 59 | static int ng_encode_udp_apppkt(uint8_t *msg, uint32_t sip, uint32_t dip, 60 | uint16_t sport, uint16_t dport, uint8_t *srcmac, uint8_t *dstmac, 61 | unsigned char *data, uint16_t total_len) 62 | { 63 | struct rte_ether_hdr *pstEth; 64 | struct rte_ipv4_hdr *pstIp; 65 | struct rte_udp_hdr *pstUdp; 66 | 67 | // 1 ethhdr 68 | pstEth = (struct rte_ether_hdr *)msg; 69 | rte_memcpy(pstEth->s_addr.addr_bytes, srcmac, RTE_ETHER_ADDR_LEN); 70 | rte_memcpy(pstEth->d_addr.addr_bytes, dstmac, RTE_ETHER_ADDR_LEN); 71 | pstEth->ether_type = htons(RTE_ETHER_TYPE_IPV4); 72 | 73 | // 2 iphdr 74 | pstIp = (struct rte_ipv4_hdr *)(pstEth + 1); 75 | pstIp->version_ihl = 0x45; 76 | pstIp->type_of_service = 0; 77 | pstIp->total_length = htons(total_len - sizeof(struct rte_ether_hdr)); 78 | pstIp->packet_id = 0; 79 | pstIp->fragment_offset = 0; 80 | pstIp->time_to_live = 64; // ttl = 64 81 | pstIp->next_proto_id = IPPROTO_UDP; 82 | pstIp->src_addr = sip; 83 | pstIp->dst_addr = dip; 84 | pstIp->hdr_checksum = 0; 85 | pstIp->hdr_checksum = rte_ipv4_cksum(pstIp); 86 | 87 | // 3 udphdr 88 | pstUdp = (struct rte_udp_hdr *)(pstIp + 1); 89 | pstUdp->src_port = sport; 90 | pstUdp->dst_port = dport; 91 | uint16_t udplen = total_len - sizeof(struct rte_ether_hdr) - sizeof(struct rte_ipv4_hdr); 92 | pstUdp->dgram_len = htons(udplen); 93 | rte_memcpy((uint8_t*)(pstUdp + 1), data, udplen); 94 | pstUdp->dgram_cksum = 0; 95 | pstUdp->dgram_cksum = rte_ipv4_udptcp_cksum(pstIp, pstUdp); 96 | 97 | return 0; 98 | } 99 | 100 | static struct rte_mbuf * ng_udp_pkt(struct rte_mempool *mbuf_pool, uint32_t sip, uint32_t dip, 101 | uint16_t sport, uint16_t dport, unsigned char *srcmac, unsigned char *dstmac, 102 | unsigned char *data, uint16_t length) 103 | { 104 | unsigned int uiTotalLen; 105 | struct rte_mbuf *pstMbuf; 106 | unsigned char *pucPktData; 107 | 108 | uiTotalLen = length + 42; // 42 = eth + ip 109 | pstMbuf = rte_pktmbuf_alloc(mbuf_pool); 110 | if (!pstMbuf) 111 | rte_exit(EXIT_FAILURE, "rte_pktmbuf_alloc\n"); 112 | 113 | pstMbuf->pkt_len = uiTotalLen; 114 | pstMbuf->data_len = uiTotalLen; 115 | pucPktData = rte_pktmbuf_mtod(pstMbuf, unsigned char*); 116 | 117 | ng_encode_udp_apppkt(pucPktData, sip, dip, sport, dport, srcmac, dstmac, 118 | data, uiTotalLen); 119 | 120 | return pstMbuf; 121 | } 122 | 123 | int udp_out(struct rte_mempool *pstMbufPool) 124 | { 125 | struct localhost *pstHost; 126 | 127 | for(pstHost = g_pstHost; pstHost != NULL; pstHost = pstHost->next) 128 | { 129 | struct offload *pstOffLoad = NULL; 130 | int iSendCnt = rte_ring_mc_dequeue(pstHost->sndbuf, (void **)&pstOffLoad); 131 | if(iSendCnt < 0) 132 | continue; 133 | 134 | struct in_addr addr; 135 | addr.s_addr = pstOffLoad->dip; 136 | printf("udp_out ---> src: %s:%d \n", inet_ntoa(addr), ntohs(pstOffLoad->dport)); 137 | 138 | unsigned char *dstmac = ng_get_dst_macaddr(pstOffLoad->dip); // 查询对端mac地址 139 | if (dstmac == NULL) // 先广播发个arp包确定对端mac地址 140 | { 141 | struct rte_mbuf *pstArpbuf = ng_send_arp(pstMbufPool, RTE_ARP_OP_REQUEST, g_aucDefaultArpMac, 142 | pstOffLoad->sip, pstOffLoad->dip); 143 | 144 | rte_ring_mp_enqueue_burst(g_pstRingIns->pstOutRing, (void **)&pstArpbuf, 1, NULL); 145 | 146 | rte_ring_mp_enqueue(pstHost->sndbuf, pstOffLoad); // 将取出的udp数据再次写入队列 147 | } 148 | else 149 | { 150 | struct rte_mbuf *pstUdpbuf = ng_udp_pkt(pstMbufPool, pstOffLoad->sip, pstOffLoad->dip, 151 | pstOffLoad->sport, pstOffLoad->dport, pstHost->localmac, 152 | dstmac, pstOffLoad->data, pstOffLoad->length); 153 | 154 | rte_ring_mp_enqueue_burst(g_pstRingIns->pstOutRing, (void **)&pstUdpbuf, 1, NULL); 155 | 156 | if (pstOffLoad->data != NULL) 157 | rte_free(pstOffLoad->data); 158 | 159 | rte_free(pstOffLoad); 160 | } 161 | } 162 | 163 | return 0; 164 | } -------------------------------------------------------------------------------- /udp.h: -------------------------------------------------------------------------------- 1 | #ifndef __UDP_H__ 2 | #define __UDP_H__ 3 | 4 | #include "common.h" 5 | 6 | int udp_process(struct rte_mbuf *pstUdpMbuf); 7 | int udp_out(struct rte_mempool *mbuf_pool); 8 | 9 | // udp control block 10 | struct localhost 11 | { 12 | int fd; 13 | 14 | //unsigned int status; // 15 | uint32_t localip; // ip --> mac 16 | unsigned char localmac[RTE_ETHER_ADDR_LEN]; 17 | uint16_t localport; 18 | 19 | unsigned char protocol; 20 | 21 | struct rte_ring *sndbuf; 22 | struct rte_ring *rcvbuf; 23 | 24 | struct localhost *prev; 25 | struct localhost *next; 26 | 27 | pthread_cond_t cond; 28 | pthread_mutex_t mutex; 29 | }; 30 | 31 | struct offload 32 | { 33 | uint32_t sip; 34 | uint32_t dip; 35 | 36 | uint16_t sport; 37 | uint16_t dport; 38 | 39 | int protocol; 40 | 41 | unsigned char *data; 42 | uint16_t length; 43 | 44 | }; 45 | 46 | #endif --------------------------------------------------------------------------------