openvswitch
12 years agoutilities: Update gitignore.
Ethan Jackson [Mon, 21 Nov 2011 18:38:57 +0000 (10:38 -0800)]
utilities: Update gitignore.

12 years agoofp-util: Support OFPP_LOCAL in enqueue actions.
Ethan Jackson [Sat, 19 Nov 2011 03:00:34 +0000 (19:00 -0800)]
ofp-util: Support OFPP_LOCAL in enqueue actions.

According to the specification the enqueue action should refer to
"a valid physical port", or OFPP_IN_PORT.  It would be strange to
attach a queueing discipline to the local port, but I see no reason
to restrict it.

12 years agodatapath: Remove unused variable in dp_notify.c.
Jesse Gross [Sat, 19 Nov 2011 22:29:19 +0000 (14:29 -0800)]
datapath: Remove unused variable in dp_notify.c.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Always notify in initial namespace for port deletions.
Jesse Gross [Sat, 19 Nov 2011 22:26:02 +0000 (14:26 -0800)]
datapath: Always notify in initial namespace for port deletions.

We currently notify for port deletions in the namespace of the device
that was deleted.  In general this should be initial namespace because
that's the only place where we look but it's possible that the device
was moved after being attached.  However, it's not semantically correct
because we really care about the namespace of the userspace process, not
that of the device.  This switches to genlmsg_multicast() which always
uses the initial namespace and seems more appropriate anyways.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Directly use methods for protecting RCU/RTNL data.
Jesse Gross [Sat, 19 Nov 2011 21:45:48 +0000 (13:45 -0800)]
datapath: Directly use methods for protecting RCU/RTNL data.

We currently have a wrapper to protect the datapath ports array.
However, this can lead to confusion over exactly what lock is
protecting the access (either RTNL or RCU).  This removes the
wrapper in favor of directly accessing the data, which also has
the benefit of being less permissive about what lock we allow so
it can be restricted to the one that we expect.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Add genl_dereference() and use it.
Jesse Gross [Sat, 19 Nov 2011 21:25:43 +0000 (13:25 -0800)]
datapath: Add genl_dereference() and use it.

We currently use a specialized version of what amounts to
genl_dereference() to protect the flow table.  This prepares to
propose genl_dereference() upstream and uses it instead of our
version.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Use u64_stats_sync for datapath and vport stats.
Jesse Gross [Sat, 19 Nov 2011 17:08:56 +0000 (09:08 -0800)]
datapath: Use u64_stats_sync for datapath and vport stats.

We currently use a seqcount to prevent reading partial 64-bit stats
on 32-bit CPUs.  u64_stats_sync uses the same logic but elides it on
64-bit and uniprocessor machines.  This improves performance (primarily
on non-x86 architectures) at the cost of not guaranteeing that packet
and byte counts were necessarily read together.

Suggested-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Better handle vlan packets sent to userspace.
Jesse Gross [Thu, 17 Nov 2011 23:54:10 +0000 (15:54 -0800)]
datapath: Better handle vlan packets sent to userspace.

We no longer clone packets that are sent via the userspace action
because placing them in Netlink attributes makes a copy so we
generally don't touch the original.  The one exception to this is
accelerated vlan tags, which are currently inserted into the
original packet as long as it isn't cloned.  Although the clone
check prevents us from causing problems for past packets it has
issues for future processing:

 * It turns accelerated tags into non-accelerated tags.  This isn't
   inherently a problem but some cards may not properly support
   offloads with in-band tags.
 * It doesn't update CHECKSUM_COMPLETE if there is one.
 * If the operation fails, it will free the packet resulting in a
   later use-after-free.

This patch fixes the above issues with a conservative approach.
It's possible to do it more efficiently but it probably doesn't
matter in most cases.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agoofproto-dpif: Simplify output action composition.
Ethan Jackson [Fri, 18 Nov 2011 00:47:49 +0000 (16:47 -0800)]
ofproto-dpif: Simplify output action composition.

Before this patch, the logic for outputting to a port was scattered
all around ofproto-dpif.  This patch simplifies the code by forcing
it to use one code path to check if a port is forwarding, and
output if appropriate.  Future patches will rely on this
simplification to implement new features.

12 years agoofproto-dpif: Improperly handled OFPP_ALL action.
Ethan Jackson [Fri, 18 Nov 2011 00:52:09 +0000 (16:52 -0800)]
ofproto-dpif: Improperly handled OFPP_ALL action.

According to the OpenFlow specification, the OFPP_ALL output to
every port except the input port regardless of whether or not they
are "blocked or link down".  This patch implements this logic, and
marginally simplifies the interface of flood_packets().

12 years agoofproto-dpif: Enqueue incorrectly calls add_output_action().
Ethan Jackson [Fri, 18 Nov 2011 01:11:40 +0000 (17:11 -0800)]
ofproto-dpif: Enqueue incorrectly calls add_output_action().

The add_output_action() function takes an OpenFlow port number, but
the enqueue action passes it a datapath port number.

12 years agoofproto-dpif: Consistently set NetFlow Output Interface.
Ethan Jackson [Fri, 18 Nov 2011 01:11:04 +0000 (17:11 -0800)]
ofproto-dpif: Consistently set NetFlow Output Interface.

