Skip to content

Commit

Permalink
ci: dao-test: add test case for multi segment
Browse files Browse the repository at this point in the history
Adds test case for multi segment.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Change-Id: I32ae3cba9a14adb2e56b3fb7d682540e0ed9ac31
Reviewed-on: https://sj1git1.cavium.com/c/IP/SW/dataplane/dpu-offload/+/135682
Tested-by: sa_ip-toolkits-Jenkins <sa_ip-toolkits-jenkins@marvell.com>
Reviewed-by: Harman Kalra <hkalra@marvell.com>
  • Loading branch information
adwivedi7 authored and harman-kalra committed Oct 10, 2024
1 parent 3f5ebb8 commit 5db2fff
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 14 deletions.
12 changes: 10 additions & 2 deletions ci/test/dao-test/common/ep_common_ops.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ function ep_common_if_configure()
local vxlan_local_ip=
local vxlan_vni=
local vlan_id=
local mtu=

if ! opts=$(getopt \
-l "ip:,pcie-addr:,down,vxlan-remote-ip:,vxlan-local-ip:,vxlan-vni:,vlan-id:" \
-l "ip:,pcie-addr:,down,vxlan-remote-ip:,vxlan-local-ip:,vxlan-vni:,vlan-id:,mtu:" \
-- configure_sdp_interface $@); then
echo "Failed to parse arguments"
exit 1
Expand All @@ -107,6 +108,7 @@ function ep_common_if_configure()
--vxlan-local-ip) shift; vxlan_local_ip=$1;;
--vlan-id) shift; vlan_id=$1;;
--down) down=1;;
--mtu) shift; mtu=$1;;
*) echo "Invalid argument $1"; exit 1;;
esac
shift
Expand Down Expand Up @@ -148,6 +150,10 @@ function ep_common_if_configure()
ifconfig $iface_name up
ifconfig $iface_name $ip_addr/24
fi

if [[ -n $mtu ]]; then
ifconfig $iface_name mtu $mtu
fi
fi
}

Expand All @@ -163,9 +169,11 @@ function ep_common_ping()
local src=$1
local dst=$2
local count=${3:-32}
local pktsz=${4:-56}
local ping_out

ping_out=$(ping -c $count -i 0.2 -I $src $dst || true)
ping_out=$(ping -c $count -i 0.2 -s $pktsz -I $src $dst || true)
echo "$ping_out">&2
if [[ -n $(echo $ping_out | grep ", 0% packet loss,") ]]; then
echo "SUCCESS"
else
Expand Down
6 changes: 6 additions & 0 deletions ci/test/dao-test/ovs/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ tests = [
['ovs_plain_ping_hw_offload', 'ovs_ping.sh', ''],
['ovs_vlan_ping_hw_offload', 'ovs_ping.sh', ''],
['ovs_vxlan_ping_hw_offload', 'ovs_ping.sh', ''],
['ovs_plain_ping_jumbo_pkt', 'ovs_ping.sh', ''],
['ovs_vlan_ping_jumbo_pkt', 'ovs_ping.sh', ''],
['ovs_vxlan_ping_jumbo_pkt', 'ovs_ping.sh', ''],
['ovs_plain_ping_jumbo_pkt_hw_offload', 'ovs_ping.sh', ''],
['ovs_vlan_ping_jumbo_pkt_hw_offload', 'ovs_ping.sh', ''],
['ovs_vxlan_ping_jumbo_pkt_hw_offload', 'ovs_ping.sh', ''],
]

