sliver-openvswitch.git
10 years agotestsuite.at: kill for windows.
Gurucharan Shetty [Fri, 18 Apr 2014 15:24:42 +0000 (08:24 -0700)]
testsuite.at: kill for windows.

We use kill to cleanup processes from pidfiles.
Windows has a 'taskkill' which does something similar.
We can check if the process with a PID exists with
'tasklist'. Both tasklist and taskkill return 0 for
both success and failure. So, we will have to grep
to see if there is a o/p.

A typical o/p of tasklist is:
$ tasklist | grep ovs
ovsdb-server.exe              3228 RDP-Tcp#0                  2      6,132 K
ovs-vswitchd.exe              2080 RDP-Tcp#0                  2      5,808 K

$ tasklist //fi "PID eq 3228"

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
ovsdb-server.exe              3228 RDP-Tcp#0                  2      6,132 K

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agotestsuite.at: pwd for windows.
Gurucharan Shetty [Fri, 18 Apr 2014 15:17:11 +0000 (08:17 -0700)]
testsuite.at: pwd for windows.

On MinGW, "pwd -W" gives the present working directory
in the form of windows path (i.e C:/temp instead of /c/temp).
When we pass the directory path to daemons as arguments,
we should be passing it in the form of windows path.

Suggested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodaemon-windows: Create pidfiles with option --pidfile.
Gurucharan Shetty [Tue, 15 Apr 2014 20:26:53 +0000 (13:26 -0700)]
daemon-windows: Create pidfiles with option --pidfile.

In Windows, we cannot delete a file that has been opened.
We use this feature to "lock" the pidfile.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodaemon-windows: Implement --detach option for Windows.
Gurucharan Shetty [Tue, 15 Apr 2014 17:14:05 +0000 (10:14 -0700)]
daemon-windows: Implement --detach option for Windows.

When "--detach" is specified, a daemon will create a new
process with the same command line options as the parent.
Additionally, an undocumented command line option "--pipe-handle"
is passed to child. Once the child is ready to handle external
commands, it communicates with the parent that it is ready using
the pipe handle. The parent exits. This lets us run the daemons
in background. This will also help the unit tests because currently
most of the unit tests pass the '--detach' option to the daemons.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodaemon-windows: Rename service variables.
Gurucharan Shetty [Mon, 14 Apr 2014 19:57:53 +0000 (12:57 -0700)]
daemon-windows: Rename service variables.

Sa far, we are using variable 'detach' to indicate whether the option
"--service" has been set. We were using variable 'detached' to indicate that
the daemon is being called from the Windows services manager.

An upcoming commit introduces command line option "--detach" for daemons
running on Windows. This will cause confusion with variable names.
Therefore, rename the variables.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agostream: Introduce [p]windows_[p]stream_class.
Gurucharan Shetty [Fri, 4 Apr 2014 21:13:32 +0000 (14:13 -0700)]
stream: Introduce [p]windows_[p]stream_class.

On Linux, we heavily use --remote=punix:* to listen for
connections through unix domain sockets. We also use, unix:*
to connect to a daemon that is listening on unix domain sockets.
Many times, we create default unix domain sockets for listening
and many utilities connect to these sockets by default.

Windows does not have unix domain sockets. So far, we could just use
ptcp:* and tcp:* for listening and initiating connections respectively.
The drawback here is that one has to provide a specific TCP port.

For unit tests, it looks useful to let kernel choose that port.
As such, we can let that chosen kernel port be stored in the
file specified with punix:* and unix:*. For this purpose, introduce
a new [p]windows_[p]stream_class. Since it is just a wrapper around
[p]tcp_[p]stream_class, add it to stream-tcp.c.

commit cb54a8c (unixctl: Add support for Windows.) used the above concept
for only control channel connections (i.e., --unixctl for daemons and its
interaction with ovs-appctl). This commit adds the same support for
all unix domain sockets.  Now that we have a separate class
[p]stream_class for hiding kernel assigned TCP port inside a file meant for
unix domain sockets in windows, make unixctl use it.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agotests: Define a variable "IS_WIN32" for tests.
Gurucharan Shetty [Thu, 3 Apr 2014 22:52:45 +0000 (15:52 -0700)]
tests: Define a variable "IS_WIN32" for tests.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-rcu: Name the ovsrcu_postpone_thread to 'urcu'.
Alex Wang [Tue, 15 Apr 2014 18:32:26 +0000 (11:32 -0700)]
ovs-rcu: Name the ovsrcu_postpone_thread to 'urcu'.

The ovs-rcu module adds a new thread for checking the grace period.
Since the thread name is not set, it will inherit the name of the
thread that creates it.  This makes the 'top' output quite confusing.

This commit names the thread to 'urcu' for clarity.

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
10 years agoofproto-dpif-upcall: Fix logic error in handler/revalidator threads
Alex Wang [Tue, 22 Apr 2014 03:05:08 +0000 (20:05 -0700)]
ofproto-dpif-upcall: Fix logic error in handler/revalidator threads
creation and deletion.

Commit 1f8675481e (ofproto-dpif-upcall: Fix ovs-vswitchd crash.)
directly copied the udpif_set_threads() logic to udpif_stop_threads()
and udpif_start_threads().  In fact, this was erroneous and caused
unittest failures.

This commit fixes the above issue by correcting the checks in
udpif_stop_threads() and udpif_start_threads(), and adding necessary
checks in udpif_set_threads().

Acked-by: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
10 years agoofproto-dpif-upcall: Fix ovs-vswitchd crash.
Alex Wang [Tue, 22 Apr 2014 00:31:11 +0000 (17:31 -0700)]
ofproto-dpif-upcall: Fix ovs-vswitchd crash.

