openvswitch
12 years agodatapath: small potential memory leak in ovs_vport_alloc()
Dan Carpenter [Tue, 6 Dec 2011 19:08:25 +0000 (11:08 -0800)]
datapath: small potential memory leak in ovs_vport_alloc()

We're unlikely to hit this leak, but the static checkers complain if we
don't take care of it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
12 years agoxenserver: Reduce number of xapi DB calls in plugin
Rob Hoes [Mon, 5 Dec 2011 14:43:12 +0000 (14:43 +0000)]
xenserver: Reduce number of xapi DB calls in plugin

When there are lots of PIFs in a XenServer/XCP pool, for example when
there are many VLANs configured on the pool, operations such as
PIF.get_all and loops over all PIFs which include database operations,
are very inefficient when executed on a pool slave, and should be
avoided as much as possible. This patch reduces the number of database
calls in the update function of the openvswitch-cfg-update xapi plugin.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Acked-by: Dominic Curran <Dominic.curran@citrix.com>
12 years agonetdev-linux: Don't restrict policing to IPv4 and don't call "tc".
Justin Pettit [Mon, 5 Dec 2011 00:33:54 +0000 (16:33 -0800)]
netdev-linux: Don't restrict policing to IPv4 and don't call "tc".

Mike Bursell pointed out that our policer only works on IPv4
traffic--and specifically not IPv6.  By using the "basic" filter, we can
enforce policing on all traffic for a particular interface.

Jamal Hadi Salim pointed out that calling "tc" directly with system() is
pretty ugly.  This commit switches our remaining "tc" calls to directly
sending the appropriate netlink messages.

Suggested-by: Mike Bursell <mike.bursell@citrix.com>
Suggested-by: Jamal Hadi Salim <hadi@cyberus.ca>
12 years agoAUTHORS: Add Zhi Yong Wu.
Jesse Gross [Mon, 5 Dec 2011 17:30:19 +0000 (09:30 -0800)]
AUTHORS: Add Zhi Yong Wu.

12 years agodatapath: Fix build breakage on kernel 2.6.40
Zhi Yong Wu [Mon, 5 Dec 2011 02:33:14 +0000 (10:33 +0800)]
datapath: Fix build breakage on kernel 2.6.40

Today i played with openvswitch on my workstation with kernel 2.6.40 and found that it break when i built. The
+issue is introduced by commit ceb176fdb72bb7ce90debc66e1eeb1d25823d30a

Below is the error log:

from /home/zwu/work/virt/openvswitch/datapath/linux/genetlink-brcompat.c:10:
/home/zwu/work/virt/openvswitch/datapath/linux/compat/include/linux/skbuff.h:243:20: error: redefinition of
+‘skb_reset_mac_len’
include/linux/skbuff.h:1259:20: note: previous definition of â€˜skb_reset_mac_len’ was here
make[5]: *** [/home/zwu/work/virt/openvswitch/datapath/linux/genetlink-brcompat.o] Error 1
make[4]: *** [_module_/home/zwu/work/virt/openvswitch/datapath/linux] Error 2
make[4]: Leaving directory `/usr/src/kernels/2.6.40.6-0.fc15.x86_64'
make[3]: *** [default] Error 2
make[3]: Leaving directory `/home/zwu/work/virt/openvswitch/datapath/linux'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/zwu/work/virt/openvswitch/datapath'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/zwu/work/virt/openvswitch'
make: *** [all] Error 2

Signed-off-by: Zhi Yong Wu <zwu.kernel@gmail.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
12 years agodatapath: Remove custom version of ipv6_skip_exthdr().
Jesse Gross [Fri, 2 Dec 2011 00:09:05 +0000 (16:09 -0800)]
datapath: Remove custom version of ipv6_skip_exthdr().

We currently have a version of ipv6_skip_exthdr() which is
identical to the main one with the addition of fragment reporting.
We can propose our version for upstream and then use it directly
without duplication.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agonetdev-linux: Ref and unref the netdev_linux_cache_notifier for taps too.
Ben Pfaff [Wed, 30 Nov 2011 18:59:12 +0000 (10:59 -0800)]
netdev-linux: Ref and unref the netdev_linux_cache_notifier for taps too.

