ADD_VF is invoked N times, each time $VF is overwritten.
The restore of the first N-1 VF devices is incorrect. To fix it, keep
the original name in ORIG_<port> file, and use it for the restore.
Also, renaming of ports might cause conflicts with other ports in the
system. For that purpose, change the order to first move them to a
namespace and do the operations there. On exit also change the order to
first restore and finally move out of the namespace.
Fixes: 289e9f6baa7c ("tests: Add a simple DPDK rte_flow test framework.")
Signed-off-by: Eli Britstein <[email protected]>
---
tests/system-dpdk-offloads-macros.at | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/tests/system-dpdk-offloads-macros.at
b/tests/system-dpdk-offloads-macros.at
index f165ee890..3c6cce1a8 100644
--- a/tests/system-dpdk-offloads-macros.at
+++ b/tests/system-dpdk-offloads-macros.at
@@ -109,8 +109,8 @@ m4_define([ADD_VF],
AT_CHECK([test -n "$VF"])
AT_CHECK([ip link set $VF down])
- AT_CHECK([ip link set $VF name $1])
- AT_CHECK([ip link set $1 netns $2])
+ AT_CHECK([ip link set $VF netns $2])
+ AT_CHECK([ip netns exec $2 ip link set $VF name $1 && printf '%s\n'
"$VF" > ORIG_$1])
AT_CHECK([ovs-vsctl add-port $3 ovs-$1 -- \
set interface ovs-$1 external-ids:iface-id="$1" -- \
set interface ovs-$1 type=dpdk -- \
@@ -127,9 +127,11 @@ m4_define([ADD_VF],
if test -n "$6"; then
NS_CHECK_EXEC([$2], [ip route add default via $6])
fi
- on_exit "ip netns exec $2 ip link set $1 netns 1; \
- ip link property del dev $1 altname $VF; \
- ip link set $1 name $VF"
+ on_exit "orig=\$(cat ORIG_$1); \
+ rm -f ORIG_$1; \
+ ip netns exec $2 ip link set $1 down; \
+ ip netns exec $2 ip link set $1 name \"\$orig\"; \
+ ip netns exec $2 ip link set \"\$orig\" netns 1"
]
)
m4_define([ADD_VETH], [ADD_VF($@)])
--
2.34.1
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev