cascardo/ovs.git
9 years agoconfigure: Fix -Werror build for NetBSD + clang
YAMAMOTO Takashi [Fri, 17 Apr 2015 08:14:38 +0000 (17:14 +0900)]
configure: Fix -Werror build for NetBSD + clang

On NetBSD, clang (clang-3.5.0 from pkgsrc) complains
when "clang -g" is used for linking.  Specify -Qunused-arguments
to suppress the warning.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoconfigure.ac: Avoid using non-ascii characters in a comment
YAMAMOTO Takashi [Fri, 17 Apr 2015 07:03:14 +0000 (16:03 +0900)]
configure.ac: Avoid using non-ascii characters in a comment

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodkms.conf.in: Install all kernel modules.
Alex Wang [Fri, 17 Apr 2015 18:30:18 +0000 (11:30 -0700)]
dkms.conf.in: Install all kernel modules.

With the latest change of separating vports into their own modules,
we need to update the dkms.conf.in and make dkms install all vport
modules.  So, this commit modifies the debian/rules to read all
kernel module names and sets the dkms.conf correctly.

Signed-off-by: Alex Wang <alexw@nicira.com>
9 years agoperf-counter: Remove unused vlog module.
Ben Pfaff [Fri, 17 Apr 2015 17:06:17 +0000 (10:06 -0700)]
perf-counter: Remove unused vlog module.

Otherwise Clang warns about an unused variable.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
9 years agobridge: Fix use-after-free in bridge_aa_refresh_queue().
Ben Pfaff [Thu, 16 Apr 2015 21:49:23 +0000 (14:49 -0700)]
bridge: Fix use-after-free in bridge_aa_refresh_queue().

Found by LLVM scan-build.

Reported-by: Kevin Lo <kevlo@FreeBSD.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Dennis Flynn <drflynn@avaya.com>
9 years agoovs-lldp: Avoid use-after-free in aa_mapping_unregister().
Ben Pfaff [Thu, 16 Apr 2015 21:46:27 +0000 (14:46 -0700)]
ovs-lldp: Avoid use-after-free in aa_mapping_unregister().

Found by LLVM scan-build.

Reported-by: Kevin Lo <kevlo@FreeBSD.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Dennis Flynn <drflynn@avaya.com>
9 years agonetdev-bsd: Fix netdev_bsd_get_mtu() return value.
Ben Pfaff [Thu, 16 Apr 2015 21:19:37 +0000 (14:19 -0700)]
netdev-bsd: Fix netdev_bsd_get_mtu() return value.

When netdev_bsd_get_mtu() failed, it didn't report the error to the caller,
so the caller couldn't work around not knowing the MTU, and ended up using
an uninitialized 'mtu' value.

Found by LLVM scan-build.

Reported-by: Kevin Lo <kevlo@FreeBSD.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Kevin Lo <kevlo@FreeBSD.org>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
9 years agonx-match: Avoid null pointer dereference in nx_pull_header__() error case.
Ben Pfaff [Thu, 16 Apr 2015 21:04:47 +0000 (14:04 -0700)]
nx-match: Avoid null pointer dereference in nx_pull_header__() error case.

Found by LLVM scan-build.

Reported-by: Kevin Lo <kevlo@FreeBSD.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoofp-actions: Remove dead store in ofpacts_pull_openflow_instructions().
Ben Pfaff [Thu, 16 Apr 2015 20:48:09 +0000 (13:48 -0700)]
ofp-actions: Remove dead store in ofpacts_pull_openflow_instructions().

Found by LLVM scan-build.

Reported-by: Kevin Lo <kevlo@FreeBSD.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoovs-lldp: Remove unused variable 'lldp_size'.
Ben Pfaff [Thu, 16 Apr 2015 20:44:53 +0000 (13:44 -0700)]
ovs-lldp: Remove unused variable 'lldp_size'.

Doesn't seem to be good for anything.

Found by LLVM scan-build.

Reported-by: Kevin Lo <kevlo@FreeBSD.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Kevin Lo <kevlo@FreeBSD.org>
Acked-by: Dennis Flynn <drflynn@avaya.com>
9 years agoofp-parse: Properly report error for invalid bucket ID.
Ben Pfaff [Thu, 16 Apr 2015 20:40:04 +0000 (13:40 -0700)]
ofp-parse: Properly report error for invalid bucket ID.

The inner 'error' shadowed an outer one, so that the error, when set, was
never returned to the caller.

Found by LLVM scan-build.

Reported-by: Kevin Lo <kevlo@FreeBSD.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoperf-counter: remove initial VLOG_INFO message when performance counter is not available
Andy Zhou [Thu, 16 Apr 2015 22:19:56 +0000 (15:19 -0700)]
perf-counter: remove initial VLOG_INFO message when performance counter is not available

Unit tests "corrupted database log" and "database log with bad
transaction" will fail without this patch.

Reported-by: Ansis Atteka <aatteka@nicira.com>¬
Signed-off-by: Andy Zhou <azhou@nicira.com>
9 years agoautoconf: check for linux/perf_event.h
Andy Zhou [Thu, 16 Apr 2015 19:52:09 +0000 (12:52 -0700)]
autoconf: check for linux/perf_event.h

Older Linux prior to version 2.6.32 do not support user mode
performance events, They also don't have 'linux/perf_event.h' header
file. Add check for those older Linux to conditionally compile
perf-counter.c

Reported-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
9 years agolib/rstp: Remove a dead store.
Jarno Rajahalme [Thu, 16 Apr 2015 21:56:50 +0000 (14:56 -0700)]
lib/rstp: Remove a dead store.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Daniele Venturino <daniele.venturino@m3s.it>
9 years agodatapath:netdevice: Export rpl_skb_gso_segment.
Alex Wang [Thu, 16 Apr 2015 18:23:47 +0000 (11:23 -0700)]
datapath:netdevice: Export rpl_skb_gso_segment.

