sliver-openvswitch.git
12 years agoPrepare Open vSwitch 1.2.0 release. v1.2.0
Justin Pettit [Wed, 3 Aug 2011 22:09:45 +0000 (15:09 -0700)]
Prepare Open vSwitch 1.2.0 release.

12 years agoUpdate ChangeLog to reflect changes since 1.1.0.
Justin Pettit [Wed, 3 Aug 2011 06:15:30 +0000 (23:15 -0700)]
Update ChangeLog to reflect changes since 1.1.0.

12 years agovlog: Move log level definitions from source code to user documentation.
Ben Pfaff [Thu, 28 Jul 2011 17:19:43 +0000 (10:19 -0700)]
vlog: Move log level definitions from source code to user documentation.

Users should be able to find out what a log level means without reading
source code comments, so this seems like a better place for it.

Reported-by: David Tsai <dtsai@nicira.com>
12 years agovlog: Add a new log level "off".
Ben Pfaff [Thu, 28 Jul 2011 17:19:42 +0000 (10:19 -0700)]
vlog: Add a new log level "off".

Until now, "emer" has effectively been "off" because no messages were ever
logged at "emer" level.  Justin points out that it is useful to use "emer"
for messages that indicate a fatal error.  This commit makes that change
and adds a new "off" level to really turn off all logging to a facility.

12 years agodebian: Fix path for ovsdb-server in init script.
Justin Pettit [Mon, 1 Aug 2011 17:43:26 +0000 (10:43 -0700)]
debian: Fix path for ovsdb-server in init script.

Reported-by: Brad Hall <brad@nicira.com>
12 years agodatapath: Backport flex_arrays.
Jesse Gross [Fri, 15 Jul 2011 16:59:06 +0000 (09:59 -0700)]
datapath: Backport flex_arrays.

flex_arrays didn't exist at all until 2.6.30, weren't exported to modules
until 2.6.38, and performed poorly until 3.0, so this backports the
functionality to older kernels.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Don't pass __GFP_ZERO to kmalloc on older kernels.
Jesse Gross [Fri, 15 Jul 2011 16:59:16 +0000 (09:59 -0700)]
datapath: Don't pass __GFP_ZERO to kmalloc on older kernels.

On new kernels kzalloc() is simply a wrapper around kmalloc with
the addition of the __GFP_ZERO flag.  flex_arrays take advantage
of this by expecting the user to just pass in this flag if they
want the memory to be zeroed.  However, before 2.6.23, kzalloc()
was a function in its own right and kmalloc really didn't like
receiving __GFP_ZERO.  This overrides kmalloc() to intercept the
flags and direct the call to the right function.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Backport reciprocal division.
Jesse Gross [Fri, 15 Jul 2011 16:59:05 +0000 (09:59 -0700)]
datapath: Backport reciprocal division.

The reciprocal division library did not exist until 2.6.20 and is
not currently exported in any version, so this backports it.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-ofctl: Print human readable nx_pull_match() errors.
Ethan Jackson [Thu, 28 Jul 2011 23:49:06 +0000 (16:49 -0700)]
ovs-ofctl: Print human readable nx_pull_match() errors.

I've found this makes debugging a bit easier.

12 years agonx-match: Shorten line length to 79 characters.
Ethan Jackson [Wed, 27 Jul 2011 22:10:38 +0000 (15:10 -0700)]
nx-match: Shorten line length to 79 characters.

12 years agoofproto-dpif: Allow setting of flow eviction threshold
Simon Horman [Thu, 28 Jul 2011 23:38:50 +0000 (16:38 -0700)]
ofproto-dpif: Allow setting of flow eviction threshold

Allow setting the number of flows present in the flow hash
at which point eviction of entries from the kernel flow hash
will begin to occur.

The value may be set using a bridge's other-config column.

e.g.

ovs-vsctl set bridge br3 other-config:flow-eviction-threshold=10000

default is 1000, reflecting constant value previously used.

Increasing this value can result in reduced CPU usage and
packet loss in situations where the number of active flows
is significantly larger than 1000.

12 years agoDatapath action should not refer to controller
pravin shelar [Thu, 28 Jul 2011 16:05:25 +0000 (09:05 -0700)]
Datapath action should not refer to controller

ODP_ACTION_ATTR_CONTROLLER in the kernel actually sends packets to
userspace, not the controller. To make it generic rename this action
to ODP_ACTION_ATTR_USERSPACE.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
12 years agogit: Update gitignore in tests and utilities.
Ethan Jackson [Thu, 28 Jul 2011 18:39:51 +0000 (11:39 -0700)]
git: Update gitignore in tests and utilities.

12 years agoofproto-dpif: Fix mirror configuration and deconfiguration.
Ben Pfaff [Thu, 28 Jul 2011 00:06:50 +0000 (17:06 -0700)]
ofproto-dpif: Fix mirror configuration and deconfiguration.

Deleting or updating a mirror didn't work: mirror_set() didn't set the
'aux' member so mirror_lookup() couldn't find the mirror on that basis.

Bug #6617.
Reported-by: David Tsai <dtsai@nicira.com>
12 years agovlog: Fix typo in VLOG_IS_ERR_ENABLED macro definition.
Ben Pfaff [Thu, 28 Jul 2011 16:45:02 +0000 (09:45 -0700)]
vlog: Fix typo in VLOG_IS_ERR_ENABLED macro definition.