On current master, caller of udpif_set_threads() can pass 0 value
on n_handlers and n_revalidators to delete all handler and revalidator
threads.

After commit 9a159f748866 (ofproto-dpif-upcall: Remove the dispatcher
thread.), udpif_set_threads() also calls the dpif_handlers_set() with
the 0 value 'n_handlers'.  Since dpif level always assume the 'n_handlers'
be non-zero, this causes warnings and even crash of ovs-vswitchd.

This commit fixes the above issue by defining separate functions for
starting and stopping handler and revalidator threads.  So
udpif_set_threads() will never be called with 0 value arguments.

Reported-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Co-authored-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agodatapath: add recirc action
Andy Zhou [Tue, 8 Apr 2014 11:13:42 +0000 (11:13 +0000)]
datapath: add recirc action

Recirculation implementation for Linux kernel data path.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: add hash action
Andy Zhou [Fri, 11 Apr 2014 08:41:18 +0000 (01:41 -0700)]
datapath: add hash action

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: remove unneeded declaration of new_vport().
Rami Rosen [Sun, 20 Apr 2014 09:19:44 +0000 (12:19 +0300)]
datapath: remove unneeded declaration of new_vport().

This patch removes the new_vport() forward declaration in datapath.c
as it is not needed.

Signed-off-by: Rami Rosen <ramirose@gmail.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoopenvswitch.h: rename hash action definition
Andy Zhou [Fri, 18 Apr 2014 03:06:58 +0000 (20:06 -0700)]
openvswitch.h: rename hash action definition

Rename hash_bias to hash_basis to make it consistent with similar
usages.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agoodp-util: Always generate key/mask pair in netlink for recirc_id
Andy Zhou [Fri, 18 Apr 2014 06:13:46 +0000 (23:13 -0700)]
odp-util: Always generate key/mask pair in netlink for recirc_id

Currently netlink flow (and mask) recirc_id attribute is only
serialized when the recirc_id value is non-zero. For this logic
to work correctly, the interpretation of the missing recirc_id
depends on whether the datapath supports recirculation.

This patch remove the ambiguity of the meaning of missing recirc_id
attribute in netlink message.  When recirc_id is non-zero, or when
it is not a wildcard match, both key and mask attributes are
serialized.  On the other hand, when recirc_id is zero, and being
wildcarded, they are not serialized.  A missing recirc_id key and
mask attribute thus should always be interpreted as wildcard,
same as other flow fields.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoofproto-dpif: Rule lookup starts from table zero for non-recirc datapath
Andy Zhou [Fri, 18 Apr 2014 06:40:27 +0000 (23:40 -0700)]
ofproto-dpif: Rule lookup starts from table zero for non-recirc datapath

Currently, all packet lookup starts from internal table for possible
matching of post recirculation rules. This is not necessary for
datapath that does not support recirculation.

This patch adds the ability to steering rule lookup starting table
based on whether datapath supports recirculation.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoofproto-dpif-upcall: Don't use stack garbage
YAMAMOTO Takashi [Fri, 18 Apr 2014 02:13:01 +0000 (11:13 +0900)]
ofproto-dpif-upcall: Don't use stack garbage

Catched by "learning action - self-modifying flow with hard_timeout"
test case.

The bug introduced by commit b256dc52.
("ofproto-dpif-xlate: Cache xlate_actions() effects.")

Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoofproto-dpif-upcall: Remove the dispatcher thread.
Alex Wang [Thu, 27 Feb 2014 07:03:24 +0000 (23:03 -0800)]
ofproto-dpif-upcall: Remove the dispatcher thread.

With the foundation laid in previous commits, this commit
removes the 'dispatcher' thread by allowing 'handler'
threads to read upcalls directly from dpif.

This commit significantly simplifies the flow miss handling
code and brings slight improvement to flow setup rate.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agodpif-linux: Add thread-safety annotations.
Alex Wang [Fri, 18 Apr 2014 00:16:34 +0000 (17:16 -0700)]
dpif-linux: Add thread-safety annotations.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agodpif-linux: Pass 'struct dpif_linux *' to internal static functions.
Alex Wang [Thu, 17 Apr 2014 23:33:17 +0000 (16:33 -0700)]
dpif-linux: Pass 'struct dpif_linux *' to internal static functions.

This commit reformats the dpif-linux module so that all internal
static functions take 'struct dpif_linux *' as input argument.
This will allow the adding of thread-safety annotations.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agodpif-linux: Implement the API functions to allow multiple handler threads read upcall.
Alex Wang [Wed, 26 Feb 2014 18:10:29 +0000 (10:10 -0800)]
dpif-linux: Implement the API functions to allow multiple handler threads read upcall.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agodpif-netdev: Use miniflow as a flow key.
Jarno Rajahalme [Fri, 18 Apr 2014 15:26:57 +0000 (08:26 -0700)]
dpif-netdev: Use miniflow as a flow key.

Use miniflow as a flow key in the userspace datapath classifier.  The
miniflow is expanded for upcalls, but for existing datapath flows, the
key need not be expanded.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoclassifier: Support miniflow as a key.
Jarno Rajahalme [Fri, 18 Apr 2014 15:26:56 +0000 (08:26 -0700)]
classifier: Support miniflow as a key.

Support struct miniflow as a key for datapath flow lookup.

The new classifier interface classifier_lookup_miniflow_first() takes
a miniflow as a key and stops at the first match with no regard to
flow prioritites.  This works only if the classifier has no
conflicting rules (as is the case with the userspace datapath
classifier).

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agolib/flow: Possibly faster miniflow_hash_in_minimask()
Jarno Rajahalme [Fri, 18 Apr 2014 15:26:56 +0000 (08:26 -0700)]
lib/flow: Possibly faster miniflow_hash_in_minimask()

