]> git.proxmox.com Git - mirror_ovs.git/log
mirror_ovs.git
7 years agonetdev-dpdk: Use DP_PACKET_BATCH_FOR_EACH in netdev_dpdk_ring_send.
Bhanuprakash Bodireddy [Fri, 22 Sep 2017 09:05:49 +0000 (02:05 -0700)]
netdev-dpdk: Use DP_PACKET_BATCH_FOR_EACH in netdev_dpdk_ring_send.

Use DP_PACKET_BATCH_FOR_EACH macro in netdev_dpdk_ring_send().

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agoconntrack: Use DP_PACKET_BATCH_FOR_EACH macro.
Bhanuprakash Bodireddy [Fri, 22 Sep 2017 09:04:32 +0000 (02:04 -0700)]
conntrack: Use DP_PACKET_BATCH_FOR_EACH macro.

Use DP_PACKET_BATCH_FOR_EACH macro in conntrack_execute().

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agodocs: Use DPDK 17.05.2 release.
Ian Stokes [Fri, 22 Sep 2017 08:59:33 +0000 (01:59 -0700)]
docs: Use DPDK 17.05.2 release.

Modify docs and travis linux build script to use the DPDK 17.05.2
release branch to benefit from most recent bug fixes.

There are no new features introduced in the DPDK release, only back
ported bug fixes. For completeness these bug fixes have been documented
under the 17.05.2 section in the link below.

http://dpdk.org/doc/guides-17.05/rel_notes/release_17_05.html

Signed-off-by: Ian Stokes <ian.stokes@intel.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agodpif-netdev: Avoid reading RSS hash when EMC is disabled.
Fischetti, Antonio [Fri, 22 Sep 2017 08:56:28 +0000 (01:56 -0700)]
dpif-netdev: Avoid reading RSS hash when EMC is disabled.

When EMC is disabled the reading of RSS hash is skipped.
Also, for packets that are not recirculated it retrieves
the hash value without considering the recirc id.

Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>
Acked-by: Billy O'Mahony <billy.o.mahony@intel.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agoofproto: Include patch ports in mtu overriden check
Numan Siddique [Tue, 12 Sep 2017 08:52:03 +0000 (14:22 +0530)]
ofproto: Include patch ports in mtu overriden check

When a patch port is deleted from the bridge (with no other ports
in the bridge) and if the bridge was set to an MTU by the user earlier, the
MTU of the bridge is overriden to 1500. Please see the below link for the
steps to reproduce the issue.

This patch fixes this issue.

Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-September/338665.html
Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoacinclude: Add missing define
Greg Rose [Thu, 21 Sep 2017 15:35:29 +0000 (08:35 -0700)]
acinclude: Add missing define

The final line of a conditional search for the nf_conntrack_helper_put
function does not actually define HAVE_NF_CONNTRACK_HELPER_PUT used
in datapath/linux/compat/include/net/netfilter/nf_conntrack_helper.h.

Fixes: ac8e3c6d14d2 ("datapath: introduce nf_conntrack_helper_put function")
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoAUTHORS.rst: Update Daniele Venturino
Daniele Venturino [Thu, 21 Sep 2017 14:34:29 +0000 (16:34 +0200)]
AUTHORS.rst: Update Daniele Venturino

Update email address.

Signed-off-by: Daniele Venturino <venturino.daniele+ovs@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovs-sandbox: Install .rst manpages into the sandbox as well.
Ben Pfaff [Tue, 19 Sep 2017 22:34:50 +0000 (15:34 -0700)]
ovs-sandbox: Install .rst manpages into the sandbox as well.

Without this, "man ovs-test" and "man ovs-vlan-test" won't work in the
sandbox.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
7 years agonetdev-tc-offloads: Fix vxlan tunnel offloading
Paul Blakey [Wed, 13 Sep 2017 14:04:58 +0000 (17:04 +0300)]
netdev-tc-offloads: Fix vxlan tunnel offloading

This commit fixes offloading when tunnel id is 0 by checking
for valid tunnel dst ipv4 or ipv6, like done in the normal flow.

Also need to reset the tunnel mask outside the condition
because in the special case, when adding a port with key=flow,
the match for tunnel_set gets a tunnel key id 0 with a mask.
If we don't reset the mask we'll fail later when we check
for unknown attributes that the mask was not reset.

Fixes: 8f283af89298 ("netdev-tc-offloads: Implement netdev flow put using tc interface")
Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agoovn-northd: add chassis nonull check
wang qianyu [Tue, 19 Sep 2017 18:02:41 +0000 (14:02 -0400)]
ovn-northd: add chassis nonull check

op->sb->gateway_chassis[0]->chassis may null in some special cases, need
to add a check to avoid segment fault.

Signed-off-by: wang qianyu <wang.qianyu@zte.com.cn>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agoovn: Discard flows for non-local ports.
Russell Bryant [Fri, 15 Sep 2017 03:57:00 +0000 (21:57 -0600)]
ovn: Discard flows for non-local ports.

Discard some OpenFlow flows that will never match.  This includes
flows that match on a non-local inport in the ingress pipeline or a
non-local outport in the egress pipeline of a logical switch.

This is most useful for networks with a large number of ports or ACLs
that use large address sets.

Signed-off-by: Russell Bryant <russell@ovn.org>
Tested-by: Miguel Angel Ajo Pelayo <majopela@redhat.com>
Acked-by: Han Zhou <zhouhan@gmail.com>
7 years agobridge: Fix controller status update to passive connections
Andy Zhou [Wed, 6 Sep 2017 22:08:10 +0000 (15:08 -0700)]
bridge: Fix controller status update to passive connections

The bug can cause ovs-vswitchd to crash (due to assert) when it is
set up with a passive controller connection. Since only active
connections are kept, the passive connection status update should be
ignored and not trigger asserts.

Fixes: 85c55772a453 ("bridge: Fix controller status update")
Reported-by: Josh Bailey <josh@faucet.nz>
Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Joe Stringer <joe@ovn.org>
7 years agoFix C++ build issue when static_assert() is not available
Yi-Hung Wei [Tue, 12 Sep 2017 22:43:03 +0000 (15:43 -0700)]
Fix C++ build issue when static_assert() is not available

This patch prevents compile errors if the C++ compiler does not support
C++11 or the support is not enabled.

VMWare-BZ: #1953215
Fixes: 994bfc298502 ("Automatically verify that OVS header files work OK in C++ also.")
Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agotests/odp: Add set vlan test to odp testsuite
Paul Blakey [Sun, 10 Sep 2017 05:00:07 +0000 (08:00 +0300)]
tests/odp: Add set vlan test to odp testsuite

We support parsing set(vlan(vid,pcp,cfi)) so let's test it.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agolib/odp: Fix handling of set masked action in parse_odp_action
Paul Blakey [Sun, 10 Sep 2017 05:00:06 +0000 (08:00 +0300)]
lib/odp: Fix handling of set masked action in parse_odp_action

