sliver-openvswitch.git
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

12 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).

12 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

12 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

12 years agometa-flow: Update mf_field description of size.
Justin Pettit [Sun, 30 Oct 2011 03:31:00 +0000 (20:31 -0700)]
meta-flow: Update mf_field description of size.

Commit 7257b5 (Implement new fragment handling policy.) added a new
"is_frag" meta-field that used fewer bits than the width of the field.
A comment in mf_field lists these cases, but "is_frag" wasn't included.
This commit updates that.

12 years agonx-match: Increase upper bound length for an nx_match.
Justin Pettit [Sun, 30 Oct 2011 03:04:21 +0000 (20:04 -0700)]
nx-match: Increase upper bound length for an nx_match.

Commits d2c0fed (nicira-ext: Bump number of registers to five from
four.) and 7257b5 (Implement new fragment handling policy.) added new
match fields, but didn't update the maximum length of an NXM message.
This commit increases the maximum NXM size to 384 bytes.

12 years agotests: Provide banner for ODP tests.
Justin Pettit [Mon, 31 Oct 2011 21:32:08 +0000 (14:32 -0700)]
tests: Provide banner for ODP tests.

Previously, the ODP tests were being grouped together with the ovs-ofctl
ones, which is clearly not right.  This commit puts it in its own
"datapath parsing and formatting" group.

12 years agoovs-ofctl: Correct bad reference in parse-flows error message.
Justin Pettit [Thu, 3 Nov 2011 06:27:24 +0000 (23:27 -0700)]
ovs-ofctl: Correct bad reference in parse-flows error message.

12 years agobond: Only drop packets that indicate moves on SLB bonds.
Ben Pfaff [Fri, 28 Oct 2011 20:27:27 +0000 (13:27 -0700)]
bond: Only drop packets that indicate moves on SLB bonds.

SLB bonds, for important reasons, drop most incoming packets that indicate
that a MAC has moved to the bond from another port.  These reasons do not
apply to other types of bonds, but until now OVS has still dropped them.

This fixes the problem.  It changes behavior of active-backup bonds and
stable bonds, neither of which has the same problem as SLB.  Behavior of
SLB bonds and TCP bonds in SLB fallback mode is unaffected.

Bug #7928.

12 years agodebian: Install ovs-vswitchd.conf.db(5) manpage.
Ben Pfaff [Fri, 4 Nov 2011 16:57:50 +0000 (09:57 -0700)]
debian: Install ovs-vswitchd.conf.db(5) manpage.

This manpage wasn't getting installed.  This fixes it.

The --language=C option to dh_installman is necessary to keep that script
from thinking that the ".db" suffix indicates a translation into the "db"
language (which doesn't actually exist) and therefore installing it into
the wrong directory with the .db suffix stripped.

Bug #8138.
Reported-by: Ethan Jackson <ethan@nicira.com>
12 years agodatapath: Don't set flags on internal vports.
Jesse Gross [Fri, 4 Nov 2011 01:12:09 +0000 (18:12 -0700)]
datapath: Don't set flags on internal vports.

We currently set netdev->flags to IFF_BROADCAST | IFF_MULTICAST
but this is unnecessary because it's already done by ether_setup().

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agocfm: Support tagged CCM PDUs.
Ethan Jackson [Thu, 3 Nov 2011 20:03:16 +0000 (13:03 -0700)]
cfm: Support tagged CCM PDUs.

This patch also causes eth_compose() to set the l2 and l3 pointers
of the packets which it modifies.

12 years agodatapath: Fix indentation in pop_vlan().
Ben Pfaff [Wed, 2 Nov 2011 17:46:53 +0000 (10:46 -0700)]
datapath: Fix indentation in pop_vlan().

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
12 years agoofproto-dpif: Use send_packet() instead of netdev_send().
Jesse Gross [Sun, 23 Oct 2011 00:22:11 +0000 (17:22 -0700)]
ofproto-dpif: Use send_packet() instead of netdev_send().

netdev_send() directly sends a packet using Linux mechanisms, skipping
our kernel module. Several upper layer abstractions are built on top of
the kernel module, so this means that we loose stats, sFlow, etc. on
these packets. This changes bonding, LACP, and STP to use send_packet()
as CFM does, which uses the standard kernel mechanisms and provides a
single place that needs to be updated.

12 years agodatapath: Drop useless WARN_ON_ONCE during flow conversion.
Jesse Gross [Tue, 1 Nov 2011 22:35:31 +0000 (15:35 -0700)]
datapath: Drop useless WARN_ON_ONCE during flow conversion.

This checks whether key_len is not zero but we set the key length
at the beginning of the function, so I don't see this as a useful
check.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agodatapath: Add IPv6 to list of parsed EtherTypes.
Jesse Gross [Tue, 1 Nov 2011 22:25:14 +0000 (15:25 -0700)]
datapath: Add IPv6 to list of parsed EtherTypes.

The kernel can parse IPv6, so if it receives a flow with an IPv6
EtherType then it expects to get IPv6 information as well.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agostream: Fix uninitialized values in stream_init().
Ben Pfaff [Wed, 2 Nov 2011 19:59:06 +0000 (12:59 -0700)]
stream: Fix uninitialized values in stream_init().

stream_init() didn't initialize the remote_ip, remote_port, local_ip, or
local_port members of the stream, so "unix" streams that don't have any of
those would get random values instead.

Reported-by: "Voravit T." <voravit@kth.se>
Reported-by: Jari Sundell <sundell.software@gmail.com>
12 years agoofproto: Reject invalid input ports in OFPT_PACKET_OUT requests.
Ben Pfaff [Thu, 8 Sep 2011 18:25:29 +0000 (11:25 -0700)]
ofproto: Reject invalid input ports in OFPT_PACKET_OUT requests.

Some invalid ports (those above the maximum port number supported by the
datapath, including OpenFlow reserved ports that are not translated by OVS
into some other number) will be rejected by the datapath.  It's better to
catch these early and send back an appropriate OpenFlow error code, rather
than to just get EINVAL from the kernel and have to guess at the problem.

Reported-by: Aaron Rosen <arosen@clemson.edu>