sliver-openvswitch.git
10 years agoutilities: a top like tool for ovs-dpctl dump-flows.
Mark Hamilton [Fri, 13 Sep 2013 22:50:48 +0000 (15:50 -0700)]
utilities: a top like tool for ovs-dpctl dump-flows.

This python script summarizes ovs-dpctl dump-flows content by aggregating
the number of packets, total bytes and occurrence of the following fields:
  - Datapath in_port
  - Ethernet type
  - Source and destination MAC addresses
  - IP protocol
  - Source and destination IPv4 addresses
  - Source and destination IPv6 addresses
  - UDP and TCP destination port
  - Tunnel source and destination addresses

Testing included confirming both mega-flows and non-megaflows are
properly parsed. Bit masks are applied in the case of mega-flows
prior to aggregation.  Test --script parameter which runs in
non-interactive mode. Tested syntax against python 2.4.3, 2.6 and 2.7.
Confirmed script passes pep8 and pylint run as:

pylint --disable=I0011 --include-id=y --reports=n

This tool has been added to these distribution:
  - add ovs-dpctl-top to debian distribution
  - add ovs-dpctl-top to rpm distribution.
  - add ovs-dpctl-top to XenServer RPM.

Signed-off-by: Mark Hamilton <mhamilton@nicira.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agoodp-util: Remove trailing whitespace.
Ethan Jackson [Tue, 17 Sep 2013 00:23:31 +0000 (17:23 -0700)]
odp-util: Remove trailing whitespace.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agonetdev-vport: Fix indentation.
Ethan Jackson [Tue, 17 Sep 2013 00:19:56 +0000 (17:19 -0700)]
netdev-vport: Fix indentation.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif: Avoid unnecessarily counting packets.
Ben Pfaff [Mon, 16 Sep 2013 18:24:30 +0000 (11:24 -0700)]
ofproto-dpif: Avoid unnecessarily counting packets.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoofproto-dpif: Remove write-only member 'key_fitness' from struct subfacet.
Ben Pfaff [Thu, 29 Aug 2013 21:24:28 +0000 (14:24 -0700)]
ofproto-dpif: Remove write-only member 'key_fitness' from struct subfacet.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoofproto-dpif-upcall: Remove redundant 'packets' list from struct flow_miss.
Ben Pfaff [Tue, 27 Aug 2013 21:58:26 +0000 (14:58 -0700)]
ofproto-dpif-upcall: Remove redundant 'packets' list from struct flow_miss.

Until now, struct flow_miss contained a list of packets and a list of
upcalls.  Each packet in the list of packets can be obtained from the
corresponding upcall in the list of upcalls via upcall->dpif_upcall.packet,
so this commit deletes the list of packets and replaces each reference to
a packet by that expression.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoofproto-dpif: Use shash_find_and_delete() to simplify close_dpif_backer().
Ben Pfaff [Mon, 16 Sep 2013 21:37:09 +0000 (14:37 -0700)]
ofproto-dpif: Use shash_find_and_delete() to simplify close_dpif_backer().

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoofproto-dpif: Fix use-after-free error deleting last bridge.
Ben Pfaff [Mon, 16 Sep 2013 21:53:27 +0000 (14:53 -0700)]
ofproto-dpif: Fix use-after-free error deleting last bridge.

valgrind reported:

    Invalid read of size 4
       at 0x806ADC1: odp_port_to_ofport (hmap.h:267)
       by 0x8077C05: xlate_receive (ofproto-dpif-xlate.c:523)
       by 0x8073994: handle_miss_upcalls (ofproto-dpif-upcall.c:642)
       by 0x80741AA: udpif_miss_handler (ofproto-dpif-upcall.c:412)
       by 0x56FCC38: start_thread (pthread_create.c:304)
       by 0x735378D: clone (clone.S:130)
     Address 0x786c084 is 4 bytes inside a block of size 16 free'd
       at 0x4D8350C: free (vg_replace_malloc.c:427)
       by 0x8065EDA: close_dpif_backer (ofproto-dpif.c:1094)

The problem is that close_dpif_backer() destroys odp_to_ofport_map and the
associated mutex before it calls udpif_destroy() to stop the forwarding
threads.  This gives the forwarding threads a window in which to try to
use odp_to_ofport_map.

This commit moves the udpif_destroy() call much earlier, solving the
problem.  (The call to udpif_destroy() must follow the call to
drop_key_clear() because drop_key_clear() uses the udpif.)

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agovlog: Fix formatting of milliseconds in Python log messages.
Ben Pfaff [Mon, 16 Sep 2013 22:15:01 +0000 (15:15 -0700)]
vlog: Fix formatting of milliseconds in Python log messages.

Commit 2b31d8e713de7 (vlog: Report timestamps in millisecond resolution in
log messages.) introduced milliseconds to log messages by default, but the
Python version did not ensure that milliseconds were always formatted with
3 digits, so 3.001 was formatted as "3.1" and 3.012 as "3.12", and so on.
This commit fixes the problem.

CC: Paul Ingram <paul@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-ofctl: Add meter support.
Jarno Rajahalme [Fri, 13 Sep 2013 22:03:33 +0000 (15:03 -0700)]
ovs-ofctl: Add meter support.

Adds commands add-meter, mod-meter, del-meter, del-meters, dump-meter,
dump-meters, meter-stats, and meter-features.

Syntax is as follows:

add-meter <br> meter=<n> (kbps|pktps) [burst] [stats] bands= type=(drop|dscp_remark) rate=<n> [burst_size=<n>] [prec_level=<n>] <more bands>

