]> git.proxmox.com Git - mirror_ovs.git/log
mirror_ovs.git
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 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 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>
10 years agodpif-netdev: Unwildcard entire odp_port in dpif_netdev_mask_from_nlattrs().
Ben Pfaff [Sat, 5 Apr 2014 17:27:05 +0000 (10:27 -0700)]
dpif-netdev: Unwildcard entire odp_port in dpif_netdev_mask_from_nlattrs().

One case in the dpif_netdev_mask_from_nlattrs() function accidentally
wildcarded only a 16-bit subset of the mask's odp_port.  On little-endian
machines this subset was the lower bits, which happened to work out OK,
but on big-endian machines this subset was the upper bits, which doesn't
work and causes a test failure.  (The problem was actually visible in the
test expected results on little-endian machines, but we had not noticed.)

This commit unwildcards the whole field, fixing the problem, and updates
the test expected results to match.

This fixes the failure of test 732 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 agoovsdb: Remove SPECS in favor of referring to RFC 7047.
Ben Pfaff [Fri, 4 Apr 2014 16:43:54 +0000 (09:43 -0700)]
ovsdb: Remove SPECS in favor of referring to RFC 7047.

Also, add some clarifications relative to RFC 7047 to ovsdb-server(1).

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
10 years agoflow: Rearrange struct flow for better megaflows.
Ethan Jackson [Fri, 4 Apr 2014 00:31:03 +0000 (17:31 -0700)]
flow: Rearrange struct flow for better megaflows.

Since the dp_hash will often be a hash of the 5 tuple, it makes sense
to put it with the L4 header so it hits in the last classifier lookup
stage.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agotest-reconnect: Fix a warning.
Alex Wang [Fri, 4 Apr 2014 16:58:28 +0000 (09:58 -0700)]
test-reconnect: Fix a warning.

This commit fixes the "return discards 'const' qualifier
from pointer target type" warning issued when compiling
test-reconnect.c.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofpbuf: fix struct comment
Lorand Jakab [Fri, 4 Apr 2014 08:09:52 +0000 (11:09 +0300)]
ofpbuf: fix struct comment

Signed-off-by: Lorand Jakab <lojakab@cisco.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoAvoid static declarations of arrays with unknown size.
Gurucharan Shetty [Thu, 3 Apr 2014 23:07:43 +0000 (16:07 -0700)]
Avoid static declarations of arrays with unknown size.

Visual studio does not like it.

This commit is similar to commit 3815d6c2c
(Avoid designated initializers and static decls of arrays
of unknown size.) but touches more files.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agojsonrpc: Return received JSON-RPC messages immediately in jsonrpc_recv().
Ben Pfaff [Thu, 3 Apr 2014 22:27:18 +0000 (15:27 -0700)]
jsonrpc: Return received JSON-RPC messages immediately in jsonrpc_recv().

Until now, jsonrpc_recv() used separate iterations of its loop to receive
data, feed it to the JSON-RPC parser, and return the received message.
This is unnecessarily complicated and can occasionally mean that the
jsonrpc object has received and parsed but not returned a message.  This
commit refactors the code to receive data, feed it to the parse, and
return the received message in a single iteration, and simplifies the code
in the process.

Reported-by: Chris Hydon <chydon@aristanetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Support OF version-specific table-miss behaviours
Simon Horman [Wed, 2 Apr 2014 09:04:27 +0000 (18:04 +0900)]
ofproto: Support OF version-specific table-miss behaviours

OpenFlow 1.1 and 1.2 specify that if a table-miss occurs then the default
behaviour is to forward the packet the controller using a packet-in
message. And until this patch this is the default behaviour that Open
vSwitch uses for all OpenFlow versions.

OpenFlow1.3+ specifies that if a table-miss occurs then the default
behaviour is simply to drop the packet. This patch implements this
behaviour using the following logic:

If a table-miss occurs and the table-miss behaviour for the table
has not been set using a table_mod (in which case it is no longer
the default setting) then:

* Installing a facet in the datapath with a drop action in the
  if there are no pre-OF1.3 controllers connected which would receive
  an packet_in message.

  Note that this covers both the case where there are only OF1.3
  controllers and the case where there are no controllers at all.

* Otherwise sent a packet_in message to all pre-OF1.3 controllers.

  This covers both the case where there are only pre-OF1.3
  controllers and there are both pre-OF1.3 and OF1.3+ controllers.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Add support for kernels 3.13
Pravin Shelar [Wed, 2 Apr 2014 03:55:21 +0000 (20:55 -0700)]
datapath: Add support for kernels 3.13

Add support for building the in-tree kernel datapath for
Linux kernels up to 3.13. There were some changes in the
netlink area which required adding new compatibility code
for this layer. Also, some new per-cpu stats initialization
code was added.

