sliver-openvswitch.git
13 years agoofproto: Factor building of flow_removed messages out into ofp-util.
Ben Pfaff [Tue, 15 Mar 2011 16:49:14 +0000 (09:49 -0700)]
ofproto: Factor building of flow_removed messages out into ofp-util.

This removes some code from ofproto.c.

13 years agoovs-vsctl: Remove dead assignment.
Ethan Jackson [Tue, 29 Mar 2011 17:58:45 +0000 (10:58 -0700)]
ovs-vsctl: Remove dead assignment.

Noticed this last night while playing around with the clang static
analyzer.

13 years agoovs-vsctl: Remove dead code.
Ethan Jackson [Tue, 29 Mar 2011 00:46:43 +0000 (17:46 -0700)]
ovs-vsctl: Remove dead code.

Coverity #10710.

13 years agobridge: Always wait for MAC learning table and ports.
Ben Pfaff [Tue, 29 Mar 2011 17:08:16 +0000 (10:08 -0700)]
bridge: Always wait for MAC learning table and ports.

The test ofproto_has_primary_controller() is meaningless, since OFPP_NORMAL
can cause the MAC learning table and port bonding to be in use even when
there is a controller.

I see that this bug has been here since early 2009, when the OFPP_NORMAL
feature was introduced in the bridge.  (Obviously it's not a severe
problem.)

13 years agoxenserver: Wait for ovs-xapi-sync to exit in "stop" command.
Ben Pfaff [Mon, 28 Mar 2011 23:22:59 +0000 (16:22 -0700)]
xenserver: Wait for ovs-xapi-sync to exit in "stop" command.

It seems possible that "restart" or a quick application of "stop" then
"start" could kill ovs-xapi-sync without starting it again, if
ovs-xapi-sync takes a little while to die, long enough for the next
instance of it to see that its pidfile is still open and locked.

I hope that this fixes some odd races that we've noticed in the "restart"
command.

Signed-off-by: Ben Pfaff <blp@nicira.com>
13 years agodaemon: Avoid redundant code in already_running().
Ben Pfaff [Tue, 29 Mar 2011 16:44:55 +0000 (09:44 -0700)]
daemon: Avoid redundant code in already_running().

This function substantially duplicated read_pidfile(), so reuse that
code instead.

13 years agodaemon: Write "already running" message to log also.
Ben Pfaff [Tue, 29 Mar 2011 17:09:23 +0000 (10:09 -0700)]
daemon: Write "already running" message to log also.

Otherwise it's hard to diagnose later if the daemon failed to start because
it thinks that it is already running.

13 years agocfm: No longer keep track of bad remote MPs and MAIDS.
Ethan Jackson [Mon, 28 Mar 2011 20:10:12 +0000 (13:10 -0700)]
cfm: No longer keep track of bad remote MPs and MAIDS.

Ben pointed out that an attacker could cause OVS to use infinite
memory by sending a series of CCMs with different MAIDs.  Each
message would cause a remote_maid to be allocated and stored for
several seconds.

Since Commit 1c2e2d2fc8 (cfm: Don't report unexpected remote
endpoints) no longer reports unexpected remote MAIDS and MPs in the
database, the only reason to keep track of this information is for
debugging purposes.  In my judgment, it provides negligible useful
debugging information at the expense of significantly increased
code complexity.  This commit rips it out entirely.

13 years agoovsdb-tool: Fix cut-and-paste error in manpage.
Ben Pfaff [Mon, 28 Mar 2011 20:35:32 +0000 (13:35 -0700)]
ovsdb-tool: Fix cut-and-paste error in manpage.

Reported-by: Paul Ingram <paul@nicira.com>
13 years agoovs-brcompatd: Delete write-only variable.
Ben Pfaff [Fri, 25 Mar 2011 22:22:10 +0000 (15:22 -0700)]
ovs-brcompatd: Delete write-only variable.

13 years agocfm: Create new cfm/show appctl command.
Ethan Jackson [Fri, 25 Mar 2011 22:30:33 +0000 (15:30 -0700)]
cfm: Create new cfm/show appctl command.

This will be useful for debugging CFM problems in the future.

13 years agobridge: Write CFM updates more quickly.
Ethan Jackson [Fri, 25 Mar 2011 20:36:43 +0000 (13:36 -0700)]
bridge: Write CFM updates more quickly.

This commit causes updates to CFM status to be written immediately.
A rate limit of 1 second is introduced to avoid performance
problems.

13 years agocfm: Reduce missed CCM detection time.
Ethan Jackson [Fri, 25 Mar 2011 21:26:53 +0000 (14:26 -0700)]
cfm: Reduce missed CCM detection time.

The specification says that a fault should be signaled when 3.5 *
ccm_interval milliseconds have passed.  This commit respects that
requirement, possibly increasing the responsiveness of fault
detection slightly.

13 years agocfm: Don't report unexpected remote endpoints.
Ethan Jackson [Fri, 25 Mar 2011 01:36:56 +0000 (18:36 -0700)]
cfm: Don't report unexpected remote endpoints.

Before this patch, CFM would report unexpected remote maintenance
points in the database.  This commit no longer exposes this
information.

Information about precisely why a link is faulty is more interesting
to a system administrator debugging a problem than a controller
which will generally only care about whether or not a link is
faulty.  For simplicity sake, this commit removes this information
from the database where it was somewhat awkwardly placed.  In the
future it may be valuable to report the information through
ovs-appctl commands for debugging purposes.