mod-meter <br> meter=<n> (kbps|pktps) [burst] [stats] bands= type=(drop|dscp_remark) rate=<n> [burst_size=<n>] [prec_level=<n>] <more bands>

del-meter <br> meter=(<n>|all)

del-meters <br>

dump-meter <br> meter=(<n>|all)

dump-meters <br>

meter-stats <br> [meter=(<n>|all)]

meter-features <br>

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agorule_ofpacts: keep datapath meter_id.
Jarno Rajahalme [Fri, 13 Sep 2013 22:03:32 +0000 (15:03 -0700)]
rule_ofpacts: keep datapath meter_id.

This allows datapaths to operate without referring to the ofproto-level
meter configuration for mater ID mapping, which reduces needs for locking.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto meters: Keep provider meter_id over mods.
Jarno Rajahalme [Fri, 13 Sep 2013 22:03:31 +0000 (15:03 -0700)]
ofproto meters: Keep provider meter_id over mods.

Changed the ofproto meter API to require the provider keep the provider
meter ID unchanged when modifying a meter.  This makes the mapping from
an OpenFlow meter ID to a datapath meter ID consistent over the lifetime
of the meter.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Actually return the error code from meter add.
Jarno Rajahalme [Fri, 13 Sep 2013 22:03:30 +0000 (15:03 -0700)]
ofproto: Actually return the error code from meter add.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoINSTALL.RHEL: Explain how to work around old Autoconf; add more prereqs.
Ben Pfaff [Fri, 13 Sep 2013 16:29:29 +0000 (09:29 -0700)]
INSTALL.RHEL: Explain how to work around old Autoconf; add more prereqs.

The new text is adapted from INSTALL.XenServer.

Mark Hamilton supplied the list of additional build prerequisites.

Reported-by: Mark Hamilton <mhamilton@nicira.com>
CC: Gurucharan Shetty <shettyg@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests: Make ovsdb-server add-db/remove-db test faster and more reliable.
Ben Pfaff [Mon, 16 Sep 2013 22:03:55 +0000 (15:03 -0700)]
tests: Make ovsdb-server add-db/remove-db test faster and more reliable.

Until now, the "ovsdb-server/add-db and remove-db with --monitor" test
killed ovsdb-server with SIGSEGV twice.  Each time, the "--monitor" option
caused the supervisor process to restart the child, but the second time it
incurred a 10-second delay intended to prevent the daemon from wasting CPU
time by restarting itself and dying again very quickly in a loop.  This
made the test take over 10 seconds to execute.  It also made it
occasionally fail because the OVS_WAIT_UNTIL check waits at most
approximately 10 seconds before it decides that the condition that it is
testing for will never occur.

This commit fixes the problem by breaking the test into two tests, each of
which kills ovsdb-server with SIGSEGV only once.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoovsdb: write commit timestamps to millisecond resolution.
Paul Ingram [Sat, 14 Sep 2013 01:52:54 +0000 (18:52 -0700)]
ovsdb: write commit timestamps to millisecond resolution.

This is expected to make system debugging easier.

This raises two compatibility issues:
1. When a new ovsdb-tool reads an old database, it will multiply by 1000 any
  timestamp it reads which is less than 1<<31. Since this date corresponds to
  Jan 16 1970 this is unlikely to cause a problem.
2. When an old ovsdb-tool reads a new database, it will interpret the
  millisecond timestamps as seconds and report dates in the far future; the
  time of this commit is reported as the year 45672 (each second since the
  epoch is interpreted as 16 minutes).

Signed-off-by: Paul Ingram <pingram@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovsdb: Use DB load time, not on-disk commit times, for compaction.
Paul Ingram [Sat, 14 Sep 2013 01:52:53 +0000 (18:52 -0700)]
ovsdb: Use DB load time, not on-disk commit times, for compaction.

The ovsdb-server compaction timing logic is written assuming monotonic
time at milliscond resolution but it calculated the next compaction time
based on the oldest commit in the database. This was a problem because
commit timestamps are written in wall-clock time to second resolution.

This commit calculates the next compaction time based on the time when
the database was first loaded or the last compaction was done, both in
monotonic time at millisecond resolution.

Signed-off-by: Paul Ingram <pingram@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoFAQ: Fix version number for 2.0.
Jesse Gross [Fri, 13 Sep 2013 21:40:39 +0000 (14:40 -0700)]
FAQ: Fix version number for 2.0.

Presumably we will have minor version releases in the 2.x series
as well.

Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agotimeval: Replace rwlock by mutex.
Ben Pfaff [Fri, 13 Sep 2013 18:38:57 +0000 (11:38 -0700)]
timeval: Replace rwlock by mutex.

It's only held briefly now and in general a mutex tends to be preferred for
that case.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agotimeval: Restore ability to warp time forward when time is not stopped.
Ben Pfaff [Fri, 13 Sep 2013 21:30:05 +0000 (14:30 -0700)]
timeval: Restore ability to warp time forward when time is not stopped.

Commit 31ef9f5178dee18 (timeval: Remove CACHE_TIME scheme.) inadvertently
removed the ability to warp time forward, for use in tests, except when
time is stopped.  This fixes the problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agotimeval: Add Clang thread-safety annotations, fix unimportant violation.
Ben Pfaff [Fri, 13 Sep 2013 18:32:45 +0000 (11:32 -0700)]
timeval: Add Clang thread-safety annotations, fix unimportant violation.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agovlog: Report timestamps in millisecond resolution in log messages.
Paul Ingram [Fri, 13 Sep 2013 01:19:04 +0000 (18:19 -0700)]
vlog: Report timestamps in millisecond resolution in log messages.