netdev-linux uses netdev_linux_cache_notifier to flush its cache when the
kernel notifies userspace that a particular network device's configuration
or status has changed.  This is as applicable to tap devices as to system
and internal devices, so we should create and destroy the notifier for
tap devices also.

I doubt that in practice it's possible to run ovs-vswitchd without having
a non-tap device open, at least with the kernel datapath, because the
local port for a bridge is not a tap device, so there should be no need to
backport this to older versions.

Reported-by: Gaetano Catalli <gaetano.catalli@gmail.com>
12 years agodatapath: Fix outdated comment.
Jesse Gross [Fri, 2 Dec 2011 02:42:20 +0000 (18:42 -0800)]
datapath: Fix outdated comment.

Signed-off-by: Jesse Gross <jesse@nicira.com>
12 years agovswitch.xml: Fix bond-hash-basis documentation placement.
Ethan Jackson [Thu, 1 Dec 2011 02:08:01 +0000 (18:08 -0800)]
vswitch.xml: Fix bond-hash-basis documentation placement.

The bond-hash-basis other_config column was documented under "LACP
Configuration".  Instead it should be documented as general bonding
configuration.

12 years agolacp: Update header file comments.
Ethan Jackson [Thu, 1 Dec 2011 02:01:32 +0000 (18:01 -0800)]
lacp: Update header file comments.

12 years agoPrepare for post-1.4.0 (1.4.90).
Justin Pettit [Thu, 1 Dec 2011 07:41:19 +0000 (23:41 -0800)]
Prepare for post-1.4.0 (1.4.90).

12 years agoovs-vlan-bugs: Document driver bug with priority tagged packets.
Ben Pfaff [Mon, 28 Nov 2011 21:49:12 +0000 (13:49 -0800)]
ovs-vlan-bugs: Document driver bug with priority tagged packets.

Reported-by: Jesse Gross <jesse@nicira.com>
12 years agoINSTALL.XenServer: Update instructions.
Ben Pfaff [Wed, 30 Nov 2011 20:54:03 +0000 (12:54 -0800)]
INSTALL.XenServer: Update instructions.

The instructions hadn't been properly updated to match current XenServer
releases.

Reported-by: Ramana Reddy <gtvrreddy@gmail.com>
12 years agolearn: Avoid 1-byte buffer underrun in learn_format().
Ben Pfaff [Thu, 1 Dec 2011 16:33:55 +0000 (08:33 -0800)]
learn: Avoid 1-byte buffer underrun in learn_format().

Reported-and-tested-by: Jari Sundell <sundell.software@gmail.com>
12 years agoDeclare the version as "1.4.0".
Justin Pettit [Thu, 1 Dec 2011 06:20:09 +0000 (22:20 -0800)]
Declare the version as "1.4.0".

12 years agotests: Perform basic LACP unit tests.
Ethan Jackson [Tue, 29 Nov 2011 02:08:49 +0000 (18:08 -0800)]
tests: Perform basic LACP unit tests.

This patch adds tests which check that configuration settings in
the database are reflected in the LACP module's appctl output.

12 years agolacp: Sort slaves in appctl output.
Ethan Jackson [Tue, 29 Nov 2011 22:21:26 +0000 (14:21 -0800)]
lacp: Sort slaves in appctl output.

This will simplify unit tests added in a future patch.

12 years agolacp: Remove trailing whitespace from appctl output.
Ethan Jackson [Tue, 29 Nov 2011 22:27:12 +0000 (14:27 -0800)]
lacp: Remove trailing whitespace from appctl output.

This will marginally simplify some unit tests in a future patch.

12 years agolacp: Require non-zero system ID.
Ethan Jackson [Tue, 29 Nov 2011 21:22:18 +0000 (13:22 -0800)]
lacp: Require non-zero system ID.

It's a bug if LACP is configured with a system ID of zero.  This
patch assert fails in this case.

12 years agoofproto-dpif: Delete un-fit flow from datapath.
Pravin B Shelar [Wed, 30 Nov 2011 22:18:21 +0000 (14:18 -0800)]
ofproto-dpif: Delete un-fit flow from datapath.

