cascardo/ovs.git
10 years agoofproto-dpif.at: Fix races in dpif/dump-flows test
YAMAMOTO Takashi [Thu, 10 Apr 2014 11:46:08 +0000 (11:46 +0000)]
ofproto-dpif.at: Fix races in dpif/dump-flows test

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoofproto-dpif.at: Use OVS_APP_EXIT_AND_WAIT where appropriate
YAMAMOTO Takashi [Thu, 10 Apr 2014 11:10:38 +0000 (11:10 +0000)]
ofproto-dpif.at: Use OVS_APP_EXIT_AND_WAIT where appropriate

Leftover of commit 0c473314.
("ofproto-dpif.at: Wait for the monitor's pidfile disappears where necessary")

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoofproto-dpif.at: Fix some races
YAMAMOTO Takashi [Thu, 10 Apr 2014 10:57:58 +0000 (10:57 +0000)]
ofproto-dpif.at: Fix some races

These races were exposed on my environment by commit c2a77f33.
("tests/ofproto-dpif: Use vlog to test dpif behaviour.")

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoFix a typo in lib/vconn-provider.h.
Rami Rosen [Mon, 12 May 2014 15:44:04 +0000 (08:44 -0700)]
Fix a typo in lib/vconn-provider.h.

This trivial patch fixes a typo in lib/vconn-provider.h.

Signed-off-by: Rami Rosen <ramirose@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolib/classifier: Add subtable cache diagnostics.
Jarno Rajahalme [Mon, 12 May 2014 04:26:28 +0000 (21:26 -0700)]
lib/classifier: Add subtable cache diagnostics.

Assert failures that should not happen have been reported on some
(non-OVS) test cases.  This patch adds diagnostics to analyze what
goes wrong.

None of the OVS unit tests trigger these, so there is no performance
penalty.

This could be moved to test-classifier once it has served it's
purpose.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoacinclude.m4: Fix a typo in a help message
YAMAMOTO Takashi [Fri, 9 May 2014 04:29:11 +0000 (13:29 +0900)]
acinclude.m4: Fix a typo in a help message

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoacinclude.m4: Expand tabs
YAMAMOTO Takashi [Fri, 9 May 2014 04:28:49 +0000 (13:28 +0900)]
acinclude.m4: Expand tabs

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoofproto-dpif-upcall: Do not call dpif_handlers_set() when there is no
Alex Wang [Fri, 9 May 2014 21:42:30 +0000 (14:42 -0700)]
ofproto-dpif-upcall: Do not call dpif_handlers_set() when there is no
handler/revalidator configuration change.

dpif_handlers_set(), which dumps all vport from datapath, should not be
called constantly.

Found by inspection.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-ctl: Don't decrease max open fds if already set higher
Thomas Graf [Thu, 8 May 2014 18:45:25 +0000 (20:45 +0200)]
ovs-ctl: Don't decrease max open fds if already set higher

A user may set LimitNOFILE through systemd or other means to set
the maximum number of open file descriptors. Only modify the ulimit
if not already set to a higher value by the user.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Gospodarek <gospo@redhat.com>
10 years agoMakefiles: Fix invocation of dot2pic when builddir != srcdir.
Ben Pfaff [Fri, 9 May 2014 04:36:42 +0000 (21:36 -0700)]
Makefiles: Fix invocation of dot2pic when builddir != srcdir.

CC: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agodot2pic: Stop assuming the path of the interpreter
YAMAMOTO Takashi [Thu, 8 May 2014 01:44:08 +0000 (10:44 +0900)]
dot2pic: Stop assuming the path of the interpreter

On NetBSD, perl is usually installed as /usr/pkg/bin/perl.

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agodot2pic: Use "> $@; mv $@.tmp $@" notation to make this reliably fail
YAMAMOTO Takashi [Thu, 8 May 2014 01:39:17 +0000 (10:39 +0900)]
dot2pic: Use "> $@; mv $@.tmp $@" notation to make this reliably fail

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoRevert commit 74622b44b ("Fix dot2pic make dependencies")
YAMAMOTO Takashi [Thu, 8 May 2014 01:35:54 +0000 (10:35 +0900)]
Revert commit 74622b44b ("Fix dot2pic make dependencies")

It turned out to be non-problem.

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoovs-dev.py: Add support for dpdk builds.
Ethan Jackson [Wed, 7 May 2014 19:56:23 +0000 (12:56 -0700)]
ovs-dev.py: Add support for dpdk builds.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoutil: Remove duplicate CACHE_LINE_SIZE definition.
Ben Pfaff [Thu, 8 May 2014 23:42:24 +0000 (16:42 -0700)]
util: Remove duplicate CACHE_LINE_SIZE definition.

Reported-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agoofp-util: compile group stats with visual studio
Andy Zhou [Fri, 25 Apr 2014 08:34:09 +0000 (08:34 +0000)]
ofp-util: compile group stats with visual studio

Visual studio supports zero-size array within a struct or union,
but has to be the last element. GCC does not have this restriction.

Commits 644cfd84772eb7d8 and 6fdaa45a6f6c9 make use of 0 size array.
Remove them so that visual studio can compile them as well.

Reported-by: Gurucharan Shetty <gshetty@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-thread: Issue better diagnostics for locking uninitialized mutexes.
Ben Pfaff [Thu, 8 May 2014 16:20:09 +0000 (09:20 -0700)]
ovs-thread: Issue better diagnostics for locking uninitialized mutexes.