To make debugging easier.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Paul Ingram <pingram@nicira.com>
10 years agodatapath: remove HAVE_MAC_RAW
Viresh Kumar [Mon, 26 Aug 2013 06:36:06 +0000 (12:06 +0530)]
datapath: remove HAVE_MAC_RAW

This was causing it to fail against latest RT kernels, with following errors:

In file included from /home/arm/work/kernel/linaro/lng/openvswitch/datapath/linux/compat/include/linux/if_vlan.h:6:0,
                 from /home/arm/work/kernel/linaro/lng/openvswitch/datapath/linux/actions.c:29:
/home/arm/work/kernel/linaro/lng/lng.git/include/linux/if_vlan.h: In function vlan_insert_tag:
/home/arm/work/kernel/linaro/lng/lng.git/include/linux/if_vlan.h:197:5: error: struct sk_buff has no member named mac
In file included from /home/arm/work/kernel/linaro/lng/openvswitch/datapath/linux/../flow.h:34:0,
                 from /home/arm/work/kernel/linaro/lng/openvswitch/datapath/linux/../datapath.h:31,
                 from /home/arm/work/kernel/linaro/lng/openvswitch/datapath/linux/actions.c:36:
/home/arm/work/kernel/linaro/lng/lng.git/include/net/inet_ecn.h: In function INET_ECN_set_ce:
/home/arm/work/kernel/linaro/lng/lng.git/include/net/inet_ecn.h:137:10: error: struct sk_buff has no member named nh
/home/arm/work/kernel/linaro/lng/lng.git/include/net/inet_ecn.h:142:10: error: struct sk_buff has no member named nh
/home/arm/work/kernel/linaro/lng/openvswitch/datapath/linux/actions.c: In function __pop_vlan_tci:
/home/arm/work/kernel/linaro/lng/openvswitch/datapath/linux/actions.c:72:5: error: struct sk_buff has no member named mac
make[7]: *** [/home/arm/work/kernel/linaro/lng/openvswitch/datapath/linux/actions.o] Error 1
make[6]: *** [_module_/home/arm/work/kernel/linaro/lng/openvswitch/datapath/linux] Error 2

Not sure why it was added earlier but my guess is, for earlier RT kernels struct
sk_buff had following variables mac.raw, nh.raw, h.raw instead of mac_header,
network_header, transport_header. And so the hack to rename them in OVS code.
But that's not the case now. RT kernel have mac_header, network_header and
transport_header as parameter and so we don't need this macro at all.

Lets get rid of it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoAUTHORS: Add Torbjorn Tornkvist.
Ben Pfaff [Fri, 13 Sep 2013 15:44:19 +0000 (08:44 -0700)]
AUTHORS: Add Torbjorn Tornkvist.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-util: Announce OpenFlow 1.3 table features only in OpenFlow 1.3.
Ben Pfaff [Fri, 13 Sep 2013 15:42:55 +0000 (08:42 -0700)]
ofp-util: Announce OpenFlow 1.3 table features only in OpenFlow 1.3.

The translation into OpenFlow 1.2 didn't trim off the OpenFlow 1.3 specific
bits.  This fixes the problem.

It would probably be wise to introduce an ofputil_table_stats structure.
Using ofp12_table_stats is somewhat confusing.

Reported-by: Torbjorn Tornkvist <kruskakli@gmail.com>
Tested-by: Torbjorn Tornkvist <kruskakli@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Move "learn" actions into individual threads.
Ben Pfaff [Fri, 13 Sep 2013 03:45:31 +0000 (20:45 -0700)]
ofproto-dpif: Move "learn" actions into individual threads.

Before OVS introduced threading, any given ``learn'' action took effect in
the flow table before the next incoming flow was set up.  This meant that
if a packet came in, used ``learn'' to set up a flow to handle replies, and
then a reply came in, the reply would always hit the flow set up by the
``learn'' action.  Until now, with the threading implementation, though,
the effects of ``learn'' actions happen asynchronously via a queue, which
means that the reply can arrive before the flow to handle it is set up.
This introduced an unacceptable regression in important use cases.

This commit fixes the problem by switching back to executing learn actions
before forwarding the packet that triggered it.

I imagine that there is considerable opportunity for optimization here.

Bug #19147.
Bug #19244.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Remove redundant cls parameter from a few functions.
Ben Pfaff [Tue, 10 Sep 2013 05:36:19 +0000 (22:36 -0700)]
ofproto: Remove redundant cls parameter from a few functions.

Previously this parameter was useful for Clang locking annotations
but it isn't actually a locking requirement anymore, so remove
the parameter.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Add global locking around flow table changes.
Ben Pfaff [Fri, 13 Sep 2013 03:45:15 +0000 (20:45 -0700)]
ofproto: Add global locking around flow table changes.

This makes 'ofproto_mutex' protect the flow table well enough that threads
other than the main one can realistically modify flows.

I need to look at the interface between ofproto and connmgr: I think that
there might need to be some locking there too.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Refactor eviction cases to use common code.
Ben Pfaff [Fri, 13 Sep 2013 03:30:56 +0000 (20:30 -0700)]
ofproto: Refactor eviction cases to use common code.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: New helper any_pending_ops().
Ben Pfaff [Wed, 11 Sep 2013 04:44:53 +0000 (21:44 -0700)]
ofproto: New helper any_pending_ops().

