diff mbox series

[ovs-dev,v2] ovs-tcpdump: Improve performance with dummy interface

Message ID ca37a748eeb6efe524fd7c77ed9c1824cae71258.camel@redhat.com
State Superseded
Headers show
Series [ovs-dev,v2] ovs-tcpdump: Improve performance with dummy interface | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test fail github build: failed

Commit Message

Mike Pattrick Oct. 20, 2021, 10:32 p.m. UTC
Currently the ovs-tcpdump utility creates a virtual tunnel to send
packets to. This method functions perfectly fine, however, it can greatly
impact 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 resulted in the following impact to performance
compared to no ovs-tcpdump.

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

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

Patch

diff --git a/utilities/ovs-tcpdump.in b/utilities/ovs-tcpdump.in
index 5ec02383c..ee208f74a 100755
--- a/utilities/ovs-tcpdump.in
+++ b/utilities/ovs-tcpdump.in
@@ -14,12 +14,9 @@ 
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import fcntl
-
 import os
 import pwd
 from random import randint
-import struct
 import subprocess
 import sys
 import time
@@ -52,7 +49,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 +64,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
-
-    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())
+    _doexec(
+        *['ip', 'link', 'add', str(tap_name), 'type', 'dummy']
+        ).wait()
 
-    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',