cascardo/ovs.git
8 years agorhel: Fix ifup-ovs to delete ports first.
Flavio Leitner [Fri, 17 Jul 2015 16:56:21 +0000 (13:56 -0300)]
rhel: Fix ifup-ovs to delete ports first.

When ifdown isn't executed (system didn't shut down properly),
the interfaces remain in the openvswitch's database.  For the
internal ports or devices that are available when openvswitch
service starts that's not an issue.

However, ovs-vsctl won't do anything for devices created later
(Linux vlan devices for instance) since they are already in the
database. That leaves a inconsistency behind because they will
be left out of the kernel's datapath.

The ifup/ifdown will operate only on configured interfaces, so
this patch fixes the issue by deleting the interface from the
database before attempt to configure it.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agolib: Fix dependencies on ofp-errors.inc and ofp-msgs.inc.
Ben Pfaff [Mon, 20 Jul 2015 20:24:29 +0000 (13:24 -0700)]
lib: Fix dependencies on ofp-errors.inc and ofp-msgs.inc.

Commit e21a4c0271e6f (lib/automake.mk: Fix dependency typos.) was
crossported from master to fix some observed Debian build failures, but it
was not crossported correctly.  The version on master (commit 5b3c194faa61)
did not include the $(srcdir) prefixes because master had a previous commit
ab70cd304210e (Makefiles: Stop distributing files because building them
requires Python.) that is not on branch-2.4, and when I did the crossport I
failed to pay enough attention to realize that retaining $(srcdir) for the
target was incorrect: an .lo file would always be in the builddir.  Thus,
this commit fixes the problem.

Reported-by: Alex Wang <alexw@nicira.com>
Reported-at: http://openvswitch.org/pipermail/dev/2015-July/057779.html
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
Tested-by: Alex Wang <alexw@nicira.com>
8 years agoacinclude: Silence OVS_FIND_FIELD_IFELSE.
Joe Stringer [Thu, 16 Jul 2015 23:34:03 +0000 (16:34 -0700)]
acinclude: Silence OVS_FIND_FIELD_IFELSE.

Fields found using OVS_FIND_FIELD_IFELSE would previously be printed in
the console during configure. Clean up the output.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofpbuf: Update msg when resizing ofpbuf.
Alex Wang [Mon, 20 Jul 2015 06:13:14 +0000 (23:13 -0700)]
ofpbuf: Update msg when resizing ofpbuf.

Commit 6fd6ed7 (ofpbuf: Simplify ofpbuf API.) introduced the
'header' and 'msg' pointers to 'struct ofpbuf'.  However, we
forget to update the 'msg' pointer when resizing ofpbuf.

This bug could cause serious issue.  For example, in the function
ofputil_encode_nx_packet_in(), the 'msg' pointer is populated in
ofpraw_alloc_xid() when creating the ofpbuf .  Later, the ofpbuf
memory can be reallocated due to the writing to the ofpbuf.
However, since the 'msg' pointer is not updated, the later use of
the 'ofpbuf->msg' will end up writing to either free'ed memory or
memory allocated for other struct.

This commit fixes the bug by always updating the 'header' and
'msg' pointers when the ofpbuf is resized.  Also, a simple test
is added.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoacinclude: Require libfuse only for DPDK with vhost-cuse.
Daniele Di Proietto [Thu, 25 Jun 2015 14:46:55 +0000 (07:46 -0700)]
acinclude: Require libfuse only for DPDK with vhost-cuse.

DPDK with vhost-user doesn't require libfuse, so we shouldn't link OVS
with libfuse unless DPDK is built with vhost-cuse support.

CC: Rapelly, Varun <vrapelly@sonusnet.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
8 years agoovs-appctl: register unixctl commands in the beginning
Huanle Han [Wed, 15 Jul 2015 15:41:05 +0000 (23:41 +0800)]
ovs-appctl: register unixctl commands in the beginning

Some commands of ovs-appctl were lazily registered when first
bridg or bfd was added. Before that, calling these commands raised a
error("xxx is not a valid command"). The problem commangs included
"bfd/...", "upcall/...","dpif/...","fdb/..." and so on.

Fix this by moving the register into the "bridge_init" and
"bridge_init_ofproto". All commands are registered at the moment
ovs-vswitchd starts.

Signed-off-by: Huanle Han <hanxueluo@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agonetdev-linux: do not warn when getting stats for netdev with no vport
Thadeu Lima de Souza Cascardo [Tue, 7 Jul 2015 18:38:51 +0000 (15:38 -0300)]
netdev-linux: do not warn when getting stats for netdev with no vport

When there is no vport for a given netdev, dpif_netlink_vport_get might return
ENODEV. Do not warn a failure to get port stats when that's the case.

This happens when the userspace switch is used.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: update extension information
Alin Gabriel Serdean [Wed, 15 Jul 2015 17:44:14 +0000 (10:44 -0700)]
datapath-windows: update extension information

This patch sets additional information about the driver used by various
applications.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Update VXLAN header information
Alin Serdean [Mon, 13 Jul 2015 16:59:26 +0000 (16:59 +0000)]
datapath-windows: Update VXLAN header information

Use tunnel key information on the IP header preceding the VXLAN header.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Solved BSOD when cleaning up the VXLAN tunnel
Sorin Vinturis [Fri, 10 Jul 2015 08:26:51 +0000 (08:26 +0000)]
datapath-windows: Solved BSOD when cleaning up the VXLAN tunnel

When removing vport also remove the vxlan tunnel port.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/94
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agolib/automake.mk: Fix dependency typos.
Kyle Upton [Thu, 9 Jul 2015 19:22:46 +0000 (15:22 -0400)]
lib/automake.mk: Fix dependency typos.

Fix dependency issues with lib/ofp-errors.lo and lib/ofp-msgs.lo that
caused problems when building debian packages.

Signed-off-by: Kyle Upton <kupton@baymicrosystems.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodpif-netlink: Fix compiler warning.
Alin Serdean [Mon, 13 Jul 2015 14:15:33 +0000 (14:15 +0000)]
dpif-netlink: Fix compiler warning.

warning C4098: 'dpif_netlink_init_flow_del' : 'void' function returning a value

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodpif-netlink: Suppress DPIF_FP_PROBE here instead of in ofproto-dpif.
Ben Pfaff [Sat, 11 Jul 2015 15:27:43 +0000 (08:27 -0700)]
dpif-netlink: Suppress DPIF_FP_PROBE here instead of in ofproto-dpif.

