2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-28 21:07:47 +00:00

663 Commits

Author SHA1 Message Date
Ben Pfaff
402f2858db bridge: Get rid of 'n_ifaces' member of struct port.
If it doesn't exist then it can't have the wrong value.
2011-04-01 15:52:20 -07:00
Ben Pfaff
f620b43af1 bridge: Break bonding implementation out into library.
This removes over 1000 lines of code from bridge.c and will make it
easier to moving the bonding implementation into ofproto as part of
future development.
2011-04-01 15:52:20 -07:00
Ben Pfaff
207079c429 bridge: Simplify and clean up bond slave enable/disable.
The code that enables and disables bond slaves was a bit of a mess:

    * Disabling a slave could recursively enable a different slave.

    * Processing a flow could enable a slave.

This commit gets rid of both of those properties, which made it difficult
to reason about the code paths along which slaves would be enabled and
disabled.

Bug #5121.
2011-04-01 15:52:20 -07:00
Ben Pfaff
e34c9ddcc8 bridge: Drop obsolete comment.
It's quite clear that we don't support double tagging now.
2011-04-01 15:52:20 -07:00
Ben Pfaff
cbbb244d5f bridge: Improve comment. 2011-04-01 15:52:20 -07:00
Ben Pfaff
090f7f5048 bridge: Change Ethernet address array from 8 bytes to ETH_ADDR_LEN bytes.
I don't know why this was declared as 8 bytes long but I only see 6
actually in use, as one would expect of an Ethernet address.
2011-04-01 15:52:20 -07:00
Ben Pfaff
79efe70efc bridge: Avoid redundant dpif_flow_flush().
ofproto_create() also calls dpif_flow_flush() very soon afterward.  This
seems more clearly in ofproto's domain anyhow.
2011-04-01 15:52:20 -07:00
Ben Pfaff
bb5bc6c042 lacp: Encapsulate configuration into new structs.
This makes it easier to pass configuration between modules.
2011-04-01 15:52:20 -07:00
Ben Pfaff
7a6735157c bridge: Drop LACP configuration members from struct iface and struct port.
There's no reason that I can see to maintain this information in struct
port and struct iface.  It's redundant, since the lacp implementation
maintains the same information.
2011-04-01 15:52:20 -07:00
Ben Pfaff
5de1bb5cc9 packets: New function snap_compose(); rename compose_packet() for consistency.
The following commit will introduce the first use of snap_compose().
2011-04-01 15:52:19 -07:00
Ben Pfaff
9759479ab6 bridge: Convert svecs to ssets. 2011-03-31 16:42:01 -07:00
Ben Pfaff
81e2083fe6 ofproto: Change string sets in interface from svec to sset. 2011-03-31 16:42:01 -07:00
Ben Pfaff
d0c23a1a57 dpif: Use sset instead of svec in dpif interface. 2011-03-31 16:42:01 -07:00
Ben Pfaff
b3c01ed330 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.
2011-03-31 16:42:01 -07:00
Ben Pfaff
6d6ab93e9d 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.
2011-03-31 14:28:42 -07:00
Ben Pfaff
595cf43e01 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.)
2011-03-29 10:12:22 -07:00
Ethan Jackson
20c8e97108 cfm: Create new cfm/show appctl command.
This will be useful for debugging CFM problems in the future.
2011-03-28 11:43:26 -07:00
Ethan Jackson
6586adf524 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.
2011-03-28 11:43:22 -07:00
Ethan Jackson
1c2e2d2fc8 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.
2011-03-28 11:30:55 -07:00
Ethan Jackson
a58727fb40 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.
2011-03-23 13:16:38 -07:00
Ethan Jackson
40f78b38e7 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.
2011-03-23 13:16:38 -07:00
Ethan Jackson
bbb1951c48 vswitchd: Properly calculate output port.
This was causing segfaults on my system.
2011-03-22 15:41:46 -07:00
Ethan Jackson
6083727211 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.
2011-03-22 13:30:15 -07:00
Ethan Jackson
fe0cfbf622 bridge: Memory leak in port_destroy() 2011-03-22 13:16:24 -07:00
Ben Pfaff
8052fb145f 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.
2011-03-22 09:57:26 -07:00
Ben Pfaff
d534627818 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.
2011-03-22 09:57:25 -07:00
Ben Pfaff
1648ddd7c1 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.
2011-03-22 09:57:06 -07:00
Ben Pfaff
1bfe968160 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.
2011-03-22 09:52:39 -07:00
Ben Pfaff
db8077c315 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.
2011-03-22 09:47:02 -07:00
Ben Pfaff
83db796889 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.
2011-03-21 17:01:49 -07:00
Ben Pfaff
c17f0d5e2e 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.
2011-03-21 17:01:49 -07:00
Ben Pfaff
332e0d030b 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.
2011-03-21 17:01:49 -07:00
Ben Pfaff
c0cb6f59f5 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.
2011-03-21 17:01:49 -07:00
Ben Pfaff
990cda8548 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.
2011-03-21 17:01:49 -07:00
Ben Pfaff
27b3a6e0b3 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)!
2011-03-21 17:01:49 -07:00
Ben Pfaff
7e559ecf6c 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.
2011-03-21 17:01:48 -07:00
Ben Pfaff
fd5f9a4f6f 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.
2011-03-21 17:01:48 -07:00
Ben Pfaff
13f5f5b05a 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.
2011-03-21 09:35:35 -07:00
Ben Pfaff
e793439635 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.
2011-03-18 16:56:31 -07:00
Ben Pfaff
3cf10406a7 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.
2011-03-18 16:52:24 -07:00
Ben Pfaff
0b8024eb4b 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.
2011-03-18 16:51:14 -07:00
Ethan Jackson
269340fac3 lacp: Enable "fast" lacp timing mode. 2011-03-18 11:33:02 -07:00
Ethan Jackson
6aa7430820 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.
2011-03-18 11:33:01 -07:00
Ethan Jackson
afabe15a7a 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.
2011-03-17 12:53:27 -07:00
Ethan Jackson
b0ce40eec4 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.
2011-03-17 12:50:56 -07:00
Ethan Jackson
07a6cf771d 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.
2011-03-17 12:49:34 -07:00
Ethan Jackson
e5ed989d03 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.
2011-03-17 12:21:11 -07:00
Ben Pfaff
195c808624 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.
2011-03-16 14:57:56 -07:00
Ethan Jackson
21dcb94fd5 bridge: Create new port_run() function. 2011-03-15 16:43:31 -07:00
Ethan Jackson
e8fe30269a 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.
2011-03-14 17:32:35 -07:00