sliver-openvswitch.git
10 years agoMerge branch 'mainstream'
Giuseppe Lettieri [Sat, 24 Aug 2013 10:23:11 +0000 (12:23 +0200)]
Merge branch 'mainstream'

10 years agodpif: Change get_max_ports() to return uint32_t.
Alex Wang [Thu, 22 Aug 2013 21:24:18 +0000 (14:24 -0700)]
dpif: Change get_max_ports() to return uint32_t.

The declaration of 'get_max_ports()' to return odp_port_t adds
unwanted complexity to coding.  This commit changes it back to
return uint32_t type.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Change max_ports and alloc_port_no to uint16_t type.
Alex Wang [Thu, 22 Aug 2013 21:24:17 +0000 (14:24 -0700)]
ofproto: Change max_ports and alloc_port_no to uint16_t type.

The declaration of 'max_ports' and 'alloc_port_no' as ofp_port_t
adds unwanted complexity to coding.  This commit changes them back
to uint16_t type.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: remove the extra reset to make code clear to read.
pritesh [Thu, 22 Aug 2013 20:59:32 +0000 (13:59 -0700)]
ofproto: remove the extra reset to make code clear to read.

Signed-off-by: pritesh <pritesh.kothari@cisco.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agometa-flow: Use correct OF1.2+ errors for invalid fields in actions.
Ben Pfaff [Fri, 23 Aug 2013 18:11:03 +0000 (11:11 -0700)]
meta-flow: Use correct OF1.2+ errors for invalid fields in actions.

OFPERR_OFPBAC_BAD_ARGUMENT is not as specific as the errors provided by
OpenFlow 1.2 and later.

Some of these errors needed Nicira extension numbers for use with OpenFlow
1.0 and 1.1, so this commit also adds those.

Some of these errors had poor explanations likely to confuse users, so this
commits improves them.

Some of the errors had the wrong names, so this commit fixes them.

Reported-by: Jean Tourrilhes <jt@hpl.hp.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jean Tourrilhes <jt@hpl.hp.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoofproto-dpif-xlate: Refactor xlate_table_action() to avoid Clang warnings.
Ben Pfaff [Fri, 23 Aug 2013 18:03:55 +0000 (11:03 -0700)]
ofproto-dpif-xlate: Refactor xlate_table_action() to avoid Clang warnings.

I get a bunch of thread-safety warnings with the latest Clang without this
patch, because Clang is smart enough to see locking and unlocking but not
smart enough to figure out the relationships.  This refactoring avoids the
warnings.

I first noticed these warnings with Clang 1:3.4~svn188890-1~exp1.
I previously used version 1:3.4~svn187484-1~exp1.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoofproto-dpif: Fix thread safety annotation on rule_dpif_lookup_in_table().
Ben Pfaff [Wed, 21 Aug 2013 18:27:25 +0000 (11:27 -0700)]
ofproto-dpif: Fix thread safety annotation on rule_dpif_lookup_in_table().

New Clang versions raise warnings about the incorrect old annotation.

I first noticed these warnings with Clang 1:3.4~svn188890-1~exp1.
I previously used version 1:3.4~svn187484-1~exp1.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoofproto-dpif-upcall.c: Fix indentation.
Jarno Rajahalme [Thu, 22 Aug 2013 23:01:41 +0000 (16:01 -0700)]
ofproto-dpif-upcall.c: Fix indentation.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoRemove duplicate call to subfacet_create().
Jarno Rajahalme [Thu, 22 Aug 2013 22:51:39 +0000 (15:51 -0700)]
Remove duplicate call to subfacet_create().

There were two calls to subfacet_create(), which is redundant.  The first
one seemed the one to remove, as there is a subsequent test on the facet's
subfacet list being empty, which is never true after a call to
subfacet_create().  The correctness of this needs to be checked, however.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobfd: Implement forwarding_if_rx.
Alex Wang [Thu, 22 Aug 2013 22:44:23 +0000 (15:44 -0700)]
bfd: Implement forwarding_if_rx.

This commit adds a new boolean option "forwarding_if_rx" to bfd.

When forwarding_if_rx is true the interface will be considered
capable of packet I/O as long as there is packet received at
interface.  This is important in that when link becomes temporarily
conjested, consecutive BFD control packets can be lost.  And the
forwarding_if_rx can prevent link failover by detecting non-control
packets received at interface.

Signed-off-by: Alex Wang <alexw@nicira.com>
10 years agodatapath: Remove redundant EtherType check in vlan translation.
Jesse Gross [Thu, 22 Aug 2013 20:30:45 +0000 (13:30 -0700)]
datapath: Remove redundant EtherType check in vlan translation.

This was supposed to be part of the previous patch but I forgot
to commit it before pushing.

Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: More strict vlan encap netlink check
Andy Zhou [Thu, 15 Aug 2013 21:16:52 +0000 (14:16 -0700)]
datapath: More strict vlan encap netlink check

Only parse the encap key field if eth_type is 802.1Q and
VLAN_TAG_PRESENT bit is set. Add a few more eror checks and logs.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Rename key_len to key_end
Andy Zhou [Fri, 16 Aug 2013 23:01:29 +0000 (16:01 -0700)]
datapath: Rename key_len to key_end

Key_end is a better name describing the ending boundary than key_len.
Rename those variables to make it less confusing.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agobond: Fix error in bond_shift_load().
Alex Wang [Thu, 22 Aug 2013 18:29:04 +0000 (11:29 -0700)]
bond: Fix error in bond_shift_load().

