sliver-openvswitch.git
11 years agoxenserver, rhel: Enable extra ovs-ctl options from init scripts.
Ben Pfaff [Fri, 15 Jun 2012 17:26:34 +0000 (10:26 -0700)]
xenserver, rhel: Enable extra ovs-ctl options from init scripts.

This is useful for passing wrapper script options and possibly for other
purposes.

Bug #11889.
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodebian: Enable passing extra options to ovs-ctl from init scripts.
Ben Pfaff [Fri, 15 Jun 2012 00:12:19 +0000 (17:12 -0700)]
debian: Enable passing extra options to ovs-ctl from init scripts.

This is useful for passing wrapper script options and possibly for other
purposes.

Bug #11889.
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoovs-ctl: Add support for running daemons under valgrind or strace.
Ben Pfaff [Fri, 15 Jun 2012 00:09:30 +0000 (17:09 -0700)]
ovs-ctl: Add support for running daemons under valgrind or strace.

This is occasionally useful for debugging.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoovs-ctl: Document --ovs-brcompatd-priority.
Ben Pfaff [Fri, 15 Jun 2012 00:07:24 +0000 (17:07 -0700)]
ovs-ctl: Document --ovs-brcompatd-priority.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoopenflow: Add ofp11_group
Simon Horman [Wed, 6 Jun 2012 07:26:36 +0000 (16:26 +0900)]
openflow: Add ofp11_group

OFPG11_ANY may be used as the out_group for ofp11_flow_mod and
ofp11_flow_stats_request.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agolib: Utilize smaps in the idl.
Ethan Jackson [Tue, 22 May 2012 08:53:07 +0000 (01:53 -0700)]
lib: Utilize smaps in the idl.

String to string maps are used all over the Open vSwitch database.
Before this patch, they were implemented in the idl as parallel
string arrays.  This strategy has proven a bit cumbersome.  With
this patch, string to string maps are implemented using the smap
library.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agolib: New data structure - smap.
Ethan Jackson [Tue, 22 May 2012 10:47:36 +0000 (03:47 -0700)]
lib: New data structure - smap.

A smap is a string to string hash map.  It has a cleaner interface
than shash's which were traditionally used for the same purpose.
This patch implements the data structure, and changes netdev and
its providers to use it.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agobridge: Simplify VLAN splinter memory management.
Ethan Jackson [Tue, 22 May 2012 23:16:08 +0000 (16:16 -0700)]
bridge: Simplify VLAN splinter memory management.

Before this patch, the VLAN splinter memory management operated on
blocks of memory instead of ovsrec_ports.  This strategy is
problematic in future patches when more than simply calling
'free()' needs to be done to destroy splinter ports.  This patch
solves the problem by keeping track of entire ovsrec_ports instead
of just the memory allocated to create them.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agoofproto: Remove member whose value is always -1 from struct ofoperation.
Ben Pfaff [Thu, 14 Jun 2012 16:30:28 +0000 (09:30 -0700)]
ofproto: Remove member whose value is always -1 from struct ofoperation.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agotests: Add $(check_DATA) to check-valgrind dependencies.
Ben Pfaff [Wed, 13 Jun 2012 20:26:27 +0000 (13:26 -0700)]
tests: Add $(check_DATA) to check-valgrind dependencies.

Otherwise if you run "check-valgrind" in a tree where you've never run
"check", you get some test failures because some data files don't get
generated before the tests run.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agovlog: Avoid use-after-free in corner case.
Ben Pfaff [Tue, 12 Jun 2012 23:45:20 +0000 (16:45 -0700)]
vlog: Avoid use-after-free in corner case.

Found by valgrind.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-util: Improve return type of ofputil_decode_packet_in().
Ben Pfaff [Thu, 7 Jun 2012 03:13:49 +0000 (23:13 -0400)]
ofp-util: Improve return type of ofputil_decode_packet_in().

"enum ofperr" is clearer than "int".

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoopenflow-1.0.h: Clarify meaning of nw_tos in struct ofp_action_nw_tos.
Ben Pfaff [Thu, 7 Jun 2012 03:08:24 +0000 (23:08 -0400)]
openflow-1.0.h: Clarify meaning of nw_tos in struct ofp_action_nw_tos.

So that I don't have to figure it out yet again.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-util: Remove unused functions make_add_simple_flow(), make_del_flow().
Ben Pfaff [Thu, 31 May 2012 03:30:05 +0000 (20:30 -0700)]
ofp-util: Remove unused functions make_add_simple_flow(), make_del_flow().

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoAllow general masking of IPv6 addresses rather than just CIDR masks.
Ben Pfaff [Wed, 23 May 2012 05:49:31 +0000 (22:49 -0700)]
Allow general masking of IPv6 addresses rather than just CIDR masks.

