sliver-openvswitch.git
10 years agorhel, xenserver: Create /var/log/openvswitch directory.
Gurucharan Shetty [Sat, 13 Jul 2013 03:52:51 +0000 (20:52 -0700)]
rhel, xenserver: Create /var/log/openvswitch directory.

During installation create the /var/log/openvswitch directory
so that openvswitch startup script is able to write the ovs-ctl.log

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Zero-out subfacet counters when installation fails.
Justin Pettit [Fri, 12 Jul 2013 23:56:55 +0000 (16:56 -0700)]
ofproto-dpif: Zero-out subfacet counters when installation fails.

When deleting subfacets, subfacet_uninstall() asserts that the
subfacet's counters are zero to make sure we don't lose counters.  We
have seen cases where a subfacet cannot be installed, but the counters
have values.  This should not happen and indicates a bug, since we
shouldn't create a subfacet if the datapath has a flow.  A buggy
datapath could trigger this, so just zero out the counters and log an
error.

Bug #18460.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
10 years agoworker: Delete library.
Ben Pfaff [Thu, 25 Apr 2013 22:03:27 +0000 (15:03 -0700)]
worker: Delete library.

It had no remaining users.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agosystem-stats: Remove worker process support.
Ben Pfaff [Thu, 25 Apr 2013 22:02:16 +0000 (15:02 -0700)]
system-stats: Remove worker process support.

The worker process implementation isn't thread-safe and, once OVS
itself is threaded, it doesn't make much sense to have a worker
process anyway.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agovlog: Remove unused function vlog_exit().
Ben Pfaff [Wed, 10 Jul 2013 21:46:41 +0000 (14:46 -0700)]
vlog: Remove unused function vlog_exit().

This is harder to implement once threads are introduced.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ed Maste <emaste@freebsd.org>
10 years agovlog: Remove unused function vlog_get_log_file().
Ben Pfaff [Wed, 10 Jul 2013 21:06:15 +0000 (14:06 -0700)]
vlog: Remove unused function vlog_get_log_file().

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ed Maste <emaste@freebsd.org>
10 years agovlog: Make vlog_should_drop() thread-safe.
Ben Pfaff [Tue, 9 Apr 2013 18:18:01 +0000 (11:18 -0700)]
vlog: Make vlog_should_drop() thread-safe.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ed Maste <emaste@freebsd.org>
10 years agoutil: Make subprogram_name thread-specific.
Ben Pfaff [Fri, 12 Jul 2013 21:18:01 +0000 (14:18 -0700)]
util: Make subprogram_name thread-specific.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotimeval: Make CPU usage and wakeup tracking per-thread.
Ben Pfaff [Tue, 25 Jun 2013 20:56:40 +0000 (13:56 -0700)]
timeval: Make CPU usage and wakeup tracking per-thread.

This should make the "timeval" module thread-safe, except for its
calls into vlog (because vlog is not yet thread-safe).

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ed Maste <emaste@freebsd.org>
10 years agotimeval: Make reading the current time thread-safe.
Ben Pfaff [Wed, 10 Jul 2013 17:10:35 +0000 (10:10 -0700)]
timeval: Make reading the current time thread-safe.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ed Maste <emaste@freebsd.org>
10 years agodatapath: Use kernel eth_mac_addr() on old kernels.
Jesse Gross [Fri, 12 Jul 2013 17:02:15 +0000 (10:02 -0700)]
datapath: Use kernel eth_mac_addr() on old kernels.

The OVS MAC address set function was removed in favor of the version
in the kernel but the function pointer for older kernels was not
updated.

Reported-by: Cali Ente <calientepermanente@gmail.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
10 years agotests: Add ofproto-dpif push_vlan test
Joe Stringer [Fri, 12 Jul 2013 07:58:13 +0000 (16:58 +0900)]
tests: Add ofproto-dpif push_vlan test

Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agovlog: Remove support for worker process.
Ben Pfaff [Fri, 12 Jul 2013 00:10:11 +0000 (17:10 -0700)]
vlog: Remove support for worker process.

The worker process implementation isn't thread-safe and, once OVS
itself is threaded, it doesn't make much sense to have a worker
process anyway.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ed Maste <emaste@freebsd.org>
10 years agopoll-loop: Fix typo in comment.
Ben Pfaff [Wed, 10 Jul 2013 17:54:52 +0000 (10:54 -0700)]
poll-loop: Fix typo in comment.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ed Maste <emaste@freebsd.org>
10 years agotimeval: Fix typo in comment.
Ben Pfaff [Thu, 9 May 2013 19:39:16 +0000 (12:39 -0700)]
timeval: Fix typo in comment.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ed Maste <emaste@freebsd.org>
10 years agotimeval: Remove backtrace feature.
Ben Pfaff [Fri, 12 Jul 2013 00:02:12 +0000 (17:02 -0700)]
timeval: Remove backtrace feature.