Based on patch from Kyle Mestery.

Signed-off-by: Kyle Mestery <mestery@noironetworks.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Kyle Mestery <mestery@noironetworks.com>
10 years agobridge: don't bring up internal ports by default.
Flavio Leitner [Tue, 1 Apr 2014 21:05:20 +0000 (18:05 -0300)]
bridge: don't bring up internal ports by default.

It should be an administrator task to bring up devices as they
are configured properly.

Currently, Fedora is deleting the bridges when the interface is
brought down. Therefore, there is no bridge on the next boot and
the initscripts can apply the networking configuration properly
for a new bridge.

However, if the system didn't execute ifdown for some reason, the
bridge is left in the ovsdb and since internal ports are brought
up by default, there is no way for initscripts to known if the
adminitrator has already configured it or not.

This patch reverts commit bef071a5fdf8e2dd87677b04b3cf7a8f5094edcb
(bridge: Always "up" internal devices.).

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofpbuf: Abstract 'l2' pointer and document usage conventions.
Jarno Rajahalme [Wed, 2 Apr 2014 22:44:21 +0000 (15:44 -0700)]
ofpbuf: Abstract 'l2' pointer and document usage conventions.

Rename 'l2' to 'frame' and add new ofpbuf_set_frame() and ofpbuf_l2().
ofpbuf_set_frame() alse resets all the layer offsets.  ofpbuf_l2()
returns NULL if the packet has no Ethernet header, as indicated either
by unset l3 offset or NULL frame pointer.  Callers of ofpbuf_l2() are
supposed to check the return value, unless they can otherwise be sure
that the packet has a valid Ethernet header.

The recent commit 437d0d22 made some assumptions that were not valid
regarding the use of the 'l2' pointer in rconn module and by
compose_rarp().  This is now fixed as follows: rconn now relies on the
fact that once OpenFlow messages are given to rconn for transport, the
frame pointer is no longer needed to refer to the OpenFlow header; and
compose_rarp() now sets the frame pointer and offsets as expected.

In addition to storing network frames, ofpbufs are also used for
handling OpenFlow messages and action lists.  lib/ofpbuf.h now has a
comment documenting the current usage conventions and invariants.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofpbuf: Rename trivial _get_ functions without the "get".
Jarno Rajahalme [Thu, 3 Apr 2014 18:51:54 +0000 (11:51 -0700)]
ofpbuf: Rename trivial _get_ functions without the "get".

Code reads better without the "get", for example "ofpbuf_l3()"
v.s. "ofpbuf_get_l3()".  L4 payoad access functions still use the
"get" (e.g., "ofpbuf_get_tcp_payload()").

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agotests: add ovstest to .gitignore
Lorand Jakab [Thu, 3 Apr 2014 18:42:31 +0000 (21:42 +0300)]
tests: add ovstest to .gitignore

Signed-off-by: Lorand Jakab <lojakab@cisco.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agounit-test: Link 29 test programs into ovstest
Andy Zhou [Tue, 1 Apr 2014 07:47:01 +0000 (00:47 -0700)]
unit-test: Link 29 test programs into ovstest

Improve link speed by linking 29 test programs into ovstest.

On my machine, running the following command against a fully
built tree:

  $ touch lib/random.c; time make

Improve the overall build time from 7 seconds to 3.5 seconds.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agounit-test: Improve ovstest user interface
Andy Zhou [Mon, 31 Mar 2014 20:38:04 +0000 (13:38 -0700)]
unit-test: Improve ovstest user interface

Improve help output. Running without argument now exit with an error
message and an error code. Simplify OVSTEST_REGISTER() since not all
test programs uses sub_commands.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agojsonrpc-server: Combine notifications when connection becomes backlogged.
Ben Pfaff [Wed, 2 Apr 2014 15:43:17 +0000 (08:43 -0700)]
jsonrpc-server: Combine notifications when connection becomes backlogged.

Connections that queue up too much data, because they are monitoring a
table that is changing quickly and failing to keep up with the updates,
cause problems with buffer management.  Since commit 60533a405b2e
(jsonrpc-server: Disconnect connections that queue too much data.),
ovsdb-server has dealt with them by disconnecting the connection and
letting them start up again with a fresh copy of the database.  However,
this is not ideal because of situations where disconnection happens
repeatedly.  For example:

     - A manager toggles a column back and forth between two or more values
       quickly (in which case the data transmitted over the monitoring
       connections always increases quickly, without bound).

     - A manager repeatedly extends the contents of some column in some row
       (in which case the data transmitted over the monitoring connection
       grows with O(n**2) in the length of the string).

A better way to deal with this problem is to combine updates when they are
sent to the monitoring connection, if that connection is not keeping up.
In both the above cases, this reduces the data that must be sent to a
manageable amount.  This commit implements this new way.

