cascardo/ovs.git
8 years agoovs-ctl: Add option to delete transient ports.
Thadeu Lima de Souza Cascardo [Tue, 1 Sep 2015 20:56:09 +0000 (17:56 -0300)]
ovs-ctl: Add option to delete transient ports.

When using virtualization, new ports are created and removed all the time. These
ports do not persist after a system reboot, for example. They may be created
again by the virtualization manager, but that will happen after the vswitch is
already running, and the virtualization manager will add them again to the
bridge.

If a reboot happens without properly deleting such ports, all kinds of errors
will happen. The absence of the ports will be logged as errors, and adding those
ports again to the database will fail.

Deleting all bridges may not be an option, if the system cannot persist other
information outside of OVSDB.

This patch introduces the notion of transient ports. Ports may be added as
transient, as a boolean in other_config smap. When openvswitch is started by
using --delete-transient-ports ovs-ctl option, all transient ports will be
removed.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoovn: Add bridge mappings to ovn-controller.
Russell Bryant [Wed, 26 Aug 2015 15:07:52 +0000 (11:07 -0400)]
ovn: Add bridge mappings to ovn-controller.

Add a new OVN configuration entry in the Open_vSwitch database called
"ovn-bridge-mappings".  This allows the configuration of mappings
between a physical network name and an OVS bridge that provides
connectivity to that network.

For example, if you wanted to configure "physnet1" to map to "br-eth0"
and "physnet2" to map to "br-eth1", the configuration would be:

  $ ovs-vsctl set open . \
  > external-ids:ovn-bridge-mappings=physnet1:br-eth0,physnet2:br-eth1

Patch ports between these bridges and the integration bridge are
automatically created and also removed if necessary when the
configuration changes.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoauthors: Update authors list with my new email.
Ethan J. Jackson [Tue, 1 Sep 2015 17:36:55 +0000 (10:36 -0700)]
authors: Update authors list with my new email.

Signed-off-by: Ethan J. Jackson <ejj@eecs.berkeley.edu>
Acked-by: Justin Pettit <jpettit@nicira.com>
8 years agodatapath-windows: Clean up properly in case of driver init failure.
Sorin Vinturis [Tue, 1 Sep 2015 14:21:09 +0000 (14:21 +0000)]
datapath-windows: Clean up properly in case of driver init failure.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoovsdb: Remove misleading OVS_UNUSED from ovsdb_monitor_change_cb().
Ben Pfaff [Mon, 31 Aug 2015 16:44:04 +0000 (09:44 -0700)]
ovsdb: Remove misleading OVS_UNUSED from ovsdb_monitor_change_cb().

This function does use this parameter.

(This does not change any behavior.)

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
8 years agodatapath-windows: Support for IRP cancelling mechanism
Sorin Vinturis [Mon, 31 Aug 2015 17:46:37 +0000 (17:46 +0000)]
datapath-windows: Support for IRP cancelling mechanism

Under certain circumstances, we might need to cancel a pending IRP
that has been submitted and not yet responded. This might occur when
the request takes too long to complete or when the process which
initiated the request terminated, leaving the request outstanding.

This patch provides this missing piece by adding support for IRP
cancelling mechanism.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/95
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Process tunnel filter requests iteratively
Sorin Vinturis [Mon, 31 Aug 2015 20:53:15 +0000 (20:53 +0000)]
datapath-windows: Process tunnel filter requests iteratively

In order to support IRP cancelling mechanism for pending IRPs, all
tunnel filter requests, VXLAN create/delete tunnel, need to be
processed iteratively.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agonetdev-windows: Fix typo in call to memcpy().
Nithin Raju [Mon, 31 Aug 2015 17:59:28 +0000 (10:59 -0700)]
netdev-windows: Fix typo in call to memcpy().

This fixes a build error introduced by commit 74ff3298c (userspace:
Define and use struct eth_addr.)

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoflow: Fix MSVC compile errors.
Ben Pfaff [Sun, 30 Aug 2015 14:40:31 +0000 (07:40 -0700)]
flow: Fix MSVC compile errors.

This fixes some MSVC build errors introduced by commit 74ff3298c
(userspace: Define and use struct eth_addr.)

MSVC doesn't like the change in 'const' between function declaration and
definition: it reports "formal parameter 2 different from declaration" for
each of the functions in flow.h corrected by this (commit.  I think it's
technically wrong about that, standards-wise.)

MSVC doesn't like an empty-brace initializer.  (I think it's technically
right about that, standards-wise.)

This commit attempts to fix both problems, but I have not tested it with
MSVC.

CC: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Tested-by: Nithin Raju <nithin@vmware.com>
8 years agodatapath: check for rx handler register
Flavio Leitner [Sat, 29 Aug 2015 00:52:36 +0000 (21:52 -0300)]
datapath: check for rx handler register

Red Hat Enterprise Linux 6 has backported the netdev RX
handler facility so use the netdev_rx_handler_register as
an indicator.

The handler prototype changed between 2.6.36 and 2.6.39
since there could be backports in any stage, don't look
at the kernel version, but at the prototype.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
8 years agotunnel: Support matching on the presence of Geneve options.
Jesse Gross [Wed, 12 Aug 2015 01:41:37 +0000 (18:41 -0700)]
tunnel: Support matching on the presence of Geneve options.

Sometimes it is useful to match only on whether a Geneve option
is present even if the specific value is unimportant. A special
case of this is zero length options where there is no value at all
and the only information conveyed is whether the option was included
in the packet.

This operation was partially supported before but it was not consistent -
in particular, options were never serialized through NXM/OXM unless
they had a non-zero mask. Furthermore, zero length options were rejected
altogether when they were installed through the Geneve map OpenFlow
command.

This adds support for these types of matches by making any NXM/OXM for
tunnel metadata force a match on that field. In the case of a zero length
option, both the value and mask of the NXM are ignored.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agobridge: Relax the whitelist format for punix path.
Alex Wang [Fri, 21 Aug 2015 22:20:24 +0000 (15:20 -0700)]
bridge: Relax the whitelist format for punix path.