Upcoming patches add classifier lookups using miniflows, this is
heavily used for it.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agolib/flow: Add miniflow accessors and miniflow_get_tcp_flags().
Jarno Rajahalme [Fri, 18 Apr 2014 15:26:56 +0000 (08:26 -0700)]
lib/flow: Add miniflow accessors and miniflow_get_tcp_flags().

Add inlined generic accessors for miniflow integer type fields, and a
new miniflow_get_tcp_flags() usinge these.  These will be used in a
later patch.

Some definitions also used in lib/packets.h had to be moved there to
resolve circular include dependencies.  Similarly, some inline
functions using struct flow are now in lib/flow.h.  IMO this is
cleaner, since now the lib/flow.h need not be included from
lib/packets.h.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agolib/flow: Introduce miniflow_extract().
Jarno Rajahalme [Fri, 18 Apr 2014 15:26:56 +0000 (08:26 -0700)]
lib/flow: Introduce miniflow_extract().

miniflow_extract() extracts packet headers directly to a miniflow,
which is a compressed form of the struct flow.  This does not require
a large struct to be cleared to begin with, and accesses less memory.
These performance benefits should allow this to be used in the DPDK
datapath.

miniflow_extract() takes a miniflow as an input/output parameter.  On
input the buffer for values to be extracted must be properly
initialized.  On output the map contains ones for all the fields that
have been extracted.

Some struct flow fields are reordered to make miniflow_extract to
progress in the logical order.

Some explicit "inline" keywords are necessary for GCC to optimize this
properly.  Also, macros are used for same reason instead of inline
functions for pushing data to the miniflow.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agolib/ofp-util: Restore the check for minus sign in port number strings.
Jarno Rajahalme [Fri, 18 Apr 2014 15:26:56 +0000 (08:26 -0700)]
lib/ofp-util: Restore the check for minus sign in port number strings.

Commit 33ab38d9 (meta-flow: Simplify mf_from_ofp_port_string())
inadvertently removed a check for minus sign at the beginning of a
port number string introduced by commit 05dddba (meta-flow: Don't
allow negative port numbers).  This check is still needed, so put it
back, but to ofputil_port_from_string() this time.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoMerge pull request #3 from joestringer/submit/xlate_cache_v2
ejj [Fri, 18 Apr 2014 00:35:52 +0000 (17:35 -0700)]
Merge pull request #3 from joestringer/submit/xlate_cache_v2

Cache the modules affected by xlate_actions().

10 years agorevalidator: Only revalidate high-throughput flows.
Joe Stringer [Tue, 4 Mar 2014 17:36:37 +0000 (09:36 -0800)]
revalidator: Only revalidate high-throughput flows.

Previously we would revalidate all flows if the "need_revalidate" flag
was raised. This patch modifies the logic to delete low throughput flows
rather than revalidate them. High-throughput flows are unaffected by
this change. This patch identifies the flows based on the mean time
between packets since the last dump.

This change is primarily targeted at situations where:
* Flow dump duration is high (~1 second)
* Revalidation is triggered. (eg, by bridge reconfiguration or learning)

After the need_revalidate flag is set, next time a new flow dump session
starts, revalidators will begin revalidating the flows. This full
revalidation is more expensive, which significantly increases the flow
dump duration. At the end of this dump session, the datapath flow
management algorithms kick in for the next dump:

* If flow dump duration becomes too long, the flow limit is decreased.
* The number of flows in the datapath then exceeds the flow_limit.
* As the flow_limit is exceeded, max_idle is temporarily set to 100ms.
* Revalidators delete all flows that haven't seen traffic recently.

The effect of this is that many low-throughput flows are deleted after
revalidation, even if they are valid. The revalidation is unnecessary
for flows that would be deleted anyway, so this patch skips the
revalidation step for those flows.

Note that this patch will only perform this optimization if the flow has
already been dumped at least once, and only if the time since the last
dump is sufficiently long. This gives the flow a chance to become
high-throughput.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
---
v2: Acked.
v1: Determine "high-throughput" by packets rather than bytes.
    Calculate the mean time between packets for comparison, rather than
      comparing the number of packets since the last dump.
RFC: First post.

10 years agoofproto-dpif-xlate: Cache xlate_actions() effects.
Joe Stringer [Thu, 10 Apr 2014 04:00:28 +0000 (16:00 +1200)]
ofproto-dpif-xlate: Cache xlate_actions() effects.

This patch adds a new object called 'struct xlate_cache' which can be
set in 'struct xlate_in', and passed to xlate_actions() to cache the
modules affected by this flow translation. Subsequently, the caller can
pass the xcache to xlate_push_stats() to credit stats and perform side
effects for a lower cost than full flow translation.

These changes are aimed currently at long-lived flows, decreasing the
average dump duration for such flows by 50-80%. This allows more flows
to be supported in the datapath at a given time. Applying these changes
to short-lived flows is left for a later commit.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
---
v2: Acked.
v1: Add caching for fin_timeout action.
    Expire netflows on xlate_cache_clear().
    Account to bonds using a copy of 'flow' rather than hash.
    Always build XC_NORMAL entry (previously only if may_learn is true)
    Rename xlate_from_cache()->xlate_push_stats()
    Add may_learn parameter to xlate_push_stats()
    Tidy up xlate_actions__() mirror/netflow code.
    Fold in style fixups.
RFC: First post.

10 years agoofproto: New function ofproto_refresh_rule().
Joe Stringer [Tue, 4 Mar 2014 01:23:12 +0000 (17:23 -0800)]
ofproto: New function ofproto_refresh_rule().

This function checks for a rule in the classifier:
* If the rule exists, reset its modified time.
* If an equivalent rule exists, reset that rule's modified time.
* If no rule exists, re-install the rule and reset its modified time.
* Finally, return the rule that was modified.

