From c17a61a4e7872af8eabdf213f71ff8aad84687ad Mon Sep 17 00:00:00 2001
From: laokz <zhangkai@iscas.ac.cn>
Date: Thu, 9 May 2024 18:44:28 +0800
Subject: [PATCH] add riscv64 support

---
 src/lstack/Makefile      | 2 +-
 src/ltran/CMakeLists.txt | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/lstack/Makefile b/src/lstack/Makefile
index d2c039d..ace33bd 100644
--- a/src/lstack/Makefile
+++ b/src/lstack/Makefile
@@ -109,7 +109,7 @@ else
                       $(LIB_PATH)/librte_net_virtio.so \
                       $(LIB_PATH)/librte_telemetry.so \
                       $(LIB_PATH)/librte_pcapng.so
-    ifneq ($(ARCH), loongarch64)
+    ifeq ($(filter loongarch64 riscv64, $(ARCH)),)
 	LIBRTE_LIB += $(LIB_PATH)/librte_net_i40e.so
     endif
 endif
diff --git a/src/ltran/CMakeLists.txt b/src/ltran/CMakeLists.txt
index 2eb7d70..fee3a94 100644
--- a/src/ltran/CMakeLists.txt
+++ b/src/ltran/CMakeLists.txt
@@ -54,7 +54,7 @@ if (DPDK_VERSION STREQUAL "19.11")
 else()
     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")
+    if(NOT CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "loongarch64|riscv64")
         set(DPDK_LINK_FLAGS "${DPDK_LINK_FLAGS} -Wl,-lrte_net_i40e")
     endif()
 endif()
@@ -82,7 +82,7 @@ target_compile_options(ltran PRIVATE -fno-strict-aliasing -D__ARM_FEATURE_CRC32=
                -Wdeprecated -Wwrite-strings -Wno-implicit-fallthrough -D_FORTIFY_SOURCE=2 -Wno-error=deprecated-declarations)
 
 # gcc coredump in openEuler-20.03-LTS-XX aarch64 when add -march=native 
-if(NOT CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "sw_64|aarch64|ppc64le" )
+if(NOT CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "sw_64|aarch64|ppc64le|riscv64" )
     target_compile_options(ltran PRIVATE -march=native -Wcast-align)
 endif()
 
-- 
2.33.0