This makes the message issued refer to the file and line that called
ovs_mutex_lock(), instead of to the file and line *inside*
ovs_mutex_lock().

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agobond: raise minimal bond distribution per interface
Andy Zhou [Wed, 7 May 2014 05:31:00 +0000 (22:31 -0700)]
bond: raise minimal bond distribution per interface

Raise the minimal per interface packet distribution from 7 to 24.

With 256 packet distributing to 3 interfaces, the expected packets per
interface should be 256/3 = 85.3

Tested with 200 runs, the average number of packet sent to a single
interface is 85.9. close to the expected number, standard deviation
within the 200 run is 24.4. Tested with 2x standard deviation with
10K test runs, got around 0.1% failure rate. 2.5x standard deviation
passes 100K test runs without failure.

Using 2.5x for the unit test, 83.5 - 2.5 * 24.4, Round down to the
whole number of 24.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoFAQ: Mention packet filter incompatibility
YAMAMOTO Takashi [Mon, 5 May 2014 00:11:07 +0000 (09:11 +0900)]
FAQ: Mention packet filter incompatibility

Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Pritesh Kothari <pritesh.kothari@cisco.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agotunnel: Fix bug where misconfiguration persists.
Joe Stringer [Sun, 4 May 2014 22:14:18 +0000 (10:14 +1200)]
tunnel: Fix bug where misconfiguration persists.

Previously, misconfiguring a tunnel port to use the exact same settings
would cause the corresponding netdev to never be destroyed. When
attempting to re-use the port as a different type, this would fail and
result in a discrepancy between reported port type and actual netdev in
use.

An example configuration that would previously give unexpected behaviour:

ovs-vsctl add-port br0 p0 -- set int p0 type=gre options:remote_ip=1.2.3.4
ovs-vsctl add-port br0 p1 -- set int p1 type=internal
ovs-vsctl set int p1 type=gre options:remote_ip=1.2.3.4
ovs-vsctl set int p1 type=internal

The final command would report in the ovs-vswitchd logs that it is
attempting to configure the port with the same gre settings as p0,
despite the command specifying the type as internal. Even after
deleting and re-adding the port, the message would reappear.

This patch fixes the bug by dereferencing the netdev in the failure
case of tnl_port_add__(), and ensures that the tnl_port structure is
freed in that case as well.

Bug #1198386.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ryan Wilson <wryan@vmware.com>
Acked-by: Alex Wang <alexw@nicira.com>
10 years agonetdev: Allow netdev_change_seq_changed() to accept const pointers.
Ethan Jackson [Wed, 7 May 2014 20:00:11 +0000 (13:00 -0700)]
netdev: Allow netdev_change_seq_changed() to accept const pointers.

This fixes the following warning in the DPDK code.

../lib/netdev-dpdk.c:790:31: error: passing 'const struct netdev *' to
parameter of type 'struct netdev *' discards qualifiers

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agolacp: Really fix mutex initialization.
Ben Pfaff [Wed, 7 May 2014 20:14:45 +0000 (13:14 -0700)]
lacp: Really fix mutex initialization.

Commit 2a3fb0aa3c (lacp: Don't lock potentially uninitialized mutex in
lacp_status().) fixed one bug related to acquiring the file scope 'mutex'
without initializing it.  However, there was at least one other, in
lacp_unixctl_show().  One could just fix that one problem, but that leaves
the possibility that I might have missed one or two more.  This commit
fixes the problem for good, by adding a helper that initializes the mutex
and then acquires it.

It's not entirely clear why 'mutex' is a recursive mutex.  I think that it
might be just because of the callback in lacp_run().  An alternate fix,
therefore, would be to eliminate the callback and therefore the need for
runtime initialization of the mutex.

Bug #1245659.
Reported-by: Jeffrey Merrick <jmerrick@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agobond: fix a bug that disabled bond stats collection
Andy Zhou [Wed, 7 May 2014 04:55:28 +0000 (21:55 -0700)]
bond: fix a bug that disabled bond stats collection

Bug #1229225

Signed-off-by: Andy Zhou <azhou@nicira.com>
Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agovtep: Update vtep schema with tunnel table
Ashwin Swaminathan [Tue, 6 May 2014 21:54:52 +0000 (14:54 -0700)]
vtep: Update vtep schema with tunnel table

Added a Tunnel table to the VTEP schema that allows
per-tunnel BFD configuration and status to be specified.
Removed the BFD configuration/status from the
Physical_Locator table.

Signed-off-by: Ashwin Swaminathan <ashwinds@arista.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Bruce Davie <bdavie@vmware.com>
10 years agobfd: Update bfd status on bfd creation and deletion.
Alex Wang [Wed, 7 May 2014 06:46:39 +0000 (23:46 -0700)]
bfd: Update bfd status on bfd creation and deletion.

Commit 88bf179aa3 (bfd/cfm: Check status change before update
status to database.) used a boolean flag to trigger bfd status
update.  However, the flag is not set on bfd creation and deletion.

To prevent any stale status in database, this commit makes bfd module
always set the flag on bfd creation and deletion.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agocfm: Update cfm status on cfm creation and deletion.
Alex Wang [Wed, 7 May 2014 06:21:36 +0000 (23:21 -0700)]
cfm: Update cfm status on cfm creation and deletion.

Commit 88bf179aa3 (bfd/cfm: Check status change before update
status to database.) used a boolean flag to trigger cfm status
update.  However, the flag is not set on cfm creation and deletion.
And this causes stale status in database which may confuse users.

This commit fixes the issue by making cfm module trigger status
update on creation and deletion.