This function is trivial now but in an upcoming commit it will need to
become slightly more complicated, which makes writing it as a function
worthwhile.

Until then, this commit simplifies the logic, which was redundant since
the 'deletions' hmap always points into the 'pending' list anyway.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Mark immutable members of struct rule 'const'.
Ben Pfaff [Wed, 11 Sep 2013 04:31:59 +0000 (21:31 -0700)]
ofproto: Mark immutable members of struct rule 'const'.

One difficult part of make flow_mods thread-safe is sorting out which
members of each structure can be modified under which locks and,
especially, documenting this in a way that makes it hard for programmers to
get it wrong later.  The compiler provides some tools for us, however, and
'const' is one of the nicer ones since it is standardized rather than part
of a compiler extension.

This commit makes use of 'const' to mark the immutable members of struct
rule, which is definitely the most confusing structure regarding thread
safety simply because it has so many members that use different forms of
synchronization.  It also adds a bunch of CONST_CASTs to allow these
members to be initialized and destroyed where necessary.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Make some functions for rules private to ofproto.c.
Ben Pfaff [Wed, 11 Sep 2013 04:01:34 +0000 (21:01 -0700)]
ofproto: Make some functions for rules private to ofproto.c.

These aren't used outside this file.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Remove ->timeout_mutex from struct rule (just use ->mutex).
Ben Pfaff [Wed, 11 Sep 2013 04:18:09 +0000 (21:18 -0700)]
ofproto: Remove ->timeout_mutex from struct rule (just use ->mutex).

I think that ->timeout_mutex and ->mutex were separate because the latter
(which was actually a rwlock named ->rwlock until recently) was held for
long periods of time, which meant that having a separate ->timeout_mutex
reduced lock contention.  But ->mutex is now only held briefly, so it seems
reasonable to just use it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Replace rwlock in struct rule by a mutex.
Ben Pfaff [Thu, 12 Sep 2013 07:28:49 +0000 (00:28 -0700)]
ofproto: Replace rwlock in struct rule by a mutex.

A rwlock is suitable when one expects long hold times so there is a need
for some parallelism for readers.  But when the lock is held briefly, it
makes more sense to use a mutex for two reasons.  First, a rwlock is more
complex than a mutex so one would expect it to be more expensive to
acquire.  Second, a rwlock is less fair than a mutex: as long as there are
any readers this blocks out writers.

At least, that's the behavior I intuitively expect, and a few looks around
the web suggest that I'm not the only one.

Previously, struct rule's rwlock was held for long periods, so using a
rwlock made sense.  Now it is held only briefly, so this commit replaces it
by a mutex.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Protect index by cookie with ofproto_mutex.
Ben Pfaff [Mon, 9 Sep 2013 21:26:23 +0000 (14:26 -0700)]
ofproto: Protect index by cookie with ofproto_mutex.

The cookie index is only used for flow_mods, so it makes sense to use this
global mutex.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Drop 'expirable_mutex' in favor of new global 'ofproto_mutex'.
Ben Pfaff [Thu, 12 Sep 2013 07:31:33 +0000 (00:31 -0700)]
ofproto: Drop 'expirable_mutex' in favor of new global 'ofproto_mutex'.

This is the first step toward making a global lock that protects everything
needed for updating the flow table.  This commit starts out by merging one
lock into the new one, and later commits will continue that process.

The mutex is initially a recursive one, because I wasn't sure that there
were no nested acquisitions at this stage, but a later commit will change
it to a regular error-checking mutex once it's settled down a bit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Move rule_execute() out of ofopgroup_complete().
Ben Pfaff [Thu, 12 Sep 2013 07:25:28 +0000 (00:25 -0700)]
ofproto: Move rule_execute() out of ofopgroup_complete().

One goal we're moving toward is to be able to execute "learn" actions
in each thread that handles packets that arrive on an interface just before
we forward those packets.  The planned strategy there is to have a global
lock that protects everything required to modify the flow table.  Generally
this works out well, but rule_execute() is a trouble spot.  That's because
it's called during a flow table modification (when that global lock is
held) which means that a "learn" action triggered by the executing the
packet would try to recursively modify the flow table and reacquire the
global lock.

I can see two ways out of this issue.  One would be to make the global lock
a recursive one, or otherwise deal with handling recursive flow_mods.  The
other is to just queue up flow_mods due to rule_execute(), which itself is
a corner case (it only happens when a flow_mod sent via OpenFlow includes
a buffer_id).  (I guess there could be other more radical solutions, like
just dropping packets that contain "learn" actions if they occur in this
situation.)

This commit implements the second solution because it seems less likely to
be wrong in a way that crashes the switch.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoclassifier: Allow CLS_CURSOR_FOR_EACH to use a const-qualified iterator.
Ben Pfaff [Tue, 10 Sep 2013 05:13:09 +0000 (22:13 -0700)]
classifier: Allow CLS_CURSOR_FOR_EACH to use a const-qualified iterator.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoguarded-list: New data structure for thread-safe queue.
Ben Pfaff [Fri, 13 Sep 2013 00:42:23 +0000 (17:42 -0700)]
guarded-list: New data structure for thread-safe queue.

We already had queues that were suitable for replacement by this data
structure, and I intend to add another one later on.

flow_miss_batch_ofproto_destroyed() did not work well with the guarded-list
structure (it required either adding a lot more functions or breaking the
abstraction) so I changed the caller to just use udpif_revalidate().