12 years agoofproto-dpif: Fix memory leak.
Pravin B Shelar [Wed, 30 Nov 2011 22:17:15 +0000 (14:17 -0800)]
ofproto-dpif: Fix memory leak.

Following patch fixes memory leak in case there is ODP_FIT_ERROR
on flow key.

12 years agobridge: Honor lacp-system-id other_config setting.
Ethan Jackson [Wed, 30 Nov 2011 03:03:52 +0000 (19:03 -0800)]
bridge: Honor lacp-system-id other_config setting.

The bridge code was completely ignoring the lacp-system-id setting.

Future patches will add tests which would have caught this issue.

Bug #8516.

12 years agoovs-ofctl: Improve usage message.
Ben Pfaff [Wed, 30 Nov 2011 21:07:38 +0000 (13:07 -0800)]
ovs-ofctl: Improve usage message.

TARGET and SWITCH are different because TARGET can refer to a switch or a
controller whereas SWITCH must be a switch, but TARGET wasn't defined
before.

Also, TARGET seems a little more user-friendly than the VCONN that was used
here before.

Reported-by: Reid Price <reid@nicira.com>
Bug #7736.

12 years agobridge: Configure datapath ID earlier.
Ben Pfaff [Wed, 30 Nov 2011 20:09:35 +0000 (12:09 -0800)]
bridge: Configure datapath ID earlier.

The design intent is for LACP ports to use the datapath ID as the default
system ID when none is specifically configured.  However, the datapath ID
is not available that early.  This commit makes it available earlier.

This commit does not fix another bug that prevents the LACP system ID from
being set properly (nothing sets it at all, in fact, so it always uses 0).

Build and unit tested only.

12 years agobridge: Remove redundant newline.
Ethan Jackson [Tue, 29 Nov 2011 21:24:57 +0000 (13:24 -0800)]
bridge: Remove redundant newline.

12 years agodatapath: Don't use ipv6_addr_copy().
Jesse Gross [Wed, 30 Nov 2011 18:46:54 +0000 (10:46 -0800)]
datapath: Don't use ipv6_addr_copy().

It was dropped upstream in favor of direct structure assignment.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
12 years agoodp-util: Move commit_odp_actions() from ofproto-dpif.
Ethan Jackson [Mon, 28 Nov 2011 22:14:23 +0000 (14:14 -0800)]
odp-util: Move commit_odp_actions() from ofproto-dpif.

In an effort to simplify ofproto-dpif, this commit moves the
definition of commit_odp_actions() to odp-util.

12 years agoofproto-dpif: Remove redundant commit_odp_actions() call.
Ethan Jackson [Mon, 28 Nov 2011 22:08:11 +0000 (14:08 -0800)]
ofproto-dpif: Remove redundant commit_odp_actions() call.

12 years agoovsdb: Correctly implement conditions that include multiple clauses.
Ben Pfaff [Wed, 16 Nov 2011 22:38:52 +0000 (14:38 -0800)]
ovsdb: Correctly implement conditions that include multiple clauses.

Multiple-clause conditions in OVSDB operations with "where" clauses are
supposed to be conjunctions, that is, the condition is true only if every
clause is true.  In fact, the implementation only checked a single clause
(not necessarily the first one) and ignored the rest.  This fixes the
problem and adds test coverage for multiple-clause conditions.

Reported-by: Shih-Hao Li <shli@nicira.com>
12 years agodaemon: Better log when fork child dies early from signals.
Ben Pfaff [Wed, 23 Nov 2011 20:15:42 +0000 (12:15 -0800)]
daemon: Better log when fork child dies early from signals.

On one machine, "/etc/init.d/openvswitch-switch start" failed to start
with:

   ovs-vswitchd: fork child failed to signal startup (Success)
   Starting ovs-vswitchd ... failed!

"strace" revealed that the fork child was actually segfaulting, but the
message output didn't indicate that in any way.  This commit fixes the
log message (but not the segfault itself).

Reported-by: Michael Hu <mhu@nicira.com>
Bug #8457.

12 years agonetlink-socket: Let the kernel choose Netlink pids for us.
Ben Pfaff [Mon, 14 Nov 2011 18:10:58 +0000 (10:10 -0800)]
netlink-socket: Let the kernel choose Netlink pids for us.