The backtrace feature of timeval is useful because it provides a "poor
man's profile" view of Open vSwitch.  But it is not likely to be useful in
a multithreaded process, because signal delivery doesn't necessarily follow
the profile when there is more than one thread.  (A signal in a
multithreaded process are delivered to an arbitrary thread.)

Another problem with the backtrace feature is that it is difficult for
format_backtraces() to synchronize properly with the signal handler in a
multithreaded process.  In a single-threaded process, it can just block
the signal handler, but in a multithreaded process this does not prevent
signal delivery to threads other than the one running format_backtrace().

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ed Maste <emaste@freebsd.org>
10 years agotimeval: New function xclock_gettime().
Ben Pfaff [Thu, 11 Jul 2013 23:50:15 +0000 (16:50 -0700)]
timeval: New function xclock_gettime().

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ed Maste <emaste@freebsd.org>
10 years agofatal-signal: Remove write-only variable fatal_signal_set.
Ben Pfaff [Thu, 11 Jul 2013 23:40:01 +0000 (16:40 -0700)]
fatal-signal: Remove write-only variable fatal_signal_set.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ed Maste <emaste@freebsd.org>
10 years agoFAQ: Add supported kernel versions for newer OVS releases.
Jesse Gross [Tue, 9 Jul 2013 21:11:12 +0000 (14:11 -0700)]
FAQ: Add supported kernel versions for newer OVS releases.

Reported-by: Kris zhang <zhang.kris@gmail.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
10 years agoovs-ctl.in: Increase the limit on file descriptors.
Gurucharan Shetty [Thu, 11 Jul 2013 16:10:41 +0000 (09:10 -0700)]
ovs-ctl.in: Increase the limit on file descriptors.

Testing shows that creation of 5000 internal ports and using it
to do some meaningful tasks works fine on a 12 cpu hardware.
Since a single port needs one file descriptor and a bridge
needs 3 file descriptors, we will have to increase the file
descriptor limit to a higher number from the current limit of 5000.
7500 feels like a decent increase with enough room for further
scale testing.

Bug #18383.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-vswitchd: Correct the documentation on the limits for bridges and ports.
Gurucharan Shetty [Thu, 11 Jul 2013 16:08:15 +0000 (09:08 -0700)]
ovs-vswitchd: Correct the documentation on the limits for bridges and ports.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agodpif-netdev: Make "packet-out" with in_port=OFPP_CONTROLLER work again.
Ben Pfaff [Tue, 9 Jul 2013 16:23:02 +0000 (09:23 -0700)]
dpif-netdev: Make "packet-out" with in_port=OFPP_CONTROLLER work again.

Commit 4e022ec09e14 (Create specific types for ofp and odp port) broke
OpenFlow OFPP_PACKET_OUT requests that use in_port=OFPP_CONTROLLER.  This
commit fixes the problem and adds a regression test.

CC: Alex Wang <alexw@nicira.com>
Reported-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agovswitchd: Fix typo in the BFD section of vswitch.xml
Min Chen [Thu, 11 Jul 2013 05:21:52 +0000 (22:21 -0700)]
vswitchd: Fix typo in the BFD section of vswitch.xml

Signed-off-by: Min Chen <minchnew@gmail.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
10 years agoatomic: Suppress sparse warning.
Ethan Jackson [Tue, 9 Jul 2013 22:27:12 +0000 (15:27 -0700)]
atomic: Suppress sparse warning.

With the latest version of sparse, the ATOMIC_VAR_INIT macro
generates the following warning.  This patch suppresses it.

warning: Using plain integer as NULL pointer

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-bugtool: Add ovsdb-server/list-dbs command to bugtool.
Gurucharan Shetty [Wed, 10 Jul 2013 16:42:37 +0000 (09:42 -0700)]
ovs-bugtool: Add ovsdb-server/list-dbs command to bugtool.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodatpath: Fix tunnel TTL flow rejection message.
Jesse Gross [Tue, 9 Jul 2013 23:59:56 +0000 (16:59 -0700)]
datpath: Fix tunnel TTL flow rejection message.

There is no default value for the tunnel TTL, so it must be
specified when setting up a new flow. However, the flow rejection
log message indicates that the TTL must be non-zero, which is not
true.

CC: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Always include tunnel TTL in serialized Netlink attributes.
Jesse Gross [Tue, 9 Jul 2013 23:47:01 +0000 (16:47 -0700)]
datapath: Always include tunnel TTL in serialized Netlink attributes.