Commit 4a1b8f30e(bond: Stop using tags.) introduced the bug that
prevents the load shifting when the traffic needs to be balanced.
This commit fixes this bug.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Fix typo in comment.
Ben Pfaff [Wed, 21 Aug 2013 21:15:33 +0000 (14:15 -0700)]
ofproto: Fix typo in comment.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Mark rule_release() as no_thread_safety_analysis.
Ben Pfaff [Wed, 21 Aug 2013 18:33:49 +0000 (11:33 -0700)]
ofproto-dpif: Mark rule_release() as no_thread_safety_analysis.

Otherwise new Clang complains about this function because it only sometimes
releases the lock (that is, it only does it when there is a lock to
release).

I first noticed these warnings with Clang 1:3.4~svn188890-1~exp1.
I previously used version 1:3.4~svn187484-1~exp1.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-thread: Mark lock and unlock functions as no_thread_safety_analysis.
Ben Pfaff [Wed, 21 Aug 2013 18:24:49 +0000 (11:24 -0700)]
ovs-thread: Mark lock and unlock functions as no_thread_safety_analysis.

I don't see any other way to make Clang realize that these are the real
mutex implementation functions.

I first noticed these warnings with Clang 1:3.4~svn188890-1~exp1.
I previously used version 1:3.4~svn187484-1~exp1.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofp-util: Add SCTP support
Joe Stringer [Thu, 22 Aug 2013 08:24:45 +0000 (20:24 +1200)]
ofp-util: Add SCTP support

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Add SCTP support
Joe Stringer [Thu, 22 Aug 2013 08:24:44 +0000 (20:24 +1200)]
ofproto-dpif: Add SCTP support

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Add SCTP support
Joe Stringer [Thu, 22 Aug 2013 08:24:43 +0000 (20:24 +1200)]
datapath: Add SCTP support

This patch adds support for rewriting SCTP src,dst ports similar to the
functionality already available for TCP/UDP.

Rewriting SCTP ports is expensive due to double-recalculation of the
SCTP checksums; this is performed to ensure that packets traversing OVS
with invalid checksums will continue to the destination with any
checksum corruption intact.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolib: Add CRC32C Implementation
Joe Stringer [Thu, 22 Aug 2013 08:24:42 +0000 (20:24 +1200)]
lib: Add CRC32C Implementation

This implementation was derived from FreeBSD:
http://svnweb.freebsd.org/base/head/sys/libkern/crc32.c

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoipfix: implement flow caching and aggregation in exporter
Romain Lenglet [Wed, 21 Aug 2013 20:49:04 +0000 (13:49 -0700)]
ipfix: implement flow caching and aggregation in exporter

Implement a per-exporter flow cache with active timeout expiration.
Add columns "cache_active_timeout" and "cache_max_flows" into table
"IPFIX" to configure each cache.

Add per-flow elements "octetDeltaSumOfSquares",
"minimumIpTotalLength", and "maximumIpTotalLength" to replace
"ethernetTotalLength".  Add per-flow element "flowEndReason" to
indicate whether a flow has expired because of an active timeout, the
cache size limit being reached, or the exporter being stopped.

Signed-off-by: Romain Lenglet <rlenglet@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-parse: Silence uninitialized use warnings with optimized gcc.
Ethan Jackson [Wed, 21 Aug 2013 21:49:09 +0000 (14:49 -0700)]
ofp-parse: Silence uninitialized use warnings with optimized gcc.

GCC 4.6.3 gets confused by the str_to_*() functions in ofp-parse and
spits out the following warning.

error: ‘priority’ may be used uninitialized in this function

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Start ofport allocation from the previous max after restart.
Gurucharan Shetty [Mon, 19 Aug 2013 21:45:02 +0000 (14:45 -0700)]
ofproto: Start ofport allocation from the previous max after restart.

We currently do not recycle ofport numbers from interfaces that are recently
deleted by maintaining the maximum allocated ofport value and
allocating new ofport numbers greater than the previous maximum.
But after a restart of ovs-vswitchd, we start again from ofport value of '1'.
This means that after a restart, we can immeditaley recycle the 'ofport'
value of the most recently deleted interface.

With this commit, during ovs-vswitchd initial configuration, we figure
out the previously allocated max ofport value. New interfaces get ofport
value that is greater than this.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev: Make run and wait functions optional as documented.
Ethan Jackson [Wed, 21 Aug 2013 19:59:28 +0000 (12:59 -0700)]
netdev: Make run and wait functions optional as documented.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Reported-by: Guolin Yang <gyang@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-upcall: Increase upcall stub size.
Ethan Jackson [Wed, 21 Aug 2013 19:56:53 +0000 (12:56 -0700)]
ofproto-dpif-upcall: Increase upcall stub size.

The existing upcall stub size is not large enough even for the
smallest miss upcalls.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Reported-by: Guolin Yang <gyang@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoReinterpret base for meter band types bitmap.
Ben Pfaff [Wed, 21 Aug 2013 20:05:36 +0000 (13:05 -0700)]
Reinterpret base for meter band types bitmap.

OpenFlow 1.3 says that the band_types member of struct ofp_meter_features
is a bitmap of OFPMBT_* values.  The OFPMBT_* values are 1-based, so
until now, to avoid wasting bit 0, OVS mapped an OFPMBT_* with value 1 to
bit 0, value 2 to bit 1, and so on.  However, according to
http://openvswitch.org/pipermail/dev/2013-July/029666.html,
other OpenFlow implementations directly translate value 1 to bit 1,
value 2 to bit 2, and so on.  This commit changes Open vSwitch to use this
more common interpretation.