Some parts of the code set the NetFlow Output Interface to the
OpenFlow port.  Other set it to the datapath port.  This patch
consistently sets it to the OpenFlow port.

12 years agoofproto-dpif: Remove trailing whitespace.
Ethan Jackson [Fri, 18 Nov 2011 00:56:17 +0000 (16:56 -0800)]
ofproto-dpif: Remove trailing whitespace.

12 years agotests: Allow unit tests to run as root.
Ethan Jackson [Fri, 18 Nov 2011 02:06:55 +0000 (18:06 -0800)]
tests: Allow unit tests to run as root.

The unit tests did not allow users to run them as root because
ovs-vswitchd would destroy all of the existing 'system' datapaths.
This patch prevents ovs-vswitchd from registering 'system'
datapaths when running unit tests preventing the issue.

12 years agopackaging: Fix Xen and RH packaging error that was introduced with ovs-test utility
Ansis Atteka [Fri, 18 Nov 2011 21:11:46 +0000 (13:11 -0800)]
packaging: Fix Xen and RH packaging error that was introduced with ovs-test utility

My previous ovs-test utility commit broke Xen and RH packaging.
This commit will address this issue by not including any ovs-test related
files into those two packages.

12 years agodatapath: Fix unaligned access when storing stats.
Jesse Gross [Fri, 18 Nov 2011 18:54:12 +0000 (10:54 -0800)]
datapath: Fix unaligned access when storing stats.

Both datapath and vport stats contain 64-bit members in a struct
but we write them directly in Netlink attributes which only
guarantee 32-bit alignment.  This causes problems on RISC
architectures that care about alignment so this computes the stats
on the stack and then memcpy's them.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agobond: Remove dead conditional.
Ethan Jackson [Tue, 15 Nov 2011 01:02:44 +0000 (17:02 -0800)]
bond: Remove dead conditional.

12 years agodatapath: Fix pop_vlan().
Pravin B Shelar [Fri, 18 Nov 2011 19:48:01 +0000 (11:48 -0800)]
datapath: Fix pop_vlan().

Following patch fixes bug in pop_vlan code by updating ethernet
header len.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agoovs-test: A new tool that allows to diagnose connectivity and performance issues
Ansis Atteka [Mon, 31 Oct 2011 21:56:08 +0000 (14:56 -0700)]
ovs-test: A new tool that allows to diagnose connectivity and performance issues

This tool will be a replacement for the current ovs-vlan-test
utility. Besides from connectivity issues it will also be able
to detect performance related issues in Open vSwitch setups.
Currently it uses UDP and TCP protocols for stressing.

Issue #6976

12 years agoImplement a new port setting "other-config:priority-tags".
Ben Pfaff [Fri, 18 Nov 2011 01:11:53 +0000 (17:11 -0800)]
Implement a new port setting "other-config:priority-tags".

Linux hosts (and probably others) tend to ignore priority-tagged frames, so
this new setting allows Open vSwitch to suppress sending them.

Reported-by: Michael Mao <mmao@nicira.com>
Bug #8320.

12 years agoovs-dpctl: Suppress compiler warning on 64 bit linux.
Ethan Jackson [Thu, 17 Nov 2011 23:26:00 +0000 (15:26 -0800)]
ovs-dpctl: Suppress compiler warning on 64 bit linux.

utilities/ovs-dpctl.c:851:42: error: cast to pointer from integer
of different size [-Werror=int-to-pointer-cast]

12 years agoofproto: Remove dead variable.
Ethan Jackson [Thu, 17 Nov 2011 23:14:08 +0000 (15:14 -0800)]
ofproto: Remove dead variable.

Fixes the following gcc warning:
    "error: variable ‘flow_vid’ set but not used
    [-Werror=unused-but-set-variable]"

12 years agoofproto-dpif: Fix segfault in mirror_update_dups().
Justin Pettit [Thu, 17 Nov 2011 22:08:09 +0000 (14:08 -0800)]
ofproto-dpif: Fix segfault in mirror_update_dups().

Fixes crash introduced in 9ba15e (ofproto-dpif: Improve RSPAN
translation performance from O(n**2) to O(n).)  The code always
dereferenced the members of the "mirrors" array in ofproto even if they
were null.

12 years agodatapath: Update startup banner.
Jesse Gross [Thu, 17 Nov 2011 21:24:21 +0000 (13:24 -0800)]
datapath: Update startup banner.

The (to be) upstream version prints out "Open vSwitch switching
datapath" on module load.  This updates the OVS tree to keep
them in sync.

Signed-off-by: Jesse Gross <jesse@nicira.com>
12 years agodatapath: Fix whitespace error.
Jesse Gross [Thu, 17 Nov 2011 21:21:39 +0000 (13:21 -0800)]
datapath: Fix whitespace error.

Signed-off-by: Jesse Gross <jesse@nicira.com>
12 years agoofproto-dpif: Get rid of "struct dst".
Ben Pfaff [Thu, 17 Nov 2011 18:46:03 +0000 (10:46 -0800)]
ofproto-dpif: Get rid of "struct dst".