This function will be used to ensure that hard timeouts for learnt rules
are refreshed if traffic consistently hits a rule with a learn action in
it. The first user will be the next commit.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
---
v2: Acked.
v1: Ensure rule->modified is updated correctly.
RFC: First post.

10 years agoflow.h: Fix a comment typo
YAMAMOTO Takashi [Fri, 11 Apr 2014 01:19:24 +0000 (10:19 +0900)]
flow.h: Fix a comment typo

Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoofproto-dpif.at: Fix a race.
Alex Wang [Wed, 16 Apr 2014 18:01:12 +0000 (11:01 -0700)]
ofproto-dpif.at: Fix a race.

For the fixed line, the ofctl_monitor.log should have 18 lines.
So, should wait until it reaches 18 lines.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agodpif-netdev: Move hash function out of the recirc action, into its own action
Andy Zhou [Wed, 9 Apr 2014 01:42:39 +0000 (18:42 -0700)]
dpif-netdev: Move hash function out of the recirc action, into its own action

Currently recirculation action can optionally compute hash. This patch
adds a hash action that is independent of the recirc action, which
no longer computes hash.  For megaflow bond with recirc, the output
to a bond port action will look like:

    hash(hash_l4(0)), recirc(<recirc_id>)

Obviously, when a recirculation application that does not depend on
hash value can just use the recirc action alone.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Acked-by: Pravin B Shelar <pshelar@nicira.com
10 years agodatapath: Fix a double free bug for the sample action
Andy Zhou [Tue, 15 Apr 2014 23:28:15 +0000 (16:28 -0700)]
datapath: Fix a double free bug for the sample action

When sample action returns with an error, the skb has already been
freed. This patch fix a bug to make sure we don't free it again.

10 years agoofproto-dpif: xlate should not attribute stats to bond entry when using recirc
Andy Zhou [Wed, 16 Apr 2014 15:04:23 +0000 (08:04 -0700)]
ofproto-dpif: xlate should not attribute stats to bond entry when using recirc

When recirculation is used to implement bond, the bond entry stats are
collected from the hidden post recirculation rules. This bug causes
double counting of stats to some strenuous bond entries.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoofproto/bond: properly maintain hash entry pr_rule
Andy Zhou [Wed, 16 Apr 2014 15:01:32 +0000 (08:01 -0700)]
ofproto/bond: properly maintain hash entry pr_rule

This is a bug causing per hash entry's pr_rule pointer not properly
maintained; they became NULL after each rebalancing. This patch fixes
this bug.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoofproto/bond: Keep hash entry slave valid.
Andy Zhou [Wed, 16 Apr 2014 14:51:02 +0000 (07:51 -0700)]
ofproto/bond: Keep hash entry slave valid.

Bond recirculation needs to refresh the 'hidden rules' from
time to time. Keep hash entry slave valid to prevent those
hidden rules from being removed.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoofproto/bond: only display hash entries with tx_byptes > 1KB
Andy Zhou [Wed, 16 Apr 2014 08:36:59 +0000 (01:36 -0700)]
ofproto/bond: only display hash entries with tx_byptes > 1KB

When recirculation is used to implement bond, all bond entries are
always populated regardless whether there is traffic going through
them or not. This change cuts down the noise when running
'ovs-appctl bond/show', by skipping '0KB' entries.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agodatapath: Allow each vport to have an array of 'port_id's.
Alex Wang [Tue, 15 Apr 2014 06:37:10 +0000 (23:37 -0700)]
datapath: Allow each vport to have an array of 'port_id's.

In order to allow handlers directly read upcalls from datapath,
we need to support per-handler netlink socket for each vport in
datapath.  This commit makes this happen.  Also, it is guaranteed
to be backward compatible with previous branch.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Thomas Graf <tgraf@redhat.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
10 years agoofproto/bond: Protect statistics with writelock.
Joe Stringer [Mon, 14 Apr 2014 18:36:21 +0000 (18:36 +0000)]
ofproto/bond: Protect statistics with writelock.

dcf00ba35a0 (ofproto/bond: Implement bond megaflow using recirculation)
allowed bond_entry statistics to be modified while holding a readlock.
This patch modifies bond_entry_account() to get a writelock before
modifying the statistics and adds thread-safety annotations to these
fields and relevant functions.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>¬
10 years agoofproto/bond: Minor cleanups.
Joe Stringer [Mon, 14 Apr 2014 13:30:42 +0000 (13:30 +0000)]
ofproto/bond: Minor cleanups.

Add a constant for the number of bond buckets, and other minor cleanups.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>¬
10 years agodatapath: Orphan frags in skb_zerocopy and handle errors
Zoltan Kiss [Fri, 11 Apr 2014 16:16:48 +0000 (17:16 +0100)]
datapath: Orphan frags in skb_zerocopy and handle errors

This is the ported version of commit 36d5fe6a with the same name from net-next.
Apart from the small datapath.c changes it adjust the compat layer files as
well. This is the original commit message:

"skb_zerocopy can copy elements of the frags array between skbs, but it doesn't
orphan them. Also, it doesn't handle errors, so this patch takes care of that
as well, and modify the callers accordingly. skb_tx_error() is also added to
the callers so they will signal the failed delivery towards the creator of the
skb."

Signed-off-by: Zoltan Kiss <zoltan.kiss@citrix.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoofproto-dpif: Correct typo in documentation of rule_dpif_lookup()
Simon Horman [Mon, 14 Apr 2014 08:03:22 +0000 (08:03 +0000)]
ofproto-dpif: Correct typo in documentation of rule_dpif_lookup()

This corrects a typo that was added by adcf00ba35a0ce9c
("ofproto/bond: Implement bond megaflow using recirculation").

