-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: virtio extbuf basic functionality test
Adds virtio extbuf basic functionality test. Signed-off-by: Rahul Bhansali <rbhansali@marvell.com> Change-Id: I31cb088aae6eea02fc685f71eaf13be5efdf1c43 Reviewed-on: https://sj1git1.cavium.com/c/IP/SW/dataplane/dpu-offload/+/132678 Reviewed-by: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com> Tested-by: sa_ip-toolkits-Jenkins <sa_ip-toolkits-jenkins@marvell.com>
- Loading branch information
1 parent
a3128bf
commit 00e47bc
Showing
4 changed files
with
234 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# SPDX-License-Identifier: Marvell-MIT | ||
# Copyright (c) 2024 Marvell. | ||
|
||
# Test script | ||
tests = [ | ||
# Name, Script, Args | ||
['virtio_extbuf_1c', 'virtio_extbuf_1c.sh', ''], | ||
] | ||
|
||
test_dir = meson.current_build_dir() | ||
foreach t : tests | ||
test_name = t[0] | ||
test_script = t[1] | ||
test_args = t[2] | ||
test(test_name, | ||
dao_test_script_wrapper, | ||
env : [['DAO_TEST=' + test_name], ['TEST_DIR=' + test_dir]], | ||
args : [[test_script], [test_args]], | ||
is_parallel : false, suite : 'dao-virtio') | ||
endforeach | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
# SPDX-License-Identifier: Marvell-MIT | ||
# Copyright (c) 2024 Marvell. | ||
|
||
set -euo pipefail | ||
|
||
EXTBUF_1C_SCRIPT_PATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" | ||
source $EXTBUF_1C_SCRIPT_PATH/virtio_extbuf_utils.sh | ||
|
||
function virtio_extbuf_1c() | ||
{ | ||
local extbuf_pfx=${DAO_TEST} | ||
local host_testpmd_pfx=${DAO_TEST}_testpmd_host | ||
local extbuf_out=virtio_extbuf.${extbuf_pfx}.out | ||
local if0=$(ep_device_get_inactive_if) | ||
|
||
extbuf_register_sig_handler ${DAO_TEST} $host_testpmd_pfx $extbuf_out | ||
|
||
ep_device_vfio_bind $if0 | ||
|
||
# Launch virtio extbuf | ||
if ! extbuf_app_launch $if0 $extbuf_pfx $extbuf_out "4-5" "-p 0x1 -v 0x1 -P -l"; then | ||
echo "Failed to launch virtio extbuf" | ||
|
||
# Quit extbuf app | ||
extbuf_app_quit $extbuf_pfx $extbuf_out | ||
return 1 | ||
fi | ||
|
||
device_part=$(ep_device_op get_part) | ||
ep_host_op vdpa_setup $device_part | ||
|
||
# Start traffic | ||
extbuf_host_start_traffic $host_testpmd_pfx | ||
|
||
# Check the performance | ||
extbuf_host_check_pps $host_testpmd_pfx | ||
local k=$? | ||
|
||
# Stop Traffic and quit host testpmd | ||
extbuf_host_stop_traffic $host_testpmd_pfx | ||
|
||
ep_host_op vdpa_cleanup | ||
|
||
# Quit extbuf app | ||
extbuf_app_quit $extbuf_pfx $extbuf_out | ||
return $k | ||
} | ||
|
||
test_run ${DAO_TEST} 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
#!/bin/bash | ||
# SPDX-License-Identifier: Marvell-MIT | ||
# Copyright (c) 2024 Marvell. | ||
|
||
set -euo pipefail | ||
|
||
VIRTIO_UTILS_SCRIPT_PATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" | ||
source $VIRTIO_UTILS_SCRIPT_PATH/../../common/utils.sh | ||
source $VIRTIO_UTILS_SCRIPT_PATH/../../common/ep_host_utils.sh | ||
source $VIRTIO_UTILS_SCRIPT_PATH/../../common/ep_device_utils.sh | ||
source $VIRTIO_UTILS_SCRIPT_PATH/../../common/testpmd.sh | ||
|
||
find_executable "dpdk-virtio-extbuf" VIRTIO_EXTBUF "$VIRTIO_UTILS_SCRIPT_PATH/../../../../../tests" | ||
|
||
function extbuf_host_check_pps() | ||
{ | ||
local pfx=$1 | ||
local wait_time_sec=10 | ||
|
||
while [[ wait_time_sec -ne 0 ]]; do | ||
local rx_pps=$(ep_host_op testpmd_pps $pfx 0) | ||
|
||
if [[ rx_pps -eq 0 ]]; then | ||
echo "Low PPS for ${pfx} ($rx_pps == 0)" | ||
else | ||
echo "Rx PPS $rx_pps as expected" | ||
return 0 | ||
fi | ||
|
||
sleep 1 | ||
wait_time_sec=$((wait_time_sec - 1)) | ||
done | ||
|
||
return 1 | ||
} | ||
|
||
function extbuf_host_start_traffic() | ||
{ | ||
local pfx=$1 | ||
local num_cores | ||
local fwd_cores | ||
local eal_args | ||
local app_args | ||
|
||
num_cores=$(ep_host_ssh_cmd "nproc --all") | ||
fwd_cores=$((num_cores - 1)) | ||
eal_args="-l 0-$fwd_cores --socket-mem 1024 --proc-type auto --file-prefix=$pfx --no-pci \ | ||
--vdev=net_virtio_user0,path=/dev/vhost-vdpa-0,mrg_rxbuf=1,packed_vq=1,in_order=1,queue_size=4096" | ||
app_args="--nb-cores=$fwd_cores --port-topology=loop --rxq=$fwd_cores --txq=$fwd_cores -i" | ||
|
||
echo "Starting Traffic on Host" | ||
ep_host_op_bg 10 testpmd_launch $pfx "$eal_args" -- "$app_args" | ||
ep_host_op testpmd_cmd $pfx start tx_first 32 | ||
echo "Started Traffic on Host" | ||
} | ||
|
||
function extbuf_host_stop_traffic() | ||
{ | ||
local pfx=$1 | ||
|
||
echo "Stopping Traffic on Host" | ||
ep_host_op testpmd_cmd $pfx stop | ||
ep_host_op testpmd_stop $pfx | ||
echo "Stopped Traffic no Host" | ||
} | ||
|
||
function extbuf_sig_handler() | ||
{ | ||
local status=$? | ||
local sig=$1 | ||
local pfx=$2 | ||
local tpmd_pfx=$3 | ||
local dev_log=$4 | ||
set +e | ||
trap - ERR | ||
trap - INT | ||
trap - QUIT | ||
trap - EXIT | ||
if [[ $status -ne 0 ]]; then | ||
echo "$sig Handler" | ||
fi | ||
|
||
if [ -f $dev_log ]; then | ||
cat $dev_log | ||
fi | ||
|
||
ep_host_op testpmd_log $tpmd_pfx | ||
safe_kill $pfx | ||
ep_host_op safe_kill $pfx | ||
} | ||
|
||
function extbuf_register_sig_handler() | ||
{ | ||
local pfx=$1 | ||
local tpmd_pfx=$2 | ||
local dev_log=$3 | ||
|
||
# Register the traps | ||
trap "extbuf_sig_handler ERR $pfx $tpmd_pfx $dev_log" ERR | ||
trap "extbuf_sig_handler INT $pfx $tpmd_pfx $dev_log" INT | ||
trap "extbuf_sig_handler QUIT $pfx $tpmd_pfx $dev_log" QUIT | ||
trap "extbuf_sig_handler EXIT $pfx $tpmd_pfx $dev_log" EXIT | ||
} | ||
|
||
function extbuf_app_launch() | ||
{ | ||
local interface=$1 | ||
local extbuf_pfx=$2 | ||
local extbuf_out=$3 | ||
local cores="$4" | ||
local app_args="$5" | ||
local eal_args=" | ||
-a 0000:06:00.1 -a 0000:06:00.2 -a 0000:06:00.3 -a 0000:06:00.4 | ||
-a 0000:06:00.5 -a 0000:06:00.6 -a 0000:06:00.7 -a 0000:06:01.0 | ||
-a 0000:06:01.1 -a 0000:06:01.2 -a 0000:06:01.3 -a 0000:06:01.4 | ||
-a 0000:06:01.5 -a 0000:06:01.6 -a 0000:06:01.7 -a 0000:06:02.0 | ||
-a 0000:06:02.1 -a 0000:06:02.2 -a 0000:06:02.3 -a 0000:06:02.4 | ||
-a 0000:06:02.5 -a 0000:06:02.6 | ||
" | ||
local args="-l $cores -a $interface $eal_args -- $app_args" | ||
local unbuffer | ||
|
||
unbuffer="$(command -v stdbuf) -o 0" || unbuffer= | ||
rm -rf $extbuf_out | ||
echo "VIRTIO_EXTBUF: $extbuf_pfx: Launching $VIRTIO_EXTBUF" | ||
echo "Args: '$args'" | ||
|
||
$unbuffer $VIRTIO_EXTBUF --file-prefix $extbuf_pfx $args &>$extbuf_out 2>&1 & | ||
|
||
# Wait for virtio_extbuf to be up | ||
local itr=0 | ||
while ! (tail -n20 $extbuf_out | grep -q "VIRTIO_L2FWD_EXTBUF: Entering main loop on lcore"); do | ||
sleep 1 | ||
itr=$((itr + 1)) | ||
if [[ itr -eq 10 ]]; then | ||
echo "Timeout waiting for virtio-extbuf"; | ||
cat $extbuf_out | ||
return 1; | ||
fi | ||
echo "Waiting for virtio-extbuf to be up" | ||
done | ||
} | ||
|
||
function extbuf_app_quit() | ||
{ | ||
local pfx=$1 | ||
local log=$2 | ||
|
||
cat $log | ||
|
||
# Issue kill SIGINT | ||
local pid=$(ps -ef | grep dpdk-virtio-extbuf | grep $pfx | awk '{print $2}' | xargs -n1 kill -2 2>/dev/null || true) | ||
|
||
# Wait until the process is killed | ||
local alive=$(ps -ef | grep dpdk-virtio-extbuf | grep $pfx || true) | ||
while [[ "$alive" != "" ]]; do | ||
sleep 1 | ||
alive=$(ps -ef | grep dpdk-virtio-extbuf | grep $pfx || true) | ||
continue | ||
done | ||
rm -f $log | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
# Copyright (c) 2024 Marvell. | ||
|
||
subdir('l2fwd') | ||
subdir('extbuf') |