Ethan Jackson [Fri, 3 Dec 2010 23:43:24 +0000 (15:43 -0800)]
lib: Add zero padding field to flow_wildcards.
Before this commit, the compiler would add two bytes of padding to
the 'flow_wildcards' structure to achieve 32bit alignment. These
two bytes had inconsistent values which caused 'flow_wildcards_hash'
to behave inconsistently. This commit explicitly 32bit aligns
'flow_wildcards' with zero padding.
This commit also fixes an issue where in-band rules were not
getting deleted when in-band control was disabled.
Ben Pfaff [Fri, 3 Dec 2010 23:44:51 +0000 (15:44 -0800)]
datapath: Merge vport "attach" into "create" and "detach" into "destroy".
These steps are sequentially in lockstep, so we might as well combine them.
This expands the region over which the vport_lock is held. I didn't
carefully verify that this was OK.
This also eliminates the synchronize_rcu() call from destruction of tunnel
vports, since they didn't appear to me to need it.
It should be possible to eliminate the synchronize_rcu() from the netdev,
patch, and internal_dev vports, but this commit does not do that.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Ben Pfaff [Fri, 3 Dec 2010 21:09:26 +0000 (13:09 -0800)]
datapath: Merge "struct dp_port" into "struct vport".
After the previous commit, which changed the datapath to always create and
attach a vport at the same time, and to always detach and delete a vport
at the same time, there is no longer any real distinction between a dp_port
and a vport. This commit, therefore, merges the two together to simplify
code. It might even improve performance, although I have not checked.
I wasn't sure at first whether the merged structure should be "struct
dp_port" or "struct vport". I went with the latter since the "v" prefix
sounds cool.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Ben Pfaff [Fri, 3 Dec 2010 20:54:08 +0000 (12:54 -0800)]
netdev-linux: Don't treat "system" devices as vports for setting stats.
Linux kernel datapath vports have a "set_stats" method. Until now,
internal vports have been handled in the userspace netdev library as
type "system", so the "system" netdevs would try to use the vport
"set_stats" method. Now, however, internal netdevs have been broken out
as a separate netdev type, so only that new type of netdev has to be able
to call into "set_stats". This commit, therefore, removes it from the
"system" netdevs.
Ben Pfaff [Fri, 3 Dec 2010 22:42:28 +0000 (14:42 -0800)]
dpif: Log port number of deleted port in dpif_port_del().
This made tracking down a particular bug easier for me. (It's too bad that
we can't log the port name, but we don't have it here.)
Ben Pfaff [Fri, 3 Dec 2010 22:41:38 +0000 (14:41 -0800)]
datapath: Make adding and attaching a vport a single step.
For some time now, Open vSwitch datapaths have internally made a
distinction between adding a vport and attaching it to a datapath. Adding
a vport just means to create it, as an entity detached from any datapath.
Attaching it gives it a port number and a datapath. Similarly, a vport
could be detached and deleted separately.
After some study, I think I understand why this distinction exists. It is
because ovs-vswitchd tries to open all the datapath ports before it tries
to create them. However, changing it to create them before it tries to
open them is not difficult, so this commit does this.
The bulk of this commit, however, changes the datapath interface to one
that always creates a vport and attaches it to a datapath in a single step,
and similarly detaches a vport and deletes it in a single step.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Ben Pfaff [Thu, 4 Nov 2010 23:32:57 +0000 (16:32 -0700)]
datapath: Encapsulate parameters for new vports in new struct vport_parms.
Upcoming commits will keep needing to pass more information to the vport
'create' member function. It's annoying to have to modify a dozen pieces
of code every time just to do this, so this commit encapsulates all of the
parameters in a new struct and passes that instead.
Acked-by: Jesse Gross <jesse@nicira.com>
Ben Pfaff [Wed, 17 Nov 2010 20:34:42 +0000 (12:34 -0800)]
util: Improve type-safety of OBJECT_CONTAINING.
Ben Pfaff [Thu, 18 Nov 2010 19:33:04 +0000 (11:33 -0800)]
ovs-ofctl: Demote common log messages from INFO to DBG level.
These log messages were useful long ago, but I have not found them helpful
in a long time. Also noticed by Paul Ingram <paul@nicira.com>.
Ben Pfaff [Fri, 3 Dec 2010 18:32:38 +0000 (10:32 -0800)]
ovs-ofctl: Reimplement dumping particular tables.
"dump-flows" and "dump-aggregate" are documented to accept a "table"
value to dump only a particular OpenFlow table, but commit
8050b31d6
"ofp-parse: Refactor flow parsing" broke this, by always dumping table
0. This commit should fix it (though I haven't tested it).
Ben Pfaff [Wed, 17 Nov 2010 18:07:48 +0000 (10:07 -0800)]
classifier: New cls_rule functions for setting registers and tun_id.
Ben Pfaff [Wed, 17 Nov 2010 18:06:37 +0000 (10:06 -0800)]
nicira-ext: Name the enum used for flow formats, to clarify code.
Ben Pfaff [Wed, 1 Dec 2010 00:49:10 +0000 (16:49 -0800)]
datapath: Add __aligned_u64 compat support for user and kernel headers.
__aligned_u64 is a 64-bit integer type that is guaranteed to be aligned on
a 64-bit boundary. It is used in ABI structures to allow them to be shared
between 32- and 64-bit userspace without the need for kernel compat code.
The first use in OVS is coming up in this series of patches.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Ben Pfaff [Tue, 30 Nov 2010 23:58:55 +0000 (15:58 -0800)]
datapath: Change vals[] in struct port_lookup_key into discrete members.
The 'vals' array is only convenient for use by port_hash(). It's a
liability otherwise, since it makes the code wider and harder to read and
seems to me less amenable to compiler optimization.
In an upcoming patch the key needed in struct port_lookup_key will
increase in size to 64 bits, so that using an array of u32 becomes even
more problematic. Therefore, this commit gets rid of the array in favor
of discrete named members that carry the same information.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Ben Pfaff [Wed, 1 Dec 2010 00:54:50 +0000 (16:54 -0800)]
Format tunnel IDs consistently.
Some code failed to convert tunnel IDs to host byte order for printing,
so this fixes that. Some code printed tunnel IDs with a 0x prefix and
other code didn't, so this code uses the '#' flag consistently (which
prints 0x for nonzero values and omits it for zero).
This commit also stops always printing all 8 digits. When tunnel IDs
are expanded to 64 bits, as they will be soon, printing 16 digits all the
time wastes too much space.
Acked-by: Jesse Gross <jesse@nicira.com>
Jesse Gross [Wed, 24 Nov 2010 01:03:16 +0000 (17:03 -0800)]
datapath: Allow skbs with a frag list.
We can already receive packets with a frag list due to reassembly
in CAPWAP tunneling. Since we can handle it, we might as well open
it up to internal devices as well to prevent linearization.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Jesse Gross [Wed, 24 Nov 2010 00:46:47 +0000 (16:46 -0800)]
datapath: Don't set dev->last_rx on kernels >= 2.6.29.
dev->last_rx is used for rebalancing in Linux bonding. However,
on a SMP machine it quickly becomes a very hot cacheline. On
kernels 2.6.29 and later the networking core will update last_rx
only if bonding is in use, so drivers do not need to set it at all.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Jesse Gross [Wed, 24 Nov 2010 17:31:49 +0000 (09:31 -0800)]
tunnels: Mark tnl_ops as static.
Both GRE and CAPWAP have tnl_ops that are only accessed inside of
their respective files. Therefore mark these structures as static.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Jesse Gross [Wed, 24 Nov 2010 06:08:27 +0000 (22:08 -0800)]
datapath: Constify ops structures.
vport_ops, tunnel_ops, and ethtool_ops should not change at runtime.
Therefore, mark them as const to keep them out of the hotpath and to
prevent them from getting trampled.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Jesse Gross [Wed, 24 Nov 2010 17:27:10 +0000 (09:27 -0800)]
datapath: Provide compatibility code for SET_ETHTOOL_OPS constness.
On 2.6.18 dev->ethtool_ops was not marked as const. This adds a
compatibility macro that casts away the constness so we can mark
our ethtool ops as const on later kernels.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Jesse Gross [Wed, 24 Nov 2010 06:35:15 +0000 (22:35 -0800)]
datapath: Add compatibility code for inet_add_protocol().
Kernels earlier than 2.6.32 did not mark struct net_protocol as const
in inet_add_protcol() and inet_del_protocol(). This provides compatibility
code to cast away the constness on these kernels so we can have them be
const on newer kernels.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Jesse Gross [Wed, 24 Nov 2010 00:34:22 +0000 (16:34 -0800)]
datapath: Use __read_mostly annotations where appropriate.
Variables which are changed only infrequently should be annotated
with __read_mostly, which will group them together in a special
linker section. This prevents them from sharing cache lines with
data on the hot path.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Jesse Gross [Sat, 20 Nov 2010 01:20:34 +0000 (17:20 -0800)]
datapath: Don't unnecessarily set skb mac header.
We currently call skb_reset_mac_header() in a few places when a
packet is received. However, this is not needed because flow_extract()
will set all of the protocol headers during parsing and nothing needs
the packet headers before that time.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Jesse Gross [Fri, 19 Nov 2010 21:55:18 +0000 (13:55 -0800)]
datapath: Remove share check for internal devices.
When transmitting on a device, dev_hard_start_xmit() always provides
a private clone. The skb_share_check() in internal_dev_xmit() is
therefore unnecessary, so remove it.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Jesse Gross [Fri, 19 Nov 2010 21:49:54 +0000 (13:49 -0800)]
vport: Remove unused error types.
We currently track rx_over_errors, rx_crc_errors, rx_frame_errors,
and collisions but never increment these counters. It seems likely
that we will never use them since they are primarily hardware errors
and we pull hardware stats directly from the NIC. This removes those
counters, saving 32 bytes per port.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Jesse Gross [Fri, 19 Nov 2010 21:19:55 +0000 (13:19 -0800)]
datapath: Drop obsolete comment.
The comment above flow_extract() refers to setting OVS_CB(skb)->is_frag
but that member no longer exists. The correct way to set is_frag is
already documented, so just drop the incorrect comment.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Jesse Gross [Thu, 2 Dec 2010 21:07:36 +0000 (13:07 -0800)]
tunneling: Clear IP control block in one memset.
We currently clear both the members of the IPCB individually before
entering the IP stack. It's simpler and more robust to just clear
the entire structure.
Suggested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Jesse Gross [Fri, 19 Nov 2010 21:10:14 +0000 (13:10 -0800)]
tunneling: Clear OVS_CB after call to update_header().
If a packet is traversing the IP stack we need to clear some pieces
of the skb CB beforehand. We currently do this before the call to
update_header() but header generation may need some members of the
CB, such as the key. Therefore, zero out the CB only after the
header is complete.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Tue, 23 Nov 2010 21:10:30 +0000 (13:10 -0800)]
ofp-print: Fix handling of zero-length actions.
Without this change, zero-length ofp_actions cause an infinite loop.
Ben Pfaff [Thu, 2 Dec 2010 22:57:53 +0000 (14:57 -0800)]
tests: Add tests for ofproto code.
This first set of tests is pretty basic and uninteresting, but the
infrastructure is now in place for adding more.
Ben Pfaff [Tue, 16 Nov 2010 19:06:25 +0000 (11:06 -0800)]
openflow: Remove vestigial support for including from kernel.
This header hasn't been included into the kernel code in ages.
Ben Pfaff [Tue, 16 Nov 2010 19:05:48 +0000 (11:05 -0800)]
openflow: Change ofp_phy_port's 'name' member from uint8_t[] to char[].
The uint8_t type here has bothered me from the very beginning.
Ben Pfaff [Tue, 16 Nov 2010 18:50:52 +0000 (10:50 -0800)]
ovs-ofctl: Check that commands actually succeed.
Until now, when it sends commands to switches that ordinarily have no
reply, ovs-ofctl has not waited around to see whether the command succeeds
or fails. This commit fixes the problem: errors will now be reported.
Ben Pfaff [Tue, 23 Nov 2010 21:05:59 +0000 (13:05 -0800)]
vconn: New function vconn_transact_noreply().
Ben Pfaff [Tue, 16 Nov 2010 18:32:52 +0000 (10:32 -0800)]
ovs-ofctl: Remove now-useless "tun-cookie" command.
This command is no longer useful, because the setting that it modifies is
now a per-connection setting, not a global switch setting.
This command was never documented or included in --help output (probably
as an oversight).
Ben Pfaff [Tue, 16 Nov 2010 18:28:10 +0000 (10:28 -0800)]
ovs-ofctl: Factor out common code in str_to_port_no(), do_mod_port().
Ben Pfaff [Wed, 1 Dec 2010 19:03:12 +0000 (11:03 -0800)]
dot2pic: Be less picky parsing "dot" output.
Some versions of "dot" put two spaces after the "node" keyword instead of
one, which didn't match the regular expression used in dot2pic. This
commit changes dot2pic not to care about the number of spaces in "node" and
"graph" lines. (The "graph" lines weren't actually a problem but I don't
see a reason to be picky about them either.)
Different versions of "dot" still produce different output for the same
input, but I don't see how to avoid that.
Reported-by: Justin Pettit <jpettit@nicira.com>
Ben Pfaff [Tue, 30 Nov 2010 21:44:01 +0000 (13:44 -0800)]
Implement stress option framework.
Stress options allow developers testing Open vSwitch to trigger behavior
that otherwise would occur only in corner cases. Developers and testers
can thereby more easily discover bugs that would otherwise manifest only
rarely or nondeterministically. Stress options may cause surprising
behavior even when they do not actually reveal bugs, so they should only be
enabled as part of testing Open vSwitch.
This commit implements the framework and adds a few example stress options.
This commit started from code written by Andrew Lambeth.
Suggested-by: Henrik Amren <henrik@nicira.com>
CC: Andrew Lambeth <wal@nicira.com>
Ben Pfaff [Tue, 30 Nov 2010 18:49:51 +0000 (10:49 -0800)]
tests: Don't remove testsuite on distclean.
This file is part of the distribution so distclean should not delete it.
Ben Pfaff [Mon, 1 Nov 2010 21:14:27 +0000 (14:14 -0700)]
coverage: Make the coverage counters catalog program-specific.
Until now, the collection of coverage counters supported by a given OVS
program was not specific to that program. That means that, for example,
even though ovs-dpctl does not have anything to do with mac_learning, it
still has a coverage counter for it. This is confusing, at best.
This commit fixes the problem on some systems, in particular on ones that
use GCC and the GNU linker. It uses the feature of the GNU linker
described in its manual as:
If an orphaned section's name is representable as a C identifier then
the linker will automatically see PROVIDE two symbols: __start_SECNAME
and __end_SECNAME, where SECNAME is the name of the section. These
indicate the start address and end address of the orphaned section
respectively.
Systems that don't support these features retain the earlier behavior.
This commit also fixes the annoyance that files that include coverage
counters must be listed on COVERAGE_FILES in lib/automake.mk.
This commit also fixes the annoyance that modifying any source file that
includes a coverage counter caused all programs that link against
libopenvswitch.a to relink, even programs that the source file was not
linked into. For example, modifying ofproto/ofproto.c (which includes
coverage counters) caused tests/test-aes128 to relink, even though
test-aes128 does not link again ofproto.o.
Ben Pfaff [Mon, 1 Nov 2010 17:47:29 +0000 (10:47 -0700)]
netdev-linux: Remove counter double-increments.
A few coverage counters were incremented both in netdev generic code and
in netdev_linux code. This commit drops the increments from the
lower-level code.
(This is not an actual bug because these counters are used only for
logging.)
Ben Pfaff [Mon, 1 Nov 2010 19:22:47 +0000 (12:22 -0700)]
vlog: Generate vlog-modules.def automatically.
Ben Pfaff [Tue, 30 Nov 2010 18:29:25 +0000 (10:29 -0800)]
vswitch: Update dia-generated diagram.
This probably didn't get updated automatically because the last update to
vswitch.ovsschema was made by a developer without one of the required
tools installed.
Ben Pfaff [Tue, 30 Nov 2010 01:09:53 +0000 (17:09 -0800)]
cfm: Fix GCC warning.
On 32-bit platforms GCC warns:
../lib/cfm.c: In function 'compose_ccm':
../lib/cfm.c:130: warning: integer constant is too large for 'long' type
../lib/cfm.c: In function 'cfm_should_process_flow':
../lib/cfm.c:375: warning: integer constant is too large for 'long' type
This fixes the problem by using the UINT64_C macro from <inttypes.h> to
write a 64-constant.
Ben Pfaff [Mon, 15 Nov 2010 20:56:29 +0000 (12:56 -0800)]
ovs-ofctl: Remove stray printf.
Ben Pfaff [Mon, 15 Nov 2010 19:43:05 +0000 (11:43 -0800)]
ovs-ofctl: Simplify code by using strcasecmp() instead of strncasecmp().
I don't know why this code was written the way it was. This is more
straightforward and I believe that it is equivalent, too.
Ben Pfaff [Mon, 15 Nov 2010 23:53:00 +0000 (15:53 -0800)]
unaligned: Add unaligned accessors for ovs_be<N> data.
These accessors are semantically identical to the ones for uint<N>_t data,
but the names are more informative to readers, and the types provide
annotations for sparse.
Ben Pfaff [Mon, 29 Nov 2010 21:48:30 +0000 (13:48 -0800)]
Convert stream and vconn interfaces to use ovs_be16, ovs_be32.
Ben Pfaff [Mon, 15 Nov 2010 20:56:12 +0000 (12:56 -0800)]
ofproto: Fix typo in comment.
Ben Pfaff [Mon, 29 Nov 2010 20:39:55 +0000 (12:39 -0800)]
ovs-openflowd: Add "exit" unixctl command.
This is useful for testing.
Ben Pfaff [Fri, 12 Nov 2010 22:19:23 +0000 (14:19 -0800)]
ovs-openflowd: Add ability to run without connecting to controller.
This is useful for testing, for which we may want to simply use tools like
ovs-ofctl without maintaining an active connection to a remote controller.
Ben Pfaff [Mon, 29 Nov 2010 20:36:31 +0000 (12:36 -0800)]
ovs-openflowd: Improve usage message.
Ben Pfaff [Fri, 12 Nov 2010 20:43:16 +0000 (12:43 -0800)]
ovs-openflowd: Add --enable-dummy option.
Ben Pfaff [Fri, 12 Nov 2010 20:42:57 +0000 (12:42 -0800)]
ovs-openflowd: Add --unixctl command line option.
Ben Pfaff [Mon, 29 Nov 2010 20:28:26 +0000 (12:28 -0800)]
Make installation directories overridable at runtime.
This makes it possible to run tests that need access to installation
directories, such as the rundir, without having access to the actual
installation directories (/var/run is generally not world-writable), by
setting environment variables. This is not a good way to do things in
general--usually it would be better to choose the correct directories
at configure time--so for now this is undocumented.
Ben Pfaff [Mon, 29 Nov 2010 20:21:08 +0000 (12:21 -0800)]
Add new "dummy" netdev and dpif implementations for use in unit tests.
Ethan Jackson [Tue, 16 Nov 2010 00:20:01 +0000 (16:20 -0800)]
ovs: Implement 802.1ag Connectivity Fault Management
This commit implements a subset of the 802.1ag specification for
Connectivity Fault Management (CFM) using Continuity Check Messages
(CCM). When CFM is configured on an interface CCMs are broadcast
at regular intervals to detect missing or unexpected connectivity.
Ethan Jackson [Wed, 24 Nov 2010 10:13:15 +0000 (02:13 -0800)]
ofproto: set up helpful flow pointers for odp miss messages
This flow copies the header pointers calculated in
handle_odp_miss_msg to the relevant packet so they can be used
later on.
Ethan Jackson [Wed, 24 Nov 2010 00:50:57 +0000 (16:50 -0800)]
ovsdb: constify should apply to all pointer types.
All pointers (except double stars) should be const-able in
ovsdb-idlc.in generated header files.
Ethan Jackson [Wed, 24 Nov 2010 09:57:45 +0000 (01:57 -0800)]
ovsdb: Remove trailing whitespace
This commit removes trailing whitespace from the files in the ovsdb
directory.
Ethan Jackson [Sat, 20 Nov 2010 00:23:27 +0000 (16:23 -0800)]
vswitchd: Remove trailing whitespace
Removed trailing whitespace from files in the vswitchd directory.
Ben Pfaff [Mon, 29 Nov 2010 22:08:29 +0000 (14:08 -0800)]
flow: Delete unused FWW_VLAN_TCI bit.
This wasn't used intentionally anywhere, but some code was turning it on
accidentally (because it was part of FWW_ALL) and other code was not, which
caused confusion. In particular, the NXM code turned it on by default
and the OpenFlow 1.0 code did not, which caused flow stat requests to
return different results depending on format. Deleting it fixes the bug.
Reported-by: Natasha Gude <natasha@nicira.com>
CC: Natasha Gude <natasha@nicira.com>
Ben Pfaff [Wed, 24 Nov 2010 20:25:10 +0000 (12:25 -0800)]
configure: Check for pkg-config "openssl" library instead of "libssl".
Checking for libssl only does not necessarily link against libcrypto, so
the build can gratuitously fail.
Reported-by: Dave Walker <DaveWalker@ubuntu.com>
Ubuntu bug #680439.
Ben Pfaff [Tue, 23 Nov 2010 21:09:53 +0000 (13:09 -0800)]
ofp-util: Fix interpretation of NXFW_TUN_ID bit for NXFF_OPENFLOW10.
In NXFF_OPENFLOW10, the tun_id field is always supposed to be wildcarded.
That is what OVS used to do, but commit
d8ae4d67 "flow: Fully separate
flow_wildcards from OpenFlow wildcard bits" broke it.
Ben Pfaff [Wed, 24 Nov 2010 20:50:52 +0000 (12:50 -0800)]
ofproto: Send OFPT_PORT_STATUS messages to primary slave controllers.
Requested-by: Jeremy Stribling <strib@nicira.com>
CC: Jeremy Stribling <strib@nicira.com>
Ben Pfaff [Fri, 12 Nov 2010 20:12:03 +0000 (12:12 -0800)]
dpif-netdev: Do not log error for EOPNOTSUPP return from netdev_recv().
If a network device does not implement receiving packets, there is no point
in logging it as an error.
Ben Pfaff [Wed, 24 Nov 2010 20:35:22 +0000 (12:35 -0800)]
dpif-netdev: Simplify code by using shash for names and dropping indexes.
Ben Pfaff [Tue, 23 Nov 2010 18:06:28 +0000 (10:06 -0800)]
nx-match: Implement support for arbitrary VLAN TCI masks.
Since the Nicira Extended Match was specified nicira-ext.h has claimed that
arbitrary masks are allowed, but in fact only certain masks were actually
implemented. This commit implements general masking for the 802.1Q VLAN
TCI field.
Ben Pfaff [Mon, 22 Nov 2010 17:27:31 +0000 (09:27 -0800)]
debian: Change architectures from "any" to "linux-any".
This should prevent Debian builds from failing on non-GNU/Linux
architectures (or possibly succeeding but producing a binary that is not
useful).
Ben Pfaff [Wed, 10 Nov 2010 22:51:49 +0000 (14:51 -0800)]
ofp-util: Make make_flow_mod() take cls_rule instead of struct flow.
This reduces code duplication, by eliminating a function that translates
from "struct flow" to "struct ofp_match" in favor of the existing function
ofputil_cls_rule_to_match(). It also allows the caller to specify the
desired priority (as part of the cls_rule).
Ben Pfaff [Wed, 10 Nov 2010 22:39:54 +0000 (14:39 -0800)]
flow: Fully separate flow_wildcards from OpenFlow wildcard bits.
Originally, wildcards were just the OpenFlow OFPFW_* bits. Then, when
OpenFlow added CIDR masks for IP addresses, struct flow_wildcards was born
with additional members for those masks, derived from the wildcard bits.
Then, when OVS added support for tunnels, we added another bit
NXFW_TUN_ID that coexisted with the OFPFW_*. Later we added even more bits
that do not appear in the OpenFlow 1.0 match structure at all. This had
become really confusing, and the difficulties were especially visible in
the long list of invariants in comments on struct flow_wildcards.
This commit cleanly separates the OpenFlow 1.0 wildcard bits from the
bits used inside Open vSwitch, by defining a new set of bits that are
used only internally to Open vSwitch and converting to and from those
wildcard bits at the point where data comes off or goes onto the wire.
It also moves those functions into ofp-util.[ch] since they are only for
dealing with OpenFlow wire protocol now.
Ben Pfaff [Mon, 22 Nov 2010 18:10:14 +0000 (10:10 -0800)]
flow: Remove flow_to/from_match() in favor of cls_rule_to/from_match().
The flow_from_match() and flow_to_match() functions have to deal with most
of the state in a cls_rule anyhow, and this will increase in upcoming
commits, to the point that we might as well just use a cls_rule anyhow.
This commit therefore deletes flow_from_match() and flow_to_match(),
integrating their code into cls_rule_from_match() and the new function
cls_rule_to_match(), respectively. It also changes each of the functions'
callers to use the new cls_rule_*() function.
Ben Pfaff [Mon, 22 Nov 2010 18:09:18 +0000 (10:09 -0800)]
flow: Move functions for dealing with wildcard bit counts to ofp-util.
These functions are really OpenFlow-specific, and they will not be used
directly by the flow code soon, so move them to ofp-util.
Ben Pfaff [Tue, 9 Nov 2010 00:45:00 +0000 (16:45 -0800)]
flow: New function flow_wildcards_is_exact().
Ben Pfaff [Tue, 9 Nov 2010 00:36:44 +0000 (16:36 -0800)]
ofp-print: Avoid converting flow to ofp_match just to format it.
These days we have a function to format a struct flow directly, so we might
as well use it.
Ben Pfaff [Tue, 9 Nov 2010 00:35:34 +0000 (16:35 -0800)]
classifier: New function cls_rule_equal().
Ben Pfaff [Sat, 20 Nov 2010 00:41:02 +0000 (16:41 -0800)]
classifier: Fix segfault iterating with rules that differ only in priority.
When CLS_CURSOR_FOR_EACH(_SAFE) iterated through a classifier, the
cls_cursor_next() function did not properly handle the case where there was
more than a single rule on a list. This commit fixes the problem.
The addition to the testsuite would have found the problem earlier.
Reported-by: Teemu Koponen <koponen@nicira.com>
CC: Teemu Koponen <koponen@nicira.com>
Ben Pfaff [Fri, 19 Nov 2010 21:07:56 +0000 (13:07 -0800)]
netdev-vport: Fix segfault on bad vport configuration.
When a vport parse error occurs, the vport_class's parse_config function
doesn't necessarily store a valid pointer into the vport_info's 'config'
member, so netdev_vport_create() needs to supply a null pointer here to
avoiding passing a wild pointer to free().
Ben Pfaff [Thu, 18 Nov 2010 22:36:53 +0000 (14:36 -0800)]
ovs-vsctl: Fix br-set-external-id.
The wrong prerequisite function was being called for set-br-external-id, so
it didn't set up to monitor the right columns, so an assertion failed.
This fixes the problem.
Also, change the test for external IDs so that it will find the regression.
(Running all of the ovs-vsctl commands together caused the column to be
monitored due to another command's intervention.)
Reported-by: Mikael Doverhag <mdoverhag@nicira.com>
Bug #4095.
Ben Pfaff [Thu, 18 Nov 2010 18:06:41 +0000 (10:06 -0800)]
dpif: Make dpif_class 'open' function take class instead of type name.
This makes it easier for dpif_provider implementations to share code but
distinguish the class actually in use, because comparing a pointer is
easier than comparing a string.
Ben Pfaff [Thu, 18 Nov 2010 18:07:48 +0000 (10:07 -0800)]
dpif: Use caller-provided dpif_class in dp_register_provider().
I don't see a reason here to copy the dpif_class instead of using the
pointer provided by the caller. Using the caller's pointer allows the
caller to compare a dpif's 'class' member against the address of its
class structure, which seems like a reasonable thing to do.
Ben Pfaff [Fri, 12 Nov 2010 23:49:16 +0000 (15:49 -0800)]
lib: Remove redundant dhparams.h from EXTRA_DIST.
This is redundant since it's also in lib_libopenvswitch_a_SOURCES.
Also, remove duplicate blank line.
Ben Pfaff [Thu, 11 Nov 2010 23:48:41 +0000 (15:48 -0800)]
netdev-vport: Remove OVS_UNUSED from argument that is actually used.
Ben Pfaff [Tue, 16 Nov 2010 19:00:25 +0000 (11:00 -0800)]
ofp-util: Consistently treat OpenFlow xids as network byte order.
The 'xid' in an ofp_header is not interpreted by the receiver but only by
the sender, so it need not be in any particular byte order. OVS used to
try to take advantage of this to avoid host/network byte order conversions
for this field. Older code in OVS, therefore, treats xid as being in host
byte order. However, as time went on, I forgot that I had introduced this
trick, and so newer code treats xid as being in network byte order.
This commit fixes up the situation by consistently treating xid as being
in network byte order. I think that this will be less surprising and
easier to remember in the future.
This doesn't fix any actual bugs except that some log messages would have
printed xids in the wrong byte order.
Ben Pfaff [Mon, 15 Nov 2010 19:04:40 +0000 (11:04 -0800)]
ofp-util: Use a counter for transaction IDs instead of a random number.
I don't know of any reason why the transaction id should be random. Using
consecutive ids means that there is no chance that two messages sent around
the same time will have the same transaction ID, which is probabilitically
possible with random IDs.
Ben Pfaff [Mon, 15 Nov 2010 20:48:31 +0000 (12:48 -0800)]
netdev-vport: Fix poll_add() implementation.
The existing implementation never worked because it used different strings
for notifier shash addition and lookup: for adding to the shash, it used
the vport name; for lookup, it used "<type>:<name>". This fixes the
problem, by using "<type>:<name>" in both cases.
Ben Pfaff [Tue, 16 Nov 2010 18:25:22 +0000 (10:25 -0800)]
ovs-ofctl: Fix return value of str_to_port_no().
The index into the array of ports returned in the OFPT_FEATURES_REPLY
message is not necessarily the same as the port number, so this fixes a
real bug.
Ben Pfaff [Tue, 16 Nov 2010 23:14:58 +0000 (15:14 -0800)]
Make the "exit" unixctl command reliable in ovsdb-server, ovs-vswitchd.
If "ovs-appctl exit" happens to hit ovsdb-server or ovs-vswitchd at a
moment when nothing else is happening to wake the daemon up, it can take a
long time for them to exit.
This seems to account for occasional "make check" failures on Nicira's
internal builds. It probably fixes some Debian automatic build failures
as well.
Ben Pfaff [Tue, 16 Nov 2010 23:13:10 +0000 (15:13 -0800)]
debian: Ignore python-openvswitch directory.
This directory is created as part of the Debian build.
Ben Pfaff [Tue, 16 Nov 2010 22:09:41 +0000 (14:09 -0800)]
debian: Fix parallel builds.
Some of the Debian automatic builds are failing apparently because the
build-arch and build-indep targets are being called in parallel and they
are both attempting to rebuild tests/testsuite at the same time, which
doesn't work. We could make the OVS makefiles handle this particular case,
but in general it's not a good idea to independently invoke a single
makefile multiples times in parallel, so this commit avoids that problem.
This also dumps the DEB_BUILD_OPTIONS variable to the log, because there
doesn't appear to be any way to infer it from the automatic builders'
log files.
Ben Pfaff [Tue, 16 Nov 2010 22:06:31 +0000 (14:06 -0800)]
debian: On "make check" failure dump the testsuite log.
The Debian automatic build machines don't save any files from the build,
but they do preserve the build log, so dumping it to stdout is the only
reasonable way to get test failure information.
Ben Pfaff [Tue, 16 Nov 2010 20:52:10 +0000 (12:52 -0800)]
csum: Avoid misaligned data access.
This should fix a checksum test failure observed on Alpha in Debian's
buildds.
Ben Pfaff [Tue, 16 Nov 2010 20:51:08 +0000 (12:51 -0800)]
test-csum: Make test_case requirements clear.
This test code only works properly with test cases whose data is a multiple
of 4, so make that clear in the code and the data.
Ben Pfaff [Tue, 16 Nov 2010 20:23:12 +0000 (12:23 -0800)]
ovs-vsctl: Make waiting for ovs-vswitchd to reload work again.
Bug introduced in commit
e5e12280e "ovs-vsctl: Replicate only tables and
columns that are actually needed."
Reported-by: Paul Ingram <paul@nicira.com>
Ben Pfaff [Tue, 16 Nov 2010 17:15:40 +0000 (09:15 -0800)]
ovs-vsctl: Replicate only tables and columns that are actually needed.
Until now, ovs-vsctl has always fetched a complete replica of the Open
vSwitch database at startup time. This is a little expensive, but that is
not normally a problem because the database is small. However, it can
cause problems when Open vSwitch is partially upgraded: if ovs-vsctl is
upgraded before the database, and new columns or tables were added to the
database schema in the newer version of Open vSwitch, then ovs-vsctl will
report an error and fail to work, because it cannot monitor the new
columns. The same problem occurs if the database is upgraded before
ovs-vsctl and columns or tables were removed in the new version of Open
vSwitch.
This commit fixes the problem in the most common case, by making ovs-vsctl
only replicate the columns and tables in the database that it will actually
use during a given execution. This will still fail if the database has
changed in major ways, but only if the changes would actually cause
problems for what ovs-vsctl is trying to do anyhow.
Bug #3388.
Ben Pfaff [Tue, 16 Nov 2010 17:14:52 +0000 (09:14 -0800)]
ovsdb-idl: Make selecting tables and columns to replicate more flexible.
Until now, by default the IDL replicated all tables and all columns in the
database, and a few functions made it possible to avoid replicating
selected columns. This commit adds a mode in which nothing is replicated
by default and the client code is responsible for specifying each column
and table that it is interested in. The following commit adds a user for
this mode.
Ben Pfaff [Mon, 30 Aug 2010 21:12:27 +0000 (14:12 -0700)]
ovsdb: Support replicating a table without including any columns.
The OVSDB wire protocol has a "monitor" feature that supports table
replication on a column-by-column basis. This wire protocol in theory
supports replicating a table without replicating any columns in it. In
such a case, the client only tracks the UUIDs of the rows in the table.
However, the ovsdb-server implementation did not support this possibility
properly. This commit fixes the bug.
Ben Pfaff [Thu, 28 Oct 2010 23:19:45 +0000 (16:19 -0700)]
classifier: Remove classifier_for_each(), classifier_for_each_match().
These functions no longer have any users.
Ben Pfaff [Mon, 15 Nov 2010 23:10:01 +0000 (15:10 -0800)]
ofproto: Fix typo in comment.
Reported-by: Ethan Jackson <ethan@nicira.com>
Ben Pfaff [Thu, 28 Oct 2010 23:18:20 +0000 (16:18 -0700)]
classifier: Add functions and macros for iteration, and use them in ofproto.
This is much more convenient in practice than being forced to use a
callback function.