struct dst is an intermediate form for OFPP_NORMAL translation that
has existed since the beginning of Open vSwitch development.  It
has always been a bit ugly, since ideally we wouldn't need any intermediate
form at all.  This commit eliminates it, which speeds up OFPP_NORMAL
translation.

struct dst was used earlier to eliminate duplicate packets in OFPP_NORMAL
output.  Now, we have rules that eliminate duplicate packets in a cheaper
way.

OFPP_NORMAL outputs packets for two different reasons, forwarding and
mirroring, so those are the two possible sources of packet duplication.
Forwarding by itself never outputs two copies of a packet to a single port
on a given VLAN, and this is also true of mirroring by itself since commit
"ofproto-dpif: Improve RSPAN translation performance from O(n**2) to O(n)".

The only remaining possibility, then, is that forwarding and mirroring
between them duplicate an output packet.  However, the algorithms are now
designed to prevent this.  Forwarding will never output to a mirroring
destination output port.  Forwarding will only output to a mirroring
output VLAN if the packet arrived on a mirroring output VLAN, and in that
case mirroring is disabled.

This commit has the side effect of improving behavior for VLAN output.
Previously, a packet that arrived with an 802.1Q tag with both VID and PCP
of 0 would be output with a similar tag in some cases; now it is
consistently stripped.  This change is reflected in the unit test change.

We really need some unit tests for mirroring.  I have not tested mirroring
behavior, only theorized about it (see above).

12 years agotests: Rewrite code for comparing sets of ODP actions.
Ben Pfaff [Thu, 17 Nov 2011 18:24:05 +0000 (10:24 -0800)]
tests: Rewrite code for comparing sets of ODP actions.

The compare-odp-actions.pl utility isn't fully general, even for its
intended purpose of allowing sets of ODP actions to be compared
ignoring unimportant differences in ordering of output actions and
VLAN set actions.  I decided that the proper way to do it was to have
a utility that can actually parse the actions, instead of just
doing textual transformations on them.  So, this commit replaces
compare-odp-actions.pl by "ovs-dpctl normalize-actions", which is
sufficiently general for the intended purpose.

The new ovs-dpctl functionality can be easily extended to handle
differences in fields other than VLAN, but only VLAN is needed so
far.

This will be needed in an upcoming commit that in some cases
introduces redundant "set vlan" actions into the ODP actions, which
compare-odp-actions.pl doesn't tolerate.

12 years agoodp-util: New function odp_actions_from_string().
Ben Pfaff [Fri, 11 Nov 2011 23:22:56 +0000 (15:22 -0800)]
odp-util: New function odp_actions_from_string().

An upcoming commit will add a user.  The only planned users for now are
part of unit tests themselves, so it doesn't seem important to unit test
it.

12 years agoodp-util: Add support for named ports to odp_flow_key_from_string().
Ben Pfaff [Wed, 26 Oct 2011 17:01:32 +0000 (10:01 -0700)]
odp-util: Add support for named ports to odp_flow_key_from_string().

Really the "trace" command should support this but in fact I need it for
an upcoming update to a test.

12 years agoodp-util: New function factored out of put_userspace_action().
Ben Pfaff [Tue, 25 Oct 2011 23:54:42 +0000 (16:54 -0700)]
odp-util: New function factored out of put_userspace_action().

An upcoming patch to odp-util will add a new user, but this seems like a
reasonable change in any case.

12 years agoodp-util: Code formatting improvements.
Ben Pfaff [Tue, 25 Oct 2011 23:55:29 +0000 (16:55 -0700)]
odp-util: Code formatting improvements.

12 years agoshash: New function shash_find_len().
Ben Pfaff [Thu, 17 Nov 2011 17:57:40 +0000 (09:57 -0800)]
shash: New function shash_find_len().

This will acquire a user in an upcoming commit that uses it in parsing
without modifying the text being parsed or copying it.

12 years agoflow: Rename flow_compare() to flow_compare_3way().
Ben Pfaff [Tue, 25 Oct 2011 23:33:38 +0000 (16:33 -0700)]
flow: Rename flow_compare() to flow_compare_3way().

I like the _3way suffix convention.  It makes the interpretation of the
return value clear.  We use it elsewhere in the tree, so use it here too.

There weren't any users of flow_compare() outside of flow.h, but there soon
will be.

12 years agoofproto-dpif: Improve RSPAN translation performance from O(n**2) to O(n).
Ben Pfaff [Wed, 5 Oct 2011 23:33:57 +0000 (16:33 -0700)]
ofproto-dpif: Improve RSPAN translation performance from O(n**2) to O(n).

This code previously checked whether each individual mirror output was
already in the set of destinations.  This is O(n**2) in the number of
ports in a bridge.

The new code uses a smarter algorithm to eliminate duplicates, one that is
O(n) in the number of ports in a bridge.

12 years agoofproto-dpif: Make compose_mirror_dsts() harder to screw up.
Ben Pfaff [Wed, 5 Oct 2011 22:42:17 +0000 (15:42 -0700)]
ofproto-dpif: Make compose_mirror_dsts() harder to screw up.