With the latest change of separating vports into their own modules,
we also need to explicitly export rpl_skb_gso_segment to avoid linker
error.

VMware-BZ: #1432578
VMware-BZ: #1308175

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
9 years agoINSTALL.Windows: external.1 should be part of 'br-pif'
Nithin Raju [Thu, 16 Apr 2015 16:22:52 +0000 (09:22 -0700)]
INSTALL.Windows: external.1 should be part of 'br-pif'

Fixing a minor typo introduced in a previous commit.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-lldp: Avoid free() of static data in aa_print_element_status_port().
Ben Pfaff [Thu, 16 Apr 2015 15:52:29 +0000 (08:52 -0700)]
ovs-lldp: Avoid free() of static data in aa_print_element_status_port().

In some cases 'id' could point to the static string "<None>", which was
then passed to free() even though it must not be.  This commit fixes the
problem.

Found by LLVM scan-build.

Reported-by: Kevin Lo <kevlo@FreeBSD.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
Acked-by: Dennis Flynn <drflynn@avaya.com>
9 years agodpctl: Add tests.
Ben Pfaff [Wed, 15 Apr 2015 18:16:23 +0000 (11:16 -0700)]
dpctl: Add tests.

These tests prevent regressions against the problems fixed by the previous
two commits.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
9 years agodpif-netdev: Reject adding duplicate ports.
Ben Pfaff [Wed, 15 Apr 2015 18:15:45 +0000 (11:15 -0700)]
dpif-netdev: Reject adding duplicate ports.

Otherwise it is at least very confusing.

Found during testing.  An upcoming commit adds a test.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
9 years agodpctl: Fix error handling and reporting regressions.
Ben Pfaff [Wed, 15 Apr 2015 18:13:04 +0000 (11:13 -0700)]
dpctl: Fix error handling and reporting regressions.

Fixes multiple weaknesses in dpctl error reporting:

    * dpctl_set_if() didn't stop processing or report to the caller
      attempts to change a port type or number.

    * dpctl_set_if() didn't report the specifics when netdev_set_config()
      reported an error setting port configuration (which can happen even
      it returns 0).

    * The unixctl handler didn't report errors encountered during command
      processing through the JSON-RPC error mechanism, which meant that
      ovs-appctl's return code wasn't useful (as ovs-dpctl's return code
      is useful) for detecting errors in command execution.

At least the first of these is a regression from OVS 2.3.x.

A followup commit will add tests.

Reported-by: Kevin Lo <kevlo@FreeBSD.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
9 years agorun-ryu: Use the IANA OpenFlow port number
YAMAMOTO Takashi [Wed, 15 Apr 2015 08:10:50 +0000 (17:10 +0900)]
run-ryu: Use the IANA OpenFlow port number

Specify the use of the port 6653 for ryu side explicitly
because it still defaults to port 6633.

Fixes check-ryu after commit d4763d1d4efbbcfd884df2d668980d61ec89d75a.
("Use the IANA-assigned ports for OpenFlow and OVSDB.")

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-vswitchd: Don't print supported OpenFlow versions with "-V".
Justin Pettit [Wed, 15 Apr 2015 20:26:32 +0000 (13:26 -0700)]
ovs-vswitchd: Don't print supported OpenFlow versions with "-V".

When "-V" was supplied to ovs-vswitchd, it was returning a max supported
OpenFlow version of 1.0, which is no longer true.  There are other
methods to determine the supported OpenFlow versions in ovs-vswitchd, so
remove it from the "-V" output.

Reported-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
9 years agonetdev-bsd: Remove duplicate header inclusion of <netinet/in.h>
Kevin Lo [Wed, 15 Apr 2015 06:58:39 +0000 (14:58 +0800)]
netdev-bsd: Remove duplicate header inclusion of <netinet/in.h>

Signed-off-by: Kevin Lo <kevlo@FreeBSD.org>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoINSTALL.DPDK.md: Update ivshmem page size restrictions
Mark D. Gray [Fri, 10 Apr 2015 14:36:54 +0000 (15:36 +0100)]
INSTALL.DPDK.md: Update ivshmem page size restrictions

Update ivshmem restrictions to indicate that ivshmem does
not currently support small pages when sharing with a guest
operating system.

Reported-by: Daniele Di Proietto <diproiettod@vmware.com>
Signed-off-by: Mark D. Gray <mark.d.gray@intel.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoINSTALL.DPDK.md: Fix whitespace.
Mark D. Gray [Fri, 10 Apr 2015 14:36:53 +0000 (15:36 +0100)]
INSTALL.DPDK.md: Fix whitespace.

Signed-off-by: Mark D. Gray <mark.d.gray@intel.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoperf-counter: use 'int' instead of size_t
Andy Zhou [Wed, 15 Apr 2015 00:25:32 +0000 (17:25 -0700)]
perf-counter: use 'int' instead of size_t

'size_t' does not allow for catching the case where 'read' returns
an error code, which is a negative number.

Reported-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
9 years agoperf-counter: fix compiler warnings
Andy Zhou [Tue, 14 Apr 2015 21:22:08 +0000 (14:22 -0700)]
perf-counter: fix compiler warnings

Gcc complains about:
lib/perf-counter.c:43:13: error: ignoring return value of 'read',
declared with attribute warn_unused_result [-Werror=unused-result]
         read(fd__, counter, sizeof(*counter));

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
9 years agoovs-sandbox: add '-r' and '-e' options
Andy Zhou [Tue, 14 Apr 2015 20:44:01 +0000 (13:44 -0700)]
ovs-sandbox: add '-r' and '-e' options

'-e' option will run ovs-vswitchd under gdb, but runs immediately
instead of waiting for user input. '-r' options applies to ovsdb-server.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
9 years agoovs-sandbox: add delay before running ovs-vsctl
Andy Zhou [Fri, 10 Apr 2015 19:53:26 +0000 (12:53 -0700)]
ovs-sandbox: add delay before running ovs-vsctl