A request for clarification of this issue in the OpenFlow standard has been
filed with the ONF Extensibility Working Group as issue EXT-345.

Reported-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoovs-atomic: Fix typo in comment.
Ben Pfaff [Wed, 21 Aug 2013 16:58:38 +0000 (09:58 -0700)]
ovs-atomic: Fix typo in comment.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ed Maste <emaste@freebsd.org>
10 years agoodp-util: New function odp_flow_key_to_mask().
Guolin Yang [Tue, 20 Aug 2013 17:40:50 +0000 (10:40 -0700)]
odp-util: New function odp_flow_key_to_mask().

With megaflow support, there is API to convert mask to nlattr key based
format.  This change introduces API to do the reverse conversion.  We
leverage the existing odp_flow_key_to_flow() API to reuse the code.

Signed-off-by: Guolin Yang <gyang@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agosparse: Suppress sparse warnings for global variables.
Alex Wang [Tue, 20 Aug 2013 22:24:19 +0000 (15:24 -0700)]
sparse: Suppress sparse warnings for global variables.

sparse warns if a non-static variable with external linkage has an
initializer at first declaration.  This commit suppresses the
warnings issued when adding custom section is not supported by
compiler.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-atomic: atomic_load() must take a non-const argument.
Ben Pfaff [Tue, 20 Aug 2013 17:46:15 +0000 (10:46 -0700)]
ovs-atomic: atomic_load() must take a non-const argument.

C11 says that atomic_load() requires a non-const argument, and Clang
enforces that.  This fixes warnings with FreeBSD <stdatomic.h> that uses
the Clang extensions.

Reported-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ed Maste <emaste@freebsd.org>
10 years agoofproto-dpif: Enable smooth transition between CFM and BFD.
Alex Wang [Wed, 21 Aug 2013 02:45:00 +0000 (02:45 +0000)]
ofproto-dpif: Enable smooth transition between CFM and BFD.

When user switches between using CFM and BFD, there will be a short
down time before the new protocol goes up.  This can unintentionally
change the traffic pattern of the bundled ports.  To prevent this,
it is proposed that user can enable both CFM and BFD before transition,
wait for the new protocol to go up, and then disable the old protocol.

To make this scheme work, this commit modifies the port_run() in
ofproto-dpif.c, so that when both CFM and BFD are used, if either shows
correct status, the port is considered usable in the bundle.

Signed-off-by: Alex Wang <alexw@nicira.com>
10 years agobfd: Implement BFD decay.
Alex Wang [Tue, 20 Aug 2013 23:41:05 +0000 (23:41 +0000)]
bfd: Implement BFD decay.

When there is no incoming data traffic at the interface for a period,
BFD decay allows the bfd session to increase the min_rx. This is
helpful in that some interfaces may usually be idle for a long time.
And cpu consumption can be reduced by processing fewer bfd control
packets.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agocoverage: Make thread-safe.
Ben Pfaff [Tue, 20 Aug 2013 20:46:33 +0000 (13:46 -0700)]
coverage: Make thread-safe.

This makes each of the coverage counters per-thread.  It abandons the
idea of trying to keep track of the number of hits in the "current" poll
loop, since there are many poll loops running, each in its own thread, as
well as the idea of numbering epochs for the same reason.  Instead, we
just keep track of overall totals for the process for each coverage
counter, accumulating per-thread counts into the global total each time
a thread's main loop passes through poll_block().

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoUse "error-checking" mutexes in place of other kinds wherever possible.
Ben Pfaff [Tue, 20 Aug 2013 20:40:02 +0000 (13:40 -0700)]
Use "error-checking" mutexes in place of other kinds wherever possible.

We've seen a number of deadlocks in the tree since thread safety was
introduced.  So far, all of these are self-deadlocks, that is, a single
thread acquiring a lock and then attempting to re-acquire the same lock
recursively.  When this has happened, the process simply hung, and it was
somewhat difficult to find the cause.

POSIX "error-checking" mutexes check for this specific problem (and
others).  This commit switches from other types of mutexes to
error-checking mutexes everywhere that we can, that is, everywhere that
we're not using recursive mutexes.  This ought to help find problems more
quickly in the future.

There might be performance advantages to other kinds of mutexes in some
cases.  However, the existing mutex type choices were just guesses, so I'd
rather go for easy detection of errors until we know that other mutex
types actually perform better in specific cases.  Also, I did a quick
microbenchmark of glibc mutex types on my host and found that the
error checking mutexes weren't any slower than the other types, at least
when the mutex is uncontended.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif-sflow: Fix memory leak.
Ben Pfaff [Tue, 20 Aug 2013 18:27:32 +0000 (11:27 -0700)]
ofproto-dpif-sflow: Fix memory leak.

dpif_sflow_set_options() uses xcalloc() to allocate space for the SFLAgent
structure, but nothing ever freed it.  This fixes the problem.

Found by valgrind.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif-xlate: Add comment on xlate_actions().
Ben Pfaff [Tue, 20 Aug 2013 18:16:14 +0000 (11:16 -0700)]
ofproto-dpif-xlate: Add comment on xlate_actions().

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Fix argument descriptions in vport.c.
Justin Pettit [Tue, 20 Aug 2013 00:25:08 +0000 (17:25 -0700)]
datapath: Fix argument descriptions in vport.c.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Fix function description in vport-lisp.c.
Justin Pettit [Tue, 20 Aug 2013 00:24:39 +0000 (17:24 -0700)]
datapath: Fix function description in vport-lisp.c.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Remove old argument description in flow.c.
Justin Pettit [Tue, 20 Aug 2013 00:23:26 +0000 (17:23 -0700)]
datapath: Remove old argument description in flow.c.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Fix typos in Netlink debugging messages.
pritesh [Mon, 19 Aug 2013 19:00:22 +0000 (12:00 -0700)]
datapath: Fix typos in Netlink debugging messages.