Commit 22b4ccf4f (ofproto-dpif: Don't try to use dpif_probe_feature() with
Windows datapath.) stopped ofproto-dpif from trying to use the DPIF_FP_PROBE
feature of the datapath interface, because it doesn't work with Windows
yet.  However, it was *too* broad--it also stopped ofproto-dpif from
using DPIF_FP_PROBE with the netdev datapath, which still does support
DPIF_FP_PROBE on Windows.  This commit moves disabling DPIF_FP_PROBE a
couple of layers down, to a place where the two datapaths can be easily
distinguished.

Reported-by: Gurucharan Shetty <shettyg@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
8 years agoUndefined symbol make_unix_socket
Alin Serdean [Wed, 1 Jul 2015 19:01:44 +0000 (19:01 +0000)]
Undefined symbol make_unix_socket

syslog_direct_create defined in (lib/syslog-direct.c) uses make_unix_socket
which is currently undefined on the windows build.

We either can remove the new file from the chain but this patch proposes
to define a wrapper to make_unix_socket in which we return EINVAL.

This will avoid this kind of problems in the future.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
8 years agowindows: Avoid OVS_UNUSED in Windows stubs for syslog.h.
Alin Serdean [Tue, 30 Jun 2015 16:27:27 +0000 (16:27 +0000)]
windows: Avoid OVS_UNUSED in Windows stubs for syslog.h.

Currently OVS_UNUSED is defined in compiler.h since syslog.h is a
standalone wrapper remove it from the parameters.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
8 years agoofp-util: Require inner and outer message in bundle add to be same version.
Ben Pfaff [Mon, 6 Jul 2015 17:19:02 +0000 (10:19 -0700)]
ofp-util: Require inner and outer message in bundle add to be same version.

It doesn't make sense for the messages added to a bundle to have a
different OpenFlow version from the outer OpenFlow version.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agodatapath-windows: Solved BSOD when adding OVS ports
Sorin Vinturis [Thu, 2 Jul 2015 11:39:14 +0000 (11:39 +0000)]
datapath-windows: Solved BSOD when adding OVS ports

This BSOD occurred in the context of a packet (NBL) with multiple
NET_BUFFER(s) (NBs). The reason for the BSOD is due to the marking
of NBLs created by OVS as being external and wrongly completing them.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/82
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoovs-bugtool: Remove argument of "ovs-appctl dpif/show".
Huanle Han [Mon, 6 Jul 2015 13:51:13 +0000 (21:51 +0800)]
ovs-bugtool: Remove argument of "ovs-appctl dpif/show".

"ovs-appctl dpif/show" no longer takes any argument after commit dc54ef36
(ofproto: Track subfacet stats in the backer).

Signed-off-by: Huanle Han <hanxueluo@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agostream-ssl: Set SSL session cache mode to disables.
Guru Chaitanya Perakam [Fri, 3 Jul 2015 05:17:31 +0000 (10:47 +0530)]
stream-ssl: Set SSL session cache mode to disables.

To enable SSL clients to reconnect with the ovs-testcontoller without being
rejected, one must either set the SSL Session ID flag or disable the
SSL caching. This patch disables the SSL caching/reuse.

In the absence of this fix, the error message from ovs-testcontroller is as
below:

  SSL protocol error: SSL_accept (error:140D9115:SSL
  routines:SSL_GET_PREV_SESSION:session id context uninitialized)

See <https://www.openssl.org/docs/ssl/SSL_CTX_set_session_id_context.html>.

Validation: Tested with ovs-testcontroller, by performing SSL reconnection
with OpenSSL based SSL client.

Signed-off-by: Guru Chaitanya Perakam <gperakam@brocade.com>
Reported-by: Guru Chaitanya Perakam <gperakam@brocade.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto: Hold ofproto_mutex when enabling or disabling eviction.
Ben Pfaff [Thu, 2 Jul 2015 19:50:59 +0000 (12:50 -0700)]
ofproto: Hold ofproto_mutex when enabling or disabling eviction.

ofproto_enable_eviction() and ofproto_disable_eviction() require
ofproto_mutex (and they were even annotated that way, though not on their
prototypes but only at definition), but it wasn't being held.  This fixes
the problem.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agodatapath-windows: Solved memory leak in OVS datapath
Sorin Vinturis [Thu, 2 Jul 2015 06:53:08 +0000 (06:53 +0000)]
datapath-windows: Solved memory leak in OVS datapath

When closing opened instances, make sure the user dump state is cleared.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/90
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoSolved datapath-windows: BSOD when initializing switch context
Alin Serdean [Thu, 2 Jul 2015 06:35:58 +0000 (06:35 +0000)]
Solved datapath-windows: BSOD when initializing switch context

Add check in case of NdisAllocateRWLock fails to allocate the resources.

Check datapath->lock before trying to free it.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/92
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Solved BSOD when handling flows
Sorin Vinturis [Wed, 1 Jul 2015 20:03:01 +0000 (20:03 +0000)]
datapath-windows: Solved BSOD when handling flows

OvsPrepareFlow() returns an error only when the new flow allocation
fails. In this case HandleFlowPut() should return error without trying
to free the flow, thus avoiding the BSOD.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/91
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Rename 'vport->isPresentOnHv' to 'isAbsentOnHv'
Nithin Raju [Fri, 26 Jun 2015 18:51:29 +0000 (11:51 -0700)]
datapath-windows: Rename 'vport->isPresentOnHv' to 'isAbsentOnHv'

Looking at the code, the flag 'vport->isPresentOnHv' is actually
indicating if the vport is present on the Hyper-V switch or not, but the
logic seems to be inverse. 'isPresentOnHv == TRUE' indicates that the
vport is not present on the Hyper-V switch. Eg. VXLAN port, would have
isPresentOnHv == TRUE.

In this patch, we rename the variable to reflect its meaning.

vport->isAbsentOnHv is TRUE iff:
- vport is bridge internal port
- vport is tunnel port
- vport was added from Hyper-V and also from OVS, but got deleted from
Hyper-V

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Code refactoring and fixes in Vport.c
Nithin Raju [Fri, 26 Jun 2015 18:51:28 +0000 (11:51 -0700)]
datapath-windows: Code refactoring and fixes in Vport.c

In this patch, there a couple of fixes and some code refactoring:
1. During deletion of "internal" and "external" in
   OvsRemoveAndDeleteVport(), we need to check if 'hvDelete' is TRUE before
   updating the data structures. Added code comments explaining the
   same.

2. Added a OvsRemoveTunnelPort() that gets called from
   OvsRemoveAndDeletePort() for the special processing for tunnel ports.