When running ovsdb-server under gdb, there is a race that ovs-vsctl
command can be called before ovsdb-server is fully launched. This will
cause ovs-vsctl to fail.  This patch fixes this by delay issuing
the ovs-vsctl command until ovsdb-server is fully launched.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoperf-counters: fix non-linux build
Andy Zhou [Tue, 14 Apr 2015 19:28:50 +0000 (12:28 -0700)]
perf-counters: fix non-linux build

Commit '97a3c43515e' misses definitions for non-Linux platforms thus
broke builds for any non-Linux platform.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agoperf-counter: Fix 32-bit build break due to incorrect printf specifiers.
Ben Pfaff [Tue, 14 Apr 2015 20:47:19 +0000 (13:47 -0700)]
perf-counter: Fix 32-bit build break due to incorrect printf specifiers.

Fixes the following warnings from GCC on 32-bit architectures:

    ../lib/perf-counter.c: In function 'perf_counter_to_ds':
    ../lib/perf-counter.c:119:19: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t' [-Werror=format]
    ../lib/perf-counter.c:119:19: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'uint64_t' [-Werror=format]

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
9 years agoperf-counter: Lower log level when no perf counter.
Flavio Leitner [Tue, 14 Apr 2015 15:14:21 +0000 (12:14 -0300)]
perf-counter: Lower log level when no perf counter.

Some arches don't support perf counter and an error message
breaks many tests from the testsuite.  Since the software still
runs without it, just inform that perf counters are not available
with using INFO level instead.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
[blp@nicira.com removed unneeded \n from log message]
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodpif-netdev: Add dpif-netdev/pmd-stats-* appctl commands.
Daniele Di Proietto [Fri, 10 Apr 2015 18:09:50 +0000 (19:09 +0100)]
dpif-netdev: Add dpif-netdev/pmd-stats-* appctl commands.

These commands can be used to get packets and cycles counters on a pmd
thread basis.  They're useful to get a clearer picture about the
performance of the userspace datapath.

They export these pieces of information:

- A (per-thread) view of the caches hit rate. Hits in the exact match
  cache are reported separately from hits in the masked classifier
- A rough cycles count. This will allow to estimate the load of OVS and
  the polling overhead.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
9 years agodpif-provider: Add class init function.
Daniele Di Proietto [Fri, 10 Apr 2015 18:09:49 +0000 (19:09 +0100)]
dpif-provider: Add class init function.

This init function is called when the dpif class is registered. It will
be used by following commits

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
9 years agodpif-netdev: Add simple per pmd-thread cycles counters.
Daniele Di Proietto [Fri, 10 Apr 2015 18:09:48 +0000 (19:09 +0100)]
dpif-netdev: Add simple per pmd-thread cycles counters.

The counters use x86 TSC if available (currently only with DPDK). They
will be exposed by subsequents commits

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
9 years agopython: Add setuptools for Python lib for PyPI.
Terry Wilson [Fri, 10 Apr 2015 19:57:00 +0000 (14:57 -0500)]
python: Add setuptools for Python lib for PyPI.

This adds very basic support for setuptools so that the OVS Python
lib can be added to PyPI.

This currently uses the Open vSwitch version number and the
generated dirs.py, though there is no real reason to tie the
Python libraries releases or version numbers to the main project's.

Signed-off-by: Terry Wilson <twilson@redhat.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
Acked-by: Kyle Mestery <mestery@mestery.com>
[blp@nicira.com adjusted automake.mk]
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovsdb: integrate perf-counter infrastructure into ovsdb-server
Andy Zhou [Sat, 21 Mar 2015 07:00:49 +0000 (00:00 -0700)]
ovsdb: integrate perf-counter infrastructure into ovsdb-server

This integration also adds two commands:

ovsdb-server/perf-counters-show -- show all counters
ovsdb-server/perf-counters-clear -- clear all counters

There is no pre-configured sample points. A programmer needs to
added sampling point by changing the source code. However he
does not need to worry about infrastructures such as initialization
or cleaning up memory when ovsdb-server exits.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
9 years agolib: add a hardware performance counter access library
Andy Zhou [Sat, 21 Mar 2015 07:00:48 +0000 (00:00 -0700)]
lib: add a hardware performance counter access library

First cut of adding a performance library that provides access to
hardware counters. Please see comments in perf-counter.h for
more details.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
9 years agodatapath: Update inner offsets when expanding headroom.
Jesse Gross [Tue, 31 Mar 2015 16:19:58 +0000 (09:19 -0700)]
datapath: Update inner offsets when expanding headroom.

skb protocol offsets are relative to the beginning of the
buffer and therefore must be updated if the buffer size is
expanded. Kernel functions do this automatically for existing
fields but obviously not for anything that we backport. This
introduces a wrapper for pskb_expand_head() to update the
inner protocol fields that we have backported.

Without this, a kernel crash can be triggered with tunnel
packets that do not have enough headroom and need to be
segmented. pskb_expand_head() is called in directly through
skb_cow_head() at the beginning of each of the tunnel transmit
routines.

Reported-by: Yinpeijun <yinpeijun@huawei.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoINSTALL.Windows.md: add steps for disabling test-signing.
Nithin Raju [Mon, 13 Apr 2015 19:00:37 +0000 (12:00 -0700)]
INSTALL.Windows.md: add steps for disabling test-signing.

Added the commands to be able to install an unsigned driver.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agoINSTALL.Windows: Correct invalid paths.
Gurucharan Shetty [Thu, 9 Apr 2015 20:36:39 +0000 (13:36 -0700)]
INSTALL.Windows: Correct invalid paths.