If we find that we need to change from a SET to SET_MASKED action,
then we write the mask to the actions opfbuf. But if there was netlink
pad added to the buffer when writing the key, mask won't follow the
key data as per SET_MASKED spec.

Fix that by removing the padding before writing the mask, and
readding it if needed for alignment.

Fixes: 6d670e7f0d45 ("lib/odp: Masked set action execution and printing.")
Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agowindows,python: remove dead code in send_wait
Alin Balutoiu [Fri, 25 Aug 2017 15:02:54 +0000 (15:02 +0000)]
windows,python: remove dead code in send_wait

Found while looking over the code.

Signed-off-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
Suggested-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Anand Kumar <kumaranand@vmware.com>
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
7 years agowindows,python: remove unnecessary code
Alin Balutoiu [Fri, 25 Aug 2017 15:02:57 +0000 (15:02 +0000)]
windows,python: remove unnecessary code

At the moment we have WSAEventSelect in each if branch.

Since the call to the function is similar, we can move
it outside the if branch and create some local variables
which will be passed to WSAEventSelect.

This patch also remove the keyword argument passed when
the event for the connection overlapped structure is created.
The argument is not needed since it does not change the value
from the default one.

Signed-off-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
7 years agowindows, python: create a different event for sockets
Alin Balutoiu [Fri, 25 Aug 2017 15:02:48 +0000 (15:02 +0000)]
windows, python: create a different event for sockets

At the moment the sockets on Windows use the same events
that are being created for the pipes.

This is not correct because they should be different events.

This patch introduces a new event which should be used for sockets.
The new event needs to be set on automatic reset with its initial
state not signaled.

Signed-off-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
Co-authored-by: Alin Gabriel Serdean <aserdean@ovn.org>
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Tested-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
7 years agowindows,python: Add restrictions to named pipes
Alin Balutoiu [Wed, 23 Aug 2017 14:50:49 +0000 (14:50 +0000)]
windows,python: Add restrictions to named pipes

Bump the security around named pipes to be more restrictive: disable network
access and allow only administrators and above to access the named pipes.

Acked-by: Anand Kumar <kumaranand@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
Signed-off-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
7 years agotests: Fix sparse error on test-ovn.c
Alin Gabriel Serdean [Tue, 12 Sep 2017 01:27:28 +0000 (04:27 +0300)]
tests: Fix sparse error on test-ovn.c

Commit d5c70d4bcc344ae10a644b83f1790a0235871efc fixed the MSVC issue
however, introduced a sparse error:
"tests/test-ovn.c:205:43: warning: Using plain integer as NULL pointer"

Use 'NULL' instead of '0'.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Shashank Ram <rams@vmware.com>
7 years agoMerge branch 'dpdk_merge' of https://github.com/darball/ovs.
Ben Pfaff [Tue, 12 Sep 2017 14:12:53 +0000 (07:12 -0700)]
Merge branch 'dpdk_merge' of https://github.com/darball/ovs.

7 years agotest: Avoid using 'truncate' command
Mark Michelson [Mon, 11 Sep 2017 20:58:12 +0000 (15:58 -0500)]
test: Avoid using 'truncate' command

The 'truncate' command is not available on all platforms. Since the
command was being used to zero out a file, there are other easy options
available. In this case, I've replaced 'truncate' with a redirection.

Reported-by: Alin Gabriel Serdean <aserdean@ovn.org>
Signed-off-by: Mark Michelson <mmichels@redhat.com>
Tested-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
7 years agotests: Fix MSVC compiler error on test-ovn.c
Alin Gabriel Serdean [Mon, 11 Sep 2017 19:36:53 +0000 (22:36 +0300)]
tests: Fix MSVC compiler error on test-ovn.c

MSVC doesn't like an empty initializer for a flexible array.

Add a zero initializer to keep the compiler happy.

Fixes current build on Windows.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoovn-nbctl: fix validation logic for acl-del command
Han Zhou [Fri, 8 Sep 2017 18:56:20 +0000 (11:56 -0700)]
ovn-nbctl: fix validation logic for acl-del command

The command error message is misleading, e.g.:

$ ovn-nbctl acl-del ls1 100 'outport=="lsp1" && ip4'
ovn-nbctl: cannot specify priority without match

$ ovn-nbctl acl-del ls1 to-lport 'outport=="lsp1" && ip4'
ovn-nbctl: cannot specify priority without match

This patch fixes the problem.
$
$ ovn-nbctl acl-del ls1 100 'outport=="lsp1" && ip4'

Signed-off-by: Han Zhou <zhouhan@gmail.com>
Signed-off-by: Justin Pettit <jpettit@ovn.org
7 years agoovn: fix wrong comment in acl log test case
Han Zhou [Wed, 30 Aug 2017 22:42:10 +0000 (15:42 -0700)]
ovn: fix wrong comment in acl log test case

Signed-off-by: Han Zhou <zhouhan@gmail.com>
Signed-off-by: Justin Pettit <jpettit@ovn.org>
7 years agoovn-controller: Fix empty address set parsing problem.
Han Zhou [Sun, 10 Sep 2017 05:58:25 +0000 (22:58 -0700)]
ovn-controller: Fix empty address set parsing problem.

When an address set is empty, current implementation will generate
an ovs flow that matches random things (and in most cases matching
everything) due to a problem in expression parser of constant set.
This patch fixes it by replacing the expression by a boolean false
when the set is empty, and adds tests cases accordingly.

Reported-by: Guru Shetty <guru@ovn.org>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-September/338441.html
Signed-off-by: Han Zhou <zhouhan@gmail.com>
Co-authored-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoadd libressl compatibility
Stuart Cardall [Sun, 10 Sep 2017 19:11:04 +0000 (19:11 +0000)]
add libressl compatibility

fixes undefined reference to ASN1_STRING_get0_data

Submitted-at: https://github.com/openvswitch/ovs/pull/202
Signed-off-by: Stuart Cardall <developer@it-offshore.co.uk>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agodpif-netdev: Avoid side-effect in argument of atomic_store_relaxed().
Ben Pfaff [Wed, 6 Sep 2017 15:57:33 +0000 (08:57 -0700)]
dpif-netdev: Avoid side-effect in argument of atomic_store_relaxed().

Some of the implementations of atomic_store_relaxed() evaluate their
first argument more than once, so arguments with side effects cause
strange behavior.  This fixes a problem observed on 64-bit Windows.

Reported-by: Alin Serdean <aserdean@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Alin Serdean <aserdean@ovn.org>
Acked-by: Darrell Ball <dlu998@gmail.com>
7 years agoovsdb-server.1: Fix mention of wrong option.
Russell Bryant [Sat, 9 Sep 2017 21:10:01 +0000 (17:10 -0400)]
ovsdb-server.1: Fix mention of wrong option.