The Netlink code in the Linux kernel has been willing to choose unique
Netlink pids for userspace sockets since at least 2.4.36 and probably
earlier.  There's no value in choosing them ourselves.

This simplifies the code and eliminates the possibility of exhausting our
supply of Netlink PIDs.

12 years agoofproto: Add "fast path".
Ben Pfaff [Mon, 28 Nov 2011 18:35:15 +0000 (10:35 -0800)]
ofproto: Add "fast path".

The key to getting good performance on the netperf CRR test seems to be to
handle the first packet of each new flow as quickly as possible.  Until
now, we've only had one opportunity to do that on each trip through the
main poll loop.  One way to improve would be to make that poll loop
circulate more quickly.  My experiments show, however, that even just
commenting out the slower parts of the poll loop yield minimal improvement.

This commit takes another approach.  Instead of making the poll loop
overall faster, it invokes the performance-critical parts of it more than
once during each poll loop.

My measurements show that this commit improves netperf CRR performance by
24% versus the previous commit, for an overall improvement of 87% versus
the baseline just before the commit that removed the poll_fd_woke().  With
this commit, ovs-benchmark performance has also improved by 13% overall
since that baseline.

12 years agoofproto-dpif: Process multiple batches of upcalls in a single poll loop.
Ben Pfaff [Fri, 11 Nov 2011 00:42:51 +0000 (16:42 -0800)]
ofproto-dpif: Process multiple batches of upcalls in a single poll loop.

This yields a 27% improvement in netperf CRR results in my tests
versus the previous commit, which is a 52% improvement versus
the baseline from just before the poll_fd_woke() optimization was
removed.

12 years agodpif-linux: Use "epoll" instead of poll().
Ben Pfaff [Tue, 22 Nov 2011 17:25:32 +0000 (09:25 -0800)]
dpif-linux: Use "epoll" instead of poll().

epoll appears to be much more efficient than poll() at least for
static file descriptor sets.  I can't otherwise explain why this
patch increases netperf CRR performance by 20% above the previous
commit, which is also about a 19% overall improvement versus
the baseline from before the poll_fd_woke() optimization was
removed.

12 years agodpif-linux: Use poll() internally in dpif_linux_recv().
Ben Pfaff [Mon, 28 Nov 2011 17:29:18 +0000 (09:29 -0800)]
dpif-linux: Use poll() internally in dpif_linux_recv().

Using poll() internally in dpif_linux_recv(), instead of relying
on the results of the main loop poll() call, brings netperf CRR
performance back within 1% of par versus the code base before the
poll_fd_woke() optimizations were introduced.  It also increases
the ovs-benchmark results by about 5% versus that baseline, too.

My theory is that this is because the main loop takes long enough
that a significant number of packets can arrive during the main
loop itself, so this reduces the time before OVS gets to those
packets.

12 years agoRevert "poll-loop: Enable checking whether a FD caused a wakeup."
Ben Pfaff [Tue, 22 Nov 2011 19:05:53 +0000 (11:05 -0800)]
Revert "poll-loop: Enable checking whether a FD caused a wakeup."

This reverts commit 1e276d1a10539a8cd97d2ad63c073a9a43f0f1ef.
The poll_fd_woke() and nl_sock_woke() function added in that commit are
no longer used, so there is no reason to keep them in the tree.

12 years agodpif-linux: Remove poll_fd_woke() optimization from dpif_linux_recv().
Ben Pfaff [Thu, 10 Nov 2011 23:39:39 +0000 (15:39 -0800)]
dpif-linux: Remove poll_fd_woke() optimization from dpif_linux_recv().

This optimization on its own provided about 37% benefit against a
load of a single netperf CRR test, but at the same time it penalized
ovs-benchmark by about 11%.  We can get back the CRR performance
loss, and more, other ways, so the first step is to revert this
patch, temporarily accepting the performance loss.

13 years agomirroring: Don't require the "normal" action to perform mirroring.
Justin Pettit [Wed, 23 Nov 2011 08:04:58 +0000 (00:04 -0800)]
mirroring: Don't require the "normal" action to perform mirroring.