13 years agocfm: Immediately signal fault on bad CCM reception.
Ethan Jackson [Fri, 25 Mar 2011 02:04:21 +0000 (19:04 -0700)]
cfm: Immediately signal fault on bad CCM reception.

Commit af5739857a (cfm: Immediately signal a fault upon receiving
an unexpected MPID.) caused the CFM library to immediately signal a
fault upon reception of an unexpected remote MPID.  This commit
does the same for MAIDs, and remote maintenance points with invalid
CCM intervals.

13 years agopackets: Move CFM related packet information to cfm header file.
Ethan Jackson [Fri, 25 Mar 2011 20:57:21 +0000 (13:57 -0700)]
packets: Move CFM related packet information to cfm header file.

13 years agoschema: Monitor's remote_mps is not ephemeral.
Ethan Jackson [Fri, 25 Mar 2011 00:53:16 +0000 (17:53 -0700)]
schema: Monitor's remote_mps is not ephemeral.

The remote_mps column of the Monitor table is a configuration
parameter and should not be ephemeral.

13 years agodatapath: Avoid memory leak in odp_packet_cmd_execute().
Ben Pfaff [Fri, 25 Mar 2011 00:06:58 +0000 (17:06 -0700)]
datapath: Avoid memory leak in odp_packet_cmd_execute().

The error path needs to free 'packet'.

Signed-off-by: Ben Pfaff <blp@nicira.com>
13 years agocfm: cfm_run() return ccm instead of packet.
Ethan Jackson [Tue, 22 Mar 2011 23:57:43 +0000 (16:57 -0700)]
cfm: cfm_run() return ccm instead of packet.

It doesn't really make sense for the CFM code to be composing
packets.  Its caller is better placed to compose the appropriate
L2 header.  This commit pulls that logic out of the CFM library.

13 years agopackets: Create new compose_packet() function.
Ethan Jackson [Wed, 23 Mar 2011 19:59:40 +0000 (12:59 -0700)]
packets: Create new compose_packet() function.

This commit generalizes compose_lacp_packet() into new
compose_packet() function.  This new function will be used to send
CCM messages in future patches.

13 years agocfm: Move destination address to cfm.h
Ethan Jackson [Tue, 22 Mar 2011 21:28:22 +0000 (14:28 -0700)]
cfm: Move destination address to cfm.h

Future patches will require the use of this information globally.

13 years agodatapath: Add compatibility with sk_buff's vlan_tci before 2.6.33.
Ben Pfaff [Wed, 23 Mar 2011 17:34:37 +0000 (10:34 -0700)]
datapath: Add compatibility with sk_buff's vlan_tci before 2.6.33.

Between 2.6.27 and 2.6.32, the vlan_tci member of struct sk_buff was the
raw value of the 802.1Q header's TCI field, without the CFI bit being set.
In 2.6.33 and later, the CFI bit is always set if an 802.1Q header is
present, correcting a corner case.

Until now, OVS has not consistently dealt with this.  If a packet arrived
at a datapath from a network device directly, or if it was set with an
ODP_ACTION_ATTR_SET_DL_TCI action, then the CFI bit would not be set in
vlan_tci.  In flow_extract(), OVS copies vlan_tci directly to dl_tci in the
flow structure (via vlan_get_tci()), so the CFI bit would also not be set
in dl_tci.  But if OVS had to send a packet up to userspace (converting the
vlan_tci back to an 802.1Q header along the way) and got it back, then it
would set the VLAN CFI bit in dl_tci when it parsed the 802.1Q header in
parse_vlan().  This had the effect that a flow set up by userspace (with
the CFI bit set) would never be matched by a packet arriving from a network
device, because they would have different dl_tci values.

This fixes the problem, by making the vlan_get_tci() and vlan_set_tci()
interface consistent across kernel versions.  Now, they always accept or
return a value where the VLAN CFI bit is set if an 802.1Q header is
present.

Build-tested only.

Problem isolated by Ethan Jackson <ethan@nicira.com>

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Reported-by: Ram Jothikumar <rjothikumar@nicira.com>
Bug #4915.

13 years agoofproto: Allow tunnel id to be in decimal or hex for trace command.
Justin Pettit [Wed, 23 Mar 2011 00:06:07 +0000 (17:06 -0700)]
ofproto: Allow tunnel id to be in decimal or hex for trace command.

Suggested-by: Pankaj Thakkar <thakkar@nicira.com>
13 years agoodp-util: Print tunnel ids in host-order.
Justin Pettit [Tue, 22 Mar 2011 23:45:03 +0000 (16:45 -0700)]
odp-util: Print tunnel ids in host-order.

Suggested-by: Pankaj Thakkar <thakkar@nicira.com>
13 years agogitignore: Added ovs-vlan-bug-workaround and tests
Ethan Jackson [Wed, 23 Mar 2011 02:11:50 +0000 (19:11 -0700)]
gitignore: Added ovs-vlan-bug-workaround and tests

13 years agoutilities: Add ovs-vlan-bug-workaround to make distclean
Ethan Jackson [Wed, 23 Mar 2011 01:55:53 +0000 (18:55 -0700)]
utilities: Add ovs-vlan-bug-workaround to make distclean

This was causing and error during make distcheck for me.

13 years agovswitchd: Properly calculate output port.
Ethan Jackson [Tue, 22 Mar 2011 22:31:59 +0000 (15:31 -0700)]
vswitchd: Properly calculate output port.