The man page referenced a "--no-sync" option.  The correct option is
"--active".

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agodatapath-windows: Increment ct packet counters based on ct_state.
Anand Kumar [Tue, 5 Sep 2017 23:53:04 +0000 (16:53 -0700)]
datapath-windows: Increment ct packet counters based on ct_state.

For a given packet, packet counters in conntrack should be accounted only
once, even if the packet is processed multiple times by conntrack.

When a packet is processed by conntrack, ct_state flag is set to
OVS_CS_F_TRACKED. Use this state to identify if a packet has been
processed previously by conntrack.

Also update the ct packet counters when ct entry is created.

With this patch, the conntrack's packet counters behavior is similar
to linux

Signed-off-by: Anand Kumar <kumaranand@vmware.com>
Acked-by: Ram Shashank Ram <rams@vmware.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Alin Serdean <aserdean@ovn.org>
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
7 years agoFAQ: Indicate OVS 2.8 supports up to Linux 4.12.
Justin Pettit [Tue, 5 Sep 2017 17:22:00 +0000 (10:22 -0700)]
FAQ: Indicate OVS 2.8 supports up to Linux 4.12.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agonetdev-dpdk: Execute QoS Checking before copying to mbuf.
Gao Zhenyu [Thu, 7 Sep 2017 05:21:59 +0000 (22:21 -0700)]
netdev-dpdk: Execute QoS Checking before copying to mbuf.

In dpdk_do_tx_copy function, all packets were copied to mbuf first,
but QoS checking may drop some of them.
Move the QoS checking in front of copying data to mbuf, it helps to
reduce useless copy.

Signed-off-by: Zhenyu Gao <sysugaozhenyu@gmail.com>
Acked-by: ian.stokes@intel.com<mailto:ian.stokes@intel.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agoAUTHORS.rst: Add Jakub Sitnicki.
Russell Bryant [Wed, 6 Sep 2017 21:21:13 +0000 (17:21 -0400)]
AUTHORS.rst: Add Jakub Sitnicki.

Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agodoc: Fix typo in ovn-sandbox tutorial
Jakub Sitnicki [Wed, 6 Sep 2017 13:50:55 +0000 (15:50 +0200)]
doc: Fix typo in ovn-sandbox tutorial

ovn-trace example refers to a non-existent output port. Correct it.

Fixes: 46a2dc58781a ("Document OVN support in ovs-sandbox.")
Signed-off-by: Jakub Sitnicki <jkbs@redhat.com>
Acked-By: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agoovn: Support chassis hostname in requested-chassis.
Russell Bryant [Fri, 1 Sep 2017 18:24:12 +0000 (14:24 -0400)]
ovn: Support chassis hostname in requested-chassis.

Previously, OVN expected the Chassis "name" in the "requested-chassis"
option for a Logical_Switch_Port.  It turns out that in the two OVN
integrations I've checked with that plan to use this option,
specifying the Chassis "hostname" is much more convenient.  This patch
extends the "requested-chassis" option to support both the Chassis
name or the hostname as a value.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Lance Richardson <lrichard@redhat.com>
7 years agoovs-atomic-msvc: Add atomics x64 builds
Alin Gabriel Serdean [Tue, 5 Sep 2017 22:39:45 +0000 (01:39 +0300)]
ovs-atomic-msvc: Add atomics x64 builds

This patch enables atomics on x64 builds.

Reuse the atomics defined for x86 and add atomics for 64 bit reads/writes.

Before this patch the cmap test gives us:
$ ./tests/ovstest.exe test-cmap benchmark 10000000 3 1
Benchmarking with n=10000000, 3 threads, 1.00% mutations, batch size 1:
cmap insert:  20100 ms
cmap iterate:  2967 ms
batch search: 10929 ms
cmap destroy: 13489 ms

cmap insert:  20079 ms
cmap iterate:  2953 ms
cmap search:  10559 ms
cmap destroy: 13486 ms

hmap insert:   2021 ms
hmap iterate:  1162 ms
hmap search:   5152 ms
hmap destroy:  1158 ms

After this change we have:
$ ./tests/ovstest.exe test-cmap benchmark 10000000 3 1
Benchmarking with n=10000000, 3 threads, 1.00% mutations, batch size 1:
cmap insert:   2953 ms
cmap iterate:   267 ms
batch search:  2193 ms
cmap destroy:  2037 ms

cmap insert:   2909 ms
cmap iterate:   267 ms
cmap search:   2167 ms
cmap destroy:  2087 ms

hmap insert:   1853 ms
hmap iterate:  1086 ms
hmap search:   4395 ms
hmap destroy:  1140 ms

We should probably revisit this file and investigate it further to see if
we can squeeze more performance.

As a side effect fix tests on x64 because usage of `ovs-atomic-pthreads.h`
is currently broken.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Suggested-by: Ben Pfaff <blp@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agogithub: Add Appveyor image and link to Readme
Alin Gabriel Serdean [Fri, 25 Aug 2017 19:47:12 +0000 (22:47 +0300)]
github: Add Appveyor image and link to Readme

Just a small nit to see current build status of appveyor.
Also add a link so one could easily reach the history of the builds.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoAUTHORS.rst: Add Jakub Sitnicki.
Russell Bryant [Wed, 6 Sep 2017 21:21:13 +0000 (17:21 -0400)]
AUTHORS.rst: Add Jakub Sitnicki.

Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agodoc: Fix typo in ovn-sandbox tutorial
Jakub Sitnicki [Wed, 6 Sep 2017 13:50:55 +0000 (15:50 +0200)]
doc: Fix typo in ovn-sandbox tutorial

ovn-trace example refers to a non-existent output port. Correct it.

Fixes: 46a2dc58781a ("Document OVN support in ovs-sandbox.")
Signed-off-by: Jakub Sitnicki <jkbs@redhat.com>
Acked-By: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agoovn: Support chassis hostname in requested-chassis.
Russell Bryant [Fri, 1 Sep 2017 18:24:12 +0000 (14:24 -0400)]
ovn: Support chassis hostname in requested-chassis.

Previously, OVN expected the Chassis "name" in the "requested-chassis"
option for a Logical_Switch_Port.  It turns out that in the two OVN
integrations I've checked with that plan to use this option,
specifying the Chassis "hostname" is much more convenient.  This patch
extends the "requested-chassis" option to support both the Chassis
name or the hostname as a value.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Lance Richardson <lrichard@redhat.com>
7 years agoovs-atomic-msvc: Add atomics x64 builds
Alin Gabriel Serdean [Tue, 5 Sep 2017 22:39:45 +0000 (01:39 +0300)]
ovs-atomic-msvc: Add atomics x64 builds

This patch enables atomics on x64 builds.

Reuse the atomics defined for x86 and add atomics for 64 bit reads/writes.

Before this patch the cmap test gives us:
$ ./tests/ovstest.exe test-cmap benchmark 10000000 3 1
Benchmarking with n=10000000, 3 threads, 1.00% mutations, batch size 1:
cmap insert:  20100 ms
cmap iterate:  2967 ms
batch search: 10929 ms
cmap destroy: 13489 ms