Previously, mirrors only worked when using the "normal" action.  This
commit performs mirroring even when mirroring is not used.  It also adds
some unit tests.

13 years agoovs-vswitchd: Track packet and byte statistics sent on mirrors.
Justin Pettit [Sun, 20 Nov 2011 23:12:36 +0000 (15:12 -0800)]
ovs-vswitchd: Track packet and byte statistics sent on mirrors.

This commit adds support for tracking the number of packets and bytes
sent through a mirror.  The numbers are kept in the new "statistics"
column on the mirror table in the "tx_packets" and "tx_bytes" keys.

13 years agomirroring: Use more generic terms for mirroring.
Justin Pettit [Wed, 23 Nov 2011 07:50:59 +0000 (23:50 -0800)]
mirroring: Use more generic terms for mirroring.

13 years agostream: Make classes const
Simon Horman [Thu, 24 Nov 2011 01:22:22 +0000 (10:22 +0900)]
stream: Make classes const

The classes are never modified and may be declared constant.

13 years agoImplement new "VLAN splinters" feature.
Ben Pfaff [Thu, 24 Nov 2011 01:03:31 +0000 (17:03 -0800)]
Implement new "VLAN splinters" feature.

The "VLAN splinters" feature works around buggy device drivers in old Linux
versions.

This feature is deprecated.  When broken device drivers are no longer in
widespread use, we will delete this feature.

I tested earlier versions of this commit, but I have not tested this
version.

See ovs-vswitchd.conf.db(5) for more information.

13 years agoofproto-dpif: Separately track the initial VLAN TCI of arriving packets.
Ben Pfaff [Wed, 23 Nov 2011 21:22:30 +0000 (13:22 -0800)]
ofproto-dpif: Separately track the initial VLAN TCI of arriving packets.

In an upcoming commit, VLAN splinters can cause the VLAN TCI of a packet
received on an interface to differ from the logical VLAN TCI.  That is,
a packet that is received on a Linux VLAN network device has no VLAN (so
its initial VLAN TCI is 0) but we logically treat it as if it has the VLAN
associated with the VLAN device.

This is only desirable for use with VLAN splinters and should be reverted
when this feature is no longer needed.  I'm breaking it out here only to
make the series easier to review.

13 years agoofproto-dpif: Move ODP actions from facets to subfacets.
Ben Pfaff [Wed, 16 Nov 2011 01:06:41 +0000 (17:06 -0800)]
ofproto-dpif: Move ODP actions from facets to subfacets.

This is a prerequisite for the upcoming VLAN splinter patch, because
splinters and non-splintered subfacets might need slightly different
actions due to the VLAN tag being initially different (present vs. absent).

This is only desirable for use with VLAN splinters and should be reverted
when this feature is no longer needed.  I'm breaking it out here only to
make the series easier to review.

13 years agoofproto-dpif: Simplify invocation of send_packet().
Ben Pfaff [Wed, 16 Nov 2011 00:55:28 +0000 (16:55 -0800)]
ofproto-dpif: Simplify invocation of send_packet().

All the callers already have the ofport handy, so they might as well just
pass it in directly.

13 years agoovsdb-idl: Add assertion for synthetic records in ovsdb_idl_read().
Ben Pfaff [Tue, 15 Nov 2011 21:59:41 +0000 (13:59 -0800)]
ovsdb-idl: Add assertion for synthetic records in ovsdb_idl_read().

This function doesn't support synthetic records but it probably isn't
obvious from looking at it, so add an actual assertion.

13 years agopackets: New function eth_pop_vlan(), formerly dp_netdev_pop_vlan().
Ben Pfaff [Mon, 14 Nov 2011 22:02:43 +0000 (14:02 -0800)]
packets: New function eth_pop_vlan(), formerly dp_netdev_pop_vlan().

An upcoming commit will add a new user.

13 years agovlan-bitmap: New function vlan_bitmap_from_array__().
Ben Pfaff [Thu, 10 Nov 2011 00:17:19 +0000 (16:17 -0800)]
vlan-bitmap: New function vlan_bitmap_from_array__().