3. Folded in OvsCleanupVportCommon() back into OvsRemoveAndDeletePort(),
   since we only need a part of the functionality of
   OvsCleanupVportCommon() to be called from
   OvsTunnelVportPendingUninit(), and not the entire function.

4. Renamed OvsTunnelVportPendingUninit() to
   OvsTunnelVportPendingRemove() since it is basically a "pending" version
   of OvsVportTunnelRemove().

Validation:
- Add external port from Hyper-V, add external port from OVS, remove
external port from OVS, remove external port from Hyper-V. No ASSERT
hit.
- Add external port from Hyper-V, add external port from OVS, remove
external port from Hyper-V, remove external port from OVS. No ASSERT
hit.
- Vxlan tunnel port creation/deletion
- Stt tunnel port creation/deletion
- Ping on Vxlan/Stt tunnels
- Ovs Extension load/unload. There's an unrelated issue I found that is
reported in: https://github.com/openvswitch/ovs-issues/issues/86

Signed-off-by: Nithin Raju <nithin@vmware.com>V
Reported-at: https://github.com/openvswitch/ovs-issues/issues/79
Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Reported-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoINSTALL.DPDK.md: Fix wrong command for creating dpdkvhostuser.
Wei li [Mon, 29 Jun 2015 10:35:13 +0000 (18:35 +0800)]
INSTALL.DPDK.md: Fix wrong command for creating dpdkvhostuser.

Signed-off-by: Wei li <liw@dtdream.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Failed initialization for datapath tunnel ports
Sorin Vinturis [Wed, 1 Jul 2015 15:32:18 +0000 (15:32 +0000)]
datapath-windows: Failed initialization for datapath tunnel ports

Tunnel ports are not initialized with the corresponding default port.
The newly allocated vport is not yet initialized and the ovsType
member does not reflect the correct tunnel port type, thus the
transport port destination won't be correctly initialized.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/88
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Avoid double incrementation of tx VXLAN packet statistics
Sorin Vinturis [Wed, 1 Jul 2015 15:21:03 +0000 (15:21 +0000)]
datapath-windows: Avoid double incrementation of tx VXLAN packet statistics

VXLAN tunnel tx packet stats are incorrectly incremented.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/89
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Duplicate tag for STT pools
Sorin Vinturis [Wed, 1 Jul 2015 15:20:27 +0000 (15:20 +0000)]
datapath-windows: Duplicate tag for STT pools

All pool allocations should have unique tags.
OVS_STT_POOL_TAG matches the OVS_MEMORY_TAG.

Changed the OVS_STT_POOL_TAG to make it unique.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agorhel: Add dkms support for ovs datapath build.
Alex Wang [Sun, 28 Jun 2015 23:31:16 +0000 (16:31 -0700)]
rhel: Add dkms support for ovs datapath build.

This commit adds a rpmbuild spec file for building ovs datapath
in dkms similar to the one for debian.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
8 years agovlog: add "vlog/list-pattern" command
Ansis Atteka [Sat, 13 Jun 2015 20:28:02 +0000 (13:28 -0700)]
vlog: add "vlog/list-pattern" command

This patch allows to query logging format at the runtime for each destination
with "vlog/list-pattern" command.

Signed-off-by: Ansis Atteka <aatteka@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agovlog: abstract out interface to syslog daemon
Ansis Atteka [Sun, 14 Jun 2015 00:22:15 +0000 (17:22 -0700)]
vlog: abstract out interface to syslog daemon

This patch helps to address two issues that are present on Ubuntu
15.04 (and most likely other Linux distributions) where rsyslog daemon
is configured to relay log messages from OVS to a remote log collector
and syslog format being used is something other than the one defined in
RFC 3164.  These two issues are:

1. libc syslog() function always adds RFC 3164 prefix to syslog
   messages before sending them over /dev/log Unix domain socket.
   This does not allow us to use libc syslog() function to log in
   RFC 5424 format;  and

2. rsyslogd daemon that comes with Ubuntu 15.04 is too old and
   uses hardcoded syslog message parser when it received messages
   over /dev/log UNIX domain socket.

Solution to those two issues would be to use the newly introduced
--syslog-method=udp:127.0.0.1:514 command line argument when starting
OVS.

Signed-off-by: Ansis Atteka <aatteka@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Conflicts:
NEWS

8 years agoofproto: Fix use-after-free in bridge destruction with groups.
Ben Pfaff [Tue, 23 Jun 2015 18:38:56 +0000 (11:38 -0700)]
ofproto: Fix use-after-free in bridge destruction with groups.

Groups were not destroyed until after lots of other important bridge
data had been destroyed, including the connection manager.  There was an
indirect dependency on the connection manager for bridge destruction
because destroying a group also destroys all of the flows that reference
the group, which in turn causes the ofmonitor to be invoked to report that
the flows had been destroyed.  This commit fixes the problem by destroying
groups earlier.

The problem can be observed by reverting the code changes in this commit
then running "make check-valgrind" with the test that this commit
introduces.

Reported-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
8 years agoofp-actions: Support mixing "conjunction" and "note" actions.
Ben Pfaff [Fri, 26 Jun 2015 15:14:15 +0000 (08:14 -0700)]
ofp-actions: Support mixing "conjunction" and "note" actions.

It doesn't make sense to mix "conjunction" actions with most other kinds
of actions.  That's because flows with "conjunction" actions aren't ever
actually executed, so any actions mixed up with them would never do
anything useful.  "note" actions are a little different because they never
do anything useful anyway: they are just there to allow a controller to
annotate flows.  It makes as much sense to annotate a flow with
"conjunction" actions as it does to annotate any other flow, so this
commit makes this possible.

Requested-by: Soner Sevinc <sevincs@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
8 years agotunneling: Don't match on source IP address for native tunnels.
Jesse Gross [Wed, 24 Jun 2015 21:44:50 +0000 (14:44 -0700)]
tunneling: Don't match on source IP address for native tunnels.

When doing native tunneling, we look at packets destined to the
local port to see if they match tunnel protocols that we should
intercept. The criteria are IP protocol, destination UDP port, etc.

However, we also look at the source IP address of the packets. This
should be a function of the port-based tunnel layer and not the
tunnel receive code itself. For comparison, the kernel tunnel code
has no idea about the IP addresses of its link partners. If port
based tunnel is desired, it can be handled using the normal port
tunnel layer, regardless of whether the packets originally came
from userspace or the kernel.

For port based tunneling, this bug has no effect - the check is
simply redundant. However, it breaks flow-based native tunnels
because the remote IP address is not known at port creation time.