cmap insert:  20079 ms
cmap iterate:  2953 ms
cmap search:  10559 ms
cmap destroy: 13486 ms

hmap insert:   2021 ms
hmap iterate:  1162 ms
hmap search:   5152 ms
hmap destroy:  1158 ms

After this change we have:
$ ./tests/ovstest.exe test-cmap benchmark 10000000 3 1
Benchmarking with n=10000000, 3 threads, 1.00% mutations, batch size 1:
cmap insert:   2953 ms
cmap iterate:   267 ms
batch search:  2193 ms
cmap destroy:  2037 ms

cmap insert:   2909 ms
cmap iterate:   267 ms
cmap search:   2167 ms
cmap destroy:  2087 ms

hmap insert:   1853 ms
hmap iterate:  1086 ms
hmap search:   4395 ms
hmap destroy:  1140 ms

We should probably revisit this file and investigate it further to see if
we can squeeze more performance.

As a side effect fix tests on x64 because usage of `ovs-atomic-pthreads.h`
is currently broken.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Suggested-by: Ben Pfaff <blp@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agogithub: Add Appveyor image and link to Readme
Alin Gabriel Serdean [Fri, 25 Aug 2017 19:47:12 +0000 (22:47 +0300)]
github: Add Appveyor image and link to Readme

Just a small nit to see current build status of appveyor.
Also add a link so one could easily reach the history of the builds.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agodocs: fix a typo in vhost-user documentation.
Rami Rosen [Tue, 5 Sep 2017 19:07:18 +0000 (12:07 -0700)]
docs: fix a typo in vhost-user documentation.

This patch fixes a trivial typo in vhost-user documentation:
the path to the second socket should be /tmp/dpdkvhostclient1
and not /tmp/dpdkvhostclient0.

Signed-off-by: Rami Rosen <rami.rosen@intel.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agodpif-netdev: Fix a couple of coding style issues.
Kevin Traynor [Fri, 1 Sep 2017 21:03:18 +0000 (14:03 -0700)]
dpif-netdev: Fix a couple of coding style issues.

A couple of trivial fixes for a ternery operator placement
and pointer declaration.

Fixes: 655856ef39b9 ("dpif-netdev: Change rxq_scheduling to use rxq processing cycles.")
Fixes: a2ac666d5265 ("dpif-netdev: Change definitions of 'idle' & 'processing' cycles")
Cc: ciara.loftus@intel.com
Reported-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Ciara Loftus <ciara.loftus@intel.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agodpif-netdev: Rename "size" variable to "cnt".
Cian Ferriter [Fri, 1 Sep 2017 20:57:54 +0000 (13:57 -0700)]
dpif-netdev: Rename "size" variable to "cnt".

Commit 72c84bc (dp-packet: Enhance packet batch APIs.) changed how the amount
of packets to be processed is retrieved. In the process, the patch used "size"
as the variable holding the amount of packets rather than "cnt". Change this
back to match with the "emc_processing()" comment.

Signed-off-by: Cian Ferriter <cian.ferriter@intel.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agodpif-netdev: Fix comments in function headers.
Fischetti, Antonio [Fri, 1 Sep 2017 20:54:34 +0000 (13:54 -0700)]
dpif-netdev: Fix comments in function headers.

Fix comments for emc_processing and dp_netdev_input__
regarding md_is_valid.

Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>
Acked-by: Cian Ferriter <cian.ferriter@intel.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agodpif-netdev: Fix per packet cycles statistics.
Ilya Maximets [Fri, 1 Sep 2017 20:50:40 +0000 (13:50 -0700)]
dpif-netdev: Fix per packet cycles statistics.

DP_STAT_LOOKUP_HIT statistics used mistakenly for calculation
of total number of packets. This leads to completely wrong
per packet cycles statistics.

For example:

emc hits:0
megaflow hits:253702308
avg. subtable lookups per hit:1.50
miss:0
lost:0
avg cycles per packet: 248.32 (157498766585/634255770)

In this case 634255770 total_packets value used for avg
per packet calculation:

  total_packets = 'megaflow hits' + 'megaflow hits' * 1.5

The real value should be 524.38 (157498766585/253702308)

Fix that by summing only stats that reflect match/not match.
It's decided to make direct summing of required values instead of
disabling some stats in a loop to make calculations more clear and
avoid similar issues in the future.

CC: Jan Scheurich <jan.scheurich@ericsson.com>
Fixes: 3453b4d62a98 ("dpif-netdev: dpcls per in_port with sorted subtables")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Jan Scheurich <jan.scheurich@ericsson.com>
Acked-by: Cian Ferriter <cian.ferriter@intel.com>
Tested-by: Cian Ferriter <cian.ferriter@intel.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agonetdev-dpdk: Create separate memory pool for each port.
Robert Wojciechowicz [Fri, 1 Sep 2017 20:40:25 +0000 (13:40 -0700)]
netdev-dpdk: Create separate memory pool for each port.

Since it's possible to delete memory pool in DPDK
we can try to estimate better required memory size
when port is reconfigured, e.g. with different number
of rx queues.

CC: Kevin Traynor <ktraynor@redhat.com>
CC: Aaron Conole <aconole@redhat.com>
Signed-off-by: Robert Wojciechowicz <robertx.wojciechowicz@intel.com>
Co-authored-by: Antonio Fischetti <antonio.fischetti@intel.com>
Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>
Acked-by: Ian Stokes <ian.stokes@intel.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agonetdev-dpdk: update vhost user client port status.
wangzhike [Wed, 30 Aug 2017 06:12:03 +0000 (23:12 -0700)]
netdev-dpdk: update vhost user client port status.

After ovs-vswitchd reboots, vhost user client port status is displayed as
LINK DOWN though the traffic is OK.

The problem is that the port may be udpated while the vhost_reconfigured
is false. Then the vhost_reconfigured is updated to true. As a result,
the vhost port status is kept as LINK-DOWN.

Signed-off-by: wangzhike <wangzhike@jd.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years ago.gitignore: Ignore generated file cxxtest.cc.
Russell Bryant [Fri, 1 Sep 2017 18:23:38 +0000 (14:23 -0400)]
.gitignore: Ignore generated file cxxtest.cc.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agodatapath-windows: Remove unnecessary call to OvsInitForwardingCtx
Anand Kumar [Wed, 30 Aug 2017 23:03:57 +0000 (16:03 -0700)]
datapath-windows: Remove unnecessary call to OvsInitForwardingCtx

Only curNbl in the forwarding context needs to be updated with
fragmented NBL.

Signed-off-by: Anand Kumar <kumaranand@vmware.com>
Acked-by: Shashank Ram <rams@vmware.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
7 years agodaemon-windows: Set default error mode for services
Alin Gabriel Serdean [Fri, 25 Aug 2017 17:48:18 +0000 (20:48 +0300)]
daemon-windows: Set default error mode for services