I came close to add a "continue;" inside the main "while" loop in
compose_mirror_dsts(), which would have turned it into an infinite loop.
This commit changes it to a "for" loop that is harder to screw up.

12 years agoofproto-dpif: Remove duplicate VLAN logic.
Ben Pfaff [Fri, 11 Nov 2011 23:25:49 +0000 (15:25 -0800)]
ofproto-dpif: Remove duplicate VLAN logic.

flow_get_vlan() duplicated the logic in input_vid_to_vlan() in an
unclear way and added some logic of its own to detect invalid
input VLANs.  This commit eliminates the duplication and makes the
code easier to understand.

12 years agoofproto-dpif: Do not output RSPAN packets to SPAN ports.
Ben Pfaff [Wed, 5 Oct 2011 22:26:49 +0000 (15:26 -0700)]
ofproto-dpif: Do not output RSPAN packets to SPAN ports.

It's always been my intention that ports used as port mirroring
destinations (SPAN) be reserved solely for that purpose.  When SPAN and
RSPAN are both configured, however, RSPAN mirror packets could get directed
to SPAN ports, which was unintentional.

This commit also updates the documentation to make it clear (if that is
even necessary) that this behavior is intentional.

Found by inspection.

12 years agoodp-util: Reorder OVS_KEY_ATTR_* cases for consistency.
Ben Pfaff [Thu, 17 Nov 2011 18:11:12 +0000 (10:11 -0800)]
odp-util: Reorder OVS_KEY_ATTR_* cases for consistency.

This matches the order of their definition in openvswitch.h.

Reported-by: Justin Pettit <jpettit@nicira.com>
12 years agorhel: Add Red Hat network scripts integration.
Alexey I. Froloff [Thu, 3 Nov 2011 17:30:04 +0000 (10:30 -0700)]
rhel: Add Red Hat network scripts integration.

[Spec file changes and some documentation updates by Ben Pfaff.]

12 years agodatapath: Dont export get_dp().
Pravin B Shelar [Thu, 17 Nov 2011 00:52:24 +0000 (16:52 -0800)]
datapath: Dont export get_dp().

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@jessegross.com>
12 years agodatapath: Fix flow table sparse RCU annotations.
Jesse Gross [Thu, 17 Nov 2011 00:01:32 +0000 (16:01 -0800)]
datapath: Fix flow table sparse RCU annotations.

Some overzealous marking of pointers as __rcu caused sparse to flag
errors.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Reformat copyright messages.
Jesse Gross [Wed, 16 Nov 2011 21:39:40 +0000 (13:39 -0800)]
datapath: Reformat copyright messages.

Many of our kernel copyright messages make reference to code being
copied from the Linux kernel, which is a bit odd for code in the
kernel.  This changes them to use the standard GNU GPL boilerplate
instead.  It does not change the actual license, which continues to
be GPLv2.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agoflow: flow_extract() improperly parses IPv6 TOS bits.
Ethan Jackson [Wed, 16 Nov 2011 02:35:26 +0000 (18:35 -0800)]
flow: flow_extract() improperly parses IPv6 TOS bits.

This problem could cause userspace to automatically evict IPv6
flows from the datapath which had TOS bits set.

Bug #8323.

12 years agodatapath: Properly validate length of OVS_KEY_ATTR_ENCAP attributes.
Ben Pfaff [Wed, 16 Nov 2011 00:02:39 +0000 (16:02 -0800)]
datapath: Properly validate length of OVS_KEY_ATTR_ENCAP attributes.

Without this, every VLAN packet goes to userspace because VLAN flows
cannot be set up.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agoofproto: Disable STP when unregistering a port.
Justin Pettit [Tue, 15 Nov 2011 09:33:08 +0000 (01:33 -0800)]
ofproto: Disable STP when unregistering a port.

If a port is removed when spanning tree was configured on it, then the
system may crash, since the STP library will try to send packets out a
now non-existent port.  This commit disables STP on ports when they are
destroyed.

12 years agostp: Fix tick remainder calculation.
Justin Pettit [Tue, 15 Nov 2011 08:20:09 +0000 (00:20 -0800)]
stp: Fix tick remainder calculation.

The spanning tree library keeps track of time to know how often it
should update its state and send out BPDUs.  OVS is able to track time
in milliseconds, but STP uses a coarser-grained count (256 ticks per
second).  To prevent losing milliseconds that didn't account for an
entire tick, the library keeps track of these remaining milliseconds.  A
bug miscalculated the remainder and made it too high, which caused the
library to think time was passing more quickly than it was.

This bug wasn't noticeable on a quiet system, since STP only asks to be
woken every second.  However, a system with a lot of activity would wake
OVS more frequently and have it call the subsystems' "run" functions.

Bug #8283

12 years agostp: Track BPDU tx and rx counts.
Justin Pettit [Mon, 14 Nov 2011 23:04:14 +0000 (15:04 -0800)]
stp: Track BPDU tx and rx counts.

When debugging spanning tree, it's useful to have counters about how
many BPDUs have been sent and received.  This commit keeps track of
these counters and stores them in a new "statistics" column of the Port
table.

Feature #8103

