Ben Pfaff [Wed, 15 Feb 2012 22:23:38 +0000 (14:23 -0800)]
netdev: Abstract "features" interface away from OpenFlow 1.0.
netdev_get_features() and other functions have always used OpenFlow 1.0
"enum ofp_port_features" bits as part of their interface. This commit
switches over to using an internally defined interface that is not tied
directly to any OpenFlow version, making evolution of each side of the
interface easier in the future.
Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Wed, 15 Feb 2012 01:08:03 +0000 (17:08 -0800)]
ofp-util: Add functions for working with OpenFlow 1.1 port numbers.
OpenFlow 1.1 extends port numbers to 32 bits. Initially we plan to support
only port numbers in the 16-bit range in Open vSwitch. However the OF1.1
reserved ports have high-valued fixed numbers that require translation to
high fixed values in the 16-bit range for OF1.0. These new functions
provide this translation.
Nothing uses these functions yet.
Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Wed, 15 Feb 2012 23:28:25 +0000 (15:28 -0800)]
ofp-print: Print OpenFlow version number of message, unless it's 1.0.
The version number is an important part of the OpenFlow message's
meaning, so include it. Version 1.0 is grandfathered in so existing output
parsers don't have to change.
Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Wed, 7 Dec 2011 06:33:49 +0000 (22:33 -0800)]
Begin breaking openflow-1.0.h into common and version-specific definitions.
The intention is that, as each OpenFlow 1.1 and 1.2 feature is added to Open
vSwitch, the corresponding protocol definitions will be broken up this way:
- Definitions that are the same in OF1.0 and OF1.1 will retain the "OFP"
or "ofp" prefix and move to openflow-common.h.
- Definitions that are specific to OF1.0 will be renamed with an "OFP10"
or "ofp10" prefix and stay in openflow-1.0.h.
- Definitions that are specific to OF1.1 or to OF1.1 and OF1.2 will be
renamed with an "OFP11" or "ofp11" prefix and move to openflow-1.1.h.
- Definitions that are specific to OF1.2 will be renamed with an "OFP12"
or "ofp12" prefix and move to openflow-1.2.h.
This commit starts this process with some basic OpenFlow definitions.
Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Mon, 24 Oct 2011 01:16:03 +0000 (18:16 -0700)]
Move content of openflow.h into openflow-1.0.h.
This prepares for a gradual introduction of definitions from OpenFlow
1.1 and later, by making it clearer that the current definitions are
specific to OpenFlow 1.0.
Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Fri, 10 Feb 2012 21:30:23 +0000 (13:30 -0800)]
Introduce ofputil_protocol, to abstract the protocol in use on a connection.
Open vSwitch already handles a few different protocol variations, but it
does so in a nonuniform manner:
- OpenFlow 1.0 and NXM flow formats are distinguished using the NXFF_*
constant values from nicira-ext.h.
- The "flow_mod_table_id" feature setting is maintained in ofproto as
part of an OpenFlow connection's (ofconn's) state.
There's no way to easily communicate this state among components. It's
not much of a problem yet, but as more protocol support is added it seems
better to have an abstract, uniform way to represent protocol versions and
variants. This commit implements that by introducing a new type
"enum ofputil_protocol". Each ofputil_protocol value represents a variant
of a protocol version. Each value is a separate bit, so a single enum
can also represent a set of protocols, which is often useful as well.
Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ethan Jackson [Tue, 6 Mar 2012 21:20:06 +0000 (13:20 -0800)]
unixctl: Re-enable unit tests.
The transient failure in the unixctl unit tests likely still
exists, but we've added additional instrumentation to our build
tools to help us debug it.
The vm-id external id in the interface table will uniquely identify a VM
that is connected to a bridge through that interface.
In xenserver, this will have the same value as the external id - xs-vm-uuid
and can be overridden by setting the nicira-vm-id key in the other_config
field of VM record of XAPI.
Pravin B Shelar [Mon, 5 Mar 2012 23:42:41 +0000 (15:42 -0800)]
netdev-linux: Make netdev_set_policing coverage counter consistent with other counters.
Most of coverage counters in netdev-linux are counting actual system
calls rather than reads from cached data.
Following patch fixes it by incrementing it after cache check.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Ben Pfaff [Fri, 2 Mar 2012 21:26:35 +0000 (13:26 -0800)]
bridge: Remove unwanted ports at time of ofproto creation.
The reconfiguration code only deleted unwanted ports for bridges that had
been created in previous (re)configurations. In fact, we should run this
step even for bridges that are newly added, e.g. to delete ports that
were added by a previous run of ovs-vswitchd and deleted from the database
between runs.
Before this commit, the following left "int" in datapath br0. After this
commit, "int" is properly deleted:
1. With ovs-vswitchd running:
# ovs-vsctl add-br br0
# ovs-vsctl add-port br0 int -- set interface int type=internal
2. Kill ovs-vswitchd, then:
# ovs-vsctl --no-wait -- del-port br0 int
3. Restart ovs-vswitchd.
Bug #9957. Reported-by: Hiroshi Tanaka <htanaka@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ethan Jackson [Sat, 3 Mar 2012 03:05:29 +0000 (19:05 -0800)]
unixctl: Skip Python unixctl tests.
The Python unixctl tests introduced a transient build failure that
can't be debugged until more information is collected. Skipping
these tests for now until it's possible to debug them.
Ethan Jackson [Fri, 17 Feb 2012 03:15:01 +0000 (19:15 -0800)]
python: Port unixctl to Python.
Many of the currently implemented Python daemons, and likely many
daemons to be implemented in the future, could benefit from unixctl
support even if only to implement "exit" and "version" commands.
This patch implements unixctl in Python.
Ethan Jackson [Thu, 1 Mar 2012 01:20:03 +0000 (17:20 -0800)]
python: New method to retrieve OVS version at runtime.
Version information is typically fairly useful when debugging Open
vSwitch. This patch adds a new version.py module which python code
can use to report its version to callers.
Ethan Jackson [Fri, 2 Mar 2012 00:21:55 +0000 (16:21 -0800)]
tests: Prefer development Python files over installed ones.
A developer may have Open vSwitch installed, in which case many of
the Python files which are tested will be in both the development
tree and the system Python library. When running unit tests, we
want to test the development tree, so it's better to prefer
importing those files.
Ben Pfaff [Fri, 2 Mar 2012 00:38:27 +0000 (16:38 -0800)]
debian: Move PKI directory to FHS-compliant location.
The PKI directory is mutable state, so it should be in /var, not in /usr.
This commit changes its location and, on systems upgraded from earlier
versions, moves the existing PKI and leaves behind a symlink.
CC: 661090@bugs.debian.org Reported-by: Andreas Beckmann <debian@abeckmann.de> Signed-off-by: Ben Pfaff <blp@nicira.com>
Chris Wright [Thu, 1 Mar 2012 23:25:14 +0000 (15:25 -0800)]
ovsdbmonitor: move to its own data directory
It doesn't have dependencies on any packages that would install into
pkgdatadir, and for Fedora it makes directory ownership work better.
So move ovsdbmonitor python internals to its own data directory.
Signed-off-by: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ethan Jackson [Thu, 1 Mar 2012 02:54:05 +0000 (18:54 -0800)]
xenserver: Restart ovs-xapi-sync on kmod reload.
Some users never restart OVS, they just reload the kernel module on
each new version. Since ovs-xapi-sync is a daemon, a restart is
required to use the new code. Therefore, without this patch, users
could unwittingly use stale versions of ovs-xapi-sync.
Bug #9919. Signed-off-by: Ethan Jackson <ethan@nicira.com> Diagnosed-by: Ben Pfaff <blp@nicira.com>
Pravin B Shelar [Wed, 29 Feb 2012 22:09:05 +0000 (14:09 -0800)]
netdev-linux: Fix stats for ovs internal device.
There is no need to retrieve linux system stats for internal devices
as all relevant stats for virtual device like internal device are
already reported by OVS over vport-stats. As a result it also fixes
error stats for internal-devices as they are not counted twice.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Ben Pfaff [Tue, 28 Feb 2012 22:57:13 +0000 (14:57 -0800)]
timeval: Add "time/stop" unixctl command, for use in unit tests.
Although we try to avoid it, some unit tests are necessarily
timing-sensitive. The new "time/stop" command that this commit adds should
help with that, by preventing time from advancing from the viewpoint of
the OVS "timeval" functions except when "time/warp" explicitly advances
the current time. This should allow the unit tests that need it to become
reproducible regardless of the speed at which the tests run.
This commit adds one unit of "time/stop" to the unit test suite, in the one
timing-sensitive test of which I am currently aware.
Bug #9782. Reported-by: Tim Chen <tchen@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Tue, 28 Feb 2012 02:42:17 +0000 (18:42 -0800)]
dpif-linux: Make dpif_linux_port_query_by_name() query only one datapath.
The kernel will report a vport with the given name in any datapath, but
userspace only wants a vport with the given name in a specific datapath.
Receiving information on a vport in an unexpected datapath yields bizarre
and hard-to-debug problems.
Bug #9889. Signed-off-by: Ben Pfaff <blp@nicira.com>
Ethan Jackson [Wed, 15 Feb 2012 04:53:59 +0000 (20:53 -0800)]
unixctl: New JSON RPC back-end.
The unixctl library had used the vde2 management protocol since the
early days of Open vSwitch. As Open vSwitch has matured, several
Python daemons have been added to the code base which would benefit
from a unixctl implementations. Instead of implementing the old
unixctl protocol in Python, this patch changes unixctl to use JSON
RPC for which we already have an implementation in both Python and
C. Future patches will need to implement a unixctl library in
Python on top of JSON RPC.
Ethan Jackson [Thu, 16 Feb 2012 03:38:27 +0000 (19:38 -0800)]
jsonrpc: Don't swallow errors in jsonrpc_transact_block().
If a server returned an error in response to a request,
jsonrpc_transact_block() would ignore it. This patch changes the
behavior and updates its callers to gracefully handle the
possibility.
Ben Pfaff [Thu, 9 Feb 2012 22:17:33 +0000 (14:17 -0800)]
Add ability to direct "packet-in"s to particular controllers.
Nicira's controllers are somewhat heterogeneous, so that particular
"packet-in" messages should be directed to particular controllers. This
new Nicira extension action allows designating a controller or controllers
to receive the "packet-in" using a 16-bit integer ID.
The new NXAST_CONTROLLER action also specifies the "reason" code to include
in the "packet-in" message. This is particularly useful for simulating a
"no-match" "packet-in" using a rule.
Feature #8946. Signed-off-by: Ben Pfaff <blp@nicira.com>
Simon Horman [Thu, 23 Feb 2012 23:06:21 +0000 (08:06 +0900)]
Make the string parameters const for do_flow_mod__()
Make the string parameter of parse_ofp_flow_stats_request_str() and
parse_ofp_flow_mod_str() const
* Both parse_ofp_flow_stats_request_str() and parse_ofp_flow_mod_str()
only pass their string parameter to it to parse_ofp_str() which treats
the parameter as const.
* do_flow_mod__() may pass a const string as the string argument to
parse_ofp_flow_stats_request_str() and parse_ofp_flow_mod_str()
Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Sat, 18 Feb 2012 00:47:36 +0000 (16:47 -0800)]
jsonrpc: Make jsonrpc_error() internal.
This function is an implementation detail. The JSONRPC unit test used it,
but not for any good reason, so this commit changes the test to avoid
using it.
Ben Pfaff [Thu, 2 Feb 2012 01:08:28 +0000 (17:08 -0800)]
ofproto-dpif: Allow OpenFlow rules that have facets to expire.
At one time (before facets were called facets), the existence of a facet
implied that its parent rule was not idle. This is no longer true, so
remove the check.
Ben Pfaff [Wed, 8 Feb 2012 23:29:15 +0000 (15:29 -0800)]
vlog: Be more liberal in syntax for -v and vlog/set.
Until now, the argument to -v and vlog/set has had to take the form
"module:facility:level". I can never remember the required order, so this
commit switches to allowing any order.
Ethan Jackson [Sun, 19 Feb 2012 08:34:28 +0000 (00:34 -0800)]
ofproto-dpif: Cleanup STP on ports when disabled on their bridge.
When STP is enabled on a bridge, the STP module puts its ports in
an STP_LISTENING state until STP converges. This causes all
traffic destined for these ports to be dropped. If STP is disabled
on the bridge, but not explicitly disabled on its ports, the bridge
fails to remove the STP state from these ports. Therefore, if a
port is in an STP_LISTENING state, it will remain in that state and
continue to drop all traffic indefinitely. This patch fixes the
issue.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Bug #9157.
Ben Pfaff [Thu, 16 Feb 2012 18:34:55 +0000 (10:34 -0800)]
configure: Try to extract kernel source directory from build Makefile.
OVS needs to inspect the headers in the kernel source directory at build
time. Debian keeps moving the source directory relative to the build
directory and doesn't provide an obvious way to find the source directory,
so in the past we've used some name-based heuristics to essentially guess
where it is.
This commit introduces a new heuristic that I hope will be more reliable:
extracting the source directory from the Makefile in the build directory.
In Debian's case, it looks like the Makefile generally contains a line of
the form "MAKEARGS := -C <srcdir> O=<outdir>". This commit extracts the
source directory from that line.
To avoid regressions this commit retains the older heuristics as fallbacks.
CC: 659685@bugs.debian.org Reported-by: Thomas Goirand <zigo@debian.org> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Fri, 17 Feb 2012 00:33:14 +0000 (16:33 -0800)]
vswitchd: Always configure a default queue for QoS.
When an interface has QoS configured but no default queue (queue 0), OVS
has until now installed that QoS configuration literally, which causes all
packets destined for this default queue to be dropped. This behavior is
usually both unexpected and undesirable.
This commit changes behavior so that, when no default queue is configured,
OVS uses a default "empty" configuration for the default queue. This
behavior should be more acceptable when QoS is slightly misconfigured.
I tested that, without this patch, configuring only queue 1 causes "tc
class show" to show only queue 1 (handle 1:2) for linux-htb and linux-hfsc,
and that with this patch it shows configurations for both queue 0 (handle
1:1) and queue 1.
Bug #5583.
Feature #7413. Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Tue, 14 Feb 2012 23:18:32 +0000 (15:18 -0800)]
vswitchd: Remove never-implemented table and column for capabilities.
Not only have we never implemented this, no one has ever asked for it to
the best of my knowledge.
This increments the middle part of the schema version number instead of the
first part on the grounds that removing something that is unused is
unlikely to break anything.
Ben Pfaff [Wed, 15 Feb 2012 18:37:03 +0000 (10:37 -0800)]
Implement new "fin_timeout" action and "learn" feature.
The "learn" action can create matching return flows. If those have a long
timeout then it's a good idea to have a way to notice when in fact the
flows have terminated. This new action and matching "learn" feature
provides that way.
Feature #8603. Signed-off-by: Ben Pfaff <blp@nicira.com>
Dominic Curran [Wed, 15 Feb 2012 17:17:25 +0000 (17:17 +0000)]
xenserver: Fix iteration of dictionary.
Fix bug in commit 3249bb907a1dab9b0, which incorrectly assumed that
get_all_records_where() returned a list. It in fact returns a
dictionary and the list iteratory needs to change to account for this.
Thanks to Nicira for pointing this out.
NIC-454.
Reported-by: David Tsai <dtsai@nicira.com> Acked-by: Rob Hoes <rob.hoes@citrix.com> Signed-off-by: Dominic Curran <dominic.curran@citrix.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ethan Jackson [Tue, 14 Feb 2012 02:07:44 +0000 (18:07 -0800)]
netdev-linux: Cache flags using netlink.
Before this patch, every request for a 'netdev_dev''s flags
required an ioctl call. This occurred every time
netdev_get_carrier() was called, which theoretically was very often
if there were a large number of devices. We were already using
netlink to keep track of the IFF_RUNNING flag. This patch
generalizes the code to keep track of all flags using the same
netlink code.
Ethan Jackson [Tue, 14 Feb 2012 02:07:39 +0000 (18:07 -0800)]
netdev-linux: Get carrier from ioctl instead of sysfs.
When a netdev Linux device is created or its netlink cache is
invalidate, it needs an alternative method to update the its
carrier status. Previous patches retrieved this information from a
sysfs file. This patch switches to ioctl which is significantly
simpler, and likely quite a bit faster as well.
Ben Pfaff [Tue, 14 Feb 2012 17:17:13 +0000 (09:17 -0800)]
debian: Use provided kernel source dir instead of host kernel version.
DKMS passes in an explicit variable for the kernel source directory, so we
should use that instead of `uname -r`.
CC: 659685@bugs.debian.org Reported-by: Thomas Goirand <thomas@goirand.fr> Tested-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Simon Horman [Mon, 13 Feb 2012 03:31:43 +0000 (12:31 +0900)]
ovs-ofctl: Clarify that tun_id will not be nonzero unless the key is nonzero
The Open vSwtich datapath's GRE implementation does not appear to make a
distinction between no key present and a zero key present, which appears to
be consistent with the (other) Linux implementation of GRE. Make this a
little clearer in the documentation.
Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Jesse Gross <jesse@nicira.com>
Simon Horman [Mon, 13 Feb 2012 06:15:33 +0000 (15:15 +0900)]
ovs-ofctl: Remove documentation that ovs-ofctl uses TUN_ID_FROM_COOKIE
My reading of commit b78f6b77 ("Remove support for obsolete
"tun_id_from_cookie" extension.") is that no part of Open vSwitch,
including ovs-ofctl, uses the TUN_ID_FROM_COOKIE extension any more.
Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Fri, 10 Feb 2012 19:00:54 +0000 (11:00 -0800)]
debian: Fix dependencies for openvswitch-datapath-dkms package.
The OVS kernel module, like other kernel modules, does not need a working
userspace build environment, but the OVS "configure" script and makefiles
don't support a kernel-only build, so "configure" fails if libc6-dev is
not installed.
It would be better to change the "configure" script and makefiles to handle
this special case, but that was more work than I initially expected it to
be.
Bug #8606. Reported-by: Edwin Chiu <echiu@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Thu, 26 Jan 2012 22:50:41 +0000 (14:50 -0800)]
vswitchd: Add "enable-async-messages" setting for controllers.
An OpenFlow connection can start receiving asynchronous messages such as
"packet-ins" immediately at connect time. If there is a lot of traffic on
the network then this can swamp the controller before it gets a chance to
set up an initial flow table. This setting overrides this OpenFlow
behavior, changing it so that the connection initially enables no
asynchronous messages at all. The controller can enable any messages that
it actually wants when it is ready for them.
Feature #7086. Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Thu, 9 Feb 2012 22:06:35 +0000 (14:06 -0800)]
ofproto: Implement OpenFlow extension to allow control over async messages.
Until now, the rules that cover the asynchronous messages that Open vSwitch
sends to a controller have been ad hoc. The new NXT_SET_ASYNC_CONFIG
message provides systematic, precise control.
Feature #7086. Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Wed, 25 Jan 2012 21:54:15 +0000 (13:54 -0800)]
Add support for parsing and printing OFPFF_* flags.
I intend to use OFPFF_SEND_FLOW_REM in upcoming unit tests. I threw in
OFPFF_CHECK_OVERLAP also because it didn't cost me anything. I omitted
parsing support for OFPFF_EMERG because we opposed its inclusion from the
start and it was removed from OpenFlow 1.2.
Ben Pfaff [Mon, 6 Feb 2012 22:17:49 +0000 (14:17 -0800)]
ofp-util: Add struct ofputil_packet_out, helper functions, and use it all.
This makes the ofp-util support for packet_out better match the support
that ofp-util has for other OpenFlow messages. It also prepares for an
upcoming patch that adds a new piece of code that generates packet_out
messages.
Ben Pfaff [Wed, 25 Jan 2012 23:54:22 +0000 (15:54 -0800)]
connmgr: Do not persist OpenFlow settings from one session to another.
Each OpenFlow session should begin fresh, with settings that are the
default for OpenFlow, but the connection manager was mistakenly persisting
them from one session to the next for "primary" controllers.
This is a bug, but it is a long-standing one. I found the problem by
inspection, not through a bug report, so I do not think that it causes much
harm in practice.
Ethan Jackson [Tue, 7 Feb 2012 22:35:09 +0000 (14:35 -0800)]
cfm: Expose detailed fault status in the database.
The cfm_fault column of the database is the logical OR of a number
of reasons that CFM can be in a faulted state. A controller may
want to have more specific information in which case it can look at
the cfm_fault_status column which this patch adds.
Ethan Jackson [Thu, 9 Feb 2012 00:26:57 +0000 (16:26 -0800)]
ovsdb-doc: Support per-element documentation of string sets.
A future patch will need to document individual elements in a set
of strings. Without this patch the documentation generation code
fails trying to figure out what type the value of the map is.
Ethan Jackson [Wed, 8 Feb 2012 22:42:03 +0000 (14:42 -0800)]
idl: Generalize special case boolean exception.
Sparse doesn't like taking sizeof boolean values. The idl had
worked around this limitation with a special case in the case of
optional booleans. A future patch needs an array with boolean
values which the existing special case did not handle. This patch
generalizes the special case to handle this situation as well.
Signed-off-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Tue, 7 Feb 2012 18:13:52 +0000 (10:13 -0800)]
Add information about time left before timeouts to flow dumps.
The "learn" action is useful for MAC learning, but until now there has been
no way to find out through OpenFlow how much time remains before a MAC
learning entry (a learned flow) expires. This commit adds that ability.
Feature #7193. Signed-off-by: Ben Pfaff <blp@nicira.com>