Checking reval_seq at the end of handle_miss_upcalls() also didn't work
well with the abstraction, so I decided that since this was a corner case
anyway it would be acceptable to just drop those in flow_miss_batch_next().

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Add a ref_count to "struct rule" to protect it from being freed.
Ben Pfaff [Thu, 12 Sep 2013 06:23:00 +0000 (23:23 -0700)]
ofproto: Add a ref_count to "struct rule" to protect it from being freed.

Taking a read-lock on the 'rwlock' member of struct rule prevents members
of the rule from changing.  This is a short-term use of the 'rwlock': one
takes the lock, reads some members, and releases the lock.

Taking a read-lock on the 'rwlock' also prevents the rule from being freed.
This is often a relatively long-term need.  For example, until now flow
translation has held the rwlock in xlate_table_action() across the entire
recursive translation, which can call into a great deal of different code
across multiple files.

This commit switches to using a reference count for this second purpose
of struct rule's rwlock.  This means that all the code that previously
held a read-lock on the rwlock across deep stacks of functions can now
simply keep a reference.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Break actions out of rule into new rule_actions structure.
Ben Pfaff [Mon, 9 Sep 2013 20:05:52 +0000 (13:05 -0700)]
ofproto: Break actions out of rule into new rule_actions structure.

This permits code to ensure long-term access to a rule's actions
without holding a long-term lock on the rule's rwlock.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Remove soon-to-be-invalid optimizations.
Ben Pfaff [Mon, 9 Sep 2013 18:19:41 +0000 (11:19 -0700)]
ofproto: Remove soon-to-be-invalid optimizations.

Until now, ofproto_add_flow() and ofproto_delete_flow() assumed that the
flow table could not change between its flow table check and its later
modification to the flow table.  This assumption will soon be untrue, so
remove it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Move function find_meter() into ofpacts as ofpacts_get_meter().
Ben Pfaff [Sat, 7 Sep 2013 02:52:14 +0000 (19:52 -0700)]
ofproto: Move function find_meter() into ofpacts as ofpacts_get_meter().

ofproto is too big anyway so we might as well move out code that can
reasonably live elsewhere.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Merge ofproto_rule_delete() and ofproto_delete_rule().
Ben Pfaff [Fri, 30 Aug 2013 22:27:33 +0000 (15:27 -0700)]
ofproto: Merge ofproto_rule_delete() and ofproto_delete_rule().

These functions were identical but had different names (one just called
the other).  Make them a single function.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif: Remove vestigial "clogged" feature.
Ben Pfaff [Sun, 1 Sep 2013 21:46:04 +0000 (14:46 -0700)]
ofproto-dpif: Remove vestigial "clogged" feature.

Before this commit, ofproto-dpif did not ordinarily ever defer
completion of a flow_mod, but it was possible to use "ovs-appctl
ofproto/clog" to force deferring completion, which allowed some basic
debugging of deferred completion.  I only ever used that feature once,
while doing initial debugging of the deferred completion feature.  I
intend in future commits to make changes that will make deferred
completion harder to implement in ofproto-dpif, so this commit removes
that feature in advance.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Avoid gratuitous memory allocation and free.
Ben Pfaff [Sat, 7 Sep 2013 02:23:07 +0000 (19:23 -0700)]
ofproto: Avoid gratuitous memory allocation and free.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Correct comments.
Ben Pfaff [Fri, 30 Aug 2013 22:20:08 +0000 (15:20 -0700)]
ofproto: Correct comments.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Eliminate 'ofproto_node' member from struct rule.
Ben Pfaff [Wed, 11 Sep 2013 23:41:32 +0000 (16:41 -0700)]
ofproto: Eliminate 'ofproto_node' member from struct rule.

The ofproto_node member is convenient for collecting lists of rules, but
it is also challenging for concurrency because only a single thread at a
time can put a given rule on a list.  This commit eliminates the
ofproto_node member and introduces a new 'struct rule_collection' that
can be use in a thread-safe manner.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Reduce number of "collect" functions taking lots of parameters.
Ben Pfaff [Wed, 11 Sep 2013 22:35:44 +0000 (15:35 -0700)]
ofproto: Reduce number of "collect" functions taking lots of parameters.

The long lists of parameters for all these "collect" functions was starting
to get to me.  This reduces the number of such functions to one.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Factor code out of collect_rules_{loose,strict} into new helper.
Ben Pfaff [Fri, 6 Sep 2013 05:37:41 +0000 (22:37 -0700)]
ofproto: Factor code out of collect_rules_{loose,strict} into new helper.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agovswitchd: Clear bfd_status column when bfd is disabled or not supported
Alex Wang [Thu, 12 Sep 2013 19:51:53 +0000 (12:51 -0700)]
vswitchd: Clear bfd_status column when bfd is disabled or not supported

This commit makes vswitchd clear the 'bfd_status' column
in ovsdb when bfd is disabled or not supported.

Reported-by: Ansis Atteka <aatteka@nicira.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-parse: Set usable protocols in parse_ofp_meter_mod_str__().
Jarno Rajahalme [Sun, 8 Sep 2013 01:27:09 +0000 (18:27 -0700)]
ofp-parse: Set usable protocols in parse_ofp_meter_mod_str__().

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Use proper error code when meter_id is out of range.
Jarno Rajahalme [Sun, 8 Sep 2013 01:27:08 +0000 (18:27 -0700)]
ofproto: Use proper error code when meter_id is out of range.

