Ben Pfaff [Fri, 25 Mar 2011 22:15:33 +0000 (15:15 -0700)]
bridge: Convert svecs to ssets.
Ben Pfaff [Fri, 25 Mar 2011 22:11:05 +0000 (15:11 -0700)]
ovs-openflowd: Use sset in place of svec.
Also deletes svec_split() since this was the only user.
Ben Pfaff [Fri, 25 Mar 2011 22:04:12 +0000 (15:04 -0700)]
ofproto: Change string sets in interface from svec to sset.
Ben Pfaff [Fri, 25 Mar 2011 20:20:35 +0000 (13:20 -0700)]
ovsdb-parser: Use sset instead of svec for detecting unused members.
Should be slightly cheaper than sorting a list (O(n) vs. O(n lg n)).
Ben Pfaff [Fri, 25 Mar 2011 20:04:47 +0000 (13:04 -0700)]
netdev: Use sset instead of svec in netdev interface.
Ben Pfaff [Fri, 25 Mar 2011 20:00:13 +0000 (13:00 -0700)]
dpif: Use sset instead of svec in dpif interface.
Ben Pfaff [Fri, 25 Mar 2011 22:26:30 +0000 (15:26 -0700)]
Convert shash users that don't use the 'data' value to sset instead.
In each of the cases converted here, an shash was used simply to maintain
a set of strings, with the shash_nodes' 'data' values set to NULL. This
commit converts them to use sset instead.
Ben Pfaff [Wed, 30 Mar 2011 20:44:10 +0000 (13:44 -0700)]
sset: New data type for a set of strings.
Many uses of "shash" or "svec" data structures really call for a "set of
strings" data type. This commit introduces such a data structure. Later
commits convert inappropriate uses of shash and svec to use sset instead.
Ethan Jackson [Tue, 29 Mar 2011 19:37:49 +0000 (12:37 -0700)]
learning-switch: Remove dead assignment.
Ethan Jackson [Thu, 31 Mar 2011 23:38:56 +0000 (16:38 -0700)]
ovs-ofctl: Remove dead assignment.
Ethan Jackson [Tue, 29 Mar 2011 19:25:17 +0000 (12:25 -0700)]
netdev-linux: Remove dead assignments.
Ethan Jackson [Thu, 31 Mar 2011 20:55:23 +0000 (13:55 -0700)]
ofproto: Use new timer library.
Ethan Jackson [Thu, 31 Mar 2011 20:54:44 +0000 (13:54 -0700)]
cfm: Use new timer library.
Ethan Jackson [Thu, 31 Mar 2011 20:54:15 +0000 (13:54 -0700)]
lacp: Use new timer library.
Ethan Jackson [Thu, 31 Mar 2011 20:46:04 +0000 (13:46 -0700)]
lib: Create new timer library.
Scattered throughout the code base we use long integers to
implement timers. When the result of timer_msec() is greater than
the time stored, we preform some action.
This commit creates a new timer library intended to replace these
manually managed timers. Code using the timer library will be more
obviously correct, and more consistent with other code using the
library.
Ethan Jackson [Thu, 31 Mar 2011 23:12:01 +0000 (16:12 -0700)]
cfm: Fix appctl negative report.
When the cfm module has never received a bad CCM message, it would
report a negative time.
Ben Pfaff [Thu, 31 Mar 2011 21:12:57 +0000 (14:12 -0700)]
bridge: Destroy ofproto before deleting dpif.
Otherwise the ofproto's attempt to flush flows from the dpif will fail with
an error, causing a spurious log message.
Ben Pfaff [Thu, 31 Mar 2011 21:13:36 +0000 (14:13 -0700)]
connmgr: Fix wild pointer dereference in connmgr_broadcast().
Fixes a segfault when fail-open goes into effect.
Ben Pfaff [Thu, 31 Mar 2011 21:11:57 +0000 (14:11 -0700)]
ofproto: Fix order of destruction in ofproto_destroy().
ofproto_flush_flows() calls into the connmgr (via connmgr_flushed()) so
it must be called before destroying the connmgr to avoid a use-after-free
error.
Bug #5231.
Reported-by: Krishna Miriyala <krishna@nicira.com>
Simon Horman [Thu, 31 Mar 2011 07:32:07 +0000 (16:32 +0900)]
datapath: Update for changes in 2.6.39-rc1
Update for flowi4 and ip_route_output_flow() changes
in 2.6.39-rc1.
Signed-off-by: Simon Horman <horms@verge.net.au>
[Jesse: drop redundant unlikely() from IS_ERR()]
Signed-off-by: Jesse Gross <jesse@nicira.com>
Ben Pfaff [Wed, 2 Mar 2011 21:39:59 +0000 (13:39 -0800)]
ofpbuf: Make ofpbufs initialized with ofpbuf_use_stack() not expandable.
My original intent for ofpbufs initialized with ofpbuf_use_stack() was that
the caller was providing enough space on the stack for the common case,
with dynamic allocation as a fallback. But in practice, none of the
clients actually do this. Instead, all of them actually know that the
stack-allocated buffer is big enough and, since they don't want to bother
with having to call ofpbuf_delete(), they instead assert that the buffer
wasn't reallocated.
Since this is a bit of a pain, this commit changes the semantics of
ofpbuf_use_stack() to be that the stack-allocated buffer cannot be
reallocated at all. This is more convenient for the existing clients.
Ben Pfaff [Wed, 2 Mar 2011 21:25:10 +0000 (13:25 -0800)]
odp-util: Replace ODPUTIL_FLOW_KEY_U32S by new struct odputil_keybuf.
This seems to me to better encapsulate the inherent ugliness.
Ben Pfaff [Wed, 30 Mar 2011 21:54:26 +0000 (14:54 -0700)]
datapath: Fix mysterious GRE-over-IPSEC problems.
We've noticed that packets that go up to userspace and then back down to
the kernel and then enter an GRE tunnel that is then ESP encapsulated
by IPSEC end up with a bad ESP "next header" value: it ends up as zero
instead of 0x2f (IPPROTO_GRE). Just putting packets from userspace into
a freshly allocated skb fixes the problem.
The underlying problem that this works around is still unknown.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Bug #4769.
Ben Pfaff [Wed, 30 Mar 2011 20:01:36 +0000 (13:01 -0700)]
mac-learning: Fix mac_entry_is_grat_arp_locked().
The lock is asserted if its expiration time has not arrived yet, not the
reverse.
Ben Pfaff [Tue, 15 Mar 2011 23:51:46 +0000 (16:51 -0700)]
ofproto: Get rid of send_port_status() trivial wrapper function.
Ben Pfaff [Tue, 15 Mar 2011 21:56:09 +0000 (14:56 -0700)]
ofp-util: Remove flow_stats_iterator, flows_stats_first(), flow_stats_next()
Nothing uses these anymore. ofputil_decode_flow_stats_reply() is a better
alternative.
Ben Pfaff [Mon, 28 Mar 2011 20:43:32 +0000 (13:43 -0700)]
timeval: Only log poll intervals longer than 50 ms.
When poll interval-based logging was introduced a long time, we were
actively interested in looking at almost every long poll interval. But
these days, with OVS working rather well, with pretty good latency, most
of the messages are red herrings that bother some administrators and
provoke false reports. So this commit suppresses all but the most
egregious long poll intervals that may in fact be worth looking at.
NIC-366.
Ben Pfaff [Wed, 30 Mar 2011 18:21:28 +0000 (11:21 -0700)]
AUTHORS: Add Gaetano Catalli <gaetano.catalli@gmail.com>.
Gaetano Catalli [Wed, 30 Mar 2011 15:25:36 +0000 (17:25 +0200)]
Fix compilation of openvswitch-1.1.0pre2 on FreeBSD-8.1
Ben Pfaff [Tue, 29 Mar 2011 19:24:28 +0000 (12:24 -0700)]
ofproto: Factor OpenFlow connection management into new "connmgr".
This removes a lot of code from ofproto.c and makes the ofproto code
easier to understand.
Ben Pfaff [Thu, 10 Feb 2011 21:16:56 +0000 (13:16 -0800)]
ofproto: New function ofconn_pktbuf_retrieve().
This helps to increase the level of abstraction of "struct ofconn",
in preparation for moving it from ofproto.c into a new file.
Ben Pfaff [Thu, 10 Feb 2011 21:11:07 +0000 (13:11 -0800)]
ofproto: Add functions to get and set ofconn type and role.
This helps to increase the level of abstraction of "struct ofconn",
in preparation for moving it from ofproto.c into a new file.
Ben Pfaff [Thu, 10 Feb 2011 20:37:02 +0000 (12:37 -0800)]
ofproto: Add ofconn_get_miss_send_len(), ofconn_set_miss_send_len().
This helps to increase the level of abstraction of "struct ofconn",
in preparation for moving it from ofproto.c into a new file.
Ben Pfaff [Thu, 10 Feb 2011 19:26:16 +0000 (11:26 -0800)]
ofproto: Add ofconn_get_flow_format(), ofconn_set_flow_format().
This helps to increase the level of abstraction of "struct ofconn",
in preparation for moving it from ofproto.c into a new file.
Ben Pfaff [Thu, 10 Feb 2011 19:22:03 +0000 (11:22 -0800)]
ofproto: Use ofconn_send_reply() for sending OpenFlow replies.
This helps to increase the level of abstraction of "struct ofconn",
in preparation for moving it from ofproto.c into a new file.
Ben Pfaff [Tue, 22 Mar 2011 16:14:59 +0000 (09:14 -0700)]
ofproto: Introduce ofconn_get_ofproto() accessor function.
This helps to increase the level of abstraction of "struct ofconn",
in preparation for moving it from ofproto.c into a new file.
Ben Pfaff [Tue, 15 Mar 2011 17:08:54 +0000 (10:08 -0700)]
ofproto: Move hton_ofp_phy_port() to ofp-util.
This removes some code from ofproto.c that doesn't really seem to
belong there to begin with.
Ben Pfaff [Tue, 22 Mar 2011 16:13:02 +0000 (09:13 -0700)]
ofproto: Break packet_in encoding out of ofproto into ofp-util.
This removes some code from ofproto.c.
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.
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.
Ethan Jackson [Tue, 29 Mar 2011 00:46:43 +0000 (17:46 -0700)]
ovs-vsctl: Remove dead code.
Coverity #10710.
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.)
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>
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.
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.
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.
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>
Ben Pfaff [Fri, 25 Mar 2011 22:22:10 +0000 (15:22 -0700)]
ovs-brcompatd: Delete write-only variable.
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.
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.
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.
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.
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.
Ethan Jackson [Fri, 25 Mar 2011 20:57:21 +0000 (13:57 -0700)]
packets: Move CFM related packet information to cfm header file.
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.
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>
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.
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.
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.
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.
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>
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>
Ethan Jackson [Wed, 23 Mar 2011 02:11:50 +0000 (19:11 -0700)]
gitignore: Added ovs-vlan-bug-workaround and tests
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.
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.
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
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.
Ethan Jackson [Tue, 22 Mar 2011 20:16:24 +0000 (13:16 -0700)]
bridge: Memory leak in port_destroy()
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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)!
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.
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.
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.
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.
Ben Pfaff [Mon, 21 Mar 2011 21:03:35 +0000 (14:03 -0700)]
list: Fix indentation.
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.
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.
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.
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).
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.
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>
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>
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>
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.
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>
Ben Pfaff [Fri, 11 Mar 2011 19:56:25 +0000 (11:56 -0800)]
ovs-ofctl: Use ovs_be32 for big-endian variable.
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.
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.
Ethan Jackson [Wed, 9 Mar 2011 00:34:20 +0000 (16:34 -0800)]
lacp: Enable "fast" lacp timing mode.
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.