]>
Commit | Line | Data |
---|---|---|
a7e4849e MR |
1 | # OVS_DPDK_PRE_CHECK() |
2 | # | |
3 | # Check prerequisites for DPDK tests. Following settings are checked: | |
4 | # - Hugepages | |
a7e4849e MR |
5 | # |
6 | m4_define([OVS_DPDK_PRE_CHECK], | |
7 | [dnl Check Hugepages | |
8 | AT_CHECK([cat /proc/meminfo], [], [stdout]) | |
f9e1eba9 | 9 | AT_SKIP_IF([egrep 'HugePages_Free: *0' stdout], [], [stdout]) |
a7e4849e MR |
10 | AT_CHECK([mount], [], [stdout]) |
11 | AT_CHECK([grep 'hugetlbfs' stdout], [], [stdout], []) | |
12 | ||
a01786b4 AC |
13 | ]) |
14 | ||
15 | ||
16 | # OVS_DPDK_PRE_PHY_SKIP() | |
17 | # | |
18 | # Skip any phy related tests if the PHY variable is not set. | |
19 | # This is done by checking for a bound driver. | |
20 | # | |
21 | m4_define([OVS_DPDK_PRE_PHY_SKIP], | |
22 | [dnl Perform the precheck | |
23 | OVS_DPDK_PRE_CHECK() | |
24 | ||
a7e4849e | 25 | dnl Check if VFIO or UIO driver is loaded |
a01786b4 | 26 | AT_SKIP_IF([ ! (lsmod | grep -E "igb_uio|vfio") ], [], [stdout]) |
a7e4849e MR |
27 | |
28 | dnl Find PCI address candidate, skip if there is no DPDK-compatible NIC | |
29 | AT_CHECK([$DPDK_DIR/usertools/dpdk-devbind.py -s | head -n +4 | tail -1], [], [stdout]) | |
30 | AT_CHECK([cat stdout | cut -d" " -s -f1 > PCI_ADDR]) | |
a01786b4 AC |
31 | AT_SKIP_IF([ ! test -s PCI_ADDR ]) |
32 | ||
a7e4849e MR |
33 | ]) |
34 | ||
35 | ||
36 | # OVS_DPDK_START() | |
37 | # | |
38 | # Create an empty database and start ovsdb-server. Add special configuration | |
39 | # dpdk-init to enable DPDK functionality. Start ovs-vswitchd connected to that | |
40 | # database using system devices (no dummies). | |
41 | # | |
42 | m4_define([OVS_DPDK_START], | |
43 | [dnl Create database. | |
44 | AT_CHECK([touch .conf.db.~lock~]) | |
45 | AT_CHECK([ovsdb-tool create conf.db $abs_top_srcdir/vswitchd/vswitch.ovsschema]) | |
46 | ||
47 | dnl Start ovsdb-server. | |
48 | AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock], [0], [stdout], [stderr]) | |
49 | on_exit "kill `cat ovsdb-server.pid`" | |
50 | AT_CHECK([[sed < stderr ' | |
51 | /vlog|INFO|opened log file/d | |
52 | /ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d']]) | |
53 | AT_CAPTURE_FILE([ovsdb-server.log]) | |
54 | ||
55 | dnl Initialize database. | |
56 | AT_CHECK([ovs-vsctl --no-wait init]) | |
57 | ||
58 | dnl Enable DPDK functionality | |
59 | AT_CHECK([ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true]) | |
a7e4849e MR |
60 | |
61 | dnl Start ovs-vswitchd. | |
62 | AT_CHECK([ovs-vswitchd --detach --no-chdir --pidfile --log-file -vvconn -vofproto_dpif -vunixctl], [0], [stdout], [stderr]) | |
63 | AT_CAPTURE_FILE([ovs-vswitchd.log]) | |
64 | on_exit "kill_ovs_vswitchd `cat ovs-vswitchd.pid`" | |
65 | ]) |