Use OUT_OF_METERS when given meter_id is greater than what is supported
by the datapath.  Retain the INVALID_METER error code for the meter_ids
outside of the range supported by the specification.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoDelete meters in the right place.
Jarno Rajahalme [Sun, 8 Sep 2013 01:27:07 +0000 (18:27 -0700)]
Delete meters in the right place.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobridge: Always call smap_destroy() after smap_init()
Alex Wang [Thu, 12 Sep 2013 18:54:16 +0000 (11:54 -0700)]
bridge: Always call smap_destroy() after smap_init()

This commit fixes a place in bridge.c where smap_destroy() is not
always called after smap_init().  Though there is no memory leak
now, it is necessary to fix it and prevent memory leak in the
future when smap_init() may be modified to allocate dynamic memory.

Reported-by: Ansis Atteka <aatteka@nicira.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-linux: Use correct enum in dpif_linux_flow_dump_start().
Ben Pfaff [Thu, 12 Sep 2013 17:54:23 +0000 (10:54 -0700)]
dpif-linux: Use correct enum in dpif_linux_flow_dump_start().

Both the old (wrong) and new (correct) enums have the same value, so this
doesn't fix a visible bug.

Reported-by: ankur dwivedi <ankurengg2003@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: update flow_stats flags on flow_stats_request
Daniel Baluta [Wed, 11 Sep 2013 21:56:53 +0000 (00:56 +0300)]
ofproto: update flow_stats flags on flow_stats_request

This is a first step in implementing 'on demand flow counters'.

We save relevant flow_mod flags (OFPUTIL_FF_SEND_FLOW_REM,
OFPUTIL_FF_NO_PKT_COUNTS, OFPUTIL_FF_NO_BYT_COUNTS) into newly created rule
when a new flow is added, and echo them back in the flow stats request.

Notice that we remove send_flow_removed flag from struct rule/struct ofoperation
and we replace it with an enum tracking all ofputil_flow_mod_flags.

Signed-off-by: Daniel Baluta <dbaluta@ixiacom.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoFAQ: Explain how to output to the ingress port in OpenFlow.
Ben Pfaff [Wed, 11 Sep 2013 17:02:58 +0000 (10:02 -0700)]
FAQ: Explain how to output to the ingress port in OpenFlow.

Reported-by: Aws Auger <ovshelpme@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoopenflow-1.1+: move OFPTC11_TABLE_MISS_MASK out of enum
Andy Zhou [Tue, 10 Sep 2013 20:33:08 +0000 (13:33 -0700)]
openflow-1.1+: move OFPTC11_TABLE_MISS_MASK out of enum

OFPTC11_TABLE_MISS_MASK is not a valid configuration, but to indicate
there are only 2 bits being used for table miss configuration. Move
it out of the enum definition.

Reported-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Reduce default number of miss handlers.
Ethan Jackson [Tue, 10 Sep 2013 22:36:21 +0000 (15:36 -0700)]
ofproto: Reduce default number of miss handlers.

The default number of miss handlers should be the number of processors
minus two to account for the dispatcher and main threads.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Don't hold mac rwlock while calling send_packet().
Ethan Jackson [Fri, 6 Sep 2013 19:51:02 +0000 (12:51 -0700)]
ofproto-dpif: Don't hold mac rwlock while calling send_packet().

Holding the mac learning rwlock while calling send_packet() which
calls xlate_actions() is dangerous because somewhere deep in the chain
the same lock might be acquired causing a deadlock.  Though we haven't
run into this problem in testing, it seems prudent to refactor it.

Reported-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Fix core dump due to uninitialized cls_rule.
Ethan Jackson [Tue, 10 Sep 2013 20:29:30 +0000 (13:29 -0700)]
ofproto: Fix core dump due to uninitialized cls_rule.

Bug #19568.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Support out_group feature when matching on cookie.
Ben Pfaff [Fri, 6 Sep 2013 05:19:25 +0000 (22:19 -0700)]
ofproto: Support out_group feature when matching on cookie.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Do not call ->rule_destruct() if ->rule_construct() failed.
Ben Pfaff [Fri, 30 Aug 2013 20:59:37 +0000 (13:59 -0700)]
ofproto: Do not call ->rule_destruct() if ->rule_construct() failed.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agodatapath: Remove compat workqueue.
Pravin B Shelar [Mon, 9 Sep 2013 20:53:40 +0000 (13:53 -0700)]
datapath: Remove compat workqueue.

OVS has its own workq implementation for coupe of reasons. first
was to avoid system freeze due to ovs-flow rehash softlockup.
We have moved out rehash from workq, So this problem does not exist.
second was related bugs in kernel workq implementation in pre-2.6.32
kernel. But we have dropped support for older kernel.
So there is no reason to keep ovs-workq around. Following patch
removes it.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agolisp: Reset vlan tag on send.
Pravin B Shelar [Mon, 9 Sep 2013 16:21:02 +0000 (09:21 -0700)]
lisp: Reset vlan tag on send.

Lisp needs to discards all l2 packet headers but if vlan tx
is hw-acceleraed vlan tag is stored in skb struct. Following
patch resets it.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: flow: fix potential illegal memory access in __parse_flow_nlattrs
Daniel Borkmann [Mon, 9 Sep 2013 20:27:27 +0000 (13:27 -0700)]
datapath: flow: fix potential illegal memory access in __parse_flow_nlattrs

In function __parse_flow_nlattrs(), we check for condition
(type > OVS_KEY_ATTR_MAX) and if true, print an error, but we do
not return from this function as in other checks. It seems this
has been forgotten, as otherwise, we could access beyond the
memory of ovs_key_lens, which is of ovs_key_lens[OVS_KEY_ATTR_MAX + 1].
Hence, a maliciously prepared nla_type from user space could access
beyond this upper limit.