This commit relaxes the whitelist format for punix path of
service controller.  Instead of only allowing
punix:<ovs_rundir>/<bridge_name>.controller, the new format
allows any suffix, like punix:<ovs_rundir>/<bridge_name>.*.
(except one containing '/').

Signed-off-by: Alex Wang <ee07b291@gmail.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto-dpif-upcall: Do not attribute stats when flow_del returns error.
Alex Wang [Fri, 28 Aug 2015 05:05:07 +0000 (05:05 +0000)]
ofproto-dpif-upcall: Do not attribute stats when flow_del returns error.

In the push_ukey_ops__(), when flow_del operation returns error, the 'struct
stats' passed to the operation function will be set to all zero.  And we
should not use it to calculate the delta (i.e. minus the zero stats by the
cached stats causes overflow).

Even though this should rarely happen, it is still good to make
push_ukey_ops__() just ignore the operation when it fails.

Signed-off-by: Alex Wang <ee07b291@gmail.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agodatapath-windows: Fix broken build.
Alin Serdean [Fri, 28 Aug 2015 20:55:32 +0000 (20:55 +0000)]
datapath-windows: Fix broken build.

Change variable name from nlAttrs to flowAttrs.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agouserspace: Define and use struct eth_addr.
Jarno Rajahalme [Fri, 28 Aug 2015 21:55:11 +0000 (14:55 -0700)]
userspace: Define and use struct eth_addr.

Define struct eth_addr and use it instead of a uint8_t array for all
ethernet addresses in OVS userspace.  The struct is always the right
size, and it can be assigned without an explicit memcpy, which makes
code more readable.

"struct eth_addr" is a good type name for this as many utility
functions are already named accordingly.

struct eth_addr can be accessed as bytes as well as ovs_be16's, which
makes the struct 16-bit aligned.  All use seems to be 16-bit aligned,
so some algorithms on the ethernet addresses can be made a bit more
efficient making use of this fact.

As the struct fits into a register (in 64-bit systems) we pass it by
value when possible.

This patch also changes the few uses of Linux specific ETH_ALEN to
OVS's own ETH_ADDR_LEN, and removes the OFP_ETH_ALEN, as it is no
longer needed.

This work stemmed from a desire to make all struct flow members
assignable for unrelated exploration purposes.  However, I think this
might be a nice code readability improvement by itself.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agoappveyor: Renew SSL link.
Alin Serdean [Fri, 28 Aug 2015 21:11:21 +0000 (21:11 +0000)]
appveyor: Renew SSL link.

1_0_2a version not available for download.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
8 years agorhel: Add variables for OVN and VTEP db locations.
Russell Bryant [Wed, 26 Aug 2015 21:46:55 +0000 (17:46 -0400)]
rhel: Add variables for OVN and VTEP db locations.

Most real deployments will need to customize the database locations
for ovn-controller and ovn-controller-vtep.  Instead of making them
override the entire command used to start the daemons, provide and
document some environment variables that can be overridden in a custom
config file.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agorhel: Add systemd suport for ovn-controller-vtep.
Russell Bryant [Wed, 26 Aug 2015 21:46:54 +0000 (17:46 -0400)]
rhel: Add systemd suport for ovn-controller-vtep.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agorhel: Use same rundir for ovs and ovn.
Russell Bryant [Wed, 26 Aug 2015 21:46:53 +0000 (17:46 -0400)]
rhel: Use same rundir for ovs and ovn.

The previous systemd units for OVN had systemd create a rundir for
each daemon (ovn-northd and ovn-controller).  This "worked", in that
the services did start successfully.  However, they didn't actually
work.  In practice, both services make use of files in the main ovs
rundir, so just run everything from there.  It keeps things simple and
makes the services actually work.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoofp-actions: Don't encode variable length fields using NXAST_REG_LOAD.
Jesse Gross [Fri, 28 Aug 2015 01:40:45 +0000 (18:40 -0700)]
ofp-actions: Don't encode variable length fields using NXAST_REG_LOAD.

Currently, when using an OpenFlow 1.0 connection to encode a
tunnel metadata set field action, a series of NXAST_REG_LOADs
are emitted. The result is something like this:

actions=load:0xa->NXM_NX_TUN_METADATA0[0..63],load:0->
NXM_NX_TUN_METADATA0[64..127],load:0->NXM_NX_TUN_METADATA0[128..191],
load:0->NXM_NX_TUN_METADATA0[192..255],load:0->NXM_NX_TUN_METADATA0
[256..319],load:0->NXM_NX_TUN_METADATA0[320..383],load:0->
NXM_NX_TUN_METADATA0[384..447],load:0->NXM_NX_TUN_METADATA0[448..511],
load:0->NXM_NX_TUN_METADATA0[512..575],load:0->NXM_NX_TUN_METADATA0
[576..639],load:0->NXM_NX_TUN_METADATA0[640..703],load:0->
NXM_NX_TUN_METADATA0[704..767],load:0->NXM_NX_TUN_METADATA0[768..831],
load:0->NXM_NX_TUN_METADATA0[832..895],load:0->NXM_NX_TUN_METADATA0
[896..959],load:0->NXM_NX_TUN_METADATA0[960..991]

This happens because tunnel metadata is seen as a maximum size field
and so many loads need to be emitted to cover the entire thing. Besides
being ugly (this shows up when using ovs-ofctl in the default
configuration), it exposes the internal size of the field. While this
shouldn't be an issue since specific protocol fields (such as Geneve
options) have fixed max sizes even if the OVS implementation is extended,
it's still not a great idea.

If we instead use NXAST_REG_LOAD2 in cases where there isn't a suitable
OpenFlow alternative, both problems are avoided:

actions=set_field:0xa->tun_metadata0

This prefers NXAST_REG_LOAD2 for variable length fields since they would
all generally have the same problems. In addition, since the concept of
this type of field is fairly new, there are no backwards compatibility
issues.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Suppress flow attribute probe.
Alin Serdean [Mon, 13 Jul 2015 16:42:28 +0000 (16:42 +0000)]
datapath-windows: Suppress flow attribute probe.

