1 Star 0 Fork 32

yc555/gazelle_1

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0008-add-loongarch64-and-sw64-arch-support.patch 6.58 KB
一键复制 编辑 原始数据 按行查看 历史
From 7b2803bfe36e6ca19d4389d28c5d9f15dcbe95e8 Mon Sep 17 00:00:00 2001
From: herengui <herengui@kylinsec.com.cn>
Date: Wed, 30 Aug 2023 15:41:03 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=BE=99=E8=8A=AF=E5=92=8C?=
=?UTF-8?q?=E7=94=B3=E5=A8=81=E6=9E=B6=E6=9E=84=E6=94=AF=E6=8C=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: herengui <herengui@kylinsec.com.cn>
---
src/lstack/Makefile | 9 +++++++--
src/ltran/CMakeLists.txt | 17 +++++++++++++----
test/unitest/ltran/CMakeLists.txt | 5 ++++-
3 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/src/lstack/Makefile b/src/lstack/Makefile
index 3550244..8f684ba 100644
--- a/src/lstack/Makefile
+++ b/src/lstack/Makefile
@@ -26,6 +26,7 @@ CC ?= gcc
OPTIMIZATION = -O2 -g
RM = rm -f
LDFLAGS = -shared -ldl -lm -lpthread -lrt -lnuma -lconfig -lboundscheck
+ARCH := $(shell uname -m)
ifneq ($(CC),clang)
SEC_FLAGS = -fstack-protector-strong -Werror -Wall -Wl,-z,relro, -Wl,-z,now -Wl,-z,noexecstack -Wtrampolines -fPIC -D_FORTIFY_SOURCE=2
@@ -88,18 +89,22 @@ ifeq ($(DPDK_VERSION_1911), 1)
LIBRTE_LIB += $(LIB_PATH)/librte_pmd_pcap.so \
$(LIB_PATH)/librte_pmd_bond.so \
$(LIB_PATH)/librte_pmd_hinic.so \
- $(LIB_PATH)/librte_pmd_i40e.so \
$(LIB_PATH)/librte_pmd_ixgbe.so \
$(LIB_PATH)/librte_pmd_virtio.so
+ ifneq ($(ARCH), loongarch64)
+ LIBRTE_LIB += $(LIB_PATH)/librte_pmd_i40e.so
+ endif
else
LIBRTE_LIB += $(LIB_PATH)/librte_net_pcap.so \
$(LIB_PATH)/librte_net_bond.so \
$(LIB_PATH)/librte_net_hinic.so \
- $(LIB_PATH)/librte_net_i40e.so \
$(LIB_PATH)/librte_net_ixgbe.so \
$(LIB_PATH)/librte_net_virtio.so \
$(LIB_PATH)/librte_telemetry.so \
$(LIB_PATH)/librte_pcapng.so
+ ifneq ($(ARCH), loongarch64)
+ LIBRTE_LIB += $(LIB_PATH)/librte_net_i40e.so
+ endif
endif
DEP_LIBS = $(LWIP_LIB) $(LIBRTE_LIB)
diff --git a/src/ltran/CMakeLists.txt b/src/ltran/CMakeLists.txt
index b8d92b7..e098a77 100644
--- a/src/ltran/CMakeLists.txt
+++ b/src/ltran/CMakeLists.txt
@@ -30,12 +30,18 @@ endif($ENV{GAZELLE_COVERAGE_ENABLE})
if($ENV{DPDK_VERSION_1911})
set(DPDK_DIR /usr/include/dpdk)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDPDK_VERSION_1911=1")
- set(DPDK_LINK_FLAGS "-Wl,-lrte_pmd_bond -Wl,-lrte_pmd_i40e -Wl,-lrte_pmd_hinic -Wl,-lrte_pmd_ixgbe \
+ set(DPDK_LINK_FLAGS "-Wl,-lrte_pmd_bond -Wl,-lrte_pmd_hinic -Wl,-lrte_pmd_ixgbe \
-Wl,-lrte_pmd_pcap -Wl,-lrte_pmd_virtio")
+ if(NOT CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "loongarch64")
+ set(DPDK_LINK_FLAGS "${DPDK_LINK_FLAGS} -Wl,-lrte_pmd_i40e")
+ endif()
else()
set(DPDK_DIR /usr/local/include/)
- set(DPDK_LINK_FLAGS "-Wl,-lrte_net_bond -Wl,-lrte_net_i40e -Wl,-lrte_net_hinic -Wl,-lrte_net_ixgbe \
+ set(DPDK_LINK_FLAGS "-Wl,-lrte_net_bond -Wl,-lrte_net_hinic -Wl,-lrte_net_ixgbe \
-Wl,-lpcap -Wl,-lrte_net_pcap -Wl,-lrte_net_virtio -Wl,-lrte_pcapng -Wl,-lrte_telemetry")
+ if(NOT CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "loongarch64")
+ set(DPDK_LINK_FLAGS "${DPDK_LINK_FLAGS} -Wl,-lrte_net_i40e")
+ endif()
endif($ENV{DPDK_VERSION_1911})
add_executable(ltran main.c ltran_param.c ltran_config.c ltran_ethdev.c ltran_stat.c ltran_errno.c
@@ -44,12 +50,15 @@ add_executable(ltran main.c ltran_param.c ltran_config.c ltran_ethdev.c ltran_st
${COMMON_DIR}/gazelle_parse_config.c)
target_include_directories(ltran PRIVATE ${COMMON_DIR} ${PROJECT_SOURCE_DIR} ${LWIP_DIR} ${DPDK_DIR})
-target_compile_options(ltran PRIVATE -march=native -fno-strict-aliasing -D__ARM_FEATURE_CRC32=1 -DRTE_MACHINE_CPUFLAG_NEON
+target_compile_options(ltran PRIVATE -fno-strict-aliasing -D__ARM_FEATURE_CRC32=1 -DRTE_MACHINE_CPUFLAG_NEON
-DRTE_MACHINE_CPUFLAG_CRC32 -DRTE_MACHINE_CPUFLAG_PMULL -DRTE_MACHINE_CPUFLAG_AES
-DRTE_MACHINE_CPUFLAG_SHA1 -DRTE_MACHINE_CPUFLAG_SHA2 -include rte_config.h
-D_GNU_SOURCE -W -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wold-style-definition
- -Wpointer-arith -Wcast-align -Wcast-qual -Wnested-externs -Wformat-nonliteral -Wformat-security -Wundef
+ -Wpointer-arith -Wcast-qual -Wnested-externs -Wformat-nonliteral -Wformat-security -Wundef
-Wdeprecated -Wwrite-strings -Wno-implicit-fallthrough -D_FORTIFY_SOURCE=2)
+if(NOT CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "sw_64")
+ target_compile_options(ltran PRIVATE -march=native -Wcast-align)
+endif()
target_link_libraries(ltran PRIVATE config boundscheck rte_pdump -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wtrampolines)
set_target_properties(ltran PROPERTIES LINK_FLAGS "-L$ENV{DPDK_LIB_PATH} -Wl,--no-whole-archive \
diff --git a/test/unitest/ltran/CMakeLists.txt b/test/unitest/ltran/CMakeLists.txt
index 9496053..60bda83 100644
--- a/test/unitest/ltran/CMakeLists.txt
+++ b/test/unitest/ltran/CMakeLists.txt
@@ -47,12 +47,15 @@ set_target_properties(ltran_test PROPERTIES LINK_FLAGS "-L$ENV{DPDK_LIB_PATH} -W
-Wl,-lrte_bus_dpaa -Wl,-lrte_bus_vdev -Wl,-lrte_bus_fslmc -Wl,-lrte_mempool_bucket -Wl,-lrte_mempool_stack -Wl,-lrte_mempool_dpaa \
-Wl,-lrte_mempool_dpaa2 -Wl,-lrte_net_af_packet -Wl,-lrte_net_ark -Wl,-lrte_net_atlantic -Wl,-lrte_net_axgbe \
-Wl,-lrte_net_bnxt -Wl,-lrte_net_bond -Wl,-lrte_net_cxgbe -Wl,-lrte_net_dpaa -Wl,-lrte_net_dpaa2 -Wl,-lrte_net_e1000 -Wl,-lrte_net_ena \
- -Wl,-lrte_net_enetc -Wl,-lrte_net_enic -Wl,-lrte_net_failsafe -Wl,-lrte_net_i40e -Wl,-lrte_net_hinic -Wl,-lrte_net_ixgbe -Wl,-lrte_net_kni \
+ -Wl,-lrte_net_enetc -Wl,-lrte_net_enic -Wl,-lrte_net_failsafe -Wl,-lrte_net_hinic -Wl,-lrte_net_ixgbe -Wl,-lrte_net_kni \
-Wl,-lrte_net_nfp -Wl,-lrte_net_null -Wl,-lpcap -Wl,-lrte_net_qede -Wl,-lrte_net_ring -Wl,-lrte_net_softnic \
-Wl,-lrte_net_tap -Wl,-lrte_net_vdev_netvsc -Wl,-lrte_net_virtio -Wl,-lrte_net_vhost \
-Wl,-lrte_bus_vmbus -Wl,-lrte_net_netvsc -Wl,-lrte_mempool_octeontx -Wl,-lrte_net_octeontx \
-Wl,-lrte_bus_ifpga -Wl,-lrte_stack -Wl,-lrte_telemetry\
-Wl,--no-whole-archive -Wl,-lm -Wl,-lrt -Wl,-lnuma -Wl,-ldl -Wl,-export-dynamic -Wl,-export-dynamic \
-Wl,--as-needed -Wl,-export-dynamic -Wl,-Map=ltran.map -Wl,--cref")
+if(NOT CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "loongarch64")
+ set_target_properties(ltran_test PROPERTIES LINK_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-lrte_net_i40e")
+endif()
target_include_directories(ltran_test PRIVATE ${LIB_PATH})
target_link_libraries(ltran_test PRIVATE config boundscheck cunit pthread)
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yangchen555/gazelle_1.git
git@gitee.com:yangchen555/gazelle_1.git
yangchen555
gazelle_1
gazelle_1
master

搜索帮助