Signed-off-by: pritesh <pritesh.kothari@cisco.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agonew makefile target for error reporting
Giuseppe Lettieri [Sun, 18 Aug 2013 10:20:11 +0000 (12:20 +0200)]
new makefile target for error reporting

10 years agolog errors from host command
Giuseppe Lettieri [Sun, 18 Aug 2013 10:18:49 +0000 (12:18 +0200)]
log errors from host command

10 years agotake only the first address returned by host
Giuseppe Lettieri [Sun, 18 Aug 2013 09:00:58 +0000 (11:00 +0200)]
take only the first address returned by host

10 years agotests: Fix build on FreeBSD
Ed Maste [Sat, 17 Aug 2013 20:40:11 +0000 (16:40 -0400)]
tests: Fix build on FreeBSD

Avoid relying on a non-portable implementation detail for atomic_flag
tests.  Per the standard, the only way to obtain the value of the flag
is via the return value from atomic_flag_test_and_set.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoMerge branch 'mainstream'
Giuseppe Lettieri [Sat, 17 Aug 2013 13:08:21 +0000 (15:08 +0200)]
Merge branch 'mainstream'

10 years agofix warning
Giuseppe Lettieri [Thu, 15 Aug 2013 21:17:30 +0000 (23:17 +0200)]
fix warning

10 years agothread safety for netdev_pltap and netdev_tunnel
Giuseppe Lettieri [Thu, 15 Aug 2013 21:08:40 +0000 (23:08 +0200)]
thread safety for netdev_pltap and netdev_tunnel

10 years agoMerge branch 'mainstream'
Giuseppe Lettieri [Thu, 15 Aug 2013 18:43:14 +0000 (20:43 +0200)]
Merge branch 'mainstream'

Conflicts:
lib/netdev.c

10 years agonetdev_pltap,netdev_tunnel: moved to new API
Giuseppe Lettieri [Thu, 15 Aug 2013 18:28:31 +0000 (20:28 +0200)]
netdev_pltap,netdev_tunnel: moved to new API

10 years agoMerge commit '9dc63482bbeae23dd57b0f885a3fd26b44656844'
Giuseppe Lettieri [Thu, 15 Aug 2013 17:35:59 +0000 (19:35 +0200)]
Merge commit '9dc63482bbeae23dd57b0f885a3fd26b44656844'

10 years agonetdev-pltap: Make access to AF_INET socket thread-safe.
Giuseppe Lettieri [Thu, 15 Aug 2013 17:34:06 +0000 (19:34 +0200)]
netdev-pltap: Make access to AF_INET socket thread-safe.

10 years agoadded targets to test links
Giuseppe Lettieri [Thu, 15 Aug 2013 16:16:11 +0000 (18:16 +0200)]
added targets to test links

simple ping-based tests for the links created
by the Makefile

10 years agoMerge commit '259e0b1ad1bfea762a76f0098deb8f8d8db1dfa3'
Giuseppe Lettieri [Thu, 15 Aug 2013 14:11:21 +0000 (16:11 +0200)]
Merge commit '259e0b1ad1bfea762a76f0098deb8f8d8db1dfa3'

10 years agodatapath: compat: remove __net_init and __net_exit annotations.
Pravin B Shelar [Thu, 15 Aug 2013 03:53:32 +0000 (20:53 -0700)]
datapath: compat: remove __net_init and __net_exit annotations.

net_namespace-device can get registered after module init, e.g. vxlan
registers name-space-device on port add.  On kernel without namespace
support __net_init is defined as __init which cause panic on vxlan port
add. Following patch fixes it.