This does not fix any real bug because VLOG_IS_ERR_ENABLED is not used
anywhere in the tree.

12 years agoxenserver: Fix typo in spec file.
Ethan Jackson [Thu, 28 Jul 2011 02:00:59 +0000 (19:00 -0700)]
xenserver: Fix typo in spec file.

12 years agoRemove spurious blank line.
Ben Pfaff [Thu, 28 Jul 2011 00:07:07 +0000 (17:07 -0700)]
Remove spurious blank line.

12 years agoovs-benchmark: New utility.
Ben Pfaff [Wed, 27 Jul 2011 23:23:06 +0000 (16:23 -0700)]
ovs-benchmark: New utility.

12 years agosocket-util: New function lookup_hostname().
Ben Pfaff [Thu, 16 Sep 2010 21:28:53 +0000 (14:28 -0700)]
socket-util: New function lookup_hostname().

This is equivalent to lookup_ip() except that it accepts DNS names also.

12 years agosocket-util: Factor inet_parse_passive() out of inet_open_passive().
Ben Pfaff [Wed, 29 Sep 2010 17:15:15 +0000 (10:15 -0700)]
socket-util: Factor inet_parse_passive() out of inet_open_passive().

12 years agoovs-ofctl: Fix dump-ports and queue-stats commands.
Ben Pfaff [Thu, 21 Jul 2011 21:44:54 +0000 (14:44 -0700)]
ovs-ofctl: Fix dump-ports and queue-stats commands.

These ovs-ofctl commands have been sending malformed stats requests since
commit 63f2140a553 "openflow: Make stats replies more like other OpenFlow
messages."  This commit fixes the problem and adds basic unit tests that
should prevent similar regressions.

Reported-by: Hao Zheng <hzheng@nicira.com>
12 years agoovs-ofctl: New --readd option for "replace-flows".
Ben Pfaff [Wed, 27 Jul 2011 21:58:10 +0000 (14:58 -0700)]
ovs-ofctl: New --readd option for "replace-flows".

This is useful for resetting flows' byte and packet counters to 0.

Suggested-by: Jed Daniels <openvswitch@jeddaniels.com>
12 years agonetlink-socket: Reduce nl_sock_recv() from 2 (or more) system calls to 1.
Ben Pfaff [Wed, 27 Jul 2011 21:56:03 +0000 (14:56 -0700)]
netlink-socket: Reduce nl_sock_recv() from 2 (or more) system calls to 1.

Until now, each attempt to receive a message from a Netlink socket has
taken at least two system calls, one to check the size of the message to
be received and a second one to delete the message from the socket buffer.
This commit switches to a new strategy that requires only one system call
per message received.

In my testing this increases the maximum flow setups per second by a little
over 10%.

12 years agonetlink-socket: Remove unused nl_sock_sendv() function.
Ben Pfaff [Wed, 20 Jul 2011 17:52:09 +0000 (10:52 -0700)]
netlink-socket: Remove unused nl_sock_sendv() function.

This function hasn't been used for ages.

12 years agodebian: Move OVSDB schema and ovsdb-tool to openvswitch-switch.
Ben Pfaff [Tue, 26 Jul 2011 16:46:38 +0000 (09:46 -0700)]
debian: Move OVSDB schema and ovsdb-tool to openvswitch-switch.

ovs-vswitchd in the openvswitch-switch package is tightly coupled to its
database schema.  During development, it's possible to change the schema
without changing the Open vSwitch version number, which makes it possible
for the openvswitch-switch and openvswitch-common packages to get out of
sync: openvswitch-switch requires the same version of openvswitch-common,
but if the version number doesn't get updated that has no effect.

Actually putting the schema and ovs-vswitchd (its primary user) in the
same package prevents them from getting out-of-sync.  This commit also
moves ovsdb-tool because that program often works directly with OVSDB
schemas and so there's not much point having it around without a schema to
work with.

12 years agoofproto-dpif: Restore former NORMAL action behavior when revalidating.
Ben Pfaff [Fri, 22 Jul 2011 22:31:32 +0000 (15:31 -0700)]
ofproto-dpif: Restore former NORMAL action behavior when revalidating.