There is no default value for the tunnel TTL so it must always be
included in flow keys sent from userspace to kernel. The kernel
should also respect this convertion when sending flows to userspace
by always including the TTL in tunnel flows.

CC: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: fix bugs in exporting netlink attributes
Andy Zhou [Tue, 9 Jul 2013 07:25:00 +0000 (00:25 -0700)]
datapath: fix bugs in exporting netlink attributes

Reported-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Fix Netlink error message header.
Jesse Gross [Tue, 9 Jul 2013 21:43:47 +0000 (14:43 -0700)]
datapath: Fix Netlink error message header.

CC: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Use DP_MAX_PORTS when no IN_PORT attribute is present.
Jesse Gross [Tue, 9 Jul 2013 21:21:26 +0000 (14:21 -0700)]
datapath: Use DP_MAX_PORTS when no IN_PORT attribute is present.

To indicate that a flow is not associated with any particular in port,
userspace may omit the IN_PORT attribute, which the kernel translates
internally to the special value DP_MAX_PORTS. After the megaflows
changes, this was no longer being done, resulting in it using port 0
(the internal port).

This also adopts a wildcarding scheme similar to 802.2 packets where
a mask can be specified for this non-existent key attribute but it
must either be completely wildcarded or completely exact match.

CC: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoovs-vsctl: Fix behavioral regression for "--if-exists del-port <bridge>".
Ben Pfaff [Mon, 8 Jul 2013 17:47:37 +0000 (10:47 -0700)]
ovs-vsctl: Fix behavioral regression for "--if-exists del-port <bridge>".