Bug #1245800

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoFix dot2pic make dependencies
YAMAMOTO Takashi [Mon, 5 May 2014 00:31:28 +0000 (09:31 +0900)]
Fix dot2pic make dependencies

I occasionally see the failure with "make -j32".

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoFAQ: Expand tabs
YAMAMOTO Takashi [Sun, 4 May 2014 23:47:08 +0000 (08:47 +0900)]
FAQ: Expand tabs

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoutil: Use posix_memalign for xmalloc_cacheline if available
YAMAMOTO Takashi [Fri, 2 May 2014 08:07:29 +0000 (17:07 +0900)]
util: Use posix_memalign for xmalloc_cacheline if available

A malloc library is expected to provide a better implementation
using the knowledge of its internal details.

ax_func_posix_memalign.m4 was obtained from:
http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_func_posix_memalign.m4

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agovlog: Use python 2.4 compatible functions.
Gurucharan Shetty [Mon, 5 May 2014 19:30:48 +0000 (12:30 -0700)]
vlog: Use python 2.4 compatible functions.

Xenserver uses python 2.4.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Log flow mod statistics per controller rather than per switch.
Ben Pfaff [Wed, 30 Apr 2014 17:50:32 +0000 (10:50 -0700)]
ofproto: Log flow mod statistics per controller rather than per switch.

I've had a number of requests for more specific logging of flow_mod
information.  It is useful for troubleshooting.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
10 years agorconn: Preserve the name of an unreliable connection beyond disconnection.
Ben Pfaff [Wed, 30 Apr 2014 17:45:16 +0000 (10:45 -0700)]
rconn: Preserve the name of an unreliable connection beyond disconnection.

An rconn has a human-readable name that typically designates both endpoints
of the connection.  For a "reliable" rconn, that automatically reconnects,
the name remains constant regardless of whether the rconn is currently
connected.  Until now, though, an "unreliable" rconn, that cannot
automatically reconnect, kept its name only until disconnection occurred.
This is OK for the uses currently in the OVS tree, which only use the name
of a rconn while it is connected, but an upcoming commit will add a final
log message following disconnection in some cases, and it makes the log
messages less useful if unreliable rconns just report "void" in that case.
This commit, therefore, modifies the rconn code so that unreliable rconns
preserve their names past disconnection, just like reliable ones.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
10 years agoconnmgr: Remove prototype for nonexistent function.
Ben Pfaff [Wed, 30 Apr 2014 17:46:41 +0000 (10:46 -0700)]
connmgr: Remove prototype for nonexistent function.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
10 years agorconn: Correct comment.
Ben Pfaff [Wed, 30 Apr 2014 17:40:25 +0000 (10:40 -0700)]
rconn: Correct comment.

rconn objects do not cache IP address and port information any longer.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
10 years agoFAQ: Add an entry about local ports
YAMAMOTO Takashi [Fri, 2 May 2014 04:06:50 +0000 (13:06 +0900)]
FAQ: Add an entry about local ports

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoovs-vswitchd.at: Avoid using GNU sed extensions
YAMAMOTO Takashi [Fri, 2 May 2014 22:57:50 +0000 (07:57 +0900)]
ovs-vswitchd.at: Avoid using GNU sed extensions

Introduced by commit 12eb035b.
("bridge: Allow users to configure statistics update to OVSDB.")

Cc: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoovs-vswitchd.at: Fix a comment typo
YAMAMOTO Takashi [Fri, 2 May 2014 22:35:42 +0000 (07:35 +0900)]
ovs-vswitchd.at: Fix a comment typo

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agobridge: Fix a NULL dereference
YAMAMOTO Takashi [Fri, 2 May 2014 22:33:58 +0000 (07:33 +0900)]
bridge: Fix a NULL dereference

Introduced by commit 12eb035b.
("bridge: Allow users to configure statistics update to OVSDB.")

Cc: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoroute-table-bsd: Remove unused vlog definition
YAMAMOTO Takashi [Wed, 30 Apr 2014 04:50:14 +0000 (13:50 +0900)]
route-table-bsd: Remove unused vlog definition

Complained by clang 3.4.

lib/route-table-bsd.c:35:1: error: unused variable 'THIS_MODULE'
      [-Werror,-Wunused-const-variable]
VLOG_DEFINE_THIS_MODULE(route_table);
^
./lib/vlog.h:176:42: note: expanded from macro 'VLOG_DEFINE_THIS_MODULE'
        static struct vlog_module *const THIS_MODULE = &VLM_##MODULE

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoroute-table-bsd: Sprinkle ALIGNED_CAST where appropriate
YAMAMOTO Takashi [Wed, 30 Apr 2014 04:34:55 +0000 (13:34 +0900)]
route-table-bsd: Sprinkle ALIGNED_CAST where appropriate

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agonetdev-bsd: Sprinkle ALIGNED_CAST where appropriate
YAMAMOTO Takashi [Wed, 30 Apr 2014 04:33:54 +0000 (13:33 +0900)]
netdev-bsd: Sprinkle ALIGNED_CAST where appropriate

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agonetdev: Safely increment refcount in netdev_open().
Joe Stringer [Thu, 1 May 2014 23:55:05 +0000 (11:55 +1200)]
netdev: Safely increment refcount in netdev_open().

netdev_open() would previously increment a netdev's refcount without
holding a lock for it. This commit shifts the locking to protect it.

Found by inspection.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev: Reuse netdev_ref() in netdev_rxq_open().
Joe Stringer [Thu, 1 May 2014 23:51:07 +0000 (11:51 +1200)]
netdev: Reuse netdev_ref() in netdev_rxq_open().