This was causing segfaults on my system.

13 years agoxenserver: Collect /proc/slabinfo in a Server Status Report
Sajjad Lateef [Tue, 22 Mar 2011 18:17:33 +0000 (11:17 -0700)]
xenserver: Collect /proc/slabinfo in a Server Status Report

/proc/slabinfo gives information about memory usage
as slab level and can be used to diagnose memory issues
on memory-limited systems

13 years agovswitchd: Destroy lacp in port_destroy().
Ethan Jackson [Tue, 22 Mar 2011 20:30:15 +0000 (13:30 -0700)]
vswitchd: Destroy lacp in port_destroy().

Port destruction could cause dangling lacp objects to live in the
lacp module's 'all_lacps' list.  This could cause bogus output for
the lacp/show appctl command.

Bug #5088.

13 years agobridge: Memory leak in port_destroy()
Ethan Jackson [Tue, 22 Mar 2011 20:16:24 +0000 (13:16 -0700)]
bridge: Memory leak in port_destroy()

13 years agobridge: Change bridge's 'ports' member from array to hmap.
Ben Pfaff [Mon, 21 Mar 2011 17:07:39 +0000 (10:07 -0700)]
bridge: Change bridge's 'ports' member from array to hmap.

In my opinion, this makes the code more obviously correct in many places,
because there are generally fewer variables.  One must generally keep two
variables in sync for iterating through an array: the array index and the
contents of the array at that index.  For iterating through an hmap, only
the map element is necessary.

A linked list would also be a reasonable choice for the bridge's collection
of ports.  I chose to use an hmap because we already had an index by name
and it seemed OK to use only one index.  I decided not to keep the shash
because they are less convenient for iteration than an hmap.

13 years agobridge: Avoid flushing entire MAC learning table for common operations.
Ben Pfaff [Fri, 18 Mar 2011 22:42:29 +0000 (15:42 -0700)]
bridge: Avoid flushing entire MAC learning table for common operations.

Adding and removing ports is fairly common in a virtual environment,
because it happens whenever a VM boots or shuts down.  It is best to
avoid flushing the whole MAC learning table when that happens, because
that means that, briefly, every packet will get flooded, wasting CPU cycles
and network bandwidth.

This commit breaks flushing the MAC table out of bridge_flush().  Instead,
each caller is now responsible for flushing the MAC table if it is
necessary.  In a few cases, no flushing was necessary, so those callers
were not modified.  In the case of removing a port or modifying its VLAN
assignments, it is necessary to expire all of the MAC learning entries
associated with that port, so this commit does that.  Finally, some
operations do require a MAC learning flush but they are rare enough that
in my opinion it's not worth taking care to avoid a MAC table flush.

Bug #891.

13 years agomac-learning: Expose function for expiring a single MAC learning entry.
Ben Pfaff [Fri, 18 Mar 2011 22:28:21 +0000 (15:28 -0700)]
mac-learning: Expose function for expiring a single MAC learning entry.

The bridge will soon use this for expiring only the MAC learning entries
associated with a given port at port deletion time.

13 years agobridge: Use pointer to "struct port", not "port_idx", for MAC learning.
Ben Pfaff [Tue, 22 Mar 2011 16:57:06 +0000 (09:57 -0700)]
bridge: Use pointer to "struct port", not "port_idx", for MAC learning.

This takes a step toward changing the data structure used for keeping
track of ports from an array to a more appropriate data structure.

13 years agomac-learning: Change 'port' member to a union.
Ben Pfaff [Fri, 18 Mar 2011 22:03:24 +0000 (15:03 -0700)]
mac-learning: Change 'port' member to a union.

This allow the client a little more flexibility.  The next commit shows
how this can be useful.

13 years agomac-learning: Refactor to increase generality.
Ben Pfaff [Tue, 22 Mar 2011 16:47:02 +0000 (09:47 -0700)]
mac-learning: Refactor to increase generality.

In an upcoming commit I want to store a pointer in MAC learning entries
in the bridge, instead of an integer port number.  The MAC learning library
has other clients, and the others do not gracefully fit this new model, so
in fact the data will have to become a union.  However, this does not fit
well with the current mac_learning API, since mac_learning_learn()
currently initializes and compares the data.  It seems better to break up
the API so that only the client has to know the data's format and how to
initialize it or compare it.  This commit makes this possible.

This commit doesn't change the type of the data stored in a MAC learning
entry yet.

As a side effect this commit has the benefit that clients that don't need
gratuitous ARP locking don't have to specify any policy for it at all.

13 years agobridge: Change port's 'ifaces' member from array to list.
Ben Pfaff [Mon, 21 Mar 2011 17:24:32 +0000 (10:24 -0700)]
bridge: Change port's 'ifaces' member from array to list.

In my opinion, this makes the code more obviously correct in many places,
because there are generally fewer variables.  One must generally keep two
variables in sync for iterating through an array: the array index and the
contents of the array at that index.  For iterating through a list, only
the list element is necessary.

13 years agobridge: Get rid of "port_ifidx" in struct iface. Fix bonding hash.
Ben Pfaff [Mon, 21 Mar 2011 20:25:02 +0000 (13:25 -0700)]
bridge: Get rid of "port_ifidx" in struct iface.  Fix bonding hash.

This is a first step toward changing the array of ifaces in struct port
to a more suitable data structure.