This patch surpresses flow attribute probing in the windows datapath.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agotests: Avoid nonportable "sed -i".
Ben Pfaff [Thu, 27 Aug 2015 18:11:03 +0000 (11:11 -0700)]
tests: Avoid nonportable "sed -i".

"sed -i" isn't entirely portable, and we can avoid it by using the
argument to check_logs as intended.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
8 years agodatapath-windows: Enable failure after restarting extension
Sorin Vinturis [Wed, 15 Jul 2015 14:50:15 +0000 (14:50 +0000)]
datapath-windows: Enable failure after restarting extension

If the extension was previously enabled and running, after issuing a
restart, stop+start, the extension fails to be enabled. This happens
because the extension's DeviceObject is not yet initialized before the
FilterAttach routine is called.

This patch addresses this issue.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/96
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath: check for el6 kernels for per_cpu
Flavio Leitner [Fri, 28 Aug 2015 13:37:11 +0000 (10:37 -0300)]
datapath: check for el6 kernels for per_cpu

The OVS hook has been backported so it doesn't work to
decide per_cpu work arounds.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
8 years agodatapath: check for backported ip_is_fragment
Flavio Leitner [Fri, 28 Aug 2015 13:37:10 +0000 (10:37 -0300)]
datapath: check for backported ip_is_fragment

Red Hat Enterprise Linux 6 has backported it from upstream,
so check for ip_is_fragment instead of kernel version.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
8 years agodatapath: check for backported proto_ports_offset
Flavio Leitner [Fri, 28 Aug 2015 13:37:09 +0000 (10:37 -0300)]
datapath: check for backported proto_ports_offset

Red Hat Enterprise Linux 6 has backported it from upstream,
so check for proto_ports_offset instead of kernel version.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
8 years agodatapath: improve l4_rxhash regex
Flavio Leitner [Fri, 28 Aug 2015 13:37:08 +0000 (10:37 -0300)]
datapath: improve l4_rxhash regex

Red Hat Enterprise Linux 6 has a comment saying
that it doesn't support l4_rxhash which matches
the current grep regex.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
8 years agoAUTHORS: Add Sairam Venugopal
Nithin Raju [Fri, 28 Aug 2015 00:45:06 +0000 (17:45 -0700)]
AUTHORS: Add Sairam Venugopal

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoUpdate my email address.
Alex Wang [Thu, 27 Aug 2015 23:57:41 +0000 (23:57 +0000)]
Update my email address.

Signed-off-by: Alex Wang <ee07b291@gmail.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
8 years agoflow: Workaround for GCC false-positive compilation error.
Jarno Rajahalme [Thu, 27 Aug 2015 17:48:03 +0000 (10:48 -0700)]
flow: Workaround for GCC false-positive compilation error.

Without an explicit bounds check GCC 4.9 issues an array out of bounds
error.  This patch adds explicit checks which will however be
optimized away as the relevant parameters are compile-time constants.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agometa-flow: Initialize the whole exact_match_mask.
Jarno Rajahalme [Thu, 27 Aug 2015 17:48:03 +0000 (10:48 -0700)]
meta-flow: Initialize the whole exact_match_mask.

Initialize the whole 'exact_match_mask' in global scope and use it in
mf_mask_field_and_prereqs() and mf_mask_field().

Requested-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoovs-ctl: Fix indentation when deleting bridges.
Thadeu Lima de Souza Cascardo [Thu, 27 Aug 2015 15:07:31 +0000 (12:07 -0300)]
ovs-ctl: Fix indentation when deleting bridges.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoexpr: Add and clarify a few comments and assertions.
Ben Pfaff [Thu, 27 Aug 2015 05:23:40 +0000 (22:23 -0700)]
expr: Add and clarify a few comments and assertions.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
8 years agosset: New function sset_intersect().
Ben Pfaff [Wed, 26 Aug 2015 04:24:38 +0000 (21:24 -0700)]
sset: New function sset_intersect().

This will acquire its first user in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
8 years agodatapath-windows: Fix iterator in NlAttrParse()
Sairam Venugopal [Wed, 26 Aug 2015 21:37:16 +0000 (14:37 -0700)]
datapath-windows: Fix iterator in NlAttrParse()

Signed-off-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agometa-flow: Minor refactoring.
Jarno Rajahalme [Tue, 25 Aug 2015 20:55:03 +0000 (13:55 -0700)]
meta-flow: Minor refactoring.

Change mf_mask_field_and_prereqs() to take a struct flow_wildcards
pointer instead of a struct flow pointer so that we can use
WC_MASK_FIELD() and WC_MASK_FIELD_MASK() macros to wildcard fields.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agometa-flow: Avoid unnecessary large memset.
Jarno Rajahalme [Wed, 26 Aug 2015 22:45:46 +0000 (15:45 -0700)]
meta-flow: Avoid unnecessary large memset.

mf_mask_field_and_prereqs() used to memset a static variable again and
again.  Now that mf_value is larger (due to tun_metadata field), this
is more expensive.  Avoid this by using static initialization.

mf_mask_field_and_prereqs() is used only for set field and reg move,
which never deal with the tun_metadata field as a whole.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto-dpif-rid: Make lookups cheaper.
Jarno Rajahalme [Tue, 25 Aug 2015 20:55:03 +0000 (13:55 -0700)]
ofproto-dpif-rid: Make lookups cheaper.

This patch removes a large-ish copy from the recirculation context
lookup, which is performed for each recirculated upcall and
revalidation of a recirculating flow.

Tunnel metadata has grown large since the addition of Geneve options,
and copying that metadata for performing a lookup is not necessary.
Change recirc_metadata to use a pointer to struct flow_tnl, and only
copy the tunnel metadata when needed, and only copy as little of it as
possible.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoclassifier: Retire partitions.
Jarno Rajahalme [Tue, 25 Aug 2015 20:55:03 +0000 (13:55 -0700)]
classifier: Retire partitions.

