Ben Pfaff [Tue, 19 Oct 2010 23:01:49 +0000 (16:01 -0700)]
nicira-ext: Shuffle comments around.
It seemed to me that the descriptions of what actions do should be just
above the action structures, where the reader can see the arguments,
instead of just above the enumeration name, so I rearranged the code
this way.
A few actions didn't have their own structures, so to do this I had to give
them some.
Ben Pfaff [Mon, 8 Nov 2010 18:43:19 +0000 (10:43 -0800)]
ofproto: Refactor handle_flow_mod().
This breaks this OpenFlow handler into two parts, one responsible
for parsing and constructing OpenFlow messages and one that works
with the flow table. The latter will be reused in a later commit
that implements the Nicira Extended Match flexible flow match
extension.
This breaks this OpenFlow handler into two parts, one responsible
for parsing and constructing OpenFlow messages and one that works
with the flow table. The latter will be reused in a later commit
that implements the Nicira Extended Match flexible flow match
extension.
Ben Pfaff [Fri, 5 Nov 2010 18:59:05 +0000 (11:59 -0700)]
ofproto: Make flow format specific to an OpenFlow connection.
Until now the flow format has been a global property of an ofproto.
This is no longer appropriate, because the Nicira Extended Match
flow format that upcoming commits will add is not compatible with
OpenFlow 1.0-only controllers. This commit changes the flow format
to a property of an individual OpenFlow connection.
Ben Pfaff [Fri, 5 Nov 2010 17:22:18 +0000 (10:22 -0700)]
Add "Manager" and "manager_options" to allow options for OVSDB connections.
I'm retaining the "managers" column in the Open_vSwitch table for now, but
I hope that applications transition to using "manager_options" eventually
so that we could drop it.
CC: Andrew Lambeth <wal@nicira.com> CC: Jeremy Stribling <strib@nicira.com>
Ben Pfaff [Wed, 3 Nov 2010 17:01:38 +0000 (10:01 -0700)]
docs: Implement our own dot->pic translator.
Recent versions of Graphviz no longer support output to PIC format, so this
commit adds our own internal translator from dot's "plain" output format
to PIC format. The "plain" format works best with slightly different
"dot" input (advised by the Graphviz manual description of the "plain"
format) so this commit also adjusts ovsdb-dot's output.
Ben Pfaff [Wed, 3 Nov 2010 16:57:16 +0000 (09:57 -0700)]
configure: Fix Graphviz test and input generation.
This check for Graphviz never actually worked properly because Autoconf
swallows up the [] around [gG], so Graphviz was always detected as missing.
This commit fixes the problem by doubling up to [[gG]].
Because Graphviz was never used, I never noticed that ovsdb-dot had not
been revised to use the latest Python interface to OVSDB, so this commit
fixes up those problems too.
Ben Pfaff [Mon, 18 Oct 2010 23:15:50 +0000 (16:15 -0700)]
ofproto: Simplify send_flow_removed().
I have no evidence that the optimization in this function is valuable.
An upcoming commit will introduce a new form of flow expiration message
that is sent to controllers that ask for it, while the standard OpenFlow
1.0 message is sent to other controllers. Since retaining this
optimization with that logic would complicate the function, this commit
drops it.
Jesse Gross [Thu, 4 Nov 2010 23:20:32 +0000 (16:20 -0700)]
datapath: Directly use free_netdev for internal devices.
Currently internal devices register a destructor function which
simply calls free_netdev. Instead we can simply set the destructor
to free_netdev. In addition to being cleaner, it is also a bug fix
because the module could be unloaded before the destructor is called,
making a call into our code illegal.
Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Thu, 4 Nov 2010 17:53:57 +0000 (10:53 -0700)]
ovs-vsctl: Create bridge interface as type "internal".
The bridge device is always an internal interface, so it seems best to
actually mark it as one. Jesse would like to eventually make the "type"
column mandatory for Interface records, so here's a step in the right
direction.
Ben Pfaff [Tue, 2 Nov 2010 21:50:48 +0000 (14:50 -0700)]
ovsdb-client: Refactor table code to save original json during formatting.
This refactoring should not change user-visible behavior, but saving the
JSON used to format tables will make it possible to print the raw JSON in
the following commit.
Ben Pfaff [Wed, 3 Nov 2010 18:07:16 +0000 (11:07 -0700)]
ofproto: Don't show separate wildcard and exact-match tables via OpenFlow.
Formerly the classifier used in Open vSwitch was very sensitive to the
number of exact-match versus wildcarded rules, so it made sense to show
them as separate tables over OpenFlow. The current classifier doesn't
have the same performance sensitivity, so we might as well just show one
table.
Ben Pfaff [Wed, 3 Nov 2010 18:00:58 +0000 (11:00 -0700)]
classifier: Rewrite.
The old classifier was not adaptive: it required knowing the structure of
the flows that were likely to be in use to get good performance. It is
likely that it degenerated to linear search in any real-world case.
This new classifier is adaptive and should perform better in the real
world.
Jesse Gross [Wed, 3 Nov 2010 17:14:06 +0000 (10:14 -0700)]
autoconf: Compat checks no longer support multiple files.
We now test that a file exists before grepping but that doesn't
work if there are multiple possible files. For the one case that
needs this (kmemdup) break the test into two: check the first file
and if the pattern isn't found check the second file.
Jesse Gross [Tue, 2 Nov 2010 22:43:32 +0000 (15:43 -0700)]
datapath: Work around debugging for csum_and_copy_to_user().
Certain versions of XenServer add debugging to csum_and_copy_to_user()
in such a way that it changes the function signature. This adds a
check and a workaround to allow us to build on these versions.
Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Jesse Gross [Tue, 2 Nov 2010 23:00:16 +0000 (16:00 -0700)]
autoconf: Tolerate missing file when grepping.
Currently we die when grepping for compatibility strings if the
file does not exist. Since this can be a valid situation when
files are added in later versions, we shouldn't kill the build.
Instead, note that the file doesn't exist but otherwise treat it
as if the string was not found.
Ben Pfaff [Tue, 2 Nov 2010 20:13:12 +0000 (13:13 -0700)]
ovsdb: Fix formatting of ovs.db.Error on Python 2.6.
All of the negative Python OVSDB tests were failing on Python 2.6 because
"%s\n" % e yielded the empty string on that version of Python. In turn,
that was because ovs.db.error.Error.__unicode__ was being called instead of
ovs.db.error.Error.__str__. I'm puzzled why that was happening, but this
commit fixes it and also seems like a small code cleanup.
Peter Balland helped me gain some insight on this problem.
CC: Peter Balland <peter@nicira.com> CC: Reid Price <reid@nicira.com>
Simon Horman [Tue, 2 Nov 2010 12:35:14 +0000 (21:35 +0900)]
datapath: The definition of struct tbl is needed by rcu_dereference()
Due to the use of typeof(*p) by __rcu_dereference_check(),
which was introduced by the Linux changeset ca5ecddfa8fcbd948c95530e7e817cee9fb43a3d
(rcu: define __rcu address space modifier for sparse) the definition
of the type of a the parameter to rcu_dereference() is needed.
In terms of the datapath, this means that the definition of
struct tbl needs to be available wherever rcu_dereference(dp->table)
is called.
Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Jesse Gross <jesse@nicira.com>
Ben Pfaff [Thu, 14 Oct 2010 17:30:07 +0000 (10:30 -0700)]
classifier: Remove classifier_insert_exact().
This function doesn't provide any extra useful functionality. It is
amenable to a slightly optimized implementation in the current classifier,
but not in the one that will soon replace it, so get rid of it.
Ben Pfaff [Thu, 28 Oct 2010 04:17:27 +0000 (21:17 -0700)]
ofproto: Use ovs_be<N> types in appropriate places.
There are many more places in OVS where using these types would be an
improvement, but the ofproto code is extra confusing because it uses
a mix of byte orders.
Ben Pfaff [Tue, 26 Oct 2010 22:24:26 +0000 (15:24 -0700)]
flow: Use ovs_be<N> types in appropriate places.
There are many more places in OVS where using these types would be an
improvement, but the flow code is particularly confusing because it uses
a mix of byte orders.
Jesse Gross [Wed, 27 Oct 2010 22:29:16 +0000 (15:29 -0700)]
netdev: Fix carrier status for down interfaces.
Currently netdev_get_carrier() returns both a carrier status and
an error code. However, usage of the error code was inconsistent:
most callers either ignored it or didn't perform their task if an
error occured, which prevented bond rebalancing. This makes the
handling consistent by translating an error into a down status in
the netdev library.
Ben Pfaff [Wed, 27 Oct 2010 16:29:08 +0000 (09:29 -0700)]
daemon: Don't call a normal exit from the monitor a "crash".
When the monitored child is killed with SIGTERM, the monitoring process
currently logs a message like "1 crashes: pid 12345 died, killed by
signal 15 (Terminated), exiting". This counts the SIGTERM as a crash, even
though it's intentional.
This commit changes the log message to omit the "%d crashes" part on normal
termination.
Justin Pettit [Tue, 26 Oct 2010 21:54:13 +0000 (14:54 -0700)]
ofproto: Add coverage counter for reinit_ports()
The reinit_ports() function is an interesting enough case that it would
be good to know if we're hitting it often. This adds a
"ofproto_reinit_ports" coverage counter.
Justin Pettit [Tue, 26 Oct 2010 00:26:44 +0000 (17:26 -0700)]
ovs-external-ids: Better handle VIFs from recently resumed VMs
XAPI doesn't provide a way to look up a VIF entry based on the name, so
we have to locate it by other methods. Previously, we were breaking up
the name into the domid and device number. Unfortunately, it can take
XAPI a few seconds to update the domid of the VM, when resuming from a
suspend. Since we have the VIF UUID, we can just look up the needed
information directly based on that.
Jesse Gross [Mon, 18 Oct 2010 22:30:20 +0000 (15:30 -0700)]
datapath: Add loop detection for RT kernels.
Our normal loop detection requires disabling preemption while
packet processing takes place. On RT kernels this isn't acceptable
and interacts badly with spinlocks, so we can't use it. This
takes advantage of some extra space that is added to struct
task_struct on RT kernels (and the knowledge that we will always
have a valid task_struct) to store the loop counter for a given
thread. Since we can't make these assumptions on non-RT kernels,
we continue to use the previous method of loop detection there.
Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Jesse Gross [Mon, 18 Oct 2010 22:36:59 +0000 (15:36 -0700)]
datapath: #define local_bh_disable to preempt_disable on RT.
We use local_bh_disable() to mean that we don't want to get
preempted or interrupted and normally it covers both situations.
However, on RT kernels local_bh_disable() becomes a no-op because
bottom halves aren't interrupts any more. We still want the
behavior of disabling preemption so #define them to be the same
on these kernels.
Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Fri, 22 Oct 2010 20:42:40 +0000 (13:42 -0700)]
vswitchd: Reset ofport columns of invalid interfaces to -1.
Until now, when ovs-vswitchd dropped interfaces because of duplicate names,
it would not write -1 to the ofport column in the OVSDB record for the
interface, which made it appear that the interface was still active (if
it had been before). This commit fixes the problem.
This commit also sets ofport to -1 for interfaces that cannot be created
for other reasons.
Ben Pfaff [Fri, 22 Oct 2010 21:46:30 +0000 (14:46 -0700)]
ovs-vsctl: Check for dirty reads within transactions.
OVSDB is transactional but it does not implement any form of locking. This
means that read-modify-write operations must verify that the values that
they read are still in place before writing. This commit adds such
checking.
Ben Pfaff [Fri, 22 Oct 2010 17:19:13 +0000 (10:19 -0700)]
vswitch: Make unique "name" columns immutable, to simplify transactions.
OVSDB has transactions but not locking, so a transaction that must
maintain an invariant must check that the starting state is what it
expects. For example, to add a bridge a client must verify that the new
bridge's name does not conflict with any existing bridge's name, given
that the set of bridges might have changed. One way to do that is for
the client to verify that that the set of bridges is the same and that none
of the bridges has been renamed to the new bridge's name. By making
bridge names immutable, the latter part of the check can be omitted.
Mirror names are not required to be unique so this commit does not make
them immutable.
Ethan Jackson [Thu, 21 Oct 2010 22:28:36 +0000 (22:28 +0000)]
netdev-linux: Make queue 0 the default QOS policy
This patch defines, by convention, queue 0 as the default queue in
a particular QOS. Thus, if queue 0 is defined, all traffic going
through the relevant interface will be enqueued in it. If queue 0
is not defined then ovs will send the traffic directly through the
interface without applying any policy to it.
Ben Pfaff [Thu, 21 Oct 2010 18:28:00 +0000 (11:28 -0700)]
tests: Update expected test result to match "ovsdb-client dump" changes.
Commit 06036898849 "ovsdb-client: Make "dump" print table names in default
output format too" changed the output format of "ovsdb-client dump" without
updating the tests that depended on that output format. This commit
updates the expected test results to match.
Ben Pfaff [Thu, 21 Oct 2010 17:48:56 +0000 (10:48 -0700)]
ovsdb-client: Make "dump" print table names in default output format too.
The "dump" command printed table names in CSV and HTML output formats but
they were omitted in the default tabular form. This commit corrects the
discrepancy.
Justin Pettit [Tue, 19 Oct 2010 22:58:35 +0000 (15:58 -0700)]
ovs-vswitchd: Add ability to disable in-band on a bridge
In-band control is always enabled when a manager is configured. Some
applications wish to control all the flows within a bridge, and in-band
control can override that wish. Depending on how the network is
configured, this can lead to loops as the in-band control rules try to
learn where to send traffic.
This commit adds a "disable-in-band" key to the "other_config" column of
bridge tables. If set to "true", in-band will be disabled regardless of
manager or controller configuration.
Justin Pettit [Mon, 18 Oct 2010 05:43:14 +0000 (22:43 -0700)]
ovs-monitor-ipsec: Add ability to traverse NATs
Stable versions of ipsec-tools have a bug that prevents our using
transport mode through a NAT box. Even though the bug has been fixed
for years, it is only available in the 0.8 alpha release of ipsec-tools.
This commit modifies our configuration to allow NAT traversal with that
version of ipsec-tools.
NB: An official package for this version of ipsec-tools is not yet
available on Debian, so we're requiring a custom version number.
Sajjad Lateef [Fri, 15 Oct 2010 20:41:46 +0000 (13:41 -0700)]
Create /etc/openvswitch dir when package is installed.
Earlier, the /etc/openvswitch directory would get installed as part of
the init script's start sequence. However, as newer packages are added,
including some that create files in this directory during their init
script sequences, a race condition may occur.
This change ensures that the directory /etc/openvswitch is created even
before the init scripts execute. Thus, the race condition is avoided.
Ethan Jackson [Wed, 13 Oct 2010 22:12:12 +0000 (22:12 +0000)]
vswitchd: Bubble no-flood configuration up to bridge
When bridge.c decides to flood a packet as the result of a "normal"
flow action, it now checks whether each port is configured to
receive flood packets.