mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
At present, the system-dpdk-testsuite makes assumptions about environment configuration, and will error out if DPDK compatible interfaces not configured for DPDK are present in the system with a message like: EAL: Probe PCI driver: net_virtio (1af4:1000) device: 0000:00:03.0 (socket -1) eth_virtio_pci_init(): Failed to init PCI device EAL: Requested device 0000:00:03.0 cannot be used The system-dpdk-testsuite is useful even with no DPDK PHY available, as the tests requiring a PHY will skip gracefully when none present. This patch extends the OVS_DPDK_START and OVS_DPDK_START_VSWITCHD macros to allow passing in values that will be set in `other_config:dpdk-extra` before the test runs. Tests that do not use physical ports are also extended to pass the `--no-pci` argument. We will use this patch in a follow-up, enabling more elaborate Debian autopkgtests for Open vSwitch. Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
82 lines
2.5 KiB
Plaintext
82 lines
2.5 KiB
Plaintext
# OVS_DPDK_PRE_CHECK()
|
|
#
|
|
# Check prerequisites for DPDK tests. Following settings are checked:
|
|
# - Hugepages
|
|
#
|
|
m4_define([OVS_DPDK_PRE_CHECK],
|
|
[dnl Check Hugepages
|
|
AT_CHECK([cat /proc/meminfo], [], [stdout])
|
|
AT_SKIP_IF([grep -E 'HugePages_Free: *0' stdout], [], [stdout])
|
|
AT_CHECK([mount], [], [stdout])
|
|
AT_CHECK([grep 'hugetlbfs' stdout], [], [stdout], [])
|
|
|
|
])
|
|
|
|
|
|
# OVS_DPDK_PRE_PHY_SKIP()
|
|
#
|
|
# Skip any phy related tests if the PHY variable is not set.
|
|
# This is done by checking for a bound driver.
|
|
#
|
|
m4_define([OVS_DPDK_PRE_PHY_SKIP],
|
|
[dnl Perform the precheck
|
|
OVS_DPDK_PRE_CHECK()
|
|
|
|
dnl Check if VFIO or UIO driver is loaded
|
|
AT_SKIP_IF([ ! (lsmod | grep -E "igb_uio|vfio") ], [], [stdout])
|
|
|
|
dnl Find PCI address candidate, skip if there is no DPDK-compatible NIC
|
|
AT_CHECK([$DPDK_DIR/usertools/dpdk-devbind.py -s | head -n +4 | tail -1], [], [stdout])
|
|
AT_CHECK([cat stdout | cut -d" " -s -f1 > PCI_ADDR])
|
|
AT_SKIP_IF([ ! test -s PCI_ADDR ])
|
|
|
|
])
|
|
|
|
|
|
# OVS_DPDK_START()
|
|
#
|
|
# Start ovsdb-server. Set dpdk-init to initialize DPDK. Start ovs-vswitchd.
|
|
#
|
|
m4_define([OVS_DPDK_START],
|
|
[dnl start ovs dpdk
|
|
OVS_DPDK_START_OVSDB()
|
|
dnl Enable DPDK functionality
|
|
AT_CHECK([ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true])
|
|
OVS_DPDK_START_VSWITCHD($1)
|
|
])
|
|
|
|
# OVS_DPDK_START_OVSDB()
|
|
#
|
|
# Create an empty database and start ovsdb-server.
|
|
#
|
|
m4_define([OVS_DPDK_START_OVSDB],
|
|
[dnl Create database.
|
|
AT_CHECK([touch .conf.db.~lock~])
|
|
AT_CHECK([ovsdb-tool create conf.db $abs_top_srcdir/vswitchd/vswitch.ovsschema])
|
|
|
|
dnl Start ovsdb-server.
|
|
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock], [0], [stdout], [stderr])
|
|
on_exit "kill `cat ovsdb-server.pid`"
|
|
AT_CHECK([[sed < stderr '
|
|
/vlog|INFO|opened log file/d
|
|
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d']])
|
|
AT_CAPTURE_FILE([ovsdb-server.log])
|
|
|
|
dnl Initialize database.
|
|
AT_CHECK([ovs-vsctl --no-wait init])
|
|
])
|
|
|
|
# OVS_DPDK_START_VSWITCHD()
|
|
#
|
|
# Add special configuration for dpdk-init. Start ovs-vswitchd.
|
|
#
|
|
m4_define([OVS_DPDK_START_VSWITCHD],
|
|
[dnl Change DPDK drivers log levels so that tests only catch errors
|
|
AT_CHECK([ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-extra="--log-level=pmd.*:error $1"])
|
|
|
|
dnl Start ovs-vswitchd.
|
|
AT_CHECK([ovs-vswitchd --detach --no-chdir --pidfile --log-file -vvconn -vofproto_dpif -vunixctl], [0], [stdout], [stderr])
|
|
AT_CAPTURE_FILE([ovs-vswitchd.log])
|
|
on_exit "kill_ovs_vswitchd `cat ovs-vswitchd.pid`"
|
|
])
|