Cc: Andy Zhou <azhou@nicira.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Andy Zhou <azhou@nicira.com>¬
10 years agoofproto-dpif: Correct documentation of rule_dpif_lookup_from_table()
Simon Horman [Mon, 14 Apr 2014 08:03:37 +0000 (08:03 +0000)]
ofproto-dpif: Correct documentation of rule_dpif_lookup_from_table()

This corrects an editing error that was added by 6b83a3c5c37a0711
("ofproto: Support OF version-specific table-miss behaviours").

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Andy Zhou <azhou@nicira.com>¬
10 years agolib/odp-util: Do not use mask if it doesn't exist.
Jarno Rajahalme [Fri, 11 Apr 2014 22:51:10 +0000 (15:51 -0700)]
lib/odp-util: Do not use mask if it doesn't exist.

Diagnostic code path dereferenced a NULL pointer.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoMakefile.am: Fix build hang when .git and Git are present but don't work.
Ben Pfaff [Fri, 11 Apr 2014 20:05:45 +0000 (13:05 -0700)]
Makefile.am: Fix build hang when .git and Git are present but don't work.

If the .git directory is there, and "git --version" works, but "git
ls-files" fails to print any file names (e.g. perhaps because .git is a
symlink to an inaccessible directory) then the "grep" command in the
thread-safety-check rule would hang forever because it had an empty list
of files and therefore expected to read from stdin.  This fixes the problem
by adding the name of an empty file to the command, which is harmless.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
10 years agoClarify tunnel wildcarding.
Jarno Rajahalme [Fri, 11 Apr 2014 19:39:24 +0000 (12:39 -0700)]
Clarify tunnel wildcarding.

It would seem we should set the 'tunnel.ip_dst' in 'wc' when calling
tnl_port_should_receive(), as it is reading that flow field.  However,
since tunnels' datapath port numbers are different from the non-tunnel
ports, and we always unwildcard the 'in_port', we do not need to
unwildcard the 'tunnel.ip_dst' for non-tunneled packets.

Also, 'nw_tos' need not be unwildcarded if it is not examined.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodebian: Better document how to get a kernel module in README.Debian.
Ben Pfaff [Fri, 11 Apr 2014 17:39:20 +0000 (10:39 -0700)]
debian: Better document how to get a kernel module in README.Debian.

This moves existing text from INSTALL.Debian into the README.Debian
installed as part of the openvswitch-switch package, and adds a reference
from the former to the latter.

Reported-by: Brian Candler <b.candler@pobox.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agoofp-util.c: Simplify ofputil_group_stats_to_* functions.
Andy Zhou [Thu, 10 Apr 2014 18:53:20 +0000 (11:53 -0700)]
ofp-util.c: Simplify ofputil_group_stats_to_* functions.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoopenflow-1.3.h: improve struct ofp13_group_stats definition
Andy Zhou [Thu, 10 Apr 2014 07:50:34 +0000 (00:50 -0700)]
openflow-1.3.h: improve struct ofp13_group_stats definition

Uncomment bucket_stats definition in struct ofp13_group_stats
to better match OpenFlow spec 1.3.3's definition on page 91.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoopenflow-1.1.h: improve struct ofp11_group_stats definition
Andy Zhou [Thu, 10 Apr 2014 07:48:18 +0000 (00:48 -0700)]
openflow-1.1.h: improve struct ofp11_group_stats definition

Uncomment bucket_stats definition in struct ofp11_group_stats
to better match OpenFlow spec 1.1's definition on page 48.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Use netdev's 'change_seq' to reduce port modification check.
Alex Wang [Thu, 3 Apr 2014 17:07:20 +0000 (10:07 -0700)]
ofproto: Use netdev's 'change_seq' to reduce port modification check.

This commit uses the 'change_seq' in 'struct netdev' to determine
whether to update the 'ofport'.  This helps eliminate unnecessary
update.

In the experiment of configuring 5K internal port, there is neither
observable configuration overhead nor additional cpu consumption
after configuration finishes.  When one internal port state is
flapped every 0.3 second, this commit reduces the cpu utilization
of ovs-vswitchd thread from 40 to 12.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-dpdk: Indicate the change of etheraddr and mtu.
Alex Wang [Thu, 3 Apr 2014 16:46:31 +0000 (09:46 -0700)]
netdev-dpdk: Indicate the change of etheraddr and mtu.

This commit makes the netdev-dpdk module signal the change of
etheraddr and mtu by changing the global sequence number and
incrementing its 'change_seq'.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev: Add 'change_seq' back to netdev.
Alex Wang [Thu, 3 Apr 2014 07:17:34 +0000 (00:17 -0700)]
netdev: Add 'change_seq' back to netdev.

This commit can be seen as a partial revert of commit
da4a619179d (netdev: Globally track port status changes)
by adding the 'change_seq' to 'struct netdev'.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoAUTHORS: Add Lior Neudorfer <lior@guardicore.com>.
Ben Pfaff [Thu, 10 Apr 2014 17:24:42 +0000 (10:24 -0700)]
AUTHORS: Add Lior Neudorfer <lior@guardicore.com>.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetflow: Correctly track flow creation time.
Ben Pfaff [Mon, 17 Mar 2014 21:32:16 +0000 (14:32 -0700)]
netflow: Correctly track flow creation time.

'created' is supposed to be the time the flow was created, but it was
getting reset to zero on every expiration, causing the flow start time to
be wonky after the first active expiration on a flow.

Reported-by: Lior Neudorfer <lior@guardicore.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests: Skip queue limit tests if the queues are very large.
Ben Pfaff [Thu, 10 Apr 2014 17:04:56 +0000 (10:04 -0700)]
tests: Skip queue limit tests if the queues are very large.