netdev_rxq_open() open-codes much of netdev_ref(), so re-use that
function instead.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-linux: favor netlink stats for physical ports
Andy Zhou [Mon, 28 Apr 2014 22:46:30 +0000 (15:46 -0700)]
netdev-linux: favor netlink stats for physical ports

Currently physical ports stats are collected from kernel datapath.
However, those counter do not reflect actual wire packet counters
when GSO, TSO or GRO are enabled by the NIC. In the meantime, the
stats collected form routing stack does. While both stats are valid,
Reporting kernel netdev stats for packet counts and byte counts make
it easier to correlate those numbers with external measurements.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-vport: Checks tunnel status change when route-table is reset.
Alex Wang [Thu, 1 May 2014 17:53:48 +0000 (10:53 -0700)]
netdev-vport: Checks tunnel status change when route-table is reset.

Commit 3e912ffcbb (netdev: Add 'change_seq' back to netdev.) added per-
netdev change number for indicating status change.  Future commits used
this change number to optimize the netdev status update to database.
However, the work also introduced the bug in the following scenario:

- assume interface eth0 has address 1.2.3.4, eth1 has adddress 10.0.0.1.
- assume tunnel port p1 is set with remote_ip=10.0.0.5.
- after setup, 'ovs-vsctl list interface p1 status' should show the
  'tunnel_egress_iface="eth1"'.
- now if the address of eth1 is change to 0 via 'ifconfig eth1 0'.
- expectedly, after change, 'ovs-vsctl list interface p1 status' should
  show the 'tunnel_egress_iface="eth0"'

However, 'tunnel_egress_iface' will not be updated on current master.
This is in that, the 'netdev-vport' module corresponding to p1 does
not react to routing related changes.

To fix the bug, this commit adds a change sequence number in the route-
table module and makes netdev-vport check the sequence number for
tunnel status update.

Bug #1240626

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agobridge: Allow users to configure statistics update to OVSDB.
Alex Wang [Thu, 3 Apr 2014 20:27:22 +0000 (13:27 -0700)]
bridge: Allow users to configure statistics update to OVSDB.

This commit adds a new configuration "stats-update-interval" in
"other_config" of Open_Vswitch table.  So users can control the
statistics update frequency.  A possible use case is that, users
can lower the update frequency to reduce the cpu consumption of
the ovs-vswitchd thread.

The configured value should always be greater than or equal to
5000 ms.  And more frequent statistics update should be achieved
via OpenFlow.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agoofproto-dpif-monitor: Fix deadlock.
Alex Wang [Fri, 4 Apr 2014 01:31:13 +0000 (18:31 -0700)]
ofproto-dpif-monitor: Fix deadlock.

Commit 6b59b543 (ovs-thread: Use fair (but nonrecursive)
rwlocks on glibc.) changed the rwlocks to nonrecursive,
writer-biased lock.  It also made the following deadlock
possible.

Assume BFD is used on both end of a link.  Consider the
following events:
1. Handler at one end received the BFD control packet with
   POLL flag set while holding the read lock of 'xlate_rwlock'.
   Since a BFD control packet with FINAL flag set should be
   sent back immediately, it calls the
   ofproto_dpif_monitor_port_send_soon(), in which, it tries
   to grab the 'monitor_mutex'.
2. The main thread needs to configure the ofproto-dpif-xlate
   module.  It tries to grab the write lock of 'xlate_rwlock'
   and is blocked by event 1.
3. The monitor thread, after acquired the 'monitor_mutex',
   wants to acquire the read lock of 'xlate_rwlock'.

Since the rwlock is now writer-biased, the attempt of acquiring
read lock in event 3 will be blocked by event 2.  This will
subsequently cause the block of event 1, since monitor thread
is holding the 'monitor_mutex'.  So the deadlock happens.

This commit resolves the above issue by removing the requirement of
acquiring 'monitor_mutex' in ofproto_dpif_monitor_port_send_soon().

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Fix feature check for HAVE_RXHASH.
Jesse Gross [Fri, 2 May 2014 17:33:45 +0000 (10:33 -0700)]
datapath: Fix feature check for HAVE_RXHASH.

The check for HAVE_RXHASH use #if rather than #ifdef, which
provokes a warning when it isn't defined.

Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoAdd basic implementation for OpenFlow 1.4 bundles
Alexandru Copot [Fri, 2 May 2014 06:54:27 +0000 (09:54 +0300)]
Add basic implementation for OpenFlow 1.4 bundles

This is only the communication part of the bundles functionality.
The actual message pre-validation and commits are not implemented.

We also enable OF1.4 for all the tests.

Signed-off-by: Alexandru Copot <alex.mihai.c@gmail.com>
Cc: Daniel Baluta <dbaluta@ixiacom.com>
[blp@nicira.com made ofputil_decode_bundle_add() more obviously correct]
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoAUTHORS: Add Christian Stigen Larsen <cslarsen@gmail.com>.
Ben Pfaff [Fri, 2 May 2014 15:10:05 +0000 (08:10 -0700)]
AUTHORS: Add Christian Stigen Larsen <cslarsen@gmail.com>.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agovtep: clean up whitespace
Bruce Davie [Fri, 2 May 2014 01:37:24 +0000 (18:37 -0700)]
vtep: clean up whitespace

Signed-off-by: Bruce Davie <bsd@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Add table_is_internal() helper
Simon Horman [Fri, 2 May 2014 08:41:33 +0000 (17:41 +0900)]
ofproto-dpif: Add table_is_internal() helper

