Skip to content

Commit

Permalink
Generalized test structure and added multi-q test
Browse files Browse the repository at this point in the history
Signed-off-by: Cliff Burdick <[email protected]>
  • Loading branch information
cliffburdick committed Dec 17, 2024
1 parent 4038dc4 commit 7dee702
Show file tree
Hide file tree
Showing 4 changed files with 289 additions and 62 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
%YAML 1.2
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
multithreaded: true
num_delay_ops: 32
delay: 0.1
delay_step: 0.01

scheduler:
check_recession_period_ms: 0
worker_thread_number: 5
stop_on_deadlock: true
stop_on_deadlock_timeout: 500
# max_duration_ms: 20000

advanced_network:
cfg:
version: 1
manager: "dpdk"
master_core: 3
debug: false
log_level: "info"

memory_regions:
- name: "Data_RX_GPU"
kind: "device"
affinity: 0
access:
- local
num_bufs: 51200
buf_size: 9000
- name: "Data_RX_GPU2"
kind: "device"
affinity: 0
access:
- local
num_bufs: 51200
buf_size: 9000

interfaces:
- name: data2
address: <0000:00:00.0> # The BUS address of the interface doing Rx
flow_isolation: true
rx:
- queues:
- name: "Data"
id: 0
cpu_core: 9
batch_size: 10240
output_port: "bench_rx_out"
memory_regions:
- "Data_RX_GPU"
- name: "Data"
id: 1
cpu_core: 9
batch_size: 10240
output_port: "bench_rx_out"
memory_regions:
- "Data_RX_GPU2"
flows:
- name: "ADC Samples"
id: 0
action:
type: queue
id: 0
match:
udp_src: 4096 #12288
udp_dst: 4096 #12288
- name: "ADC Samples"
id: 1
action:
type: queue
id: 1
match:
udp_src: 4095 #12288
udp_dst: 4095 #12288

bench_rx:
gpu_direct: true # Set to true if using a GPU region for the Rx queues.
split_boundary: false # Whether header and data is split (Header to CPU)
batch_size: 10240
max_packet_size: 1064
header_size: 64
45 changes: 34 additions & 11 deletions applications/adv_networking_bench/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ add_custom_target(adv_networking_bench_default_tx_rx_yaml
)
add_dependencies(adv_networking_bench adv_networking_bench_default_tx_rx_yaml)

add_custom_target(adv_networking_bench_default_rx_multi_q_yaml
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/../adv_networking_bench_default_rx_multi_q.yaml" ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../adv_networking_bench_default_rx_multi_q.yaml"
)
add_dependencies(adv_networking_bench adv_networking_bench_default_rx_multi_q_yaml)

