cascardo/ovs.git
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>
8 years agoofp-util: Convert flow_metadata to match structure.
Jesse Gross [Sat, 16 May 2015 00:03:17 +0000 (17:03 -0700)]
ofp-util: Convert flow_metadata to match structure.

We have a special flow_metadata structure to represent the parts
of a packet that aren't carried in the payload itself. This is
used in the case where we need to send the packet as a Packet In
to an OpenFlow controller. This is a subset of the more general
struct flow.

In practice, almost all operations we do on this structure involve
converting it to or from a match or have code that is the same as
a match. Serialization to NXM and back is done as a match. There
is special flow_metadata formatting code that is almost identical
to match formatting.

The uses for struct flow_metadata aren't performance critical
when it comes to memory, so we can save quite a bit of code by
just using a match structure directly instead. In addition, as
metadata increases and becomes more complex (Geneve options require
some special handling beyond just additional fields), using the
match structure means we only have to do this work in one place.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoThis commit adds the windows installer to the OVS tree.
Alin Gabriel Serdean [Fri, 5 Jun 2015 22:06:30 +0000 (01:06 +0300)]
This commit adds the windows installer to the OVS tree.

Requirements are the following:
Visual Studio Community 2013
WiX Toolset 3.9
Microsoft_VC120_CRT_x86.msm

More detailed information on the requirements and build instructions
can be found under:
https://github.com/cloudbase/ovs-windows-installer/blob/master/README.rst

To run and make the installer issue the following:

./boot.sh
./configure CC=./build-aux/cccl LD="`which link`" \
LIBS="-lws2_32 -liphlpapi" --prefix="C:/openvswitch/usr" \
--localstatedir="C:/openvswitch/var" --sysconfdir="C:/openvswitch/etc" \
--with-pthread="C:/pthread" --with-vstudiotarget="Release"

make clean && make -j16 windows_installer

