cascardo/ovs.git
8 years agotest-ovsdb: Fix memory leak reported by valgrind.
William Tu [Tue, 9 Feb 2016 22:15:13 +0000 (14:15 -0800)]
test-ovsdb: Fix memory leak reported by valgrind.

Testcase 1314: UUID-distinct queries on scalars.
Call stacks:
    allocate_row (row.c:37)
    ovsdb_row_clone (row.c:67)
    do_query_distinct (test-ovsdb.c:1232)
    ovs_cmdl_run_command (command-line.c:121)
    main (test-ovsdb.c:72)

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoovn: Support ingress policing settings for VIFs.
Ben Pfaff [Wed, 10 Feb 2016 19:09:12 +0000 (11:09 -0800)]
ovn: Support ingress policing settings for VIFs.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Co-authored-by: Babu Shanmugam <bschanmu@redhat.com>
Signed-off-by: Babu Shanmugam <bschanmu@redhat.com>
8 years agotest-ovn: Add help output for parse-actions command.
Ben Pfaff [Wed, 10 Feb 2016 05:08:13 +0000 (21:08 -0800)]
test-ovn: Add help output for parse-actions command.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agodist-docs: Convert tabs to spaces.
Russell Bryant [Tue, 9 Feb 2016 17:53:42 +0000 (12:53 -0500)]
dist-docs: Convert tabs to spaces.

This file used mixed indentation.  Convert the tabs to spaces for
consistency.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agodist-docs: Fix relative links.
Russell Bryant [Tue, 9 Feb 2016 17:46:46 +0000 (12:46 -0500)]
dist-docs: Fix relative links.

There are some relative links designed to work on github.  These links
are broken within dist-docs.  Adding a symbolic link from the original
filename to the plain text version makes these links work within
dist-docs.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agodist-docs: Install plaintext files properly.
Ben Pfaff [Tue, 9 Feb 2016 04:18:35 +0000 (20:18 -0800)]
dist-docs: Install plaintext files properly.

We shouldn't try to treat every file as Markdown.

Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agodist-docs: Make GNU make aware of sub-make.
Ben Pfaff [Tue, 9 Feb 2016 04:18:34 +0000 (20:18 -0800)]
dist-docs: Make GNU make aware of sub-make.

When GNU make sees that a command to be executed contains the string
$(MAKE), it makes the jobserver that limits parallelism available to
the command.  Otherwise, any sub-make that executes sees that
parallelism is enabled but does not have access to the jobserver, so
it prints a warning and turns off parallel job execution.

This also makes the dist-docs process run the same "make" that is
executed at the top level, in case that's different from the default
"make" found in $PATH.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agodist-docs: Include Documentation/ in dist-docs.
Russell Bryant [Mon, 8 Feb 2016 17:12:41 +0000 (12:12 -0500)]
dist-docs: Include Documentation/ in dist-docs.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agosset: Make sset iteration check the type of the nodes it's iterating.
Ben Pfaff [Tue, 9 Feb 2016 00:52:44 +0000 (16:52 -0800)]
sset: Make sset iteration check the type of the nodes it's iterating.

Without this additional check, SSET_FOR_EACH is happy to iterate over any
type that has a struct hmap member named 'map'.  We have a number of these:
hmapx, shash, simap, and smap, in addition to sset.

I guess another approach would be give each of these a unique member name,
but the short name 'map' is nice too.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agoutil: New macro BUILD_ASSERT_TYPE.
Ben Pfaff [Tue, 9 Feb 2016 00:52:43 +0000 (16:52 -0800)]
util: New macro BUILD_ASSERT_TYPE.

I intend to make further use of this in upcoming commits.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
8 years agonetdev: Free packets in netdev_send() for devices that don't support send.
Ben Pfaff [Tue, 9 Feb 2016 06:42:50 +0000 (22:42 -0800)]
netdev: Free packets in netdev_send() for devices that don't support send.

This manifested as a memory leak in test 898 "ofproto-dpif - sFlow packet
sampling - tunnel set", which included an output to a tunnel vport that
doesn't have an implementation of netdev_send().

Reported-by: William Tu <u9012063@gmail.com>
Reported-at: http://openvswitch.org/pipermail/dev/2016-February/065873.html
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agomanpages.mk: Remove ovs-benchmark.
Ilya Maximets [Mon, 8 Feb 2016 07:31:48 +0000 (10:31 +0300)]
manpages.mk: Remove ovs-benchmark.