CC: Pravin Shelar <pshelar@nicira.com>
Reported-by: David Griswold <David.Griswold@overturenetworks.com>
Tested-by: David Griswold <David.Griswold@overturenetworks.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
8 years agonetdev-dpdk: Reset RSS hash when receiving from a vhost device.
Daniele Di Proietto [Wed, 24 Jun 2015 15:55:40 +0000 (08:55 -0700)]
netdev-dpdk: Reset RSS hash when receiving from a vhost device.

A vhost device, being a virtual interface, doesn't provide a valid RSS
hash.  As a workaround we set the value to 0, which suggests the
datapath to recompute the hash in software.

Reported-by: Dongjun <dongj@dtdream.com>
CC: Traynor, Kevin <kevin.traynor@intel.com>
CC: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
8 years agonetdev-dpdk: Fix sparse and clang warnings
Daniele Di Proietto [Wed, 24 Jun 2015 15:55:39 +0000 (08:55 -0700)]
netdev-dpdk: Fix sparse and clang warnings

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
8 years agodpif-netdev: log port/core affinity
Mark Kavanagh [Tue, 9 Jun 2015 14:49:18 +0000 (07:49 -0700)]
dpif-netdev: log port/core affinity

When using multiple PMDs and numerous ports, a performance gain
may be achieved in some use cases by pinning a PMD/port to a
particular (set of) core(s).

This patch provides a summary of the switch's port/core affinities
each time that the status of the switch's ports is modified.
Based on this information, a user may determine what affinity
modifications are required to optimise performance for their
particular use case.

Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Signed-off-by: Wojciech Andralojc <wojciechx.andralojc@intel.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
8 years agonetdev-dpdk: Do not flush tx queue which is shared among CPUs since it is always...
Wei li [Thu, 25 Jun 2015 09:45:08 +0000 (02:45 -0700)]
netdev-dpdk: Do not flush tx queue which is shared among CPUs since it is always flushed

When tx queue is shared among CPUS,the pkts always be flush
in 'netdev_dpdk_eth_send'. So it is unnecessarily for flushing
in netdev_dpdk_rxq_recv Otherwise tx will be accessed without
locking.

Signed-off-by: Wei li <liw@dtdream.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
8 years agoofproto-dpif: Don't try to use dpif_probe_feature() with Windows datapath.
Alin Serdean [Thu, 25 Jun 2015 17:18:41 +0000 (17:18 +0000)]
ofproto-dpif: Don't try to use dpif_probe_feature() with Windows datapath.

This patch disables features which are not currently supported in the
Windows datapath.

Unfortunately we have to do it in userspace because dpif_probe_feature is
not treated accordingly in the Windows datapath.  Fixing that is the
correct solution; this commit works around it for branch-2.4.

I opened the issue to track the feature for later implementations:
https://github.com/openvswitch/ovs-issues/issues/85

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agotests: Use taskkill if tskill is not available, on Windows.
Ben Pfaff [Thu, 25 Jun 2015 15:34:39 +0000 (08:34 -0700)]
tests: Use taskkill if tskill is not available, on Windows.

This is not the minimal change; it "improves" the rest of the code as well.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
8 years agopython: Fix issue with probes for JSONRPC connections
Sumit Garg [Thu, 25 Jun 2015 13:24:54 +0000 (09:24 -0400)]
python: Fix issue with probes for JSONRPC connections

When opening a JSONRPC connection, the health probes
are incorrectly getting turned off for connections
that need probes.

In other words, when stream_or_pstream_needs_probes()
return non-zero, the probes are gettting disabled as
the probe interval is getting set to zero. This leads
to incorrect behavior such that probes are:

  - not getting turned off for unix: connections
  - getting turned off for tcp:/ssl: connections

The changes in this commit fix this issue.

Signed-off-by: Sumit Garg <sumit@extremenetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agopython: Fix writing to non-"alert" column for newly inserted row.
Sumit Garg [Thu, 25 Jun 2015 15:51:42 +0000 (08:51 -0700)]
python: Fix writing to non-"alert" column for newly inserted row.

When 'alert' was turned off on a column, the code was erroring out when
value for that column was being set in a newly inserted row. This is
because the row._data was None at this time.

It seems that new rows are not initialized to defaults and that's why the
NULL error happens.  IMO a newly inserted row should automatically get
intialized to default values.  This new behavior can be implemented as a
separate improvement sometime in the future.

For now, I don't see an issue with adding the additional check. This new
check can continue as-is even after the new behavior is implemented.

Signed-off-by: Sumit Garg <sumit@extremenetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agopython: Fix attempt to use a bool as a function.
Sumit Garg [Thu, 25 Jun 2015 12:44:10 +0000 (08:44 -0400)]
python: Fix attempt to use a bool as a function.

A bool (has_lock) was being accessed as a function call leading to a
runtime exception.

Signed-off-by: Sumit Garg <sumit@extremenetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agotests: Reduce user burden for running "make check".
Alin Serdean [Thu, 25 Jun 2015 15:30:34 +0000 (15:30 +0000)]
tests: Reduce user burden for running "make check".

With this commit, users do not have to manually add the pthread-win32
DLL directory to their PATH.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agonx-match: Fix distribution of hash function for NXM/OXM headers.
Ben Pfaff [Wed, 24 Jun 2015 18:17:12 +0000 (11:17 -0700)]
nx-match: Fix distribution of hash function for NXM/OXM headers.

NXM/OXM headers as represented in this file are 64-bit long and the low
bits are essentially constant (almost always 0) so using hash_int(),
which takes an uint32_t, is going to be a useless hash function.  This
commit fixes the problem.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
8 years agodatapath-windows: Wrong cleanup of newly created multiple NBLs
Sorin Vinturis [Wed, 24 Jun 2015 10:56:55 +0000 (10:56 +0000)]
datapath-windows: Wrong cleanup of newly created multiple NBLs

Bug found in OvsPartialCopyToMultipleNBLs function in the cleanup part of
the code. Before completing the current NBL (newNbl) the NEXT link for the
following NBL (firstNbl) was broken, instead of the current one (newNbl).

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/87
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Return success for already existing WFP objects
Sorin Vinturis [Thu, 18 Jun 2015 18:37:13 +0000 (18:37 +0000)]
datapath-windows: Return success for already existing WFP objects

There are cases when the WFP callout or sublayer, being persistent
objects, already exists when we try to register the OVS callout. In
this cases, when trying to add again these WFP objects the return code
is STATUS_FWP_ALREADY_EXISTS, which we are interpreting as an error.
This is incorrect and this patch changes that.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/84
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agotests: Adjust output of vconn for windows.
Gurucharan Shetty [Mon, 15 Jun 2015 15:13:06 +0000 (08:13 -0700)]
tests: Adjust output of vconn for windows.