12 years agodatapath: Don't drop packets with partial vlan tags.
Ben Pfaff [Tue, 15 Nov 2011 01:19:41 +0000 (17:19 -0800)]
datapath: Don't drop packets with partial vlan tags.

In the future it is likely that our vlan support will expand to
include multiply tagged packets.  When this happens, we would
ideally like for it to be consistent with our current tagging.

Currently, if we receive a packet with a partial VLAN tag we will
automatically drop it in the kernel, which is unique among the
protocols we support.  The only other reason to drop a packet is
a memory allocation error.  For a doubly tagged packet, we will
parse the first tag and indicate that another tag was present but
do not drop if the second tag is incorrect as we do not parse it.

This changes the behavior of the vlan parser to match other protocols
and also deeper tags by indicating the presence of a broken tag with
the 802.1Q EtherType but no vlan information.  This shifts the policy
decision to userspace on whether to drop broken tags and allows us to
uniformly add new levels of tag parsing.

Although additional levels of control are provided to userspace, this
maintains the current behavior of dropping packets with a broken
tag when using the NORMAL action because that is the correct behavior
for an 802.1Q-aware switch.  The userspace flow parser actually
already had the new behavior so this corrects an inconsistency.

Reported-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agodatapath: Describe policy for extending flow key, implement needed changes.
Ben Pfaff [Mon, 14 Nov 2011 23:56:43 +0000 (15:56 -0800)]
datapath: Describe policy for extending flow key, implement needed changes.

When the datapath was converted to use Netlink attributes for describing
flow keys, I had a vague idea of how it could be smoothly extensible, but
I didn't actually implement extensibility or carefully think it through.
This commit adds a document that describes how flow keys can be extended
in a compatible fashion and adapts the existing interface to match what
it says.

This commit doesn't actually implement extensibility.  I already have a
separate patch series out for that.  This patch series borrows from that
one heavily, but the extensibility series will need to be reworked
somewhat once this one is in.

This commit is only lightly tested because I don't have a good test setup
for VLANs.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agodatapath: Allow flow key Netlink attributes to appear in any order.
Ben Pfaff [Mon, 14 Nov 2011 23:09:01 +0000 (15:09 -0800)]
datapath: Allow flow key Netlink attributes to appear in any order.

This is more conventional use of Netlink.

For upstreaming, 'u64 attrs' can be changed to u32 and the uses of 1ULL
can be changed to 1.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agoMake unixctl_command_register() idempotent
Simon Horman [Mon, 14 Nov 2011 08:41:28 +0000 (17:41 +0900)]
Make unixctl_command_register() idempotent

The assert() statement in unixctl_command_register() implies that it is
intended to be idempotent but inserting the same name and callback twice
would fail because:

* The callback is not stored directly in the hash, rather it the
  cb element of a struct unixctl_command which is stored in the hash.

* Insertion would be attempted even if the entry was already present.

12 years agorhel: Add ability to enable bridge compatibility mode in /etc/sysconfig/openvswitch
Tyler Coumbes [Mon, 14 Nov 2011 17:08:03 +0000 (09:08 -0800)]
rhel: Add ability to enable bridge compatibility mode in /etc/sysconfig/openvswitch

Add the ability to enable bridge compatibility mode through BRCOMPAT
variable in /etc/sysconfig/openvswitch for the rhel build. When
BRCOMPAT is set to 'yes' the brcompat_mod will be loaded and
ovs-brcompatd daemon will be started.

12 years agoopenvswitch.h: Change OVS_KEY_ATTR_TUN_ID from 100 to 63.
Ben Pfaff [Thu, 10 Nov 2011 00:15:36 +0000 (16:15 -0800)]
openvswitch.h: Change OVS_KEY_ATTR_TUN_ID from 100 to 63.

It's useful to be able to track sets of attributes by using their values as
bit indexes.  That's easier if the values are all in the range of a basic
C integer type.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agodatapath: Rearrange ovs_key_lens.
Ben Pfaff [Fri, 11 Nov 2011 18:28:48 +0000 (10:28 -0800)]
datapath: Rearrange ovs_key_lens.

This seems clearer to me.  It should not cause any behavioral change.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agodatapath: Use correct ethernet addr len.
Pravin B Shelar [Sat, 12 Nov 2011 00:09:20 +0000 (16:09 -0800)]
datapath: Use correct ethernet addr len.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agodocs: Always build ovs-vswitchd.conf.db.5 in srcdir.
Ben Pfaff [Fri, 11 Nov 2011 23:10:55 +0000 (15:10 -0800)]
docs: Always build ovs-vswitchd.conf.db.5 in srcdir.

Otherwise we build it in the build directory by default, which breaks the
Debian package build (unless we're working from a "make dist" created
tarball since that has ovs-vswitchd.conf.db.5 in the srcdir as part of
the distribution).

Reported-by: Ansis Atteka <aatteka@nicira.com>
Tested-by: Ansis Atteka <aatteka@nicira.com>
12 years agoovs-ofctl: Document behavior when table=255 is specified.
Ben Pfaff [Thu, 10 Nov 2011 17:09:36 +0000 (09:09 -0800)]
ovs-ofctl: Document behavior when table=255 is specified.