As a side effect this fixes a bonding problem that I noticed via code
inspection.  Before this commit, each bond_entry specified an interface
via index.  If an iface was deleted, however, this shifted all of the
iface indexes, and the code didn't compensate for that.  This commit fixes
the problem by using pointers to ifaces instead, which don't shift around.

13 years agobridge: Expire bond slave assignments when their loads decay to 0.
Ben Pfaff [Fri, 18 Mar 2011 00:12:40 +0000 (17:12 -0700)]
bridge: Expire bond slave assignments when their loads decay to 0.

Until now, if a given MAC ever transmitted, then it would always show up
in bond information output.  There's no benefit to that if the MAC has
gone away permanently.  This commit causes them to be deleted when their
load has gone to 0.  This takes a fairly long time: if a MAC has sent, say,
one million bytes and then stops transmitting entirely, then it will take
about 20 rebalancing intervals (200 seconds) before it decays to 0 and
gets deleted.

Bug #2157.

13 years agobridge: Improve name and comments for bond_entry's "iface_tag" member.
Ben Pfaff [Thu, 17 Mar 2011 23:29:55 +0000 (16:29 -0700)]
bridge: Improve name and comments for bond_entry's "iface_tag" member.

The iface_tag name and comment implied that it was really just a copy of
the 'tag' member of struct iface, but in fact it has a completely different
purpose: it represents the binding of a bond_entry to a particular iface.
It is invalidated when the bond_entry has to be redirected to a different
iface, not when the iface itself changes.  I hope that this commit helps
to clarify.

13 years agobridge: Change struct port's active_iface member from index to pointer.
Ben Pfaff [Thu, 17 Mar 2011 22:57:20 +0000 (15:57 -0700)]
bridge: Change struct port's active_iface member from index to pointer.

This makes the code easier to understand.

As a historical note, the "bridge" code was originally written in an
almighty hurry, and so some design decisions were made on the basis of
being unlikely to cause serious bugs instead of on the basis of being
easy to understand.  That's why there are so many array indexes sprinkled
around the bridge data structures, and so much range checking of their
values, when it would be better to just have pointers that can be followed
directly.  I figured that getting the wrong index would at least do
something half-reasonable in most cases, whereas dereferencing a freed
pointer was likely to segfault sooner or later and cause immediate failure.

But now I think it's time to improve the code.  The code is mature enough
now that we should be able to thoroughly understand the data lifetime
issues.

13 years agobridge: Get rid of redundant bridge_get_local_iface() function.
Ben Pfaff [Thu, 17 Mar 2011 22:38:08 +0000 (15:38 -0700)]
bridge: Get rid of redundant bridge_get_local_iface() function.

Not only was this function redundant, it managed to spend O(n) time doing
a task that should take only O(1)!

13 years agobridge: Drop 'active_iface_tag' from "struct port".
Ben Pfaff [Thu, 17 Mar 2011 22:26:43 +0000 (15:26 -0700)]
bridge: Drop 'active_iface_tag' from "struct port".

I cannot see a reason to have an active_iface_tag that is different from
the tag on the active_iface.  As far as I can see, we can just get rid of
it.

13 years agobridge: Don't bother revalidating in combination with bridge_flush().
Ben Pfaff [Thu, 17 Mar 2011 22:14:46 +0000 (15:14 -0700)]
bridge: Don't bother revalidating in combination with bridge_flush().

iface_destroy() always calls bridge_flush(), which causes every flow to be
revalidated, so there is no point in revalidating individual tags also.

13 years agoxenserver: Don't require other-config:disable-in-band to exist.
Ben Pfaff [Mon, 21 Mar 2011 21:39:45 +0000 (14:39 -0700)]
xenserver: Don't require other-config:disable-in-band to exist.

other-config:disable-in-band is optional but the ovs-vsctl "get" command
by default requires its target to exist.  Adding --if-exists allows it
to be missing.

Reported-by: Henrik Amren <henrik@nicira.com>
Bug #5056.

13 years agolist: Allow list_front(), list_back() to take 'const' arguments.
Ben Pfaff [Mon, 21 Mar 2011 21:06:35 +0000 (14:06 -0700)]
list: Allow list_front(), list_back() to take 'const' arguments.

It totally makes sense to pass a const struct list * to one of these
functions.  Ideally the return type would be the same as the argument
type but C can't handle that, so this is the best second choice.

13 years agolist: Fix indentation.
Ben Pfaff [Mon, 21 Mar 2011 21:03:35 +0000 (14:03 -0700)]
list: Fix indentation.

13 years agobridge: Always delete the correct interfaces in port_del_ifaces().
Ben Pfaff [Fri, 18 Mar 2011 17:56:28 +0000 (10:56 -0700)]
bridge: Always delete the correct interfaces in port_del_ifaces().

This code was checking a name from cfg->interfaces[i] but using the result
to decide whether to delete port->ifaces[i].  The two arrays aren't
necessarily in the same order so this code could delete the wrong iface.

Found by inspection.  This is probably not a common problem in practice
because I imagine that deleting an interface from a bond, without deleting
the bond itself, is a rare operation.  The problem would also be
intermittent--after a few switch reconfiguration cycles I imagine that
the problem would resolve.

13 years agoofproto: Take responsibility for connectivity fault management (CFM).
Ben Pfaff [Fri, 18 Mar 2011 23:56:31 +0000 (16:56 -0700)]
ofproto: Take responsibility for connectivity fault management (CFM).

This takes one step toward the larger goal of getting rid of all of the
hooks from ofproto back into vswitchd, by eliminating one of the reasons
that they are required.

