From b9e59611841fa6110db667c7f879db6a9bb50580 Mon Sep 17 00:00:00 2001 From: Rakesh Kudurumalla Date: Mon, 23 Sep 2024 16:08:21 +0530 Subject: [PATCH] ci: virtio csum functionality test Adds virtio checksum functionality test. Signed-off-by: Rakesh Kudurumalla Change-Id: I62be251c3b4aeec18fc7eb11001202cf7f5808f4 Reviewed-on: https://sj1git1.cavium.com/c/IP/SW/dataplane/dpu-offload/+/135452 Tested-by: sa_ip-toolkits-Jenkins Reviewed-by: Rahul Bhansali Reviewed-by: Nithin Kumar Dabilpuram --- ci/test/dao-test/virtio/l2fwd/meson.build | 1 + .../virtio/l2fwd/pcap/csum_expected.pcap | Bin 0 -> 9049 bytes .../dao-test/virtio/l2fwd/pcap/csum_tx.pcap | Bin 0 -> 9049 bytes .../virtio/l2fwd/virtio_l2fwd_csum.sh | 108 ++++++++++++++++++ 4 files changed, 109 insertions(+) create mode 100644 ci/test/dao-test/virtio/l2fwd/pcap/csum_expected.pcap create mode 100644 ci/test/dao-test/virtio/l2fwd/pcap/csum_tx.pcap create mode 100755 ci/test/dao-test/virtio/l2fwd/virtio_l2fwd_csum.sh diff --git a/ci/test/dao-test/virtio/l2fwd/meson.build b/ci/test/dao-test/virtio/l2fwd/meson.build index 52ea78b..b911945 100644 --- a/ci/test/dao-test/virtio/l2fwd/meson.build +++ b/ci/test/dao-test/virtio/l2fwd/meson.build @@ -9,6 +9,7 @@ tests = [ ['virtio_l2fwd_guest_1c', 'virtio_l2fwd_1c.sh', ''], ['virtio_l2fwd_perf', 'virtio_l2fwd_perf.sh', ''], ['virtio_l2fwd_host_net_1c', 'virtio_l2fwd_1c.sh', ''], + ['virtio_l2fwd_csum', 'virtio_l2fwd_csum.sh', ''] ] test_dir = meson.current_build_dir() diff --git a/ci/test/dao-test/virtio/l2fwd/pcap/csum_expected.pcap b/ci/test/dao-test/virtio/l2fwd/pcap/csum_expected.pcap new file mode 100644 index 0000000000000000000000000000000000000000..1f1797454a213d76b724a3b73ea099fcc12a837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NL+45!gth?2 zk|*>MWrb3=4sFgIq(i33;-uV1o*Ew0Jr2{*IhiNREylEpQ5jSTsuY#(N?HUh;%3mk zvM-WH30K1dyx;&1o%?y<+1h}s994m;M5P;^7Do$vIGiVLnUkkTTEnCLh(kM6$6yg+ zMEeZwszx27HmG$k)uQQ;M|3?`=P!R0d7jucJoHaG=tFfG)_z9l*Fs;Xs58_#P-~g7 z<>dLW|8QSkrUx3H56?M1gz8Kzz>R$PPao`XB+?+N0BkusVGwS{O+YL>5KlaahfcQibQUUwV{)d5)s9yxSw4w;xY zDRIHj!)OcCx;1>--2Kp;EYm6t&#reJyFztMmh4A%oj+FUlXZmPCcYGWgxwJSTM`)skXXH1I zk)gUX?`%d!ZoH9(b#pq(#kIMoZmD~&&JL#K7#-E{T>ZguHB?9EW#Y)yO?K7jHK|_r Rvs7qU^WlGJSQo6z(Lc-I9*F<| literal 0 HcmV?d00001 diff --git a/ci/test/dao-test/virtio/l2fwd/virtio_l2fwd_csum.sh b/ci/test/dao-test/virtio/l2fwd/virtio_l2fwd_csum.sh new file mode 100755 index 0000000..270df9b --- /dev/null +++ b/ci/test/dao-test/virtio/l2fwd/virtio_l2fwd_csum.sh @@ -0,0 +1,108 @@ +#!/bin/bash +# SPDX-License-Identifier: Marvell-MIT +# Copyright (c) 2024 Marvell. + +set -euo pipefail + +L2FWD_1C_SCRIPT_PATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +source $L2FWD_1C_SCRIPT_PATH/virtio_l2fwd_utils.sh + + +# List-format "offload-name +virtio_offloads=( + [0]="cksum 1 0 0" #CSUM_F + ) + +function csum_host_start_traffic() +{ + local pfx=$1 + + echo "Starting ports" + ep_host_op testpmd_cmd $pfx set fwd csum + ep_host_op testpmd_cmd $pfx start + echo "Started traffic on Host" +} + +failed_tests="" +function virtio_csum_offload_run() +{ + local pfx=$1 + local l2fwd_out=$2 + local ff=$3 + local tx_spcap=$4 + local cmp_script=$EP_DIR/ci/test/dao-test/common/scapy/validate_pcap.py + local rpcap=/tmp/out.pcap + local ref_pcap=$5 + local tpcap + local itr=0 + local max_offloads=${#virtio_offloads[@]} + ((--max_offloads)) + + + local list=(${virtio_offloads[$itr]}) + echo -e "######################## ITERATION $itr" \ + "(virtio_offload = "$ff"_${list[0]})########################\n" + + tpcap=$tx_spcap + + # Start traffic + l2fwd_host_launch_testpmd_with_pcap $pfx $tpcap $rpcap ${list[1]} ${list[2]} \ + ${list[3]} + + # Wait for host to connect before traffic start + l2fwd_host_connect_wait $l2fwd_out + csum_host_start_traffic $pfx + + # Stop Traffic + l2fwd_host_stop_traffic $pfx + + # validate packets + l2fwd_host_validate_traffic $cmp_script $ref_pcap $rpcap + local k=$? + if [[ "$k" != "0" ]]; then + failed_tests="$failed_tests \""$ff"_${list[0]}\"" + fi + return $k +} + + +function virtio_l2fwd_csum() +{ + local l2fwd_pfx=${DAO_TEST} + local host_testpmd_pfx=${DAO_TEST}_testpmd_host + local l2fwd_out=virtio_l2fwd.${l2fwd_pfx}.out + local tx_spcap=$EP_DIR/ci/test/dao-test/virtio/l2fwd/pcap/csum_tx.pcap + local ref_pcap=$EP_DIR/ci/test/dao-test/virtio/l2fwd/pcap/csum_expected.pcap + local if0=$(ep_device_get_inactive_if) + local k=0 + + + failed_tests="" + l2fwd_register_sig_handler ${DAO_TEST} $host_testpmd_pfx $l2fwd_out + + ep_common_bind_driver pci $if0 vfio-pci + + # Launch virtio l2fwd + if ! l2fwd_app_launch $if0 $l2fwd_pfx $l2fwd_out "4-7" \ + "-p 0x1 -v 0x1 -P -l --enable-l4-csum"; then + echo "Failed to launch virtio l2fwd" + + # Quit l2fwd app + l2fwd_app_quit $l2fwd_pfx $l2fwd_out + return 1 + fi + + ep_host_op vdpa_setup $(ep_device_get_part) + + virtio_csum_offload_run $host_testpmd_pfx $l2fwd_out "" $tx_spcap $ref_pcap + local k=$? + + ep_host_op vdpa_cleanup + # Quit l2fwd app + l2fwd_app_quit $l2fwd_pfx $l2fwd_out + + return $k +} + + +test_run ${DAO_TEST} 2