13 years agovlandev: New library for working with Linux VLAN devices.
Ben Pfaff [Thu, 10 Nov 2011 00:16:10 +0000 (16:16 -0800)]
vlandev: New library for working with Linux VLAN devices.

13 years agonetdev-linux: Reorganize slightly.
Ben Pfaff [Thu, 10 Nov 2011 00:52:16 +0000 (16:52 -0800)]
netdev-linux: Reorganize slightly.

13 years agonetdev: Remove netdev_get_vlan_vid().
Ben Pfaff [Tue, 8 Nov 2011 21:50:13 +0000 (13:50 -0800)]
netdev: Remove netdev_get_vlan_vid().

It has no remaining users.

13 years agovswitchd: Remove special case for VLAN devices.
Ben Pfaff [Tue, 8 Nov 2011 21:53:38 +0000 (13:53 -0800)]
vswitchd: Remove special case for VLAN devices.

We introduced this special case before the XenServer integration was
complete.  At that point, we were using VLAN devices on XenServer, with a
separate bridge for each VLAN, so we needed this special case.  But no
version of OVS for any supported XenServer version uses VLAN devices this
way, so we can delete the special case.

13 years agoofproto-dpif: Support differing user/kernel packet parsing support.
Ben Pfaff [Wed, 23 Nov 2011 18:26:02 +0000 (10:26 -0800)]
ofproto-dpif: Support differing user/kernel packet parsing support.

Feature #4886.

13 years agoofproto-dpif: Factor NetFlow active timeouts out of flow expiration.
Ben Pfaff [Wed, 23 Nov 2011 00:46:05 +0000 (16:46 -0800)]
ofproto-dpif: Factor NetFlow active timeouts out of flow expiration.

NetFlow active timeouts were only mixed in with flow expiration for
convenience: both processes need to iterate all the facets.  But
an upcoming commit will change flow expiration to work in terms of
a new "subfacet" entity, so they will no longer fit together well.

This change could be seen as an optimization, since NetFlow active
timeouts don't ordinarily have to run as often as flow expiration,
especially when the flow expiration rate is stepped up due to a
large volume of flows.

13 years agobridge: Fix incorrect comments.
Ben Pfaff [Mon, 14 Nov 2011 18:28:31 +0000 (10:28 -0800)]
bridge: Fix incorrect comments.

13 years agoofproto: Add "const" to ->rule_execute's "flow" parameter.
Ben Pfaff [Mon, 14 Nov 2011 21:12:56 +0000 (13:12 -0800)]
ofproto: Add "const" to ->rule_execute's "flow" parameter.

13 years agobridge: Avoid reading other_config columns with ovsdb_idl_get().
Ben Pfaff [Wed, 23 Nov 2011 21:17:38 +0000 (13:17 -0800)]
bridge: Avoid reading other_config columns with ovsdb_idl_get().

ovsdb_idl_get() doesn't work with synthetic records.  Upcoming commits
will start synthesizing more ports and interfaces, so we should avoid
using ovsdb_idl_get().

In the long term it's probably a good idea to come up with a better way
to do synthetic database records, one that causes less trouble.

Bug #8457.

13 years agovswitch: Implement dscp column of the Queue table.
Ethan Jackson [Thu, 17 Nov 2011 00:31:05 +0000 (16:31 -0800)]
vswitch: Implement dscp column of the Queue table.

The dscp column of the queue table instructs Open vSwitch to mark
all traffic egressing the queue with the given DSCP bits in its tos
field.

Bug #7046.

13 years agoofproto-dpif: Simplify commit logic.
Ethan Jackson [Tue, 22 Nov 2011 03:25:19 +0000 (19:25 -0800)]
ofproto-dpif: Simplify commit logic.

Before executing an output action, ofproto-dpif must commit the
changes it's made to the flow so they are reflected in the
packet.  This code has been unnecessarily complex.  This patch
attempts to simplify the code in the following ways.

- Commit in fewer places.
In an attempt to provide some optimization, the ofproto-dpif code
separated the commit and output composition steps so things like
flood actions could avoid redundant commits.  This is a case of
premature optimization that makes the code significantly more
difficult to reason about.  With this patch, commits happen only
when really necessary.