Recent tests added for openflow atomic bundle support
looks for Linux specific output in logs. Adjust them
so that tests pass in Windows too.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
8 years agoofproto.at: Don't specify the specific error.
Gurucharan Shetty [Fri, 12 Jun 2015 17:40:57 +0000 (10:40 -0700)]
ofproto.at: Don't specify the specific error.

On Windows, we don't do a good job of translating errors to Linux
type errors.  So in the tests, don't look for a specific type of
error.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
8 years agoofproto: Don't report that group chaining is supported.
Ben Pfaff [Sat, 6 Jun 2015 05:42:10 +0000 (22:42 -0700)]
ofproto: Don't report that group chaining is supported.

Group chaining hasn't been supported, so we shouldn't report that it is.
(This is a good demonstration of why I don't like feature bits like this.
It's too easy for even well-intentioned implementers to get them wrong.)

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
8 years agodatapath-windows: Initialize reference count when enabling extension
Sorin Vinturis [Fri, 19 Jun 2015 16:33:56 +0000 (16:33 +0000)]
datapath-windows: Initialize reference count when enabling extension

When the extension is initialized the global reference count, used for
preventing early deallocation of the switch extension, is set to 1.
Enabling and then disabling the extension leaves the latter reference
count to zero. Because of this the switch context fails to be acquired,
i.e OvsAcquireSwitchContext returns zero, and that affects driver's
communication to the userspace.

The solution is to initialize the reference count each time the extension
is enabled.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Nithin Raju <nithin@vmware.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/86
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
8 years agodatapath-windows: use correct dst port during Vxlan Tx
Nithin Raju [Fri, 19 Jun 2015 16:13:08 +0000 (09:13 -0700)]
datapath-windows: use correct dst port during Vxlan Tx

A previous commit used the wrong DST port in the UDP header during Vxlan
Tx which caused Vxlan tunneling to break. Fixing it here..

Also included is a cosmetic fix in OvsDetectTunnelRxPkt() where we were
using htons() instead of ntohs(). Doesn't make a difference in practice
though.

One more change is, OvsIpHlprCbVxlan() has been nuked since it is not
used. Not sure if it is worth being resurrected.

Testing done: Ping across Vxlan tunnel and Stt tunnel.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Reported-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
8 years agoPrepare for 2.4.0.
Justin Pettit [Wed, 17 Jun 2015 23:09:48 +0000 (16:09 -0700)]
Prepare for 2.4.0.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
8 years agodatapath-windows: Return pending for IRPs completed later
Sorin Vinturis [Thu, 18 Jun 2015 13:48:09 +0000 (13:48 +0000)]
datapath-windows: Return pending for IRPs completed later

Return STATUS_PENDING for IRPs that are completed later in another
thread.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/83
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoAUTHORS: Add Thadeu Lima de Souza Cascardo.
Ben Pfaff [Wed, 17 Jun 2015 18:14:31 +0000 (11:14 -0700)]
AUTHORS: Add Thadeu Lima de Souza Cascardo.

Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoAdd IGMPv3 support.
Thadeu Lima de Souza Cascardo [Wed, 17 Jun 2015 17:12:20 +0000 (14:12 -0300)]
Add IGMPv3 support.

Support IGMPv3 messages with multiple records. Make sure all IGMPv3
messages go through slow path, since they may carry multiple multicast
addresses, unlike IGMPv2.

Tests done:

* multiple addresses in IGMPv3 report are inserted in mdb;
* address is removed from IGMPv3 if record is INCLUDE_MODE;
* reports sent on a burst with same flow all go to userspace;
* IGMPv3 reports go to mrouters, i.e., ports that have issued a query.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto-dpif-xlate: Make IGMP packets always take slow path.
Thadeu Lima de Souza Cascardo [Wed, 17 Jun 2015 17:12:19 +0000 (14:12 -0300)]
ofproto-dpif-xlate: Make IGMP packets always take slow path.

IGMP packets need to take the slow path. Otherwise, packets that match
the same flow will not be processed by OVS. That might prevent OVS from
updating the expire time for entries already in the mdb, but also to
lose packets with different addresses in the payload.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agolacp: Remove packed attribute from struct lacp_pdu.
Ben Pfaff [Tue, 16 Jun 2015 15:47:34 +0000 (08:47 -0700)]
lacp: Remove packed attribute from struct lacp_pdu.

The packed annotation doesn't do anything here because all of the members
in the structure are naturally aligned.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Ethan Jackson <ethan@nicira.com>
8 years agoauto-attach: Cleanup i-sid/vlan mappings associated with lldp-enabled port.
Dennis Flynn [Tue, 16 Jun 2015 21:33:35 +0000 (17:33 -0400)]
auto-attach: Cleanup i-sid/vlan mappings associated with lldp-enabled port.

This commit fixes a bug where the i-sid/vlan mapping structures associated with
an lldp-enabled port were not being freed during general port cleanup.

Signed-off-by: Dennis Flynn <drflynn@avaya.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodocs: Fix alignment for diagram in native-tunneling.md.
Mark D. Gray [Wed, 17 Jun 2015 11:49:25 +0000 (12:49 +0100)]
docs: Fix alignment for diagram in native-tunneling.md.

Markdown was not formatted correctly and, as a result,
was displaying incorrectly on github.

Signed-off-by: Mark D. Gray <mark.d.gray@intel.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoovs-vtep: Support userspace datapaths.
Daniele Di Proietto [Tue, 16 Jun 2015 15:25:24 +0000 (16:25 +0100)]
ovs-vtep: Support userspace datapaths.

With this commit, the VTEP emulator detects the datapath_type of the
bridge used as a "physical" switch, and creates subsequent bridges
with the same type.  This allows ovs-vtep to work with the userspace
datapath.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Gurucharan Shetty <gshetty@nicira.com>
8 years agodatapath-windows: BSOD when disabling the extension
Sorin Vinturis [Thu, 28 May 2015 20:30:57 +0000 (20:30 +0000)]
datapath-windows: BSOD when disabling the extension

When the filter detach routine is called while there are packets
still in processing, the OvsUninitSwitchContext function call will
decrement the switch context reference count without releasing the
switch context structure. This behaviour is correct and expected,
but the BSOD is caused in this case because the gOvsSwitchContext
variable is set to NULL, which is wrong.

The gOvsSwitchContext global variable must be set to NULL only when
the switch context structure is actually released.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/80
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodpif-netdev: Prefetch next packet before miniflow_extract().
Daniele Di Proietto [Mon, 15 Jun 2015 18:06:39 +0000 (19:06 +0100)]
dpif-netdev: Prefetch next packet before miniflow_extract().

It appears that miniflow_extract() in emc_processing() spends a lot of
cycles waiting for the packet's data to be read.

Prefetching the next packet's data while parsing removes this delay.
For a single flow pipeline the throughput improves by ~10%.  With a
more realistic pipeline the change has a much smaller effect (~0.5%
improvement)

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
8 years agoovs-ctl: let openvswitch startup to NOT hold up system boot upon error
Sabyasachi Sengupta [Mon, 15 Jun 2015 21:57:53 +0000 (14:57 -0700)]
ovs-ctl: let openvswitch startup to NOT hold up system boot upon error

Abort openvswitch startup script if ovsdb startup fails for
some reason. This helps in getting the system startup to NOT hang
indefinitely, as was seen in a recent report when ovsdb failed with
"I/O error: /etc/openvswitch/conf.db: failed to lock lockfile
(Resource temporarily unavailable)" and system remained in hung state
forever, unless manually rebooted from console.

Signed-off-by: Sabyasachi Sengupta <sabyasachi.sengupta@alcatel-lucent.com>
[blp@nicira.com changed an 'if' statement to '||']
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoflow: Make assertions about offsets within struct flow easier to follow.
Ben Pfaff [Tue, 9 Jun 2015 18:32:24 +0000 (11:32 -0700)]
flow: Make assertions about offsets within struct flow easier to follow.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agonetdev-dpdk: add dpdk vhost-user ports
Ciara Loftus [Thu, 4 Jun 2015 13:51:40 +0000 (06:51 -0700)]
netdev-dpdk: add dpdk vhost-user ports

This patch adds support for a new port type to the userspace
datapath called dpdkvhostuser.

A new dpdkvhostuser port will create a unix domain socket which
when provided to QEMU is used to facilitate communication between
the virtio-net device on the VM and the OVS port on the host.

vhost-cuse ('dpdkvhost') ports are still available as 'dpdkvhostcuse'
ports and will be enabled if vhost-cuse support is detected in the
DPDK build specified during compilation of the switch. Otherwise,
vhost-user ports are enabled.

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
8 years agoofproto: Support port mods in bundles.
Jarno Rajahalme [Fri, 12 Jun 2015 23:12:56 +0000 (16:12 -0700)]
ofproto: Support port mods in bundles.

Add support for port mods in an OpenFlow 1.4 bundle, as required for
the minimum support level by the OpenFlow 1.4 specification.  If the
bundle includes port mods, it may not specify the OFPBF_ATOMIC flag.
Port mods and flow mods in a bundle are always applied in order and
the consecutive flow mods between port mods are made available to
lookups atomically.

Note that ovs-ofctl does not support creating bundles with port mods.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto: Postpone sending flow removed messages.
Jarno Rajahalme [Fri, 12 Jun 2015 23:12:56 +0000 (16:12 -0700)]
ofproto: Postpone sending flow removed messages.

The final flow stats are available only after there are no references
to the rule.  Postpone sending the flow removed message until the
final stats are available.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoclassifier: Simplify versioning.
Jarno Rajahalme [Fri, 12 Jun 2015 23:12:56 +0000 (16:12 -0700)]
classifier: Simplify versioning.

After all, there are some cases in which both the insertion version
and removal version of a rule need to be considered.  This makes the
cls_match a bit bigger, but makes classifier versioning much simpler
to understand.

Also, avoid using type larger than int in an enum, as it is not
portable C.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoovs-rcu: Comment fixes.
Ben Pfaff [Fri, 12 Jun 2015 17:58:27 +0000 (10:58 -0700)]
ovs-rcu: Comment fixes.

A comment referred to a "Usage" section but the section was named "Use".
This fixes the problem (also a grammar error).

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
8 years agorculist: Remove postponed poisoning.
Jarno Rajahalme [Fri, 12 Jun 2015 00:28:37 +0000 (17:28 -0700)]
rculist: Remove postponed poisoning.

Postponed 'next' member poisoning was based on the faulty assumption
that postponed functions would be called in the order they were
postponed.  This assumption holds only for the functions postponed by
any single thread.  When functions are postponed by different
threads, there are no guarantees of the order in which the functions
may be called, or timing between those calls after the next grace
period has passed.

Given this, the postponed poisoning could have executed after
postponed destruction of the object containing the rculist element.

This bug was revealed after the memory leaks on rule deletion were
recently fixed.

This patch removes the postponed 'next' member poisoning and adds
documentation describing the ordering limitations in OVS RCU.

Alex Wang dug out the root cause of the resulting crashes, thanks!

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
8 years agovtep-ctl: Fix a bug.
Alex Wang [Tue, 9 Jun 2015 05:57:09 +0000 (22:57 -0700)]
vtep-ctl: Fix a bug.

add_port_to_cache() uses 'cache_name' as the shash node name for
shash_add().  So, the del_cached_port() must also pass 'cache_name'
as argument for shash_find_and_delete().

This bug does not cause any issue currently but should be fixed.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
8 years agoofproto: Revertible eviction.
Jarno Rajahalme [Thu, 11 Jun 2015 22:53:43 +0000 (15:53 -0700)]
ofproto: Revertible eviction.

Handling evictions was broken in the previous patches. Eviction took
place early in the commit, and actually inappropriately bumped the
version number too early.  Now eviction is treated much like a flow
modification, where a new rule replaces the old one, but just without
any 'inheritance' from the evicted rule to the new rule.  This makes
evictions to be executed only when commit is successful, as evictions
are reverted like any other changes when the commit fails.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto: Accurate flow counts.
Jarno Rajahalme [Thu, 11 Jun 2015 22:53:43 +0000 (15:53 -0700)]
ofproto: Accurate flow counts.

Classifier's rule count now contains temporary duplicates and rules
whose deletion has been deferred.  Maintain a new 'n_flows' count in
struct oftable to as the count of rules in the latest version.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoUse classifier versioning.
Jarno Rajahalme [Thu, 11 Jun 2015 22:53:43 +0000 (15:53 -0700)]
Use classifier versioning.

Each rule is now added or deleted in a specific tables version.  Flow
tables are versioned with a monotonically increasing 64-bit integer,
where positive values are valid version numbers.

Rule modifications are implemented as an insertion of a new rule and a
deletion of the old rule, both taking place in the same tables
version.  Since concurrent lookups may use different versions, both
the old and new rule must be available for lookups at the same time.

The ofproto provider interface is changed to accomodate the above.  As
rule's actions need not be modified any more, we no longer need
'rule_premodify_actions', nor 'rule_modify_actions'.  'rule_insert'
now takes a pointer to the old rule and adds a flag that tells whether
the old stats should be forwarded to the new rule or not (this
replaces the 'reset_counters' flag of the now removed
'rule_modify_actions').

Versioning all flow table changes has the side effect of making
learned flows visible for future lookups only.  I.e., the upcall that
executes the learn action, will not see the newly learned action in
it's classifier lookups.  Only upcalls that start executing after the
new flow was added will match on it.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto: Infra for table versioning.
Jarno Rajahalme [Thu, 11 Jun 2015 22:53:43 +0000 (15:53 -0700)]
ofproto: Infra for table versioning.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agotest-classifier: Test versioning features.
Jarno Rajahalme [Thu, 11 Jun 2015 22:53:43 +0000 (15:53 -0700)]
test-classifier: Test versioning features.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoclassifier: Make traversing identical rules robust.
Jarno Rajahalme [Thu, 11 Jun 2015 22:53:42 +0000 (15:53 -0700)]
classifier: Make traversing identical rules robust.

The traversal of the list of identical rules from the lookup threads
is fragile if the list head is removed during the list traversal.

This patch simplifies the implementation of that list by making the
list NULL terminated, singly linked RCU-protected list.  By having the
NULL at the end there is no longer a possiblity of missing the point
when the list wraps around.  This is significant when there can be
multiple elements with the same priority in the list.

This change also decreases the size of the struct cls_match back
pre-'visibility' attribute size.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoodp-util: Remove last use of odp_tun_key_from_attr for formatting.
Jesse Gross [Tue, 9 Jun 2015 17:29:43 +0000 (10:29 -0700)]
odp-util: Remove last use of odp_tun_key_from_attr for formatting.

We formerly converted tunnel attributes to their flow representation
before formatting but now perform all operations directly on the
netlink attributes.

There is one remaining use of odp_tun_key_from_attr() that is not
used for the purposes of generating a flow. This is to check the
mask but this no longer makes sense given the way that we format
the flow itself. In fact, the code is not actually invoked any
more, so we can simply remove it.

This retains the special case for tunnels as a safety measure but it
should not matter in practice.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoovsdb-idl: Document that the IDL always presents a consistent view.
Ben Pfaff [Thu, 11 Jun 2015 17:47:47 +0000 (10:47 -0700)]
ovsdb-idl: Document that the IDL always presents a consistent view.

We've had this question a couple of times so we might as well document it.

Requested-by: Saurabh Shrivastava (सौरभ श्रीवास्तव) <saurabh@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Stateless TCP Tunnelling protocol - Initial implementation
Eitan Eliahu [Thu, 11 Jun 2015 13:35:54 +0000 (06:35 -0700)]
datapath-windows: Stateless TCP Tunnelling protocol - Initial implementation

This change include an initial implementable of STT.

The following should be added:
[1] Checksum offload (SW and HW)
[2] LSO (SW and HW)
[3] IP layer WFP callout for IP segments

Added support for multiple (per TCP port) STT ports

Testing: link layer connection through ping works. File transfer.

Signed-off-by: Eitan Eliahu <eliahue@vmware.com>
Co-authored-by: Saurabh Shah <ssaurabh@vmware.com>
Signed-off-by: Saurabh Shah <ssaurabh@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Correctly complete the original NBL with multiple NBs
Sorin Vinturis [Thu, 11 Jun 2015 12:52:49 +0000 (12:52 +0000)]
datapath-windows: Correctly complete the original NBL with multiple NBs

OvsCreateNewNBLsFromMultipleNBs function failed to correctly complete the
original NBL with multiple NBs after creating multiple NBLs with single
NB.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agonetdev-vport: Mark netdev_vport_get_dpif_port() as OVS_WARN_UNUSED_RESULT.
Ben Pfaff [Sat, 6 Jun 2015 05:09:50 +0000 (22:09 -0700)]
netdev-vport: Mark netdev_vport_get_dpif_port() as OVS_WARN_UNUSED_RESULT.

Ignoring the result of this function means that the caller is quite likely
blindly using the character array passed in, instead of the return value,
which leads to latent bugs.

This would have prevented one of the bugs fixed by commit "tunneling: Fix a
tunnel name display bug".

CC: Andy Zhou <azhou@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
8 years agoclassifier: Support table versioning
Jarno Rajahalme [Wed, 10 Jun 2015 00:00:00 +0000 (17:00 -0700)]
classifier: Support table versioning

This patch allows classifier rules to become visible and invisible in
specific versions.  A 'version' is defined as a positive monotonically
increasing integer, which never wraps around.

The new 'visibility' attribute replaces the prior 'to_be_removed' and
'visible' attributes.

When versioning is not used, the 'version' parameter should be passed
as 'CLS_MIN_VERSION' when creating rules, and 'CLS_MAX_VERSION' when
looking up flows.

This feature enables the support for atomic OpenFlow bundles without
significant performance penalty on 64-bit systems. There is a
performance decrease in 32-bit systems due to 64-bit atomics used.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoovs-ofctl: Add bundle support and unit testing.
Jarno Rajahalme [Fri, 5 Jun 2015 21:03:12 +0000 (14:03 -0700)]
ovs-ofctl: Add bundle support and unit testing.

All existing ovs-ofctl flow mod commands now take an optional
'--bundle' argument, which executes the flow mods as a single
transaction.  OpenFlow 1.4+ is implicitly assumed when '--bundle' is
specified.

ovs-ofctl 'add-flow' and 'add-flows' commands now accept flow
specifications that start with an optional 'add', 'modify', 'delete',
'modify_strict', or 'delete_strict' keyword, so that arbitrary flow
table modifications may be specified.  For backwards compatibility, a
missing keyword is treated as an 'add'.  With the new '--bundle'
option all the modifications are executed as a single transaction
using an OpenFlow 1.4 bundle.

OpenFlow 1.4 requires bundles to support at least flow and port mods.
This implementation does not yet support port mods in bundles.

Another restriction is that the atomic transactions are not yet
supported.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto: Rename *_begin functions as *_start.
Jarno Rajahalme [Fri, 5 Jun 2015 21:03:11 +0000 (14:03 -0700)]
ofproto: Rename *_begin functions as *_start.

Weirdest things can bother you at night when you try to sleep ;-)