Classifier partitions allowed skipping subtables when if was known
from the flow's metadata field that the subtable cannot possibly
match.  This functionality was later implemented in a more general
fashion by staged lookup, where the first stage also covers the
metadata field, among the rest of the non-packet fields in the struct
flow.  While in theory skipping a subtable on the basis of the
metadata field alone could produce more effective wildcards, on the
basis of our testsuite coverage it does not seem to be the case, as
removing the partitioning feature did not result in any test failures.

Removing the partitioning feature makes classifier lookups roughly 20%
faster when a wildcard mask is not needed, and roughly 10% faster when
a wildcard mask is needed, as tested with the test-classifier
benchmark with one lookup thread.

Found by profiling with 'perf'.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoflow: Add struct flowmap.
Jarno Rajahalme [Tue, 25 Aug 2015 20:55:03 +0000 (13:55 -0700)]
flow: Add struct flowmap.

Struct miniflow is now sometimes used just as a map.  Define a new
struct flowmap for that purpose.  The flowmap is defined as an array of
maps, and it is automatically sized according to the size of struct
flow, so it will be easier to maintain in the future.

It would have been tempting to use the existing struct bitmap for this
purpose. The main reason this is not feasible at the moment is that
some flowmap algorithms are simpler when it can be assumed that no
struct flow member requires more bits than can fit to a single map
unit. The tunnel member already requires more than 32 bits, so the map
unit needs to be 64 bits wide.

Performance critical algorithms enumerate the flowmap array units
explicitly, as it is easier for the compiler to optimize, compared to
the normal iterator.  Without this optimization a classifier lookup
without wildcard masks would be about 25% slower.

With this more general (and maintainable) algorithm the classifier
lookups are about 5% slower, when the struct flow actually becomes big
enough to require a second map.  This negates the performance gained
in the "Pre-compute stage masks" patch earlier in the series.

Requested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoclassifier: Pre-compute stage masks.
Jarno Rajahalme [Tue, 25 Aug 2015 20:55:03 +0000 (13:55 -0700)]
classifier: Pre-compute stage masks.

This makes stage mask computation happen only when a subtable is
inserted and allows simplification of the main lookup function.

Classifier benchmark shows that this speeds up the classification
(with wildcards) about 5%.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agonroff: Allow comments in more contexts.
Ben Pfaff [Wed, 26 Aug 2015 15:11:31 +0000 (08:11 -0700)]
nroff: Allow comments in more contexts.

Reported-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agocoverage: Add coverage_try_clear() for performance-critical threads.
Alex Wang [Thu, 13 Aug 2015 18:31:49 +0000 (11:31 -0700)]
coverage: Add coverage_try_clear() for performance-critical threads.

For performance-critical threads like pmd threads, we currently make them
never call coverage_clear() to avoid contention over the global mutex
'coverage_mutex'.  So, even though pmd thread still keeps updating their
thread-local coverage count, the count is never attributed to the global
total.  But it is useful to have them available.

This commit makes this happen by implementing a non-contending version
of the clear function, coverage_try_clear().  The function will use
the ovs_mutex_trylock() and return immediately if the mutex cannot
be acquired.  Since threads like pmd thread are always busy-looping,
the lock will eventually be acquired.

Requested-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com
8 years agoovs-pki: Handle Windows style path.
Gurucharan Shetty [Mon, 24 Aug 2015 22:44:20 +0000 (15:44 -0700)]
ovs-pki: Handle Windows style path.

Reported-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoovn-controller: Minor tweaks to man page.
Justin Pettit [Tue, 25 Aug 2015 01:10:08 +0000 (18:10 -0700)]
ovn-controller: Minor tweaks to man page.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-northd: Add man page describing daemon.
Justin Pettit [Sat, 22 Aug 2015 20:24:42 +0000 (13:24 -0700)]
ovn-northd: Add man page describing daemon.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-controller: Document supported ovs-appctl commands.
Justin Pettit [Sat, 22 Aug 2015 20:09:29 +0000 (13:09 -0700)]
ovn-controller: Document supported ovs-appctl commands.

Currently only "exit" is supported, but more will be added shortly.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-controller: Update man page comment on mid-run changes.
Justin Pettit [Mon, 24 Aug 2015 16:42:35 +0000 (09:42 -0700)]
ovn-controller: Update man page comment on mid-run changes.

It's no longer necessary to restart ovn-controller when the chassis name
or integration bridge changes.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoofp-parse: Add "ipv4" and "ip4" shorthand notations.
Justin Pettit [Mon, 24 Aug 2015 22:39:37 +0000 (15:39 -0700)]
ofp-parse: Add "ipv4" and "ip4" shorthand notations.

This will allow ovs-ofctl to accept them on input and provides some
symmetry with the IPv6 versions.  Documentation was not added, since
output will always be "ip".

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovs-ofctl: Document missing shorthand notations.
Justin Pettit [Mon, 24 Aug 2015 22:22:12 +0000 (15:22 -0700)]
ovs-ofctl: Document missing shorthand notations.

Some new shorthands were added to ovs-ofctl, but not documented in the
man page.  This adds most of them.  A couple were left out that would
print differently than they would be input.  For example, we accept
"ip6" and "ipv6", but we would output it as "ipv6", so "ip6" is not
documented.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn: Fix example in comment in expr.c.
Justin Pettit [Sat, 22 Aug 2015 20:02:02 +0000 (13:02 -0700)]
ovn: Fix example in comment in expr.c.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agodatapath: Make 100 percents packets sampled when sampling rate is 1.
Wenyu Zhang [Tue, 25 Aug 2015 03:56:44 +0000 (20:56 -0700)]
datapath: Make 100 percents packets sampled when sampling rate is 1.

When sampling rate is 1, the sampling probability is UINT32_MAX. The packet
should be sampled even the prandom32() generate the number of UINT32_MAX.
And none packet need be sampled when the probability is 0.