commit 0be55e389d2f1 (INSTALL.Windows: Add documentation about Windows
services.) added documentation about starting Windows services but
provided wrong executable paths. This commit fixes it.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Nithin Raju <nithin@vmware.com>
9 years agotravis: fix errors
Mark Kavanagh [Wed, 8 Apr 2015 22:30:06 +0000 (23:30 +0100)]
travis: fix errors

Fix two issues observed in travis scripts:
- prepare.sh: add '-E' flag to ensure user environmental variables
  (for example, URL of the proxy server) are passed to 'sudo'
- build.sh: add quotes around compiler variable to fix 'unary
  operator expected' error

[tgraf: Fixed two additional occurrences of missing "]

Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
9 years agotests: gre: fix flags endianness
Flavio Leitner [Fri, 10 Apr 2015 14:08:10 +0000 (11:08 -0300)]
tests: gre: fix flags endianness

The flags field is 16 bits so use network byte order in the
test case and use the proper conversion methods when parsing
and dumping.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
9 years agotest-csum: endianess fix
Flavio Leitner [Fri, 10 Apr 2015 14:07:50 +0000 (11:07 -0300)]
test-csum: endianess fix

The math is done in network byte order so the 32 bits won't
match between big and little endian, so the assert fails.

Reduce to 16 bits and then compare to the converted constant.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
9 years agodpif-netdev: Count exact match cache hits.
Daniele Di Proietto [Tue, 7 Apr 2015 19:02:15 +0000 (20:02 +0100)]
dpif-netdev: Count exact match cache hits.

We used to count exact match cache hits and masked classifier hits
together. This commit splits the DP_STAT_HIT counter into two.
This change will be used by future commits.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
9 years agodpif-netdev: Make datapath and flow stats atomic.
Daniele Di Proietto [Tue, 7 Apr 2015 19:02:14 +0000 (20:02 +0100)]
dpif-netdev: Make datapath and flow stats atomic.

A read operation from a non atomic shared value (without external
locking) can return incorrect values.  Using the atomic semantics
prevents this from happening.

However:
* No memory barriers are used.  We don't need that kind of consistency
  for statistics (we use relaxed operations).
* The updates are not atomic, just the loads and stores.  This is ok
  because there's a single writer.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
9 years agodpif-netdev: Group statistics updates in the slow path.
Daniele Di Proietto [Tue, 7 Apr 2015 19:02:13 +0000 (20:02 +0100)]
dpif-netdev: Group statistics updates in the slow path.

Since statistics updates might require locking (in future commits)
grouping them will reduce the locking overhead.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
9 years agodatapath: Account for "udptunnels: Call handle_offloads after inserting vlan tag."
Jesse Gross [Tue, 7 Apr 2015 23:11:23 +0000 (16:11 -0700)]
datapath: Account for "udptunnels: Call handle_offloads after inserting vlan tag."

Upstream commit:
    udptunnels: Call handle_offloads after inserting vlan tag.

    handle_offloads() calls skb_reset_inner_headers() to store
    the layer pointers to the encapsulated packet. However, we
    currently push the vlag tag (if there is one) onto the packet
    afterwards. This changes the MAC header for the encapsulated
    packet but it is not reflected in skb->inner_mac_header, which
    breaks GSO and drivers which attempt to use this for encapsulation
    offloads.

    Fixes: b736a623 ("vxlan: Add tx-vlan offload support.")
Signed-off-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: 4aac884d ("udptunnels: Call handle_offloads after inserting vlan tag.")
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agotunneling: Invalid packets should be cleared.
Jesse Gross [Wed, 8 Apr 2015 19:56:50 +0000 (12:56 -0700)]
tunneling: Invalid packets should be cleared.

If we receive a packet with an invalid tunnel header, we
should drop the packet without further processing. Currently
we do this by removing any parsed tunnel metadata. However,
this is not sufficient to stop processing - this only results
in the packet getting dropped by chance when something
usually runs across part of the packet that does not make
sense. Since both the packet and its metadata are in an
inconsistent state, it's also possible that the result is
an ovs-vswitchd crash or forwarding of a mangled packet.

Rather than clear the metadata, an alternate solution is to
remove all of the packet data. This guarantees that the
packet gets dropped during the next round of processing.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agotunneling: Convert tunnel push/pop functions to act on single packets.
Jesse Gross [Wed, 8 Apr 2015 00:45:40 +0000 (17:45 -0700)]
tunneling: Convert tunnel push/pop functions to act on single packets.

The userspace tunneling API for pushing and popping tunnel headers
is currently based on processing batches of packets. However, there
is no obvious way to take advantage of batching for these operations
and so each tunnel operation has a pair of loops to process the
batch. This changes the API to operate on single packets to enable
better code reuse.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoINSTALL.Windows: Add documentation about Windows services.
Gurucharan Shetty [Thu, 9 Apr 2015 15:54:23 +0000 (08:54 -0700)]
INSTALL.Windows: Add documentation about Windows services.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Nithin Raju <nithin@vmware.com>
9 years agoINSTALL.Windows: Add details about local build and installation.
Gurucharan Shetty [Thu, 9 Apr 2015 15:00:13 +0000 (08:00 -0700)]
INSTALL.Windows: Add details about local build and installation.

This commits adds the following.

* Clearly callout to set pthread-win32's dll path in $PATH
* Details about running parallel make and parallel unit tests.
* Installing Open vSwitch locally via 'make install'
* Update the steps to run the user processes by relying on
  the previous 'make install'. The steps now run the daemons
  in the background with the creation of a logfile and pidfile.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Nithin Raju <nithin@vmware.com>
9 years agotestsuite: ofproto-dpif: fix test names
Flavio Leitner [Wed, 8 Apr 2015 17:30:40 +0000 (14:30 -0300)]
testsuite: ofproto-dpif: fix test names

Some tests were not included when running the
make TESTSUITEFLAGS="-k ofproto-dpif" check because
the test name was out of the expected pattern.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
9 years agoINSTALL.Windows: update documentation
Nithin Raju [Wed, 8 Apr 2015 23:41:36 +0000 (16:41 -0700)]
INSTALL.Windows: update documentation

The documentation to run the executables has fallen behind quite
a bit. In this patch, we make a few updates. There's more to come.

The patch assumes the user has not run 'make install' or does not
have access to an installer.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agotestsuite: work around patch bug
Flavio Leitner [Wed, 8 Apr 2015 16:35:54 +0000 (13:35 -0300)]
testsuite: work around patch bug

Due to a CVE bug, the patch was modified to not allow following
symlinks out of the workdir.  However, this causes a bug when
there is a regular file out of the workdir which breaks the current
testsuite build.

Steps to reproduce:
  ./boot.sh
  mkdir _gcc && cd _gcc
  ../configure
  make
  [...]
  /bin/sh /home/fleitner/ovs/testsuite/build-aux/missing autom4te
  --language=autotest -I '..' -o ../tests/testsuite.tmp
  ../tests/testsuite.at
  patch -p0 ../tests/testsuite.tmp ../tests/testsuite.patch
  Invalid file name ../tests/testsuite.tmp -- skipping patch
  Makefile:5155: recipe for target '../tests/testsuite' failed
  make[2]: *** [../tests/testsuite] Error 1
  make[2]: Leaving directory
  '/home/fleitner/NetworkingServices/openvswitch/repo/testsuite/_gcc'
  Makefile:4087: recipe for target 'all-recursive' failed
  make[1]: *** [all-recursive] Error 1

Since it's just a temporary file, this patch changes to use the
workdir as the place to put the file.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agogeneve: Zero header before parsing userspace tunneling action.
Jesse Gross [Wed, 8 Apr 2015 01:55:54 +0000 (18:55 -0700)]
geneve: Zero header before parsing userspace tunneling action.

When we parse the text representation of the Geneve action the
header is not fully initialized. Besides the obvious potential
to generate an action that the user did not actually specify, this
also causes intermittent unit test failures when an action is
read in and printed out and the result is different.

Signed-off-by: Jesse Gross <jesse@nicira.com>
9 years agopacket: Avoid array of struct with zero length member.
Jesse Gross [Wed, 8 Apr 2015 00:57:36 +0000 (17:57 -0700)]
packet: Avoid array of struct with zero length member.

Windows doesn't like that the Geneve header has an array of
options with each have a zero length member (the variable data).
Nothing is accessing the data now, so just replace the member with
a comment - we can use pointer arithmetic when necessary.

Reported-by: Gurucharan Shetty <shettyg@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
9 years agotunneling: Add UDP checksum support for userspace tunnels.
Jesse Gross [Thu, 26 Mar 2015 21:27:19 +0000 (14:27 -0700)]
tunneling: Add UDP checksum support for userspace tunnels.

Kernel based OVS recently added the ability to support checksums
for UDP based tunnels (Geneve and VXLAN). This adds similar support
for the userspace datapath to bring feature parity.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agopacket: Add IP pseudoheader checksum calculation.
Jesse Gross [Mon, 30 Mar 2015 19:17:05 +0000 (12:17 -0700)]
packet: Add IP pseudoheader checksum calculation.

As OVS adds userspace support for being the endpoint in protocols
like tunnels, it will need to be able to calculate pseudoheaders
as part of the checksum calculation.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agotunneling: Add userspace tunnel support for Geneve.
Jesse Gross [Thu, 26 Mar 2015 20:51:06 +0000 (13:51 -0700)]
tunneling: Add userspace tunnel support for Geneve.

This adds basic userspace dataplane support for the Geneve
tunneling protocol. The rest of userspace only has the ability
to handle Geneve without options and this follows that pattern
for the time being. However, when the rest of userspace is updated
it should be easy to extend the dataplane as well.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agotunneling: Factor out common UDP tunnel code.
Jesse Gross [Thu, 26 Mar 2015 19:07:02 +0000 (12:07 -0700)]
tunneling: Factor out common UDP tunnel code.

Currently, the userspace VXLAN implementation contains the code
for generating and parsing both the UDP and VXLAN headers. This
pulls out the UDP portion for better layering and to make it
easier to support additional UDP based tunnels and features.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agovxlan: Set FLOW_TNL_F_KEY for received packets.
Jesse Gross [Tue, 7 Apr 2015 23:40:18 +0000 (16:40 -0700)]
vxlan: Set FLOW_TNL_F_KEY for received packets.

The VNI is always present in the VXLAN header, so we should
set the FLOW_TNL_F_KEY flag to indicate this. However, the
userspace implementation of VXLAN currently does not.

Signed-off-by: Jesse Gross <jesse@nicira.com>
9 years agoodp-util: Shift VXLAN VNI when printing/parsing.
Jesse Gross [Sat, 28 Mar 2015 00:51:35 +0000 (17:51 -0700)]
odp-util: Shift VXLAN VNI when printing/parsing.

Currently when printing a userspace tunnel action for VXLAN, the
VNI is treated as a 32 bit field rather than 24 bit. Even if this
is the representation that we use internally, we should still show
the right VNI to avoid confusing people.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pritesh Kothari <pritesh.kothari@cisco.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agotunneling: Use flow flag for GRE checksum calculation.
Jesse Gross [Fri, 27 Mar 2015 05:55:53 +0000 (22:55 -0700)]
tunneling: Use flow flag for GRE checksum calculation.

The indication to calculate the GRE checksum is currently the port
config rather than the tunnel flow. Currently there is a one to one
mapping between the two so there is no difference. However, the
kernel datapath must use the flow and it is also potentially more
flexible, so this switches how we decide whether to calculate the
checksum.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pritesh Kothari <pritesh.kothari@cisco.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agotunneling: Fix location of GRE checksums.
Jesse Gross [Fri, 27 Mar 2015 00:09:38 +0000 (17:09 -0700)]
tunneling: Fix location of GRE checksums.

The GRE checksum is a 16 bit field stored in a 32 bit option (the
rest is reserved). The current code treats the checksum as a 32-bit
field and places it in the right place for little endian systems but
not big endian. This fixes the problem by storing the 16 bit field
directly.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pritesh Kothari <pritesh.kothari@cisco.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agotunneling: Add check for GRE protocol is Ethernet.
Jesse Gross [Thu, 26 Mar 2015 23:53:39 +0000 (16:53 -0700)]
tunneling: Add check for GRE protocol is Ethernet.

On receive, the userspace GRE code doesn't check the protocol
field. Since OVS only understands Ethernet packets, this adds a
check that the inner protocol is Ethernet and discards other types
of packets.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pritesh Kothari <pritesh.kothari@cisco.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agotunneling: Include IP TTL in flow metadata.
Jesse Gross [Fri, 27 Mar 2015 14:39:18 +0000 (07:39 -0700)]
tunneling: Include IP TTL in flow metadata.

The IP TTL is currently omitted in the extracted tunnel information
that is stored in the flow for userspace tunneling. This includes it
so that the same logic used by the kernel also applies.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pritesh Kothari <pritesh.kothari@cisco.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agodatapath-windows: Solved BSOD when uninstalling the driver (race condition)
Sorin Vinturis [Tue, 7 Apr 2015 16:35:54 +0000 (16:35 +0000)]
datapath-windows: Solved BSOD when uninstalling the driver (race condition)

The BSOD occurred because the FilterAttach routine released the switch
context, while there were IRPs in processing.

The solution was to add a reference count to prevent premature deallocation of the
global switch context structure, gOvsSwitchContext.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/58
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agospecify -w to set variables for sysctl(8) on NetBSD
Kevin Lo [Tue, 7 Apr 2015 08:18:47 +0000 (16:18 +0800)]
specify -w to set variables for sysctl(8) on NetBSD

We have to specify -w to set tunable sysctls on NetBSD.

Signed-off-by: Kevin Lo <kevlo at FreeBSD.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
9 years agorhel: Make Fedora %files and %install section wildcards match.
Ben Pfaff [Mon, 6 Apr 2015 20:56:04 +0000 (13:56 -0700)]
rhel: Make Fedora %files and %install section wildcards match.

Since %install puts every .ko file into /lib/modules, %files should make
sure that all of them are packaged.

Suggested-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
9 years agohmap: Add comment warning about pitfall in HMAP_FOR_EACH_* usage.
Ben Pfaff [Mon, 6 Apr 2015 21:39:06 +0000 (14:39 -0700)]
hmap: Add comment warning about pitfall in HMAP_FOR_EACH_* usage.

CC: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
9 years agobridge: Wait for previous stats update transation when it is incomplete.
Alex Wang [Wed, 1 Apr 2015 00:07:03 +0000 (17:07 -0700)]
bridge: Wait for previous stats update transation when it is incomplete.

When ovsdb happens to get blocked for few seconds, the 'stats_timer'
will not be updated due to incompletion of previous transaction.
When the current time passes the 'stats_timer', the call to
poll_timer_wait_until(stats_timer) will keep waking up ovs-vswitchd,
causing 100% cpu utilization.

This commit fixes this issue by making ovs-vswitchd wait on the
previous idl transaction when it is incomplete rather than the
'stats_timer'.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agobridge: Do not wait for status update when there is no bridge.
Alex Wang [Tue, 31 Mar 2015 23:53:47 +0000 (16:53 -0700)]
bridge: Do not wait for status update when there is no bridge.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib/list: Add LIST_FOR_EACH_POP.
Jarno Rajahalme [Mon, 6 Apr 2015 21:02:28 +0000 (14:02 -0700)]
lib/list: Add LIST_FOR_EACH_POP.

Makes popping each member of the list a bit easier.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoauto-attach: Fix segfault when enabling auto attach.
Dennis Flynn [Mon, 6 Apr 2015 14:59:19 +0000 (10:59 -0400)]
auto-attach: Fix segfault when enabling auto attach.

This commit fixes a segmentation fault observed when enabling lldp prior to
establishing auto attach mappings.

Signed-off-by: Dennis Flynn <drflynn@avaya.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows Release lock on HVUpdateNIC
Alin Serdean [Mon, 6 Apr 2015 17:22:06 +0000 (17:22 +0000)]
datapath-windows Release lock on HVUpdateNIC

Release switchContext->dispatchLock in case the vport has not been found.

Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Allow NdisSwitchPortTypeSynthetic to be updated
Alin Serdean [Mon, 6 Apr 2015 17:28:42 +0000 (17:28 +0000)]
datapath-windows: Allow NdisSwitchPortTypeSynthetic to be updated

Allow the port to be updated if it the type is only:
NdisSwitchPortTypeSynthetic

Acked-by: Nithin Raju <nithin@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-dev.py: Remove vport-*.ko at same time as openvswitch.ko.
Ben Pfaff [Sun, 5 Apr 2015 19:12:14 +0000 (12:12 -0700)]
ovs-dev.py: Remove vport-*.ko at same time as openvswitch.ko.

My guess is that this is the intent.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
9 years agorhel: Package vport-*.ko in Fedora kernel package.
Ben Pfaff [Sun, 5 Apr 2015 19:12:13 +0000 (12:12 -0700)]
rhel: Package vport-*.ko in Fedora kernel package.

Fixes a presumed build break due to unpackaged files.  (Only "presumed" at
this point because it is masked in the VMware build system by the similar
XenServer build failure.)

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
9 years agoxenserver: Package vport-*.ko with kernel module.
Ben Pfaff [Sun, 5 Apr 2015 19:12:12 +0000 (12:12 -0700)]
xenserver: Package vport-*.ko with kernel module.

Fixes a build error due to unpackaged files.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
9 years agoovs-sandbox: Tell gdb to start the daemon.
Russell Bryant [Fri, 3 Apr 2015 20:04:14 +0000 (16:04 -0400)]
ovs-sandbox: Tell gdb to start the daemon.

The current gdb support launches gdb but doesn't start the daemon.
If you start ovsdb-server with gdb, ovs-sandbox produces an error as
it tries to run ovs-vsctl before ovsdb-server is running.  Telling gdb
to start the daemon immediately avoids this error.

There are cases where it's useful to go straight to the gdb prompt,
too.  For example, someone may want to set a breakpoint.  In that
case, it's easy enough to just kill it, set a breakpoint, and execute
'run' again.

In passing, fix indentation to use spaces instead of tabs.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoMakefile.am: Clarify error message about missing distribution files.
Justin Pettit [Sat, 4 Apr 2015 23:30:44 +0000 (16:30 -0700)]
Makefile.am: Clarify error message about missing distribution files.

The error message did not make it clear that the problem was due to
files being in git but not the distribution.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoAUTHORS: Add Kevin Lo.
Ben Pfaff [Sun, 5 Apr 2015 16:58:06 +0000 (09:58 -0700)]
AUTHORS: Add Kevin Lo.

Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agonetdev-bsd: Fix sign extension bug in ifr_flags on FreeBSD.
Kevin Lo [Sat, 4 Apr 2015 16:59:26 +0000 (00:59 +0800)]
netdev-bsd: Fix sign extension bug in ifr_flags on FreeBSD.

FreeBSD fills the int return value with ifr_flagshigh in the high
16 bits and ifr_flags in the low 16 bits rather than blindly promoting
ifr_flags to an int, which will preserve the sign.
This commit makes sure the flags returned isn't negative and apply mask
0xffff to flags.

Signed-off-by: Kevin Lo <kevlo@FreeBSD.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath: Turn vports with dependencies into separate modules
Thomas Graf [Sat, 4 Apr 2015 06:24:13 +0000 (08:24 +0200)]
datapath: Turn vports with dependencies into separate modules

Upstream commit:
    The internal and netdev vport remain part of openvswitch.ko. Encap
    vports including vxlan, gre, and geneve can be built as separate
    modules and are loaded on demand. Modules can be unloaded after use.
    Datapath ports keep a reference to the vport module during their
    lifetime.

    Allows to remove the error prone maintenance of the global list
    vport_ops_list.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Also folds in the follow-up commits 9ba559d9ca3 to turned the non-GPL
symbol exports to GPL exports, and fa2d8ff4e35 which fixes a module
reference release bug.

Exports various backwards compat functions linked into the main
openvswitch module as GPL symbols to ensure vport modules can use them.

Some fiddling with the Makefile was needed to work around the fact
that Makefile variables can't contain '-' characters needed to define
'vport-xxx' module sources. Also, Kbuild complains heavily if a
$(module)-y = $(module).o is defined which is actually backed with a .c
file of the same name. Therefore, a new $(build_multi_modules) variable
is defined which lists all module which consist of more than one source
file.

Upstream: 62b9c8d0372 ("ovs: Turn vports with dependencies into separate modules")
Upstream: 9ba559d9ca3 ("openvswitch: Export symbols as GPL symbols.")
Upstream: fa2d8ff4e35 ("openvswitch: Return vport module ref before destruction")
Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoacinclude: Always assume buggy strtok_r() for glibc < 2.8.
Ben Pfaff [Fri, 3 Apr 2015 22:10:57 +0000 (15:10 -0700)]
acinclude: Always assume buggy strtok_r() for glibc < 2.8.

Lately our internal build system has been seeing intermittent failures that
I can't explain.  With old glibc versions, the "configure" time check will
pass, but the equivalent (almost identical) "make check" test will fail.
One possibility, I guess, is that occasionally address space randomization
will put valid data at the 0xc0ffee address that the test assumes will
segfault, and another is that some change in compiler optimization flags
is making a difference.  At any rate, I think it's safe to just always
assume that this strtok_r() bug is present whenever glibc before 2.8 is
in use.

Specifically we've seen this happen intermittently when building against
the XenServer DDK 5.6.100 build 39265, which uses glibc 2.5.

Reported-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
9 years agoINSTALL.md: Add note about EXTRA_CFLAGS.
Russell Bryant [Thu, 2 Apr 2015 21:51:49 +0000 (17:51 -0400)]
INSTALL.md: Add note about EXTRA_CFLAGS.

Add a note about the use of EXTRA_CFLAGS to provide custom CFLAGS for
the build of the Linux kernel module.

This addition is technically in the "configuring the sources" section
of the document.  However, it's the spot where custom CFLAGS is
discussed already, so that seemed like the best place to put it.
Alternatively, it could go in the "Building the Sources" section
instead.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodpif-netdev: Remove support for DPIF_FP_ZERO_STATS flag
Daniele Di Proietto [Wed, 1 Apr 2015 16:20:57 +0000 (17:20 +0100)]
dpif-netdev: Remove support for DPIF_FP_ZERO_STATS flag

Since flow statistics are thread local and updated without any lock,
it is not correct to do a memset from another thread.

This commit simply removes the support for the flag.  It is not needed
by ofproto-dpif, it is only exposed by dpctl commands.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
9 years agoINSTALL.md: Document how to add custom compiler flags.
Ben Pfaff [Thu, 2 Apr 2015 16:52:03 +0000 (09:52 -0700)]
INSTALL.md: Document how to add custom compiler flags.

CC: Mark B Kavanagh <mark.b.kavanagh@intel.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
9 years agodatapath-windows: Make GET_PID a separate IOCTL
Sorin Vinturis [Thu, 2 Apr 2015 19:35:32 +0000 (19:35 +0000)]
datapath-windows: Make GET_PID a separate IOCTL

Added a new IOCTL in order to retrieve the PID from the kernel datapath.
The new method uses a direct and cleaner way, as opposed to the old way
of using a Netlink transaction, avoiding the unnecessary overhead.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/31
Acked-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agobridge: Execute bridge_run() only after retrieving db contents.
Alex Wang [Wed, 1 Apr 2015 23:11:19 +0000 (16:11 -0700)]
bridge: Execute bridge_run() only after retrieving db contents.

During upgrade of ovs-vswitchd, we do not want to recreate the already
configured kernel interfaces.  Especially when IP address is assigned to
the internal port, the recreation will cause the lost of connection.
Therefore, ovs-vswitchd should read current ovsdb content first and then
reuse the existing kernel interfaces that are configured in ovsdb.  In
terms of the code language, ovs-vswitchd should only execute bridge_run()
after it finishes reading the ovsdb content.

However, this expected behavior is broken by the recent commit d18e52e
(ovsdb-idl: Tolerate missing tables and columns.) which causes the
execution of bridge_run() before getting the hint of configured interfaces
from ovsdb.

To fix the issue, this commit makes sure that the execution of bridge_run()
happens only after retrieving the ovsdb contents.

VMware-BZ: #1424342

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovsdb-server: Correct malformed error replies to certain JSON-RPC requests.
Ben Pfaff [Fri, 20 Mar 2015 04:00:46 +0000 (21:00 -0700)]
ovsdb-server: Correct malformed error replies to certain JSON-RPC requests.

I realized that this bug existed only a few weeks ago, but it has been
there since the earliest ovsdb-server code.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
9 years agoovsdb-idl: Tolerate missing tables and columns.
Ben Pfaff [Fri, 20 Mar 2015 06:45:42 +0000 (23:45 -0700)]
ovsdb-idl: Tolerate missing tables and columns.

Until now, if ovs-vsctl (or another client of the C ovsdb-idl library) was
compiled against a schema that had a column or table that was not in the
database actually being used (e.g. during an upgrade), and the column or
table was selected for monitoring, then ovsdb-idl would fail to get any
data at all because ovsdb-server would report an error due to a request
about a column or a table it didn't know about.

This commit fixes the problem by making ovsdb-idl retrieve the database
schema from the database server and omit any tables or columns that don't
exist from its monitoring request.  This works OK for the kinds of upgrades
that OVSDB otherwise supports gracefully because it will simply make the
missing columns or tables appear empty, which clients of the ovsdb-idl
library already have to tolerate.

VMware-BZ: #1413562
Reported-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
9 years agovswitch.xml: Improve description of forward-bpdu.
Ben Pfaff [Wed, 1 Apr 2015 00:08:49 +0000 (17:08 -0700)]
vswitch.xml: Improve description of forward-bpdu.

The description was at best incomplete and difficult to understand.

Reported-by: Brian Field <Brian_Field@cable.comcast.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
9 years agolockfile: Support \-delimited file names in lockfile_name().
Alin Serdean [Tue, 31 Mar 2015 19:16:58 +0000 (19:16 +0000)]
lockfile: Support \-delimited file names in lockfile_name().

Currently paths that have only forward slashes like the following
"C:/package/binaries/conf.db" work seamlessly.

If we try the native windows filepaths i.e. "C:\package\binaries\conf.db" we
will hit the following problem:
2015-03-31T15:54:17Z|00001|lockfile|WARN|.c:\package\binaries\conf.db.~lock~:
failed to open lock file: Invalid argument

2015-03-31T15:54:17Z|00002|lockfile|WARN|.c:\package\binaries\conf.db.~lock~:
failed to lock file: Invalid argument
ovsdb-server: I/O error: c:\package\binaries\conf.db: failed to lock lockfile
(Invalid argument)

In this patch we update the lockfile_name function to also look for
backslashes, and also accommodate if we have a mix of backslashes and forward
slashes.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
[blp@nicira.com simplified the code]
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agohmap: Don't include ovs-atomic.h unnecessarily.
Ben Pfaff [Sun, 29 Mar 2015 22:49:29 +0000 (15:49 -0700)]
hmap: Don't include ovs-atomic.h unnecessarily.

GNU C++ isn't too happy with ovs-atomic.h.  We could fix that (maybe we
should) but the report I received from a C++ user implied to me that it
would be just as useful to just drop the unnecessary #include
"ovs-atomic.h" from hmap.h.