Now we have function triples such as add_flow_begin(),
add_flow_finish(), and add_flow_revert(), where a modification is
started in *_begin(), which can fail, and when successful can be
either made permanent with *_finish(), or cancelled with *_revert().

Linguistically it should be either "begin/end" or "start/finish", not
"begin/finish".  "begin/end" has some C++ STL baggage, so let's go
with "start/finish".  IMO "revert" rhymes with it, too.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agodebian: Remove obsolete manual setting of CFLAGS and warnings from rules.
Ben Pfaff [Sun, 7 Jun 2015 16:48:15 +0000 (09:48 -0700)]
debian: Remove obsolete manual setting of CFLAGS and warnings from rules.

Setting CFLAGS by hand before invoking dpkg-buildflags is ineffective,
because dpkg-buildflags overrides it.

Reported-by: Andrey Korolyov <andrey@xdel.ru>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoconfigure: Stop avoiding -Wformat-zero-length.
Ben Pfaff [Sun, 7 Jun 2015 16:48:14 +0000 (09:48 -0700)]
configure: Stop avoiding -Wformat-zero-length.

Debian likes to enable -Wformat-zero-length, even over our code trying to
disable it.  It isn't too hard to make our code warning-free against this
option, so this commit both stops disabling it and fixes the warnings.