13 years agoofproto: Specialize ofproto_send_packet() for uses the callers really want.
Ben Pfaff [Wed, 16 Mar 2011 20:54:10 +0000 (13:54 -0700)]
ofproto: Specialize ofproto_send_packet() for uses the callers really want.

The callers of ofproto_send_packet() actually just want to send a packet
out on a port, possibly tagged with a VLAN, but the interface forced them
to compose a set of OpenFlow actions, which made it harder to use than
necessary.  This commit specializes the interface for the purposes that
the callers really wanted, making it easier to use.

handle_miss_upcall() can now take advantage of this function, too.

13 years agocfm: Immediately signal a fault upon receiving an unexpected MPID.
Ben Pfaff [Wed, 16 Mar 2011 21:32:38 +0000 (14:32 -0700)]
cfm: Immediately signal a fault upon receiving an unexpected MPID.

An unexpected MPID is always a fault, but the CFM code didn't signal the
fault until the next time cfm_run() was called.  In one experiment I
saw a visible lag in the database (although I wasn't able to reproduce it
again within a few tries).

13 years agobridge: Consistently use miimon status if miimon is configured.
Ben Pfaff [Thu, 17 Mar 2011 17:48:05 +0000 (10:48 -0700)]
bridge: Consistently use miimon status if miimon is configured.

A port can be configured to use miimon reporting as the criterion for
enabling or disabling an interface, but in some cases (such as for reading
the initial link status) the code was reading the carrier status instead.
This commit fixes the problem.

This changes the meaning of the link_status column in the Interface table.
I don't think that the old meaning was useful to the controller in the
case of a bond configured for miimon monitoring, because the controller
could not use it to detect which interfaces the bond considered to be up
or down.

13 years agodatapath: Use ipv4_dst_hoplimit() instead of direct access.
Jesse Gross [Fri, 18 Mar 2011 21:37:33 +0000 (14:37 -0700)]
datapath: Use ipv4_dst_hoplimit() instead of direct access.

In 2.6.38 dst metrics became shared and use copy-on-write instead
of using private versions.  This means that it is no longer permissible
to directly access the metric and we need to use the helper function
instead.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
13 years agodatapath: Backport ip4_dst_hoplimit() from 2.6.38.
Jesse Gross [Fri, 18 Mar 2011 21:43:51 +0000 (14:43 -0700)]
datapath: Backport ip4_dst_hoplimit() from 2.6.38.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
13 years agoovs-ofctl: Make mod-flows and del-flows commands able read files.
Ben Pfaff [Fri, 11 Mar 2011 21:19:12 +0000 (13:19 -0800)]
ovs-ofctl: Make mod-flows and del-flows commands able read files.

This makes it possible to modify or delete multiple flows in one run,
which is sometimes convenient.

Requested-by: Paul Ingram <paul@nicira.com>
13 years agoofp-parse: Generalize parse_ofp_add_flow_file() to parse_ofp_flow_mod_file().
Ben Pfaff [Fri, 18 Mar 2011 21:41:22 +0000 (14:41 -0700)]
ofp-parse: Generalize parse_ofp_add_flow_file() to parse_ofp_flow_mod_file().

An upcoming commit will want to pass a different command.

13 years agoovs-ofctl: New commands "replace-flows" and "diff-flows".
Ben Pfaff [Fri, 11 Mar 2011 20:02:27 +0000 (12:02 -0800)]
ovs-ofctl: New commands "replace-flows" and "diff-flows".

Requested-by: Paul Ingram <paul@nicira.com>
13 years agoovs-ofctl: Use ovs_be32 for big-endian variable.
Ben Pfaff [Fri, 11 Mar 2011 19:56:25 +0000 (11:56 -0800)]
ovs-ofctl: Use ovs_be32 for big-endian variable.

13 years agoofpbuf: New function ofpbuf_steal_data().
Ben Pfaff [Fri, 11 Mar 2011 19:52:49 +0000 (11:52 -0800)]
ofpbuf: New function ofpbuf_steal_data().

This will have its first use in an upcoming commit.

13 years agovlog: Add comment describing the purpose of each log level.
Ben Pfaff [Fri, 18 Mar 2011 17:10:20 +0000 (10:10 -0700)]
vlog: Add comment describing the purpose of each log level.

Based on descriptions from internal wiki.

13 years agolacp: Enable "fast" lacp timing mode.
Ethan Jackson [Wed, 9 Mar 2011 00:34:20 +0000 (16:34 -0800)]
lacp: Enable "fast" lacp timing mode.

13 years agolacp: Transmit more judiciously.
Ethan Jackson [Wed, 9 Mar 2011 02:32:58 +0000 (18:32 -0800)]
lacp: Transmit more judiciously.

Only transmit when the LACP partner needs to be updated instead of
whenever it might need to be updated.

13 years agovswitchd: Modularize LACP.
Ethan Jackson [Mon, 28 Feb 2011 22:48:06 +0000 (14:48 -0800)]
vswitchd: Modularize LACP.

This commit pulls LACP code out of the bridge into its own LACP
module.  Currently this module is only used by the existing bonding
infrastructure.

13 years agovswitchd: Update lacp before bonding.
Ethan Jackson [Wed, 9 Mar 2011 01:20:01 +0000 (17:20 -0800)]
vswitchd: Update lacp before bonding.