This will be used by a subsequent patch to add support for
recirculation for MPLS.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoflow: Add mf_is_l3_or_higher()
Simon Horman [Fri, 2 May 2014 08:41:32 +0000 (17:41 +0900)]
flow: Add mf_is_l3_or_higher()

This is in preparation for using the same helper as part of support
for using recirculation in conjunction series of actions including
with MPLS actions that are currently not able to be translated.

In that scenario this helper will be used to test if load, move and
set_field actions require recirculation to occur.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: clear l4_rxhash in skb_clear_hash.
Pritesh Kothari [Thu, 1 May 2014 22:50:49 +0000 (15:50 -0700)]
datapath: clear l4_rxhash in skb_clear_hash.

Signed-off-by: Pritesh Kothari <pritesh.kothari@cisco.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Add support for kernel 3.14.
Pritesh Kothari [Thu, 1 May 2014 22:50:48 +0000 (15:50 -0700)]
datapath: Add support for kernel 3.14.

Signed-off-by: Pritesh Kothari <pritesh.kothari@cisco.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: handle recirculation loop detection
Andy Zhou [Wed, 30 Apr 2014 23:13:27 +0000 (16:13 -0700)]
datapath: handle recirculation loop detection

Current datapath limits the number of times same packet can loop
through action execution to avoid blowing out the kernel stack.
Recirculation also adds to action execution count, but does not use
the same amount of stack compare to other services, such as IPsec.

This patch introduces the concept of stack cost. Recirculation has a
stack cost of 1 while other services have stack cost of 4. Datapath
packet process can accommodate packets that need both services and
recirculation as long as the total stack cost does not exceed the max
stack cost. Packets exceed the limit will be treated as looped packets
and dropped.

The max stack cost is set to allow up to 4 regular services, plus up
to 3 recirculation. The behavior of packets do not recirculate does
not change.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agoofproto: Fix is_flow_deletion_pending() false positive.
Ethan Jackson [Thu, 1 May 2014 00:24:21 +0000 (17:24 -0700)]
ofproto: Fix is_flow_deletion_pending() false positive.

If one tries to install a rule that's identical to another rule in
another OpenFlow table which is being deleted, it's possible that
is_flow_deletion_pending() might confuse them and block the
installation.  This is such an edge case I doubt it has ever actually
happened.

Found by inspection.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Fix potential leak during flow mods.
Ethan Jackson [Wed, 30 Apr 2014 21:52:28 +0000 (14:52 -0700)]
ofproto: Fix potential leak during flow mods.

This code created a cls_rule without destroying it.  Found by
inspection.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoofproto-dpif: Make bonding balance test more robust
Simon Horman [Thu, 1 May 2014 16:40:17 +0000 (16:40 +0000)]
ofproto-dpif: Make bonding balance test more robust

It is my observation that when sending 91 packets to a mode=balance
bond interface with three underlying ports in some cases not all ports
receive at least 7 packets. This causes the test to fail.

It may be that failure indicates that the bonding code
needs improvement. But it seems to me that its more likely to
be a valid behaviour.

I have found that by sending 256 packets instead of 91 the test passes
more reliably: I am yet to see it fail.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Andy Zhou <azhou@nicira.com>
10 years agoovs-thread: Fix OVS_ADAPTIVE_MUTEX_INITIALIZER.
Ben Pfaff [Thu, 1 May 2014 15:46:45 +0000 (08:46 -0700)]
ovs-thread: Fix OVS_ADAPTIVE_MUTEX_INITIALIZER.

Commit 05bf6d3c62e1d (ovs-thread: Add checking for mutex and rwlock
initialization.) updated mutex and rwlock initializers to set the "where"
member to a nonnull value, but missed this one.  This commit fixes the
problem.

This does not cause real problems in practice because
OVS_ADAPTIVE_MUTEX_INITIALIZER has no existing users.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoovs-ctl: Install manpage.
Ben Pfaff [Thu, 1 May 2014 15:10:20 +0000 (08:10 -0700)]
ovs-ctl: Install manpage.

It seems that it is useful to admins after all.

Reported-by: Brian Candler <b.candler@pobox.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoMerge pull request #1 from spil-jasper/master
Ben Pfaff [Thu, 1 May 2014 14:40:35 +0000 (07:40 -0700)]
Merge pull request #1 from spil-jasper/master

Add BuildRequires to RHEL specfile

10 years agoofproto-dpif: Correct check_recirc comment
Simon Horman [Thu, 1 May 2014 08:34:20 +0000 (17:34 +0900)]
ofproto-dpif: Correct check_recirc comment

This is a proposed correction for what appears to be
an editing error.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-print: Enable printing OF1.4 version
Alexandru Copot [Thu, 1 May 2014 10:22:20 +0000 (13:22 +0300)]
ofp-print: Enable printing OF1.4 version

Also fix some tests that can now properly print packets
with the new protocol version.

Signed-off-by: Alexandru Copot <alex.mihai.c@gmail.com>
Cc: Daniel Baluta <dbaluta@ixiacom.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Move recirc members from struct xlate_out to struct xlate_ctx
Simon Horman [Thu, 1 May 2014 08:29:59 +0000 (17:29 +0900)]
ofproto-dpif: Move recirc members from struct xlate_out to struct xlate_ctx

There does not seem to be a reason to expose
recirc members in struct xlate_out to move them
to struct xlate_ctx.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-xlate: Fix in_port=controller case for NORMAL action
YAMAMOTO Takashi [Wed, 30 Apr 2014 01:10:12 +0000 (10:10 +0900)]
ofproto-dpif-xlate: Fix in_port=controller case for NORMAL action