add_custom_target(adv_networking_bench_default_tx_yaml
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/../adv_networking_bench_default_tx.yaml" ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../adv_networking_bench_default_tx.yaml"
Expand Down Expand Up @@ -98,18 +104,16 @@ install(
FILES ../adv_networking_bench_default_rx.yaml
../adv_networking_bench_default_tx.yaml
../adv_networking_bench_default_tx_rx.yaml
../adv_networking_bench_default_rx_multi_q.yaml
../adv_networking_bench_doca_tx_rx.yaml
../adv_networking_bench_rmax_rx.yaml
DESTINATION bin/adv_networking_bench/cpp
COMPONENT holoscan-networking
)


# Add testing
if(BUILD_TESTING)
## adv_networking_bench_dpdk_multi_if_loopback_test ##
# The test below is expected to run on a system with a ConnectX NIC with
# both ports connected in a loopback, with optimal system setups (BAR1,
# GPU clock, CPU clock, huge pages, etc... docs incoming).

# Define a macro to handle the execution and checks
macro(execute_and_check MSG CMD OUTPUT_VAR)
Expand All @@ -121,7 +125,7 @@ if(BUILD_TESTING)
if(NOT result_code EQUAL 0 OR "${${OUTPUT_VAR}}" STREQUAL "")
message(STATUS "[ANO Test] ${MSG}")
message(WARNING "'${CMD}' failed (${result_code}) or output was empty.\nError: ${error_output}")
message(STATUS "[ANO Test] Skipping advanced networking loopback test")
message(STATUS "[ANO Test] Skipping advanced networking test")
return()
else()
message(STATUS "[ANO Test] ${MSG} ${${OUTPUT_VAR}}")
Expand All @@ -138,24 +142,43 @@ if(BUILD_TESTING)
message(WARNING "[ANO Test] Expected 2 CX NICs, found ${cx_bus_address_list_count}")
message(WARNING "[ANO Test] Skipping advanced networking test")
return()
endif()
endif()

# TEST 1 TX/RX loopback over single link. One TX queue and one RX queue
list(GET cx_bus_address_list 0 tx_bus)
list(GET cx_bus_address_list 1 rx_bus)
execute_and_check("ETH Interface for ${tx_bus}:" "find /sys/class/net -exec bash -c 'echo {} $(readlink -f {}/device)' \; | grep ${tx_bus} | awk '{print $1}'" tx_if)
execute_and_check("MAC Address for ${tx_if}:" "cat ${tx_if}/address" rx_eth_mac)

# Inject in the test config and add app timeout
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/../adv_networking_bench_default_tx_rx.yaml" TEST_CONFIG)
string(REGEX REPLACE "# max_duration_ms:[^\n]*" "max_duration_ms: 20000" TEST_CONFIG ${TEST_CONFIG})
string(REGEX REPLACE "address: [^\n]*interface[^\n]*Rx[^\n]*" "address: ${rx_bus}" TEST_CONFIG ${TEST_CONFIG})
string(REGEX REPLACE "address: [^\n]*interface[^\n]*Tx[^\n]*" "address: ${tx_bus}" TEST_CONFIG ${TEST_CONFIG})
string(REGEX REPLACE "address: [^\n]*Source[^\n]*Tx[^\n]*" "address: ${tx_bus}" TEST_CONFIG ${TEST_CONFIG})
string(REGEX REPLACE "eth_dst_addr:[^\n]*" "eth_dst_addr: ${rx_eth_mac}" TEST_CONFIG ${TEST_CONFIG})
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/adv_networking_bench_dpdk_multi_if_loopback_test.yaml" ${TEST_CONFIG})
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/adv_networking_bench_dpdk_multi_if_loopback_test.yaml" ${TEST_CONFIG})

# Define the test
# TEST 2 RX multi queue with a single CPU core. Uses a scapy script to send packets
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/../adv_networking_bench_default_rx_multi_q.yaml" TEST_CONFIG)
string(REGEX REPLACE "# max_duration_ms:[^\n]*" "max_duration_ms: 20000" TEST_CONFIG ${TEST_CONFIG})
string(REGEX REPLACE "address: [^\n]*interface[^\n]*Rx[^\n]*" "address: ${rx_bus}" TEST_CONFIG ${TEST_CONFIG})
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/adv_networking_bench_dpdk_rx_multi_q.yaml" ${TEST_CONFIG})


# Define the tests
file(COPY "testing/adv_networking_test_harness.py" DESTINATION "testing")
add_test(NAME adv_networking_bench_dpdk_multi_if_loopback_test
COMMAND python3 testing/adv_networking_test_harness.py "./adv_networking_bench adv_networking_bench_dpdk_multi_if_loopback_test.yaml" --avg-throughput-threshold 90 --missed-packets-threshold 0.1
COMMAND python3 testing/adv_networking_test_harness.py "./adv_networking_bench adv_networking_bench_dpdk_multi_if_loopback_test.yaml"
--avg-throughput-threshold 90
--missed-packets-threshold 0.1
--port-map 0-1
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

add_test(NAME adv_networking_bench_dpdk_multi_rx_q_test
COMMAND python3 testing/adv_networking_test_harness.py "./adv_networking_bench adv_networking_bench_dpdk_rx_multi_q.yaml"
--avg-throughput-threshold 0
--missed-packets-threshold 0
--packets-per-rx-queue 1 1
--port-map 0-0
--external-script ${CMAKE_CURRENT_SOURCE_DIR}/../utils/test_multi_rx_q.py
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()
Loading

0 comments on commit 7dee702

Please sign in to comment.