Bonding requires lacp attached status to make decisions about which
links are enabled.  However, LACP does not require any bonding
related information (other than which links are aggregated) to
perform.  Having them reversed causes some subtle bugs in the
bonding code's responsiveness to LACP changes.

13 years agopackets: Rename LACP portid and sysid to port_id and sys_id.
Ethan Jackson [Thu, 3 Mar 2011 18:34:22 +0000 (10:34 -0800)]
packets: Rename LACP portid and sysid to port_id and sys_id.

This seems more stylistically consistent with the rest of the
code base and the sys_priority and port_priority in the same
struct.

13 years agopackets: create new compose_lacp_pdu() function.
Ethan Jackson [Tue, 1 Mar 2011 21:27:23 +0000 (13:27 -0800)]
packets: create new compose_lacp_pdu() function.

Creates new compose_lacp_pdu() from the old compose_lacp_packet()
function.  This will allow a LACP PDU to be created without
necessarily knowing the Ethernet Source Address required for
generating the packet.  Future patches rely on this functionality.

13 years agobridge: Pull monitoring out of bonding logic.
Ethan Jackson [Tue, 22 Feb 2011 22:19:18 +0000 (14:19 -0800)]
bridge: Pull monitoring out of bonding logic.

The monitoring logic and bonding code are unrelated.  This commit
pulls the monitoring logic out.  As a result all interfaces, not
just those participating in bonds, are monitored.  This will be
required to run LACP on non-bonded ports.

Also removes the miimon flag from the port structure.

13 years agoovs-vsctl: Back out garbage collection changes.
Ethan Jackson [Wed, 16 Mar 2011 22:06:37 +0000 (15:06 -0700)]
ovs-vsctl: Back out garbage collection changes.

Garbage collection introduced in
c5f341ab193b9126dffef8c77bf8ed35e91290fd changed ovs-vsctl so that
it would allow the garbage collector to reclaim unused tables
instead of manually deleting them itself.  Since garbage collection
runs at transaction completion, undeleted tables would hang around
and could conflict with future actions in a given transaction.
This commit backs out this change.

The following command is an example of something that would have
failed before this commit.

ovs-vsctl -- add-br b \
-- del-br b           \
-- add-br b           \
-- set Interface b other_config:test=test

13 years agoutilities: Fix typo in makefile that caused RPM build failure.
Ben Pfaff [Wed, 16 Mar 2011 22:45:25 +0000 (15:45 -0700)]
utilities: Fix typo in makefile that caused RPM build failure.

I tested this against our autobuilder and it passed.

13 years agoofproto: Remove controller discovery support.
Ben Pfaff [Tue, 15 Mar 2011 16:46:39 +0000 (09:46 -0700)]
ofproto: Remove controller discovery support.

I've never heard of anyone actually using controller discovery.
It adds a great deal of code to the source tree, and a little
bit of complication to ofproto, so this commit removes it.

13 years agoofproto: Get rid of archaic "switch status" OpenFlow extension.
Ben Pfaff [Fri, 4 Feb 2011 21:17:46 +0000 (13:17 -0800)]
ofproto: Get rid of archaic "switch status" OpenFlow extension.

Back in 2008 or so, I introduced this extension as a way to provide
information about switch status to the new "switch UI" program.  Since
then, the switch UI program has been removed and the important information
that was provided by the switch status extension is now available in the
database, so we might as well get rid of this extension, and that is what
this commit does.

13 years agoofproto: Fix obsolete comments.
Ben Pfaff [Fri, 11 Mar 2011 22:22:21 +0000 (14:22 -0800)]
ofproto: Fix obsolete comments.

"secchan" is long gone.

13 years agoofproto: Fix comment on send_packet_in().
Ben Pfaff [Fri, 4 Feb 2011 23:34:45 +0000 (15:34 -0800)]
ofproto: Fix comment on send_packet_in().

13 years agoofproto: Don't include unneeded header file.
Ben Pfaff [Fri, 4 Feb 2011 20:31:57 +0000 (12:31 -0800)]
ofproto: Don't include unneeded header file.

13 years agodynamic-string: New function ds_get_preprocessed_line().
Ben Pfaff [Fri, 11 Mar 2011 19:52:12 +0000 (11:52 -0800)]
dynamic-string: New function ds_get_preprocessed_line().

This commit adds one user.  It will be useful elsewhere in an upcoming
commit.

13 years agoofp-util: New function ofputil_decode_flow_stats_reply().
Ben Pfaff [Thu, 10 Mar 2011 23:02:05 +0000 (15:02 -0800)]
ofp-util: New function ofputil_decode_flow_stats_reply().

This function will see more use later in this series.  This commit just
starts using it to make ofp-print output entirely consistent for
OFPST_FLOW and NXST_FLOW replies.

13 years agoovs-ofctl: Check min flow format support in negotiate_highest_flow_format().
Ben Pfaff [Thu, 10 Mar 2011 19:07:10 +0000 (11:07 -0800)]
ovs-ofctl: Check min flow format support in negotiate_highest_flow_format().

When the -F option wasn't set, or if it was set to an invalid flow format
for the match, this code would happily select a flow format that did not
select the user's requested match if the switch didn't support an
advanced-enough flow format.  This fixes the problem.  It also changes
behavior in the case where the user specifies a flow format that cannot
represent the match, changing this from a warning to a fatal error; this
is consistent with -F behavior for flow_mod commands.

13 years agoclassifier: Omit all-1-bits mask for VLAN TCI in cls_rule_format().
Ben Pfaff [Thu, 10 Mar 2011 22:51:30 +0000 (14:51 -0800)]
classifier: Omit all-1-bits mask for VLAN TCI in cls_rule_format().