Before commit fa066f015 "bridge: Move packet processing functionality into
ofproto," the code that called into what became xlate_normal() prevented
a flow from being installed if it was called at revalidation time and
the MAC learning table lacked an entry for the flow's destination MAC.
That commit instead started dropping packets in that case (because it
incorrectly ignored xlate_normal()'s return value).

This restores the former behavior.  It's not clear that the former behavior
is the best possible, but it is strictly better than starting to drop
packets at revalidation time.

Along with the previously fixed problem where flood_vlans were interpreted
incorrectly, this bug broke controller connectivity when flood_vlans was
set to any nonempty value that did not include the VLAN used for the
controller connection (that is, when flood_vlans was interpreted as
flooding the controller VLAN).

Reported-by: David Tsai <dtsai@nicira.com>
12 years agovlan-bitmap: Remove function vlan_bitmap_contains().
Ben Pfaff [Fri, 22 Jul 2011 00:03:59 +0000 (17:03 -0700)]
vlan-bitmap: Remove function vlan_bitmap_contains().

I created this function because I thought I had three good use cases.
Unfortunately, one of them was wrong, so drop it.

12 years agomac-learning: Fix inverted logic in is_learning_vlan().
Ben Pfaff [Fri, 22 Jul 2011 00:03:03 +0000 (17:03 -0700)]
mac-learning: Fix inverted logic in is_learning_vlan().

When a bit is set in flood_vlans, that VLAN must be flooded, but the logic
here was reversed in the case where there were any flooded VLANs at all.
Thus, if a single VLAN was configured to be flooded, all VLANs except that
one were actually flooded.

The common case where no VLANs were to be flooded was handled correctly.

Reported-by: David Tsai <dtsai@nicira.com>
12 years agodatapath: Add missing targets to avoid failure on e.g. "make TAGS".
Ben Pfaff [Wed, 27 Jul 2011 00:08:06 +0000 (17:08 -0700)]
datapath: Add missing targets to avoid failure on e.g. "make TAGS".

Automake invokes a number of targets recursively, including in
datapath/linux, so we need to define all those targets or get an error
from "make" when those targets are invoked, e.g. when "make TAGS" is run.
This commit adds a no-op target to the main datapath/linux Makefile for
each recursive target listed in the "Third-Party Makefiles" section of
the Automake manual, in the order listed there, fixing the problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agoofp-print: Make port "config" and "state" output easier to read.
Ben Pfaff [Thu, 14 Jul 2011 22:17:33 +0000 (15:17 -0700)]
ofp-print: Make port "config" and "state" output easier to read.

This changes the output of "ovs-ofctl show" from printing ports like this:
     1(eth1): addr:50:54:00:00:00:02, config: 0x11, state:0x1
to this:
     1(eth1): addr:50:54:00:00:00:02
         config:     PORT_DOWN NO_FLOOD
         state:      LINK_DOWN
which seems much easier to read.

It also eliminates trailing white space from the output.

Reported-by: Ethan Jackson <ethan@nicira.com>
12 years agovswitchd: Prevent multiple ovs-vswitchd processes from acting together.
Ben Pfaff [Tue, 26 Jul 2011 23:49:03 +0000 (16:49 -0700)]
vswitchd: Prevent multiple ovs-vswitchd processes from acting together.

Once in a while someone reports a problem caused by running multiple
ovs-vswitchd processes at the same time.  This fixes the problem by
requiring ovs-vswitchd to obtain a database lock before taking any actions.

12 years agoovsdb: Implement a "lock" feature in the database protocol.
Ben Pfaff [Tue, 26 Jul 2011 17:24:17 +0000 (10:24 -0700)]
ovsdb: Implement a "lock" feature in the database protocol.

This provides clients a way to coordinate their access to the database.
This is a voluntary, not mandatory, locking protocols, that is, clients
are not prevented from modifying the database unless they cooperate with
the locking protocol.  It is also not related to any of the ACID properties
of database transactions.  It is strictly a way for clients to coordinate
among themselves.

The following commit will introduce one user.

12 years agoovsdb: Refactor jsonrpc-server to make the concept of a session public.
Ben Pfaff [Tue, 26 Jul 2011 17:17:36 +0000 (10:17 -0700)]
ovsdb: Refactor jsonrpc-server to make the concept of a session public.

An upcoming commit will need to expose the concept of a database session
to the execution engine, to allow the execution engine to query the locks
held by the session.  This commit prepares for that by making sessions a
publicly visible data structure.

12 years agoovsdb: Report the number of connections for inbound Managers.
Ben Pfaff [Wed, 13 Jul 2011 23:08:37 +0000 (16:08 -0700)]
ovsdb: Report the number of connections for inbound Managers.

Inbound managers (e.g. "ptcp:") can have multiple active connections, but
the database schema doesn't allow us to report the status of more than one
at a time.  This commit adds a status key-value pair that, when there is
more than one active connection, reports the number that are active.  This
at least helps to clarify the issue.

12 years agoovsdb-server: Reliably report status of inbound connections.
Ben Pfaff [Wed, 13 Jul 2011 23:15:22 +0000 (16:15 -0700)]
ovsdb-server: Reliably report status of inbound connections.

ovsdb_jsonrpc_server keeps track of its remotes in a shash indexed on the
remote name specified in the database Manager record, but
ovsdb_jsonrpc_server_get_remote_status() added the name returned by
jsonrpc_session_get_name() to the shash returned to the ovsdb-server code.
If that name happened to be different (which is entirely possible because
the latter returns a "canonicalized" name in some cases) then the
ovsdb-server code couldn't find it.  Furthermore, if an inbound (e.g.
"ptcp:") Manager got a connection and then lost it, the status info in
that Manager never got updated to reflect that, because the code considered
that that "couldn't happen" and didn't bother to do any updates.

This commit simplifies the logic.  Now ovsdb-server just asks for a single
status record at a time, using the name that is indexed in the
ovsdb_jsonrpc_server shash, avoiding that whole issue.

12 years agoovsdb-client: Make "server" and "database" arguments optional.
Ben Pfaff [Tue, 26 Jul 2011 17:16:15 +0000 (10:16 -0700)]
ovsdb-client: Make "server" and "database" arguments optional.

In practice these arguments are almost always the defaults, so this change
makes ovsdb-client much more usable interactively.