The problem mentioned by Simon Horman in the following mail.
http://openvswitch.org/pipermail/dev/2014-April/039492.html

Cc: Simon Horman <horms@verge.net.au>
Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agobfd: Require bfd control packet received in forwarding_if_rx mode.
Alex Wang [Wed, 16 Apr 2014 23:00:40 +0000 (16:00 -0700)]
bfd: Require bfd control packet received in forwarding_if_rx mode.

This commit adds a requirement that bfd session must receive at least
one bfd control packet every 100 * bfd->cfg_min_rx amount of time in
forwarding_if_rx mode.  Otherwise, even if the data packets are received
on the monitored interface, the bfd->forwarding is still false.

Since the datapath flow is not purged when the userspace Open Vswitch
crashes, data packet can still be forwarded through the tunnel and
fool the remote BFD session in forwarding_if_rx mode.  Thus, this commit
can prevent the remote BFD session from falsely declaring tunnel liveness
in this situation.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agocfm: Require ccm received in demand mode.
Alex Wang [Wed, 9 Apr 2014 17:58:54 +0000 (10:58 -0700)]
cfm: Require ccm received in demand mode.

This commit adds a new requirement that cfm session must receive
at least one ccm every 100 * cfm_interval amount of time in demand
mode.  Otherwise, even if the data packets are received on the
monitored interface, the cfm session still reports "[recv]" fault.

Since the datapath flow is not purged when the userspace Open Vswitch
crashes, data packet can still be forwarded through the tunnel and
fool the remote CFM session in demand mode.  Thus, this commit can
prevent the remote CFM session from falsely declaring tunnel liveness
in this situation.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agobridge: Remove traces of flow-eviction-threshold.
Joe Stringer [Wed, 30 Apr 2014 21:50:59 +0000 (09:50 +1200)]
bridge: Remove traces of flow-eviction-threshold.

This configuration option was shifted in 2.0, then removed in 2.1.
Remove the misleading log message.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agolib/classifier: Use a prefix tree to optimize ports wildcarding.
Jarno Rajahalme [Wed, 30 Apr 2014 21:09:08 +0000 (14:09 -0700)]
lib/classifier: Use a prefix tree to optimize ports wildcarding.

Using a prefix tree (aka 'trie') for transport ports matching produces
less specific (more wildcarded) datapath megaflows.

Each subtable that matches on transport ports has it's own ports trie.
This trie is consulted only after a failing lookup to determine the
number of bits that need to be unwildcarded to guarantee that any
packet that should match on any of the other rules will not match this
megaflow.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif: Close race between processing packet_ins and checking seqno.
Ben Pfaff [Wed, 30 Apr 2014 18:07:46 +0000 (11:07 -0700)]
ofproto-dpif: Close race between processing packet_ins and checking seqno.

If a packet-in were to be queued, and the sequence number changed, after
grabbing the list of packet-ins, then the existing code could have gone to
sleep until something happened.  By grabbing the sequence number before
the list of packet-ins, we avoid this race.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Remove unnecessary flow variable.
Pravin B Shelar [Tue, 29 Apr 2014 23:27:50 +0000 (16:27 -0700)]
datapath: Remove unnecessary flow variable.

Patch fixes following warning:
datapath/linux/flow_table.c:580:40: warning: symbol 'flow' shadows an earlier one
datapath/linux/flow_table.c:558:24: originally declared here

Reported-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agoEnable OpenFlow 1.0, 1.1, 1.2, and 1.3 by default.
Ben Pfaff [Wed, 30 Apr 2014 13:54:09 +0000 (06:54 -0700)]
Enable OpenFlow 1.0, 1.1, 1.2, and 1.3 by default.

The Open vSwitch software switch now supports all the required features of
OpenFlow 1.0 through 1.3, with one known trivial exception[*].  Enable them
by default in ovs-vswitchd.

For now, ovs-ofctl only enables OpenFlow 1.0 by default.  This is
because ovs-ofctl implements command such as "add-flow" as raw
OpenFlow requests, but those requests have subtly different semantics
in different OpenFlow versions.  For example:

    - In OpenFlow 1.0, a "mod-flow" operation that does not find any
      existing flow to modify adds a new flow.

    - In OpenFlow 1.1, a "mod-flow" operation that does not find any
      existing flow to modify adds a new flow, but only if the
      mod-flow did not match on the flow cookie.

    - In OpenFlow 1.2 and a later, a "mod-flow" operation never adds a
      new flow.

[*] OpenFlow 1.1, but not any earlier or later version of OpenFlow,
    requires support for VLANs introduced by Ethertype 0x88a8, but Open
    vSwitch does not support this Ethertype.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoAdd BuildRequires to RHEL specfile
Jasper Capel [Wed, 9 Apr 2014 06:38:43 +0000 (08:38 +0200)]
Add BuildRequires to RHEL specfile

Added a build-time dependency on openssl-devel, so you can easily build
a source RPM and then pass it into mock for building in a clean build
environment (without manually having to install the buildrequires).

Signed-off-by: Jasper Capel <jasper@capel.tv>
10 years agobond: fix uninitialized use of use_recirc variable
Andy Zhou [Tue, 29 Apr 2014 20:04:00 +0000 (13:04 -0700)]
bond: fix uninitialized use of use_recirc variable

Caught by clang-3.5.

Reported-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Pritesh Kothari <pritesh.kothari@cisco.com>
10 years agolib/classifier: Support variable sized miniflows.
Jarno Rajahalme [Tue, 29 Apr 2014 22:50:39 +0000 (15:50 -0700)]
lib/classifier: Support variable sized miniflows.