test_dir = meson.current_build_dir()
Expand Down
47 changes: 44 additions & 3 deletions ci/test/dao-test/ovs/ovs_ping.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ function ovs_ping()
{
local test_type=$1
local hw_offload=$2
local mtu=${3:-1500}
local pktsz=${4:-56}
local eth_pf_ifcs
local sdp_eth_vf_pairs
local esw_vf_ifcs
Expand All @@ -23,11 +25,13 @@ function ovs_ping()
local remote_ip="20.0.0.20"
local extra_args_interface_setup=
local extra_args_remote_ifconfig=
local extra_args_host_ifconfig=
local vxlan_local_ip="30.0.0.2"
local vxlan_remote_ip="30.0.0.254"
local vxlan_subnet="30.0.0.0"
local vxlan_vni=5001
local vlan_id=100
local maxpktlen

if [[ $test_type == "vlan" ]]; then
extra_args_interface_setup="--vlan-id $vlan_id"
Expand All @@ -38,6 +42,11 @@ function ovs_ping()
--vxlan-remote-ip $vxlan_remote_ip --vxlan-local-ip $vxlan_local_ip"
fi

maxpktlen=$[mtu+18]
extra_args_interface_setup+=" --mtu-request $mtu"
extra_args_remote_ifconfig+=" --mtu $mtu"
extra_args_host_ifconfig+=" --mtu $mtu"

# Register signal handler
ovs_register_sig_handler

Expand Down Expand Up @@ -67,17 +76,19 @@ function ovs_ping()
echo "Running OVS offload"
ovs_offload_launch \
$(form_split_args "--esw-vf-ifc" "$esw_vf_ifcs") \
$(form_split_args "--sdp-eth-vf-pair" "$sdp_eth_vf_pairs")
$(form_split_args "--sdp-eth-vf-pair" "$sdp_eth_vf_pairs") \
$(form_split_args "--max-pkt-len" $maxpktlen)

echo "Configure SDP interface on host"
ep_host_op if_configure --pcie-addr $EP_HOST_SDP_IFACE --ip $host_ip
ep_host_op if_configure --pcie-addr $EP_HOST_SDP_IFACE --ip $host_ip \
$extra_args_host_ifconfig

echo "Configure remote interface"
ep_remote_op bind_driver pci $EP_REMOTE_IFACE rvu_nicpf
ep_remote_op if_configure --pcie-addr $EP_REMOTE_IFACE \
--ip $remote_ip $extra_args_remote_ifconfig

if [[ $(ep_host_op ping $host_ip $remote_ip) != "SUCCESS" ]]; then
if [[ $(ep_host_op ping $host_ip $remote_ip 32 $pktsz) != "SUCCESS" ]]; then
echo "Ping Failed"
exit 1
else
Expand Down Expand Up @@ -115,4 +126,34 @@ function ovs_vxlan_ping_hw_offload()
ovs_ping vxlan true
}

function ovs_plain_ping_jumbo_pkt()
{
ovs_ping plain false 9000 8000
}

function ovs_vlan_ping_jumbo_pkt()
{
ovs_ping vlan false 9000 8000
}

function ovs_vxlan_ping_jumbo_pkt()
{
ovs_ping vxlan false 9000 8000
}

function ovs_plain_ping_jumbo_pkt_hw_offload()
{
ovs_ping plain true 9000 8000
}

function ovs_vlan_ping_jumbo_pkt_hw_offload()
{
ovs_ping vlan true 9000 8000
}

function ovs_vxlan_ping_jumbo_pkt_hw_offload()
{
ovs_ping vxlan true 9000 8000
}

test_run ${DAO_TEST} 2
38 changes: 30 additions & 8 deletions ci/test/dao-test/ovs/ovs_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@ function ovs_interface_setup()
local net
local ipaddr
local vlan_id=
local mtu=

if ! opts=$(getopt \
-l "eth-ifc:,num-sdp-ifcs-per-eth:,vxlan-vni:,vxlan-subnet:,vlan-id:" \
-l "eth-ifc:,num-sdp-ifcs-per-eth:,vxlan-vni:,vxlan-subnet:,vlan-id:,mtu-request:" \
-- interface_setup $@); then
echo "Failed to parse arguments"
exit 1
Expand All @@ -132,6 +133,7 @@ function ovs_interface_setup()
--vxlan-subnet) shift; vxlan_subnet=$1;;
--vlan-id) shift; vlan_id=$1;;
--num-sdp-ifcs-per-eth) shift; num_sdp_ifcs_per_eth=$1;;
--mtu-request) shift; mtu=$1;;
*) echo "Unknown argument $1"; exit 1;;
esac
shift
Expand All @@ -151,16 +153,20 @@ function ovs_interface_setup()
"br${eth_ifc_idx}" \
"e${eth_ifc_idx}_vf_rep${sdp_idx}" \
$esw_pf_pcie \
"representor=pf${pfid}vf${sdp_idx}"
"representor=pf${pfid}vf${sdp_idx}" \
"mtu_request=$mtu"

done