- Only perform full commits.
In an attempt to provide some optimization, the ofproto-dpif code
would allow callers to only commit the part of the flow that they
had modified by directly calling the relevant subroutine.  This
practice made the code difficult to reason about and is thus
discontinued.

- Perform all output logic in one function.
All of the logic surrounding the datapath output action has been
placed in the compose_output_action__() function.  Most callers
will use the compose_output_action() function which simply passes
reasonable defaults through to compose_output_action__().

13 years agoofproto-dpif: Properly update tos and ttl fields.
Ethan Jackson [Tue, 22 Nov 2011 03:18:14 +0000 (19:18 -0800)]
ofproto-dpif: Properly update tos and ttl fields.

ofproto-dpif failed to update the base flow's tos and ttl fields
when preparing for an output action.  This could cause redundant
updates of those fields in the datapath.  A future patch adds a
test which could have caught the issue for the tos bits.

13 years agodatapath: Fix build after global symbol rename.
Jesse Gross [Tue, 22 Nov 2011 19:39:50 +0000 (11:39 -0800)]
datapath: Fix build after global symbol rename.

ovs_netdev_get_vport() did not get renamed in one of the blocks
for older kernels.

Signed-off-by: Jesse Gross <jesse@nicira.com>
13 years agodatapath: Scope global symbols with ovs_ prefix.
Jesse Gross [Tue, 22 Nov 2011 01:15:20 +0000 (17:15 -0800)]
datapath: Scope global symbols with ovs_ prefix.

OVS has quite a few global symbols that should be scoped with a
prefix to prevent collisions with other modules in the kernel.

Suggested-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
13 years agonx-match: Fold all of its data structures into mf_field.
Ben Pfaff [Thu, 13 Oct 2011 00:04:13 +0000 (17:04 -0700)]
nx-match: Fold all of its data structures into mf_field.

This is less redundant.

13 years agoflow: New functions for setting a VLAN VID or PCP value.
Ben Pfaff [Mon, 21 Nov 2011 22:14:02 +0000 (14:14 -0800)]
flow: New functions for setting a VLAN VID or PCP value.

13 years agometa-flow: Split ICMP into ICMPv4 and ICMPv6.
Ben Pfaff [Sat, 22 Oct 2011 20:11:48 +0000 (13:11 -0700)]
meta-flow: Split ICMP into ICMPv4 and ICMPv6.

NXM breaks ICMP into v4 and v6.  An upcoming commit will drop all of the
NXM specific data in favor of mf_field, and so at that point we need to
have a separate mf_field for each NXM field.  So, this commit splits
ICMP into v4 and v6 for meta-flow also.

13 years agodpif-netdev: Allow enqueue actions.
Ethan Jackson [Mon, 21 Nov 2011 21:36:17 +0000 (13:36 -0800)]
dpif-netdev: Allow enqueue actions.

The dpif-netdev implementation disallowed enqueue actions because
it did not support conversion from OVS 'queue_id' to dpif
'priority'.  For testing purposes, this patch allows queues which
translate into NOOPs.

13 years agoofproto-dpif: Test basic output and flooding.
Ethan Jackson [Fri, 18 Nov 2011 21:47:25 +0000 (13:47 -0800)]
ofproto-dpif: Test basic output and flooding.

This patch adds basic tests to ofproto-dpif which verify that
output and flood actions respect the relevant OFPPC flags, and do
not loop back to the in_port.

13 years agoovs-ofctl: Support OFPPC_NO_FWD.
Ethan Jackson [Mon, 21 Nov 2011 18:59:41 +0000 (10:59 -0800)]
ovs-ofctl: Support OFPPC_NO_FWD.

Currently, there is no way to disable forwarding on an OpenFlow
port from the command line.  This patch adds support for the
OFPPC_NO_FWD flag to the ovs-ofctl utility.

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

13 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.

13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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.

13 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().

13 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.

13 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.

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

13 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.

13 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.

13 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>
13 years agobond: Remove dead conditional.
Ethan Jackson [Tue, 15 Nov 2011 01:02:44 +0000 (17:02 -0800)]
bond: Remove dead conditional.

13 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>
13 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

13 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.

13 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]

13 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]"

13 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.

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

13 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.

13 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.

13 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.

13 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.

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

13 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.