Change the classifier to allocate variable sized miniflows and
minimasks in cls_match and cls_subtable, respectively.  Do not
duplicate the mask in cls_rule any more.

miniflow_clone and miniflow_move can now take variably sized miniflows
as source.  The destination is assumed to be regularly sized miniflow.

Inlining miniflow and mask values reduces memory indirection and helps
reduce cache misses.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agolib/flow: Maintain miniflow offline values explicitly.
Jarno Rajahalme [Tue, 29 Apr 2014 22:50:39 +0000 (15:50 -0700)]
lib/flow: Maintain miniflow offline values explicitly.

This allows use of miniflows that have all of their values inline.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agolib/classifier: Separate cls_rule internals from the API.
Jarno Rajahalme [Tue, 29 Apr 2014 22:50:38 +0000 (15:50 -0700)]
lib/classifier: Separate cls_rule internals from the API.

Keep an internal representation of a rule separate from the one
embedded into user's structs.  This allows for further memory
optimization in the classifier.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoclassifier: Use array for subtables instead of a list.
Jarno Rajahalme [Tue, 29 Apr 2014 22:50:38 +0000 (15:50 -0700)]
classifier: Use array for subtables instead of a list.

Using a linear array allows more efficient memory access for lookups.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agolib: Add prefetch support (for GCC)
Jarno Rajahalme [Tue, 29 Apr 2014 22:50:38 +0000 (15:50 -0700)]
lib: Add prefetch support (for GCC)

Define OVS_PREFETCH() and OVS_PREFETCH_WRITE() using builtin prefetch
for GCC, and ovs_prefetch_range() for prefetching a range of addresses.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agolib/flow: Optimize minimask_has_extra() and minimask_is_catchall()
Jarno Rajahalme [Tue, 29 Apr 2014 22:50:38 +0000 (15:50 -0700)]
lib/flow: Optimize minimask_has_extra() and minimask_is_catchall()

We only need to iterate over the bits masked by the 'b' in
minimask_has_extra(), since for zeroes in 'b' there can be no 'extra'
wildcards in 'a', as 'b' has already wildcarded all the bits.

minimask_is_catchall() can be simplified by the invariant that mask's
map never has 1-bits for all-zero values.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agolib/classifier: Hide more of the internal data structures.
Jarno Rajahalme [Tue, 29 Apr 2014 22:50:38 +0000 (15:50 -0700)]
lib/classifier: Hide more of the internal data structures.

It is better not to expose definitions not needed by users.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Use classifer cursor API to collect vlan usage.
Jarno Rajahalme [Tue, 29 Apr 2014 22:50:38 +0000 (15:50 -0700)]
ofproto: Use classifer cursor API to collect vlan usage.

This was the only place in OVS code that accessed classifier internal
data structures directly.  Use the classifier cursor API instead, so
that following patches can hide classifier internal data structures.

Note: There seems to be no test case to verify that this vlan usage
collection is implemented correctly.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agolib: Inline functions used in classifier_lookup.
Jarno Rajahalme [Tue, 29 Apr 2014 22:50:38 +0000 (15:50 -0700)]
lib: Inline functions used in classifier_lookup.

This helps about 1% in TCP_CRR performance test.  However, this also
helps by clearly showing the classifier_lookup() cost in perf reports
as one item.

This also cleans up the flow/match APIs from functionality only used
by the classifier, making is more straightforward to evolve them
later.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agolib/flow: Simplify miniflow accessors, add ipv6 support.
Jarno Rajahalme [Tue, 29 Apr 2014 22:50:38 +0000 (15:50 -0700)]
lib/flow: Simplify miniflow accessors, add ipv6 support.

Add new macro MINIFLOW_MAP(FIELD) that returns the map covering the
given struct flow field.

Change the miniflow accessors to macros so that they can take the
field name directly.

Use these to add ipv6 support to miniflow_hash_5tuple().

Add ipv6 support to flow_hash_5tuple() as well so that these two
functions continue to return the same hash value for the corresponding
flows.

Also, simplify miniflow_get_metadata().

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Inline trivial functions.
Jarno Rajahalme [Tue, 29 Apr 2014 22:50:38 +0000 (15:50 -0700)]
ofproto: Inline trivial functions.

rule_dpif_is_internal is among the top ten OVS internal functions in
recent perf reports.  Inline it and some other equally trivial
functions.

This change removes rule_is_internal(), since the fact that a table is
an internal one is defined within ofproto-dpif, not ofproto.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Inline actions in struct rule_actions.
Jarno Rajahalme [Tue, 29 Apr 2014 22:50:38 +0000 (15:50 -0700)]
ofproto: Inline actions in struct rule_actions.

Allocate struct rule_actions and the space for the actions at once.
This reduces one memory indirection and helps reduce cache misses
visible in perf annotations.

Fix some old comments referring to ref count, since we now use RCU for
this.

Enforce constness of the actions that are assigned from rule_actions
throughout the code.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-rcu: Log the name of the main thread as "main" instead of "".
Ben Pfaff [Tue, 29 Apr 2014 21:44:39 +0000 (14:44 -0700)]
ovs-rcu: Log the name of the main thread as "main" instead of "".

The main thread has the empty string as its name, but that's not a good
log string.

Without this patch we can get log message like
    blocked 1000 ms waiting for  to quiesce
from ovsrcu_synchronize().

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
10 years agotests: Whitelist messages about RCU blocking in the testsuite.
Ben Pfaff [Tue, 29 Apr 2014 21:40:51 +0000 (14:40 -0700)]
tests: Whitelist messages about RCU blocking in the testsuite.