This should prevent timing out.

Reported-by: Andrey Korolyov <andrey@xdel.ru>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
10 years agoMerge branch 'mainstream'
Giuseppe Lettieri [Thu, 10 Apr 2014 15:28:24 +0000 (17:28 +0200)]
Merge branch 'mainstream'

10 years agoSubmittingPatches: Rename to CONTRIBUTING.
Joe Stringer [Thu, 10 Apr 2014 04:57:51 +0000 (16:57 +1200)]
SubmittingPatches: Rename to CONTRIBUTING.

This makes the GitHub interface aware of the contribution guidelines,
so it will be displayed to contributors when they submit issues or pull
requests.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoMerge branch 'mainstream'
Giuseppe Lettieri [Thu, 10 Apr 2014 15:20:49 +0000 (17:20 +0200)]
Merge branch 'mainstream'

Conflicts:
lib/dpif-netdev.c
lib/netdev.c

10 years agovlandev: Fix an obvious predicate logic crash bug.
ZhengLingyun [Thu, 10 Apr 2014 15:07:05 +0000 (08:07 -0700)]
vlandev: Fix an obvious predicate logic crash bug.

Signed-off-by: ZhengLingyun <konghuarukhr@163.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif.at: Update MPLS test names.
Joe Stringer [Thu, 10 Apr 2014 04:56:12 +0000 (16:56 +1200)]
ofproto-dpif.at: Update MPLS test names.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agolearn.at: Fix a shell syntax
YAMAMOTO Takashi [Thu, 10 Apr 2014 00:32:36 +0000 (09:32 +0900)]
learn.at: Fix a shell syntax

Fix a botch in commit 7f12bdcc.
("learn.at: Fix a race in "self-modifying flow with idle_timeout" test")

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agonetdev-bsd: Update for recent ofpbuf api changes
YAMAMOTO Takashi [Wed, 9 Apr 2014 03:43:49 +0000 (12:43 +0900)]
netdev-bsd: Update for recent ofpbuf api changes

Leftovers from commit commit 1f317cb5.
("ofpbuf: Introduce access api for base, data and size.")

This fixes regressons introduced by commit 3f976e12.
("lib/ofpbuf: Rename private fields to discourage direct use.")

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agotests/ofproto-dpif: Use vlog to test dpif behaviour.
Joe Stringer [Wed, 9 Apr 2014 23:14:07 +0000 (11:14 +1200)]
tests/ofproto-dpif: Use vlog to test dpif behaviour.

Previously we made heavy use of the 'ovs-appctl dpif/dump-flows' command
to verify that flows were being installed into the datapath correctly.
However this is sensitive to timing, particularly when the behaviour of
revalidator threads is modified. A common race condition involves flows
being revalidated and deleted before the test script gets a chance to
connect to ovs-vswitchd and dump the datapath flows.

This patch reworks the tests to make use of the vlog facility for dpif,
checking for flow installation and flow dump messages. Most tests are
converted to check for flow installation, which should reduce these race
conditions significantly. For tests that require packet counts, these
will continue to check for flow_dump messages. Race conditions for these
should be reduced but not eliminated.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto/xlate: Fix set field unwildcarding.
Jarno Rajahalme [Wed, 9 Apr 2014 18:13:57 +0000 (11:13 -0700)]
ofproto/xlate: Fix set field unwildcarding.

If the field does not exist, nothing is set.  However, we must
unwildcard the bits we used to make the decision, and we need not
unwildcard the field and it's prerequisities, if nothing is set.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoTests: Fix ofproto/trace and expose megaflows when having a set action.
Jarno Rajahalme [Wed, 9 Apr 2014 18:13:57 +0000 (11:13 -0700)]
Tests: Fix ofproto/trace and expose megaflows when having a set action.

ofproto/trace incorrectly reported the megaflow based on the modified
flow, rather than the original flow key.  Now the original flow key is
stored before any modifications and is used for reporting the megaflow.

Also, flow reporting is suppressed only for resubmit flows, so that
the final flow will be printed if it is different from the incoming
flow key.

Test for the megaflow key and mask with flows having set actions.
This helps in verifying the correctness of operation with masked set
actions in the following patches.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Fix wildcard masking with nw_tos.
Jarno Rajahalme [Wed, 9 Apr 2014 18:13:57 +0000 (11:13 -0700)]
ofproto: Fix wildcard masking with nw_tos.

Later patches rely on the DSCP and ECN masks to be properly set when
the fields are read.  Also, avoid reading nw_tos if tunnel's inner
packet is not IP.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agolib/ofp-actions: Silently discard set ip ecn/ttl actions on OpenFlow10.
Jarno Rajahalme [Wed, 9 Apr 2014 18:13:57 +0000 (11:13 -0700)]
lib/ofp-actions: Silently discard set ip ecn/ttl actions on OpenFlow10.

It is better to not abort().

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Use existing flow for computing dp hash
Andy Zhou [Tue, 8 Apr 2014 20:26:46 +0000 (13:26 -0700)]
dpif-netdev: Use existing flow for computing dp hash

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: preserve packet metadata fields across recirculation
Andy Zhou [Tue, 8 Apr 2014 18:32:57 +0000 (11:32 -0700)]
dpif-netdev: preserve packet metadata fields across recirculation

If the actions executed during recirculation changed metadata fields,
then any actions after the recirculation returns would see those new
values. Now, all metadata are saved and restored across a recirculation.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agobridge: improve vlan mode related error messages when adding port
Thomas Graf [Wed, 9 Apr 2014 15:19:17 +0000 (17:19 +0200)]
bridge: improve vlan mode related error messages when adding port