Bug #1211786.
Bug #1221378.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agojsonrpc-server: Track monitor updates separately from sending them.
Ben Pfaff [Tue, 1 Apr 2014 23:26:47 +0000 (16:26 -0700)]
jsonrpc-server: Track monitor updates separately from sending them.

This will make combining monitor updates easier in the next commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agoRevert "json: New function json_serialized_length()."
Ben Pfaff [Wed, 2 Apr 2014 14:11:20 +0000 (07:11 -0700)]
Revert "json: New function json_serialized_length()."

This reverts commit 1600fa6853872e16130366351a2c14f6fa8b547c.

Connections that queue up too much data, because they are monitoring a
table that is changing quickly and failing to keep up with the updates,
cause problems with buffer management.  Since commit 60533a405b2e
(jsonrpc-server: Disconnect connections that queue too much data.),
ovsdb-server has dealt with them by disconnecting the connection and
letting them start up again with a fresh copy of the database.  However,
this is not ideal because of situations where disconnection happens
repeatedly.  For example:

     - A manager toggles a column back and forth between two or more values
       quickly (in which case the data transmitted over the monitoring
       connections always increases quickly, without bound).

     - A manager repeatedly extends the contents of some column in some row
       (in which case the data transmitted over the monitoring connection
       grows with O(n**2) in the length of the string).

A better way to deal with this problem is to combine updates when they are
sent to the monitoring connection, if that connection is not keeping up.
In both the above cases, this reduces the data that must be sent to a
manageable amount.  An upcoming patch implements this new way.  This commit
reverts part of the previous solution that disconnects backlogged
connections, since it is no longer useful.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agoRevert "ovsdb-data: New functions for predicting serialized length of data."
Ben Pfaff [Wed, 2 Apr 2014 14:10:40 +0000 (07:10 -0700)]
Revert "ovsdb-data: New functions for predicting serialized length of data."

This reverts commit 0ea7bec76d804a2c4efccd3dbdaa3e30cf536a5c.

Connections that queue up too much data, because they are monitoring a
table that is changing quickly and failing to keep up with the updates,
cause problems with buffer management.  Since commit 60533a405b2e
(jsonrpc-server: Disconnect connections that queue too much data.),
ovsdb-server has dealt with them by disconnecting the connection and
letting them start up again with a fresh copy of the database.  However,
this is not ideal because of situations where disconnection happens
repeatedly.  For example:

     - A manager toggles a column back and forth between two or more values
       quickly (in which case the data transmitted over the monitoring
       connections always increases quickly, without bound).

     - A manager repeatedly extends the contents of some column in some row
       (in which case the data transmitted over the monitoring connection
       grows with O(n**2) in the length of the string).

A better way to deal with this problem is to combine updates when they are
sent to the monitoring connection, if that connection is not keeping up.
In both the above cases, this reduces the data that must be sent to a
manageable amount.  An upcoming patch implements this new way.  This commit
reverts part of the previous solution that disconnects backlogged
connections, since it is no longer useful.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agoRevert "jsonrpc-server: Disconnect connections that queue too much data."
Ben Pfaff [Wed, 2 Apr 2014 14:09:47 +0000 (07:09 -0700)]
Revert "jsonrpc-server: Disconnect connections that queue too much data."

This reverts commit 60533a405b2eb77214b767767fe143c8645f82d5.

Connections that queue up too much data, because they are monitoring a
table that is changing quickly and failing to keep up with the updates,
cause problems with buffer management.  Since commit 60533a405b2e
(jsonrpc-server: Disconnect connections that queue too much data.),
ovsdb-server has dealt with them by disconnecting the connection and
letting them start up again with a fresh copy of the database.  However,
this is not ideal because of situations where disconnection happens
repeatedly.  For example:

     - A manager toggles a column back and forth between two or more values
       quickly (in which case the data transmitted over the monitoring
       connections always increases quickly, without bound).

     - A manager repeatedly extends the contents of some column in some row
       (in which case the data transmitted over the monitoring connection
       grows with O(n**2) in the length of the string).

A better way to deal with this problem is to combine updates when they are
sent to the monitoring connection, if that connection is not keeping up.
In both the above cases, this reduces the data that must be sent to a
manageable amount.  An upcoming patch implements this new way.  This commit
reverts part of the previous solution that disconnects backlogged
connections, since it is no longer useful.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agoRevert "jsonrpc-server: Add test for disconnecting connections with too long queues."
Ben Pfaff [Wed, 2 Apr 2014 21:22:25 +0000 (14:22 -0700)]
Revert "jsonrpc-server: Add test for disconnecting connections with too long queues."