Introduced by 03f0d916a ("openvswitch: Mega flow implementation").

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Cc: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoutil: Don't set thread name to empty
Guolin Yang [Mon, 9 Sep 2013 16:38:01 +0000 (09:38 -0700)]
util: Don't set thread name to empty

In monitor_daemon(), it set subprogram_name to "" which causes system crash
in some platform when trying to set the thread name to "".  This change set
thread name to program name in this case.

Signed-off-by: Guolin Yang <gyang@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolib/timeval: don't forget to initialize a rwlock
YAMAMOTO Takashi [Mon, 9 Sep 2013 06:56:23 +0000 (15:56 +0900)]
lib/timeval: don't forget to initialize a rwlock

Commit 31ef9f5178 (timeval: Remove CACHE_TIME scheme.) removed
initialization of a rwlock which is still used for some operations.
This restores it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Move flow table rehashing to flow install.
Pravin B Shelar [Fri, 6 Sep 2013 21:54:31 +0000 (14:54 -0700)]
datapath: Move flow table rehashing to flow install.

Rehashing in ovs-workqueue can cause ovs-mutex lock contentions
in case of heavy flow setups where both needs ovs-mutex.  So by
moving rehashing to flow-setup we can eliminate contention.
This also simplify ovs locking and reduces dependence on
workqueue.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: vxlan: remove net arg from vxlan[6]_xmit_skb()
Pravin B Shelar [Fri, 6 Sep 2013 18:39:15 +0000 (11:39 -0700)]
datapath: vxlan: remove net arg from vxlan[6]_xmit_skb()

Backport of upstream commit 117961878cc1 (vxlan: remove net
arg from vxlan[6]_xmit_skb()).

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: iptunnels: remove net arg from iptunnel_xmit().
Pravin B Shelar [Fri, 6 Sep 2013 18:39:09 +0000 (11:39 -0700)]
datapath: iptunnels: remove net arg from iptunnel_xmit().

Backport of upstream commit 8b7ed2d91d6af (iptunnels: remove
net arg from iptunnel_xmit()).

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath lisp: Use ovs offload compat functionality.
Pravin B Shelar [Fri, 6 Sep 2013 18:16:23 +0000 (11:16 -0700)]
datapath lisp: Use ovs offload compat functionality.

OVS already has compat functions to handle GSO packets.
Following patch get rid of GSO packet handling in lisp
and use ovs iptunnel_xmit() function for same.

CC: Lori Jakab <lojakab@cisco.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath lisp: use iptunnel_pull_header().
Pravin B Shelar [Fri, 6 Sep 2013 18:16:15 +0000 (11:16 -0700)]
datapath lisp: use iptunnel_pull_header().

CC: Lori Jakab <lojakab@cisco.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Lorand Jakab <lojakab@cisco.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agoAUTHORS: Update Jarno Rajahalme's email address.
Ben Pfaff [Sun, 8 Sep 2013 17:57:03 +0000 (10:57 -0700)]
AUTHORS: Update Jarno Rajahalme's email address.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoopenflow-1.1+: OFPT_TABLE_MOD (part 1)
Andy Zhou [Sat, 7 Sep 2013 10:02:32 +0000 (03:02 -0700)]
openflow-1.1+: OFPT_TABLE_MOD (part 1)

Added infrastructure to support Openflow OFPT_TABLE_MOD message. This patch
does not include the flexible table miss handling code that is necessary to
support the semantics specified in OFPT_TABLE_MOD messages.

Current flow miss behavior continues to conform to Openflow 1.0.  Future
commits to add more flexible table miss support are needed to fully support
OPFT_TABLE_MOD for Openflow-1.1+.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests/ofproto: add basic test for OFPT_GET_ASYNC_REQUEST/REPLY
Alexandru Copot [Sat, 7 Sep 2013 12:36:23 +0000 (15:36 +0300)]
tests/ofproto: add basic test for OFPT_GET_ASYNC_REQUEST/REPLY

This only checks the default settings.

Signed-off-by: Alexandru Copot <alex.mihai.c@gmail.com>
Cc: Daniel Baluta <dbaluta@ixiacom.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-print: display OFPT_GET_ASYNC_REPLY in same way as OFPT_SET_ASYNC
Alexandru Copot [Sat, 7 Sep 2013 12:36:22 +0000 (15:36 +0300)]
ofp-print: display OFPT_GET_ASYNC_REPLY in same way as OFPT_SET_ASYNC

Signed-off-by: Alexandru Copot <alex.mihai.c@gmail.com>
Cc: Daniel Baluta <dbaluta@ixiacom.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: implement OFPT_GET_ASYNC_REQUEST
Alexandru Copot [Sat, 7 Sep 2013 12:36:21 +0000 (15:36 +0300)]
ofproto: implement OFPT_GET_ASYNC_REQUEST

Signed-off-by: Alexandru Copot <alex.mihai.c@gmail.com>
Cc: Daniel Baluta <dbaluta@ixiacom.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Do not allow adding loopback devices
Alexandru Copot [Sat, 7 Sep 2013 09:35:15 +0000 (12:35 +0300)]
dpif-netdev: Do not allow adding loopback devices

Signed-off-by: Alexandru Copot <alex.mihai.c@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev: update IFF_LOOPBACK flag for linux and bsd devices
Alexandru Copot [Sat, 7 Sep 2013 09:35:14 +0000 (12:35 +0300)]
netdev: update IFF_LOOPBACK flag for linux and bsd devices