Fixes: e75291417990 ("ovs-benchmark: Remove.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agovtep: Support per-tunnel tunnel key in schema.
Ofer Ben Yacov [Fri, 5 Feb 2016 20:54:57 +0000 (12:54 -0800)]
vtep: Support per-tunnel tunnel key in schema.

Currently the scenario of single logical bridge that use multiple locators
with different tunnel key on each of the locators is not supported.
In order to support much more flexibility in the tunnel settings, we need
to add tunnel key column to the Physical_Locator table.

This patch is needed to support the usage of neutron L2GW as an inter-cloud
gateway. The tunnel key that is set in the logical bridge will be used
'internally' to connect the L2GW to the compute hosts and the key that
is set in the physical locator will be used to connect the L2GW to a
remote L2GW to form a tunnel between 2 clouds. In this case, the
'external' connection will use single 'dst_ip' on all the locators with
different tunnel key for each L2 domain.

The Neutron spec is available here:
https://review.openstack.org/#/c/270786/
The new code depend on the ability to use different keys in multiple
tunnels in the same logical switch.

Signed-off-by: Ofer Ben-Yacov <ofer.benyacov@gmail.com>
[blp@ovn.org added and clarified documentation]
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agonetdev-dpdk: Fix dpdk_watchdog failure to quiesce.
Kevin Traynor [Fri, 5 Feb 2016 17:07:16 +0000 (17:07 +0000)]
netdev-dpdk: Fix dpdk_watchdog failure to quiesce.

Fix issue whereby vhost_thread is waiting for dpdk_watchdog
thread to quiesce and at the same time dpdk_watchdog thread
is waiting for vhost_thread to give up dpdk_mutex.

Reported-by: Patrik Andersson R <patrik.r.andersson@ericsson.com>
Signed-off-by: Patrik Andersson R <patrik.r.andersson@ericsson.com>
Signed-off-by: Kevin Traynor <kevin.traynor@intel.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agoovs-benchmark: Remove.
Ben Pfaff [Sat, 6 Feb 2016 00:00:49 +0000 (16:00 -0800)]
ovs-benchmark: Remove.

This utility was completely broken and no one noticed for the time of a
full release, so I think that's a safe sign that we should remove it.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoovsdb-idl: log error in client when db schema does not exist on server
Lance Richardson [Thu, 28 Jan 2016 14:26:55 +0000 (09:26 -0500)]
ovsdb-idl: log error in client when db schema does not exist on server

A common error scenario with OVN is to attempt to use ovn-nbctl when
the OVN databases have not been created in ovsdb-server:
   1. ovn-nbctl sends "get_schema" request for OVN db to ovsdb-server.
   2. ovsdb-server fails to find requested db, sends error response
      to ovn-nbctl.
   3. ovn-nbctl receives the error response in ovsdb_idl_run(), but
      takes no specific action.
   4. ovn-nbctl hangs forever in IDL_S_SCHEMA_REQUESTED state (assuming
      a timeout wasn't requested on the command line).

Add a log message to inform the user of this situation.

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agorhel: Add '--with dpdk' spec option to build DPDK-enabled packages
Panu Matilainen [Thu, 28 Jan 2016 12:23:52 +0000 (14:23 +0200)]
rhel: Add '--with dpdk' spec option to build DPDK-enabled packages

Requires DPDK >= 2.2 as that is the first version to have a standard
install layout which we can discover without help from user.
Additionally document the option in INSTALL.Fedora.md.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoovs-numa: Fix cpu discovering if CONFIG_NUMA disabled.
Ilya Maximets [Mon, 25 Jan 2016 14:37:19 +0000 (17:37 +0300)]
ovs-numa: Fix cpu discovering if CONFIG_NUMA disabled.

If CONFIG_NUMA disabled in the system, PMD threads can't
be created:

|ovs_numa|INFO|Discovered 0 NUMA nodes and 0 CPU cores

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoovn-controller: Fix typo in comment.
Ben Pfaff [Fri, 5 Feb 2016 22:18:27 +0000 (14:18 -0800)]
ovn-controller: Fix typo in comment.

Too much asss.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Kyle Mestery <mestery@mestery.com>
8 years agoovsdb: Fix typo in libovsdb's pkg-config.
Ansari, Shad [Fri, 22 Jan 2016 20:06:28 +0000 (20:06 +0000)]
ovsdb: Fix typo in libovsdb's pkg-config.

Fix typo in the library name of pkg-config of libovsdb.

Reported-by: Javier Albornz <javier.albornoz@hpe.com>
Signed-off-by: Shad Ansari <shad.ansari@hpe.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agotest-ovsdb: Fix memory leak reported by valgrind.
William Tu [Fri, 22 Jan 2016 21:04:50 +0000 (13:04 -0800)]
test-ovsdb: Fix memory leak reported by valgrind.

Testcase 1311, 1312: Boolean-distinct queries on scalars, reports leak
below:
    xmalloc (util.c:112)
    do_query_distinct (test-ovsdb.c:1208)
    ovs_cmdl_run_command (command-line.c:121)
    main (test-ovsdb.c:72)

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoofproto-macros: Fix definition of add_of_ports.
Ben Pfaff [Fri, 5 Feb 2016 23:30:24 +0000 (15:30 -0800)]
ofproto-macros: Fix definition of add_of_ports.

This definition just didn't work, and caused lots of tests to inadvertently
be effectively skipped.

Fixes: ca5792f0d80ffd (tests: Change ADD_OF_PORTS from macro to shell function.)
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoovs-benchmark: Fix return value of do_poll.
William Tu [Thu, 21 Jan 2016 18:16:23 +0000 (10:16 -0800)]
ovs-benchmark: Fix return value of do_poll.

A positive number is returned when do_poll successes.

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoofproto-dpif-mirror: Fix bug that flag "need_revalidate" is never reset.
Huanle Han [Fri, 5 Feb 2016 23:43:25 +0000 (15:43 -0800)]
ofproto-dpif-mirror: Fix bug that flag "need_revalidate" is never reset.

Flag "need_revalidate" on mbridge is set to true when an ofbundle
destroy. And it's never reset. It causes the backer revalidate and
the mac learning flush every time 'ofproto_run' is called.

Signed-off-by: Huanle Han <hanxueluo@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoofproto-dpif-xlate: Fix clash between macro argument and struct member name.
Huanle Han [Fri, 15 Jan 2016 15:24:59 +0000 (23:24 +0800)]
ofproto-dpif-xlate: Fix clash between macro argument and struct member name.

Argument name "entries" is same as the member "entries" of xcache.
It will lead to compile error if we pass an argument whose name is
not "entries".

Signed-off-by: Huanle Han <hanxueluo@gmail.com>
8 years agoovsdb-server: fix monitor counters reported by memory/show
Andy Zhou [Thu, 4 Feb 2016 04:57:32 +0000 (20:57 -0800)]
ovsdb-server: fix monitor counters reported by memory/show

Commit 4c2809787cdbc774 (ovsdb-monitor: add json cache) introduced
an optimization that allows jsonrpc session to share monitors.
However, the memory/show implementation was not updated to match the
implementation; it still assumes that each jsonrpc session uses its
own monitor, thus are likely to over reporting the number.

This patch fix the bug and reports the actual number of monitor used
by the ovsdb-server.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agoovs-vswitchd: Preserve datapath ports across graceful shutdown.
Ben Pfaff [Thu, 4 Feb 2016 17:48:54 +0000 (09:48 -0800)]
ovs-vswitchd: Preserve datapath ports across graceful shutdown.

Until now, asking ovs-vswitchd to shut down gracefully, e.g. with
"ovs-appctl exit", would cause it to first remove all the ports from
kernel-based datapaths.  This has the unfortunate side effect that IP
addresses on any removed "internal" ports are lost, even if the ports are
added again when ovs-vswitchd is restarted.  This is long-standing
behavior, but it only became important when the OVS control scripts were
changed to try to do graceful shutdown first instead of using a signal.

This commit changes graceful shutdown so that it leaves ports in the
datapath, fixing the problem.

Fixes: 9b5422a98f8 (ovs-lib: Try to call exit before killing.)
Reported-by: Edgar Cantu <eocantu@us.ibm.com>
Reported-at: http://openvswitch.org/pipermail/discuss/2016-January/020024.html
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Gurucharan Shetty <guru@ovn.org>
8 years agolib/ovs-thread: Ensure that thread stacks are always at least 512 kB.
Alexandru Ardelean [Thu, 4 Feb 2016 07:20:34 +0000 (09:20 +0200)]
lib/ovs-thread: Ensure that thread stacks are always at least 512 kB.

This makes a difference for libc implementations (such as musl libc) that
have a really small default pthread stack size.

Will reference this discussion:
http://patchwork.ozlabs.org/patch/572340/

Reported-by: Robert McKay <robert@mckay.com>
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
[blp@ovn.org made style changes]
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoovn-northd: Revert "ovn-northd: Only run idl loop if something changed"
Numan Siddique [Thu, 4 Feb 2016 14:41:31 +0000 (20:11 +0530)]
ovn-northd: Revert "ovn-northd: Only run idl loop if something changed"

This reverts f20396e051ea4fd623bfc022cc78d9bd52a850e5

f20396e.. was required to fix the failing ovn-sbctl testsuites.
commit fb496f92ca1eeead8760b5cdfd857165f64deadf addresses these failing
test cases in a proper way.

With commit f20396e.. its possible that commit to the southbound db is
delayed. When ovnnb_db_run is called, and if ctx->ovnsb_txn is NULL,
ovnnb_db_run returns immediately without generating the logical flows.
ovnnb_db_run is not called again until the northbound db seqno changes.

Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
8 years agodpif-netdev: Allow different numbers of rx queues for different ports.
Ilya Maximets [Thu, 21 Jan 2016 14:15:18 +0000 (17:15 +0300)]
dpif-netdev: Allow different numbers of rx queues for different ports.

Currently, all of the PMD netdevs can only have the same number of
rx queues, which is specified in other_config:n-dpdk-rxqs.

Fix that by introducing of new option for PMD interfaces: 'n_rxq', which
specifies the maximum number of rx queues to be created for this
interface.

Example:
ovs-vsctl set Interface dpdk0 options:n_rxq=8

Old 'other_config:n-dpdk-rxqs' deleted.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Ben Pfaff <blp@ovn.org>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agotravis: Update kernel matrix.
Joe Stringer [Thu, 24 Dec 2015 19:46:42 +0000 (11:46 -0800)]
travis: Update kernel matrix.

Remove v4.2 as it is EOL; Add v4.3 as we support this version in
OVS-2.5. Update other versions to the latest listed on kernel.org.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agodatapath: Re-designate OVS_FRAGMENT_BACKPORT.
Joe Stringer [Thu, 24 Dec 2015 21:09:38 +0000 (13:09 -0800)]
datapath: Re-designate OVS_FRAGMENT_BACKPORT.

Typically the way that we include backported code is by testing for
existence of the feature in the upstream codebase via header checks,
then attempt to use the upstream code as much as possible. However, for
the IP fragmentation handling backport we have an additional constraint
which is that we cannot support kernels older than Linux-3.10.

To date, OVS_FRAGMENT_BACKPORT has been defined to include the backport
of the IP fragmentation code for all kernels from 3.10 to 4.2, rather
than attempting to use the upstream code as much as possible. This patch
relaxes OVS_FRAGMENT_BACKPORT to only check the lower bound so that the
upstream code may be used in more circumstances.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agocompat: Detect and use upstream ip_fragment().
Joe Stringer [Tue, 2 Feb 2016 23:19:02 +0000 (15:19 -0800)]
compat: Detect and use upstream ip_fragment().

Previously a version check was used to determine whether the upstream
ip_fragment() should be used or the backported version. The actual test
is for whether upstream commit d6b915e29f4a ("ip_fragment: don't forward
defragmented DF packet") is present, so test for that instead.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agocompat: Detect and use inet_frag_queue->list_evictor.
Joe Stringer [Thu, 24 Dec 2015 18:41:35 +0000 (10:41 -0800)]
compat: Detect and use inet_frag_queue->list_evictor.

Kernels 3.17 to 4.2 have a work queue to evict old fragments, but do not
track these fragments in an eviction list. On these kernels, we detect
the absence of the list_evictor and provide one. This commit fixes the
reliance on kernel versions in the case that this functionality is
backported.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agocompat: Rename OVS frag caches.
Joe Stringer [Tue, 2 Feb 2016 23:19:00 +0000 (15:19 -0800)]
compat: Rename OVS frag caches.

These should not have the same name as the upstream ones, to reduce
confusion when they are created. Rename them.

Suggested-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agodatapath: Fix kernel-4.3 build.
Joe Stringer [Tue, 2 Feb 2016 23:18:59 +0000 (15:18 -0800)]
datapath: Fix kernel-4.3 build.

Commit 792e5ed750ce ("datapath: inet: frag: Always orphan skbs inside
ip_defrag().") broke the build for OVS backport against kernel-4.3. Fix
the build.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agocmap: Explain corner case in CMAP_FOR_EACH comment.
Daniele Di Proietto [Wed, 3 Feb 2016 04:55:48 +0000 (20:55 -0800)]
cmap: Explain corner case in CMAP_FOR_EACH comment.

Commit d916785ce98c("dpif-netdev: Fix improper use of CMAP_FOR_EACH.")
fixes a problem that's worth documenting.

Requested-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agobridge: Do not add bridges with '/' in name.
Daniele Di Proietto [Tue, 2 Feb 2016 21:28:11 +0000 (13:28 -0800)]
bridge: Do not add bridges with '/' in name.

This effectively stops vswitchd from creating bridges with '/' in the
name. OVS used to print a warning but the bridge was created anyway.

This restriction is implemented because the bridge name is part of a
filesystem path.

This check is no substitute for Mandatory Access Control, but it
certainly helps to catch the error early.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
[blp@ovn.org added a test]
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agodpif: Allow adding ukeys for same flow by different pmds.
Ilya Maximets [Wed, 3 Feb 2016 11:31:43 +0000 (14:31 +0300)]
dpif: Allow adding ukeys for same flow by different pmds.

In multiqueue mode several pmd threads may process one port, but
different queues. Flow may not depend on queue. It's true at least for
vhost-user ports.

When multiple pmd threads attempt to process upcalls for a particular
flow key, only the first will succeed. Any subsequent threads will
receive error = ENOSPC when attempting to insert a new udpif_key into
the umaps. This causes the latter threads to never insert a flow into
the datapath to handle the traffic, and as a result they will
consistently execute those flows through the slow path.

Fix that by mixing pmd_id with the bits from the ufid for ukey->hash
calculation. So, for a given flow key/UFID, each pmd thread will create
an independent udpif_key.

This also opens the possibility to reassign queues among pmd threads
without restarting them and deleting the megaflow cache.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
8 years agovlog: Stop using explicit references to external log modules.
Ben Pfaff [Wed, 3 Feb 2016 21:15:48 +0000 (13:15 -0800)]
vlog: Stop using explicit references to external log modules.

It's always risky to write "extern" declarations outside a header file,
since there's no way to ensure the type of what's being referenced is
correct.  In these cases, we can easily avoid the extern reference, so do
so.

There is a little tradeoff here, in that referring to the log modules
through strings means that we catch an incorrect module name at runtime
instead of at link time, but I think that the risk here is minimal because
the mistake will be found by every test in "make check" that runs any of
the utilities, since they make these calls as one of their first tasks
during initialization.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agovlog: Simplify module definition.
Ben Pfaff [Wed, 3 Feb 2016 23:18:33 +0000 (15:18 -0800)]
vlog: Simplify module definition.

Until now, vlog had a macro VLOG_DEFINE_THIS_MODULE, which expanded using
VLOG_DEFINE_MODULE, which expanded using VLOG_DEFINE_MODULE__, and the
latter macros didn't have any other users.  This commit combines them for
clarity.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agovlog: Make 'vlog_modules' private to vlog.c.
Ben Pfaff [Wed, 3 Feb 2016 20:23:36 +0000 (12:23 -0800)]
vlog: Make 'vlog_modules' private to vlog.c.

I think we once used this variable from an inline function in vlog.h, so
that we had to make it "extern", but these days it's only used from vlog.c,
so it can be static now.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agobridge: Also prohibit \ in bridge names.
Ben Pfaff [Wed, 3 Feb 2016 22:45:30 +0000 (14:45 -0800)]
bridge: Also prohibit \ in bridge names.

This is only necessary for Windows but it's no great loss elsewhere.

Also, document the restriction on bridge names.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
8 years agoofproto: Detect and handle errors in ofproto_port_add().
Ben Pfaff [Wed, 3 Feb 2016 01:57:46 +0000 (17:57 -0800)]
ofproto: Detect and handle errors in ofproto_port_add().

The update_port() function called in ofproto_port_add() can encounter
errors that prevent a port from being added, but nothing was checking for
the error and in fact update_port() didn't even pass the error along to
its caller.  This commit fixes the problem.

The scenario that led me to examine this code can be triggered as follows
from the sandbox, as long as you change --enable-dummy=override to
--enable-dummy=system in ovs-sandbox:

ovs-vsctl add-br br0
ovs-vsctl add-port br0 tun0 \
    -- set interface tun0 type=stt options:remote_ip=1.2.3.4
ovs-vsctl add-port br0 tun1 \
    -- set interface tun1 type=stt options:remote_ip=1.2.3.4

The second add-port will fail due to the duplicate tunnel options, but
ofproto_port_add() will not return the error.  Instead, it will report to
the caller that it succeeded and tell it that it has ofp_port OFPP_NONE
(65535), which is invalid and it obviously does not.  The result is that
you get bizarre log messages like this:

    tunnel|WARN|tun1: attempting to add tunnel port with same config as port 'tun0' (::->1.2.3.4, key=0, dp port=7471, pkt mark=0)
    ofproto|WARN|br0: could not add port tun1 (File exists)
    bridge|INFO|bridge br0: added interface tun1 on port 65535
    ofproto|WARN|br0: cannot configure bfd on nonexistent port 65535
    ofproto|WARN|br0: cannot configure LLDP on nonexistent port 65535
    ofproto|WARN|br0: cannot get STP status on nonexistent port 65535
    ofproto|WARN|br0: cannot get RSTP status on nonexistent port 65535
    ofproto|WARN|br0: cannot get STP stats on nonexistent port 65535
    ofproto|WARN|br0: cannot get STP stats on nonexistent port 65535

VMware-BZ: #1598643
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
8 years agotests: Add vlog tests for C implementation to match Python tests.
Ben Pfaff [Tue, 8 Dec 2015 08:59:56 +0000 (00:59 -0800)]
tests: Add vlog tests for C implementation to match Python tests.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agodpif-netdev: Correctly update 'key' in emc_processing().
Daniele Di Proietto [Wed, 3 Feb 2016 04:38:11 +0000 (20:38 -0800)]
dpif-netdev: Correctly update 'key' in emc_processing().

The 'key' pointer must point at the first unused element in the key
array.

Fixes: b89c678b7a26 ("dpif-netdev: optmizing emc_processing()")
CC: Andy Zhou <azhou@ovn.org>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Andy Zhou <azhou@nicira.com>
8 years agoovn: Update comment about local datapath calculation.
Russell Bryant [Wed, 3 Feb 2016 16:46:33 +0000 (11:46 -0500)]
ovn: Update comment about local datapath calculation.

ovn-controller has a simple optimization for excluding some logical flow
processing that we know is unnecessary.  This update to a comment in the
code reflects a discussion we had on the mailing list about a better
algorithm that would let us exclude even more.

Signed-off-by: Russell Bryant <russell@ovn.org>
8 years agodatapath-windows: fix endless loop on reboot
Alin Serdean [Tue, 12 Jan 2016 18:00:32 +0000 (18:00 +0000)]
datapath-windows: fix endless loop on reboot

Testing under 2012 gave some more inisight on an old bug.

If a PNP event with the value of NetEventSwitchActivate was triggered
we were calling OvsQuerySwitchActivationComplete which does an OID request
to the underlying drivers, however this triggered a hang because as per
documentation:
https://msdn.microsoft.com/en-us/library/windows/hardware/ff561830%28v=vs.85%29.aspx
"A driver can call NdisFOidRequest when it is in the Restarting, Running,
Pausing, or Paused state."
This resulted in an endless booting cycle.
Looking at the documentation again:
https://msdn.microsoft.com/en-us/library/windows/hardware/ff568751%28v=vs.85%29.aspx
NetEventSwitchActivate indicates that the extensible switch has completed
activation so we can now safely query the switch itself.

Also we are not forwarding the PNP event to the overlaying drivers unless
we succeeded in the operation, this issue has been fixed also.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
8 years agoovn-controller: Only process lflows for local datapaths.
Russell Bryant [Wed, 20 Jan 2016 18:29:25 +0000 (13:29 -0500)]
ovn-controller: Only process lflows for local datapaths.

Previously, ovn-controller translated logical flows into OpenFlow flows
for *every* logical datapath.  This patch makes it so we skip doing so
for the egress pipeline if the datapath is a logical switch with no
logical ports bound locally.  In that case, the flows have no effect.

This was the code path taking the most time in a large scale OVN
environment and was an easy optimization to make based on the existing
local_datapaths info.

In this environment, while idling, ovn-controller was taking up about
20% CPU with this patch, while other nodes were in the 40-70% range.

Reported-at: https://bugs.launchpad.net/networking-ovn/+bug/1536003
Signed-off-by: Russell Bryant <russell@ovn.org>
Tested-by: Matt Mulsow <mamulsow@us.ibm.com>
Acked-by: Ben Pfaff <blp@ovn.org>
Acked-By: Kyle Mestery <mestery@mestery.com>
8 years agovtep: add logical router related commands.
Wenyu Zhang [Fri, 29 Jan 2016 10:22:16 +0000 (02:22 -0800)]
vtep: add logical router related commands.

Add logical router related vtep-ctl commands:
vtep-ctl add-lr LR
vtep-ctl del-lr LR
vtep-ctl list-lr
vtep-ctl lr-exists LR

Signed-off-by: Wenyu Zhang <wenyuz@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
8 years agoovn-controller: Allocate ct zones for localnet ports.
Russell Bryant [Mon, 25 Jan 2016 21:54:06 +0000 (16:54 -0500)]
ovn-controller: Allocate ct zones for localnet ports.

Previously, all ct() actions applied to localnet ports used the default
conntrack zone.  We should allocate a ct zone ID for all localnet ports
just like we do for all local VIFs so that none of our connection
tracking interferes with any base system connection tracking in the
default zone.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Han Zhou <zhouhan@gmail.com>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agoovn: Fix localnet ports on the same chassis.
Russell Bryant [Fri, 15 Jan 2016 21:39:42 +0000 (16:39 -0500)]
ovn: Fix localnet ports on the same chassis.

Multiple logical ports on the same chassis that were connected to the
same physical network via localnet ports were not able to send packets
to each other.  This was because ovn-controller created a single patch
port between br-int and the physical network access bridge and used it
for all localnet ports.

The fix implemented here is to create a separate patch port for every
logical port of type=localnet.  An optimization is included where these
ports are only created if the localnet port is on a logical switch with
another logical port with an associated local VIF.

A nice side effect of this fix is that the code in physical.c got a lot
simpler, as localnet ports are now handled mostly like local VIFs.

Fixes: c02819293d52 ("ovn: Add "localnet" logical port type.")
Reported-by: Han Zhou <zhouhan@gmail.com>
Reported-at: http://openvswitch.org/pipermail/dev/2016-January/064413.html
Signed-off-by: Russell Bryant <russell@ovn.org>
Tested-by: Kyle Mestery <mestery@mestery.com
Acked-By: Kyle Mestery <mestery@mestery.com>
Tested-by: Han Zhou <zhouhan@gmail.com>
Tested-by: Michael Arnaldi <michael.arnaldi@mymoneyex.com>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agoovn-controller: Move local_datapaths calculation.
Russell Bryant [Fri, 15 Jan 2016 19:30:41 +0000 (14:30 -0500)]
ovn-controller: Move local_datapaths calculation.

Before this patch, physical.c build up the set of local datapaths for
its own use.  I'd like to use it in another module in a later patch, so
pull it out of physical.  It's now populated by the bindings module,
since that seems like a more appropriate place to do it, and it's also
done much earlier in the main loop, making it easier to re-use.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Han Zhou <zhouhan@gmail.com>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agodpif-netdev: Fix improper use of CMAP_FOR_EACH.
Daniele Di Proietto [Wed, 27 Jan 2016 02:53:52 +0000 (18:53 -0800)]
dpif-netdev: Fix improper use of CMAP_FOR_EACH.

It is ok to iterate a cmap with CMAP_FOR_EACH and remove elements with
cmap_remove(), but having quiescent states inside the loop might create
problems, since some of the postponed cleanup done inside the cmap might
be executed, freeing the memory that the iterator is using.

We had several of these errors in dpif-netdev, because when we rearrange
ports or threads we often need to wait on a condition variable (which
implies a quiescent state).

This problem caused iterations to skip elements or to list them twice,
resulting in the main thread waiting on a condition without anyone else
to signal.

Fix these cases by moving the possible quiescent states outside
CMAP_FOR_EACH loops.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Tested-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agodpif-netdev: Delay packets' metadata initialization.
Daniele Di Proietto [Fri, 29 Jan 2016 01:47:51 +0000 (17:47 -0800)]
dpif-netdev: Delay packets' metadata initialization.

When a group of packets arrives from a port, we loop through them to
initialize metadata and then we loop through them again to extract the
flow and perform the exact match classification.

This commit combines the two loops into one, and initializes packet->md
in emc_processing() to improve performance.

Since emc_processing() might also be called after recirculation (in
which case the metadata is already valid), an extra parameter is added
to support both cases.

This commits also implements simple prefetching of packet metadata,
to further improve performance.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Andy Zhou <azhou@ovn.org>
Acked-by: Chandran, Sugesh <sugesh.chandran@intel.com>
8 years agocompat: Detect and use nf_ct_frag6_gather().
Joe Stringer [Fri, 8 Jan 2016 01:47:23 +0000 (17:47 -0800)]
compat: Detect and use nf_ct_frag6_gather().

This function is a likely candidate for backporting, and currently
relies on version checks to include the source or not. Grep for the
appropriate functions instead, and include the backport based on that.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agocompat: Detect and use inet_getpeer_v4().
Joe Stringer [Fri, 8 Jan 2016 01:58:59 +0000 (17:58 -0800)]
compat: Detect and use inet_getpeer_v4().

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agocompat: Detect and use __skb_dst_copy().
Joe Stringer [Thu, 24 Dec 2015 19:41:40 +0000 (11:41 -0800)]
compat: Detect and use __skb_dst_copy().

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agocompat: Detect and use nf_connlabels_get().
Joe Stringer [Thu, 24 Dec 2015 19:34:35 +0000 (11:34 -0800)]
compat: Detect and use nf_connlabels_get().

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agocompat: Detect and use nf_ipv6_ops->fragment.
Joe Stringer [Thu, 24 Dec 2015 19:32:38 +0000 (11:32 -0800)]
compat: Detect and use nf_ipv6_ops->fragment.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agocompat: Detect and use struct nf_conntrack_zone.
Joe Stringer [Thu, 24 Dec 2015 19:29:34 +0000 (11:29 -0800)]
compat: Detect and use struct nf_conntrack_zone.

Rather than relying on version checks, detect the presence of this
structure and use it if available.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agocompat: Detect and use inet_frags->lock.
Joe Stringer [Thu, 24 Dec 2015 19:06:18 +0000 (11:06 -0800)]
compat: Detect and use inet_frags->lock.

Prior to ab1c724f6330 ("inet: frag: use seqlock for hash rebuild")
upstream, a rwlock was used when rebuilding inet_frags. Rather than
using a version check to detect this, search for it in the header and
enable the code based on whether it exists.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agocompat: Detect and use inet_frags->frags_work.
Joe Stringer [Thu, 24 Dec 2015 18:54:37 +0000 (10:54 -0800)]
compat: Detect and use inet_frags->frags_work.

Kernels 3.17 and newer have a work queue to evict old fragments, while
older kernel versions use an LRU in the fast path; see upstream commit
b13d3cbfb8e8 ("inet: frag: move eviction of queues to work queue").
This commit fixes the version checking so that rather than enabling the
code for either of these approaches using version checks, it is
triggered based on the presence of the work queue in "struct inet_frags".

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agocompat: Detect and use inet_frag_queue->last_in.
Joe Stringer [Thu, 24 Dec 2015 18:40:02 +0000 (10:40 -0800)]
compat: Detect and use inet_frag_queue->last_in.

Kernels 3.17 and older have this field, while newer kernels use the
'flags' field. Detect this in the build in case anyone backports this
change to an older kernel.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agopython: Deal with str and byte differences.
Russell Bryant [Thu, 17 Dec 2015 14:45:58 +0000 (09:45 -0500)]
python: Deal with str and byte differences.

Python 3 has separate types for strings and bytes.  Python 2 used the
same type for both.  We need to convert strings to bytes before writing
them out to a socket.  We also need to convert data read from the socket
to a string.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agopython: Fix object comparisons in Python 3.
Russell Bryant [Thu, 17 Dec 2015 17:55:43 +0000 (12:55 -0500)]
python: Fix object comparisons in Python 3.

Python 3 no longer supports __cmp__.  Instead, we have to implement the
"rich comparison" operators.  We implement __eq__ and __lt__ and use
functools.total_ordering to implement the rest.

In one case, no __cmp__ method was provided and instead relied on the
default behavior provided in Python 2.  We have to implement the
comparisons explicitly for Python 3.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agopython: Don't compare None and int.
Russell Bryant [Thu, 17 Dec 2015 14:56:44 +0000 (09:56 -0500)]
python: Don't compare None and int.

Comparing None to an integer worked in Python 2, but fails in Python 3.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agopython: Remove reamining direct type comparisons.
Russell Bryant [Wed, 16 Dec 2015 21:16:49 +0000 (16:16 -0500)]
python: Remove reamining direct type comparisons.

I've hit several bugs in this Python 3 work where the fix was some code
needed to be converted to use isinstance().  This has been primarily
around deadling with the changes to unicode handling.  Go ahead and
convert the rest of the direct type comparisons to use isinstance(), as
it could avoid a bug I haven't hit yet and it's more Pythonic, anyway.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agopython: Use six.unichr().
Russell Bryant [Wed, 16 Dec 2015 17:19:22 +0000 (12:19 -0500)]
python: Use six.unichr().

six.unichr() is equivalent to unichr() in Python 2
and chr() in Python 3.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agopython: Drop use of sys.maxint.
Russell Bryant [Tue, 15 Dec 2015 21:37:11 +0000 (16:37 -0500)]
python: Drop use of sys.maxint.

sys.maxint does not exist in Python 3, as an int does not have a max
value anymore (except as limited by implementation details and system
resources).

sys.maxsize works as a reasonable substitute as it's the same as
sys.maxint.  The Python 3.0 release notes have this to say:

  The sys.maxint constant was removed, since there is no longer a limit
  to the value of integers. However, sys.maxsize can be used as an
  integer larger than any practical list or string index. It conforms to
  the implementation’s “natural” integer size and is typically the same
  as sys.maxint in previous releases on the same platform (assuming the
  same build options).

sys.maxsize is documented as:

  An integer giving the maximum value a variable of type Py_ssize_t can
  take. It’s usually 2**31 - 1 on a 32-bit platform and 2**63 - 1 on a
  64-bit platform.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agopython: Don't use StringIO directly.
Russell Bryant [Tue, 15 Dec 2015 21:01:38 +0000 (16:01 -0500)]
python: Don't use StringIO directly.

StringIO.StringIO in Python 2 became io.StringIO in Python 3.  Use
six.StringIO which is an alias for the two cases.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agopython: Drop use of types.FunctionType.
Russell Bryant [Tue, 15 Dec 2015 13:51:45 +0000 (08:51 -0500)]
python: Drop use of types.FunctionType.

This code asserted that the callback argument was of type
types.FunctionType.  It's more pythonic to just check that the argument
is callable, and not specifically that it's a function.  There are other
ways to implement a callback than types.FunctionType.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agopython: Drop use of types.StringTypes.
Russell Bryant [Mon, 14 Dec 2015 22:21:26 +0000 (17:21 -0500)]
python: Drop use of types.StringTypes.

types.StringTypes does not exist in Python 3.  We can use
six.string_types, instead.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agopython: Drop unicode type.
Russell Bryant [Mon, 14 Dec 2015 22:01:11 +0000 (17:01 -0500)]
python: Drop unicode type.

Python 2 had str and unicode.  Python 3 only has str, which is always a
unicode string.  Drop use of unicode with the help of six.text_type
(unicode in py2 and str in py3) and six.string_types ([str, unicode] in
py2 and [str] in py3).

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agopython: Drop usage of long type.
Russell Bryant [Mon, 14 Dec 2015 21:32:00 +0000 (16:32 -0500)]
python: Drop usage of long type.

Python 2 has both long and int types.  Python 3 only has int, which
behaves like long.

In the case of needing a set of integer types, we can use
six.integer_types which includes int and long for Python 2 and just int
for Python 3.

We can convert all cases of long(value) to int(value), because as of
Python 2.4, when the result of an operation would be too big for an int,
the type is automatically converted to a long.

There were several places in this patch doing type comparisons.  The
preferred way to do this is using the isinstance() or issubclass()
built-in functions, so I converted the similar checks nearby while I was
at it.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agoflake8: Fix use of --select and --ignore.
Russell Bryant [Fri, 22 Jan 2016 19:49:25 +0000 (14:49 -0500)]
flake8: Fix use of --select and --ignore.

The flake8 command evolved over a series of patches and now includes the
use of both --select and --ignore.  Unfortunately, this wasn't doing
what I thought.  The use of --select completely overrides what --ignore
does, meaning that we were only currently enforcing a small number of
warnings specified in --select.  This patch runs flake8 twice, once with
--select and once with --ignore to actually enforce the full desired
set of warnings.

No additional violations had been introduced, but I noticed this while
working on some other patches.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agodpif-netdev: optmizing emc_processing()
Andy Zhou [Sat, 30 Jan 2016 01:48:50 +0000 (17:48 -0800)]
dpif-netdev: optmizing emc_processing()

Commit d262ac2c60ce1da7b477737f70e8efd38b32502d introduced a slight
performance drop for the fast path, where every packets hits the
emc cache.  This patch removes that performance drop by only reloading
the key pointer on emc cache miss.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agodpif-netdev: Load packet pointer only once in emc_processing()
Andy Zhou [Sat, 30 Jan 2016 01:40:18 +0000 (17:40 -0800)]
dpif-netdev: Load packet pointer only once in emc_processing()

For the machines I have access to, Reloading the same pointer from
memory seems to inhibit complier optimization somewhat.

In emc_processing(), using a single packet pointer, instead reloading
it from memory with packets[i], improves performance by 0.3 Mpps (tested
with 10G NIC pushing 64 byte packets, with the base line of 12.2 Mpps).

Besides improving performance, this patch should also improves code
readability.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agonetdev-dpdk: Fix leak on netdev_dpdk_vhost_user_construct failure.
Ilya Maximets [Tue, 2 Feb 2016 11:02:16 +0000 (14:02 +0300)]
netdev-dpdk: Fix leak on netdev_dpdk_vhost_user_construct failure.

Memory pool for vhost-user ports always created even if construction
fails. And message about successfull socket creation also printed.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agonetdev-dpdk: Unlink vhost-user sockets on fatal signals.
Ilya Maximets [Tue, 2 Feb 2016 11:02:15 +0000 (14:02 +0300)]
netdev-dpdk: Unlink vhost-user sockets on fatal signals.

While killing OVS may not call rte_vhost_driver_unregister()
for vhost-user ports. As a result corresponding socket will
remain in a system and opening of that port after restart
will fail.

(Even after this patch this remains a problem for signals
that OVS does not or cannot catch, such as SIGSEGV and
SIGKILL.)

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agodatapath-windows: Updated FAQ regarding Hyper-V MPLS.
Sorin Vinturis [Tue, 2 Feb 2016 10:43:03 +0000 (10:43 +0000)]
datapath-windows: Updated FAQ regarding Hyper-V MPLS.

Updated FAQ document to reflect MPLS support for Hyper-V.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
8 years agodatapath-windows: Accept MPLS feature probe.
Sorin Vinturis [Tue, 2 Feb 2016 10:41:28 +0000 (10:41 +0000)]
datapath-windows: Accept MPLS feature probe.

Currently all feature probe messages sent from userspace are
suppressed by the OVS extension.

This patch changes the current behaviour to allow feature probe
for MPLS.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
8 years agodatapath-windows: Support for OVS_KEY_ATTR_MPLS attribute
Sorin Vinturis [Tue, 2 Feb 2016 10:41:27 +0000 (10:41 +0000)]
datapath-windows: Support for OVS_KEY_ATTR_MPLS attribute

This patch adds OVS_KEY_ATTR_MPLS to the OVS flow mechanism.

Tested using ping.
Tested using iperf (TCP and UDP).
Tested using DriverVerifier.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
8 years agoodp-util: Fix formatting and parsing of 'frag' in tnl_push ipv4 argument.
Ben Pfaff [Mon, 1 Feb 2016 19:31:54 +0000 (11:31 -0800)]
odp-util: Fix formatting and parsing of 'frag' in tnl_push ipv4 argument.

ip_frag_off is an ovs_be16 so it must be converted between host and
network byte order for parsing and formatting.

Reported-by: Dimitri John Ledkov <xnox@ubuntu.com>
Reported-at: http://openvswitch.org/pipermail/discuss/2016-January/020072.html
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Dimitri John Ledkov <xnox@ubuntu.com>
8 years agoovn-northd: Don't set custom log level defaults.
Russell Bryant [Mon, 1 Feb 2016 14:58:22 +0000 (09:58 -0500)]
ovn-northd: Don't set custom log level defaults.

ovn-northd set some custom log level defaults, which I believe were
copied from ovs-vsctl.  Other daemons don't set this.  The difference in
behavior in ovn-northd vs other daemons has caused some confusion during
OpenStack+OVN development and testing, so make it consistent.

Reported-by: Ryan Moats <rmoats@us.ibm.com>
Reported-at: https://bugs.launchpad.net/bugs/1539994
Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-By: Kyle Mestery <mestery@mestery.com>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agodpif-netdev: Avoid copying netdev_flow_key in emc_processing().
Ben Pfaff [Sun, 24 Jan 2016 16:32:36 +0000 (08:32 -0800)]
dpif-netdev: Avoid copying netdev_flow_key in emc_processing().

Before this commit, emc_processing() copied a netdev_flow_key if there was
no exact-match cache (EMC) hit.  This commit eliminates the copy by
constructing the netdev_flow_key in the place it would be copied.

Found by inspection.

Shahbaz (CCed) reports that this reduces the cost of an EMC miss by 72
cycles in his test case in which the EMC is disabled.  Presumably this
is similarly valuable in cases where the EMC merely has few hits.

For the original version of this patch, which was against a slightly
earlier version of OVS, Daniele reported that:

    - With EMC disabled, this increases throughput from 4.8 Mpps to 5.4
      Mpps.

    - With EMC enabled, this decreases throughput from 12.4 to 12.0 Mpps.

CC: Muhammad Shahbaz <mshahbaz@cs.princeton.edu>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agoofproto-dpif-xlate: Remove obsolete special case.
Jarno Rajahalme [Sat, 30 Jan 2016 01:28:08 +0000 (17:28 -0800)]
ofproto-dpif-xlate: Remove obsolete special case.

Bond recirculation used to insert a special rule that jumped from the
internal table to table 0 using GOTO_TABLE.  Since the introduction of
the ofproto-dpif-rid this has not been necessary any more, so we can
remove the special case that allowed GOTO_TABLE to go backwards in
that case.

Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
8 years agobuild: Fix for rename of MAINTAINERS file.
Russell Bryant [Sat, 30 Jan 2016 00:50:07 +0000 (19:50 -0500)]
build: Fix for rename of MAINTAINERS file.

I renamed MAINTAINERS to MAINTAINERS.md, but forgot to update
Makefile.am to reflect the new name.

Signed-off-by: Russell Bryant <russell@ovn.org>
8 years agoovs-thread: Fix missing space.
William Tu [Fri, 29 Jan 2016 23:27:55 +0000 (15:27 -0800)]
ovs-thread: Fix missing space.

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Justin Pettit <jpettit@ovn.org>
8 years agocommitter-grant-revocation.md: Fix link and clarify location.
Justin Pettit [Fri, 29 Jan 2016 11:32:12 +0000 (03:32 -0800)]
committer-grant-revocation.md: Fix link and clarify location.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agodatapath: inet: frag: Always orphan skbs inside ip_defrag().
Joe Stringer [Fri, 29 Jan 2016 19:01:56 +0000 (11:01 -0800)]
datapath: inet: frag: Always orphan skbs inside ip_defrag().

When the linux stack is an endpoint connected to OVS which is performing
IP fragmentation via conntrack actions, it's possible to hit a kernel
BUG. The following upstream commit fixes the issue inside ip_defrag().
For the backport, we provide this inside ip_defrag() for kernels that we
currently backport that function, and also provide just the bugfix for
newer kernels, so we can continue to use upstream functionality as much
as possible.

Upstream commit:
    Later parts of the stack (including fragmentation) expect that there is
    never a socket attached to frag in a frag_list, however this invariant
    was not enforced on all defrag paths. This could lead to the
    BUG_ON(skb->sk) during ip_do_fragment(), as per the call stack at the
    end of this commit message.

    While the call could be added to openvswitch to fix this particular
    error, the head and tail of the frags list are already orphaned
    indirectly inside ip_defrag(), so it seems like the remaining fragments
    should all be orphaned in all circumstances.

    kernel BUG at net/ipv4/ip_output.c:586!
    [...]
    Call Trace:
     <IRQ>
     [<ffffffffa0205270>] ? do_output.isra.29+0x1b0/0x1b0 [openvswitch]
     [<ffffffffa02167a7>] ovs_fragment+0xcc/0x214 [openvswitch]
     [<ffffffff81667830>] ? dst_discard_out+0x20/0x20
     [<ffffffff81667810>] ? dst_ifdown+0x80/0x80
     [<ffffffffa0212072>] ? find_bucket.isra.2+0x62/0x70 [openvswitch]
     [<ffffffff810e0ba5>] ? mod_timer_pending+0x65/0x210
     [<ffffffff810b732b>] ? __lock_acquire+0x3db/0x1b90
     [<ffffffffa03205a2>] ? nf_conntrack_in+0x252/0x500 [nf_conntrack]
     [<ffffffff810b63c4>] ? __lock_is_held+0x54/0x70
     [<ffffffffa02051a3>] do_output.isra.29+0xe3/0x1b0 [openvswitch]
     [<ffffffffa0206411>] do_execute_actions+0xe11/0x11f0 [openvswitch]
     [<ffffffff810b63c4>] ? __lock_is_held+0x54/0x70
     [<ffffffffa0206822>] ovs_execute_actions+0x32/0xd0 [openvswitch]
     [<ffffffffa020b505>] ovs_dp_process_packet+0x85/0x140 [openvswitch]
     [<ffffffff810b63c4>] ? __lock_is_held+0x54/0x70
     [<ffffffffa02068a2>] ovs_execute_actions+0xb2/0xd0 [openvswitch]
     [<ffffffffa020b505>] ovs_dp_process_packet+0x85/0x140 [openvswitch]
     [<ffffffffa0215019>] ? ovs_ct_get_labels+0x49/0x80 [openvswitch]
     [<ffffffffa0213a1d>] ovs_vport_receive+0x5d/0xa0 [openvswitch]
     [<ffffffff810b732b>] ? __lock_acquire+0x3db/0x1b90
     [<ffffffff810b732b>] ? __lock_acquire+0x3db/0x1b90
     [<ffffffff810b732b>] ? __lock_acquire+0x3db/0x1b90
     [<ffffffffa0214895>] ? internal_dev_xmit+0x5/0x140 [openvswitch]
     [<ffffffffa02148fc>] internal_dev_xmit+0x6c/0x140 [openvswitch]
     [<ffffffffa0214895>] ? internal_dev_xmit+0x5/0x140 [openvswitch]
     [<ffffffff81660299>] dev_hard_start_xmit+0x2b9/0x5e0
     [<ffffffff8165fc21>] ? netif_skb_features+0xd1/0x1f0
     [<ffffffff81660f20>] __dev_queue_xmit+0x800/0x930
     [<ffffffff81660770>] ? __dev_queue_xmit+0x50/0x930
     [<ffffffff810b53f1>] ? mark_held_locks+0x71/0x90
     [<ffffffff81669876>] ? neigh_resolve_output+0x106/0x220
     [<ffffffff81661060>] dev_queue_xmit+0x10/0x20
     [<ffffffff816698e8>] neigh_resolve_output+0x178/0x220
     [<ffffffff816a8e6f>] ? ip_finish_output2+0x1ff/0x590
     [<ffffffff816a8e6f>] ip_finish_output2+0x1ff/0x590
     [<ffffffff816a8cee>] ? ip_finish_output2+0x7e/0x590
     [<ffffffff816a9a31>] ip_do_fragment+0x831/0x8a0
     [<ffffffff816a8c70>] ? ip_copy_metadata+0x1b0/0x1b0
     [<ffffffff816a9ae3>] ip_fragment.constprop.49+0x43/0x80
     [<ffffffff816a9c9c>] ip_finish_output+0x17c/0x340
     [<ffffffff8169a6f4>] ? nf_hook_slow+0xe4/0x190
     [<ffffffff816ab4c0>] ip_output+0x70/0x110
     [<ffffffff816a9b20>] ? ip_fragment.constprop.49+0x80/0x80
     [<ffffffff816aa9f9>] ip_local_out+0x39/0x70
     [<ffffffff816abf89>] ip_send_skb+0x19/0x40
     [<ffffffff816abfe3>] ip_push_pending_frames+0x33/0x40
     [<ffffffff816df21a>] icmp_push_reply+0xea/0x120
     [<ffffffff816df93d>] icmp_reply.constprop.23+0x1ed/0x230
     [<ffffffff816df9ce>] icmp_echo.part.21+0x4e/0x50
     [<ffffffff810b63c4>] ? __lock_is_held+0x54/0x70
     [<ffffffff810d5f9e>] ? rcu_read_lock_held+0x5e/0x70
     [<ffffffff816dfa06>] icmp_echo+0x36/0x70
     [<ffffffff816e0d11>] icmp_rcv+0x271/0x450
     [<ffffffff816a4ca7>] ip_local_deliver_finish+0x127/0x3a0
     [<ffffffff816a4bc1>] ? ip_local_deliver_finish+0x41/0x3a0
     [<ffffffff816a5160>] ip_local_deliver+0x60/0xd0
     [<ffffffff816a4b80>] ? ip_rcv_finish+0x560/0x560
     [<ffffffff816a46fd>] ip_rcv_finish+0xdd/0x560
     [<ffffffff816a5453>] ip_rcv+0x283/0x3e0
     [<ffffffff810b6302>] ? match_held_lock+0x192/0x200
     [<ffffffff816a4620>] ? inet_del_offload+0x40/0x40
     [<ffffffff8165d062>] __netif_receive_skb_core+0x392/0xae0
     [<ffffffff8165e68e>] ? process_backlog+0x8e/0x230
     [<ffffffff810b53f1>] ? mark_held_locks+0x71/0x90
     [<ffffffff8165d7c8>] __netif_receive_skb+0x18/0x60
     [<ffffffff8165e678>] process_backlog+0x78/0x230
     [<ffffffff8165e6dd>] ? process_backlog+0xdd/0x230
     [<ffffffff8165e355>] net_rx_action+0x155/0x400
     [<ffffffff8106b48c>] __do_softirq+0xcc/0x420
     [<ffffffff816a8e87>] ? ip_finish_output2+0x217/0x590
     [<ffffffff8178e78c>] do_softirq_own_stack+0x1c/0x30
     <EOI>
     [<ffffffff8106b88e>] do_softirq+0x4e/0x60
     [<ffffffff8106b948>] __local_bh_enable_ip+0xa8/0xb0
     [<ffffffff816a8eb0>] ip_finish_output2+0x240/0x590
     [<ffffffff816a9a31>] ? ip_do_fragment+0x831/0x8a0
     [<ffffffff816a9a31>] ip_do_fragment+0x831/0x8a0
     [<ffffffff816a8c70>] ? ip_copy_metadata+0x1b0/0x1b0
     [<ffffffff816a9ae3>] ip_fragment.constprop.49+0x43/0x80
     [<ffffffff816a9c9c>] ip_finish_output+0x17c/0x340
     [<ffffffff8169a6f4>] ? nf_hook_slow+0xe4/0x190
     [<ffffffff816ab4c0>] ip_output+0x70/0x110
     [<ffffffff816a9b20>] ? ip_fragment.constprop.49+0x80/0x80
     [<ffffffff816aa9f9>] ip_local_out+0x39/0x70
     [<ffffffff816abf89>] ip_send_skb+0x19/0x40
     [<ffffffff816abfe3>] ip_push_pending_frames+0x33/0x40
     [<ffffffff816d55d3>] raw_sendmsg+0x7d3/0xc30
     [<ffffffff810b732b>] ? __lock_acquire+0x3db/0x1b90
     [<ffffffff816e7557>] ? inet_sendmsg+0xc7/0x1d0
     [<ffffffff810b63c4>] ? __lock_is_held+0x54/0x70
     [<ffffffff816e759a>] inet_sendmsg+0x10a/0x1d0
     [<ffffffff816e7495>] ? inet_sendmsg+0x5/0x1d0
     [<ffffffff8163e398>] sock_sendmsg+0x38/0x50
     [<ffffffff8163ec5f>] ___sys_sendmsg+0x25f/0x270
     [<ffffffff811aadad>] ? handle_mm_fault+0x8dd/0x1320
     [<ffffffff8178c147>] ? _raw_spin_unlock+0x27/0x40
     [<ffffffff810529b2>] ? __do_page_fault+0x1e2/0x460
     [<ffffffff81204886>] ? __fget_light+0x66/0x90
     [<ffffffff8163f8e2>] __sys_sendmsg+0x42/0x80
     [<ffffffff8163f932>] SyS_sendmsg+0x12/0x20
     [<ffffffff8178cb17>] entry_SYSCALL_64_fastpath+0x12/0x6f
    Code: 00 00 44 89 e0 e9 7c fb ff ff 4c 89 ff e8 e7 e7 ff ff 41 8b 9d 80 00 00 00 2b 5d d4 89 d8 c1 f8 03 0f b7 c0 e9 33 ff ff f
     66 66 66 2e 0f 1f 84 00 00 00 00 00 66 66 66 66 90 55 48
    RIP  [<ffffffff816a9a92>] ip_do_fragment+0x892/0x8a0
     RSP <ffff88006d603170>

    Fixes: 7f8a436eaa2c ("openvswitch: Add conntrack action")
Signed-off-by: Joe Stringer <joe@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: 8282f27449bf ("inet: frag: Always orphan skbs inside ip_defrag()")
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agoMAINTAINERS: convert to .md format.
Russell Bryant [Fri, 29 Jan 2016 21:32:36 +0000 (16:32 -0500)]
MAINTAINERS: convert to .md format.

Most other doc files are in markdown format, so convert this one as
well.  Instead of linking to the web site, just use relative links
to the policy documents in the tree.

This patch also gives me a chance to hide a fix for my failure to
accurately sort names in alphabetical order.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
8 years agorhel: Clarify instructions for RHEL 7.
Russell Bryant [Thu, 28 Jan 2016 16:42:27 +0000 (11:42 -0500)]
rhel: Clarify instructions for RHEL 7.

The rpm build instructions did not clarify what spec files were to be
used for RHEL 7 and its derivatives.  Clarify that you're actually
supposed to use the spec files called "fedora" for RHEL 7 right now.

Update references to Fedora versions to reflect the current release
(23), as neither 16 or 17 are supported releases anymore.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Gurucharan Shetty <guru@ovn.org>
8 years agoDocumentation: Change committer files to ".md" format.
Justin Pettit [Fri, 29 Jan 2016 08:31:41 +0000 (00:31 -0800)]
Documentation: Change committer files to ".md" format.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agoDocumentation: Clarify committer documentation.
Justin Pettit [Fri, 29 Jan 2016 09:07:39 +0000 (01:07 -0800)]
Documentation: Clarify committer documentation.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agoDocumentation: Add information about committer policies.
Justin Pettit [Fri, 29 Jan 2016 08:09:27 +0000 (00:09 -0800)]
Documentation: Add information about committer policies.

These files were only available on the openvswitch.org mailing list.
Move them to the source tree so that they're more visible.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agorhel: Make openvswitch-kmod-fedora.spec build.
Russell Bryant [Thu, 28 Jan 2016 20:23:00 +0000 (15:23 -0500)]
rhel: Make openvswitch-kmod-fedora.spec build.

I tried building this package on Fedora 23 and it failed for a couple of
different reasons.

This package tried to install modules without specifying the rpm build
root as an install prefix.  The result was just attempting to install
the modules on the system, which luckily failed since I wasn't running
rpmbuild as root.

The package also then tried to manually install the modules into the rpm
build root, which is unnecessary once modules_install is pointed to the
right place.

Finally, the package build failed with a completely unhelpful error
which turned out to be because it didn't know how to generate
a debuginfo pacakge.  I turned off the debug package for now.  At least
it builds now, which is an improvement.

Signed-off-by: Russell Bryant <russell@ovn.org>
Suggested-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Gurucharan Shetty <guru@ovn.org>
8 years agodatapath: Fix IPv6 fragment expiry crash.
Joe Stringer [Wed, 27 Jan 2016 00:49:36 +0000 (00:49 +0000)]
datapath: Fix IPv6 fragment expiry crash.

Prior to a series of commits in 3.17 like the following, the model
used to manage and expire fragments was different. We already backport
several of these functions (See datapath/compat/inet_fragment.c) to do
things like allocate/evict/destroy frags and frag queues. In the IPv4
code, we use these. In most of the IPv6 cases, we already reuse these
also. However, for timed frag expiration we instead call the upstream
version of the function, which proceeds to use the upstream versions
of the functions we backport in inet_fragment.c. There can be some
discrepancy between the offsets used in these upstream versions vs. the
backport versions, so if you mix/match them then it leads to invalid
dereferences.

b13d3cbfb8e8 ("inet: frag: move eviction of queues to work queue")
ab1c724f6330 ("inet: frag: use seqlock for hash rebuild")

Fixes the following kernel oops on kernels < 3.17 when IPv6 fragments
are expired without reassembling the frame.

BUG: unable to handle kernel paging request at 00000006845d69a8
IP: [<ffffffff8172c09e>] _raw_spin_lock+0xe/0x50
...
Call Trace:
 <IRQ>
 [<ffffffff816a32d3>] inet_frag_kill+0x63/0x100
 [<ffffffff816ead93>] ip6_expire_frag_queue+0x63/0x110
 [<ffffffffa01130e6>] nf_ct_frag6_expire+0x26/0x30 [openvswitch]
 [<ffffffff810744f6>] call_timer_fn+0x36/0x100
 [<ffffffffa01130c0>] ? nf_ct_net_init+0x20/0x20 [openvswitch]
 [<ffffffff8107548f>] run_timer_softirq+0x1ef/0x2f0
 [<ffffffff8106cccc>] __do_softirq+0xec/0x2c0
 [<ffffffff8106d215>] irq_exit+0x105/0x110
 [<ffffffff81737095>] smp_apic_timer_interrupt+0x45/0x60
 [<ffffffff81735a1d>] apic_timer_interrupt+0x6d/0x80
 <EOI>
 [<ffffffff8104f596>] ? native_safe_halt+0x6/0x10
 [<ffffffff8101cb2f>] default_idle+0x1f/0xc0
 [<ffffffff8101d406>] arch_cpu_idle+0x26/0x30
 [<ffffffff810bf3a5>] cpu_startup_entry+0xc5/0x290
 [<ffffffff817122e7>] rest_init+0x77/0x80
 [<ffffffff81d34f70>] start_kernel+0x438/0x443

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agoovn: Remove top ovn directory from PATHs.
Ilya Maximets [Fri, 29 Jan 2016 09:20:13 +0000 (12:20 +0300)]
ovn: Remove top ovn directory from PATHs.

Since 5b5c922b0ca6 ("ovn-nbctl: Move ovn-nbctl to utilities directory.")
there is no more executables in top ovn directory.

Removing of this directory from PATHs helps to avoid problems when
old executable ./ovn/ovn-nbctl used instead of ./ovn/utilities/ovn-nbctl.

This may happen if source directory was updated to commit 5b5c922b0ca6
without calling 'make clean'.

Fixes: 5b5c922b0ca6 ("ovn-nbctl: Move ovn-nbctl to utilities directory.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
8 years agoMAINTAINERS: Add Simon Horman.
Justin Pettit [Fri, 29 Jan 2016 10:16:01 +0000 (02:16 -0800)]
MAINTAINERS: Add Simon Horman.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>