Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Commit

Permalink
Integrate all components
Browse files Browse the repository at this point in the history
  • Loading branch information
qizzz committed Dec 7, 2023
1 parent 8ce58dc commit de7de22
Show file tree
Hide file tree
Showing 9 changed files with 302 additions and 15 deletions.
9 changes: 9 additions & 0 deletions DPDPU/Main/Build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Apply patches
cp ../NetworkEngine/Patches/dpdk_utils.c /opt/mellanox/doca/applications/common/src/dpdk_utils.c

BUILD_DIR="./build/"
if [ -d "$BUILD_DIR" ]; then
rm -r $BUILD_DIR
fi
meson setup build -Dbuildtype=release
ninja -v -C build
58 changes: 58 additions & 0 deletions DPDPU/Main/MainConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"subsystems": [
{
"subsystem": "bdev",
"config": [
{
"method": "bdev_malloc_create",
"params": {
"name": "malloc_delay",
"num_blocks": 6291456,
"block_size": 512
}
}
]
}
],

"doca_dpdk_flags":{
// -a - Add a device to the allow list.
"devices":[
{
"device": "sf",
"id": "4",
"sft": false
},
],
// -c - Hexadecimal bitmask of cores to run on
"core-mask": "0xFF",
// Additional DPDK (EAL) flags (if needed)
"flags": "",
},

"doca_general_flags":{
// -l - sets the log level for the application DEBUG=60 CRITICAL=20
"log-level": 60,
},

"doca_program_flags":{
// -s - Set application signature
"app-sig": "192.168.200.133/32:* 192.168.200.132/32:3232 TCP",
// -o - Set offload predicate file path
"udf-path": "../OffloadEngine/UDFSamples/",
// -h - Set host MAC address
"host-mac": "b8:3f:d2:04:e2:5c",
// -f - Set forwarding rules
"fwd-rules": "192.168.200.133/32 b8:3f:d2:04:e2:54",
// -c - Set the number of cores
"num-cores": 4,
// -l - Set the core list
"core-list": "0,1,2,3",
// -i - Set the host IPv4
"host-ipv4": "192.168.200.132",
// -p - Set the host port
"host-port": 3232,
// -d - Set if use DPDK
"use-dpdk" : 1,
}
}
1 change: 1 addition & 0 deletions DPDPU/Main/Run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./build/DDSPipeline --json DDSPipeline.json
66 changes: 66 additions & 0 deletions DPDPU/Main/Source/Main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#include <pthread.h>

#include "DDSBOWPipeline.h"
#include "FileBackEnd.h"

typedef struct {
int Argc;
char** Argv;
} StorageEnginePara;

void*
StorageEngine(
void* Arg
) {
StorageEnginePara* arg = (StorageEnginePara*)Arg;
RunFileBackEnd(
DDS_BACKEND_ADDR,
DDS_BACKEND_PORT,
1,
1,
arg->Argc,
arg->Argv
);
}

int
main(
int Argc,
char** Argv
) {
//
// Run storage engine on a separte thread
//
//
pthread_t sEng;
StorageEnginePara sEngPara;
int ret;

sEngPara.Argc = Argc;
sEngPara.Argv = Argv;

ret = pthread_create(&sEng, NULL, StorageEngine, (void*)&sEng);
if (ret) {
fprintf(stderr, "Failed to run storage engine\n");
return ret;
} else {
fprintf(stdout, "Storage engine is running...\n");
}

//
// Run network engine
//
//
ret = RunBOW(Argc, Argv);
fprintf(stdout, "Network engine exited\n");

//
// Wait for storage engine
//
//
fprintf(stdout, "Waiting for storage engine to exit\n");
pthread_join(sEng, NULL);
fprintf(stdout, "Storage engine exited\n");

return ret;
}
152 changes: 152 additions & 0 deletions DPDPU/Main/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
project('DDSMain', 'C', 'CPP',
version: '0.1',
license: 'Proprietary',
default_options: ['buildtype=release'],
meson_version: '>= 0.61.2'
)

languages = ['c', 'cpp']

install_apps = false

base_cpp_args = [
'-std=c++11',
]

base_c_args = [
'-flax-vector-conversions',
]