Signed-off-by: Wenyu Zhang <wenyuz@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: e05176a3283 ("openvswitch: Make 100 percents packets
sampled when sampling rate is 1.")

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
8 years agoofp-print: Fix redundant expression.
Joe Stringer [Wed, 5 Aug 2015 20:31:25 +0000 (13:31 -0700)]
ofp-print: Fix redundant expression.

'features' is always a valid pointer to something on the stack, so
checking (!features || ...) is the same as checking (false || ...).
Simplify the expression.

Found by MIT STACK undefined behaviour checker.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoSet release dates for 2.4.0.
Justin Pettit [Fri, 21 Aug 2015 00:23:56 +0000 (17:23 -0700)]
Set release dates for 2.4.0.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agodocs: Fix typo in README-native-tunneling.md
Wei li [Mon, 24 Aug 2015 00:30:27 +0000 (08:30 +0800)]
docs: Fix typo in README-native-tunneling.md

Signed-off-by: Wei li <liw@dtdream.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoovn-controller-vtep.at: Remove all 'Broken pipe' warning logs from
Alex Wang [Sat, 22 Aug 2015 16:26:54 +0000 (09:26 -0700)]
ovn-controller-vtep.at: Remove all 'Broken pipe' warning logs from
ovsdb-server.log.

This commit makes the OVN_CONTROLLER_VTEP_STOP remove all 'Broken pipe'
warning logs from ovsdb-server.log before running 'check_log'.  This is in
that *ctl command (e.g. ovn-nbctl) exits right after committing the change
to database;  however, in reaction, some daemon (e.g. ovn-controller-vtep)
may immediately update the database;  this later update may cause database
sending update back to *ctl command if *ctl has not proceeded to exit yet;
and if *ctl command exits before database calling send, the send will fail
with 'Broken pipe' error.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoofp-util: For OF1.0, don't wildcard PCP field when 802.1Q header absent.
Ben Pfaff [Fri, 21 Aug 2015 00:07:40 +0000 (17:07 -0700)]
ofp-util: For OF1.0, don't wildcard PCP field when 802.1Q header absent.

OpenFlow 1.0.1 says:

    The dl_vlan_pcp field must be ignored when the OFPFW_DL_VLAN wildcard
    bit is set or when the dl_vlan value is set to OFP_VLAN_NONE.  Fields
    that are ignored don’t need to be wildcarded and should be set to 0.

Previously, OVS wildcarded the PCP field when dl_vlan was OFP_VLAN_NONE,
but this commit changes the behavior to that suggested above: the PCP
field should not be wildcarded (and should be set to 0, but the code
already did that).

This commit only changes the translation from OVS's internal flow format
to the OpenFlow 1.0 wire format.  Translation in the other direction and
to other formats is unaffected.

Found by OFTest.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agoovn: Add bootstrap options for OVN controllers.
Gurucharan Shetty [Wed, 19 Aug 2015 22:55:21 +0000 (15:55 -0700)]
ovn: Add bootstrap options for OVN controllers.

This lets the central controller to push
its certificate to the OVN controllers.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoovsdb-server: Add the ability to push peer-cert.
Gurucharan Shetty [Wed, 19 Aug 2015 22:42:07 +0000 (15:42 -0700)]
ovsdb-server: Add the ability to push peer-cert.

In OVN, ovsdb-server is the daemon that manages the databases
and can be called as the central controller. So it would be
nice for ovsdb-server to be able to push its self-signed
certificate to all the other nodes where ovn-controller runs.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoovs-sandbox: Add support for ovn-controller-vtep.
Russell Bryant [Fri, 21 Aug 2015 17:42:18 +0000 (13:42 -0400)]
ovs-sandbox: Add support for ovn-controller-vtep.

When ovs-sandbox is run with ovn enabled, create the vtep database and
run ovn-controller-vtep.  This lets you do some basic testing with
ovn-controller-vtep.  For example:

    $ make sandbox SANDBOXFLAGS="--ovn"
    $ vtep-ctl add-ps ps0

After those commands, you can see that ovn-controller-vtep added a
Chassis row to OVN_Southbound for the physical switch.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoovs-vsctl: Add the missing ssl bootstrapping option parsing.
Gurucharan Shetty [Wed, 19 Aug 2015 16:21:04 +0000 (09:21 -0700)]
ovs-vsctl: Add the missing ssl bootstrapping option parsing.

'man ovs-vsctl' mentions that ovs-vsctl can bootstrap itself
by getting the certificate from the server. But the option
was never parsed in the code.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agotun-metadata: Always set option present when copying data.
Jesse Gross [Wed, 12 Aug 2015 01:46:14 +0000 (18:46 -0700)]
tun-metadata: Always set option present when copying data.

Whenever we write into a tunnel option field, we also need to mark
it as significant. If we don't, then the data will later be ignored.

We currently do this in every case except for flow metadata. This causes
us to not correctly serialize the tunnel metadata for Packet Ins to the
controller.

Rather than separately writing the data and marking the options as present,
it is better to combine the two steps to ensure that one can never be
done without the other.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agohmap: Ensure iterator is NULL after iteration.
Russell Bryant [Tue, 18 Aug 2015 18:43:18 +0000 (11:43 -0700)]
hmap: Ensure iterator is NULL after iteration.

The HMAP_FOR_EACH_()* macros had a usability issue where the iterator
was only NULL at the completion of iteration if the hmap_node was the
first struct member.  This change ensures that the iterator is set to
NULL when iteration ends normally without a 'break'.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agotest-classifier: Add benchmark.
Jarno Rajahalme [Fri, 21 Aug 2015 19:49:46 +0000 (12:49 -0700)]
test-classifier: Add benchmark.

Add a benchmark command for classifier lookup performance testing.

Running the test-classifier without arguments of with "--help" will
print the following usage:

usage: ovstest test-classifier benchmark <n_rules> <n_priorities> <n_subtables> <n_threads> <n_lookups>

where:

<n_rules>      - The number of rules to install for lookups.  More rules
                 makes misses less likely.
<n_priorities> - How many different priorities to use.  Using only 1
                 priority will force lookups to continue through all
                 subtables.
<n_subtables>  - Number of subtables to use.  Normally a classifier has
                 rules with different kinds of masks, resulting in
                 multiple subtables (one per mask).  However, in some
                 special cases a table may consist of only one kind of
                 rules, so there will be only one subtable.
<n_threads>    - How many lookup threads to use.  Using one thread should
                 give less variance accross runs, but classifier
                 scaling can be tested with multiple threads.
<n_lookups>    - How many lookups each thread should perform.

For testing the classifier is filled with <n_rules> rules using
<n_subtables> different mask patterns and <n_priorities> different
priorities.  A random set of lookup flows are created, and <n_threads>
lookup threads are spawned to perform <n_lookups> lookups each.  The
count of hits and misses, as well as the overall execution time is
reported.

Example run:

$ tests/ovstest test-classifier benchmark 1000 1 30 1 3800000

Benchmarking with:
1000 rules with 1 priorities in 30 tables, 1 threads doing 3800000 lookups each

Without wildcards:

hits: 461520, misses: 3338480
classifier lookups:    386 ms, 9844559 lookups/sec

With wildcards:

hits: 461520, misses: 3338480
classifier lookups:    866 ms, 4387990 lookups/sec

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agorhel: Define rundir for older distros.
Flavio Leitner [Thu, 13 Aug 2015 18:39:33 +0000 (15:39 -0300)]
rhel: Define rundir for older distros.

Some older distros might not define _rundir yet so in this case the RPM
build breaks.  This patch defines it to Fedora's default.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoovs-ctl: do not attempt to restore flows when called with --delete-bridges
Simon Horman [Thu, 20 Aug 2015 23:45:34 +0000 (16:45 -0700)]
ovs-ctl: do not attempt to restore flows when called with --delete-bridges

When called with --delete-bridges saved flows cannot be restored as the
bridges to which they belong no longer exist. This results in the following
error messages on restart.

ovs-ofctl: br0 is not a bridge or a socket
Restoring saved flows ... failed!

Although there is no effect of this error other than the message
it seems worth avoiding. This patch does so by skipping saving of flows
when --delete-bridges is in effect.

As flows are no longer saved when --delete-bridges is in effect
a side-effect of this change is that restart may be faster when
there are many flows.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agometa-flow: Fix ip_frag handling in mf_set_wild().
Jarno Rajahalme [Thu, 20 Aug 2015 20:10:07 +0000 (13:10 -0700)]
meta-flow: Fix ip_frag handling in mf_set_wild().

The wildcard bits were set when they should have been cleared.

Found by inspection.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoodp-util: Fix put_nd_key().
Jarno Rajahalme [Thu, 20 Aug 2015 20:10:07 +0000 (13:10 -0700)]
odp-util: Fix put_nd_key().

Actually copy the 'nd_target' from the key.

Found by inspection.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agotunneling: Remove gre64 tunnel support.
Pravin B Shelar [Tue, 18 Aug 2015 19:18:47 +0000 (12:18 -0700)]
tunneling: Remove gre64 tunnel support.

GRE64 was introduced to extend gre key from 32-bit to 64-bit using
gre-key and sequence number field. But GRE64 is not standard
protocol. There are not many users of this protocol. Therefore we
have decided to remove it.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
8 years agoovn-controller-vtep.at: Check the successful exit of ovn-controller-vtep.
Alex Wang [Wed, 19 Aug 2015 00:44:07 +0000 (17:44 -0700)]
ovn-controller-vtep.at: Check the successful exit of ovn-controller-vtep.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofp-util: Use correct error for indirect group with more than one bucket.
Ben Pfaff [Mon, 25 May 2015 22:35:53 +0000 (15:35 -0700)]
ofp-util: Use correct error for indirect group with more than one bucket.

OpenFlow 1.5 says:

    If the group-mod request specifies more than one bucket for a group of
    type Indirect, the switch must refuse to add the group entry and must
    send an ofp_error_msg with OFPET_GROUP_MOD_FAILED type and
    OFPGMFC_INVALID_GROUP code.

Older versions don't specify a particular error for this case, so we might
as well use it for older OpenFlow also.

Found by OFTest.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agoovn: Add comments to encourage syncing MFF_LOG_* with documentation.
Ben Pfaff [Wed, 19 Aug 2015 18:53:04 +0000 (11:53 -0700)]
ovn: Add comments to encourage syncing MFF_LOG_* with documentation.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-sbctl: Avoid cast in lflow_cmp().
Ben Pfaff [Wed, 19 Aug 2015 19:11:38 +0000 (12:11 -0700)]
ovn-sbctl: Avoid cast in lflow_cmp().

Using casts, IMO, makes it harder to spot what's actually going on.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agosystem-traffic: Add basic vxlan tunnel sanity test.
Joe Stringer [Wed, 12 Aug 2015 21:01:30 +0000 (14:01 -0700)]
system-traffic: Add basic vxlan tunnel sanity test.

This test is skipped if the 'ip' command cannot interpret the vxlan 'dstport'
option; this is used as a proxy for detecting native kernel support for this
tunnel type.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agosystem-macros: Don't explicitly remove bridge.
Joe Stringer [Wed, 12 Aug 2015 21:01:29 +0000 (14:01 -0700)]
system-macros: Don't explicitly remove bridge.

Depending on the kernel in use, manually removing a bridge during
OVS_VSWITCHD_STOP can cause the kernel to send a route update that
refers to the bridge device which is being deleted. OVS can't make sense
of these messages, resulting in logs like the following:

route_table|DBG|Could not find interface name[702]: No such device or
address
netlink_notifier|WARN|received bad netlink message

One such example kernel is the Ubuntu 3.16.0-33-generic linux package.

The bridge doesn't need to be explicitly removed, as the OVSDB
configuration for each test will be cleared before executing the next.
Drop this extra step.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agosystem-macros: Create ADD_BR variant.
Joe Stringer [Wed, 12 Aug 2015 21:01:28 +0000 (14:01 -0700)]
system-macros: Create ADD_BR variant.

This patch splits ADD_BR into two commands, so they can be used from
different contexts:

ADD_BR(...) is a standalone command to add a bridge to OVS, and allows
additional ovs-vsctl arguments to be passed. It uses _ADD_BR().
_ADD_BR(...) is the implementation-specific ovs-vsctl arguments to
set up the correct datapath type for userspace or kmod tests.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agosystem-traffic: Check ping-by-ping output.
Joe Stringer [Wed, 12 Aug 2015 21:01:27 +0000 (14:01 -0700)]
system-traffic: Check ping-by-ping output.

Rather than saving all of the ping output to a file then checking at the
end, check each ping and fail as soon as there is a connectivity
failure.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agosystem-common-macros: Allow quotes in NS_EXEC().
Joe Stringer [Wed, 12 Aug 2015 21:01:26 +0000 (14:01 -0700)]
system-common-macros: Allow quotes in NS_EXEC().

This allows arbitrary commands to be passed into the NS_EXEC macro to be
executed within a namespace, including commands that have quotes and
commands chained together.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agoovn: Free default db befor exit.
Russell Bryant [Tue, 18 Aug 2015 18:26:21 +0000 (11:26 -0700)]
ovn: Free default db befor exit.

The static result of default_db() was malloc'd but not freed before
exit.  Make the static result global and free it before exit.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Acked-by: Alex Wang <alexw@nicira.com>
8 years agoovn-controller-vtep: Make 'ovnsb_remote' and 'vtep_remote' free-able.
Alex Wang [Tue, 18 Aug 2015 06:12:55 +0000 (23:12 -0700)]
ovn-controller-vtep: Make 'ovnsb_remote' and 'vtep_remote' free-able.

Found by inspection.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-controller-vtep: Call binding_cleanup() before gateway_cleanup().
Alex Wang [Tue, 18 Aug 2015 06:09:57 +0000 (23:09 -0700)]
ovn-controller-vtep: Call binding_cleanup() before gateway_cleanup().

Otherwise, binding_cleanup() will be a no-op since all related chassis
entries are deleted in gateway_cleanup().

Found by inspection.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-controller-vtep: Fix dereference of NULL pointer.
Alex Wang [Tue, 18 Aug 2015 06:02:14 +0000 (23:02 -0700)]
ovn-controller-vtep: Fix dereference of NULL pointer.

Found by inspection.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-northd: Ability to detach on Windows.
Gurucharan Shetty [Mon, 17 Aug 2015 21:54:16 +0000 (14:54 -0700)]
ovn-northd: Ability to detach on Windows.

A unit test for ovn-northd was hanging because ovn-northd
running on Windows failed to detach. The detach function
for Windows is implemented inside "service_start()".

Also handle Windows services.

Reported-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
8 years agodatapath: Fix L4 checksum handling when dealing with IP fragments
Glenn Griffin [Mon, 17 Aug 2015 14:50:51 +0000 (07:50 -0700)]
datapath: Fix L4 checksum handling when dealing with IP fragments

openvswitch modifies the L4 checksum of a packet when modifying
the ip address. When an IP packet is fragmented only the first
fragment contains an L4 header and checksum. Prior to this change
openvswitch would modify all fragments, modifying application data
in non-first fragments, causing checksum failures in the
reassembled packet.

Signed-off-by: Glenn Griffin <ggriffin.kernel@gmail.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: 3576fd794b3 ("openvswitch: Fix L4 checksum handling when
dealing with IP fragments").

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
8 years agodatapath: allocate nr_node_ids flow_stats instead of num_possible_nodes
Chris J Arges [Mon, 17 Aug 2015 14:40:43 +0000 (07:40 -0700)]
datapath: allocate nr_node_ids flow_stats instead of num_possible_nodes

Some architectures like POWER can have a NUMA node_possible_map that
contains sparse entries. This causes memory corruption with openvswitch
since it allocates flow_cache with a multiple of num_possible_nodes() and
assumes the node variable returned by for_each_node will index into
flow->stats[node].

Use nr_node_ids to allocate a maximal sparse array instead of
num_possible_nodes().

The crash was noticed after 3af229f2 was applied as it changed the
node_possible_map to match node_online_map on boot.
Fixes: 3af229f2071f5b5cb31664be6109561fbe19c861

Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: bac541e4631 ("openvswitch: allocate nr_node_ids flow_stats
instead of num_possible_nodes")

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
8 years agodatapath: disable LRO
Jiri Benc [Mon, 17 Aug 2015 14:38:01 +0000 (07:38 -0700)]
datapath: disable LRO

Currently, openvswitch tries to disable LRO from the user space. This does
not work correctly when the device added is a vlan interface, though.
Instead of dealing with possibly complex stacked cross name space relations
in the user space, do the same as bridging does and call dev_disable_lro in
the kernel.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: 640b2b107c ("openvswitch: disable LRO").

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
8 years agoovn-controller-vtep.at: Skip test when using Windows setup.
Alex Wang [Mon, 17 Aug 2015 22:04:50 +0000 (15:04 -0700)]
ovn-controller-vtep.at: Skip test when using Windows setup.

The 'ovs-vtep' simulator is not ported to Windows.  So, for now,
just skip all tests in ovn-controller-vtep.at when running in
Windows.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Gurucharan Shetty <gshetty@nicira.com>
8 years agoovn-controller-vtep: Add binding module.
Alex Wang [Sat, 4 Jul 2015 05:55:24 +0000 (22:55 -0700)]
ovn-controller-vtep: Add binding module.

This commit adds the binding module to ovn-controller-vtep.  The
module will scan through the Port_Binding table in ovnsb.  If there is
a port binding entry for a logical switch on the vtep gateway chassis's
"vtep_logical_switches", sets the port binding's chassis column to the
vtep gateway chassis.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-controller-vtep.at: Fix intermittent test failure.
Alex Wang [Sun, 16 Aug 2015 07:06:24 +0000 (00:06 -0700)]
ovn-controller-vtep.at: Fix intermittent test failure.

When testing the recreation of 'chassis' table entry by 'ovn-controller-
vtep'.  The removal of 'chassis' table entry by the 'ovn-sbctl' could
cause 'Broken pipe' warning in ovsdb-server.log.  This is due to the
race between 'ovn-sbctl' exiting and 'ovn-controller-vtep' adding
the chassis back.  So, if the 'ovn-sbctl' exits right when the
ovsdb-server tries to send update of readd of the deleted 'chassis',
the sending will fail with 'Broken pipe' error.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-sbctl: Make 'chassis-del' delete all encaps.
Alex Wang [Sun, 16 Aug 2015 06:52:42 +0000 (23:52 -0700)]
ovn-sbctl: Make 'chassis-del' delete all encaps.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-controller-vtep.at: Fix intermittent test failure.
Alex Wang [Sun, 16 Aug 2015 06:44:45 +0000 (23:44 -0700)]
ovn-controller-vtep.at: Fix intermittent test failure.

The test waits until grep no vlan '200' from the VTEP 'vlan_binding'
column.  However, string '200' could also appear in other 'vlan_binding'
entry's uuid value.  Instead, we should grep for '200='.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agorhel: add installed but not packaged OVN tools
Flavio Leitner [Thu, 13 Aug 2015 19:06:29 +0000 (16:06 -0300)]
rhel: add installed but not packaged OVN tools

This patch adds the following to OVN %files:
   /usr/bin/ovn-controller-vtep
   /usr/bin/ovn-sbctl
   /usr/share/man/man8/ovn-controller-vtep.8.gz
   /usr/share/man/man8/ovn-sbctl.8.gz

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoflow: Ignore invalid ICMPv6 fields when parsing packets
Simon Horman [Thu, 13 Aug 2015 07:55:32 +0000 (16:55 +0900)]
flow: Ignore invalid ICMPv6 fields when parsing packets

There is a miss-match between the handling of invalid ICMPv6 fields in the
implementations of parse_icmpv6() in user-space and in the kernel datapath.

This patch addresses that by modifying the user-space implementation to
match that of the kernel datapath; processing is terminated without
rather than with an error and partial information is cleared.

With these changes the user-space implementation of parse_icmpv6()
never returns an error. Accordingly the return type and caller have been
updated.

The original motivation for this is to allow matching the ICMPv6 type and
code of packets with invalid neighbour discovery options although only the
change around the '(!opt_len || opt_len > *sizep)' conditional is necessary
to achieve that goal.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
8 years agoofproto: Allow in-place modifications of datapath flows.
Ethan Jackson [Tue, 4 Aug 2015 01:43:53 +0000 (18:43 -0700)]
ofproto: Allow in-place modifications of datapath flows.

There are certain use cases (such as bond rebalancing) where a
datapath flow's actions may change, while it's wildcard pattern
remains the same.  Before this patch, revalidators would note the
change, delete the flow, and wait for the handlers to install an
updated version.  This is inefficient, as many packets could get
punted to userspace before the new flow is finally installed.

To improve the situation, this patch implements in place modification
of datapath flows.  If the revalidators detect the only change to a
given ukey is its actions, instead of deleting it, it does a put with
the MODIFY flag set.

Signed-off-by: Ethan J. Jackson <ethan@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agoofproto-dpif-upcall: Make ukey actions modifiable with RCU.
Ethan Jackson [Wed, 12 Aug 2015 21:50:54 +0000 (14:50 -0700)]
ofproto-dpif-upcall: Make ukey actions modifiable with RCU.

Future patches will need to modify ukey actions in some instances.
This patch makes this possible by protecting them with RCU.  It also
adds thread safety checks to enforce the new protection mechanism.

Signed-off-by: Ethan J. Jackson <ethan@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agodb-ctl-base: Allow print rows that weak reference to table in
Alex Wang [Thu, 13 Aug 2015 04:29:06 +0000 (21:29 -0700)]
db-ctl-base: Allow print rows that weak reference to table in
'cmd_show_table'.

Sometimes, it is desirable to print the table with weak reference to
the table specified in 'struct cmd_show_table'.  For example the
Port_Binding table rows in OVN_Southbound database that refer to the
same Chassis table row can be printed under the same chassis entry
in 'ovn-sbctl show' output.

To achieve it, this commit adds a new struct in 'struct cmd_show_table'
that allows users to print a table with weak reference to 'table'
specified in 'struct cmd_show_table'.  The 'ovn-sbctl' which now prints
the Port_Binding entries with Chassis table, is the first user of this
new feature.

Requested-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
8 years agoovn-sbctl: Print stage name in addition to table number.
Justin Pettit [Thu, 13 Aug 2015 00:42:14 +0000 (17:42 -0700)]
ovn-sbctl: Print stage name in addition to table number.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
8 years agoovn-northd: Store name of the logical flow stage in external-ids.
Justin Pettit [Wed, 12 Aug 2015 23:40:59 +0000 (16:40 -0700)]
ovn-northd: Store name of the logical flow stage in external-ids.

This will be useful in a future commit.

It also introduces #define's for logical stages instead of in-place
constants.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
8 years agoclassifier: Do not use mf_value.
Jarno Rajahalme [Thu, 13 Aug 2015 00:03:07 +0000 (17:03 -0700)]
classifier: Do not use mf_value.

mf_value has grown bigger than needed for storing the biggest
supported prefix (IPv6 address length).  Define a new type to be used
instead of mf_value.

This makes classifier lookups a bit faster.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
8 years agoovn: Add lflow-list to ovn-sbctl.
Russell Bryant [Wed, 12 Aug 2015 23:53:09 +0000 (16:53 -0700)]
ovn: Add lflow-list to ovn-sbctl.

I frequently view the contents of the Logical_Flow table while working
on OVN.  Add a command that can output the contents of this table in a
sorted way that makes it easier to read through.  It's sorted by
logical datapath, pipeline, table id, priority, and match.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Acked-by: Alex Wang <alexw@nicira.com>