OF1.2 and later make these fields fully maskable so we might as well also.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoAllow general masking of IPv4 addresses rather than just CIDR masks.
Ben Pfaff [Wed, 23 May 2012 05:06:03 +0000 (22:06 -0700)]
Allow general masking of IPv4 addresses rather than just CIDR masks.

OF1.1 and later make these fields fully maskable so we might as well also.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-util: Implement translation to and from OpenFlow 1.1 ofp_match.
Ben Pfaff [Sat, 9 Jun 2012 22:49:16 +0000 (15:49 -0700)]
ofp-util: Implement translation to and from OpenFlow 1.1 ofp_match.

This is another step toward OpenFlow 1.1 support.  The change does not
affect any outwardly visible OpenFlow behavior yet.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agopackets: Add ETH_TYPE_MPLS and ETH_TYPE_MPLS_MCAST.
Ben Pfaff [Tue, 22 May 2012 07:15:25 +0000 (00:15 -0700)]
packets: Add ETH_TYPE_MPLS and ETH_TYPE_MPLS_MCAST.

We need these for OpenFlow 1.1 ofp_match support even if we don't support
MPLS matching (which we don't, yet).

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agopackets: Define IPPROTO_SCTP if not provided by <netinet/in.h>.
Ben Pfaff [Tue, 22 May 2012 04:34:46 +0000 (21:34 -0700)]
packets: Define IPPROTO_SCTP if not provided by <netinet/in.h>.

SUSv3 doesn't require IPPROTO_SCTP so some systems might not provide it.

IPPROTO_SCTP isn't used in the tree yet so this doesn't fix a real bug.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoopenflow-1.0: Rename ofp_match to ofp10_match, OFPFW_* to OFPFW10_*.
Ben Pfaff [Tue, 22 May 2012 04:51:03 +0000 (21:51 -0700)]
openflow-1.0: Rename ofp_match to ofp10_match, OFPFW_* to OFPFW10_*.

This better fits our general policy of adding a version number suffix
to structures and constants whose values differ from one OpenFlow
version to the next.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoopenflow-1.1.h: Fix OFPFW11_* definitions.
Ben Pfaff [Tue, 22 May 2012 07:25:08 +0000 (00:25 -0700)]
openflow-1.1.h: Fix OFPFW11_* definitions.

OFPFW_DL_SRC and OFPFW_DL_DST don't exist in OpenFlow 1.1.  Replace them
by the correct enums.

Most of the change here is due to respacing since DL_VLAN_PCP is one
character wider than any previous name.

This doesn't fix a real bug because these constants didn't have any users
in the tree.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodatapath: Check currect return value from skb_gso_segment()
Pravin B Shelar [Tue, 12 Jun 2012 18:19:16 +0000 (11:19 -0700)]
datapath: Check currect return value from skb_gso_segment()

Fix return check typo.

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

11 years agoFAQ: Mention high CPU usage as symptom of looping the network.
Ben Pfaff [Tue, 12 Jun 2012 18:19:36 +0000 (11:19 -0700)]
FAQ: Mention high CPU usage as symptom of looping the network.

Suggested-by: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoAdd a FAQ.
Ben Pfaff [Tue, 12 Jun 2012 16:40:11 +0000 (09:40 -0700)]
Add a FAQ.

I wrote most of this myself.  The answer to "I can't seem to use Open
vSwitch in a wireless network" is based on a response by Jesse Gross:
http://openvswitch.org/pipermail/discuss/2011-January/004707.html

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofproto: Update comment.
Ben Pfaff [Wed, 30 May 2012 20:15:00 +0000 (13:15 -0700)]
ofproto: Update comment.

CC: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agonx-match: Add parsing and serialisation of OXM matches.
Simon Horman [Mon, 11 Jun 2012 16:56:12 +0000 (09:56 -0700)]
nx-match: Add parsing and serialisation of OXM matches.

This code, which leverages the existing NXM implementation,
adds parsing and serialisation of OXM matches. Test cases
have also been provided.

This patch only implements parsing and serialisation of OXM fields that
are already handled by NXM.

It should be noted that in OXM ports are 32bit whereas in NXM they
are 16 bit. This has been handled as a special case as all other field
widths are the same in both OXM and NXM.

This patch does not address differences in wildcarding between OXM and NXM.
It is planned that liberal wildcarding policy dictated by either OXM or
NXM will be implemented.

This patch also does not address any (subtle?) differences between
OXM and NXM treatment of specific fields. It is envisages that his
can be handled by subsequent patches.

Signed-off-by: Simon Horman <horms@verge.net.au>
[blp@nicira.com adjusted style, added a comment, changed in_port special
 case, enabled NXM extensions to OXM]
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodpif-netdev: Fix use-after-free in dpif_netdev_recv.
Ben Pfaff [Sat, 9 Jun 2012 15:55:29 +0000 (11:55 -0400)]
dpif-netdev: Fix use-after-free in dpif_netdev_recv.

Found by valgrind.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoopenflow: Use spaces for indentation
Simon Horman [Fri, 8 Jun 2012 07:03:34 +0000 (16:03 +0900)]
openflow: Use spaces for indentation

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agopackets: Rename compose_benign_packet().
Ethan Jackson [Fri, 8 Jun 2012 01:24:29 +0000 (18:24 -0700)]
packets: Rename compose_benign_packet().

The name compose_rarp() more clearly describes what it's doing now.

Requested-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agolacp: Print may_enable flag in appctl output.
Ethan Jackson [Thu, 7 Jun 2012 21:21:36 +0000 (14:21 -0700)]
lacp: Print may_enable flag in appctl output.

I would have found this helpful when debugging a problem recently.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agopackets: Use RARPs for learning packets.
Ethan Jackson [Thu, 7 Jun 2012 22:27:22 +0000 (15:27 -0700)]
packets: Use RARPs for learning packets.

Traditionally Open vSwitch had used 802.2 SNAP packets to update
upstream switch learning tables when necessary.  This approach had
advantages in that debugging information could be embedded in the
packet helping hapless admins figure out what's going on.  However,
since both qemu and VMware use RARP for this purpose, it seems
appropriate to fall in line with the defacto standard.

Requested-by: Ben Basler <bbasler@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agodatapath: Fix sparse warning on BUILD_BUG_ON_NOT_POWER_OF_2 definition.
Pravin B Shelar [Thu, 7 Jun 2012 22:20:27 +0000 (15:20 -0700)]
datapath: Fix sparse warning on BUILD_BUG_ON_NOT_POWER_OF_2 definition.

BUILD_BUG_ON_NOT_POWER_OF_2 could been defined in kernel.h or bug.h
depending on kernel version.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
11 years agodatapath: Fix use-after-free bug in dp_notify.
Pravin B Shelar [Thu, 7 Jun 2012 22:18:17 +0000 (15:18 -0700)]
datapath: Fix use-after-free bug in dp_notify.

dp_notify, in unregister case, is accessing vport after detaching
it. Following patch fixes it.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
11 years agoofproto: Fix use after free in ofoperation_complete().
Ethan Jackson [Thu, 7 Jun 2012 20:05:41 +0000 (13:05 -0700)]
ofproto: Fix use after free in ofoperation_complete().

In one edge case, ofoperation_complete() destroys its rule, without
updating its ofoperation that the rule is gone.  Later in the same
function, ofoperation_destroy() attempts to modify the rule which
already destroyed.

Bug #11797.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agoofproto-dpif: Avoid calling eth_addr_is_reserved().
Ethan Jackson [Wed, 6 Jun 2012 22:06:15 +0000 (15:06 -0700)]
ofproto-dpif: Avoid calling eth_addr_is_reserved().

eth_addr_is_reserved() is a bit more expensive than it used to be,
so it makes sense to avoid calling it when convenient as an
optimization.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agopackets: Update the reserved protocols list.
Ethan Jackson [Wed, 6 Jun 2012 22:22:52 +0000 (15:22 -0700)]
packets: Update the reserved protocols list.

The protocols added in this patch should be considered "reserved"
and not forward when "forward-bpdu" is false, nor should they be
mirrored.

Bug #11755.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agopackets: Generalize reserved RSPAN protocols.
Ethan Jackson [Fri, 1 Jun 2012 21:33:41 +0000 (14:33 -0700)]
packets: Generalize reserved RSPAN protocols.

Open vSwitch refuses to mirror certain destination addresses in
addition to those classified by eth_addr_is_reserved().  Looking
through the uses of eth_addr_is_reserved(), one finds that no
callers should be using the additional addresses which mirroring
drops.  This patch folds the additional addresses dropped in the
mirroring code, into the more general eth_addr_is_reserverd()
function.

This patch also changes the implementation in a way that is
slightly less efficient, but much easier to read and extend int he
future.

Bug #11755.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agopackets: Fix eth_addr_equal_except().
Ethan Jackson [Thu, 7 Jun 2012 00:37:46 +0000 (17:37 -0700)]
packets: Fix eth_addr_equal_except().

It turns out that eth_addr_equal_except() computed the exact
opposite of what it purported to.  It returned true if the two
arguments where *not* equal.  This is extremely confusing, so this
patch changes it.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agodpif-linux: Fix invalid format specifier.
Ethan Jackson [Wed, 6 Jun 2012 01:02:30 +0000 (18:02 -0700)]
dpif-linux: Fix invalid format specifier.

This fixes the following warning on my system. "format '%d' expects
argument of type 'int', but argument 5 has type 'long int'"

Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agoovsdb-client: Fix bugs in man page
Bruce Davie [Wed, 6 Jun 2012 01:49:51 +0000 (18:49 -0700)]
ovsdb-client: Fix bugs in man page

In commit 53ffefe9 (ovsdb-client: Make "server" and "database"
arguments optional.), two errors were introduced.  "list-columns"
appeared twice in the list of commands, the first instance should be
"list-tables".  The "monitor" command now lists optional "column"
arguments.

Signed-off-by: Bruce Davie <bsd@nicira.com>
Signed-off-by: Bruce Davie <bdavie@nicira.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agodpif-linux: Log details when a packet is lost.
Ben Pfaff [Fri, 1 Jun 2012 21:40:31 +0000 (17:40 -0400)]
dpif-linux: Log details when a packet is lost.

Until now, when a packet was dropped in the kernel-to-user buffers, we
logged the occurrence but nothing that would allow a person reading the
log after the fact to learn why it was dropped.  This commit adds details
that identify the major sources of packets in the buffer, which should
help.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodpif-linux: Slightly refactor internal data structures.
Ben Pfaff [Wed, 23 May 2012 23:55:09 +0000 (16:55 -0700)]
dpif-linux: Slightly refactor internal data structures.

An initial attempt also replaced the 'uint32_t ready_mask' in struct
dpif_linux by a 'bool ready' in each struct dpif_channel, but I wasn't
happy with the result (the ready_mask bitmap works out really well) and so
I dropped that part.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodpif-linux: Avoid pessimal behavior when kernel-to-user buffers overflow.
Ben Pfaff [Wed, 23 May 2012 21:56:20 +0000 (14:56 -0700)]
dpif-linux: Avoid pessimal behavior when kernel-to-user buffers overflow.

When a kernel-to-user Netlink buffer overflows, the kernel reports
ENOBUFS without passing along an actual message.  When it does this,
we should immediately try again, because we know that there is a
message waiting, instead of reporting the error to the caller.

This improves the OVS response rate to "hping3 --flood" traffic by
a few percentage points in my testing.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agopoll-loop: More strictly rate-limit high CPU use logging.
Ben Pfaff [Fri, 25 May 2012 20:54:38 +0000 (13:54 -0700)]
poll-loop: More strictly rate-limit high CPU use logging.

120 messages per minute just isn't helpful.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoSet dates for release of 1.5.0.
Justin Pettit [Fri, 1 Jun 2012 20:21:50 +0000 (13:21 -0700)]
Set dates for release of 1.5.0.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agoNEWS: Move learning timeout changes to 1.5.0 section.
Justin Pettit [Fri, 1 Jun 2012 20:19:40 +0000 (13:19 -0700)]
NEWS: Move learning timeout changes to 1.5.0 section.

Changes to the default MAC learning timeout and making it configurable
were added in 1.5.0, not 1.6.0.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agoflow: Adds support for arbitrary ethernet masking
Joe Stringer [Mon, 28 May 2012 12:38:21 +0000 (00:38 +1200)]
flow: Adds support for arbitrary ethernet masking

Arbitrary ethernet mask support is one step on the way to support for OpenFlow
1.1+. This patch set seeks to add this capability without breaking current
protocol support.

Signed-off-by: Joe Stringer <joe@wand.net.nz>
[blp@nicira.com made some updates, see
 http://openvswitch.org/pipermail/dev/2012-May/017585.html]
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-util: Clean up cookie handling.
Justin Pettit [Sat, 24 Mar 2012 08:02:26 +0000 (01:02 -0700)]
ofp-util: Clean up cookie handling.

Commit e72e793 (Add ability to restrict flow mods and flow stats
requests to cookies.) modified cookie handling.  Some of its behavior
was unintuitive and there was at least one bug (described below).
Commit f66b87d (DESIGN: Document uses for flow cookies.) attempted to
document a clean design for cookie handling.  This commit updates the
DESIGN document and brings the implementation in line with it.

In commit e72e793, the code that handled processing OpenFlow flow
modification requests set the cookie mask to exact-match.  This seems
reasonable for adding flows, but is not correct for matching, since
OpenFlow 1.0 doesn't support matching based on the cookie.  This commit
changes to cookie mask to fully wildcarded, which is the correct
behavior for modifications and deletions.  It doesn't cause any problems
for flow additions, since the mask is ignored for that operation.

Bug #9742

Reported-by: Luca Giraudo <lgiraudo@nicira.com>
Reported-by: Paul Ingram <paul@nicira.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
11 years agopackets: Adds ethernet-matching helper functions
Joe Stringer [Tue, 29 May 2012 18:07:16 +0000 (11:07 -0700)]
packets: Adds ethernet-matching helper functions

With OpenFlow 1.1 requiring arbitrary ethernet match support, it simplifies
other code if we have some extra helper functions. This patch adds
eth_mask_is_exact(mask), eth_addr_bitand(src, mask, dst),
eth_addr_equal_except(a, b, mask) and eth_format_masked(eth, mask, output).

Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodatapath: Convert net_ratelimit uses to net_<level>_ratelimited
Joe Perches [Fri, 25 May 2012 18:09:56 +0000 (11:09 -0700)]
datapath: Convert net_ratelimit uses to net_<level>_ratelimited

Standardize the net core ratelimited logging functions.

Coalesce formats, align arguments.
Change a printk then vprintk sequence to use printf extension %pV.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jesse Gross <jesse@nicira.com>
11 years agodatapath: Backport net_warn_ratelimited() and friends.
Jesse Gross [Fri, 25 May 2012 18:16:54 +0000 (11:16 -0700)]
datapath: Backport net_warn_ratelimited() and friends.

Signed-off-by: Jesse Gross <jesse@nicira.com>
11 years agodatapath: cleanup unsigned to unsigned int
Eric Dumazet [Fri, 25 May 2012 18:07:35 +0000 (11:07 -0700)]
datapath: cleanup unsigned to unsigned int

Use of "unsigned int" is preferred to bare "unsigned" in net tree.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jesse Gross <jesse@nicira.com>
11 years agodatapath: Remove all #inclusions of asm/system.h
David Howells [Fri, 25 May 2012 18:05:32 +0000 (11:05 -0700)]
datapath: Remove all #inclusions of asm/system.h

Remove all #inclusions of asm/system.h preparatory to splitting and killing
it.  Performed with the following command:

perl -p -i -e 's!^#\s*include\s*<asm/system[.]h>.*\n!!' `grep -Irl '^#\s*include\s*<asm/system[.]h>' *`

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
11 years agoodp-util: Update ODPUTIL_FLOW_KEY_BYTES for current kernel flow format.
Ben Pfaff [Tue, 15 May 2012 19:50:57 +0000 (12:50 -0700)]
odp-util: Update ODPUTIL_FLOW_KEY_BYTES for current kernel flow format.

Before we submitted the kernel module upstream, we updated the flow format
by adding two fields to the description of packets with VLAN headers, but
we forgot to update ODPUTIL_FLOW_KEY_BYTES to reflect these changes.  The
result was that a maximum-length flow did not fit in the given space.

This fixes a crash processing IPv6 neighbor discovery packets with VLAN
headers received in a tunnel configured with key=flow or in_key=flow.

This updates some comments to better describe the implications of
ODPUTIL_FLOW_KEY_BYTES (suggested by Justin).

This also updates test-odp.c so that it would have caught this problem, and
updates odp.at to demonstrate that a full 156 bytes are necessary.  (To see
that, revert the change to ODPUTIL_FLOW_KEY_BYTES and run the test.)

Reported-by: Dan Wendlandt <dan@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoNEWS: Fix up version for "mod-port" item.
Ben Pfaff [Thu, 24 May 2012 21:17:55 +0000 (14:17 -0700)]
NEWS: Fix up version for "mod-port" item.

I originally posted this before the 1.7 branch but it didn't get committed
until afterward, so it needs to be in the "post-1.7.0" group.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoovs-ofctl: Support all OFPPC_* flags in "mod-port" command.
Ben Pfaff [Thu, 24 May 2012 21:01:02 +0000 (14:01 -0700)]
ovs-ofctl: Support all OFPPC_* flags in "mod-port" command.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agomemory: Memory leak when generating reports.
Ethan Jackson [Tue, 22 May 2012 23:43:52 +0000 (16:43 -0700)]
memory: Memory leak when generating reports.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agoovs-dpctl: Don't include include/openvswitch/tunnel.h
Simon Horman [Thu, 24 May 2012 08:15:04 +0000 (17:15 +0900)]
ovs-dpctl: Don't include include/openvswitch/tunnel.h

The inclusion include/openvswitch/tunnel.h does not seem to be needed any
more.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodatapath: Avoid system freeze due to ovs-flow-rehash softlockup.
Pravin B Shelar [Thu, 24 May 2012 00:25:41 +0000 (17:25 -0700)]
datapath: Avoid system freeze due to ovs-flow-rehash softlockup.

OVS datapath does periodic flow table rehash which takes genl_lock
in workq context.
In some cases, like ports add or delete, genl_lock can cause softlockup
as vswitchd would take and succeed with genl_lock and rehash workq
would block on the lock. Eventually rehash will proceed, flow rehash
is low priority task so this is not problem for rehashing.
But it is blocking workq thread; some other workq item from other
kernel subsystem would be blocked and can cause system freeze.
To avoid workq blocking and system freeze, we can use OVS compat workq.
It runs in separate kernel thread thus does not block any non-ovs
deferred workq work item.

We will fix it by making genetlink lockless and having fine granular
locking in OVS.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
11 years agoofproto-dpif-governor: Fix bug in log message.
Ben Pfaff [Tue, 22 May 2012 18:39:25 +0000 (11:39 -0700)]
ofproto-dpif-governor: Fix bug in log message.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoAdd support for tracking and logging daemon memory usage.
Ben Pfaff [Tue, 8 May 2012 22:44:21 +0000 (15:44 -0700)]
Add support for tracking and logging daemon memory usage.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agosimap: New data structure for string-to-integer maps.
Ben Pfaff [Tue, 22 May 2012 17:32:02 +0000 (10:32 -0700)]
simap: New data structure for string-to-integer maps.

This commit adapts a couple of existing pieces of code to use the
new data structure.  The following commit will add another user
(which is also the first use of the simap_increas() function).

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoProperly reopen python daemon log files after rotation.
Ben Pfaff [Tue, 1 May 2012 21:27:06 +0000 (14:27 -0700)]
Properly reopen python daemon log files after rotation.

The OVS Python daemons weren't reopening their log files after rotation, so
all the log information after the second rotation was lost.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agovlog: Take advantage of relaxed "-v" syntax through the tree.
Ben Pfaff [Tue, 1 May 2012 21:03:52 +0000 (14:03 -0700)]
vlog: Take advantage of relaxed "-v" syntax through the tree.

The vlog manpage implies that writing ANY explicitly is obsolete, but
examples elsewhere in the documentation and code still tend to add it.
This removes them.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agopython: Implement "vlog/set", "vlog/list" unixctl commands in Python vlog.
Ben Pfaff [Mon, 14 May 2012 21:00:33 +0000 (14:00 -0700)]
python: Implement "vlog/set", "vlog/list" unixctl commands in Python vlog.

This doesn't implement control over log patterns, though.

The change to vlog.man in this commit doesn't have any practical effect
because OVS doesn't come with any Python daemons that have their own
manpages.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agopython: Implement "vlog/reopen" unixctl command in Python vlog.
Ben Pfaff [Tue, 1 May 2012 21:13:00 +0000 (14:13 -0700)]
python: Implement "vlog/reopen" unixctl command in Python vlog.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agopython: Break unixctl implementation into registry, client, and server.
Ben Pfaff [Mon, 14 May 2012 18:26:36 +0000 (11:26 -0700)]
python: Break unixctl implementation into registry, client, and server.

I wish to add some unixctl commands to the Python vlog module.  However,
importing ovs.unixctl in ovs.vlog creates a circular dependency, because
ovs.unixctl imports ovs.vlog already.  The solution, in this commit, is to
break the unixctl module into three parts: a register (ovs.unixctl) that
does not depend on ovs.vlog, and client (ovs.unixctl.client) and server
(ovs.unixctl.server) modules that do.  This breaks the circular dependency.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agotests: Fix Emacs syntax highlighting in vlog.at.
Ben Pfaff [Mon, 30 Apr 2012 23:49:59 +0000 (16:49 -0700)]
tests: Fix Emacs syntax highlighting in vlog.at.

[^"] confuses the Emacs syntax highlighter for Autotest mode.  It thinks
that it terminates a quoted string and therefore everything following the
next " in the file is highlighted as if it was part of a quoted string.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoUse PYTHONDONTWRITEBYTECODE=yes for invoking Python for build or test.
Ben Pfaff [Tue, 22 May 2012 17:17:00 +0000 (10:17 -0700)]
Use PYTHONDONTWRITEBYTECODE=yes for invoking Python for build or test.

An upcoming commit will break the ovs.vlog module into an ovs.vlog package
with submodules.  This commit makes switching between trees with the old
structure and those with the new structure much easier.

This commit works by setting PYTHONDONTWRITEBYTECODE=yes in Python
invocations from the build system and testing.  This keeps Python 2.6+ from
creating .pyc and .pyo files.  Creating .py[co] works OK for any given
version of Open vSwitch, but it causes trouble if you switch from a version
with foo/__init__.py into an (older) version with plain foo.py, since
foo/__init__.pyc will cause Python to ignore foo.py.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoFix typo in "PYTHONPATH".
Ben Pfaff [Tue, 22 May 2012 17:12:49 +0000 (10:12 -0700)]
Fix typo in "PYTHONPATH".

Reported-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agobridge: Ignore "null" interfaces as required.
Ethan Jackson [Mon, 21 May 2012 20:20:18 +0000 (13:20 -0700)]
bridge: Ignore "null" interfaces as required.

Commit bae7208e91a0 (bridge: Refactor bridge_reconfigure().)
introduced a regression in which the switch would attempt to
instantiate "null" interfaces in the datapath. This would, of
course, fail and trigger a warning.  Though harmless, these
warnings confused users.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agodatapath: Fix Tunnel options TOS
Pravin B Shelar [Mon, 21 May 2012 19:18:50 +0000 (12:18 -0700)]
datapath: Fix Tunnel options TOS

Use DSCP bits from ToS set on tunnel.

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

11 years agotunnel: Accept 'set options:tos' as hex value.
Pravin B Shelar [Mon, 21 May 2012 19:18:19 +0000 (12:18 -0700)]
tunnel: Accept 'set options:tos' as hex value.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Bug #8822

11 years agoofp-util: Fix stale comment.
Ethan Jackson [Wed, 16 May 2012 15:22:17 +0000 (08:22 -0700)]
ofp-util: Fix stale comment.

'flow_mod_table_id' is no longer an argument to
ofputil_encode_flow_mod(), its information is now encoded in the
'protocol' argument.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agogitignore: Add ovs-check-dead-ifs.
Ethan Jackson [Wed, 16 May 2012 15:24:26 +0000 (08:24 -0700)]
gitignore: Add ovs-check-dead-ifs.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
11 years agodatapath: Reset upper layer protocol info on internal devices.
Jesse Gross [Thu, 17 May 2012 18:43:15 +0000 (11:43 -0700)]
datapath: Reset upper layer protocol info on internal devices.

It's possible that packets that are sent on internal devices (from
the OVS perspective) have already traversed the local IP stack.
After they go through the internal device, they will again travel
through the IP stack which may get confused by the presence of
existing information in the skb. The problem can be observed
when switching between namespaces. This clears out that information
to avoid problems but deliberately leaves other metadata alone.
This is to provide maximum flexibility in chaining together OVS
and other Linux components.

Bug #10995

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
11 years agoPORTING: Add hint to adjust the default fail-mode, for hardware ports.
Ben Pfaff [Wed, 16 May 2012 19:43:21 +0000 (12:43 -0700)]
PORTING: Add hint to adjust the default fail-mode, for hardware ports.

Suggested-by: Rob Sherwood <rob.sherwood@bigswitch.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agovswitch.xml: Describe current default fail_mode.
Ben Pfaff [Thu, 10 May 2012 22:53:19 +0000 (15:53 -0700)]
vswitch.xml: Describe current default fail_mode.

We are thinking about changing the default, so this leaves that open
for the future.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoovs-vsctl: Add "--all" option for "destroy" command in ovs-vsctl.
Arun Sharma [Wed, 16 May 2012 18:39:55 +0000 (11:39 -0700)]
ovs-vsctl: Add "--all" option for "destroy" command in ovs-vsctl.

Adds the ability to delete all records from table. This will help
users to destroy all records from Qos or Queue table using single
command rather then current method.

Feature #11306
Suggested-by: Kevin Mancuso <kevin.mancuso@rackspace.com>
Signed-off-by: Arun Sharma <arun.sharma@calsoftinc.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodpif-netdev: allow for proper destruction of netdev datapaths
Giuseppe Lettieri [Wed, 9 May 2012 10:17:15 +0000 (12:17 +0200)]
dpif-netdev: allow for proper destruction of netdev datapaths

Until now, bridges with datapath_type=netdev did not destroy the datapath
when deleted. In particular, the tap device implementing the internal
interface was not close()d, and therefore the tap persists until
ovs-vswitchd exit()s.

This behaviour was caused by the missing callback for 'enumerate' in the
dpif-netdev class. Without this callback 'bridge_reconfigure' failed to
realize that there are datapaths with no bridge, and thus cannot destroy
them. Providing an 'enumerate' callback fixes this.

Signed-off-by: Giuseppe Lettieri <g.lettieri@iet.unipi.it>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodaemon: Add comment.
Ben Pfaff [Mon, 14 May 2012 21:21:18 +0000 (14:21 -0700)]
daemon: Add comment.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agovswitch.xml: Suggest secure fail-mode to avoid loops with multiple uplinks.
Ben Pfaff [Thu, 10 May 2012 17:11:08 +0000 (10:11 -0700)]
vswitch.xml: Suggest secure fail-mode to avoid loops with multiple uplinks.

EXT-186.
Reported-by: Rob Sherwood <rob.sherwood@bigswitch.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoMakefile.am: Remove -export-dynamic.
Ben Pfaff [Mon, 14 May 2012 20:31:07 +0000 (13:31 -0700)]
Makefile.am: Remove -export-dynamic.

This got added as part of the "initial import" commit from March 2008.  I
don't see any value in it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agofatal-signal: Log when terminating due to a fatal signal.
Ben Pfaff [Tue, 8 May 2012 23:54:21 +0000 (16:54 -0700)]
fatal-signal: Log when terminating due to a fatal signal.

This makes it easier to diagnose why and when a daemon exited.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-util: Match on NXAST_CONTROLLER as an output to OFPP_CONTROLLER.
Ben Pfaff [Wed, 2 May 2012 21:51:51 +0000 (14:51 -0700)]
ofp-util: Match on NXAST_CONTROLLER as an output to OFPP_CONTROLLER.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agodocs: Fix bad troff markup.
Ben Pfaff [Mon, 14 May 2012 18:15:34 +0000 (11:15 -0700)]
docs: Fix bad troff markup.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoovs-vswitchd: Document some limits.
Ben Pfaff [Mon, 14 May 2012 18:13:39 +0000 (11:13 -0700)]
ovs-vswitchd: Document some limits.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoovs-dpctl: Remove obsolete documentation of limit on number of datapaths.
Ben Pfaff [Mon, 14 May 2012 18:13:27 +0000 (11:13 -0700)]
ovs-dpctl: Remove obsolete documentation of limit on number of datapaths.

Reported-by: Vjekoslav Brajkovic <balkan@cs.washington.edu>
Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofp-parse: Mark ofp_fatal() as never returning.
Ben Pfaff [Sun, 13 May 2012 23:33:01 +0000 (16:33 -0700)]
ofp-parse: Mark ofp_fatal() as never returning.

This makes clang less confused.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoovs-ofctl: Avoid impossible check for !osm in fetch_port_by_stats().
Ben Pfaff [Sun, 13 May 2012 23:41:05 +0000 (16:41 -0700)]
ovs-ofctl: Avoid impossible check for !osm in fetch_port_by_stats().

At the time of the call to ofpbuf_at(), we know that the ofp_stats_msg is
present because ofputil_decode_msg_type() reported that it was.  Therefore,
we can use ofpbuf_at_assert() and don't have to check for a null pointer.

Found by clang.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoAvoid writes to variables that are never read back.
Ben Pfaff [Sun, 13 May 2012 23:34:49 +0000 (16:34 -0700)]
Avoid writes to variables that are never read back.

Found by clang.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoAvoid assigning the same value to a variable back-to-back.
Ben Pfaff [Sun, 13 May 2012 23:33:49 +0000 (16:33 -0700)]
Avoid assigning the same value to a variable back-to-back.

Found by clang.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoofproto: Remove write-only variable.
Ben Pfaff [Sun, 13 May 2012 23:56:01 +0000 (16:56 -0700)]
ofproto: Remove write-only variable.

Found by clang.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agocfm: Avoid null pointer dereference in cfm_process_heartbeat().
Ben Pfaff [Sun, 13 May 2012 23:31:15 +0000 (16:31 -0700)]
cfm: Avoid null pointer dereference in cfm_process_heartbeat().

Found by clang.

Signed-off-by: Ben Pfaff <blp@nicira.com>
11 years agoRemove forward declaration of vsp_vlandev_to_realdev()
Simon Horman [Mon, 14 May 2012 04:59:58 +0000 (13:59 +0900)]
Remove forward declaration of vsp_vlandev_to_realdev()

There is no need to for a forward declaration of vsp_vlandev_to_realdev()

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoovs-bugtool: Close file descriptors after use.
Gurucharan Shetty [Fri, 11 May 2012 21:49:02 +0000 (14:49 -0700)]
ovs-bugtool: Close file descriptors after use.

In ovs-bugtool, we do a bunch of Popen calls to
get the results of some shell commands with stdout
set to PIPE. Once we are done, we need to
close the file descriptors.

Bug #11083.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
12 years agoodp-util: Add tests for parsing and formatting ODP actions.
Ben Pfaff [Wed, 9 May 2012 19:22:18 +0000 (12:22 -0700)]
odp-util: Add tests for parsing and formatting ODP actions.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agodynamic-string: New function ds_get_test_line().
Ben Pfaff [Wed, 9 May 2012 19:15:11 +0000 (12:15 -0700)]
dynamic-string: New function ds_get_test_line().

This eliminates some code duplication.   An upcoming commit will add
another user.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoodp-util: Fix parsing of actions encapsulated within "sample" actions.
Ben Pfaff [Wed, 9 May 2012 19:21:54 +0000 (12:21 -0700)]
odp-util: Fix parsing of actions encapsulated within "sample" actions.

Signed-off-by: Ben Pfaff <blp@nicira.com>
12 years agoofputil: Accept OFPP_NONE as a valid output port.
Ethan Jackson [Thu, 10 May 2012 18:24:36 +0000 (11:24 -0700)]
ofputil: Accept OFPP_NONE as a valid output port.

Ofproto-dpif treats an output to OFPP_NONE as a NOOP, but ofputil
treated it as an error.  The former behavior seems more natural.

Reported-by: Teemu Koponen <koponen@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>