##
# Comment this line to restore warnings of experimental DOCA features
##
add_project_arguments('-D DOCA_ALLOW_EXPERIMENTAL_API', language: languages)

##
# Ensure mlnx-dpdk will manage to find our libbsd
##
add_project_arguments('-D RTE_USE_LIBBSD', language: languages)

# Resolve irrelevant compiler warnings
add_project_arguments('-Wno-format-zero-length', language: languages)
add_project_arguments('-Wno-address-of-packed-member', language: languages)
add_project_arguments('-Wno-deprecated-declarations', language: languages)

##
# DPDK & SPDK paths
##
spdk_inc_path = get_option('SpdkInc')
spdk_lib_path = get_option('SpdkLib')
dpdk_lib_path = get_option('DpdkLib')

message('SPDK include path =', spdk_inc_path)
message('SPDK library path =', spdk_lib_path)
message('DPDK library path =', dpdk_lib_path)

base_app_dependencies = []
base_app_dependencies += dependency('threads')
base_app_dependencies += dependency('json-c')
base_app_dependencies += dependency('libbsd')
base_app_dependencies += dependency('libdpdk')

##
# Build
##
common_path = '../Common/'
network_engine_path = '../NetworkEngine/'
doca_path = '/opt/mellanox/doca/applications/common/src'
tldk_path = network_engine_path + 'TLDK/'
offload_engine_path = '../OffloadEngine/DPU/'
storage_engine_path = '../StorageEngine/DDSBackEndDPUService/'

base_app_inc_dirs = [
include_directories(common_path + 'Include/'),
include_directories(common_path + 'Include/DPU'),
include_directories(doca_path),
include_directories(network_engine_path + 'Include'),
include_directories(tldk_path + 'libtle_timer'),
include_directories(tldk_path + 'libtle_misc'),
include_directories(tldk_path + 'libtle_memtank'),
include_directories(tldk_path + 'libtle_dring'),
include_directories(tldk_path + 'libtle_l4p'),
include_directories(offload_engine_path + 'Include'),
include_directories(storage_engine_path + 'Include'),
]

APP_NAME = 'DDSMain'

app_inc_dirs = base_app_inc_dirs
app_srcs = []

app_srcs += [
'Source/Main.c',
common_path + 'Source/DPU/FileService.c',
common_path + 'Source/DPU/RingBufferPolling.c',
network_engine_path + 'Source/DDSBOWPipeline.c',
network_engine_path + 'Source/DDSBOWCore.c',
network_engine_path + 'Source/DDSTrafficDirecting.c',
network_engine_path + 'Source/AppEchoTCPDirect.c',
network_engine_path + 'Source/ActionRedirectPackets.c',
network_engine_path + 'Source/ActionModifyHeaders.c',
network_engine_path + 'Source/PEPOLinuxTCP.c',
network_engine_path + 'Source/PEPOTLDKTCP.c',
tldk_path + 'libtle_timer/timer.c',
tldk_path + 'libtle_memtank/memtank.c',
tldk_path + 'libtle_memtank/misc.c',
tldk_path + 'libtle_dring/dring.c',
tldk_path + 'libtle_l4p/ctx.c',
tldk_path + 'libtle_l4p/event.c',
tldk_path + 'libtle_l4p/stream_table.c',
tldk_path + 'libtle_l4p/tcp_ofo.c',
tldk_path + 'libtle_l4p/tcp_rxtx.c',
tldk_path + 'libtle_l4p/tcp_stream.c',
tldk_path + 'libtle_l4p/udp_rxtx.c',
tldk_path + 'libtle_l4p/udp_stream.c',
doca_path + '/dpdk_utils.c',
doca_path + '/offload_rules.c',
doca_path + '/utils.c',
offload_engine_path + 'Source/UDF.c',
storage_engine_path + 'Source/FileBackEnd.c',
storage_engine_path + 'Source/bdev.c',
storage_engine_path + 'Source/ControlPlaneHandlers.c',
storage_engine_path + 'Source/DataPlaneHandlers.c',
storage_engine_path + 'Source/DPUBackEndDir.c',
storage_engine_path + 'Source/DPUBackEndFile.c',
storage_engine_path + 'Source/DPUBackEndStorage.c',
storage_engine_path + 'Source/Zmalloc.c'
]

