[ovs-discuss] Seek advice for direct r/w to an ovs port

Xu_Zhaokui cynicholas at gmail.com
Sat Jun 20 14:48:28 UTC 2015


Hi all:

I am a developer who is using ovs in my personal project. Recently I am
trying to do some tcp/ip Nat stuff in a program running in userspace, so I
need to read/write whole L2 packets from ovs directly, the way I am taking
now is attaching a tap device to the ovs bridge, and then open the tap
device for reading and writing, Just like this:

ovs-vsctl add-br br0

ifconfig br0 up

ip tun tap add dev tap0 mode tap

ovs-vsctl add-port br0 tap0

However, I found the performance of the tap device is really bad, my Nat
program can just hold up to 2Gbps bandwidth in one tcp connection(test by
iperf), and the cpu(16 cores) usage are almost full, while the bandwidth
between two veth can be 30Gbps.

My nat program is written in GO, so I did a cpu prof of it, then I found
this:

The result of my program’s cpuprof shows that most of cpu is wasting on the
syscalls to read/write tap device.

So, is there any other better way to read/write directly from/to an ovs
bridge’s port?

By the way, I notice that when adding a port to ovs bridge, there is an
option “type=tap” for setting, but I cannot find the related documents
anywhere, will it be any performance promotion if I set the tap interface
with this option? like this:

ovs-vsctl set interface tap0 type=tap

Thanks for paying attention to this help, waiting for your precious advice.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openvswitch.org/pipermail/ovs-discuss/attachments/20150620/99875582/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cpuprof.jpg
Type: image/jpeg
Size: 3048518 bytes
Desc: not available
URL: <http://openvswitch.org/pipermail/ovs-discuss/attachments/20150620/99875582/attachment-0002.jpg>


More information about the discuss mailing list