In production these may indicate a bug, but in the testsuite they probably
just indicate a time-warp.

Reported-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
10 years agoofp-version-opt: Fix spelling and capitalization.
Ben Pfaff [Tue, 29 Apr 2014 20:55:54 +0000 (13:55 -0700)]
ofp-version-opt: Fix spelling and capitalization.

"OpenFlow" is one word.
"Version" isn't a proper noun.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
10 years agodatapath: Convert mask list in mask array.
Pravin B Shelar [Wed, 23 Apr 2014 15:34:51 +0000 (08:34 -0700)]
datapath: Convert mask list in mask array.

mask caches index of mask in mask_list.  On packet recv OVS
need to traverse mask-list to get cached mask.  Therefore array
is better for retrieving cached mask.  This also allows better
cache replacement algorithm by directly checking mask's existence.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Thomas Graf <tgraf@redhat.com>
10 years agodatapath: Add flow mask cache.
Pravin B Shelar [Wed, 23 Apr 2014 15:34:08 +0000 (08:34 -0700)]
datapath: Add flow mask cache.

On every packet OVS needs to lookup flow-table with every mask
until it finds a match. The packet flow-key is first masked
with mask in the list and then the masked key is looked up in
flow-table.  Therefore number of masks can affect packet
processing performance.

Following patch adds mask index to mask cache from last
pakcet lookup in same flow.  Index of mask is stored in
this cache. This cache is searched by 5 tuple hash (skb rxhash).

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Thomas Graf <tgraf@redhat.com>
10 years agodatapath: Move table destroy to dp-rcu callback.
Pravin B Shelar [Wed, 23 Apr 2014 15:33:38 +0000 (08:33 -0700)]
datapath: Move table destroy to dp-rcu callback.

Ths simplifies flow-table-destroy API.  This change is required
for following patches.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Thomas Graf <tgraf@redhat.com>
10 years agonetdev: Fix an use of uninitialized mutex.
Alex Wang [Tue, 29 Apr 2014 06:42:51 +0000 (23:42 -0700)]
netdev: Fix an use of uninitialized mutex.

Commit 05bf6d3c62e1d (ovs-thread: Add checking for mutex and
rwlock initialization.) helps find an use of uninitialized
mutex (netdev_class_mutex) during upgrade.  The assertion
check aborts the ovs.

This commit fixes the issue by adding the proper initialization.

Bug #1239914.
Bug #1240598.
Bug #1240626.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-linux: Fix a bug in creating port.
Alex Wang [Tue, 29 Apr 2014 05:05:05 +0000 (22:05 -0700)]
dpif-linux: Fix a bug in creating port.

Based on the policy of 'OVS_VPORT_ATTR_UPCALL_PID', if upcall should
not be sent to userspace (i.e. the number of handler threads is zero),
the netlink message for creating vport should be an one-element array of
value 0.  However, dpif_linux_port_add__() fails to obey it and generates
zero-payload netlink message which causes the netlink transaction failing
with ERANGE error.

This is particularly bad when the 'flow-restore-wait' is set during upgrade,
since number of handler threads is not set in dpif-linux module and ovs is
not able to add port in datapath until the 'flow-restore-wait' is disabled.
Connection may lose due to this bug.

This bug was introduced by commit 1579cf677fc (dpif-linux: Implement the
API functions to allow multiple handler threads read upcall.).

This commit fixes the bug by fixing the dpif_linux_port_add__() to generate
the correct netlink message when the number of handler threads is not set.

Bug #1239914.
Bug #1240598.
Bug #1240626.

Reported-by: Gurucharan Shetty <gshetty@nicira.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: restore bond rebalance for non-recirc bond
Andy Zhou [Fri, 25 Apr 2014 02:20:05 +0000 (19:20 -0700)]
ofproto-dpif: restore bond rebalance for non-recirc bond

Bond rebalancing was disabled for bonds not using recirculation. The
patch fixes this bug.

While fixing the bug, the bond_rebalance() was also restructured
slightly to move bond related logic back into ofproto/bond.c

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-bond: do not allow recirculation when we failed to allocate recirc_id
Andy Zhou [Fri, 25 Apr 2014 02:21:40 +0000 (19:21 -0700)]
ofproto-bond: do not allow recirculation when we failed to allocate recirc_id

When recirc pool is exhausted, a new bond won't be allocate a new
recirc_id. The bond->recirc_id will remain zero. This condition
should prevent the bond from use recirculation. This check was missing
before this patch.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoopenvswitch.h: Clarify use of key attributes.
Jarno Rajahalme [Tue, 29 Apr 2014 00:31:26 +0000 (17:31 -0700)]
openvswitch.h: Clarify use of key attributes.

Key attributes relating to actual packet headers are ignored for
OVS_PACKET_CMD_EXECUTE as the header key attributes are retrieved
from the packet itself.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agolib/odp-util: Remove extra parenthesis from sctp key output.
Jarno Rajahalme [Tue, 29 Apr 2014 00:31:25 +0000 (17:31 -0700)]
lib/odp-util: Remove extra parenthesis from sctp key output.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoopenvswitch.h: Note that 64 bit ints are 4-aligned.
Jarno Rajahalme [Tue, 29 Apr 2014 00:31:25 +0000 (17:31 -0700)]
openvswitch.h: Note that 64 bit ints are 4-aligned.

In general, all Netlink 64-bit data may be 4-byte aligned, due to
netlink header and attributes being 4-aligned.

To avoid unaligned access the data should be copied out of the netlink
attribute before access.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>