The first fix is to change set_subprogram_name() to take a plain string
instead of a format string, and to adjust its few callers.  This fixes one
warning since one of those callers passed in an empty string.

The second fix is to remove a test for ovs_scan() against an empty string.
I couldn't find a way to avoid a warning for this test, and it isn't too
valuable in any case.

This allows us to drop filtering for -Wformat from the Debian rules file,
so this commit removes it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agotypes: Rename and move ovs_u128_equal().
Joe Stringer [Fri, 29 May 2015 23:17:01 +0000 (16:17 -0700)]
types: Rename and move ovs_u128_equal().

This function doesn't need to be exported in the public OVS headers, and
it had an inconsistent name compared to uuid_equals(). Rename and move.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoodp-util: Reuse UUID marshalling for UFID.
Joe Stringer [Sat, 30 May 2015 00:08:45 +0000 (17:08 -0700)]
odp-util: Reuse UUID marshalling for UFID.

Unique flow identifiers are really a UUID of sorts, so it makes sense to
reuse the UUID string representations for UFID.

Suggested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agodpif: Always generate RFC4122 UUIDs for UFID.
Joe Stringer [Tue, 9 Jun 2015 20:35:29 +0000 (13:35 -0700)]
dpif: Always generate RFC4122 UUIDs for UFID.