12 years agoovs-vswitchd: Make database socket command-line argument optional.
Ben Pfaff [Tue, 26 Jul 2011 17:13:07 +0000 (10:13 -0700)]
ovs-vswitchd: Make database socket command-line argument optional.

In practice the default location is the only one used, so we might as well
make it easy.

12 years agoovsdb-server: Make database command-line argument optional.
Ben Pfaff [Tue, 26 Jul 2011 16:53:49 +0000 (09:53 -0700)]
ovsdb-server: Make database command-line argument optional.

In practice the default location is the only one used, so we might as well
make it easier.

12 years agodirs: Make sysconfdir available via ovs_sysconfdir().
Ben Pfaff [Sat, 9 Jul 2011 00:03:17 +0000 (17:03 -0700)]
dirs: Make sysconfdir available via ovs_sysconfdir().

This will be used in upcoming patches.

12 years agoovsdb-doc: Fix definition of .TQ macro.
Ben Pfaff [Wed, 13 Jul 2011 21:38:33 +0000 (14:38 -0700)]
ovsdb-doc: Fix definition of .TQ macro.

.TP's argument is an optional indentation width, not a string.  The string
goes on the next line.

vswitch.xml didn't actually cause .TQ to be used before, so this wasn't a
problem, but an upcoming commit does add a use, so this commit fixes the
problem in advance.

12 years agostream-unix: Fix naming of passive Unix streams.
Ben Pfaff [Wed, 13 Jul 2011 20:40:43 +0000 (13:40 -0700)]
stream-unix: Fix naming of passive Unix streams.

Until now, pstream_get_name() would just return "punix" for passive Unix
streams.  This is uninformative and probably just a mistake, so this
commit switches to using the full name passed in, e.g.
"punix:/path/to/socket".

12 years agoUpdate version to reflect this branch is for post-1.1.x development.
Justin Pettit [Tue, 26 Jul 2011 21:43:06 +0000 (14:43 -0700)]
Update version to reflect this branch is for post-1.1.x development.

When development for a new long-term release is started, we haven't
typically updated the version string.  This means that version numbers
used in binaries generated on this branch tend to lag behind "current"
stable releases.  We considered using a "pre" string in the version
(eg, "1.2.0-pre1") but this causes some pain for RPMs.  Instead, we
will now use "90" as the version's bug-fix number to indicate that this
will form a new release.

For example, the current stable series is "1.1.x" in the "branch-1.1"
branch, so the master branch will be labeled "1.1.90" in anticipation
that it will be the basis for the "1.2.x" series.  Code in "branch-1.1"
will have the expected version numbers (ie, 1.1.0, 1.1.1, 1.1.2, etc)
and versions in-branch will lag slightly before an official release.

Suggested-by: Ben Pfaff <blp@nicira.com>
12 years agodebian: Fix bug from commit 211b05b5 "debian: Modernize use of dh_install."
Ben Pfaff [Tue, 26 Jul 2011 21:55:55 +0000 (14:55 -0700)]
debian: Fix bug from commit 211b05b5 "debian: Modernize use of dh_install."

Commit 211b05b5 "debian: Modernize use of dh_install" caused build failures
in clean environments because debian/ovsdbmonitor.install now installed
files that were never created in such an environment.  It didn't cause a
build failure in my own testing because I still had old files around.
This fixes the problem.

It seems to be necessary to run "make install" once for each of binary-arch
and binary-indep, because dh_prep always deletes debian/tmp.  It is
logically not necessary but I don't see a clean and robust way to avoid it.

12 years agonx-match: Make more fields writable with NXAST_REG_MOVE and other actions.
Ben Pfaff [Mon, 18 Jul 2011 22:26:43 +0000 (15:26 -0700)]
nx-match: Make more fields writable with NXAST_REG_MOVE and other actions.

Until now, fields writable by actions defined in terms of NXM field
numbers were special cases, but commit b3e9b2eda9a "ofproto: Optimize
datapath actions" had the side effect of making it easy to modify
additional fields.  This commit takes advantage of that to make
modifiable all the fields that the kernel datapath supports modifying.
We could make other fields modifiable by adding more support to the kernel
datapath.

12 years agodebian: Add support for bridge compatibility.
Ben Pfaff [Mon, 18 Jul 2011 20:51:12 +0000 (13:51 -0700)]
debian: Add support for bridge compatibility.

This adds support for bridge compatibility to the generic Open vSwitch
init scripts and to the Debian packaging.

See https://bugs.launchpad.net/ubuntu/+source/openvswitch/+bug/808224.

12 years agoovs-vsctl: Log better warnings for duplicate ports and interfaces.
Ben Pfaff [Fri, 8 Jul 2011 19:31:55 +0000 (12:31 -0700)]
ovs-vsctl: Log better warnings for duplicate ports and interfaces.

The database prevents multiple ports or interfaces with a single name, but
duplicates can still occur if, for example, two bridges' "ports" columns
both point to a single Port record.  The existing warning just says in this
case that the database contains a duplicate port name.  This prompts users
to dump the Port table to look for the duplicate.  Of course there isn't
one, so then they ask me to point out the problem.

This commit improves the log message to point out the actual problem.

12 years agodebian: Modernize use of dh_install.
Ben Pfaff [Tue, 26 Jul 2011 16:22:45 +0000 (09:22 -0700)]
debian: Modernize use of dh_install.