Microsoft allows default process memory dumps via WER (Windows Error
Reporting).
WER can be set to collect dumps using in general using:
https://msdn.microsoft.com/en-us/library/windows/desktop/bb787181(v=vs.85).aspx
If a normal application crashes, the user will receive a pop-up dialog,
in which he will be asked of his consent on what will be the steps
after the dump was created (debug, close or send the dump to MSFT).
We disable the dump creation via WER in:
https://github.com/openvswitch/ovs/blob/master/lib/util.c#L492
because the idea is we don't want a pop-up if a OVS process (eg. ovs-vsctl)
has crashed.
(more information on the subject:
https://blogs.msdn.microsoft.com/oldnewthing/20040727-00/?p=38323)

Until we implement our own dump collection mechanism, we can set the default
error mode for services because there are no pop-ups allowed in that case.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Requested-by: Anand Kumar <kumaranand@vmware.com>
Acked-by: Anand Kumar <kumaranand@vmware.com>
7 years agodatapath-windows: Add an upper limit to conntrack entries
Sairam Venugopal [Wed, 30 Aug 2017 20:26:34 +0000 (13:26 -0700)]
datapath-windows: Add an upper limit to conntrack entries

The current implementation lacked an upper bound of number of entries in
the system. Set the size to ~2M (2^21) for the time being.

Signed-off-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Shashank Ram <rams@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
7 years agocentos: fix selinux intermediate file
Aaron Conole [Fri, 1 Sep 2017 17:17:40 +0000 (13:17 -0400)]
centos: fix selinux intermediate file

The commit 7bc1aae71e89 ("rhel: make the selinux policy intermediate")
broke the centos RPM builds.  This commit ensures that the centos rpmbuild
will first create the openvswitch-custom.te file, and then create the
final policy files.

Fixes: 7bc1aae71e89 ("rhel: make the selinux policy intermediate")
Reported-by: Ansis Atteka <aatteka@ovn.org>
Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Ansis Atteka <aatteka@ovn.org>
7 years agoselinux.rst: point to the correct file
Aaron Conole [Fri, 1 Sep 2017 17:17:39 +0000 (13:17 -0400)]
selinux.rst: point to the correct file

The selinux documentation mentions to check the selinux/openvswitch.te file
for any permissions that might need to be added.  However, the commit
7bc1aae71e89 ("rhel: make the selinux policy intermediate") moved this
file to be generated from intermediate file selinux/openvswitch.te.in
instead.

Correct the documentation, so that users won't be trying to edit a generated
file.

Also, add a gitignore for the autogenerated file.

Fixes: 7bc1aae71e89 ("rhel: make the selinux policy intermediate")
Reported-by: Ansis Atteka <aatteka@ovn.org>
Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Ansis Atteka <aatteka@ovn.org>
7 years agoselinux: move chr_file to non-dpdk as well
Aaron Conole [Fri, 1 Sep 2017 17:17:38 +0000 (13:17 -0400)]
selinux: move chr_file to non-dpdk as well

A last-minute change to the selinux policy caught by testing
incorrectly omitted moving a definition from non-dpdk to dpdk.

This moves the chr_file definition to a non-dpdk enabled permission,
which should allow non-dpdk enabled builds to work.

Fixes: 84d272330506 ("selinux: update policy to reflect non-root and dpdk support")
Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Ansis Atteka <aatteka@ovn.org>
7 years agoselinux: update policy to reflect non-root and dpdk support
Aaron Conole [Thu, 31 Aug 2017 23:22:45 +0000 (19:22 -0400)]
selinux: update policy to reflect non-root and dpdk support

The selinux policy that exists in the repository did not specify access to
all of the resources needed for Open vSwitch to properly function with
an enforcing selinux policy.  This update allows Open vSwitch to operate
with selinux set to Enforcing mode, even while running as a non-root user.

Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Ansis Atteka <aatteka@ovn.org>
Signed-off-by: Aaron Conole <aconole@redhat.com>
Tested-by: Jean Hsiao <jhsiao@redhat.com>
7 years agomakefile: hook up dpdkstrip preprocessor
Aaron Conole [Thu, 31 Aug 2017 23:22:44 +0000 (19:22 -0400)]
makefile: hook up dpdkstrip preprocessor

When building the openvswitch-custom.te file, it is important to have the
ability to filter out dpdk blocks depending on whether the system has been
configured with dpdk or not.  This allows using all the standard .in file
blocks, as well as the dpdkstrip blocks, when constructing the selinux
policy file.

Additionally, this means any .in files which might want to change based on
configuration to exclude blocks based on dpdk can do so.

Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Ansis Atteka <aatteka@ovn.org>
Signed-off-by: Aaron Conole <aconole@redhat.com>
Tested-by: Jean Hsiao <jhsiao@redhat.com>
7 years agorhel: make the selinux policy intermediate
Aaron Conole [Thu, 31 Aug 2017 23:22:43 +0000 (19:22 -0400)]
rhel: make the selinux policy intermediate

This will be used by an upcoming commit to have @begin_ and @end_ dpdk
blocks to keep dpdk specific policy decisions only active when dpdk is
used.

Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Ansis Atteka <aatteka@ovn.org>
Signed-off-by: Aaron Conole <aconole@redhat.com>
Tested-by: Jean Hsiao <jhsiao@redhat.com>
7 years agoNEWS: Mark NSH support as experimental in 2.8.
Ben Pfaff [Tue, 29 Aug 2017 17:50:11 +0000 (10:50 -0700)]
NEWS: Mark NSH support as experimental in 2.8.

This feature landed late in 2.8 and the NSH wire protocol itself is not
completely stable.

Acked-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agomonitor: Simplify calculation of cond->conditional.
Ben Pfaff [Wed, 30 Aug 2017 16:33:14 +0000 (09:33 -0700)]
monitor: Simplify calculation of cond->conditional.

This removes n_true_cnd from struct ovsdb_monitor_session_condition.
It was an "optimization" that is not part of any inner loop, but
make the code harder to reason about.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
Acked-by: Liran Schour <lirans@il.ibm.com>
7 years agomonitor: Fix bad caching of conditional monitor_cond requests.
Ben Pfaff [Wed, 30 Aug 2017 16:33:13 +0000 (09:33 -0700)]
monitor: Fix bad caching of conditional monitor_cond requests.

The current implementation of ovsdb-server caches only non-conditional
monitors, that is, monitors for every table row, not those that monitor
only rows that match some condition.  To figure out which monitors are
conditional, the code track the number of tables that have conditions that
are uniformly true (cond->n_true_cnd) and compares that against the number
of tables in the condition (shash_count(&cond->tables)).  If they are the
same, then every table has (effectively) no condition, and so
cond->conditional is set to false.

However, the implementation was buggy.  The function that adds a new
table condition, ovsdb_monitor_table_condition_create(), only updated
cond->conditional if the table condition being added was true.  This is
wrong; only adding a non-true condition can actually change
cond->conditional.  This commit fixes the problem by always recalculating
cond->conditional.

The most visible side effect of cond->conditional being true when it
should be false, as caused by this bug, was that conditional monitors were
being mixed with unconditional monitors for the purpose of caching.  This
meant that, if a client requested a conditional monitor that was the
same as an unconditional one, except for the condition, then the client
would receive the cached data previously sent for the unconditional one.
This commit fixes the problem.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
Acked-by: Liran Schour <lirans@il.ibm.com>
7 years agoredhat: fix upgrades where group doesn't exist
Aaron Conole [Mon, 14 Aug 2017 20:18:14 +0000 (16:18 -0400)]
redhat: fix upgrades where group doesn't exist

The upgrade from older Open vSwitch versions on RHEL will try, as much as
possible, to preserve the system.  This means no new users or groups are
created.  As an effect, it's possible for the chown to fail, because the
hugetlbfs group may not exist.  While it did on my systems, it was not
there on others.

This change allows the ExecStartPre commands to fail.  In the case that the
user doesn't use DPDK, it won't matter anyway.

Fixes: e3e738a3d058 ('redhat: allow dpdk to also run as non-root user')
Signed-off-by: Aaron Conole <aconole@redhat.com>
Reported-by: Jean-Tsung Hsiao <jhsiao@redhat.com>
Tested-by: Jean-Tsung Hsiao <jhsiao@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agoMerge branch 'dpdk_merge' of https://github.com/darball/ovs.
Ben Pfaff [Tue, 29 Aug 2017 20:13:35 +0000 (13:13 -0700)]
Merge branch 'dpdk_merge' of https://github.com/darball/ovs.

7 years agonsh: fix an implicit bug in nsh_hdr_len
Yi Yang [Fri, 25 Aug 2017 04:02:49 +0000 (12:02 +0800)]
nsh: fix an implicit bug in nsh_hdr_len

Operator '*' will be executed prior to operator '>>',
but we expect operator '>>' is executed prior to '*',
this patch fixed the issue.

Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agonetdev-dpdk: vhost get stats fix.
wangzhike [Fri, 25 Aug 2017 21:49:55 +0000 (14:49 -0700)]
netdev-dpdk: vhost get stats fix.

In netdev_dpdk_vhost_get_stats, '+=' was used in a few places
where '=' was expected.

Signed-off-by: wangzhike <wangzhike@jd.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agonetdev-dpdk: use 64-bit arithmetic when converting rates.
Lance Richardson [Fri, 25 Aug 2017 21:35:31 +0000 (14:35 -0700)]
netdev-dpdk: use 64-bit arithmetic when converting rates.

Force 64-bit arithmetic to be used when converting uint32_t rate
and burst parameters from kilobits per second to bytes per second,
avoiding incorrect behavior for rates exceeding UINT_MAX bits
per second.

Reported-by: "王志克" <wangzhike@jd.com>
Fixes: 9509913aa722 ("netdev-dpdk.c: Add ingress-policing functionality.")
Signed-off-by: Lance Richardson <lrichard@redhat.com>
Acked-By: Mark Michelson <mmichels@redhat.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agoconntrack: Fix ct-clean thread crash bug.
Lily Huang [Fri, 25 Aug 2017 20:39:00 +0000 (13:39 -0700)]
conntrack: Fix ct-clean thread crash bug.

Conn should be removed from the connection expiry list when
the connection tracker experiences NAT resource exhaustion
and the connection needing NAT mapping cannot get it.
If this is not done, the connection tracker can crash during
cleanup of expired connections by the clean thread.

This crash will be triggered when a established flow do ct(nat)
again, like
"ip,actions=ct(table=1)
 table=1,in_port=1,ip,actions=ct(commit,nat(dst=5.5.5.5)),2
 table=1,in_port=2,ip,ct_state=+est,actions=1
 table=1,in_port=1,ip,ct_state=+est,actions=2"

Fixes: bd5e81a0e596 ("Userspace Datapath: Add ALG infra and FTP.")
Signed-off-by: Lili Huang <huanglili.huang@huawei.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agodpif-netdev: Add ovs-appctl dpif-netdev/pmd-rxq-rebalance.
Kevin Traynor [Fri, 25 Aug 2017 07:54:26 +0000 (00:54 -0700)]
dpif-netdev: Add ovs-appctl dpif-netdev/pmd-rxq-rebalance.

Rxqs consumed processing cycles are used to improve the balance
of how rxqs are assigned to pmds. Currently some reconfiguration
is needed to perform a reassignment.

Add an ovs-appctl command to perform a new assignment in order
to balance based on the latest rxq processing cycle information.

Note: Jan requested this for testing purposes.

Suggested-by: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agodpif-netdev: Change pmd selection order.
Kevin Traynor [Fri, 25 Aug 2017 07:51:18 +0000 (00:51 -0700)]
dpif-netdev: Change pmd selection order.

Up to his point rxqs are sorted by processing cycles they
consumed and assigned to pmds in a round robin manner.

Ian pointed out that on wrap around the most loaded pmd will be
the next one to be assigned an additional rxq and that it would be
better to reverse the pmd order when wraparound occurs.

In other words, change from assigning by rr to assigning in a forward
and reverse cycle through pmds.

Also, now that the algorithm has finalized, document an example.

Suggested-by: Ian Stokes <ian.stokes@intel.com>
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agodpif-netdev: Change rxq_scheduling to use rxq processing cycles.
Kevin Traynor [Fri, 25 Aug 2017 07:48:01 +0000 (00:48 -0700)]
dpif-netdev: Change rxq_scheduling to use rxq processing cycles.

Previously rxqs were assigned to pmds by round robin in
port/queue order.

Now that we have the processing cycles used for existing rxqs,
use that information to try and produced a better balanced
distribution of rxqs across pmds. i.e. given multiple pmds, the
rxqs which have consumed the largest amount of processing cycles
will be placed on different pmds.

The rxqs are sorted by their processing cycles and assigned (in
sorted order) round robin across pmds.

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agodpif-netdev: Count the rxq processing cycles for an rxq.
Kevin Traynor [Fri, 25 Aug 2017 07:44:25 +0000 (00:44 -0700)]
dpif-netdev: Count the rxq processing cycles for an rxq.

Count the cycles used for processing an rxq during the
pmd rxq interval. As this is an in flight counter and
pmds run independently, also store the total cycles used
during the last full interval.

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agodpif-netdev: Add rxq processing cycle counters.
Kevin Traynor [Fri, 25 Aug 2017 07:42:06 +0000 (00:42 -0700)]
dpif-netdev: Add rxq processing cycle counters.

Add counters to dp_netdev_rxq which will later be used for storing the
processing cycles of an rxq. Processing cycles will be stored in reference
to a defined time interval. We will store the cycles of the current in progress
interval, a number of completed intervals and the sum of the completed
intervals.

cycles_count_intermediate was used to count cycles for a pmd. With some small
additions we can also use it to count the cycles used for processing an rxq.

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agodpif-netdev: Change polled_queue to use dp_netdev_rxq.
Kevin Traynor [Fri, 25 Aug 2017 07:39:40 +0000 (00:39 -0700)]
dpif-netdev: Change polled_queue to use dp_netdev_rxq.

Soon we will want to store processing cycle counts in the dp_netdev_rxq,
so use that as a basis for the polled_queue that pmd_thread_main uses.

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agodp-packet: Use memcpy on dp_packet elements.
Fischetti, Antonio [Fri, 25 Aug 2017 07:37:33 +0000 (00:37 -0700)]
dp-packet: Use memcpy on dp_packet elements.

memcpy replaces the several single copies inside
dp_packet_clone_with_headroom().

Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agoconntrack: pass current time to conntrack_execute.
Fischetti, Antonio [Fri, 25 Aug 2017 05:16:53 +0000 (22:16 -0700)]
conntrack: pass current time to conntrack_execute.

Current time is passed to conntrack_execute so it doesn't have
to recompute it again.

Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>
Acked by: Sugesh Chandran <sugesh.chandran@intel.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agodp-packet: Refactor DPDK packet initialization.
Darrell Ball [Fri, 25 Aug 2017 05:09:58 +0000 (22:09 -0700)]
dp-packet: Refactor DPDK packet initialization.

DPDK uses dp-packet pools and manages the mbuf portion of
each packet. When a pool is created, partial initialization is
also done on the OVS portion (i.e. non-mbuf).  Since packet
memory is reused, this is not very useful for transient
fields and is also misleading.  Furthermore, some of these
transient fields are properly initialized for DPDK packets
entering OVS anyways, which is the only reasonable way to do this.
Another field, cutlen, is initialized in this manner in the pool
and intended to be reset when cutlen is applied on sending the
packet out. However, if cutlen context is set but the packet is
not sent out for some reason, then the packet header would be
corrupted in the memory pool.  It is better to just reset the
cutlen in the packets when received.  I did not detect a
degradation in performance, however, I would be willing to
have some degradation, since this is a proper way to handle
this.  In addition to initializing cutlen in received packets,
the other OVS transient fields are removed from the DPDK pool
initialization.

Acked-by: Sugesh Chandran <sugesh.chandran@intel.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agodocs/dpdk: Consolidate pmd-cpu-mask references.
Darrell Ball [Fri, 25 Aug 2017 04:46:51 +0000 (21:46 -0700)]
docs/dpdk: Consolidate pmd-cpu-mask references.

The DPDK introductory documentation has various references to
pmd-cpu-mask, including a section devoted to it.  These parts of
the documentation seemed to have been written at different times
and look like they were individually ported from other sources.
They all include an example command which gets repeated several times.
Here, we consolidate those referenes to make the documentation
easier to maintain. At the same time, create linkages to the
pmd-cpu-mask section from other sections to provide some level of
coherence.

Reviewed-by: Greg rose <gvrose8192@gmail.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
7 years agoovn: Fix BFD error config on gateway
Gao Zhenyu [Sun, 20 Aug 2017 14:37:31 +0000 (14:37 +0000)]
ovn: Fix BFD error config on gateway

The bfd_calculate_chassis function calculates gateway's peer datapaths
to figure out which tunnel's BFD should be enabled to from the current chassis.
Existing algorithm only calculats peer datapaths at one hop, but multiple
logical switches and E/W routers could be in the path, making several hops
which were not considered on the calculation.
It may disable BFD on some gw's tunnel ports. Then a port on a remote ovs
cannot send packet out because it believes all remote gateways are down.

This patch will go through whole graph and visit all datapath's port
which has connection with gateways.

Signed-off-by: Zhenyu Gao <sysugaozhenyu@gmail.com>
Acked-by: Venkata Anil Kommaddi <vkommadi@redhat.com>
Tested-by: Venkata Anil Kommaddi <vkommadi@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agoatlocal: Document find_l7_lib()
Yi-Hung Wei [Wed, 23 Aug 2017 00:52:30 +0000 (17:52 -0700)]
atlocal: Document find_l7_lib()

When a system traffic is skipped due to 'HAVE_FTP = no' or
'HAVE_TFTP = no', it takes some effort to figure out it is due to
missing the required python library. Add some comments around the
find_l7_lib(), so that user can figure that out by
$ git grep HAVE_FTP.

Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: compat: Fix build on RHEL 7.4
Yi-Hung Wei [Wed, 23 Aug 2017 00:52:29 +0000 (17:52 -0700)]
datapath: compat: Fix build on RHEL 7.4

RHEL 7.4 introduces netdev_master_upper_dev_link_rh() that breaks the
backport of OVS kernel module on RHEL 7.4. This patch fixes that issue.

Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath-windows: Move OvsCreateNewNBLsFromMultipleNBs to BuggerMgmt
Shashank Ram [Mon, 21 Aug 2017 21:45:23 +0000 (14:45 -0700)]
datapath-windows: Move OvsCreateNewNBLsFromMultipleNBs to BuggerMgmt

Moves function OvsCreateNewNBLsFromMultipleNBs() to BufferMgmt.c
to facilitate consumption from outside PacketIO.c.

Signed-off-by: Shashank Ram <rams@vmware.com>
Acked-by: Anand Kumar <kumaranand@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
7 years agowindows, python: Remove code duplication in send/recv functions
Alin Balutoiu [Tue, 22 Aug 2017 10:47:24 +0000 (10:47 +0000)]
windows, python: Remove code duplication in send/recv functions

Move the return value at the end of the function
regardless of the pending/non-pending operation.

Signed-off-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
Acked-by: Russell Bryant <russell@ovn.org>
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
7 years agowindows, python: Fix event type returned from poller
Alin Balutoiu [Tue, 22 Aug 2017 10:47:21 +0000 (10:47 +0000)]
windows, python: Fix event type returned from poller

The function poll from poller should return a list of tuples
containing the events and their types.

On Windows the event type is not returned at the moment.
Instead of returning zero all the time, we check to see
the type of event and we set it accordingly before returning
the list.

This is used only for debugging purposes inside the function
"__log_wakeup" later on.

Signed-off-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
Acked-by: Russell Bryant <russell@ovn.org>
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
7 years agoofproto-dpif: Mark packets as "untracked" after call to ct().
Justin Pettit [Mon, 7 Aug 2017 21:44:02 +0000 (14:44 -0700)]
ofproto-dpif: Mark packets as "untracked" after call to ct().

Packet and Connection state is only available to the processing path
that follows the "recirc_table" argument of the ct() action.  The
previous behavior made these states available until the end of the
pipeline.  This commit changes the behavior so that the Packet and
Connection state are cleared for the current processing path whenever
ct() is called (in addition to reaching the end of the pipeline.)

A future commit will remove the behavior that a "send to controller"
action causes all packets for that flow to be handled via the slow-path.
The current behavior of connection tracking state makes that difficult
due to datapath actions containing multiple OpenFlow rules that may
contain different connection tracking states.  This change will make
that future commit possible.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Joe Stringer <joe@ovn.org>
7 years agocheckpatch: Enforce bracing around conditionals.
Joe Stringer [Thu, 17 Aug 2017 21:26:27 +0000 (14:26 -0700)]
checkpatch: Enforce bracing around conditionals.

The coding style states that BSD-style brace placement should be used,
and even single statements should be enclosed. Add checks to checkpatch
for this, particularly for 'else' statements.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
7 years agoovn: support requested-chassis option for logical switch ports
Lance Richardson [Sat, 19 Aug 2017 20:23:34 +0000 (16:23 -0400)]
ovn: support requested-chassis option for logical switch ports

This patch adds support for a "requested-chassis" option for logical
switch ports. If set, the only chassis that will claim this port is the
chassis identfied by this option; if already bound by another chassis,
it will be released.

The primary benefit of this enhancement is allowing a CMS to prevent
"thrashing" in the southbound database during live migration by keeping
the original chassis from attempting to re-bind a port that is in the
process of migrating.

This would also allow (with some additional work) RBAC to be applied
to the Port_Binding table for additional security.

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agosystem-offloads-traffic: Add sanity check
Roi Dayan [Thu, 17 Aug 2017 05:59:11 +0000 (08:59 +0300)]
system-offloads-traffic: Add sanity check

Doing dump-flows also altering the netdev ports list.
So doing it pre the actual test is adding a check to
make sure we don't break the that list.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodpif: Fix cleanup of netdev_ports map
Roi Dayan [Thu, 17 Aug 2017 05:59:10 +0000 (08:59 +0300)]
dpif: Fix cleanup of netdev_ports map

Executing dpctl commands from userspace also calls to
dpif_open()/dpif_close() but not really creating another dpif
but using a clone.
As for netdev_ports map is global we avoid adding duplicate entries
but also need to make sure we are not removing needed entries.
With this commit we make sure only the last dpif close should clean
the netdev_ports map.

Fixes: 6595cb95a4a9 ("dpif: Clean up netdev_ports map on dpif_close().")
Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agopython: Force file system encoding on cmdline args
Alin Balutoiu [Wed, 16 Aug 2017 15:01:45 +0000 (15:01 +0000)]
python: Force file system encoding on cmdline args

On Windows, the default file system encoding is 'mbcs'
resulting in a bad conversion.

To make it cross-platform tolerant use
'sys.getfilesystemencoding()' instead of 'utf-8'.

Co-authored-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
Signed-off-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agopython: fix python3 encode/decode on Windows
Alin Balutoiu [Wed, 16 Aug 2017 15:01:39 +0000 (15:01 +0000)]
python: fix python3 encode/decode on Windows

Fix double encoding/decoding on data, caused by
'get_decoded_buffer' and 'get_encoded_buffer'.

The functions 'get_decoded_buffer' and 'get_encoded_buffer'
from winutils have been removed. They are no longer
necessary since the buffers received/returned are already
in the right form.

The necessary encoding has been moved before any sending
function (this also includes named pipes send on Windows).

Co-authored-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
Signed-off-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agogitignore: Ignore cxx-check
Xiao Liang [Fri, 18 Aug 2017 04:43:28 +0000 (12:43 +0800)]
gitignore: Ignore cxx-check

Add cxx-check to .gitignore

Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodatapath-windows: Do not modify port field for ICMP during SNAT/DNAT
Anand Kumar [Tue, 15 Aug 2017 22:29:04 +0000 (15:29 -0700)]
datapath-windows: Do not modify port field for ICMP during SNAT/DNAT

During SNAT/DNAT, we should not be updating the port field of ct_endpoint
struct, as ICMP packets do not have port information. Since port and
icmp_id are overlapped in ct_endpoint struct, icmp_id gets changed.
As a result, NAT look up fails to find a matching entry.

This patch addresses this issue by not modifying icmp_id field during
SNAT/DNAT only for ICMP traffic

The current NAT module doesn't take the ICMP type/code into account
during the lookups. Fix this to make it similar with the other conntrack
module.

Acked-by: Shashank Ram <rams@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
Signed-off-by: Anand Kumar <kumaranand@vmware.com>
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
7 years agodatapath-windows: Update Orig Tuple to use ICMP Type and Code
Anand Kumar [Wed, 16 Aug 2017 18:23:02 +0000 (11:23 -0700)]
datapath-windows: Update Orig Tuple to use ICMP Type and Code

- Also add some padding for the ct_endpoint's union, so that each member
of ct_endpoint's union are of same size.

Co-authored-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Shashank Ram <rams@vmware.com>
Signed-off-by: Anand Kumar <kumaranand@vmware.com>
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
7 years agonetdev-tc-offloads: Add prefix to identify source of log msg
Roi Dayan [Wed, 16 Aug 2017 12:27:52 +0000 (15:27 +0300)]
netdev-tc-offloads: Add prefix to identify source of log msg

There is an identical log msg from multiple api calls.
Add a prefix to identify the source function of the log msg.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agotests: Comment which netcat version the opts are for.
Joe Stringer [Tue, 15 Aug 2017 23:15:55 +0000 (16:15 -0700)]
tests: Comment which netcat version the opts are for.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Flavio Leitner <fbl@sysclose.org>
7 years agotests: Put maximum timeout on netcat calls.
Joe Stringer [Tue, 15 Aug 2017 23:15:54 +0000 (16:15 -0700)]
tests: Put maximum timeout on netcat calls.

This was causing test script execution to hang forever on Ubuntu Zesty.
Make sure it times out within 5 seconds, so at least it will fail out
properly.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Flavio Leitner <fbl@sysclose.org>
7 years agoovsdb-idl: Rename 'old' to 'old_datum'.
Joe Stringer [Fri, 11 Aug 2017 18:06:47 +0000 (11:06 -0700)]
ovsdb-idl: Rename 'old' to 'old_datum'.

Now that the 'new' datum is named 'new_datum', be more consistent by
renaming 'old' to 'old_datum' to match.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoovsdb-idl: Avoid new expression.
Joe Stringer [Fri, 11 Aug 2017 18:06:46 +0000 (11:06 -0700)]
ovsdb-idl: Avoid new expression.

In C++, 'new' is a keyword. If this is used as the name for a field,
then C++ compilers can get confused about the context and fail to
compile references to such fields. Rename the field to 'new_datum' to
avoid this issue.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoovsdb-idl: Avoid mutable type specifier.
Joe Stringer [Fri, 11 Aug 2017 18:06:45 +0000 (11:06 -0700)]
ovsdb-idl: Avoid mutable type specifier.

In C++, 'mutable' is a keyword. If this is used as the name for a field,
then C++ compilers can get confused about the context and fail to
compile references to such fields. Rename the field to 'is_mutable' to
avoid this issue.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>