Reported-by: Michael Mao <mmao@nicira.com>
12 years agoclassifier: Use HMAP_FOR_EACH, HMAP_FOR_EACH_CONTINUE.
Ben Pfaff [Thu, 10 Nov 2011 00:24:19 +0000 (16:24 -0800)]
classifier: Use HMAP_FOR_EACH, HMAP_FOR_EACH_CONTINUE.

I like how this removes over 20 lines of code and ends up more readable.

12 years agonetlink: Refactor and simplify nl_policy_parse().
Ben Pfaff [Mon, 7 Nov 2011 17:21:03 +0000 (09:21 -0800)]
netlink: Refactor and simplify nl_policy_parse().

12 years agonetlink: Use NL_ATTR_FOR_EACH in nl_policy_parse().
Ben Pfaff [Tue, 1 Nov 2011 21:48:44 +0000 (14:48 -0700)]
netlink: Use NL_ATTR_FOR_EACH in nl_policy_parse().

I don't see a reason not to use it and it simplifies the code a lot.

12 years agonetlink: New macro NL_POLICY_FOR.
Ben Pfaff [Mon, 7 Nov 2011 17:21:17 +0000 (09:21 -0800)]
netlink: New macro NL_POLICY_FOR.

12 years agoodp-util: Use ovs_key_attr_to_string() names in format_odp_key_attr().
Ben Pfaff [Mon, 7 Nov 2011 21:19:38 +0000 (13:19 -0800)]
odp-util: Use ovs_key_attr_to_string() names in format_odp_key_attr().

12 years agoodp-util: Adjust style.
Ben Pfaff [Mon, 7 Nov 2011 17:14:46 +0000 (09:14 -0800)]
odp-util: Adjust style.

Usually we don't put a new-line in prototypes unless we have to.  I also
think that this comment deserves to be higher up in the file, so I moved
it.

12 years agoodp-util: Trigger warning for unhandled attrs in format_odp_key_attr().
Ben Pfaff [Mon, 7 Nov 2011 17:13:53 +0000 (09:13 -0800)]
odp-util: Trigger warning for unhandled attrs in format_odp_key_attr().

I usually do things this way but must have overlooked this one a while ago.

12 years agoodp-util: New function ovs_key_attr_to_string().
Ben Pfaff [Mon, 7 Nov 2011 21:13:36 +0000 (13:13 -0800)]
odp-util: New function ovs_key_attr_to_string().

This seems like a worthwhile improvement in itself, but it will also see
additional users in upcoming commits.

12 years agoopenvswitch.h: Improve comments.
Ben Pfaff [Wed, 2 Nov 2011 00:13:06 +0000 (17:13 -0700)]
openvswitch.h: Improve comments.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agodatapath: remove actions.h
Pravin B Shelar [Fri, 11 Nov 2011 03:35:37 +0000 (19:35 -0800)]
datapath: remove actions.h

There are only two symbols in actions.h. Compatibility function
is moved to compat.h and execute_actions() declaration is moved
to datapath.h

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agodatapath: Don't use Nicira's OUI for generating mac-address.
Pravin B Shelar [Fri, 11 Nov 2011 03:34:27 +0000 (19:34 -0800)]
datapath: Don't use Nicira's OUI for generating mac-address.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agodatapath: Remove unnecessary definition of is_internal_vport()
Pravin B Shelar [Fri, 11 Nov 2011 03:33:15 +0000 (19:33 -0800)]
datapath: Remove unnecessary definition of is_internal_vport()

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agodatapath: Use skb_copy_and_csum_dev() to csum upcall packet.
Pravin B Shelar [Fri, 11 Nov 2011 03:31:24 +0000 (19:31 -0800)]
datapath: Use skb_copy_and_csum_dev() to csum upcall packet.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agoflow: htons() zero initializers to make their size more clear.
Justin Pettit [Thu, 10 Nov 2011 07:54:33 +0000 (23:54 -0800)]
flow: htons() zero initializers to make their size more clear.

12 years agoflow: Use FWW_ flags to wildcard IP DSCP and ECN.
Justin Pettit [Thu, 10 Nov 2011 07:39:16 +0000 (23:39 -0800)]
flow: Use FWW_ flags to wildcard IP DSCP and ECN.

It's no longer necessary to maintain a "nw_tos_mask" wildcard member,
since we only care about completely wildcarding the DSCP and ECN
portions of the IP TOS field.  This commit makes that change.  It also
goes a bit further in internally using "tos" to refer to the entire TOS
field (ie, DSCP and ECN).  We must still refer to the DSCP portions as
"nw_tos" externally through OpenFlow 1.0, since that's the convention it
uses.

12 years agoofp-util: Rename MAY_IPV6_ADDR to MAY_IPV6.
Justin Pettit [Thu, 10 Nov 2011 01:49:49 +0000 (17:49 -0800)]
ofp-util: Rename MAY_IPV6_ADDR to MAY_IPV6.

The MAY_IPV6_ADDR function now includes the IPv6 flow label, so it is
clearer to just call it MAY_IPV6.

