mirror of
https://github.com/openvswitch/ovs
synced 2025-08-22 01:51:26 +00:00
Until now there was only two options for XDP mode in OVS: SKB or DRV. i.e. 'generic XDP' or 'native XDP with zero-copy enabled'. Devices like 'veth' interfaces in Linux supports native XDP, but doesn't support zero-copy mode. This case can not be covered by existing API and we have to use slower generic XDP for such devices. There are few more issues, e.g. TCP is not supported in generic XDP mode for veth interfaces due to kernel limitations, however it is supported in native mode. This change introduces ability to use native XDP without zero-copy along with best-effort configuration option that enabled by default. In best-effort case OVS will sequentially try different modes starting from the fastest one and will choose the first acceptable for current interface. This will guarantee the best possible performance. If user will want to choose specific mode, it's still possible by setting the 'options:xdp-mode'. This change additionally changes the API by renaming the configuration knob from 'xdpmode' to 'xdp-mode' and also renaming the modes themselves to be more user-friendly. The full list of currently supported modes: * native-with-zerocopy - former DRV * native - new one, DRV without zero-copy * generic - former SKB * best-effort - new one, chooses the best available from 3 above modes Since 'best-effort' is a default mode, users will not need to explicitely set 'xdp-mode' in most cases. TCP related tests enabled back in system afxdp testsuite, because 'best-effort' will choose 'native' mode for veth interfaces and this mode has no issues with TCP. Signed-off-by: Ilya Maximets <i.maximets@ovn.org> Acked-by: William Tu <u9012063@gmail.com> Acked-by: Eelco Chaudron <echaudro@redhat.com>
33 lines
1.1 KiB
Plaintext
33 lines
1.1 KiB
Plaintext
# Add port to ovs bridge by using afxdp mode.
|
|
# This will use generic XDP support in the veth driver.
|
|
m4_define([ADD_VETH],
|
|
[ AT_CHECK([ip link add $1 type veth peer name ovs-$1 || return 77])
|
|
CONFIGURE_VETH_OFFLOADS([$1])
|
|
AT_CHECK([ip link set $1 netns $2])
|
|
AT_CHECK([ip link set dev ovs-$1 up])
|
|
AT_CHECK([ovs-vsctl add-port $3 ovs-$1 -- \
|
|
set interface ovs-$1 external-ids:iface-id="$1" type="afxdp"])
|
|
NS_CHECK_EXEC([$2], [ip addr add $4 dev $1 $7])
|
|
NS_CHECK_EXEC([$2], [ip link set dev $1 up])
|
|
if test -n "$5"; then
|
|
NS_CHECK_EXEC([$2], [ip link set dev $1 address $5])
|
|
fi
|
|
if test -n "$6"; then
|
|
NS_CHECK_EXEC([$2], [ip route add default via $6])
|
|
fi
|
|
on_exit 'ip link del ovs-$1'
|
|
]
|
|
)
|
|
|
|
m4_define([OVS_CHECK_8021AD],
|
|
[AT_SKIP_IF([:])])
|
|
|
|
# CONFIGURE_VETH_OFFLOADS([VETH])
|
|
#
|
|
# Disable TX offloads and VLAN offloads for veths used in AF_XDP.
|
|
m4_define([CONFIGURE_VETH_OFFLOADS],
|
|
[AT_CHECK([ethtool -K $1 tx off], [0], [ignore], [ignore])
|
|
AT_CHECK([ethtool -K $1 txvlan off], [0], [ignore], [ignore])
|
|
]
|
|
)
|