Signed-off-by: Alexandru Copot <alex.mihai.c@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoopenflow-1.3.h: Fix typo
Daniel Baluta [Thu, 5 Sep 2013 21:23:40 +0000 (00:23 +0300)]
openflow-1.3.h: Fix typo

Fix typo in enum ofp13_flow_mod_flags comment caused probably
by a copy/paste error.

Signed-off-by: Daniel Baluta <dbaluta@ixiacom.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Remove compat files.
Pravin B Shelar [Mon, 26 Aug 2013 18:19:10 +0000 (11:19 -0700)]
datapath: Remove compat files.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Remove reciprocal_div compat code.
Pravin B Shelar [Fri, 30 Aug 2013 17:42:53 +0000 (10:42 -0700)]
datapath: Remove reciprocal_div compat code.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Remove compat support for NLA_NUL_STRING
Pravin B Shelar [Wed, 28 Aug 2013 18:24:00 +0000 (11:24 -0700)]
datapath: Remove compat support for NLA_NUL_STRING

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Cleanup compat support.
Pravin B Shelar [Tue, 27 Aug 2013 06:43:29 +0000 (23:43 -0700)]
datapath: Cleanup compat support.

cleanup various header file.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Cleanup netlink compat code.
Pravin B Shelar [Tue, 27 Aug 2013 06:53:17 +0000 (23:53 -0700)]
datapath: Cleanup netlink compat code.

Patch removes genl, netlink, rtnl compat code and dpif-linux
fallback-id compat code.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Remove vlan compat support
Pravin B Shelar [Wed, 4 Sep 2013 18:35:13 +0000 (11:35 -0700)]
datapath: Remove vlan compat support

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Remove checksum compat support
Pravin B Shelar [Mon, 26 Aug 2013 18:18:07 +0000 (11:18 -0700)]
datapath: Remove checksum compat support

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Remove skb->mark compat code.
Pravin B Shelar [Mon, 26 Aug 2013 20:27:02 +0000 (13:27 -0700)]
datapath: Remove skb->mark compat code.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Remove namespace compat support.
Pravin B Shelar [Mon, 26 Aug 2013 18:30:41 +0000 (11:30 -0700)]
datapath: Remove namespace compat support.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: vport: Remove compat support
Pravin B Shelar [Tue, 27 Aug 2013 20:24:50 +0000 (13:24 -0700)]
datapath: vport: Remove compat support

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Drop support for RHEL5 build
Pravin B Shelar [Tue, 3 Sep 2013 17:55:18 +0000 (10:55 -0700)]
datapath: Drop support for RHEL5 build

RHEL5 is based on kernel 2.6.18.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Move kernel version check to configure.
Pravin B Shelar [Tue, 3 Sep 2013 18:02:40 +0000 (11:02 -0700)]
datapath: Move kernel version check to configure.

Rather than having compile time check in datapath.c, its better
to check kernel version at configuration step.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Drop support for linux pre-2.6.32 kernel.
Pravin B Shelar [Tue, 3 Sep 2013 16:54:51 +0000 (09:54 -0700)]
datapath: Drop support for linux pre-2.6.32 kernel.

This makes datapath module much close to upstream datapath and
make code easy to understand.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Fix alignment of struct sw_flow_key.
Jesse Gross [Thu, 5 Sep 2013 20:01:58 +0000 (13:01 -0700)]
datapath: Fix alignment of struct sw_flow_key.

sw_flow_key alignment was declared as " __aligned(__alignof__(long))".
However, this breaks on the m68k architecture where long is 32 bit in
size but 16 bit aligned by default. This aligns to the size of a long to
ensure that we can always do comparsions in full long-sized chunks. It
also adds an additional build check to catch any reduction in alignment.

CC: Andy Zhou <azhou@nicira.com>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoovs-ofctl: Handle any number of buckets in group statistics
Simon Horman [Thu, 5 Sep 2013 05:19:13 +0000 (14:19 +0900)]
ovs-ofctl: Handle any number of buckets in group statistics

struct ofputil_group_stats has an arbitrary limit
of 16 buckets for which it can record statistics.
However the code does not appear to enforce this
limit and it seems to me that the code could overflow.

This patch aims to remove the arbitrary limit by
changing the 'bucket_stats' field of struct ofputil_group_stats
from a fixed length array to a pointer whose storage is allocated and freed
as necessary.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoUse enum ofp11_group_type in struct ofgroup
Simon Horman [Thu, 5 Sep 2013 05:19:12 +0000 (14:19 +0900)]
Use enum ofp11_group_type in struct ofgroup

Use enum ofp11_group_type for the 'type' field of struct ofgroup
as the enum exactly covers all the valid values of the field.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoOPENFLOW-1.1+: Remove OFPT_FLOW_MOD task from OpenFlow 1.2 todo list.
Gurucharan Shetty [Thu, 5 Sep 2013 15:59:42 +0000 (08:59 -0700)]
OPENFLOW-1.1+: Remove OFPT_FLOW_MOD task from OpenFlow 1.2 todo list.

We already have the ability to delete flows in all tables.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Correct indentation of rule_dpif_{release, credit_stats}
Simon Horman [Thu, 5 Sep 2013 06:32:32 +0000 (15:32 +0900)]
ofproto-dpif: Correct indentation of rule_dpif_{release, credit_stats}

Correct indentation of rule_dpif_{release,credit_stats} prototypes.

This corrects a cosmetic problem introduced by
70742c7f54e7f147 ("ofproto-dpif: Hide struct rule_dpif internally.").

Cc: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>