12 years agoclassifier: Don't check masks when adding IPv4/IPv6 addresses.
Justin Pettit [Thu, 10 Nov 2011 01:42:17 +0000 (17:42 -0800)]
classifier: Don't check masks when adding IPv4/IPv6 addresses.

The meta-flow code enforces IPv4/IPv6 masks, so there's no reason to do
it again in the classifier.  This allows a number of functions to be
removed, since the only callers were in this classifier code.

12 years agoPrepend "nw_" to "frag" and "tos" elements.
Justin Pettit [Thu, 10 Nov 2011 01:10:27 +0000 (17:10 -0800)]
Prepend "nw_" to "frag" and "tos" elements.

Most of the members in structures referring to network elements indicate
the layer (e.g., "tl_", "nw_", "tp_").  The "frag" and "tos" members
didn't, so this commit add them.

12 years agodatapath: Kernel flow metadata parsing should be less restrictive
Ansis Atteka [Tue, 8 Nov 2011 22:32:13 +0000 (14:32 -0800)]
datapath: Kernel flow metadata parsing should be less restrictive

The function flow_metadata_from_nlattrs() is very restrictive
about the ordering and type of metadata attributes that it receives.
This patch will change flow_metadata_from_nlattrs() behavior by
ignoring attributes that it does not understand and allowing them
to be passed in arbitrary order.

Issue #8167

Signed-off-by: Ansis Atteka <aatteka@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agodebian: Strip epoch from version number used in directory names.
Ben Pfaff [Wed, 9 Nov 2011 16:35:33 +0000 (08:35 -0800)]
debian: Strip epoch from version number used in directory names.

This doesn't fix a visible bug, since there's no epoch in the Open vSwitch
version used in Debian, but some Nicira internal build scripts were
inserting an epoch so it was visible in our builds.

Reported-by: Edwin Chiu <echiu@nicira.com>
12 years agodatapath: Fix compiler warning on older kernel.
Pravin B Shelar [Thu, 10 Nov 2011 03:47:25 +0000 (19:47 -0800)]
datapath: Fix compiler warning on older kernel.

commit 6455100f38e9312346f4d58511595f695d813537 (datapath: Fix
coding style issues) introduced this issue.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agodatapath: Fix comment formatting.
Jesse Gross [Wed, 9 Nov 2011 22:13:44 +0000 (14:13 -0800)]
datapath: Fix comment formatting.

A few of the recently added fields in struct sw_flow_key had
comments that weren't properly aligned.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Rename ipv6_tos to ipv6_tclass.
Justin Pettit [Wed, 9 Nov 2011 20:17:38 +0000 (12:17 -0800)]
datapath: Rename ipv6_tos to ipv6_tclass.

IPv6 uses the term "traffic class" for what IPv4 calls
"type-of-service".  This commit renames the the "ipv6_tos" field to
"ipv6_tclass" in the "ovs-key_ipv6" struct to be more consistent with
the IPv6 terminology.

Suggested-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agoodp-util: Use PRIu8 instead of PRId8 when printing ip_proto.
Justin Pettit [Tue, 8 Nov 2011 07:47:38 +0000 (23:47 -0800)]
odp-util: Use PRIu8 instead of PRId8 when printing ip_proto.

Suggested-by: Ben Pfaff <blp@nicira.com>
12 years agoSupport matching and modifying IP TTL.
Justin Pettit [Sat, 5 Nov 2011 22:48:12 +0000 (15:48 -0700)]
Support matching and modifying IP TTL.

Add support matching the IPv4 TTL and IPv6 hop limit fields.  This
commit also adds support for modifying the IPv4 TTL.  Modifying the IPv6
hop limit isn't currently supported, since we don't support modifying
IPv6 headers.

We will likely want to change the user-space interface, since basic
matching and setting the TTL are not generally useful.  We will probably
want the ability to match on extraordinary events (such as TTL of 0 or 1)
and a decrement action.

Feature #8024

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agoSupport matching and modifying IP ECN bits.
Justin Pettit [Thu, 3 Nov 2011 06:34:15 +0000 (23:34 -0700)]
Support matching and modifying IP ECN bits.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agoDon't overload IP TOS with the frag matching bits.
Justin Pettit [Thu, 3 Nov 2011 01:17:36 +0000 (18:17 -0700)]
Don't overload IP TOS with the frag matching bits.

This will be useful later when we add support for matching the ECN bits
within the TOS field.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agoSupport matching IPv6 flow label.
Justin Pettit [Tue, 1 Nov 2011 22:57:56 +0000 (15:57 -0700)]
Support matching IPv6 flow label.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agoflow: Rearrange IPv6 addresses to remove potential hole in structure.
Justin Pettit [Thu, 3 Nov 2011 01:22:22 +0000 (18:22 -0700)]
flow: Rearrange IPv6 addresses to remove potential hole in structure.

On some platforms, the in6_addr structure is made up of 16- or 32-bit
members.  Depending on the members of the "flow" structure, this can
lead to holes in the middle.  Moving the IPv6 addresses to the middle
fixes that on these platforms.

12 years agoovs-ofctl: Clarify that nw_tos doesn't match on ARP.
Justin Pettit [Sat, 5 Nov 2011 22:51:37 +0000 (15:51 -0700)]
ovs-ofctl: Clarify that nw_tos doesn't match on ARP.