##
# Link
##
app_link_args = ['-O3', '-Wl,--no-as-needed']
app_link_args += ['-L' + spdk_lib_path, '-L' + dpdk_lib_path, '-lspdk_bdev_malloc', '-lspdk_bdev', '-lspdk_notify', '-lspdk_bdev_error', '-lspdk_bdev_gpt', '-lspdk_bdev_split', '-lspdk_bdev_delay', '-lspdk_bdev_zone_block', '-lspdk_accel', '-lspdk_accel_ioat', '-lspdk_thread', '-lspdk_trace', '-lspdk_rpc', '-lspdk_jsonrpc', '-lspdk_json', '-lspdk_util', '-lspdk_ioat', '-lspdk_dma', '-lspdk_log', '-lspdk_event', '-lspdk_env_dpdk_rpc', '-lspdk_event_bdev', '-lspdk_init']
app_link_args += ['-lspdk_env_dpdk', '-lspdk_util', '-lspdk_log', '-lrte_eal', '-lrte_mempool', '-lrte_ring', '-lrte_mbuf', '-lrte_bus_pci', '-lrte_pci', '-lrte_mempool_ring', '-lrte_telemetry', '-lrte_kvargs', '-lrte_rcu', '-lrte_power', '-lrte_ethdev', '-lrte_vhost', '-lrte_net', '-lrte_dmadev', '-lrte_cryptodev', '-lrte_hash']
app_link_args += ['-lrt', '-luuid', '-lssl', '-lcrypto', '-lm', '-lbsd', '-lnuma', '-ldl']
app_link_args += ['-libverbs', '-lrdmacm']


##
# Dependencies
##
app_dependencies = base_app_dependencies
app_dependencies += dependency('doca-argp')
app_dependencies += dependency('doca-flow')
app_dependencies += dependency('doca-common')

dl_dep = meson.get_compiler('c').find_library('dl', required : true)

##
# Final executable
##
executable(
APP_NAME,
app_srcs,
c_args : base_c_args,
cpp_args : base_cpp_args,
dependencies : [app_dependencies, dl_dep],
include_directories : app_inc_dirs,
link_args : app_link_args,
install: install_apps,
build_rpath: spdk_lib_path + ':' + dpdk_lib_path
)
3 changes: 3 additions & 0 deletions DPDPU/Main/meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
option('SpdkLib', type : 'string', value : '/opt/mellanox/spdk/lib', description : 'Path to SPDK lib')
option('SpdkInc', type : 'string', value : '/opt/mellanox/spdk/include', description : 'Path to SPDK header files')
option('DpdkLib', type : 'string', value : '/opt/mellanox/dpdk/lib/aarch64-linux-gnu', description : 'Path to DPDK lib')
12 changes: 12 additions & 0 deletions DPDPU/NetworkEngine/Include/DDSBOWPipeline.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* DDS BOW pipeline main function
*
* @Argc [in]: command line arguments size
* @Argv [in]: array of command line arguments
* @return: EXIT_SUCCESS on success and EXIT_FAILURE otherwise
*/
int
RunBOW(
int Argc,
char **Argv
);
2 changes: 1 addition & 1 deletion DPDPU/NetworkEngine/Source/DDSBOWPipeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ SignalHandler(
* @return: EXIT_SUCCESS on success and EXIT_FAILURE otherwise
*/
int
main(
RunBOW(
int Argc,
char **Argv
) {
Expand Down
14 changes: 0 additions & 14 deletions DPDPU/StorageEngine/DDSBackEndDPUService/Source/FileBackEnd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2953,18 +2953,4 @@ int RunFileBackEnd(
DeallocateFileService(config.FS);
sleep(1); // return only after all spdk threads have finished exiting, so wait a bit here
return ret;
}

int main(
int Argc,
char **Argv
) {
return RunFileBackEnd(
DDS_BACKEND_ADDR,
DDS_BACKEND_PORT,
1,
1,
Argc,
Argv
);
}

0 comments on commit de7de22

Please sign in to comment.