if [[ -n $vxlan_vni ]]; then
local vni=$((vxlan_vni + eth_ifc_idx))
net=$((eth_ifc_idx + 2))
ipaddr=${vxlan_subnet%.*}.$net
ovs_vxlan_port_add "br${eth_ifc_idx}" "vxlan${eth_ifc_idx}" "$ipaddr" $vni
ovs_vxlan_port_add "br${eth_ifc_idx}" "vxlan${eth_ifc_idx}" \
"$ipaddr" $vni "mtu_request=$mtu"
else
ovs_port_add "br${eth_ifc_idx}" "e${eth_ifc_idx}_pf" $eth_ifc
ovs_port_add "br${eth_ifc_idx}" "e${eth_ifc_idx}_pf" $eth_ifc \
"" "mtu_request=$mtu"
fi

sleep 1
Expand All @@ -183,7 +189,7 @@ function ovs_interface_setup()
other_config:hwaddr=00:00:00:aa:bb:$khex"

ovs_bridge_add br${k} "netdev" "$br_args"
ovs_port_add "br${k}" "e${eth_ifc_idx}_pf" $eth_ifc
ovs_port_add "br${k}" "e${eth_ifc_idx}_pf" $eth_ifc "" "mtu_request=$mtu"

# Bring the bridge up
ovs_iface_link_set "br${k}" "up"
Expand Down Expand Up @@ -237,12 +243,13 @@ function ovs_port_add()
local port=$2
local pcie_addr=$3
local rep_args=${4:-}
local mtu_args=${5:-}

if [[ -n $rep_args ]]; then
rep_args=",$rep_args"
fi
ovs-vsctl add-port $br_name $port -- set Interface $port type=dpdk \
options:dpdk-devargs="$pcie_addr"$rep_args
options:dpdk-devargs="$pcie_addr"$rep_args $mtu_args
}

function ovs_vxlan_port_add()
Expand All @@ -251,9 +258,10 @@ function ovs_vxlan_port_add()
local port=$2
local raddr=$3
local vni=$4
local mtu_args=${5:-}

ovs-vsctl add-port $br_name $port -- set Interface $port type=vxlan \
options:remote_ip=$raddr options:key=$vni
options:remote_ip=$raddr options:key=$vni $mtu_args
}

function ovs_port_del()
Expand Down Expand Up @@ -305,10 +313,11 @@ function ovs_offload_launch()
local dao_offload
local coremask=0
local portconf=""
local maxpktlen=0
local tmp

if ! opts=$(getopt \
-l "sdp-eth-vf-pair:,esw-vf-ifc:" \
-l "sdp-eth-vf-pair:,esw-vf-ifc:,max-pkt-len:" \
-- get_allowlist $@); then
echo "Failed to parse arguments"
exit 1
Expand All @@ -335,6 +344,8 @@ function ovs_offload_launch()
coremask=$((coremask | 3 << num_cores));;
--esw-vf-ifc) shift;
allowlist="$allowlist -a $1";;
--max-pkt-len) shift;
maxpktlen=$1;;
*) echo "Unknown argument $1"; exit 1;;
esac
shift
Expand All @@ -352,6 +363,16 @@ function ovs_offload_launch()

find_executable "dao-ovs-offload" dao_offload "$OVS_UTILS_SCRIPT_PATH/../../../../app"

echo "$dao_offload \
-c $coremask \
$allowlist \
--vfio-vf-token="$VFIO_TOKEN" \
--file-prefix=ep \
-- \
-p 0xff \
--portmap="$portmap" \
--max-pkt-len=$maxpktlen \
--config="$portconf" &> $EP_DEVICE_OVS_PATH/var/log/dao-ovs-offload.log &"
$dao_offload \
-c $coremask \
$allowlist \
Expand All @@ -360,6 +381,7 @@ function ovs_offload_launch()
-- \
-p 0xff \
--portmap="$portmap" \
--max-pkt-len=$maxpktlen \
--config="$portconf" &> $EP_DEVICE_OVS_PATH/var/log/dao-ovs-offload.log &

sleep 10
Expand Down
2 changes: 1 addition & 1 deletion ci/test/ep/ovs_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function dao_ovs_setup()
echo "Copied OVS version: $OVS_VERSION"

echo "Setting up EP device for ovs tests"
ep_device_op hugepage_setup 524288 24 6
ep_device_op hugepage_setup 524288 24 12

echo "Setting up EP Host for ovs"
ep_host_op sdp_setup
Expand Down

0 comments on commit 5db2fff

Please sign in to comment.