Inform about fallback to trunk mode and convert errors to warnings
when we are not failing.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif: Wildcard bond output port with recirculation
Andy Zhou [Tue, 8 Apr 2014 04:49:07 +0000 (21:49 -0700)]
dpif: Wildcard bond output port with recirculation

This patch took advantage of the recirculation infrastructure
introduced in commit adcf00ba35a0, allowing megaflows to be generated
when the flow output to bond ports.

Without recirculation, it is necessary flows output to Bond ports
in balance_tcp mode to unmask all hash fields. With recirculation,
masking of hash fields is no longer required as kernel
now hashes each packet and redirects packets based on the hash value
using recirculation.

This patch removes the masking requirements when recirculation is
in use. Datapaths do not support recirculation are still supported,
but without the benefits of megaflow.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: supply a dummy err_handler of gre_cisco_protocol to prevent kernel crash
Wei Zhang [Sat, 5 Apr 2014 23:17:35 +0000 (16:17 -0700)]
datapath: supply a dummy err_handler of gre_cisco_protocol to prevent kernel crash

When use gre vport, openvswitch register a gre_cisco_protocol but
does not supply a err_handler with it. The gre_cisco_err() in
net/ipv4/gre_demux.c expect err_handler be provided with the
gre_cisco_protocol implementation, and call ->err_handler() without
existence check, cause the kernel crash.

This patch provide a err_handler to fix this bug.

Signed-off-by: Wei Zhang <asuka.com@163.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoovs-dev.py: Update repository location.
Ben Pfaff [Tue, 8 Apr 2014 23:56:21 +0000 (16:56 -0700)]
ovs-dev.py: Update repository location.

The Open vSwitch repository has moved to Github.

CC: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
10 years agodatapath: Fix tracking of flags seen in TCP flows.
Ben Pfaff [Tue, 8 Apr 2014 22:39:18 +0000 (15:39 -0700)]
datapath: Fix tracking of flags seen in TCP flows.

Flow statistics need to take into account the TCP flags from the packet
currently being processed (in 'key'), not the TCP flags matched by the
flow found in the kernel flow table (in 'flow').

This bug made the Open vSwitch userspace fin_timeout action have no effect
in many cases.

Bug #1219516.
Reported-by: Len Gao <leng@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agolib/ofpbuf: Rename private fields to discourage direct use.
Jarno Rajahalme [Tue, 8 Apr 2014 15:36:33 +0000 (08:36 -0700)]
lib/ofpbuf: Rename private fields to discourage direct use.

Direct use of 'data', 'base', and 'size' will break DPDK builds.  Try
to wean us off the habit by renaming the fields.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
10 years agoofproto/ofproto-dpif: Use ofpbuf API to access 'data' and 'size'.
Jarno Rajahalme [Tue, 8 Apr 2014 15:54:42 +0000 (08:54 -0700)]
ofproto/ofproto-dpif: Use ofpbuf API to access 'data' and 'size'.

A recent commit reintroduced some direct use of the ofpbuf 'data' and
'size'.  Use the access API instead.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif.at: Fix a race in "idle_age and hard_age increase over time"
YAMAMOTO Takashi [Fri, 4 Apr 2014 11:13:30 +0000 (20:13 +0900)]
ofproto-dpif.at: Fix a race in "idle_age and hard_age increase over time"

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agolearn.at: Fix a race in "learn refreshes hard_age" test
YAMAMOTO Takashi [Fri, 4 Apr 2014 10:18:35 +0000 (19:18 +0900)]
learn.at: Fix a race in "learn refreshes hard_age" test

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agolearn.at: Fix a race in "self-modifying flow with hard_timeout"
YAMAMOTO Takashi [Fri, 4 Apr 2014 09:23:00 +0000 (18:23 +0900)]
learn.at: Fix a race in "self-modifying flow with hard_timeout"

Also, add a comment to explain the expected sequences.

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoofproto-dpif.at: Fix races in "NetFlow flow expiration" tests
YAMAMOTO Takashi [Fri, 4 Apr 2014 08:46:01 +0000 (17:46 +0900)]
ofproto-dpif.at: Fix races in "NetFlow flow expiration" tests

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoofproto-dpif.at: Fix a race in "flow stats" test
YAMAMOTO Takashi [Fri, 4 Apr 2014 08:36:05 +0000 (17:36 +0900)]
ofproto-dpif.at: Fix a race in "flow stats" test

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoofproto-dpif.at: Fix a race in fin_timeout test
YAMAMOTO Takashi [Fri, 4 Apr 2014 08:30:05 +0000 (17:30 +0900)]
ofproto-dpif.at: Fix a race in fin_timeout test

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoofproto-dpif.at: Fix some races in MPLS actions tests
YAMAMOTO Takashi [Fri, 4 Apr 2014 08:02:11 +0000 (17:02 +0900)]
ofproto-dpif.at: Fix some races in MPLS actions tests

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agolearn.at: Fix a race in "self-modifying flow with idle_timeout" test
YAMAMOTO Takashi [Fri, 4 Apr 2014 04:57:26 +0000 (13:57 +0900)]
learn.at: Fix a race in "self-modifying flow with idle_timeout" test

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoofproto-dpif.at: Avoid races in table miss tests
YAMAMOTO Takashi [Fri, 4 Apr 2014 03:43:33 +0000 (12:43 +0900)]
ofproto-dpif.at: Avoid races in table miss tests

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoofproto-dpif.at: Fix a race in "ofproto-dpif - controller"
YAMAMOTO Takashi [Fri, 4 Apr 2014 01:54:05 +0000 (10:54 +0900)]
ofproto-dpif.at: Fix a race in "ofproto-dpif - controller"

Simon Horman submitted the identical patch independently.