Reported-by: Michael Hu <humichael@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoovsdb-idl: Add function comments.
Ben Pfaff [Tue, 31 Mar 2015 18:28:39 +0000 (11:28 -0700)]
ovsdb-idl: Add function comments.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
9 years agojsonrpc: Add function comments.
Ben Pfaff [Tue, 31 Mar 2015 18:28:27 +0000 (11:28 -0700)]
jsonrpc: Add function comments.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
9 years agodatapath: Use alternate name for udp_sock_create() backport
Thomas Graf [Mon, 30 Mar 2015 10:21:09 +0000 (12:21 +0200)]
datapath: Use alternate name for udp_sock_create() backport

Account for kernels which provide udp_sock_create() in an
insufficient version.

Avoids the following error when inserting openvswitch.ko on
respective kernels:

openvswitch: exports duplicate symbol udp_sock_create (owned by udp_tunnel)

Fixes: eb6eebd28 ("datapath: Account for "udp: Add udp_sock_create for UDP tunnels to open listener socket")
Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Cc: Jesse Gross <jesse@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
9 years agodpif-netdev: Account for and free lost packets.
Daniele Di Proietto [Fri, 27 Mar 2015 16:29:50 +0000 (16:29 +0000)]
dpif-netdev: Account for and free lost packets.

Packets for which an upcall has failed (lost packets) must be deleted.
We also need to count them as MISS and LOST.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Ethan Jackson <ethan@nicira.com>