This reverts commit 631583739f9aec55d4cbe25fb856143ccde48ab6.

Connections that queue up too much data, because they are monitoring a
table that is changing quickly and failing to keep up with the updates,
cause problems with buffer management.  Since commit 60533a405b2e
(jsonrpc-server: Disconnect connections that queue too much data.),
ovsdb-server has dealt with them by disconnecting the connection and
letting them start up again with a fresh copy of the database.  However,
this is not ideal because of situations where disconnection happens
repeatedly.  For example:

     - A manager toggles a column back and forth between two or more values
       quickly (in which case the data transmitted over the monitoring
       connections always increases quickly, without bound).

     - A manager repeatedly extends the contents of some column in some row
       (in which case the data transmitted over the monitoring connection
       grows with O(n**2) in the length of the string).

A better way to deal with this problem is to combine updates when they are
sent to the monitoring connection, if that connection is not keeping up.
In both the above cases, this reduces the data that must be sent to a
manageable amount.  An upcoming patch implements this new way.  This commit
reverts part of the previous solution that disconnects backlogged
connections, since it is no longer useful.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agoovsdb-server: Send update for _version for changes due to weak ref removal.
Ben Pfaff [Tue, 1 Apr 2014 21:33:24 +0000 (14:33 -0700)]
ovsdb-server: Send update for _version for changes due to weak ref removal.

When a row was deleted, and that caused the transaction manager to remove
a remaining weak reference to the row, and no other change had been made
to the row in that transaction, and a client was monitoring modifications
of the _version column in the row, then the monitor update for the column
did not include the old contents of the _version column, even though it
should have.  This commit fixes the problem.

Probably most clients only look at the new value of the column, if they
monitor _version at all, and this bug is really old, so it's probably
not a serious bug.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agoovsdb-client: Support all vlog options.
Ben Pfaff [Wed, 2 Apr 2014 22:03:41 +0000 (15:03 -0700)]
ovsdb-client: Support all vlog options.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agodebian: Allow kmod or module-init-tools for backward compatibility.
Ben Pfaff [Wed, 2 Apr 2014 21:54:51 +0000 (14:54 -0700)]
debian: Allow kmod or module-init-tools for backward compatibility.

Commit d473844693 (debian: Depend on 'kmod' instead of module-init-tools.)
switched from depending on module-init-tools to depending on kmod, which
is the new name of the appropriate package in Debian.  Unfortunately,
while kmod is the right name for the latest Debian distribution, it doesn't
have that name in old distributions and thus breaks the build on those.
This commit should work OK in either case, since it allows both names.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agonetdev-dpdk: Remove alloc from packet recv.
Pravin Shelar [Mon, 31 Mar 2014 20:17:24 +0000 (13:17 -0700)]
netdev-dpdk: Remove alloc from packet recv.

On DPDK packet recv, ovs is given pointer to mbuf which has
information about a packet, for example pointer to data and size.
By moving mbuf to ofpbuf we can let dpdk allocate ofpbuf and
pass that to ovs for processing the packet.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoofpbuf: Add DPDK mbuf to ofpbuf.
Pravin Shelar [Tue, 1 Apr 2014 03:41:53 +0000 (20:41 -0700)]
ofpbuf: Add DPDK mbuf to ofpbuf.

Define data, base and size access APIs for DPDK.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoofpbuf: Add ofpbuf_init_dpdk()
Pravin Shelar [Mon, 31 Mar 2014 20:22:39 +0000 (13:22 -0700)]
ofpbuf: Add ofpbuf_init_dpdk()

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoofpbuf: Introduce access api for base, data and size.
Pravin Shelar [Sun, 30 Mar 2014 08:31:50 +0000 (01:31 -0700)]
ofpbuf: Introduce access api for base, data and size.

These functions will be used by later patches.  Following patch
does not change functionality.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
10 years agoofpbuf: Add private pointer for dpdk
Pravin Shelar [Mon, 31 Mar 2014 19:44:06 +0000 (12:44 -0700)]
ofpbuf: Add private pointer for dpdk

netdev-dpdk uses this pointer to store dpdk mbuf. This patch fixes
compilation error in dpdk.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agodatapath: Minimize ovs_flow_cmd_new|set critical sections.
Jarno Rajahalme [Wed, 2 Apr 2014 18:14:58 +0000 (11:14 -0700)]
datapath: Minimize ovs_flow_cmd_new|set critical sections.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
10 years agodatapath: Split ovs_flow_cmd_new_or_set().
Jarno Rajahalme [Wed, 2 Apr 2014 18:14:58 +0000 (11:14 -0700)]
datapath: Split ovs_flow_cmd_new_or_set().

Following patch will be easier to reason about with separate
ovs_flow_cmd_new() and ovs_flow_cmd_set() functions.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>