Acked-by: Ben Pfaff <blp@nicira.com>
Tested-by: Lori Jakab <lojakab@cisco.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoofproto/bond: Implement bond megaflow using recirculation
Andy Zhou [Wed, 5 Mar 2014 23:27:31 +0000 (15:27 -0800)]
ofproto/bond: Implement bond megaflow using recirculation

Infrastructure to enable megaflow support for bond ports using
recirculation. This patch adds the following features:
* Generate RECIRC action when bond can benefit from recirculation.
* Populate post recirculation rules in a hidden table. Currently table 254.
* Uses post recirculation rules for bond rebalancing
* A recirculation implementation in dpif-netdev.

The goal of this patch is to be able to megaflow bond outputs and
thus greatly improve performance. However, this patch does not
actually improve the megaflow generation. It is left for a later commit.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovsdb-server: Improve message for "add-db" of database already open.
Ben Pfaff [Tue, 25 Mar 2014 22:51:23 +0000 (15:51 -0700)]
ovsdb-server: Improve message for "add-db" of database already open.

Otherwise you get a fairly obscure message about a lockfile already being
locked.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
10 years agolockfile: Improve log message when a process tries to relock a file.
Ben Pfaff [Tue, 25 Mar 2014 22:50:14 +0000 (15:50 -0700)]
lockfile: Improve log message when a process tries to relock a file.

"Resource deadlock avoided" is a pretty obscure message.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
10 years agotests: Fix typo in ovsdb-server test.
Ben Pfaff [Fri, 4 Apr 2014 20:51:14 +0000 (13:51 -0700)]
tests: Fix typo in ovsdb-server test.

25 kB is about 25000 bytes, not 2500.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agotests: Remove problematic but questionably useful part of ovsdb-server test.
Ben Pfaff [Fri, 4 Apr 2014 20:37:33 +0000 (13:37 -0700)]
tests: Remove problematic but questionably useful part of ovsdb-server test.

The test "ovsdb-server combines updates on backlogged connections" first
checks that ovsdb-server can combine transactions, and then checks that
it can keep them separate.  The latter part is hard to force because it
requires making sure that the socket buffer never fills up, and it also
isn't a very useful test (it doesn't check for any kind of correctness).
Therefore, this commit removes it.

Reported-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-parse: Handle buffer resize when parsing actions
Simon Horman [Mon, 7 Apr 2014 16:43:04 +0000 (16:43 +0000)]
ofp-parse: Handle buffer resize when parsing actions

A call to ofpbuf_put() may cause the data of the passed to be resized and
its base address to change.  Thus the address returned by ofpbuf_put()
should be used as the base address rather than relying on the base address
prior to ofpbuf_put().

This avoids the following assertion in ofpact_update_len() from failing
when ofpbuf_put() causes a resize in parse_note(), parse_noargs_dec_ttl(),
parse_dec_ttl().

    ovs_assert(ofpact == ofpacts->frame);

This restores pointer updates removed by and resolves a regression
introduced by cf3b7538666cd1ef ("ofpbuf: Abstract 'l2' pointer and document
usage conventions.").

Test cases have also been added to exercise this buffer resize in
parse_note(), parse_noargs_dec_ttl(), parse_dec_ttl().

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoofproto-dpif-upcall: Expire netflow flow when revalidate_ukey failed
YAMAMOTO Takashi [Tue, 1 Apr 2014 12:21:45 +0000 (21:21 +0900)]
ofproto-dpif-upcall: Expire netflow flow when revalidate_ukey failed

This fixes missing netflow flows in
"ofproto-dpif - NetFlow flow expiration" tests.

Acked-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoovsdb-server.at: Update a comment
YAMAMOTO Takashi [Fri, 4 Apr 2014 02:49:00 +0000 (11:49 +0900)]
ovsdb-server.at: Update a comment

Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoofproto-dpif.at: Wait for the monitor's pidfile disappears where necessary
YAMAMOTO Takashi [Mon, 31 Mar 2014 06:11:19 +0000 (15:11 +0900)]
ofproto-dpif.at: Wait for the monitor's pidfile disappears where necessary

These tests invokes ovs-ofctl monitor twice or more.
Because "ovs-appctl -t ofctl exit" does not wait for the target
process exit, there are chances to see the pid file from the previous
incarnation.

OVS_APP_EXIT_AND_WAIT macro was provided by Ben Pfaff.

Acked-by: Ben Pfaff <blp@nicira.com>
Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agoofp-print: Fix misaligned data access in ofp_print_error_msg().
Ben Pfaff [Sat, 5 Apr 2014 02:26:22 +0000 (19:26 -0700)]
ofp-print: Fix misaligned data access in ofp_print_error_msg().

The body of an OpenFlow error message often contains an inner OpenFlow
message, and when it does, the inner message starts at an odd multiple of 4
bytes from the beginning of the outer message.  That means that, on RISC
systems, accessing the inner message directly causes a bus error.  This
commit fixes the problem in a way that should make it difficult to recur.

This fixes the failure of tests 643, 645, and 651 on sparc seen here:
https://buildd.debian.org/status/fetch.php?pkg=openvswitch&arch=sparc&ver=2.1.0%2Bgit20140325-1&stamp=1396438624

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agopackets: Fix misaligned data accesses for MPLS and SCTP fields.
Ben Pfaff [Sat, 5 Apr 2014 03:21:15 +0000 (20:21 -0700)]
packets: Fix misaligned data accesses for MPLS and SCTP fields.

The other 32-bit data fields in protocol headers were already using
ovs_16aligned_be32, but MPLS and SCTP had been overlooked.  This fixes
the failure of test 681 seen here:
https://buildd.debian.org/status/fetch.php?pkg=openvswitch&arch=sparc&ver=2.1.0%2Bgit20140325-1&stamp=1396438624

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>