This patch sacrifices a few bits of hash quality from the 128-bit unique
flow identifiers to make the UFIDs RFC4122-conformant as per the version 4
(random) UUID spec. Given that the 128-bit space is already quite large,
this should not affect the spread of UFIDs in any meaningful way for
hashing.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofp-parse: Use F_OUT_PORT when parsing.
Jarno Rajahalme [Tue, 9 Jun 2015 22:24:33 +0000 (15:24 -0700)]
ofp-parse: Use F_OUT_PORT when parsing.

We set this field flag for the cases when an out_port should be
parsed, but failed to make use of it.

Two test cases needed to be updated due to use of out_port in flow
add, while out_port is legal for flow deletes only.

Suggested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoodp-util: Simplify parsing function for GCC.
Jarno Rajahalme [Tue, 9 Jun 2015 22:24:33 +0000 (15:24 -0700)]
odp-util: Simplify parsing function for GCC.

GCC 4.7.2 -O3 flagged potential use before initialization for the 'id'
and 'id_mask' being scanned in scan_vxlan_gbp().  For the 'id' this
was a real possiblity, but for the 'id_mask' it seems to be a false
positive in gcc analysis.  Simplify scan_vxlan_gbp() to fix this.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto: Fix memory leak in ofproto_rule_delete().
Jarno Rajahalme [Tue, 9 Jun 2015 22:24:33 +0000 (15:24 -0700)]
ofproto: Fix memory leak in ofproto_rule_delete().

Commit 401aa90e33be (ofproto: Fix memory leak in flow deletion.) fixed
the memory leak when a rule is deleted, but failed to do the same when
all rules in a bridge are deleted just before the bridge itself is
deleted.

This patch adds the necessary unref to ofproto_rule_delete().

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoflow: Add 'const' qualifiers in flow extraction.
Ben Pfaff [Mon, 8 Jun 2015 20:16:07 +0000 (13:16 -0700)]
flow: Add 'const' qualifiers in flow extraction.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agoovsdb-monitor: add json cache
Andy Zhou [Mon, 16 Mar 2015 22:45:27 +0000 (15:45 -0700)]
ovsdb-monitor: add json cache

Although multiple jsonrpc monitors can share the same ovsdb monitor,
each change still needs to translated into json object from scratch.
This can be wasteful if multiple jsonrpc monitors are interested in the
same changes.

Json cache improves this by keeping an copy of json object generated
for transaction X to current transaction. When jsonrpc is interested
in a change, the cache is searched first, if an json object is found,
a copy of it is handed back, skipping the regeneration process.

Any commit to the monitor will empty the cache. This can be further
optimized to not throw away the cache if the updated tables and columns
are not being monitored.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoovsdb-monitor: allow multiple jsonrpc monitors to share a single ovsdb
Andy Zhou [Mon, 16 Mar 2015 10:03:20 +0000 (03:03 -0700)]
ovsdb-monitor: allow multiple jsonrpc monitors to share a single ovsdb
monitor

Store ovsdb monitor in a global hmap. If a newly created ovsdb monitor
object monitors the same tables and columns as an existing one, the
existing monitor will be reused.

With this patch, jsonrpc monitor and ovsdb monitor now have N:1 mapping.
The goals are to:
1) Reduce the cost of maintaining duplicated monitors.
2) Allow for create Json cache for the same updates. Json cache will be
introduced in the following patch.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoovsdb-monitor: refactor ovsdb_monitor_create()
Andy Zhou [Sun, 15 Mar 2015 23:31:41 +0000 (16:31 -0700)]
ovsdb-monitor: refactor ovsdb_monitor_create()

Add ovsdb_monitor_add_jsonrpc_monitor(). This change will allow
ovsdb_monitor to be reference counted.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agotunneling: Fix a tunnel name display bug
Andy Zhou [Thu, 4 Jun 2015 20:45:55 +0000 (13:45 -0700)]
tunneling: Fix a tunnel name display bug

Currently, 'ovs-appctl tnl/ports/show' command won't display gre port
name correctly. Since netdev_vport_get_dpif_port() will not always
set the 'namebuf' it receives. Should use the name by its return
value instead. Found by inspection.

Also extend the test case to cover this command.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>