Originally I intended this as just a cleanup, but as a side effect it also
installs some files from the install tree in debian/tmp instead of from
_debian.  This should avoid a reported problem in which ovs-bugtool was
being created in the source directory instead of the build directory (I
still don't see why this happened).

Reported-by: Sébastien RICCIO <sr@swisscenter.com>
Tested-by: Sébastien RICCIO <sr@swisscenter.com>
Acked-by: Simon Horman <horms@verge.net.au>
CC: Simon Horman <horms@verge.net.au>
12 years agoutilities: Install ovs-parse-leaks utility by default.
Ben Pfaff [Tue, 26 Jul 2011 16:23:31 +0000 (09:23 -0700)]
utilities: Install ovs-parse-leaks utility by default.

We install this in the Debian packaging and I don't see a reason not to
install it everywhere.

(Oddly, we were already installing the manpage everywhere.)

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-ctl: Drop back to an empty database if schema conversion fails.
Ben Pfaff [Tue, 26 Jul 2011 16:13:17 +0000 (09:13 -0700)]
ovs-ctl: Drop back to an empty database if schema conversion fails.

If the "ovsdb-tool convert" call fails, it is likely because the database
has bad contents that this version of OVSDB does not understand.  In that
case, we're better off using a fresh, empty database rather than failing
to come up at all.

Bug #6280.

12 years agoovs-ctl: Log messages about database upgrade process.
Ben Pfaff [Thu, 7 Jul 2011 19:31:58 +0000 (12:31 -0700)]
ovs-ctl: Log messages about database upgrade process.

This should make problems easier to debug.

Bug #6280.

12 years agorhel: Fix use of $< in ordinary Make rules.
Ben Pfaff [Mon, 25 Jul 2011 23:15:18 +0000 (16:15 -0700)]
rhel: Fix use of $< in ordinary Make rules.

POSIX only allows $< in inference rules, so avoid it for these target
rules.

Also, add a header to the generated spec files to remind developers that
they are generated.

12 years agoovs-parse-leaks: Fix typos in manpage.
Ben Pfaff [Mon, 25 Jul 2011 16:30:41 +0000 (09:30 -0700)]
ovs-parse-leaks: Fix typos in manpage.

12 years agomac-learning: Simplify memory management.
Ethan Jackson [Fri, 22 Jul 2011 19:00:46 +0000 (12:00 -0700)]
mac-learning: Simplify memory management.

The mac-learning implementation used a free list to keep track of
statically allocated table entries.  This made the code slightly
more difficult to understand than the more straightforward heap
based strategy implemented by this patch.

12 years agomac-learning: Use random secret in hash function.
Ethan Jackson [Fri, 22 Jul 2011 18:50:26 +0000 (11:50 -0700)]
mac-learning: Use random secret in hash function.

The mac-learning 'secret' parameter is intended to prevent an
attacker from turning the mac learning table into a linked list by
using a known hash function to choose perfectly bad mac entries.
However, this parameter was not taken into account in most cases.

Found by inspection.

12 years agobundle: New action "bundle_load".
Ethan Jackson [Wed, 20 Jul 2011 22:07:46 +0000 (15:07 -0700)]
bundle: New action "bundle_load".

The bundle_load action behaves the same as the bundle action,
except instead of outputting, it writes its result to a register.

12 years agobundle: Implement NX_BD_ALG_ACTIVE_BACKUP.
Ethan Jackson [Mon, 18 Jul 2011 20:50:26 +0000 (13:50 -0700)]
bundle: Implement NX_BD_ALG_ACTIVE_BACKUP.

I don't expect this bundling algorithm to be particularly useful in
software switches.  However, hardware switches will probably only
support this bundling algorithm, so it's implemented here as an
example and a reference.

12 years agonx-match: New helpers.
Ethan Jackson [Tue, 19 Jul 2011 22:47:02 +0000 (15:47 -0700)]
nx-match: New helpers.

This patch creates two new helper functions, nxm_reg_load() and
nxm_dst_check().  The new nxm_dst_check() function may be used to
check the validity of destination fields used by actions.  The new
nxm_reg_load() function may be used by actions which need to write
to NXM fields.

This patch also allows multipath and autopath to write their result
to non-register NXM fields.

12 years agoutil: New function log_2_floor().
Ben Pfaff [Fri, 22 Jul 2011 17:20:52 +0000 (10:20 -0700)]
util: New function log_2_floor().

Calculates the position of the most significant bit in a 32 bit
word.

12 years agobundle: Run bundle_check() in unit tests.
Ethan Jackson [Thu, 21 Jul 2011 01:58:23 +0000 (18:58 -0700)]
bundle: Run bundle_check() in unit tests.

This has been helpful finding bugs in my development environment.
It's good to exercise this code.

12 years agoutilities: Add ovs-bugtool to gitignore.
Ethan Jackson [Wed, 20 Jul 2011 01:05:46 +0000 (18:05 -0700)]
utilities: Add ovs-bugtool to gitignore.

12 years agonx-match: Whitespace cleanup.
Ethan Jackson [Tue, 19 Jul 2011 21:33:29 +0000 (14:33 -0700)]
nx-match: Whitespace cleanup.

12 years agoINTERNALS: Describe SLB bonding.
Ben Pfaff [Fri, 22 Jul 2011 22:05:35 +0000 (15:05 -0700)]
INTERNALS: Describe SLB bonding.

12 years agoofproto-dpif: Initialize 'may_enable' at port construction time.
Ben Pfaff [Thu, 21 Jul 2011 22:39:08 +0000 (15:39 -0700)]
ofproto-dpif: Initialize 'may_enable' at port construction time.

Silences a valgrind warning:

==640== Conditional jump or move depends on uninitialised value(s)
==640==    at 0x808E623: run (ofproto-dpif.c:1444)
==640==    by 0x8086593: ofproto_run (ofproto.c:755)
==640==    by 0x806EB80: bridge_run (bridge.c:1397)
==640==    by 0x806F66C: main (ovs-vswitchd.c:90)

12 years agomac-learning: Convert to hmap.
Ethan Jackson [Fri, 22 Jul 2011 00:41:58 +0000 (17:41 -0700)]
mac-learning: Convert to hmap.

The mac-learning code predates the hmap data structure in OVS.  For
this reason, it rolled it's own hmap-like bucket concept.  This
patch converts it to use an hmap which makes the code slightly
simpler and easier to understand.

12 years agomac-learning: Fix serious performance bug in the learning table.
Ethan Jackson [Fri, 22 Jul 2011 00:58:47 +0000 (17:58 -0700)]
mac-learning: Fix serious performance bug in the learning table.

Due to a typo, the mac-learning hash table had dissolved into a
linked list.  This caused a significant reduction in performance.

12 years agoovs-ofctl: Use strchr() instead of strstr().
Ben Pfaff [Thu, 21 Jul 2011 18:12:45 +0000 (11:12 -0700)]
ovs-ofctl: Use strchr() instead of strstr().

It's the right tool for the job.  Potentially faster, too.

12 years agoovs-ofctl: Improve error message for "ovs-ofctl show nonexistent".
Ben Pfaff [Wed, 20 Jul 2011 21:31:54 +0000 (14:31 -0700)]
ovs-ofctl: Improve error message for "ovs-ofctl show nonexistent".

Suggested-by: Peter Balland <peter@nicira.com>
12 years agobridge: Log a warning when QoS misconfiguration is likely.
Ben Pfaff [Wed, 20 Jul 2011 17:41:16 +0000 (10:41 -0700)]
bridge: Log a warning when QoS misconfiguration is likely.

Queue 0 is documented as the "default queue" used when a packet is not
directed to any specific queue.  Many qdiscs drop packets not directed to a
queue if the default queue is not configured.  This is therefore likely to
be a misconfiguration, so warn about it.

Bug #5583.

12 years agobundle: Avoid GCC 4.5 warning about possibly uninitialized value.
Ben Pfaff [Wed, 20 Jul 2011 16:51:29 +0000 (09:51 -0700)]
bundle: Avoid GCC 4.5 warning about possibly uninitialized value.

This value is not actually uninitialized but GCC 4.5 cannot tell.

12 years agobundle: Treat slave_type properly as 32-bit value.
Ben Pfaff [Wed, 20 Jul 2011 16:50:37 +0000 (09:50 -0700)]
bundle: Treat slave_type properly as 32-bit value.

Found by sparse.

12 years agoofproto-dpif: Implement OFPAT_SET_NW_TOS.
Ben Pfaff [Mon, 18 Jul 2011 22:13:01 +0000 (15:13 -0700)]
ofproto-dpif: Implement OFPAT_SET_NW_TOS.

This field was overlooked in commit b3e9b2eda9a "ofproto: Optimize datapath
actions."

Found by inspection.

12 years agoofproto-dpif: Ignore ECN bits in OFPAT_SET_NW_TOS actions.
Ben Pfaff [Mon, 18 Jul 2011 22:17:57 +0000 (15:17 -0700)]
ofproto-dpif: Ignore ECN bits in OFPAT_SET_NW_TOS actions.

OpenFlow 1.0 doesn't say that the ECN bits in OFPAT_SET_NW_TOS actions must
be zero, but Open vSwitch ODP implementations do require that, so mask off
those bits before storing the nw_tos into the flow.

12 years agovswitch: Implement bundle action.
Ethan Jackson [Sat, 11 Jun 2011 00:45:45 +0000 (17:45 -0700)]
vswitch: Implement bundle action.

This patch creates a new action called "bundle".  Bundles are a way
to implement a simple form of multipath in OpenFlow by grouping
several ports in a single output-like action.

12 years agoofputil: Export ofputil_check_output_port().
Ethan Jackson [Thu, 14 Jul 2011 21:23:02 +0000 (14:23 -0700)]
ofputil: Export ofputil_check_output_port().

Future patches will use this function outside of the ofputil
module.

12 years agoofproto-dpif: Store bonding enabled flag on ofport.
Ethan Jackson [Thu, 14 Jul 2011 01:17:36 +0000 (18:17 -0700)]
ofproto-dpif: Store bonding enabled flag on ofport.

This simplifies the implementation of future patches.

12 years agonicira-ext: Generalize nx_mp_fields into nx_hash_fields.
Ethan Jackson [Wed, 13 Jul 2011 23:20:24 +0000 (16:20 -0700)]
nicira-ext: Generalize nx_mp_fields into nx_hash_fields.

Future patches will use nx_hash_fields for non-multipath related
actions.  This patch renames nx_mp_fields and creates a new
flow_hash_fields() function.

12 years agoofproto: Don't commit modifiers on OFPP_NONE outputs.
Ethan Jackson [Thu, 14 Jul 2011 20:53:34 +0000 (13:53 -0700)]
ofproto: Don't commit modifiers on OFPP_NONE outputs.

This provides a minor optimization.

12 years agoofproto-dpif: Do not mirror L2 multicast switch protocols to VLANs.
Ben Pfaff [Mon, 18 Jul 2011 21:30:42 +0000 (14:30 -0700)]
ofproto-dpif: Do not mirror L2 multicast switch protocols to VLANs.

Mirroring certain protocols interpreted by switches to a VLAN can deceive
the switch that receives it.  Drop such packets instead of mirroring them.

CC: David Tsai <dtsai@nicira.com>
NIC-401.

12 years agodebian: Remove obsolete comment.
Ben Pfaff [Fri, 15 Jul 2011 21:55:29 +0000 (14:55 -0700)]
debian: Remove obsolete comment.

The comment is obsolete because the switch now starts by default, without
prior configuration.

12 years agoovs-lib: Allow "status" command to work as non-root.
Ben Pfaff [Fri, 15 Jul 2011 21:53:11 +0000 (14:53 -0700)]
ovs-lib: Allow "status" command to work as non-root.

12 years agoovs-ctl: Start ovs-vswitchd with correct niceness.
Ben Pfaff [Fri, 15 Jul 2011 21:54:26 +0000 (14:54 -0700)]
ovs-ctl: Start ovs-vswitchd with correct niceness.

12 years agoovsdb: Log when remote connections are deconfigured.
Ben Pfaff [Fri, 15 Jul 2011 18:25:14 +0000 (11:25 -0700)]
ovsdb: Log when remote connections are deconfigured.

Recently I helped debug a scenario where ovsdb-server connected to a remote
manager, then ovs-vsctl deleted the remote manager and soon after re-added
it.  The log was difficult to interpret because it showed two successful
connection attempts to the same remote without showing a reason why the
connection was dropped in the first place.  Adding this log message would
make it clear that the configuration changed to remove that remote
connection in the meantime.

12 years agoPORTING: Document why OVS does not support hybrid ofproto+dpif providers.
Ben Pfaff [Fri, 15 Jul 2011 16:35:25 +0000 (09:35 -0700)]
PORTING: Document why OVS does not support hybrid ofproto+dpif providers.

CC: Sanjay Sane <ssane@nicira.com>
CC: Justin Pettit <jpettit@nicira.com>
CC: Hao Zheng <hzheng@nicira.com>
12 years agorhel: Add ovs-bugtool manpage to list of packaged files.
Ben Pfaff [Thu, 14 Jul 2011 17:14:28 +0000 (10:14 -0700)]
rhel: Add ovs-bugtool manpage to list of packaged files.

With this change, the RPM builds for me again on RHEL 6.

Bug #6413.

12 years agoovs-bugtool: Include conf.db backups in bugtool output.
Ben Pfaff [Thu, 7 Jul 2011 20:19:31 +0000 (13:19 -0700)]
ovs-bugtool: Include conf.db backups in bugtool output.

When an upgrade or downgrade fails due to OVSDB issues, it is useful to
have the old versions of the database available.

12 years agoovs-bugtool: Add an OVSDB snapshot to ovs-bugtool output.
Ben Pfaff [Wed, 6 Jul 2011 17:26:57 +0000 (10:26 -0700)]
ovs-bugtool: Add an OVSDB snapshot to ovs-bugtool output.

The ovs-bugtool output already includes a copy of the configuration
database file, but this file omits many instantaneous details.  For
example, it does not include any information about controller connection
status or interface statistics.  This commit adds a snapshot of the
database contents that does include these details.

12 years agoovs-bugtool: Add plugins previously used only under XenServer.
Ben Pfaff [Wed, 6 Jul 2011 17:43:03 +0000 (10:43 -0700)]
ovs-bugtool: Add plugins previously used only under XenServer.

All of the xen-bugtool plugins that OVS has previously installed only under
XenServer are equally useful with Debian and other distributions, so
this commit installs and uses them everywhere.

12 years agoconfigure: Improve error message when pkg-config is missing.
Ben Pfaff [Wed, 13 Jul 2011 17:58:59 +0000 (10:58 -0700)]
configure: Improve error message when pkg-config is missing.

Until now, when pkg-config is missing, Autoconf emitted this error:
    error: possibly undefined macro: PKG_CHECK_MODULES
This commit changes the message to:
    error: Please install pkg-config.
This should be easier for users to interpret.

Suggested-by: Ethan Jackson <ethan@nicira.com>
12 years agotests: Fix deprecated use of qw.
Ethan Jackson [Tue, 12 Jul 2011 01:56:59 +0000 (18:56 -0700)]
tests: Fix deprecated use of qw.

This causes tests to fail on my system with the following error.

Use of qw(...) as parentheses is deprecated at
/home/root/ovs/tests/flowgen.pl line 35.

12 years agoovs-bugtool: Dump dpkg-related information as well as RPM-related info.
Ben Pfaff [Thu, 30 Jun 2011 21:55:28 +0000 (14:55 -0700)]
ovs-bugtool: Dump dpkg-related information as well as RPM-related info.

12 years agoovs-bugtool: Turn off "group" and "other" permissions for generated files.
Ben Pfaff [Tue, 12 Jul 2011 16:38:12 +0000 (09:38 -0700)]
ovs-bugtool: Turn off "group" and "other" permissions for generated files.

ovs-bugtool's output is potentially sensitive, so it seems best not to
allow anyone but the owner to read it.  This commit disables "group" and
"other" bits in the Unix ACL.

12 years agoovs-bugtool: Make available outside of Debian packages.
Ben Pfaff [Tue, 12 Jul 2011 16:37:08 +0000 (09:37 -0700)]
ovs-bugtool: Make available outside of Debian packages.

ovs-bugtool is no longer Debian-specific, so install it everywhere.  (On
XenServer, specifically, we do not install it, because there xen-bugtool
already exists.)

12 years agoovs-bugtool: Restore RHEL support.
Ben Pfaff [Thu, 30 Jun 2011 19:42:32 +0000 (12:42 -0700)]
ovs-bugtool: Restore RHEL support.

ovs-bugtool was originally xen-bugtool from Citrix XenServer.  We modified
it for OVS by tailoring it to work better on Debian, updating file
locations and removing features that were specific to XenServer or that
work with packages not installed by default on Debian.

This commit reverts many of those changes.  This commit:

  - Adds back code that works with RHEL features not installed by default
    on Debian (but not XenServer-specific features, since xen-bugtool works
    nicely on XenServer).

  - Switches from hard-coded paths for utilities to searching the
    superuser's typical $PATH (because RHEL and Debian disagree on the
    location for some utilities).

  - In a few cases merges lists, e.g. now it looks for logs under the names
    used in both Debian and RHEL.

  - Fixes a few spurious differences between ovs-bugtool and xen-bugtool,
    e.g. in white space.

