Currently the ovs-tcpdump utility creates a virtual tunnel to send
packets to. This method functions perfectly fine, however, it can
greatly impact the performance of the monitored port.

It has been reported to reduce packet throughput significantly. I was
able to reproduce a reduction in throughput of 70 percent with a very
simple setup of two hosts communicating through a single bridge. This
testing was performed on Linux both with and without the kernel module
module loaded. Another more complex DPDK test was configured with the
data path going from a port, through one OVS bridge, through a DPDK
enabled network card, then into a different OVS bridge, and finally
into another port.

Using the dummy driver instead of a tunnel results in the following
reduction in throughput compared to no ovs-tcpdump.

Kernel datapath - 5%
Usermode datapath - 10%
DPDK datapath - 17%

Signed-off-by: Mike Pattrick <m...@redhat.com>
---
 utilities/ovs-tcpdump.in | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/utilities/ovs-tcpdump.in b/utilities/ovs-tcpdump.in
index 5ec02383c..9be39827e 100755
--- a/utilities/ovs-tcpdump.in
+++ b/utilities/ovs-tcpdump.in
@@ -52,7 +52,6 @@ except Exception:
     print("       the correct location.")
     sys.exit(1)
 
-tapdev_fd = None
 _make_taps = {}
 _make_mirror_name = {}
 IFNAMSIZ_LINUX = 15      # this is the max name size, excluding the null byte.
@@ -68,20 +67,10 @@ def _doexec(*args, **kwargs):
 
 
 def _install_tap_linux(tap_name, mtu_value=None):
-    """Uses /dev/net/tun to create a tap device"""
-    global tapdev_fd
+    _doexec(
+        *['ip', 'link', 'add', str(tap_name), 'type', 'dummy']
+        ).wait()
 
-    IFF_TAP = 0x0002
-    IFF_NO_PI = 0x1000
-    TUNSETIFF = 0x400454CA  # This is derived by printf() of TUNSETIFF
-    TUNSETOWNER = TUNSETIFF + 2
-
-    tapdev_fd = os.open('/dev/net/tun', os.O_RDWR)
-    ifr = struct.pack('16sH', tap_name.encode('utf8'), IFF_TAP | IFF_NO_PI)
-    fcntl.ioctl(tapdev_fd, TUNSETIFF, ifr)
-    fcntl.ioctl(tapdev_fd, TUNSETOWNER, os.getegid())
-
-    time.sleep(1)  # required to give the new device settling time
     if mtu_value is not None:
         pipe = _doexec(
             *(['ip', 'link', 'set', 'dev', str(tap_name), 'mtu',
-- 
2.30.2


_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to