12 years agodatapath: Properly calculate checksum when updating TOS field.
Justin Pettit [Mon, 7 Nov 2011 07:37:21 +0000 (23:37 -0800)]
datapath: Properly calculate checksum when updating TOS field.

When updating the IP TOS field, the checksum was not properly calculated
on little endian systems.  This commit fixes the issue.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agoofproto-dpif: Actually disable STP on port when disabling STP on port.
Justin Pettit [Wed, 9 Nov 2011 01:31:04 +0000 (17:31 -0800)]
ofproto-dpif: Actually disable STP on port when disabling STP on port.

When disabling STP on a port that has it enabled on the bridge, STP was
not actually being disabled on the port.  This commit directly calls the
update function in this situation.

Reported-by: Paul Ingram <paul@nicira.com>
12 years agodatapath: Update kernel support to 3.2.
Pravin B Shelar [Tue, 8 Nov 2011 23:25:12 +0000 (15:25 -0800)]
datapath: Update kernel support to 3.2.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Bug #7772

12 years agodatapath: Fix vport tx_packets count.
Pravin B Shelar [Tue, 8 Nov 2011 19:16:24 +0000 (11:16 -0800)]
datapath: Fix vport tx_packets count.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agotunneling: Separate out multicast port pools.
Jesse Gross [Tue, 8 Nov 2011 04:01:52 +0000 (20:01 -0800)]
tunneling: Separate out multicast port pools.

Currently multicast and unicast tunnel ports share port pools but
there's no overlap between the two in the lookup, which means that
we can do a lookup that has no chance of ever finding a port.  This
separates them out.

Suggested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agotunneling: Reduce priority of multicast tunnels.
Jesse Gross [Sun, 6 Nov 2011 00:18:04 +0000 (17:18 -0700)]
tunneling: Reduce priority of multicast tunnels.

It's possible to have an incoming packet that matches both a unicast
and multicast tunnel if the source address corresponds to the remote_ip
of a unicast tunnel and the destination is multicast.  Currently this
will match the multicast tunnel but in reality the unicast tunnel
should probably be considered more specific.  This is actually a
common situation in protocols that use a combination of multicast
for flooding and unicast for responses.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Renumber non-upstreamable interfaces.
Jesse Gross [Sun, 6 Nov 2011 03:13:55 +0000 (20:13 -0700)]
datapath: Renumber non-upstreamable interfaces.

The interfaces related to tunneling aren't finalized enough to be
sent upstream but we also still want to retain them in the OVS
repository.  Since userspace should be compatible with both versions
of the kernel, this renumbers the tunnel interfaces to high numbers
so that we can continue to add new interfaces without conflict.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Slim down the vport interface.
Jesse Gross [Sun, 6 Nov 2011 00:08:21 +0000 (17:08 -0700)]
datapath: Slim down the vport interface.

Many of the function in vport.c are simply pass throughs to their
underlying vport implementation and, of these, many are used only
for bridge compatibility code.  This allows users of these functions
to directly call through the ops structure, reducing boilerplate code
and keeping more of the compatibility code together.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Remove vport from OVS_CB.
Jesse Gross [Sat, 5 Nov 2011 23:43:34 +0000 (16:43 -0700)]
datapath: Remove vport from OVS_CB.

Now that most fix function logic (like sFlow) has been moved to
userspace, the vport member of OVS_CB is no longer used by anything,
so drop it.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Fix coding style issues.
Pravin B Shelar [Mon, 7 Nov 2011 23:53:01 +0000 (15:53 -0800)]
datapath: Fix coding style issues.

Most of issues are reported by checkpatch.pl

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Bug #7771

13 years agodebian: Fix build failure installing ovs-vswitchd.conf.db(5) manpage.
Ben Pfaff [Fri, 4 Nov 2011 20:53:44 +0000 (13:53 -0700)]
debian: Fix build failure installing ovs-vswitchd.conf.db(5) manpage.

ovs-vswitchd.conf.db is distributed so it's in the source directory not
the build directory.

This fixes a Debian package build failure introduced by commit 9840bdbd
"debian: Install ovs-vswitchd.conf.db(5) manpage."  I did test that commit
but the build failure didn't show up in my environment (probably I had a
stray file left over from development).

13 years agodatapath: Define net_device_ops->ndo_get_stats64() for internal_dev.
Pravin B Shelar [Fri, 4 Nov 2011 20:32:27 +0000 (13:32 -0700)]
datapath: Define net_device_ops->ndo_get_stats64() for internal_dev.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Bug #7772

13 years agodatapath: Convert internal_dev to ndo_fix_features.
Pravin B Shelar [Fri, 4 Nov 2011 20:31:45 +0000 (13:31 -0700)]
datapath: Convert internal_dev to ndo_fix_features.

From 2.6.39 kernel netdev features are set using set_features and
fix_features APIs. Since internal-dev does not need any special
checks on setting feature, there is no need to define set_features
or fix_features. Only hw_features needs to be set to features that
are supported by internal-dev.

Following patch does same and drops discrete offload setting ops for
newer kernel.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Bug #7772