dpif-netdev: Unwildcard entire odp_port in dpif_netdev_mask_from_nlattrs().

One case in the dpif_netdev_mask_from_nlattrs() function accidentally
wildcarded only a 16-bit subset of the mask's odp_port.  On little-endian
machines this subset was the lower bits, which happened to work out OK,
but on big-endian machines this subset was the upper bits, which doesn't
work and causes a test failure.  (The problem was actually visible in the
test expected results on little-endian machines, but we had not noticed.)

This commit unwildcards the whole field, fixing the problem, and updates
the test expected results to match.

This fixes the failure of test 732 seen here:
https://buildd.debian.org/status/fetch.php?pkg=openvswitch&arch=sparc&ver=2.1.0%2Bgit20140325-1&stamp=1396438624

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
packets: Fix misaligned data accesses for MPLS and SCTP fields.

The other 32-bit data fields in protocol headers were already using
ovs_16aligned_be32, but MPLS and SCTP had been overlooked.  This fixes
the failure of test 681 seen here:
https://buildd.debian.org/status/fetch.php?pkg=openvswitch&arch=sparc&ver=2.1.0%2Bgit20140325-1&stamp=1396438624

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
ofp-print: Fix misaligned data access in ofp_print_error_msg().

The body of an OpenFlow error message often contains an inner OpenFlow
message, and when it does, the inner message starts at an odd multiple of 4
bytes from the beginning of the outer message.  That means that, on RISC
systems, accessing the inner message directly causes a bus error.  This
commit fixes the problem in a way that should make it difficult to recur.

This fixes the failure of tests 643, 645, and 651 on sparc seen here:
https://buildd.debian.org/status/fetch.php?pkg=openvswitch&arch=sparc&ver=2.1.0%2Bgit20140325-1&stamp=1396438624

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
ofproto-dpif.at: Wait for the monitor's pidfile disappears where necessary

These tests invokes ovs-ofctl monitor twice or more.
Because "ovs-appctl -t ofctl exit" does not wait for the target
process exit, there are chances to see the pid file from the previous
incarnation.

OVS_APP_EXIT_AND_WAIT macro was provided by Ben Pfaff.

Acked-by: Ben Pfaff <blp@nicira.com>
Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
ovsdb-server.at: Update a comment

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
ofproto-dpif-upcall: Expire netflow flow when revalidate_ukey failed

This fixes missing netflow flows in
"ofproto-dpif - NetFlow flow expiration" tests.

Acked-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
ofp-parse: Handle buffer resize when parsing actions

A call to ofpbuf_put() may cause the data of the passed to be resized and
its base address to change.  Thus the address returned by ofpbuf_put()
should be used as the base address rather than relying on the base address
prior to ofpbuf_put().

This avoids the following assertion in ofpact_update_len() from failing
when ofpbuf_put() causes a resize in parse_note(), parse_noargs_dec_ttl(),
parse_dec_ttl().

    ovs_assert(ofpact == ofpacts->frame);

This restores pointer updates removed by and resolves a regression
introduced by cf3b7538666cd1ef ("ofpbuf: Abstract 'l2' pointer and document
usage conventions.").

Test cases have also been added to exercise this buffer resize in
parse_note(), parse_noargs_dec_ttl(), parse_dec_ttl().

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
tests: Remove problematic but questionably useful part of ovsdb-server test.

The test "ovsdb-server combines updates on backlogged connections" first
checks that ovsdb-server can combine transactions, and then checks that
it can keep them separate.  The latter part is hard to force because it
requires making sure that the socket buffer never fills up, and it also
isn't a very useful test (it doesn't check for any kind of correctness).
Therefore, this commit removes it.

Reported-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
tests: Fix typo in ovsdb-server test.

25 kB is about 25000 bytes, not 2500.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
lockfile: Improve log message when a process tries to relock a file.

"Resource deadlock avoided" is a pretty obscure message.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
ovsdb-server: Improve message for "add-db" of database already open.

Otherwise you get a fairly obscure message about a lockfile already being
locked.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
ofproto/bond: Implement bond megaflow using recirculation

Infrastructure to enable megaflow support for bond ports using
recirculation. This patch adds the following features:
* Generate RECIRC action when bond can benefit from recirculation.
* Populate post recirculation rules in a hidden table. Currently table 254.
* Uses post recirculation rules for bond rebalancing
* A recirculation implementation in dpif-netdev.

The goal of this patch is to be able to megaflow bond outputs and
thus greatly improve performance. However, this patch does not
actually improve the megaflow generation. It is left for a later commit.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif.at: Fix a race in "ofproto-dpif - controller"

Simon Horman submitted the identical patch independently.

Acked-by: Ben Pfaff <blp@nicira.com>
Tested-by: Lori Jakab <lojakab@cisco.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
ofproto-dpif.at: Avoid races in table miss tests

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
learn.at: Fix a race in "self-modifying flow with idle_timeout" test

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
ofproto-dpif.at: Fix some races in MPLS actions tests

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
ofproto-dpif.at: Fix a race in fin_timeout test

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
ofproto-dpif.at: Fix a race in "flow stats" test

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
ofproto-dpif.at: Fix races in "NetFlow flow expiration" tests

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
learn.at: Fix a race in "self-modifying flow with hard_timeout"

Also, add a comment to explain the expected sequences.

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>