diff options
| author | tongzongzhen <[email protected]> | 2024-07-25 10:30:10 +0800 |
|---|---|---|
| committer | tongzongzhen <[email protected]> | 2024-07-25 10:30:10 +0800 |
| commit | 38039049b6896bf1fdb151062838a723f2b24e8a (patch) | |
| tree | 46b98db9c27f869ddf6cdaa97e741b547c0651bb | |
| parent | 76c0d159c2a85af96cef9fff39285bb3280cb16e (diff) | |
Modify cmake to build the binary file of znver4-O3
The MACHINE variable is set to znver4.
CMAKE_BUILD_TYPE command line setting allows to set it to release, if not set use the default value.
When decoding messagepack, the route_ctx number size is set to 128 to avoid false positive warnings in the gcc13 case.
| -rw-r--r-- | CMakeLists.txt | 17 | ||||
| -rw-r--r-- | service/src/node_phydev.c | 18 | ||||
| -rw-r--r-- | support/CMakeLists.txt | 3 |
3 files changed, 27 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ded67fc..9b72286 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,8 @@ message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") set(COREI7 "corei7") set(ICELAKE_SERVER "icelake-server") set(ZNVER1 "znver1") -set(SUPPORTED_MACHINES ${COREI7} ${ICELAKE_SERVER} ${ZNVER1}) +set(ZNVER4 "znver4") +set(SUPPORTED_MACHINES ${COREI7} ${ICELAKE_SERVER} ${ZNVER1} ${ZNVER4}) if(NOT MACHINE) set(MACHINE "corei7") endif() @@ -38,13 +39,25 @@ else() message(FATAL_ERROR "${MACHINE} is not in the support machines list.") endif() +if(${MACHINE} STREQUAL ${ZNVER4}) + message(WARNING "The ${ZNVER4} architecture is only used for testing.It is currently not allowed in production environments.") + if(${CMAKE_C_COMPILER_VERSION} VERSION_LESS 13) + message(FATAL_ERROR "For ${ZNVER4}, GCC version must be 13 or higher.") + endif() +endif() + +# If the command line specifies the type, use the command line specified type. +# If the command line does not specify the type, use the default value. +set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Build type") +message(STATUS "cmake build type: ${CMAKE_BUILD_TYPE}") + # FLAGS and define set(CMAKE_C_FLAGS "-std=gnu99 -m64 -march=${MACHINE} -fPIC -Wall -Wno-format-truncation") set(CMAKE_CXX_FLAGS "-std=gnu++11 -m64 -march=${MACHINE} -fPIC -Wall -Wno-format-truncation") # Force -O3 for release and relwithdebinfo #string(REPLACE "-O2" "-O3" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") -#string(REPLACE "-O2" "-O3" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") +#string(REPLACE "-O2" "-O3" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") if(ENABLE_WARNING_AS_ERROR) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") diff --git a/service/src/node_phydev.c b/service/src/node_phydev.c index ab5ecca..7d9b70b 100644 --- a/service/src/node_phydev.c +++ b/service/src/node_phydev.c @@ -95,8 +95,8 @@ int mbuf_object_deserialize_from_msgpack(struct sc_main * sc, struct rte_mbuf * /* unpack the mrb_metadata */ struct mrb_metadata * mrb_meta = mrbuf_cz_data(mbuf, MR_NODE_CTRLZONE_ID); mrb_meta->dir = mpack_node_u8(mpack_node_map_cstr(mpack_tree_root(&tree), "dir")); - mrb_meta->packet_create_from_nf = - mpack_node_u8(mpack_node_map_cstr(mpack_tree_root(&tree), "packet_create_from_nf")); + mrb_meta->packet_create_from_nf = mpack_node_u8( + mpack_node_map_cstr(mpack_tree_root(&tree), "packet_create_from_nf")); mrb_meta->is_ctrlbuf = mpack_node_u8(mpack_node_map_cstr(mpack_tree_root(&tree), "is_ctrlbuf")); mrb_meta->adapter_type = mpack_node_u8(mpack_node_map_cstr(mpack_tree_root(&tree), "adapter_type")); mrb_meta->adapter_id = mpack_node_u16(mpack_node_map_cstr(mpack_tree_root(&tree), "adapter_id")); @@ -117,8 +117,8 @@ int mbuf_object_deserialize_from_msgpack(struct sc_main * sc, struct rte_mbuf * mpack_node_map_cstr(mpack_tree_root(&tree), "sids"); for (unsigned int i = 0; i < RTE_DIM(sid_list->sids); i++) { - sid_list->sids[i] = - mpack_node_u16(mpack_node_array_at(mpack_node_map_cstr(mpack_tree_root(&tree), "sids"), i)); + sid_list->sids[i] = mpack_node_u16( + mpack_node_array_at(mpack_node_map_cstr(mpack_tree_root(&tree), "sids"), i)); } /* unpack the head sid */ @@ -134,7 +134,7 @@ int mbuf_object_deserialize_from_msgpack(struct sc_main * sc, struct rte_mbuf * /* If route context is enabled, the route context fields should be deserialized. */ if (sc->en_mpack_route_ctx) { - char route_ctx[64] = {}; + char route_ctx[128] = {}; mpack_node_t route_ctx_node = mpack_node_map_cstr(mpack_tree_root(&tree), "route_ctx"); rte_memcpy(route_ctx, mpack_node_data(route_ctx_node), mpack_node_data_len(route_ctx_node)); buffer_metadata_set(mbuf, MR_BUFF_ROUTE_CTX, route_ctx, sizeof(route_ctx)); @@ -402,8 +402,8 @@ static __rte_always_inline uint16_t dpdk_msgpack_dev_rx_node_process(struct rte_ struct dev_node_ctx * ctx = (struct dev_node_ctx *)node->ctx; assert(ctx->dev_desc->role_type == MR_DEV_ROLE_NF_INTERFACE); - unsigned int nr_mbufs = - rte_eth_rx_burst(ctx->dev_desc->port_id, graph->id, (struct rte_mbuf **)node->objs, RTE_GRAPH_BURST_SIZE); + unsigned int nr_mbufs = rte_eth_rx_burst(ctx->dev_desc->port_id, graph->id, (struct rte_mbuf **)node->objs, + RTE_GRAPH_BURST_SIZE); if (nr_mbufs == 0) { @@ -478,8 +478,8 @@ static __rte_always_inline uint16_t dpdk_dev_rx_node_process(struct rte_graph * } unsigned int qid = qid_map->qid_map[core_id]; - unsigned int nr_mbufs = - rte_eth_rx_burst(dev_desc->port_id, qid, (struct rte_mbuf **)node->objs, RTE_GRAPH_BURST_SIZE); + unsigned int nr_mbufs = rte_eth_rx_burst(dev_desc->port_id, qid, (struct rte_mbuf **)node->objs, + RTE_GRAPH_BURST_SIZE); if (nr_mbufs == 0) { diff --git a/support/CMakeLists.txt b/support/CMakeLists.txt index 7da7ce8..2c43f8c 100644 --- a/support/CMakeLists.txt +++ b/support/CMakeLists.txt @@ -129,9 +129,12 @@ execute_process(COMMAND cat ${DPDK_PATCH_FILES} OUTPUT_FILE ${MERGED_PATCH_FILE} if(CMAKE_BUILD_TYPE STREQUAL "Debug") set(DPDK_BUILD_TYPE debug) +elseif(CMAKE_BUILD_TYPE STREQUAL "Release") + set(DPDK_BUILD_TYPE release) else() set(DPDK_BUILD_TYPE debugoptimized) endif() +message(STATUS "dpdk build type: ${DPDK_BUILD_TYPE}") set(DPDK_MESON_DISABLED_DRIVERS "common/cpt,common/dpaax,common/octeontx,common/octeontx2,common/sfc_efx,\ common/qat,bus/dpaa,bus/fslmc,bus/ifpga,bus/vmbus,mempool/bucket,mempool/dpaa,\ |