Commit 89f3c258fe (ovs-vsctl: Improve error message for "ovs-vsctl del-port
<bridge>".) changed the behavior of
    ovs-vsctl --if-exists del-port <bridge>
from a silent no-op to a hard failure.  This commit fixes this regression.

This caused problems on XenServer, for which the Open vSwitch integration
runs commands like:
    /usr/bin/ovs-vsctl --timeout=20 \
        -- --with-iface --if-exists del-port xapi103 \
        -- --if-exists del-br xapi103

Bug #18276.
Reported-by: Michael Hu <mhu@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agocsum: Suppress sparse warning.
Ethan Jackson [Tue, 9 Jul 2013 17:13:35 +0000 (10:13 -0700)]
csum: Suppress sparse warning.

The latest version of sparse triggers the following warning in the
checksum tests.  This patch suppresses it.

warning: too long initializer-string for array of char

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoutilities: New helper script ovs-dev.py.
Ethan Jackson [Sun, 7 Jul 2013 01:55:45 +0000 (18:55 -0700)]
utilities: New helper script ovs-dev.py.

ovs-dev.py is a script I've written to help perform common tasks
necessary for developing Open vSwitch.  It allows a developer to
configure, build, and run the switch with a minimum of effort or
knowledge of the various idiosyncrasies involved.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agodatapath: rhel: Move RHEL OVS hook registration to netdev_rx_handler_register() backport
Thomas Graf [Tue, 9 Jul 2013 18:36:57 +0000 (20:36 +0200)]
datapath: rhel: Move RHEL OVS hook registration to netdev_rx_handler_register() backport

Moves the registration of the RHEL specific OVS hook to the compat
backport of netdev_rx_handler_register(). This moves the hook
unregistration from the RCU callback to the netdev_destroy()
callback directly.

This is purely cosmetic though, the RHEL hook is only used if the
IFF_OVS_DATAPATH flag is present which was removed under RTNL
protection before the RCU callback.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: rhel: Account for RHEL specific backports
Thomas Graf [Tue, 9 Jul 2013 16:00:26 +0000 (18:00 +0200)]
datapath: rhel: Account for RHEL specific backports

The following symbols have been backported to RHEL and the kernel
version is no longer an accurate indicator for their presence:

 - skb_gso_segment
 - netif_skb_features
 - netif_needs_gso

Signed-off-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Rename skb_network_protocol() to __skb_network_protocol()
Thomas Graf [Tue, 9 Jul 2013 16:00:25 +0000 (18:00 +0200)]
datapath: Rename skb_network_protocol() to __skb_network_protocol()

The function skb_network_protocol() is already defined in
<linux/netdevice.h> upstream but not an exported symbol.

Rename the OVS internal implementation to work around this.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agotests: Additional test for run time addition of a database.
Gurucharan Shetty [Mon, 8 Jul 2013 22:27:27 +0000 (15:27 -0700)]
tests: Additional test for run time addition of a database.

Adding a removed database covers a common use case.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agoofproto-dpif: Remove pointers between rules and facets.
Ethan Jackson [Thu, 2 May 2013 22:22:19 +0000 (15:22 -0700)]
ofproto-dpif: Remove pointers between rules and facets.

Before this patch, facets maintained a pointer to the first rule
used when translating their actions, and rules maintained a pointer
to those facets.  This made sense before the resubmit actions which
each facet used precisely one rule.  However, today a facet may
require many rules to translate, and therefore it makes no
conceptual sense to designate one as the "owning rule".

Furthermore, as Open vSwitch becomes multithreaded, maintaining a
facet's rule pointer will become more difficult.  One thread will
do the action translation, while another will maintain the facets.
During the hand-off between these threads, it's possible the
"owning rule" will expire leaving us with a stale pointer.

This patch does have a disadvantage,  Pushing a facet's statistics
will become slightly less efficient as it will involve an
additional classifier lookup.  We can revisit this issue once
multithreading is complete, but I suspect there's much lower
hanging fruit to worry about.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif: Modularize ofproto-dpif-xlate.
Ethan Jackson [Fri, 14 Jun 2013 01:38:24 +0000 (18:38 -0700)]
ofproto-dpif: Modularize ofproto-dpif-xlate.

This patch modularizes ofproto-dpif-xlate by disentangling it from
ofproto-dpif.  Instead of poking around in ofproto-dpif's internal
data structures, ofproto-dpif-xlate is updated with a simple API
which can easily be made thread safe.  There are still some places
where ofproto-dpif-xlate needs to call into ofproto-dpif, but this
patch makes significant progress towards the final goal.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-xlate: Actually drop packets on mirror ports.
Ethan Jackson [Sun, 7 Jul 2013 10:52:16 +0000 (03:52 -0700)]
ofproto-dpif-xlate: Actually drop packets on mirror ports.

Reported-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Free meters in ofproto_destroy__().
Jarno Rajahalme [Mon, 1 Jul 2013 13:30:52 +0000 (16:30 +0300)]
ofproto: Free meters in ofproto_destroy__().

Ben noticed that I had forgot to free meters when ofproto is freed.
This should do it.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoAdd basic OpenFlow 1.1 protocol support.
Ben Pfaff [Mon, 8 Jul 2013 21:48:05 +0000 (14:48 -0700)]
Add basic OpenFlow 1.1 protocol support.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests: Add tests for mod flows with cookie miss on OF1.2.
Ben Pfaff [Wed, 17 Apr 2013 20:30:17 +0000 (13:30 -0700)]
tests: Add tests for mod flows with cookie miss on OF1.2.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-util: Add 'modify_cookie' to struct ofputil_flow_mod, to support OF1.1.
Ben Pfaff [Wed, 17 Apr 2013 20:02:15 +0000 (13:02 -0700)]
ofp-util: Add 'modify_cookie' to struct ofputil_flow_mod, to support OF1.1.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoDESIGN: Update flow_mod section to describe OpenFlow 1.1+ behavior.
Ben Pfaff [Wed, 17 Apr 2013 16:59:08 +0000 (09:59 -0700)]
DESIGN: Update flow_mod section to describe OpenFlow 1.1+ behavior.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Make netlink error messages more consistent.
Jesse Gross [Mon, 8 Jul 2013 21:51:27 +0000 (14:51 -0700)]
datapath: Make netlink error messages more consistent.

Suggested-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoofproto-dpif: Modularize mirror code.
Ethan Jackson [Thu, 20 Jun 2013 20:00:27 +0000 (13:00 -0700)]
ofproto-dpif: Modularize mirror code.

This code modularizes ofproto-dpif's mirror code by moving it to
ofproto-dpif-mirror.  Not only does this shorten ofproto-dpif and
hide complexity, but its also necessary for future patches which
modularize ofproto-dpif-xlate in preparation for multi-threading.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Handle dest mirrors in compose_output_action().
Ethan Jackson [Thu, 20 Jun 2013 01:51:28 +0000 (18:51 -0700)]
ofproto-dpif: Handle dest mirrors in compose_output_action().

Before this patch, the mirroring code would retroactively insert
actions for destination mirrors after actions were translated.
This relied on converting datapath output actions into ofports
which doesn't work for tunnels and patch ports.  This patch
refactors the code to handle destination mirrors at output.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agolacp: Handle unknown slaves in lacp_process_packet().
Ethan Jackson [Wed, 19 Jun 2013 21:40:21 +0000 (14:40 -0700)]
lacp: Handle unknown slaves in lacp_process_packet().

In future patches, ofproto-dpif-xlate may be temporarily out of
sync with ofproto-dpif proper, and pass an unknown ofport to
lacp_process_packet().  This patch handles that edge case
gracefully.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoDESIGN: Fix typo in "VLAN Matching" section.
Ben Pfaff [Fri, 3 May 2013 22:27:55 +0000 (15:27 -0700)]
DESIGN: Fix typo in "VLAN Matching" section.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobitmap: Fix bitmap_allocate1() bug when n_bits is a multiple of 32.
ZhengLingyun [Mon, 8 Jul 2013 21:10:26 +0000 (14:10 -0700)]
bitmap: Fix bitmap_allocate1() bug when n_bits is a multiple of 32.

In function bitmap_allocate1(), the last "unsigned long" in bitmap was
set to all 0-bits when (n_bits % BITMAP_ULONG_BITS == 0).  This commit
correctly sets it to all 1-bits.

Signed-off-by: ZhengLingyun <konghuarukhr@163.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobridge: Add ifindex column to Interface table.
Neil McKee [Mon, 8 Jul 2013 20:36:06 +0000 (13:36 -0700)]
bridge: Add ifindex column to Interface table.

This commit adds an "ifindex" column to the "Interface" table in the db.

Signed-off-by: Neil McKee <neil.mckee@inmon.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoBFD: Add forwarding_override command for BFD.
Pavithra Ramesh [Sat, 29 Jun 2013 10:09:02 +0000 (10:09 +0000)]
BFD: Add forwarding_override command for BFD.

Added appctl commands to override the bfd forwarding status. Values
of true/false/normal are allowed. When set to normal, the bfd
forwarding status is left unchanged. Else, the forwarding status is
set to the specified value - true/false.

Signed-off-by: Pavithra Ramesh <paramesh@vmware.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofp-parse: Do not exit() upon a parse error.
Ben Pfaff [Mon, 8 Jul 2013 17:15:00 +0000 (10:15 -0700)]
ofp-parse: Do not exit() upon a parse error.

Until now, failure to parse a flow in the ofp-parse module has caused the
program to abort immediately with a fatal error.  This makes it hard to
use these functions from any long-lived program.  This commit fixes the
problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests: Add test-atomic to .gitignore.
Ethan Jackson [Thu, 4 Jul 2013 09:15:00 +0000 (02:15 -0700)]
tests: Add test-atomic to .gitignore.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agodatapath: add netlink error message to help kernel userspace integration.
Andy Zhou [Wed, 3 Jul 2013 16:18:27 +0000 (09:18 -0700)]
datapath: add netlink error message to help kernel userspace integration.

When kernel rejects a netlink message, it usually returns EINVAL
error code to the userspace. The actual reason for rejecting the
netlinke message is not available, making it harder to debug netlink
issues.  This patch adds kernel log messages whenever a netlink message
is rejected with reasons. Those messages are logged at the info level.

Those messages are logged only once per message, to keep kernel log noise
level down. Reload the kernel module to re-enable already logged
messages.

The messages are meant to help developers to debug userspace and kernel
intergration issues. The actual message may change or be removed over time.
These messages are not expected to show up in a production environment.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Use RCU lock for flow dump operation.
Pravin B Shelar [Tue, 2 Jul 2013 22:44:51 +0000 (15:44 -0700)]
datapath: Use RCU lock for flow dump operation.

Flow dump operation is read-only operation.  There is no need to
take ovs-lock.  Following patch use rcu-lock for dumping flows.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Fix version check in compat gre.h
Jarno Rajahalme [Fri, 28 Jun 2013 09:22:33 +0000 (12:22 +0300)]
datapath: Fix version check in compat gre.h

Taken the version checks in datapath/linux/compat/gre.c this seems correct.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
10 years agoodp-util: Clearly indicate VID mask is printed in hex.
Justin Pettit [Mon, 1 Jul 2013 18:03:23 +0000 (11:03 -0700)]
odp-util: Clearly indicate VID mask is printed in hex.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agoodp-util: Always encode mask of 0xffff for dl_type < ETH_TYPE_MIN.
Justin Pettit [Mon, 1 Jul 2013 17:43:18 +0000 (10:43 -0700)]
odp-util: Always encode mask of 0xffff for dl_type < ETH_TYPE_MIN.

For non-Ethernet II packets, we don't set an EtherType netlink attribute
and set the Ethertype mask attribute to 0xffff.  The code was encoding
whatever mask was passed in, which could lead to bugs if the caller
didn't know the userspace-kernel interface.

Found by inspection.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agodatapath: Fix tunnel source port selection for mega flow
Andy Zhou [Tue, 2 Jul 2013 22:58:19 +0000 (15:58 -0700)]
datapath: Fix tunnel source port selection for mega flow

Tunnel source port selection was based on hash value cached in the
flow. This no longer works with mega flow, since all flows matching
a mega flow will be transmitted with the same tunnel source port.

This patch computes the tunnel source port at run time based on each
incoming packet. Packets belong to the same micro flow would still get
the same source port, but multiple micro flows hitting the same mega flow
can get different source ports.

Packets injected from the usespace will be assigned to the same
source port as if they are forwarded in the kernel.

Bug #18216

Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agonetdev-bsd: Fix a build error.
YAMAMOTO Takashi [Tue, 2 Jul 2013 02:04:02 +0000 (11:04 +0900)]
netdev-bsd: Fix a build error.

fix a typo in the following commit.

> commit 10a89ef04df5669c5cdd02f786150a7ab8454e01
> Author: Ben Pfaff <blp@nicira.com>
> Date:   Mon Jun 24 10:54:49 2013 -0700
>
>     Replace all uses of strerror() by ovs_strerror(), for thread safety.
>
>     Signed-off-by: Ben Pfaff <blp@nicira.com>

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
10 years agotest-atomic: Drop atomic read-modify-write tests for the moment.
Ben Pfaff [Sat, 29 Jun 2013 15:18:54 +0000 (08:18 -0700)]
test-atomic: Drop atomic read-modify-write tests for the moment.

XenServer builds are failing because of link errors reporting that
__sync_fetch_and_<op>_<size> were not found, for <op> in add/sub/and/xor/or
and <size> in 1/2/4/8.  We're not actually using these RMW operations yet,
so as a stopgap measure just drop the tests.

The correct long-term fix is probably to do Autoconf linkage tests for
these operations instead of just testing the GCC version (if we really need
the operations at all).

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoOPENFLOW-1.1+: Remove items that I've verified to be implemented already.
Ben Pfaff [Wed, 17 Apr 2013 16:59:25 +0000 (09:59 -0700)]
OPENFLOW-1.1+: Remove items that I've verified to be implemented already.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests: Fix typo in test name.
Ben Pfaff [Fri, 15 Feb 2013 05:59:42 +0000 (21:59 -0800)]
tests: Fix typo in test name.

Other test names use a space here, so this one should also.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agovconn: Fix formatting of user message.
Ben Pfaff [Wed, 17 Apr 2013 17:51:52 +0000 (10:51 -0700)]
vconn: Fix formatting of user message.

This corrects "version 0x03and earlier" to "version 0x03 and earlier".

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Add ability to disable megaflows.
Justin Pettit [Sat, 29 Jun 2013 00:13:50 +0000 (17:13 -0700)]
ofproto-dpif: Add ability to disable megaflows.

Add new "dpif/disable-megaflows" and "dpif/enable-megaflows" commands to
ovs-appctl to disable and enable megaflows, respectively.  By default,
megaflows are enabled, and these commands should only be used for
debugging.

Feature #18265.

Requested-by: Ronghua Zhang <rzhang@vmware.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoflow: Don't assume non-IPv4 is IPv6 for un-wildcarding.
Justin Pettit [Fri, 28 Jun 2013 18:31:48 +0000 (11:31 -0700)]
flow: Don't assume non-IPv4 is IPv6 for un-wildcarding.

When determinining what fields to un-wildcard for the symmetric L4 hash,
don't include the IPv6 address fields if the packet isn't IPv6.

Reported-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoMakefile: Blacklist functions that threaded programs cannot use safely.
Ben Pfaff [Fri, 5 Apr 2013 13:58:57 +0000 (08:58 -0500)]
Makefile: Blacklist functions that threaded programs cannot use safely.

Some functions that POSIX says cannot be used safely in multithreaded
programs are not on the initial blacklist:

    - getenv() should be safe in real implementations in the absence of
      changes to the environment.  (putenv() and setenv() are blacklisted.)

    - We only use getopt() before spawning extra threads, and I expect this
      to continue to be true.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoUse random_*() instead of rand(), for thread safety.
Ben Pfaff [Tue, 25 Jun 2013 16:22:11 +0000 (09:22 -0700)]
Use random_*() instead of rand(), for thread safety.

None of these test programs are threaded, but has little cost and means
that "grep" doesn't turn up any instances of these thread-unsafe functions
in our tree.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agorandom: Make thread-safe.
Ben Pfaff [Tue, 25 Jun 2013 20:53:36 +0000 (13:53 -0700)]
random: Make thread-safe.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoReplace all uses of strerror() by ovs_strerror(), for thread safety.
Ben Pfaff [Mon, 24 Jun 2013 17:54:49 +0000 (10:54 -0700)]
Replace all uses of strerror() by ovs_strerror(), for thread safety.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoNew function ovs_strerror() as a thread-safe replacement for strerror().
Ben Pfaff [Wed, 19 Jun 2013 22:44:54 +0000 (15:44 -0700)]
New function ovs_strerror() as a thread-safe replacement for strerror().

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-thread: Add support for various thread-related assertions.
Ben Pfaff [Wed, 19 Jun 2013 20:07:35 +0000 (13:07 -0700)]
ovs-thread: Add support for various thread-related assertions.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoovs-thread: Add support for convenient once-only initializers.
Ben Pfaff [Wed, 19 Jun 2013 18:21:47 +0000 (11:21 -0700)]
ovs-thread: Add support for convenient once-only initializers.

pthread_once() is portable but it does not allow passing any parameters to
the initialization function, which is often inconvenient, because it means
that the function can only access data declared at file scope.  This commit
introduces an alternative with a more convenient interface.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoovs-atomic: New library for atomic operations.
Ben Pfaff [Fri, 28 Jun 2013 22:54:40 +0000 (15:54 -0700)]
ovs-atomic: New library for atomic operations.

This library should prove useful for the threading changes coming up.
The following commit introduces one (very simple) user.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agotunnel: Hide 'struct tnl_port' internally.
Ethan Jackson [Tue, 18 Jun 2013 22:24:33 +0000 (15:24 -0700)]
tunnel: Hide 'struct tnl_port' internally.

This simplifies the tunnel module's interface and prevents us from
having to sync 'struct tnl_port' once ofproto-dpif and
ofproto-dpif-xlate are disentangled.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agotunnel: Use ofport_dpif instead of ofport.
Ethan Jackson [Tue, 18 Jun 2013 21:40:30 +0000 (14:40 -0700)]
tunnel: Use ofport_dpif instead of ofport.

Necessary in a future patch.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-appctl: allow ofproto/trace to take mega flow input
Andy Zhou [Fri, 28 Jun 2013 22:20:49 +0000 (15:20 -0700)]
ovs-appctl: allow ofproto/trace to take mega flow input

ofproto/trace command was not updated to take mega flow input, which made
it hard to use by cutting and pasting output from "ovs-dpctl dump-flows".

(The mask is not actually used for tracing.)

Bug #18267.
Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Resolve external module dependencies.
Jesse Gross [Tue, 25 Jun 2013 19:27:13 +0000 (12:27 -0700)]
datapath: Resolve external module dependencies.

The Open vSwitch kernel module now has dependencies on symbols
exported by other kernel modules (currently just for GRE). In
order for it to load, the dependencies must be correctly resolved
ahead of time. This runs depmod as part of the module installation
process and updates the installation instructions.

Reported-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoofp-errors: Fix typos in error enumeration names.
Ben Pfaff [Wed, 19 Jun 2013 20:55:17 +0000 (13:55 -0700)]
ofp-errors: Fix typos in error enumeration names.

OFPGMFC is so nice these constants said it twice.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovsdb-server: Add and remove databases during run time.
Ben Pfaff [Thu, 27 Jun 2013 17:27:57 +0000 (10:27 -0700)]
ovsdb-server: Add and remove databases during run time.

The commit allows a user to add a database file to a
ovsdb-server during run time. One can also remove a
database file from ovsdb-server's control.

Feature #14595.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoFix table checking for goto table instruction.
Jarno Rajahalme [Fri, 28 Jun 2013 16:44:03 +0000 (19:44 +0300)]
Fix table checking for goto table instruction.

Usually the table id in flow mods is 255, which means that goto table
instruction cannot be checked before the table is picked (for flow add),
or the rules to be modified are found (flow mod).

Move goto table checking from decode (ofp-util) to actions checking
(ofp-actions), and postpone the action checking until the table in
which the actions are added is known.

This fixes OFPBRC_BAD_TABLE_ID errors for flow adds that specify the table
id as 255, and have a goto table instruction.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-util: OpenFlow 1.0 can match IPv6 Ethertype even though not L3 or L4.
Ben Pfaff [Fri, 28 Jun 2013 17:06:58 +0000 (10:06 -0700)]
ofp-util: OpenFlow 1.0 can match IPv6 Ethertype even though not L3 or L4.

OpenFlow 1.0 can match on flows that have the IPv6 Ethertype, but
ofputil_usable_protocols() incorrectly reported that such a match required
NXM or OXM.  This commit fixes the problem.

Also, add some related tests.

Reported-by: Nagi Reddy Jonnala <njonnala@Brocade.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Implement OpenFlow 1.3 meter table.
Jarno Rajahalme [Wed, 26 Jun 2013 22:39:51 +0000 (01:39 +0300)]
ofproto: Implement OpenFlow 1.3 meter table.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofpact: New function ovs_instruction_type_from_ofpact_type().
Ben Pfaff [Thu, 27 Jun 2013 18:01:18 +0000 (11:01 -0700)]
ofpact: New function ovs_instruction_type_from_ofpact_type().

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-actions: Give ovs_instruction funcs names that start with that prefix.
Ben Pfaff [Thu, 27 Jun 2013 18:04:50 +0000 (11:04 -0700)]
ofp-actions: Give ovs_instruction funcs names that start with that prefix.

This seems slightly clearer, because ofpact_instruction_* makes me look
for a type named ofpact_instruction.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobridge: Don't log flow miss model on every reconfiguration.
Ben Pfaff [Wed, 26 Jun 2013 15:35:14 +0000 (08:35 -0700)]
bridge: Don't log flow miss model on every reconfiguration.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-dpctl: Fix mega flow output
Andy Zhou [Fri, 28 Jun 2013 05:02:58 +0000 (22:02 -0700)]
ovs-dpctl: Fix mega flow output

ovs-dpctl sometimes displays wildcarded fields as exact match. This
patch fixes those cases.

This patch implements the following logic. When OVS_FLOW_ATTR_MASK is
missing, the entire key attributes will be displayed as exact match fields.
When OVS_FLOW_ATTR_MASK is present, but some individual key attributes do
not have matching attributes in the mask, those key attributes will be
displayed as wildcarded fields.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agonetflow: Only un-wildcard IPv4 packets.
Justin Pettit [Thu, 27 Jun 2013 00:13:33 +0000 (17:13 -0700)]
netflow: Only un-wildcard IPv4 packets.

NetFlow v5 only supports IPv4, so don't bother un-wildcarding
non-IPv4 packets.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoflow: Only un-wildcard relevant IP headers.
Justin Pettit [Wed, 26 Jun 2013 23:37:16 +0000 (16:37 -0700)]
flow: Only un-wildcard relevant IP headers.

When determining the fields to un-wildcard, we need to be careful
about only un-wildcarding fields that are relevant.  Also, we
didn't properly handle IPv6 addresses.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoodp-util: Fix converting masked VLAN from flow.
Justin Pettit [Fri, 28 Jun 2013 00:57:57 +0000 (17:57 -0700)]
odp-util: Fix converting masked VLAN from flow.

When converting the VLAN from a flow to an ODP key, the processing logic
would always store the VLAN ethertype.  However, when handling a mask,
it should be a mask, not an ethertype.  And since we don't support
bit-wise masking of the ethertype, just make it an exact-match mask.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoodp-util: Correct printing the VLAN PCP mask.
Justin Pettit [Thu, 27 Jun 2013 22:02:12 +0000 (15:02 -0700)]
odp-util: Correct printing the VLAN PCP mask.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif: Remove old comment.
Justin Pettit [Thu, 27 Jun 2013 23:09:03 +0000 (16:09 -0700)]
ofproto-dpif: Remove old comment.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agodatapath: Bug fix: Kernel rejects flow with valid vlan field
Andy Zhou [Wed, 26 Jun 2013 15:54:45 +0000 (08:54 -0700)]
datapath: Bug fix: Kernel rejects flow with valid vlan field

Bug #18233

Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoDatapath: Bug fix: kernel rejects mega flow with encap masks
Andy Zhou [Wed, 26 Jun 2013 15:54:44 +0000 (08:54 -0700)]
Datapath: Bug fix: kernel rejects mega flow with encap masks

Bug #18233

Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agobond: Handle unknown slaves in bond_check_admissibility().
Ethan Jackson [Wed, 19 Jun 2013 21:34:35 +0000 (14:34 -0700)]
bond: Handle unknown slaves in bond_check_admissibility().

In future patches, ofproto-dpif-xlate may be temporarily out of
sync with ofproto-dpif and pass a non-bonded ofport into
bond_check_admissibility().  This patch handles that edge case
gracefully.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Move tag_the_flow() to ofproto-dpif.c
Ethan Jackson [Sat, 22 Jun 2013 20:16:26 +0000 (13:16 -0700)]
ofproto-dpif: Move tag_the_flow() to ofproto-dpif.c

This will help disentangle ofproto-dpif and ofproto-dpif-xlate.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Refactor checking for in-band special case.
Ben Pfaff [Wed, 26 Jun 2013 21:44:39 +0000 (14:44 -0700)]
ofproto-dpif: Refactor checking for in-band special case.

The comments on in_band_rule_check() were more or less wrong (the return
value was no longer used to determine whether a flow could be set up).
This commit fixes the comments and refactors the interface to make better
sense in the current context.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoconnmgr: Remove connmgr_must_output_local().
Ethan Jackson [Sat, 22 Jun 2013 17:48:42 +0000 (10:48 -0700)]
connmgr: Remove connmgr_must_output_local().

connmgr_must_output_local() requires a 'struct connmgr' handle,
when in principle, it should simply be enough to know whether or
not in_band is enabled.  Breaking this up will allow
ofproto-dpif-xlate to disentangle itself from ofproto-dpif in future
patches.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>