To me, this seems to be easier to read.

13 years agoofp-print: Consistently print priority only if it is not default.
Ben Pfaff [Thu, 10 Mar 2011 22:59:06 +0000 (14:59 -0800)]
ofp-print: Consistently print priority only if it is not default.

In NXST_FLOW replies, the priority was printed only if it was not
OFP_DEFAULT_PRIORITY, but it was always printed in OFPST_FLOW replies.
This commit changes OFPST_FLOW replies to match NXST_FLOW replies.

13 years agotests: Fix up interface-reconfigure test and results.
Ben Pfaff [Wed, 16 Mar 2011 21:51:41 +0000 (14:51 -0700)]
tests: Fix up interface-reconfigure test and results.

I forgot to update the test when I added the VLAN bug workaround.

13 years agoSupport vlan_group workaround implemented in XenServer kernels.
Ben Pfaff [Wed, 16 Mar 2011 21:39:17 +0000 (14:39 -0700)]
Support vlan_group workaround implemented in XenServer kernels.

Some Linux network drivers support a feature called "VLAN acceleration",
associated with a data structure called a "vlan_group".  A vlan_group is,
abstractly, a dictionary that maps from a VLAN ID (in the range 0...4095)
to a VLAN device, that is, a Linux network device associated with a
particular VLAN, e.g. "eth0.9" for VLAN 9 on eth0.

Some drivers that support VLAN acceleration have bugs that fall roughly
into the following categories:

    * Some NICs strip VLAN tags on receive if no vlan_group is registered,
      so that the tag is completely lost.

    * Some drivers size their receive buffers based on whether a vlan_group
      is enabled, meaning that a maximum size packet with a VLAN tag will
      not fit if a vlan_group is not configured.

    * On transmit some drivers expect that VLAN acceleration will be used
      if it is available (which can only be done if a vlan_group is
      configured).  In these cases, the driver may fail to parse the packet
      and correctly setup checksum offloading and/or TSO.

The correct long term solution is to fix these driver bugs.  To cope until
then, we have prepared a patch to the Linux kernel network stack that works
around these problems.  This commit adds support for the workaround
implemented by that patch.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
13 years agobridge: Create new port_run() function.
Ethan Jackson [Tue, 22 Feb 2011 22:38:11 +0000 (14:38 -0800)]
bridge: Create new port_run() function.

13 years agohtb: Set required min-rate to mtu not 1500.
Ethan Jackson [Tue, 15 Mar 2011 21:57:12 +0000 (14:57 -0700)]
htb: Set required min-rate to mtu not 1500.

13 years agohfsc: min-rate tweaks.
Ethan Jackson [Mon, 14 Mar 2011 21:27:50 +0000 (14:27 -0700)]
hfsc: min-rate tweaks.

There doesn't appear to be any reason to enforce a minimum min-rate
of 1500Bps on queues. This commit lowers the minimum to 1Bps.  A
min-rate of 0 is not allowed by hfsc in the kernel.

13 years agoqos: Remove min-rate requirement for linux-htb and linux-hfsc.
Ethan Jackson [Tue, 15 Mar 2011 18:50:53 +0000 (11:50 -0700)]
qos: Remove min-rate requirement for linux-htb and linux-hfsc.

One could quite reasonably desire to create a queue with no
min-rate.  For example, a default queue could be reasonably
configured without a min-rate or a max-rate.  This commit removes
the requirement that min-rate be configured on all queues.  If not
configured, defaults to something very small.

13 years agoreconnect.py: Fix Python 2.4 compatibility break.
Andrew Evans [Tue, 15 Mar 2011 21:42:49 +0000 (14:42 -0700)]
reconnect.py: Fix Python 2.4 compatibility break.

Commit 5eda645e36 (ovsdb-server: Report time since last connect and disconnect
for each manager.) used a conditional expression in reconnect.py. That syntax
is only supported in Python 2.5 and later. XenServer 5.6 is based on RHEL 5,
which uses Python 2.4.3, so various OVS scripts on XenServer fail with Python
tracebacks.

Reported-by: Cedric Hobbs <cedric@nicira.com>
13 years agovswitchd: Dump QoS with appctl.
Ethan Jackson [Fri, 11 Mar 2011 21:44:16 +0000 (13:44 -0800)]
vswitchd: Dump QoS with appctl.

The source of truth for QoS statistics on a given interface is tc.
Unfortunately, output from tc can be a little bit confusing and
does not follow the same data model as OVS.  This commit adds a
"qos/show" appctl command which gives friendlier output.

13 years agobridge: Downgrade log level of some log messages that may indicate races.
Ben Pfaff [Mon, 14 Mar 2011 22:28:32 +0000 (15:28 -0700)]
bridge: Downgrade log level of some log messages that may indicate races.

Some legitimate system activity can cause network devices to be destroyed
just before they are removed from the database, added to the database
just before they are created, or destroyed and then recreated under the
same name while other database activity is going on.  Logging these
events as errors makes it sound like something unexpectedly bad is going
on, but in fact these events are the most common instances of these log
messages, so downgrade them to warnings.

Reported-by: Reid Price <reid@nicira.com>
Bug #2584.

13 years agoovsdbmonitor: Fix "make install" race.
Ben Pfaff [Mon, 14 Mar 2011 23:39:28 +0000 (16:39 -0700)]
ovsdbmonitor: Fix "make install" race.

