2021-04-19 17:27:20 +00:00
|
|
|
#!/usr/bin/env bash
|
2022-11-02 15:49:40 +00:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
# Copyright (C) 2021 Intel Corporation
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
2021-04-19 17:27:20 +00:00
|
|
|
testdir=$(readlink -f $(dirname $0))
|
|
|
|
rootdir=$(readlink -f $testdir/../../..)
|
|
|
|
source $rootdir/test/common/autotest_common.sh
|
|
|
|
source $rootdir/test/nvmf/common.sh
|
|
|
|
|
|
|
|
gather_supported_nvmf_pci_devs
|
|
|
|
TCP_INTERFACE_LIST=("${net_devs[@]}")
|
|
|
|
if ((${#TCP_INTERFACE_LIST[@]} == 0)); then
|
|
|
|
echo "ERROR: Physical TCP interfaces are not ready"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
perf="$SPDK_EXAMPLE_DIR/perf"
|
|
|
|
|
2022-08-02 18:01:20 +00:00
|
|
|
function adq_configure_driver() {
|
2021-04-19 17:27:20 +00:00
|
|
|
# Enable adding flows to hardware
|
|
|
|
"${NVMF_TARGET_NS_CMD[@]}" ethtool --offload $NVMF_TARGET_INTERFACE hw-tc-offload on
|
|
|
|
# ADQ driver turns on this switch by default, we need to turn it off for SPDK testing
|
|
|
|
"${NVMF_TARGET_NS_CMD[@]}" ethtool --set-priv-flags $NVMF_TARGET_INTERFACE channel-pkt-inspect-optimize off
|
|
|
|
# Since sockets are non-blocking, a non-zero value of net.core.busy_read is sufficient
|
|
|
|
sysctl -w net.core.busy_poll=1
|
|
|
|
sysctl -w net.core.busy_read=1
|
|
|
|
|
|
|
|
tc=/usr/sbin/tc
|
|
|
|
# Create 2 traffic classes and 2 tc1 queues
|
|
|
|
"${NVMF_TARGET_NS_CMD[@]}" $tc qdisc add dev $NVMF_TARGET_INTERFACE root \
|
|
|
|
mqprio num_tc 2 map 0 1 queues 2@0 2@2 hw 1 mode channel
|
|
|
|
"${NVMF_TARGET_NS_CMD[@]}" $tc qdisc add dev $NVMF_TARGET_INTERFACE ingress
|
|
|
|
# TC filter is configured using target address (traddr) and port number (trsvcid) to steer packets
|
|
|
|
"${NVMF_TARGET_NS_CMD[@]}" $tc filter add dev $NVMF_TARGET_INTERFACE protocol \
|
|
|
|
ip parent ffff: prio 1 flower dst_ip $NVMF_FIRST_TARGET_IP/32 ip_proto tcp dst_port $NVMF_PORT skip_sw hw_tc 1
|
|
|
|
# Setup mechanism for Tx queue selection based on Rx queue(s) map
|
|
|
|
"${NVMF_TARGET_NS_CMD[@]}" $rootdir/scripts/perf/nvmf/set_xps_rxqs $NVMF_TARGET_INTERFACE
|
|
|
|
}
|
|
|
|
|
2022-08-02 19:11:13 +00:00
|
|
|
function adq_configure_nvmf_target() {
|
2022-08-02 18:01:20 +00:00
|
|
|
$rpc_py sock_impl_set_options --enable-placement-id $1 --enable-zerocopy-send-server -i posix
|
2021-04-19 17:27:20 +00:00
|
|
|
$rpc_py framework_start_init
|
2022-08-02 18:01:20 +00:00
|
|
|
$rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS --io-unit-size 8192 --sock-priority $1
|
2021-04-19 17:27:20 +00:00
|
|
|
$rpc_py bdev_malloc_create 64 512 -b Malloc1
|
|
|
|
$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a -s SPDK00000000000001
|
|
|
|
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Malloc1
|
|
|
|
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
|
|
|
|
}
|
|
|
|
|
2022-08-02 18:01:20 +00:00
|
|
|
function adq_reload_driver() {
|
2021-04-19 17:27:20 +00:00
|
|
|
rmmod ice
|
|
|
|
modprobe ice
|
|
|
|
sleep 5
|
|
|
|
}
|
|
|
|
|
|
|
|
# Clear the previous configuration that may have an impact.
|
|
|
|
# At present, ADQ configuration is only applicable to the ice driver.
|
2022-08-02 18:01:20 +00:00
|
|
|
adq_reload_driver
|
2021-04-19 17:27:20 +00:00
|
|
|
|
2022-08-02 19:02:35 +00:00
|
|
|
# We are going to run the test twice, once with ADQ enabled and once with it disabled.
|
|
|
|
# The nvmf target is given 4 cores and ADQ creates queues in one traffic class. We then run
|
|
|
|
# perf with 4 cores (i.e. 4 connections) and examine how the connections are allocated to the nvmf target's
|
|
|
|
# poll groups.
|
|
|
|
|
|
|
|
# When ADQ is disabled, we expect 1 connection on each of the 4 poll groups.
|
2021-04-19 17:27:20 +00:00
|
|
|
nvmftestinit
|
2022-08-02 19:11:13 +00:00
|
|
|
nvmfappstart -m 0xF --wait-for-rpc
|
|
|
|
adq_configure_nvmf_target 0
|
2022-08-02 19:02:35 +00:00
|
|
|
$perf -q 64 -o 4096 -w randread -t 10 -c 0xF0 \
|
2021-04-19 17:27:20 +00:00
|
|
|
-r "trtype:${TEST_TRANSPORT} adrfam:IPv4 traddr:${NVMF_FIRST_TARGET_IP} trsvcid:${NVMF_PORT} \
|
2022-08-02 19:02:35 +00:00
|
|
|
subnqn:nqn.2016-06.io.spdk:cnode1" &
|
2021-04-19 17:27:20 +00:00
|
|
|
perfpid=$!
|
|
|
|
sleep 2
|
2022-08-02 19:02:35 +00:00
|
|
|
|
|
|
|
count=$("$rpc_py" nvmf_get_stats | jq -r '.poll_groups[] | select(.current_io_qpairs == 1) | length' | wc -l)
|
|
|
|
if [[ "$count" -ne 4 ]]; then
|
|
|
|
echo "ERROR: With ADQ disabled, connections were not evenly distributed amongst poll groups!"
|
2021-04-19 17:27:20 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
wait $perfpid
|
|
|
|
nvmftestfini
|
|
|
|
|
2022-08-02 18:01:20 +00:00
|
|
|
adq_reload_driver
|
2021-04-19 17:27:20 +00:00
|
|
|
|
2022-08-02 19:02:35 +00:00
|
|
|
# When ADQ is enabled, we expect the connections to reside on AT MOST two poll groups.
|
2021-04-19 17:27:20 +00:00
|
|
|
nvmftestinit
|
2022-08-02 18:01:20 +00:00
|
|
|
adq_configure_driver
|
2022-08-02 19:11:13 +00:00
|
|
|
nvmfappstart -m 0xF --wait-for-rpc
|
|
|
|
adq_configure_nvmf_target 1
|
2022-08-02 19:02:35 +00:00
|
|
|
$perf -q 64 -o 4096 -w randread -t 10 -c 0xF0 \
|
2021-04-19 17:27:20 +00:00
|
|
|
-r "trtype:${TEST_TRANSPORT} adrfam:IPv4 traddr:${NVMF_FIRST_TARGET_IP} trsvcid:${NVMF_PORT} \
|
2022-08-02 19:02:35 +00:00
|
|
|
subnqn:nqn.2016-06.io.spdk:cnode1" &
|
2021-04-19 17:27:20 +00:00
|
|
|
perfpid=$!
|
2022-08-02 19:02:35 +00:00
|
|
|
sleep 2
|
2022-08-02 19:04:01 +00:00
|
|
|
|
2022-08-02 19:02:35 +00:00
|
|
|
count=$("$rpc_py" nvmf_get_stats | jq -r '.poll_groups[] | select(.current_io_qpairs == 0) | length' | wc -l)
|
|
|
|
if [[ "$count" -lt 2 ]]; then
|
|
|
|
echo "ERROR: With ADQ enabled, did not find 0 connections on 2 of the poll groups!"
|
2021-04-19 17:27:20 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2022-08-02 19:02:35 +00:00
|
|
|
|
2021-04-19 17:27:20 +00:00
|
|
|
wait $perfpid
|
|
|
|
nvmftestfini
|
|
|
|
|
|
|
|
trap - SIGINT SIGTERM EXIT
|