To uninstall one could use the following Powershell commandlets:
$app = Get-WmiObject -Class Win32_Product | Where-Object `
 { $_.Name -match "Open Vswitch" }

$app.Uninstall()

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Co-authored-by: Alessandro Pilotti <apilotti@cloudbasesolutions.com>
Signed-off-by: Alessandro Pilotti <apilotti@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
8 years agotests: Fix unit test failure.
Alex Wang [Sun, 7 Jun 2015 20:31:23 +0000 (13:31 -0700)]
tests: Fix unit test failure.

This commit fixes unit test failure caused by commit f171fa8 (odp-util:
Make sure vlan tci mask has exact match for VLAN_CFI.).

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoovs-appctl-bashcomp: bash_completion shouldn't modify user environment.
Zang MingJie [Sun, 7 Jun 2015 20:21:18 +0000 (13:21 -0700)]
ovs-appctl-bashcomp: bash_completion shouldn't modify user environment.

Signed-off-by: Zang MingJie <zealot0630@gmail.com>
Acked-by: Alex Wang <alexw@nicira.com>
8 years agoodp-util: Make sure vlan tci mask has exact match for VLAN_CFI.
Alex Wang [Sun, 7 Jun 2015 18:38:52 +0000 (11:38 -0700)]
odp-util: Make sure vlan tci mask has exact match for VLAN_CFI.

OVS datapath has check which prevents the installation of flow
that matches VLAN TCI but does not have exact match for VLAN_CFI
bit.  To follow this rule, ovs userspace must make sure the
flow key for datapath flow matching VLAN TCI has exact match for
VLAN_CFI bit.

Before this commit, this is not enforced, so OpenFlow flow like
"vlan_tci=0x000a/0x0fff,action=output:local" can generate datapath
flow like "vlan(vid=10/0xfff,pcp=0/0x0,cfi=1/0)".

With the OVS datapath check, the installation of such datapath
flow will be rejected with:
"|WARN|system@ovs-system: failed to put[create][modify] (Invalid argument)"

This commit makes ovs userspace always exact match the VLAN_CFI
bit if the flow matches VLAN TCI.

Reported-by: Ronald Lee <ronaldlee@vmware.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agoAdd support functions for 8021.ad push and pop vlan.
Thomas F. Herbert [Tue, 2 Jun 2015 17:55:28 +0000 (13:55 -0400)]
Add support functions for 8021.ad push and pop vlan.

Changes to allow the tpid to be specified and all vlan tpid checking to be
generalized.

Signed-off-by: Thomas F Herbert <thomasfherbert@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto-dpif: Use xzalloc instead of xmalloc.
Sabyasachi Sengupta [Sat, 6 Jun 2015 05:14:37 +0000 (22:14 -0700)]
ofproto-dpif: Use xzalloc instead of xmalloc.

Use xzalloc instead of xmalloc for some key structure allocations in
ofproto-dpif (viz. ofproto_dpif, ofport_dpif and rule_dpif) so as to
prevent uninitialized values in these structures.

Signed-off-by: Sabyasachi Sengupta <sabyasachi.sengupta@alcatel-lucent.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto-dpif: Avoid creating OpenFlow ports for duplicate tunnels.
Ben Pfaff [Fri, 5 Jun 2015 15:13:28 +0000 (08:13 -0700)]
ofproto-dpif: Avoid creating OpenFlow ports for duplicate tunnels.

Until now, when two tunnels had an identical configuration, both of them
were assigned OpenFlow ports, but only one of those OpenFlow ports was
functional.  With this commit, only one of the two (or more) identically
configured tunnels will be assigned an OpenFlow port number.

Reported-by: Keith Holleman <hollemanietf@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Co-authored-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
8 years agoappveyor: Add a newer ssl link.
Gurucharan Shetty [Fri, 5 Jun 2015 18:37:52 +0000 (11:37 -0700)]
appveyor: Add a newer ssl link.

The older version is no longer available for download.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Alin Serdean <aserdean@cloudbasesolutions.com>
8 years agoLink library updates for appveyor
Alin Serdean [Fri, 5 Jun 2015 18:39:37 +0000 (18:39 +0000)]
Link library updates for appveyor

Add the library iphlpapi to the appveyor.yml build script.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
8 years agoovs-vswitchd: Update documentation
Mijo Safradin [Wed, 27 May 2015 08:34:31 +0000 (10:34 +0200)]
ovs-vswitchd: Update documentation

Commit 7a6cf343a410d77e05ebd7bf5b5ade52803879ae raised the MAXFD
limit from 7500 to 65535.

Signed-off-by: Mijo Safradin <mijo@linux.vnet.ibm.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodpif-netdev: Fix non-pmd thread queue id.
Daniele Di Proietto [Wed, 3 Jun 2015 14:55:16 +0000 (15:55 +0100)]
dpif-netdev: Fix non-pmd thread queue id.

Non pmd threads have a core_id == UINT32_MAX, while queue ids used by
netdevs range from 0 to the number of CPUs.  Therefore core ids cannot
be used directly to select a queue.

This commit introduces a simple mapping to fix the problem: pmd threads
continue using queues 0 to N (where N is the number of CPUs in the
system), while non pmd threads use queue N+1.

Fixes: d5c199ea7ff7 ("netdev-dpdk: Properly support non pmd threads.")

Reported-by: 차은호 <eunho.cha@atto-research.com
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Signed-off-by: Mark D. Gray <mark.d.gray@intel.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
8 years agoUpdate my email address
YAMAMOTO Takashi [Mon, 1 Jun 2015 03:26:40 +0000 (12:26 +0900)]
Update my email address

Signed-off-by: YAMAMOTO Takashi <yamamoto@midokura.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
8 years agolib/util.c: style fixes
Andy Zhou [Tue, 2 Jun 2015 02:07:13 +0000 (19:07 -0700)]
lib/util.c: style fixes

Covert tabs into spaces. Found by inspection.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
8 years agometaflow: Convert hex parsing to use new utility functions.
Jesse Gross [Tue, 19 May 2015 00:17:41 +0000 (17:17 -0700)]
metaflow: Convert hex parsing to use new utility functions.

We now have functions that can do parsing and printing of long hex
strings, so we should use them for meta flow fields to ensure
consistent behavior.

Since these functions can handle infinitely long strings, we can
also increase the maximum field size for MFS_HEXADECIMAL types to
the limit allowed by NXM/OXM. This is useful for future large fields,
such as Geneve options.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
8 years agoofproto: Add support for reverting flow mods and bundle commit.
Jarno Rajahalme [Mon, 1 Jun 2015 22:47:58 +0000 (15:47 -0700)]
ofproto: Add support for reverting flow mods and bundle commit.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto: Split delete_flow*().
Jarno Rajahalme [Fri, 29 May 2015 18:28:39 +0000 (11:28 -0700)]
ofproto: Split delete_flow*().

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto: Split modify_flows().
Jarno Rajahalme [Fri, 29 May 2015 18:28:39 +0000 (11:28 -0700)]
ofproto: Split modify_flows().

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto: Split add_flow().
Jarno Rajahalme [Fri, 29 May 2015 18:28:39 +0000 (11:28 -0700)]
ofproto: Split add_flow().

Split add_flow() to add_flow_begin() which does all the error
checking, and add_flow_finish() which can not fail.

Since we still want to send an error response for an unknown
'buffer_id', send_buffered_packet() now send the error response
itself.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto: Refactor modify_flows__().
Jarno Rajahalme [Fri, 29 May 2015 18:28:39 +0000 (11:28 -0700)]
ofproto: Refactor modify_flows__().

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto: Use enum ofperr for 'error'.
Jarno Rajahalme [Mon, 1 Jun 2015 21:13:05 +0000 (14:13 -0700)]
ofproto: Use enum ofperr for 'error'.

Clean up error return types and related comments.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto: Factor out ofproto_rule_create().
Jarno Rajahalme [Fri, 29 May 2015 18:28:38 +0000 (11:28 -0700)]
ofproto: Factor out ofproto_rule_create().

Makes add_flow() easier to read and understand.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto: Factor out ofproto_rule_insert__().
Jarno Rajahalme [Fri, 29 May 2015 18:28:38 +0000 (11:28 -0700)]
ofproto: Factor out ofproto_rule_insert__().

Pairs well with ofproto_rule_remove__().

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agobundles: Manage bundles in connmgr.
Jarno Rajahalme [Fri, 29 May 2015 18:28:38 +0000 (11:28 -0700)]
bundles: Manage bundles in connmgr.

This will make implementing bundle commit in ofproto.c easier.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agobundles: Validate bundled messages.
Jarno Rajahalme [Tue, 2 Jun 2015 01:07:39 +0000 (18:07 -0700)]
bundles: Validate bundled messages.

OpenFlow bundle messages should be decoded and validated at the time
they are added to the bundle.  This commit does this for flow mod and
port mod messages.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoclassifier: Support duplicate rules.
Jarno Rajahalme [Fri, 29 May 2015 18:28:38 +0000 (11:28 -0700)]
classifier: Support duplicate rules.

OpenFlow 1.4 bundles are easier to implement when it is possible to
mark a rule as 'to_be_removed' and then insert a new, identical rule
with the same priority.

All but one out of the identical rules must be marked as
'to_be_removed', and the one rule that is not 'to_be_removed' must
have been inserted last.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoclassifier: Add support for invisible flows.
Jarno Rajahalme [Fri, 29 May 2015 18:28:38 +0000 (11:28 -0700)]
classifier: Add support for invisible flows.

This makes it possible to tentatively add flows to the classifier
without the datapath seeing them.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofp-util: Fix xid in ofputil_encode_bundle_add().
Jarno Rajahalme [Fri, 29 May 2015 18:28:38 +0000 (11:28 -0700)]
ofp-util: Fix xid in ofputil_encode_bundle_add().

Bundle add must use the same xid as the embedded message.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto: Eliminate use of unset error code.
Jarno Rajahalme [Fri, 29 May 2015 18:28:38 +0000 (11:28 -0700)]
ofproto: Eliminate use of unset error code.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoovsdb-monitor: allow multiple of 'ovsdb_monitor_changes' in each ovsdb monitor table
Andy Zhou [Sat, 14 Mar 2015 07:40:18 +0000 (00:40 -0700)]
ovsdb-monitor: allow multiple of 'ovsdb_monitor_changes' in each ovsdb monitor table

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoovsdb-monitor: add ovsdb_monitor_changes
Andy Zhou [Fri, 13 Mar 2015 23:35:49 +0000 (16:35 -0700)]
ovsdb-monitor: add ovsdb_monitor_changes

Currently, each monitor table contains a single hmap 'changes' to
track updates. This patch introduces a new data structure
'ovsdb_monitor_changes' that stores the updates 'rows' tagged by
its first commit transaction id. Each 'ovsdb_monitor_changes' is
refenece counted allowing multiple jsonrpc_monitors to share them.

The next patch will allow each ovsdb monitor table to store a list
of 'ovsdb_monitor_changes'. This patch stores only one, same as
before.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoovsdb-monitor: rename jsonrpc_monitor_compose_table_update()
Andy Zhou [Fri, 13 Mar 2015 20:41:38 +0000 (13:41 -0700)]
ovsdb-monitor: rename jsonrpc_monitor_compose_table_update()

jsonrpc_monitor_compose_update() seems to fit better than
jsonrpc_monitor_compose_table_update(), since it composes changes
from all tables.  Albeit the original one is named after the
<table-updates> object described in RFC 7047.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoovsdb-monitor: add transaction ids
Andy Zhou [Fri, 13 Mar 2015 06:15:56 +0000 (23:15 -0700)]
ovsdb-monitor: add transaction ids

With N:1 mappings, multiple jsonrpc server may be servicing the rpc
connection at a different pace. ovsdb-monitor thus needs to maintain
different change sets, depends on connection speed of each rpc
connections. Connections servicing at the same speed can share the
same change set.

Transaction ID is an concept added to describe the change set. One
possible view of the database state is a sequence of changes, more
precisely, commits be applied to it in order, starting from an
initial state, with commit 0. The logic can also be applied to the
jsonrpc monitor; each change it pushes corresponds to commits between
two transaction IDs.

This patch introduces transaction IDs. For ovsdb-monitor, it maintains
n_transactions, starting from 0. Each commit add 1 to the number.
Jsonrpc maintains and 'unflushed' transaction number, corresponding to
the next commit the remote has not seen. jsonrpc's job is simply to
notice there are changes in the ovsdb-monitor that it is interested in,
i.e.  'n_transactions' >= 'unflushed', get the changes in json format,
and push them to the remote site.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoovsdb-monitor: stores jsonrpc-monitor in a linked-list
Andy Zhou [Thu, 9 Apr 2015 23:39:58 +0000 (16:39 -0700)]
ovsdb-monitor: stores jsonrpc-monitor in a linked-list

Currently, each ovsdb-monitor points to a single jsonrpc_monitor object.
This means there is 1:1 relationship between them.

In case multiple jsonrpc-monitors need to monitor the same tables and
the columns within them, then can share a single ovsdb-monitor, so the
updates only needs to be maintained once.

This patch, with a few following patches,  will allow for N:1 mapping
between jsonrpc-monitor and ovsdb-monitor.

Maintaining jsonrpc-monitor pointers in a linked-list is essential
in allowing N:1 mapping. The ovsdb-monitor life cycle
is now reference counted. An empty list means zero references.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoovsdb-monitor: refactoring ovsdb_monitor_get_initial
Andy Zhou [Wed, 18 Mar 2015 04:25:20 +0000 (21:25 -0700)]
ovsdb-monitor: refactoring ovsdb_monitor_get_initial

Refactoring ovsdb_monitor_get_initial() to not generate JSON object.
It only collect changes within the ovsdb_monitor().
ovsdb_jsonrpc_monitor_compose_table_update() is then used to generate
JSON object.

This change will also make future patch easier.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agojsonrpc-server: Split out monitor backend functions to monitor.c/h
Andy Zhou [Thu, 12 Mar 2015 04:20:44 +0000 (21:20 -0700)]
jsonrpc-server: Split out monitor backend functions to monitor.c/h

Added new files monitor.[ch] for monitor backend functions.
There is no functional changes.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agojsonrpc-server: refactoring ovsdb_monitor_destroy()
Andy Zhou [Thu, 12 Mar 2015 02:49:13 +0000 (19:49 -0700)]
jsonrpc-server: refactoring ovsdb_monitor_destroy()

Add ovsdb_monitor_destroy() function to properly cleanup ovsdb_monitor.
It is also responsible for unhook from the replica chain.

The replica destroy callback is now called
ovsdb_monitor_destroy_callback()

Minor variable renaming in ovsdb_monitor_create() to make it
more consistent.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agojsonrpc-server: rename ovsdb_jsonrpc_monitor_get_initial()
Andy Zhou [Thu, 12 Mar 2015 02:38:50 +0000 (19:38 -0700)]
jsonrpc-server: rename ovsdb_jsonrpc_monitor_get_initial()

rename ovsdb_jsonrpc_monitor_get_initial() to
ovsdb_monitor_get_initial()

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agojsonrpc-server: refactoring ovsdb_jsonrpc_monitor_needs_flush
Andy Zhou [Thu, 12 Mar 2015 02:33:46 +0000 (19:33 -0700)]
jsonrpc-server: refactoring ovsdb_jsonrpc_monitor_needs_flush

split out per monitoring needs_flush() into
ovsdb_monitor_needs_flush().

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agojsonrpc-server: refactoring ovsdb_jsonrpc_monitor_compose_table_update()
Andy Zhou [Thu, 12 Mar 2015 02:28:13 +0000 (19:28 -0700)]
jsonrpc-server: refactoring ovsdb_jsonrpc_monitor_compose_table_update()

Now it simply calls ovsdb_monitor_compose_table_update(), which
actually creates the json object.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agojsonrpc-server: refactor ovsdb_monitor_add_column()
Andy Zhou [Thu, 12 Mar 2015 02:05:49 +0000 (19:05 -0700)]
jsonrpc-server: refactor ovsdb_monitor_add_column()

To hide ovsdb_monitor_table object from ovsdb_jsonrpc serve.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agojsonrpc-server: refactor ovsdb_jsonrpc_parse_monitor_request
Andy Zhou [Thu, 12 Mar 2015 01:57:55 +0000 (18:57 -0700)]
jsonrpc-server: refactor ovsdb_jsonrpc_parse_monitor_request

Change ovsdb_jsonrpc_parse_monitor_request() to make
ovsdb_monitor_table an opaque object.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agojsonrpc-server: make setting mt->select into its own functions
Andy Zhou [Thu, 12 Mar 2015 01:02:53 +0000 (18:02 -0700)]
jsonrpc-server: make setting mt->select into its own functions

To make ovsdb_monitor an opaque to ovsdb_jsonrpc server object.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agojsonrpc-server: split monitors into database back end and JSON-RPC front
Andy Zhou [Wed, 11 Mar 2015 23:50:41 +0000 (16:50 -0700)]
jsonrpc-server: split monitors into database back end and JSON-RPC front
end

jsonrpc-server.c has two main functions. One deals with handling the
jsonrpc connections, the other deals with monitoring the database.

Currently, each jsonrpc connections has its own set of DB monitors.
This can be wasteful if a number of connections shares the same
monitors.

This patch, and a few following refactoring patches attempts to
split the jsonrpc handling front end off the main monitoring
functions within jsonrpc.c.

This patch changes the monitoring functions and data structures from
'ovsdb_jsonrpc_monitor_xxx' into 'ovsdb_monitor_xxx'

This and the following patches move the ovsdb_monitor backend functions
into their own file.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoovsdb-test: add multiple clients to backlogged connection test
Andy Zhou [Thu, 9 Apr 2015 01:05:27 +0000 (18:05 -0700)]
ovsdb-test: add multiple clients to backlogged connection test

Backlogged connection test tests jsonrpc monitor's ability to combine
updates. Adding multiple clients to ensure that non-blocking clients
will get individual updates while blocking clients will get combined
updates.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agolearn: Improve error reporting.
Ben Pfaff [Fri, 29 May 2015 22:15:01 +0000 (15:15 -0700)]
learn: Improve error reporting.

parse_int_string() returns an error if the field overflows, not if there
is a bad hex digit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
8 years agoodp-execute: Refactor determining dpif assistance.
Joe Stringer [Fri, 6 Mar 2015 18:09:10 +0000 (10:09 -0800)]
odp-execute: Refactor determining dpif assistance.

To be more explicit about which actions require datapath assistance,
split this out into a separate function. While this is fairly trivial
currently, there will be more special cases for the upcoming conntrack
changes.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto-dpif: Refactor feature support structure.
Joe Stringer [Wed, 25 Feb 2015 00:40:42 +0000 (16:40 -0800)]
ofproto-dpif: Refactor feature support structure.

Place all of the detected datapath features into a separate structure,
initialized when the dpif_backer is opened and shared with xbridges.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofp-errors: Add Nicira extension code for OFPBMC_BAD_FIELD.
Ben Pfaff [Tue, 3 Mar 2015 21:28:32 +0000 (13:28 -0800)]
ofp-errors: Add Nicira extension code for OFPBMC_BAD_FIELD.

There are a couple of cases where OpenFlow 1.0 controllers that use
Nicira extensions can get OFPBMC_BAD_FIELD, so we should have an error
code for it in that protocol.

Reported-by: Soner Sevinc <sevincs@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agojson: Fix error message for corner case in json_string_unescape().
Ben Pfaff [Wed, 25 Feb 2015 16:46:02 +0000 (08:46 -0800)]
json: Fix error message for corner case in json_string_unescape().

The error message should not include bytes already copied from the input
string.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
8 years agodatapath-windows: Fix build.
Alin Serdean [Fri, 29 May 2015 21:22:54 +0000 (21:22 +0000)]
datapath-windows: Fix build.

Removing a variable which breaks the windows forwarding extension build.

The error:
warning C4189: 'bufContext' : local variable is initialized but not referenced

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 agoodp-util: Fix alignment when scanning Geneve attributes.
Jesse Gross [Fri, 29 May 2015 17:41:05 +0000 (10:41 -0700)]
odp-util: Fix alignment when scanning Geneve attributes.

Clang complains about the fact that we use a byte array to scan
Geneve attributes into since there are different alignment requirements:

lib/odp-util.c:2936:30: error: cast from 'uint8_t *' (aka 'unsigned char *') to

      'struct geneve_opt *' increases required alignment from 1 to 2

      [-Werror,-Wcast-align]

    struct geneve_opt *opt = (struct geneve_opt *)key->d;

                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~

We can instead treat this as an array of Geneve option headers to
ensure we get the right alignment and then there are no need for
casts.

Reported-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
8 years agoodp-util: Geneve netlink decoding.
Jesse Gross [Mon, 18 May 2015 23:03:01 +0000 (16:03 -0700)]
odp-util: Geneve netlink decoding.

Even though userspace does not yet support Geneve options,
the kernel does and there is some basic support for decoding
those attributes. This adds the ability to print Geneve
attributes that might potentially come from the kernel.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
8 years agoutil: Library routines for printing and scanning large hex integers.
Jesse Gross [Thu, 21 May 2015 01:47:21 +0000 (18:47 -0700)]
util: Library routines for printing and scanning large hex integers.

Geneve options are variable length and up to 124 bytes long, which means
that they can't be easily manipulated by the integer string functions
like we do for other fields. This adds a few helper routines to make
these operations easier.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
8 years agoodp-util: Format tunnel attributes directly from netlink.
Jesse Gross [Sun, 17 May 2015 05:08:20 +0000 (22:08 -0700)]
odp-util: Format tunnel attributes directly from netlink.

When we format most netlink attributes we do so from the netlink
itself, iterating through each one and printing the contents out.
However, for tunnels we don't do this - we first convert to the
OVS userspace representation and then format that. While convienient,
this isn't really ideal as the primary use of printing netlink
attributes is debugging and this conversion is lossy, particularly
when the attributes aren't as expected. The result is that unexpected
keys are silently ignored and the level of detail on errors is
minimal.

This situation becomes worse when we introduce support for Geneve.
The conversion to userspace format requires additional information
which we might not have (ovs-dpctl) and is more complicated than
other attributes so it is likely to be confusing in the event of a
bug. The information from the kernel is self-describing so it's
much more reliable to display it directly from the netlink.

This converts tunnel attribute formatting to be more similar to
other types of attributes. As a nice bonus the output becomes
more compact because it doesn't print zeroed out attributes in
cases where they aren't relevant and therefore not present.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
8 years agoodp-util: Correctly generate wildcards when formating nested attributes.
Jesse Gross [Wed, 20 May 2015 18:57:35 +0000 (11:57 -0700)]
odp-util: Correctly generate wildcards when formating nested attributes.

When formatting netlink attributes if no mask is present a wildcarded
attribute is synthesized for the purposes of later processing. In
the case of nested attributes this must be done recursively, filling
in the correct attributes at each level rather than just generating
a set of zeros of the correct size. This is done already but it
always uses the attribute type for the top level keys - this corresponds
to nested ENCAP attributes. However, we have several levels of potentially
nested attributes for tunnels that each have their own types.

This uses an approach similar to the kernel where we have sets of
tables for the type of each attribute linked together by pointers.
This allows the mask generation function to automatically traverse
the nested attributes and always get the right types.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
8 years agodatapath-windows: Multiple NBLs support for ingress data path
Sorin Vinturis [Thu, 28 May 2015 21:00:39 +0000 (21:00 +0000)]
datapath-windows: Multiple NBLs support for ingress data path

Added support for creating and handling multiple NBLs with only one NB
for ingress data path.

Signed-off-by: Sorin Vinturis <svinturis at cloudbasesolutions.com>
Reported-by: Alessandro Pilotti <apilotti at cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/2
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoofp-actions: Improve conjunction error message.
Joe Stringer [Mon, 18 May 2015 17:26:14 +0000 (10:26 -0700)]
ofp-actions: Improve conjunction error message.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Removed memory barrier and master lock
Sorin Vinturis [Wed, 27 May 2015 17:08:00 +0000 (17:08 +0000)]
datapath-windows: Removed memory barrier and master lock

There is no need to enforce Netlink serialization on transactions
sent from userspace. The access to the driver's shared resources
is synchronized anyway. Thus I have removed the master lock.

I also removed the memory barrier from filter dispatch routine. A
memory barrier is already in place in OvsReleaseSwitchContext
function, due to the use of InterlockedCompareExchange function.

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 agodatapath-windows: Document OVS tunnel filter callout
Sorin Vinturis [Wed, 27 May 2015 16:58:26 +0000 (16:58 +0000)]
datapath-windows: Document OVS tunnel filter callout

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 agodatapath-windows: Support for multiple VXLAN tunnels
Sorin Vinturis [Wed, 27 May 2015 16:58:25 +0000 (16:58 +0000)]
datapath-windows: Support for multiple VXLAN tunnels

At the moment the OVS extension supports only one VXLAN tunnel that
is cached in the extension switch context. Replaced the latter
cached pointer with an array list that contains all VXLAN tunnel
vports.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/64
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Support for custom VXLAN tunnel port
Sorin Vinturis [Wed, 27 May 2015 16:58:25 +0000 (16:58 +0000)]
datapath-windows: Support for custom VXLAN tunnel port

The kernel datapath supports only port 4789 for VXLAN tunnel creation.
Added support in order to allow for the VXLAN tunnel port to be
configurable to any port number set by the userspace.

The patch also checks to see if an existing WFP filter, for the
necessary UDP tunnel port, is already created before adding a new one.
This is a double check, because currently the userspace also verifies
this, but it is necessary to avoid future issues.

Custom VXLAN tunnel port requires the addition of a new WFP filter
with the new UDP tunnel port. The creation of a new WFP filter is
triggered in OvsInitVxlanTunnel function and the removal of the WFP
filter in OvsCleanupVxlanTunnel function.
But the latter functions are running at IRQL = DISPATCH_LEVEL, due
to the NDIS RW lock acquisition, and all WFP calls must be running at
IRQL = PASSIVE_LEVEL. This is why I have created a system thread which
records all filter addition/removal requests into a list for later
processing by the system thread. The ThreadStart routine processes all
received requests at IRQL = PASSIVE_LEVEL, which is the required IRQL
for the necessary WFP calls for adding/removal of the WFP filters.

The WFP filter for the default VXLAN port 4789 is not added anymore at
filter attach. All WFP filters for the tunnel ports are added when the
tunnel ports are initialized and are removed at cleanup. WFP operation
status is then reported to userspace.

It is necessary that OvsTunnelFilterUninitialize function is called
after OvsClearAllSwitchVports in order to allow for the added WFP
filters to be removed. OvsTunnelFilterUninitialize function closes the
global engine handle used by most of the WFP calls, including filter
removal.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/66
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agotests: Check that ofproto/trace accepts dpctl output.
Joe Stringer [Wed, 20 May 2015 20:30:55 +0000 (13:30 -0700)]
tests: Check that ofproto/trace accepts dpctl output.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agotests: Fix in_port(name) test for ofproto/trace.
Joe Stringer [Wed, 20 May 2015 17:35:15 +0000 (10:35 -0700)]
tests: Fix in_port(name) test for ofproto/trace.

Commit c2a77f33ade (tests/ofproto-dpif: Use vlog to test dpif
behaviour.) mistakenly changed the test which checked that ovs-dpctl
accepts named ports as input. Restore the name to the test.

Reported-by: Gurucharan Shetty <gshetty@nicira.com>
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoodp-util: Skip UFID when parsing datapath key.
Joe Stringer [Thu, 21 May 2015 00:04:33 +0000 (17:04 -0700)]
odp-util: Skip UFID when parsing datapath key.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto-dpif: Make odp/ofp parse errors more clear.
Joe Stringer [Wed, 20 May 2015 23:48:57 +0000 (16:48 -0700)]
ofproto-dpif: Make odp/ofp parse errors more clear.

It's useful to distinguish which type of flow that the parser thinks it
is parsing when we output error messages.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
8 years agoextract-ofp-fields: Detect duplicate fields.
Joe Stringer [Tue, 19 May 2015 21:13:12 +0000 (14:13 -0700)]
extract-ofp-fields: Detect duplicate fields.

Figure out if a developer accidentally defines new NXM fields using an
existing number, and warn them. Useful particularly if new fields are
introduced upstream while rebasing an in-progress patchset.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoovs_threads: Avoid running pthread destructors from main thread exit.
Gurucharan Shetty [Wed, 8 Apr 2015 00:34:27 +0000 (17:34 -0700)]
ovs_threads: Avoid running pthread destructors from main thread exit.

Windows uses pthreads-win32 library to provide the Linux pthread
functionality. It is observed that when the main thread calls
a pthread destructor after it exits, undefined behavior is seen
(e.g., junk values in data, causing pthread deadlocks).
Similar behavior has been seen by
other people as seen in the following email thread:
https://sourceware.org/ml/pthreads-win32/2003/msg00001.html

To avoid this, this commit de-registers the thread destructor
when the main thread exits (via the atexit handler).

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agorhel: Add buildrequires for procps-ng.
Flavio Leitner [Tue, 28 Apr 2015 02:00:14 +0000 (23:00 -0300)]
rhel: Add buildrequires for procps-ng.

The testsuite is enabled by default and uses some of
the tools provided by procps-ng.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agorhel: Fix rundir ownership.
Flavio Leitner [Tue, 28 Apr 2015 02:01:09 +0000 (23:01 -0300)]
rhel: Fix rundir ownership.

Although the ovs-ctl/ovs-lib takes care of creating the rundir,
it is correct to let the systemd manages the directory and let
the rpm know about the ownership too.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoovs-docker: Ability to set the MTU of the container interface.
Gurucharan Shetty [Mon, 25 May 2015 08:04:01 +0000 (01:04 -0700)]
ovs-docker: Ability to set the MTU of the container interface.

When containers are connected to a OVS bridge and tunnels
are created, it makese sense to reduce the MTU of the interafce.

Reported-by: Aurélien Poulai <aurepoulain@viacesi.fr>
Signed-off-by: Gurucharan Shetty <shettyg@nicira.com>
8 years agoovs-docker: Add the ability to set the mac address.
Gurucharan Shetty [Mon, 25 May 2015 07:50:01 +0000 (00:50 -0700)]
ovs-docker: Add the ability to set the mac address.

For testing OVN, it is useful to set the mac address
of the container. Since ovs-docker hasn't been part
of any released versions of OVS, it is probably OK
to change the options style.

Signed-off-by: Gurucharan Shetty <shettyg@nicira.com>