12 years agodatapath: An expanded table should be larger than its predecessor
Simon Horman [Tue, 12 Jul 2011 06:52:44 +0000 (15:52 +0900)]
datapath: An expanded table should be larger than its predecessor

This resolves what appears to be a think-o in tbl_expand()

* Old Logic: Always create tables with TBL_MIN_BUCKETS buckets
* New Logic: Create tables twice as big as their predecessor

When sending 10,000 flows through ovs-vswitchd:
* Old Logic: CPU bound in tbl_lookup(), significant packet loss
* New Logic: ~10% of one core used, negligible packet loss

Tested with an Intel E5520 @ 2.27GHz,
flows from an ethernet device to to a dummy interface with
no address configured.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Jesse Gross <jesse@nicira.com>
12 years agoconfigure: Pass correct -target option to "cgcc" in the common case.
Ben Pfaff [Mon, 11 Jul 2011 20:57:58 +0000 (13:57 -0700)]
configure: Pass correct -target option to "cgcc" in the common case.

The "cgcc" script included with sparse guesses the target architecture
based on the host architecture instead of based on the GCC architecture.
This means that it often guesses wrong on biarch systems, e.g. my Linux
kernel is x86_64 but userspace is i686 and thus GCC targets i686 by
default.

This fixes the problem by passing an explicit "-target=i86" to cgcc if
GCC targets x86 or "-target=x86_64" if GCC targets x86_64.