BUG: unable to handle kernel paging request at ffffffffa02b6293
IP: [<ffffffffa02b6293>] 0xffffffffa02b6293
PGD 1a87067 PUD 1a8b063 PMD 8371de067 PTE 0
Oops: 0010 [#1] SMP
Process ovs-vswitchd (pid: 10330, threadinfo ffff8808367fe000, task
      f880839e16aa0)
Stack:
Call Trace:
 [<ffffffff8144b254>] ? register_pernet_gen_device+0x74/0xd0
 [<ffffffffa027e220>] ? vxlan_rcv+0x0/0x60 [openvswitch]
 [<ffffffffa0280a7b>] vxlan_handler_add+0x3cb/0x480 [openvswitch]
 [<ffffffffa027e1f4>] vxlan_tnl_create+0xc4/0xf0 [openvswitch]
 [<ffffffffa027b6f3>] ovs_vport_add+0x53/0xb0 [openvswitch]
 [<ffffffffa0273bc6>] new_vport+0x16/0x60 [openvswitch]
 [<ffffffffa0276399>] ovs_vport_cmd_new+0x109/0x210 [openvswitch]
 [<ffffffff81478f80>] genl_rcv_msg+0x1d0/0x210
 [<ffffffff81477e29>] netlink_rcv_skb+0xa9/0xd0
 [<ffffffff81478d95>] genl_rcv+0x25/0x40
 [<ffffffff81477a63>] netlink_unicast+0x283/0x2d0
 [<ffffffff814783de>] netlink_sendmsg+0x1fe/0x2e0
 [<ffffffff8143c8d3>] sock_sendmsg+0x123/0x150
 [<ffffffff8143e0b6>] __sys_sendmsg+0x406/0x420
 [<ffffffff8143e2d9>] sys_sendmsg+0x49/0x90
 [<ffffffff8100b072>] system_call_fastpath+0x16/0x1b
Code:  Bad RIP value.
RIP  [<ffffffffa02b6293>] 0xffffffffa02b6293

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Bug #19178

10 years agonetdev-linux: Fix self-deadlocks in traffic control code.
Ben Pfaff [Fri, 16 Aug 2013 21:25:16 +0000 (14:25 -0700)]
netdev-linux: Fix self-deadlocks in traffic control code.

htb_parse_qdisc_details__(), which is called with the netdev mutex, called
netdev_get_mtu(), which tried to reacquire the mutex and thus deadlocked.
This commit fixes the problem and similar problems in
htb_parse_class_details__() and hfsc_parse_qdisc_details__().

Bug #19180.
Reported-by: Dhaval Badiani <dbadiani@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agonetdev-dummy: Add Clang lock annotations.
Ben Pfaff [Fri, 16 Aug 2013 21:04:08 +0000 (14:04 -0700)]
netdev-dummy: Add Clang lock annotations.

This commit adds some superfluous locks and unlocks, but they should not
hurt performance and do make Clang happy.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agonetdev-dummy: Fix synchronization error in netdev_dummy_get_config().
Ben Pfaff [Mon, 12 Aug 2013 19:51:47 +0000 (12:51 -0700)]
netdev-dummy: Fix synchronization error in netdev_dummy_get_config().

Found by Clang.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agoofproto-dpif-upcall: ofproto_dpif_send_packet_in() needs object on heap.
YAMAMOTO Takashi [Fri, 16 Aug 2013 05:17:23 +0000 (14:17 +0900)]
ofproto-dpif-upcall: ofproto_dpif_send_packet_in() needs object on heap.

fix a bug introduced by commit e1ec7dd46 (ofproto-dpif: Implement
multi-threaded miss handling.), in which execute_flow_miss() passes a
stack-allocated object to ofproto_dpif_send_packet_in() whereas that
function requires a heap-allocated object.  Also fixes two related bugs:
the 'packet' previously used in the packet-in was invalid and its data
was not copied with xmemdup().

Previously, when there were multiple packets in a single flow miss,
execute_flow_miss() would only send the first one to the controller.  This
was intentional (the goal is to find out whether the controller is
operational, and sending a single packet is sufficient for that) but
possibly confusing to the reader.  This commit switches to sending all of
the packets (the common case is a single packet anyhow).

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoseq: Initialize 'ovsthread_id' member of waiters in seq_wait__().
Ben Pfaff [Fri, 16 Aug 2013 18:20:57 +0000 (11:20 -0700)]
seq: Initialize 'ovsthread_id' member of waiters in seq_wait__().

Found by valgrind.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agoofproto-dpif-xlate: Unreference handles on xbridge removal.
Ethan Jackson [Fri, 16 Aug 2013 01:37:41 +0000 (18:37 -0700)]
ofproto-dpif-xlate: Unreference handles on xbridge removal.

Reported-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
[blp@nicira.com added one more hmap_destroy()]
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobfd: Include prerequisite header for FreeBSD
Ed Maste [Fri, 16 Aug 2013 12:24:30 +0000 (08:24 -0400)]
bfd: Include prerequisite header for FreeBSD

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Fix bad pointer dereference when deleting a bridge.
Ben Pfaff [Fri, 16 Aug 2013 00:54:04 +0000 (17:54 -0700)]
ofproto-dpif: Fix bad pointer dereference when deleting a bridge.

The 'pins' list contains packet-ins, not flow-mods.

Introduced by commit ada3a58d1f8 (ofproto-dpif: Make packet_ins thread
safe.).

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Avoid extra O(N) work in common case on flow addition.
Ben Pfaff [Fri, 16 Aug 2013 00:38:40 +0000 (17:38 -0700)]
ofproto: Avoid extra O(N) work in common case on flow addition.

The OpenFlow OFPFF_CHECK_OVERLAP flag requires us to check whether the flow
being inserted overlaps with any existing flows.  That isn't efficiently
implemented and typically requires us to compare the new flow against most
or all of the existing flows.  We don't have to do that work if
OFPFF_CHECK_OVERLAP is not requested, but commit 0b4f207828c (classifier:
Make use of the classifier thread safe.) inadvertently made us do it
anyway.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Make number of packet handler threads runtime configurable.
Alex Wang [Thu, 15 Aug 2013 07:23:54 +0000 (00:23 -0700)]
ofproto: Make number of packet handler threads runtime configurable.

This commit adds a new column "n-handler-threads" to the Open_vSwitch
table. This is used to set the number of upcall handler threads created by
the ofproto-dpif-upcall module.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: move per-backer wait calls from wait to type_wait
YAMAMOTO Takashi [Thu, 15 Aug 2013 11:25:44 +0000 (20:25 +0900)]
ofproto-dpif: move per-backer wait calls from wait to type_wait

move per-backer wait calls (dpif_wait/udpif_wait) from ofproto_wait
to ofproto_type_wait.

This eliminates excessive poll slot consumption when there is more
than one bridge.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Fix RHEL compat for netdev_rx_handler_register
Chris Wright [Wed, 14 Aug 2013 01:02:48 +0000 (18:02 -0700)]
datapath: Fix RHEL compat for netdev_rx_handler_register

Andrei Andone reported an oops on CentOS 6.4 when adding a device to an
ovs instance.  The problem is easy to reproduce and generates the
following stack trace:

kernel tried to execute NX-protected page - exploit attempt? (uid: 0)
BUG: unable to handle kernel paging request at ffff88033afa49c0
IP: [<ffff88033afa49c0>] 0xffff88033afa49c0
...
Call Trace:
 <IRQ>
 [<ffffffff814487ba>] ? __netif_receive_skb+0x60a/0x750
 [<ffffffff81055f96>] ? enqueue_task+0x66/0x80
 [<ffffffff8144aa38>] netif_receive_skb+0x58/0x60
 [<ffffffff8144ab40>] napi_skb_finish+0x50/0x70
 [<ffffffff8144d0e9>] napi_gro_receive+0x39/0x50
 [<ffffffffa025f46c>] igb_poll+0x7ec/0xc70 [igb]
 [<ffffffff810e6881>] ? cpu_quiet_msk+0xc1/0x130
...

As you can see, we jumped to data rather than code.  This is caused by
a mistake in the compat code for netdev_rx_handler_register which sets
the handler to rx_handler_data rather than rx_handler.  This was
introduced by commit "3e35fe3 datapath: rhel: Move RHEL OVS hook
registration to netdev_rx_handler_register() backport".

Reported-by: Andrei Andone <andrei.andone@softvision.ro>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Cc: Thomas Graf <tgraf@redhat.com>
Cc: Pravin Shelar <pshelar@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
Reviewed-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
10 years agodatapath: Move generic tunnel functions to lisp module.
Pravin B Shelar [Tue, 13 Aug 2013 07:19:53 +0000 (00:19 -0700)]
datapath: Move generic tunnel functions to lisp module.

Generic tunnel rcv and send function are only used by lisp tunneling
module, so It make sense to move them to lisp module.

CC: Lori Jakab <lojakab@cisco.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Lorand Jakab <lojakab@cisco.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Move find_route() to compat.h
Pravin B Shelar [Mon, 29 Jul 2013 22:47:34 +0000 (15:47 -0700)]
datapath: Move find_route() to compat.h

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: move tunnel-init function to flow.h
Pravin B Shelar [Mon, 29 Jul 2013 22:47:27 +0000 (15:47 -0700)]
datapath: move tunnel-init function to flow.h

This makes ovs-module more in-sync with upstream ovs-module.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: tunnel: Fix gre64 tunnel when key not specified.
Pravin B Shelar [Thu, 15 Aug 2013 00:31:57 +0000 (17:31 -0700)]
datapath: tunnel: Fix gre64 tunnel when key not specified.

User is allowed to create tunnel without any keys.  In this
case userspace set tunnel action does not set tun-key flag
which was confusing gre64 vport header calculations.  Following
patch fixes it by always assuming TUNNEL_KEY parameter as we
do it with tun-seq.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Bug #19121

10 years agodatapath: tunnel: Do not use inner ip-header-id for tunnel ip-header-id.
Pravin B Shelar [Wed, 14 Aug 2013 18:46:15 +0000 (11:46 -0700)]
datapath: tunnel: Do not use inner ip-header-id for tunnel ip-header-id.

Using inner-id for tunnel id is not safe in some rare cases.
E.g. packets coming from multiple sources entering same tunnel
can have same id. Therefore on tunnel packet receive we
could have packets from two different stream but with same
source and dst IP with same ip-id which could confuse ip packet
reassembly.

CC: Jarno Rajahalme <jrajahalme@nicira.com>
CC: Ansis Atteka <aatteka@nicira.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agonetdev-bsd: implement netdev_arp_lookup for NetBSD
YAMAMOTO Takashi [Tue, 13 Aug 2013 20:57:41 +0000 (05:57 +0900)]
netdev-bsd: implement netdev_arp_lookup for NetBSD

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobfd: Increase configuration efficiency.
Alex Wang [Tue, 13 Aug 2013 23:51:08 +0000 (16:51 -0700)]
bfd: Increase configuration efficiency.

Currently, when there are multiple bfd configuration changes,
the bfd_poll() will only update one change at a time with the
other side. This commit moves the call to bfd_poll() at the
end of configuration processing function, so that bfd_poll()
will update all configuration changes together.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobfd: Fix check_tnl_key error.
Alex Wang [Wed, 14 Aug 2013 20:12:33 +0000 (13:12 -0700)]
bfd: Fix check_tnl_key error.

This commit fixes the bug introduced by commit 26131299fa5 (bfd: Make the
BFD module thread safe.). The bug caused the opposite of the intended
behaviour.

Unit test is added for the 'check_tnl_key' feature.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Destroy bundle after moving its last port out.
Ben Pfaff [Wed, 14 Aug 2013 00:44:14 +0000 (17:44 -0700)]
ofproto-dpif: Destroy bundle after moving its last port out.

When the ofp_port argument to bundle_add_port() refers to an ofport_dpif
that already belongs to some other bundle, bundle_add_port() removed
the port from the other bundle, correctly, with bundle_del_port().
If the other bundle now contained no ports, however, this violated the
invariant that a bundle always contains at least one port.

Normally, this would get fixed up when the other bundle was processed
later during reconfiguration.  I haven't quite zeroed in on the exact
case where this is not true, but segfaults have happened here in
production, in particular when port adds and deletes happen simultaneously
and the new port reuses the OpenFlow port number of one of the deleted
ports.  It seems that the duplicate port number allows some port to rip
away the new port from its bundle without destroying that bundle.  I
suspect, therefore, that there is still a more subtle bug here, but I
hope that this will fix the segfault.

Bug #18967.
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agogitignore: Add ovsdbmonitor.
Gurucharan Shetty [Wed, 14 Aug 2013 09:11:04 +0000 (09:11 +0000)]
gitignore: Add ovsdbmonitor.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agoflow: Enable matching on new field 'pkt_mark'.
Jesse Gross [Tue, 6 Aug 2013 19:57:16 +0000 (12:57 -0700)]
flow: Enable matching on new field 'pkt_mark'.

The Linux kernel datapath enables matching and setting the skb mark
but this functionality is currently used only internally by
ovs-vswitchd. This exposes it through NXM to enable external
controllers to interact with other kernel subsystems. Although this
is simply exporting the skb mark, the intention is that this is a
platform independent mechanism to access some system metadata and
therefore may have different implementations on various systems.

Bug #17855

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agotunnel: Clear IPSEC_MARK on input rather than output.
Jesse Gross [Tue, 6 Aug 2013 19:57:15 +0000 (12:57 -0700)]
tunnel: Clear IPSEC_MARK on input rather than output.

Currently we remove the IPSEC_MARK flag from all packets that are
egressing on non-tunnel ports. However, this behavior is confusing
if we allow OpenFlow controllers to match and set the pkt_mark field
because the tunnel behavior applies even on non-tunnel ports.

This instead clears the mark on tunnel input which should have the
same effect for tunnel ports. However, on non-tunnel traffic (or
even for traffic entering on a tunnel port but leaving on a non-
tunnel port) it allows the mark to pass through without change.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agotunnel: Consolidate action code for tunnel port receive.
Jesse Gross [Tue, 6 Aug 2013 19:57:14 +0000 (12:57 -0700)]
tunnel: Consolidate action code for tunnel port receive.

There are a couple of operations that are related to receiving a
packet on a tunnel port but that affect the actions and therefore
need to be performed on the output path. This adds a new hook to
do this and consolidates the existing code there.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agoflow: Rename skb_mark to pkt_mark.
Jesse Gross [Tue, 6 Aug 2013 19:57:13 +0000 (12:57 -0700)]
flow: Rename skb_mark to pkt_mark.

The skb_mark field is currently only available with the Linux datapath
and is only used internally. However, it is desirable to expose this
through OpenFlow and when it is exposed ideally it would not be system-
specific. In preparation for this, skb_mark is rename to pkt_mark in
internal data structures for consistency.

This does not rename the Linux interfaces because doing so would break
the API. It would not necessarily be desirable to do anyways since in
Linux-specific code it is clearer to use the actual name rather than a
generic one. This can lead to confusion in some places, however, because
we do not always strictly separate generic and platform dependent code
(one example is actions). This seems inevitable though at this point if
the lower and upper layers have different names (as they must given the
above requirements).

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agodebian: Fix build with old versions of dpkg-buildflags.
Ben Pfaff [Tue, 13 Aug 2013 19:54:35 +0000 (12:54 -0700)]
debian: Fix build with old versions of dpkg-buildflags.

dpkg-buildflags has not always supported --export=configure, but commit
6c2d4c8780 (debian: Apply hardening options to build.) used it
unconditionally, causing the build to fail on old Debian distributions.
This fixes the problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests: Fix threading race in "ofproto-dpif megaflow - learning" test.
Ben Pfaff [Tue, 13 Aug 2013 19:37:50 +0000 (12:37 -0700)]
tests: Fix threading race in "ofproto-dpif megaflow - learning" test.

Threaded ofproto-dpif uses a queue to pass packets from the forwarding
threads to the main thread for (mega)flow setup and for learning.  When
learning occurs, causing revalidations, this races against flow setup, so
that sometimes a datapath (mega)flow does get set up for a packet that
causes learning and sometimes it doesn't.  This caused this test to
sometimes fail because one megaflow or the other that was expected to be
set up was not.

This commit fixes the problem by sending a second packet in each flow.
These additional packets don't cause any additional changes to the flow
table but they do cause flows to be set up, fixing the problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests: Fix problems in "learning action - self-modifying flow" test.
Ben Pfaff [Tue, 13 Aug 2013 18:22:26 +0000 (11:22 -0700)]
tests: Fix problems in "learning action - self-modifying flow" test.

This test had two problems.  First, it had a bizarre dependency on stats
that were not up-to-date: the "ovs-ofctl dump-flows" assumed that only
the first one of ten packets sent through the switch had been accounted
to OpenFlow flow statistics.  Adding a 1-second time warp fixed this
problem by ensuring that all ten packets were accounted.  (That's why this
patch updates the expected output of "ovs-ofctl dump-flows".)

Second, multithreading has made packet processing less predictable in
general.  This commit adds 10-ms time warps after sending each packet,
which seems to make the test reliable for me.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobfd: Delete trailing whitespace in 'bfd/show' output.
Alex Wang [Tue, 13 Aug 2013 17:02:41 +0000 (10:02 -0700)]
bfd: Delete trailing whitespace in 'bfd/show' output.

This commit chops off the trailing whitespace in the 'flag' field
of 'bfd/show' output.  This is for the string matching in bfd
unit test.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-thread: Use mutex instead of its address in thread-safety annotation.
Ben Pfaff [Mon, 12 Aug 2013 22:52:42 +0000 (15:52 -0700)]
ovs-thread: Use mutex instead of its address in thread-safety annotation.

CodingStyle says that this is preferred.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agosparse: Remove support for thread-safety annotations.
Ben Pfaff [Mon, 12 Aug 2013 22:49:25 +0000 (15:49 -0700)]
sparse: Remove support for thread-safety annotations.

The Clang support for thread-safety annotations is much more effective
than "sparse" support.  I found that I was unable to make the annotations
warning-free under sparse.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif-upcall: Fix sparse warning.
Ben Pfaff [Mon, 12 Aug 2013 22:43:36 +0000 (15:43 -0700)]
ofproto-dpif-upcall: Fix sparse warning.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoovs-ofctl: Avoid groff warning due to too-long line.
Ben Pfaff [Mon, 12 Aug 2013 22:11:35 +0000 (15:11 -0700)]
ovs-ofctl: Avoid groff warning due to too-long line.

Avoids these warnings from groff:

<standard input>:1037: warning [p 14, 6.0i]: cannot adjust line
<standard input>:1037: warning [p 14, 6.2i]: can't break line

Found by lintian.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodebian: Apply hardening options to build.
Ben Pfaff [Mon, 12 Aug 2013 22:10:39 +0000 (15:10 -0700)]
debian: Apply hardening options to build.

Debian now encourages building every program with various GCC hardening
options.  This commit implements that recommendation for Open vSwitch.

See https://wiki.debian.org/Hardening for details.

Found by lintian.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Include classifier wildcards in trace output.
Jesse Gross [Mon, 5 Aug 2013 23:00:03 +0000 (16:00 -0700)]
ofproto: Include classifier wildcards in trace output.

When tracing a flow, it shows the "relevant fields" that were used
to determine the results. However, this currently only includes fields
that are used for computing the actions but not the flow lookup. This
can be confusing so this patch includes the wildcards from the classifer
lookup as well.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: make oftable_remove_rule__ release evict lock
YAMAMOTO Takashi [Mon, 12 Aug 2013 23:00:05 +0000 (08:00 +0900)]
ofproto: make oftable_remove_rule__ release evict lock

according to the OVS_RELEASES annotation, oftable_remove_rule__ is
expected to release rule->evict lock.  make it actually do so.

this fixes pthread_rwlock_destroy failures observed on NetBSD,
where destroying a held lock, which is specwise undefined behaviour,
actually fails.  i guess it doesn't fail on linux but it's better
not to rely on an undefined behavior.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Do not set dev->master for XEN.
Pravin B Shelar [Mon, 12 Aug 2013 17:12:27 +0000 (10:12 -0700)]
datapath: Do not set dev->master for XEN.

XEN dom0 networking assumes dev->master is bond device
and it tries to access bond private structure from dev->master
ptr on receive path. This causes panic.
Following patch removes compat code that is setting master
device.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Bug #18920

10 years agonetdev-bsd: ioctl "cmd" is unsigned long, not int
YAMAMOTO Takashi [Mon, 12 Aug 2013 22:20:22 +0000 (07:20 +0900)]
netdev-bsd: ioctl "cmd" is unsigned long, not int

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-upcall: don't forget to initialize mutexes
YAMAMOTO Takashi [Mon, 12 Aug 2013 22:20:21 +0000 (07:20 +0900)]
ofproto-dpif-upcall: don't forget to initialize mutexes

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoband: Fix error in bond_choose_output_slave() function.
Alex Wang [Mon, 12 Aug 2013 21:14:52 +0000 (14:14 -0700)]
band: Fix error in bond_choose_output_slave() function.

This commit fixes the error introduced by commit 4a1b8f30e59 (bond:
Stop using tags.). The error is caused by mistakenly returning 'slave'
where 'slave->aux' should be returned.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoseq: Add some comments.
Ben Pfaff [Mon, 12 Aug 2013 20:45:01 +0000 (13:45 -0700)]
seq: Add some comments.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-dummy: Include all dummy classes in iterations.
Ben Pfaff [Mon, 12 Aug 2013 19:49:23 +0000 (12:49 -0700)]
netdev-dummy: Include all dummy classes in iterations.

Commit 86f1d0326bd0 (netdev-dummy: Use netdev_get_devices() instead of a
local shash.) caused netdev-dummy functions that iterate over all dummy
devices to iterate only over the ones that have class 'dummy_class'.  This
seemed to obviously include all the ones that we want, but in fact
when ovs-vswitch is invoked with --enable-dummy=override, there are more
dummy classes than just dummy_class, which this new form of iteration
skipped over, with various negative consequences that showed up in some
testing.

This commit switches netdev-dummy back to internally tracking its own
dummy devices.  It fixes the tests for me.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobond.c: Fix a typo.
Alex Wang [Mon, 12 Aug 2013 19:01:46 +0000 (12:01 -0700)]
bond.c: Fix a typo.

This commit fixes a typo in "lib/bond.c" which causes the high CPU
utilization after adding bond.  The bug was introduced in commit
4a1b8f30e59 (bond: Stop using tags.).

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Use parallel_ops genl.
Pravin B Shelar [Thu, 1 Aug 2013 22:36:06 +0000 (15:36 -0700)]
datapath: Use parallel_ops genl.

OVS locking was recently changed to have private OVS lock which
simplified overall locking.  Therefore there is no need to have
another global genl lock to protect OVS data structures.  Following
patch uses of parallel_ops genl family for OVS.  This also allows
more granual OVS locking using ovs_mutex for protecting OVS data
structures, which gives more concurrencey.  E.g multiple genl
operations OVS_PACKET_CMD_EXECUTE can run in parallel, etc.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>