In a parallel make, the install-exec-local target runs concurrently with
the creation of the directory that it installs into.  Fix the race by
using the install-exec-hook target instead, which runs subsequently to
directory creation.

13 years agodebian: Restart daemons only after upgrade is complete.
Ben Pfaff [Mon, 14 Mar 2011 22:13:49 +0000 (15:13 -0700)]
debian: Restart daemons only after upgrade is complete.

This yields less downtime during an upgrade and allows an SSH session or
other network access to dpkg to continue during the upgrade to, e.g.,
answer questions about conffiles from dpkg.  (Open vSwitch doesn't have
any conffiles but other packages being upgraded in the same dpkg run
might.)

Bug #542.

13 years agodebian: Run tests in parallel too.
Ben Pfaff [Mon, 14 Mar 2011 22:11:39 +0000 (15:11 -0700)]
debian: Run tests in parallel too.

Passing e.g. -j4 in TESTSUITEFLAGS runs 4 tests in parallel, which speeds
up the testsuite.

13 years agoxenserver: dbcache should always exist so don't bother checking.
Ben Pfaff [Mon, 14 Mar 2011 21:14:34 +0000 (14:14 -0700)]
xenserver: dbcache should always exist so don't bother checking.

Open vSwitch introduced the on-disk database cache a long time ago.  Since
then, Citrix has integrated it upstream into XenServer's
interface-reconfigure and even into their installer.  OVS no longer
supports XenServer before 5.6.100, so it is no longer necessary to check
for and create the database cache if it isn't there.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Bug #3388.

13 years agonetdev-vport: Log at ERR level when port won't be created.
Justin Pettit [Mon, 14 Mar 2011 20:45:43 +0000 (13:45 -0700)]
netdev-vport: Log at ERR level when port won't be created.

Suggested-by: Ben Pfaff <blp@nicira.com>
13 years agonetdev-vport: Don't create port when ovs-monitor-ipsec not running.
Justin Pettit [Mon, 14 Mar 2011 20:15:25 +0000 (13:15 -0700)]
netdev-vport: Don't create port when ovs-monitor-ipsec not running.

It was suggested by Jesse that it would be better to just not create
IPsec tunnel devices if the ovs-monitor-ipsec daemon is not running.  He
had legitimate concerns about users missing the warning message printed
and traffic possibly going out unencrypted.

Suggested-by: Jesse Gross <jesse@nicira.com>
13 years agoofproto: Store time since last connect and disconnect in Controller table.
Andrew Evans [Mon, 14 Mar 2011 20:19:20 +0000 (13:19 -0700)]
ofproto: Store time since last connect and disconnect in Controller table.

ovs-vswitchd writes only the duration of its connection to or disconnection
from each controller to the database. This changes that behavior to write the
time since both the last connection and disconnection events regardless of
connection state. This mirrors the new behavior for reporting database manager
connection status.

Requested-by: Peter Balland <peter@nicira.com>
Bug #4833.

13 years agoovsdb-server: Report time since last connect and disconnect for each manager.
Andrew Evans [Mon, 14 Mar 2011 20:10:02 +0000 (13:10 -0700)]
ovsdb-server: Report time since last connect and disconnect for each manager.

Only the time connected (if connected) or disconnected (if disconnected) is
currently reported for each manager. Change to reporting both in seconds since
the last connect and disconnect events respectively. An empty value indicates
no previous connection or disconnection.

This can help diagnose certain connectivity problems, e.g. flapping.

Requested-by: Peter Balland <peter@nicira.com>
Bug #4833.

13 years agoofp-print: Omit timestamp when printing packets in ofp_packet_to_string().
Ben Pfaff [Mon, 14 Mar 2011 16:46:19 +0000 (09:46 -0700)]
ofp-print: Omit timestamp when printing packets in ofp_packet_to_string().

There's no value in the timestamp here, because it will always be the
same.  Printing it just makes results less reproducible because output
then depends on the time zone.

This fixes a test failure in California due to yesterday's DST change,
and presumably a test failure almost everywhere else all the time.

Reported-by: Andrew Evans <aevans@nicira.com>
13 years agodatapath: Check for backported dev_get_by_index_rcu().
Jesse Gross [Fri, 11 Mar 2011 23:16:02 +0000 (15:16 -0800)]
datapath: Check for backported dev_get_by_index_rcu().

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
13 years agodatapath: Use compat directory only for backported code.
Jesse Gross [Fri, 11 Mar 2011 22:58:18 +0000 (14:58 -0800)]
datapath: Use compat directory only for backported code.

Most necessary compatibility code is simply backported versions
of kernel functions from newer kernels.  These belong in the compat
directory, where they can be transparently picked up when necessary.
However, in some situations there is code that is different
depending on the kernel version but is always needed in some form.
Here it is desirable to segregate the code but it does not really
belong in the compat directory because it does not exist in upstream
kernels.  This moves those functions to a compat file, which makes
the meaning clear and prevents problems when Open vSwitch is integrated
into other projects.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
13 years agosystem-stats: Don't bother calling kill() after read_pidfile().
Justin Pettit [Sun, 13 Mar 2011 08:01:53 +0000 (00:01 -0800)]
system-stats: Don't bother calling kill() after read_pidfile().

The function read_pidfile() will only return a PID if the process is
still running, so there's no reason to send a signal to check again.

Suggested-by: Andrew Evans <aevans@nicira.com>