Bug #6312.
Reported-by: Ethan Jackson <ethan@nicira.com>
12 years agoINSTALL.bridge: Fix suggested ovs-brcompatd invocation.
Ben Pfaff [Fri, 8 Jul 2011 23:56:08 +0000 (16:56 -0700)]
INSTALL.bridge: Fix suggested ovs-brcompatd invocation.

ovs-brcompatd no longer accepts any non-option arguments.  Also,
-vANY:console:EMER is unnecessary, because --detach now implies disabling
logging to the console.

12 years agoovsdb: Remove useless "return;" in ovsdb_jsonrpc_session_get_status().
Ben Pfaff [Sat, 9 Jul 2011 00:10:15 +0000 (17:10 -0700)]
ovsdb: Remove useless "return;" in ovsdb_jsonrpc_session_get_status().

12 years agopackets: Remove unneeded !! from eth_addr_is_local().
Ben Pfaff [Fri, 8 Jul 2011 17:47:22 +0000 (10:47 -0700)]
packets: Remove unneeded !! from eth_addr_is_local().

There's no value in using !! on an operand of && or || as done here.

12 years agovconn-stream: Always call the stream's run function from vconn_stream_run().
Ben Pfaff [Fri, 8 Jul 2011 16:11:55 +0000 (09:11 -0700)]
vconn-stream: Always call the stream's run function from vconn_stream_run().

The stream's run function ensures that data buffered in the stream itself
gets pushed to the network.  Only the SSL stream class has such a run
function, which means that SSL stream data failed to be pushed to the
remote peer in a timely manner in some cases.

Many thanks to Alex Yip for narrowing this down.

Reported-by: Alex Yip <alex@nicira.com>
Tested-by: Alex Yip <alex@nicira.com>
Bug #6221.

12 years agoovsdb-tool: Put version number in comment when compacting or converting.
Ben Pfaff [Thu, 7 Jul 2011 19:25:04 +0000 (12:25 -0700)]
ovsdb-tool: Put version number in comment when compacting or converting.

Adding the version number can make it clear what version of OVS screwed
something up as part of an upgrade or downgrade.