sliver-openvswitch.git
10 years agometa-flow: Fix comment describing mf_set_flow_value().
Justin Pettit [Sat, 1 Jun 2013 18:44:01 +0000 (11:44 -0700)]
meta-flow: Fix comment describing mf_set_flow_value().

An obvious copy/paste error.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
10 years agoodp-execute: Style fixes
Joe Stringer [Tue, 11 Jun 2013 02:05:55 +0000 (11:05 +0900)]
odp-execute: Style fixes

Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoprocess: Add thread safety comments.
Ben Pfaff [Wed, 8 May 2013 22:02:45 +0000 (15:02 -0700)]
process: Add thread safety comments.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoprocess: Make signal handling thread-safe.
Ben Pfaff [Thu, 6 Jun 2013 23:26:34 +0000 (16:26 -0700)]
process: Make signal handling thread-safe.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoprocess: Remove unused features from process_start().
Ben Pfaff [Wed, 8 May 2013 21:31:55 +0000 (14:31 -0700)]
process: Remove unused features from process_start().

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoprocess: Remove process_run(), process_run_capture(), and related code.
Ben Pfaff [Wed, 8 May 2013 21:46:30 +0000 (14:46 -0700)]
process: Remove process_run(), process_run_capture(), and related code.

They are unused.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ansis Atteka <aatteka@nicira.com>
10 years agoofproto-dpif: Fix incorrect printf format specifiers.
Ben Pfaff [Mon, 10 Jun 2013 18:26:03 +0000 (11:26 -0700)]
ofproto-dpif: Fix incorrect printf format specifiers.

    cc1: warnings being treated as errors
    ../ofproto/ofproto-dpif.c: In function ‘dpif_show_backer’:
    ../ofproto/ofproto-dpif.c:8305: error: format ‘%llu’ expects type ‘long
    long unsigned int’, but argument 4 has type ‘size_t’
    ../ofproto/ofproto-dpif.c:8305: error: format ‘%llu’ expects type ‘long
    long unsigned int’, but argument 5 has type ‘size_t’

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
10 years agonetdev-vport: Make netdev_vport_get_dpif_port() code less confusing.
Ben Pfaff [Mon, 15 Apr 2013 22:55:56 +0000 (15:55 -0700)]
netdev-vport: Make netdev_vport_get_dpif_port() code less confusing.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-util: Don't return static data in ofputil_packet_in_reason_to_string().
Ben Pfaff [Tue, 16 Apr 2013 22:13:21 +0000 (15:13 -0700)]
ofp-util: Don't return static data in ofputil_packet_in_reason_to_string().

Returning a static data buffer makes code more brittle and definitely
not thread-safe, so this commit switches to using a caller-provided
buffer instead.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoodp-util: Avoid returning static data in ovs_key_attr_to_string().
Ben Pfaff [Mon, 15 Apr 2013 22:40:21 +0000 (15:40 -0700)]
odp-util: Avoid returning static data in ovs_key_attr_to_string().

Returning a static data buffer makes code more brittle and definitely
not thread-safe, so this commit switches to using a caller-provided
buffer instead.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ansis Atteka <aatteka@nicira.com>
10 years agoofp-actions: Add comments to struct ofpact_learn_spec.
Ben Pfaff [Mon, 10 Jun 2013 17:38:39 +0000 (10:38 -0700)]
ofp-actions: Add comments to struct ofpact_learn_spec.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ansis Atteka <aatteka@nicira.com>
10 years agoovsdb-idlc: Write a new-line at the end of "annotate" output.
Ben Pfaff [Mon, 10 Jun 2013 17:25:29 +0000 (10:25 -0700)]
ovsdb-idlc: Write a new-line at the end of "annotate" output.

Some tools do not like text files that lack a trailing new-line.  In
particular, Debian's dpkg-source utility complains about a missing new-line
in the file generated by ovsdb-idlc:

    dpkg-source: warning: file
    openvswitch-1.9.2+git20130605/lib/vswitch-idl.ovsidl has no final
    newline (either original or modified version)

This commit fixes the problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif-governor: Dispense with governor name.
Ethan Jackson [Fri, 7 Jun 2013 20:51:31 +0000 (13:51 -0700)]
ofproto-dpif-governor: Dispense with governor name.

In almost all cases, ovs-vswitchd runs with a single datapath, and
therefore a single governor.  Therefore, it's usually clear from
context what governor log messages are referring to making the name
redundant.  This patch removes it.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif: Maintain subfacets in dpif_backer.
Ethan Jackson [Wed, 1 May 2013 01:32:02 +0000 (18:32 -0700)]
ofproto-dpif: Maintain subfacets in dpif_backer.

Conceptually, a subfacet represents a datapath flow key, and
therefore belongs more to a datapath more than it does to a bridge.
This patch moves the subfacet hmap from 'struct ofproto_dpif' to
'struct dpif_backer', simplifying the code in the process.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif: Set flow-eviction-threshold globally.
Ethan Jackson [Tue, 4 Jun 2013 20:22:46 +0000 (13:22 -0700)]
ofproto-dpif: Set flow-eviction-threshold globally.

With the single datapath, it no longer makes sense to have a per
ofproto flow eviction threshold.  This patch moves the flow
eviction threshold to the Open_vSwitch table making the setting
global, though still treated separately for each ofproto.  A future
patch will unify flow eviction on a per datapath basis.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Track subfacet stats in the backer.
Ethan Jackson [Tue, 4 Jun 2013 22:48:31 +0000 (15:48 -0700)]
ofproto: Track subfacet stats in the backer.

Subfacets being per-datapath entities, their statistics are really
only interesting at per-datapath granularity.  This patch moves
them to the dpif_backer and makes some related simplifications.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif: More responsive average subfacet statistics.
Ethan Jackson [Thu, 30 May 2013 20:22:26 +0000 (13:22 -0700)]
ofproto-dpif: More responsive average subfacet statistics.

Before this patch, statistics about subfacet average life span,
and count in the datapath, were calculated over the entire lifetime
of the ofproto.  Furthermore, the subfacet lifespan was only
updated when a subfacet was removed from the datapath causing long
lived subfacets to be ignored.  It's far more useful to know these
numbers averaged over all subfacets in the recent past.  This patch
changes the code to implement an exponentially weighted moving
average updated every time statistics are pulled from the datapath.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agotimeval: Remove time_disable_restart(), time_enable_restart() functions.
Ben Pfaff [Fri, 12 Apr 2013 16:42:44 +0000 (09:42 -0700)]
timeval: Remove time_disable_restart(), time_enable_restart() functions.

These functions will not have the same useful effect when Open vSwitch
becomes multithreaded, because time_disable_restart() will disable time
advancing for every thread, not just for the thread that calls it.

These functions are no longer used, so this commit removes them.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-vport: Don't return static data in netdev_vport_get_dpif_port().
Ben Pfaff [Wed, 1 May 2013 18:05:28 +0000 (11:05 -0700)]
netdev-vport: Don't return static data in netdev_vport_get_dpif_port().

Returning a static data buffer makes code more brittle and definitely
not thread-safe, so this commit switches to using a caller-provided
buffer instead.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Don't run port names through netdev_vport_get_dpif_port().
Ben Pfaff [Thu, 6 Jun 2013 22:27:15 +0000 (15:27 -0700)]
dpif-netdev: Don't run port names through netdev_vport_get_dpif_port().

The ports that exist within a dpif have already been translated through
netdev_vport_get_dpif_port(), so there is no value to translating them
again in the interfaces that query or dump ports (and possibly a drawback
if somehow the translation could change).

After this change, dpif-netdev translates port names in just one place,
the port_add path, which makes dpif-netdev act the same way as dpif-linux
in this respect.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif: Actually log errors in facet_check_consistency()
Simon Horman [Wed, 5 Jun 2013 13:28:47 +0000 (13:28 +0000)]
ofproto-dpif: Actually log errors in facet_check_consistency()

facet_check_consistency() goes to some effort to create informative
error messages, protected by a rate limit, but does not actually
log these messages.

This appears to be an unintended side effect of
4dff90977694784e67e9c08cc72dee28ebc343ae ("ofproto-dpif: Move
odp_actions from subfacet to facet.").  This patch restores the
logging behaviour present prior to the above commit.

This patch also reverses a changes made by the same commit to use
ds_put_cstr() instead of ds_put_char() in facet_check_consistency().

Cc: Justin Pettit <jpettit@nicira.com>
Cc: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoroute-table: Make 'rtnl_sock' and 'attrs' local variables non-static.
Ben Pfaff [Tue, 23 Apr 2013 23:03:36 +0000 (16:03 -0700)]
route-table: Make 'rtnl_sock' and 'attrs' local variables non-static.

I don't see any reason for these to be static.

CC: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agonetdev-vport: Make 'iface' non-static in tunnel_get_status().
Ben Pfaff [Mon, 15 Apr 2013 22:33:43 +0000 (15:33 -0700)]
netdev-vport: Make 'iface' non-static in tunnel_get_status().

I don't see any reason for this to be static.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agotimeval: Do not block SIGALRM around setting 'deadline' in time_alarm().
Ben Pfaff [Thu, 9 May 2013 18:26:24 +0000 (11:26 -0700)]
timeval: Do not block SIGALRM around setting 'deadline' in time_alarm().

There is no need to do so because the signal handler does not read or
write 'deadline'.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agolockfile: Remove calls to time_disable_restart()/time_enable_restart().
Ben Pfaff [Fri, 12 Apr 2013 16:39:50 +0000 (09:39 -0700)]
lockfile: Remove calls to time_disable_restart()/time_enable_restart().

These calls are not necessary because F_SETLK does not block.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agosignals: Make thread-safe.
Ben Pfaff [Wed, 8 May 2013 22:30:05 +0000 (15:30 -0700)]
signals: Make thread-safe.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoAlways update ethertype on mpls_pop
Simon Horman [Wed, 5 Jun 2013 05:28:52 +0000 (14:28 +0900)]
Always update ethertype on mpls_pop

The ethertype should always be updated on mpls_pop
as there may be a transition between MPLS unicast (0x8847) and
MPLS multicast (0x8848).

Ben Pfaff tells me that this is consistent with the
behaviour described in EXT-194 of the JIRA bug tracker.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Use execute_actions to execute controller actions
Simon Horman [Wed, 5 Jun 2013 05:28:50 +0000 (14:28 +0900)]
ofproto-dpif: Use execute_actions to execute controller actions

Now that execute_actions() is available it can be used as a generic
replacement for special-case action execution in
execute_controller_action().

As suggested by Jesse Gross.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoodp-execute: Add set skb_mark, set_priority, tunnel support.
Simon Horman [Wed, 5 Jun 2013 05:28:49 +0000 (14:28 +0900)]
odp-execute: Add set skb_mark, set_priority, tunnel support.

The motivation for this is to allow such actions to be honoured
if they are encountered; by the user-space datapath before recirculation;
or by internal processing of actions by ovs-vswitchd before recirculation.
Recirculation will be added by a subsequent patch.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoodp-util: Export odp_tun_key_from_attr()
Simon Horman [Wed, 5 Jun 2013 05:28:48 +0000 (14:28 +0900)]
odp-util: Export odp_tun_key_from_attr()

Rename tun_key_from_attr() as odp_tun_key_from_attr() and export it.
This is in preparation for calling this function outside of odp-util.c.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-actions: enforce valid range for table_id in goto_table instruction
Jing Ai [Wed, 5 Jun 2013 20:18:09 +0000 (13:18 -0700)]
ofp-actions: enforce valid range for table_id in goto_table instruction

Found a bug that OVS allows goto_table_id to be smaller than (or equal to)
the current table id where the flow resides. It potentially creates an
infinite loop when composing actions for a packet. To fix it, we just let
OVS returns an error message to prevent such flow to be programmed.

Signed-off-by: Jing Ai <jinga@google.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolib: Restore build on FreeBSD
Ed Maste [Wed, 5 Jun 2013 20:22:20 +0000 (16:22 -0400)]
lib: Restore build on FreeBSD

It appears that the size_t definition was supplied through header leakage
on other platforms after commit eee8089cbeffa39eef3858be57628be663b229b7
(signals: Make signal_name() thread-safe.).

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agosignals: Make signal_name() thread-safe.
Ben Pfaff [Tue, 16 Apr 2013 22:25:10 +0000 (15:25 -0700)]
signals: Make signal_name() thread-safe.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agosignals: Use sys_siglist[] instead of strsignal() for thread-safety.
Ben Pfaff [Fri, 5 Apr 2013 04:29:59 +0000 (23:29 -0500)]
signals: Use sys_siglist[] instead of strsignal() for thread-safety.

strsignal() isn't thread-safe but sys_siglist[] is.  Also, according to
the glibc manual, BSD has sys_siglist[] but not strsignal().

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Do not give stats to rules bypassed by "drop" frag policy.
Ben Pfaff [Wed, 5 Jun 2013 17:11:55 +0000 (10:11 -0700)]
ofproto-dpif: Do not give stats to rules bypassed by "drop" frag policy.

When the OFPC_FRAG_DROP policy is in effect, IP fragments are supposed to
be dropped before they reach the flow table.  Open vSwitch properly dropped
IP fragments in this case, but still accounted them to the packet and byte
counters for the flow that they would have hit if the OFPC_FRAG_NX_MATCh
policy had been in effect.

Reported-by: love you <thunder.love07@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agopackets: Fix typo in reserved multicast Ethernet addresses.
Ben Pfaff [Tue, 28 May 2013 23:05:34 +0000 (16:05 -0700)]
packets: Fix typo in reserved multicast Ethernet addresses.

The reserved multicast Ethernet addresses begin with 01:80:c2, not
01:08:c2.

Reported-by: Padmanabhan Krishnan <kprad1@yahoo.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoFix misspellings in comments and docs.
Andy Hill [Tue, 4 Jun 2013 22:35:36 +0000 (17:35 -0500)]
Fix misspellings in comments and docs.

Flagged with: https://github.com/lyda/misspell-check
Run with: git ls-files | misspellings -f -

Signed-off-by: Andy Hill <hillad@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto/pktbuf.c: Fix a typo in the comment
Alex Wang [Wed, 29 May 2013 20:57:22 +0000 (13:57 -0700)]
ofproto/pktbuf.c: Fix a typo in the comment

This patch fixes a typo in the comment of the pktbuf_retrieve() function.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotestsuite: make a sed command more portable
YAMAMOTO Takashi [Tue, 4 Jun 2013 00:17:34 +0000 (09:17 +0900)]
testsuite: make a sed command more portable

avoid using some GNU sed extensions, which are not available
eg. on NetBSD's /usr/bin/sed.

while there are other places these extenstions are used in the testsuite,
this instance is new and seems the only one currently being executed
for NetBSD.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobridge.c: Change variable "ofport" type in "struct if_cfg" and "struct iface"
Alex Wang [Tue, 4 Jun 2013 19:46:38 +0000 (12:46 -0700)]
bridge.c: Change variable "ofport" type in "struct if_cfg" and "struct iface"

This patch changes the variable type of "ofport" in "struct if_cfg" and
"struct iface" from int64_t to uint16_t. This is more consistent with
the OpenFlow-1.0 port definition.

Also, before this patch, -1 is used to indicate an unknown port. This
patch uses OFPP_NONE, since "ofport" becomes uint16_t.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoAlways use valid ids pointer in dec_ttl_cnt_ids_from_openflow()
Simon Horman [Mon, 3 Jun 2013 05:46:30 +0000 (14:46 +0900)]
Always use valid ids pointer in dec_ttl_cnt_ids_from_openflow()

Always update the ids pointer after calling ofpbuf_put()
to ensure that it is valid when accessed.

During testing a case came up where the call to ofpbuf_put() in the
for (i = 0; i < ids->n_controllers; i++) loop would cause the underlying
buffer to be reallocated. This resulted in ids->n_controllers being an
incorrect value, the loop continuing on longer than desired and finally a
segmentation fault.

Reported-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agocfm: Update netdev when changed.
Ethan Jackson [Mon, 3 Jun 2013 20:49:13 +0000 (13:49 -0700)]
cfm: Update netdev when changed.

If ofproto decided to change the netdev of a particular ofport,
cfm_demand mode would improperly continue using the old netdev to
collect stats.

Bug #17583.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agodatapath: fix variable names in comment
Lorand Jakab [Mon, 3 Jun 2013 15:43:37 +0000 (08:43 -0700)]
datapath: fix variable names in comment

Signed-off-by: Lorand Jakab <lojakab@cisco.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoofproto-dpif.c: Modify vsp_realdev_to_vlandev() function
Alex Wang [Fri, 31 May 2013 01:24:44 +0000 (18:24 -0700)]
ofproto-dpif.c: Modify vsp_realdev_to_vlandev() function

Commit 52a90c29 (Implement new "VLAN splinters" feature) passed in OpenFlow
port number to vsp_realdev_to_vlandev() function which asks for datapath port
number.

This patch fixes this bug by making the vsp_realdev_to_vlandev() function
take in and return OpenFlow port number.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoINSTALL: Add documentaion for hot upgrades.
Gurucharan Shetty [Thu, 30 May 2013 09:07:15 +0000 (09:07 +0000)]
INSTALL: Add documentaion for hot upgrades.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agoovs-ctl.in: Restore flows with vswitchd packet processing disabled.
Gurucharan Shetty [Tue, 28 May 2013 13:21:56 +0000 (13:21 +0000)]
ovs-ctl.in: Restore flows with vswitchd packet processing disabled.

It has been observed that when we upgrade openvswitch with
thousands of openflow flows already established and there is heavy
traffic going through the switch, restoring flows can take a very
long time (8 minutes in one use case) with CPU running at 100%.
This can make the upgrade very expensive.

This commit starts vswitchd by asking it to wait till flow restore is
finished. Once the flows are restored, it resumes normal operations.

Bug #16086.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agoovs-ctl.in: Add manager after restoring flows.
Gurucharan Shetty [Tue, 28 May 2013 12:53:17 +0000 (12:53 +0000)]
ovs-ctl.in: Add manager after restoring flows.

Currently we are adding the manager after starting ovs-vswitchd.
Instead, add the manager after flow restore is completed.

Bug #16086.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agoovs-vswitchd: An option to wait for userspace flow restore to complete.
Gurucharan Shetty [Tue, 28 May 2013 12:52:36 +0000 (12:52 +0000)]
ovs-vswitchd: An option to wait for userspace flow restore to complete.

While upgrading openvswitch, it helps to restore openflow flows before
starting packet processing.  Typically we want to restart openvswitch,
add the openflow flows and then start packet processing.

To do this, we look for the other_config:flow-restore-wait column
in the Open_vSwitch table during startup. If set as true, we disable
receiving packets from the datapath, expiring or flushing flows and
running any periodic ofproto activities. This option does not prevent
the addition and deletion of ports. Once this option is set to false,
we return to normal processing.

An upcoming commit will use this feature in Open vSwitch startup scripts.

Bug #16086.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agoofproto-dpif: Simplify ofproto hit count tracking.
Ethan Jackson [Thu, 30 May 2013 20:32:26 +0000 (13:32 -0700)]
ofproto-dpif: Simplify ofproto hit count tracking.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif: Fix a typo
Alex Wang [Thu, 30 May 2013 21:37:57 +0000 (14:37 -0700)]
ofproto-dpif: Fix a typo

This patch fixes a typo in handle_miss_upcalls() function.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Remove useless odp_in_port from subfacet.
Ethan Jackson [Wed, 29 May 2013 23:05:06 +0000 (16:05 -0700)]
ofproto-dpif: Remove useless odp_in_port from subfacet.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoImplement duration fields in OpenFlow 1.3 port stats.
Ben Pfaff [Thu, 30 May 2013 19:49:59 +0000 (12:49 -0700)]
Implement duration fields in OpenFlow 1.3 port stats.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Consolidate facet stat logic.
Ethan Jackson [Wed, 29 May 2013 19:38:48 +0000 (12:38 -0700)]
ofproto-dpif: Consolidate facet stat logic.

The logic for updating statistics at the facet level had been
spread through ofproto-dpif in a rather confusing manner.  This
patch consolidates as much of this logic as is reasonable into
facet_push_stats().

On a side note, I'd expect this patch to have a marginal positive
performance impact when using learning (though I haven't bothered
to measure it).  It combines facet_learn() and facet_push_stats()
into one step allowing us to avoid a redundant xlate_actions().

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif: Fix facet_lookup_valid().
Ethan Jackson [Wed, 29 May 2013 23:19:20 +0000 (16:19 -0700)]
ofproto-dpif: Fix facet_lookup_valid().

facet_lookup_valid() attempted to re-revalidate its facet after
it had been removed.  Added very recently in commit 5bf64ad
(ofproto-dpif: Avoid redundant facet_find() in
facet_lookup_valid()).

Found by inspection (by Justin).

Reported-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif: Don't count misses in OpenFlow table stats.
Jesse Gross [Sat, 25 May 2013 00:01:34 +0000 (17:01 -0700)]
ofproto-dpif: Don't count misses in OpenFlow table stats.

Originally no rule existed for packets that did not match an
OpenFlow flow and therefore every packet with a rule could be
counted as a hit. However, newer versions of OVS have hidden
miss rules so this is no longer true. To return the correct
table stats, this subtracts packets that hit the miss rule
from the total and removes the separate counter.

Reported-by: love you <thunder.love07@gmail.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodebian: Don't fail ovs-controller restart if daemon not running.
Gurucharan Shetty [Wed, 29 May 2013 00:18:12 +0000 (17:18 -0700)]
debian: Don't fail ovs-controller restart if daemon not running.

Reported-by: Maxime Brun <m.brun@alphalink.fr>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agoofproto-dpif: Revamp xlate_actions() interface.
Ethan Jackson [Mon, 13 May 2013 18:18:21 +0000 (11:18 -0700)]
ofproto-dpif: Revamp xlate_actions() interface.

This patch implements a new interface to xlate_actions which, aside
from being simpler and more intuitive, achieves several goals.  It
pulls all of xlate_actions() results into a single structure which
will be easier to cache and pass around in future.  And it shields
xlate_ctx from the rest of the code, making it possible to factor
xlate_actions() in the future (hopefully).

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif: Rename action_xlate_ctx.
Ethan Jackson [Mon, 13 May 2013 22:31:31 +0000 (15:31 -0700)]
ofproto-dpif: Rename action_xlate_ctx.

This patch changes the name of action_xlate_ctx to xlate_ctx. Aside
from being a bit snappier, it fits more cleanly with structures
added in future patches.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif: Move odp_actions from subfacet to facet.
Ethan Jackson [Sat, 16 Mar 2013 01:03:59 +0000 (18:03 -0700)]
ofproto-dpif: Move odp_actions from subfacet to facet.

Upon close inspection, it appears that it's not possible for
actions to differ between subfacets belonging to a given facet.
Given this fact, it makes sense to move datapath actions from
subfacets to their parent facets.  It's both conceptually more
straightforward, and necessary for future threading and megaflow
work.

Co-authored-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoodp-util: Make slow_path_reasons mutually exclusive.
Ethan Jackson [Tue, 28 May 2013 18:43:43 +0000 (11:43 -0700)]
odp-util: Make slow_path_reasons mutually exclusive.

It's no longer possible for a single datapath flow to be slow
pathed for two different reasons.  This patch updates the code to
reflect this fact (marginally simplifying it).

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto: Ditch SLOW_IN_BAND slow path reason.
Ethan Jackson [Thu, 23 May 2013 23:01:20 +0000 (16:01 -0700)]
ofproto: Ditch SLOW_IN_BAND slow path reason.

Before this patch, when in band control was enabled, every DHCP
packet had to be sent to userspace to calculate it's actions.
Those DHCP packets intended for the local port would have a special
action added to ensure they actually make it there.  This
unnecessarily complicates the code, so this patch takes a slightly
different approach.  When in-band is enabled, *all* DHCP packets
must be sent to the local port.  This guarantees that
xlate_actions() returns the same result every time for a given
flow.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif: Ditch SLOW_MATCH slow path reason.
Ethan Jackson [Fri, 17 May 2013 20:39:03 +0000 (13:39 -0700)]
ofproto-dpif: Ditch SLOW_MATCH slow path reason.

Before this patch, datapath keys with ODP_FIT_TO_LITTLE, would be
assigned subfacets and installed in the kernel with a SLOW_MATCH
slow path reason.  This is problematic, because these flow keys
can't be reliable converted into a 'struct flow' thus breaking a
fundamental assumption of ofproto-dpif.  This patch circumvents the
issue by skipping facet creation for these flows altogether.  This
approach has the added benefit of simplifying the code for future
patches.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoofpbuf: New helper ofpbuf_equal().
Ethan Jackson [Tue, 19 Mar 2013 21:46:12 +0000 (14:46 -0700)]
ofpbuf: New helper ofpbuf_equal().

Used in future commits.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif: Avoid redundant facet_find() in facet_lookup_valid().
Ethan Jackson [Tue, 28 May 2013 20:29:50 +0000 (13:29 -0700)]
ofproto-dpif: Avoid redundant facet_find() in facet_lookup_valid().

Suggested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif: handle_flow_miss_common() without facets.
Ethan Jackson [Wed, 29 May 2013 17:20:23 +0000 (10:20 -0700)]
ofproto-dpif: handle_flow_miss_common() without facets.

handle_flow_miss_common() is intended to be called whether or not a
miss needs a facet.  Found by inspection.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoodp-execute: New module for executing datapath actions.
Simon Horman [Wed, 29 May 2013 06:06:38 +0000 (15:06 +0900)]
odp-execute: New module for executing datapath actions.

This moves generic action execution code out of lib/dpif-netedev.c
and into a new file, lib/odp-execute.c.

This is in preparation for using odp_execute_actions()
in lib/odp-util.c to handle recirculation/

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests: Add support for running OFTest.
Ben Pfaff [Tue, 28 May 2013 18:44:21 +0000 (11:44 -0700)]
tests: Add support for running OFTest.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-dummy: Add "pstream" option for connecting a dummy to a process.
Ben Pfaff [Thu, 25 Oct 2012 23:54:23 +0000 (16:54 -0700)]
netdev-dummy: Add "pstream" option for connecting a dummy to a process.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-dummy: Drop "nobody listened" reply from netdev-dummy/receive.
Ben Pfaff [Tue, 28 May 2013 18:23:29 +0000 (11:23 -0700)]
netdev-dummy: Drop "nobody listened" reply from netdev-dummy/receive.

Ethan pointed out that this wasn't very useful.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-dummy: Factor some netdev_dummy_receive() code out into new function.
Ben Pfaff [Fri, 10 Aug 2012 22:21:58 +0000 (15:21 -0700)]
netdev-dummy: Factor some netdev_dummy_receive() code out into new function.

An upcoming patch will add another user.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-dummy: Limit receive queue length to 100 packets.
Ben Pfaff [Thu, 16 Aug 2012 23:37:32 +0000 (16:37 -0700)]
netdev-dummy: Limit receive queue length to 100 packets.

It doesn't seem like a good idea to allow the queue length to grow without
bound, even for a test-only device.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoBFD: Reconfigure BFD on port deletion.
Pavithra Ramesh [Tue, 28 May 2013 19:35:06 +0000 (12:35 -0700)]
BFD: Reconfigure BFD on port deletion.

Invoke the function to reconfigure BFD when a port/interface
is deleted.

Signed-off-by: Pavithra Ramesh <paramesh@vmware.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agoLISP: update documentation for "null" ports
Lorand Jakab [Mon, 27 May 2013 11:54:54 +0000 (04:54 -0700)]
LISP: update documentation for "null" ports

Since commit 0ad90c8 it is possible to set tunnel destination IP address
in the flow.  This allows creating a LISP "map-cache" in the flow table.
Update the LISP documentation to reflect these possibilities.

Signed-off-by: Lorand Jakab <lojakab@cisco.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-vswitchd: Fix typo in manpage.
Ben Pfaff [Tue, 28 May 2013 16:15:00 +0000 (09:15 -0700)]
ovs-vswitchd: Fix typo in manpage.

Reported-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoOVS: update INSTALL.KVM
Zhi Yong Wu [Tue, 28 May 2013 07:50:25 +0000 (15:50 +0800)]
OVS: update INSTALL.KVM

    When i played with OVS again today, i found that the argument
of "ovs-dpctl show" is not correct, so INSTALL.KVM need to be
updated accordingly.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoDocument OVS packet buffering, to satisfy an OpenFlow 1.2+ requirement.
Ben Pfaff [Thu, 23 May 2013 22:49:48 +0000 (15:49 -0700)]
Document OVS packet buffering, to satisfy an OpenFlow 1.2+ requirement.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoOPENFLOW-1.1+: OFPCML_NO_BUFFER is effectively already implemented.
Ben Pfaff [Thu, 23 May 2013 23:07:43 +0000 (16:07 -0700)]
OPENFLOW-1.1+: OFPCML_NO_BUFFER is effectively already implemented.

OpenFlow 1.2 and later define a value of 65535 (OFPCML_NO_BUFFER) for
the max_len field in an output action to mean that the switch should send
the entire packet without buffering it.  Open vSwitch never buffers packets
sent via an output action, so it trivially satisfies this requirement.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-vswitchd: Update documentation of MAC table limits.
Ben Pfaff [Thu, 23 May 2013 22:35:16 +0000 (15:35 -0700)]
ovs-vswitchd: Update documentation of MAC table limits.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-bsd: Silence warnings on unimplemented platform.
Ed Maste [Fri, 24 May 2013 12:33:51 +0000 (08:33 -0400)]
netdev-bsd: Silence warnings on unimplemented platform.

netdev_bsd_get_next_hop currently lacks an implementation on FreeBSD, so
its arguments are unused; mark them so.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-xapi-sync: Handle exceptions from XAPI for get_single_bridge_id.
Gurucharan Shetty [Thu, 23 May 2013 23:14:19 +0000 (16:14 -0700)]
ovs-xapi-sync: Handle exceptions from XAPI for get_single_bridge_id.

There are possibilities when records disappear underneath ovs-xapi-sync.
In this particular case, when VLAN network was deleted, the corresponding
record in bridge's external_ids:xs_network_ids column was not deleted by
xenserver.  In situations like that handle the exceptions cleanly.

Bug #17390.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agodpif-netdev: Move decoding of data out of dp_netdev_output_userspace()
Simon Horman [Wed, 22 May 2013 07:08:06 +0000 (16:08 +0900)]
dpif-netdev: Move decoding of data out of dp_netdev_output_userspace()

This is in preparation for making dp_netdev_action_userspace()
more generic and passing dp_netdev_output_userspace() as a callback.
In this case it makes sense to decode userdata in generic code.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Constify key parameter of dp_netdev_action_userspace()
Simon Horman [Wed, 22 May 2013 07:08:05 +0000 (16:08 +0900)]
dpif-netdev: Constify key parameter of dp_netdev_action_userspace()

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-errors: Add missing copyright and license notice.
Ben Pfaff [Tue, 23 Apr 2013 04:47:18 +0000 (21:47 -0700)]
ofp-errors: Add missing copyright and license notice.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-bsd: Correct pointer use after refactoring.
Ed Maste [Thu, 23 May 2013 14:16:16 +0000 (10:16 -0400)]
netdev-bsd: Correct pointer use after refactoring.

Introduced in commit 666afb55e84e9118812de81a75655ec9567b7a5b.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoconfigure: Add if_mib.h prerequisites.
Ed Maste [Thu, 23 May 2013 14:00:57 +0000 (10:00 -0400)]
configure: Add if_mib.h prerequisites.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoINSTALL: update for NetBSD
YAMAMOTO Takashi [Tue, 21 May 2013 08:50:05 +0000 (17:50 +0900)]
INSTALL: update for NetBSD

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agofactor out a function to extract stats from if_data to netdev_stats.
YAMAMOTO Takashi [Tue, 21 May 2013 08:50:03 +0000 (17:50 +0900)]
factor out a function to extract stats from if_data to netdev_stats.

suggested by Ed Maste.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoimplement get_next_hop for NetBSD
YAMAMOTO Takashi [Tue, 21 May 2013 08:50:01 +0000 (17:50 +0900)]
implement get_next_hop for NetBSD

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agosome NetBSD related documentation changes
YAMAMOTO Takashi [Tue, 21 May 2013 08:50:00 +0000 (17:50 +0900)]
some NetBSD related documentation changes

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoimplement get_stats for NetBSD
YAMAMOTO Takashi [Tue, 21 May 2013 08:49:59 +0000 (17:49 +0900)]
implement get_stats for NetBSD

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoimplement set_etheraddr for NetBSD
YAMAMOTO Takashi [Thu, 23 May 2013 03:56:47 +0000 (20:56 -0700)]
implement set_etheraddr for NetBSD

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
10 years agomissing ifdef netbsd guard for af_link_sock
YAMAMOTO Takashi [Tue, 21 May 2013 08:49:57 +0000 (17:49 +0900)]
missing ifdef netbsd guard for af_link_sock

pointed out by Ed Maste

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-bsd: NetBSD: keep a AF_LINK socket open
YAMAMOTO Takashi [Tue, 21 May 2013 08:49:56 +0000 (17:49 +0900)]
netdev-bsd: NetBSD: keep a AF_LINK socket open

this will be used for get_stats and set_etheraddr

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agokeep "kernel name" for each netdev
YAMAMOTO Takashi [Tue, 21 May 2013 08:49:55 +0000 (17:49 +0900)]
keep "kernel name" for each netdev

where interface renaming is not supported (NetBSD), remember both of
our netdev name and the correspoinding kernel name separately.
the latter is necessary to talk with kernel using interface names.
eg. ifioctls, bpf

XXX there should be a proper way to query kernel name.
Ben Pfaff suggested ovs-appctl but this patch doesn't implement it. (yet)

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoadd minimal NetBSD support
YAMAMOTO Takashi [Tue, 21 May 2013 08:49:54 +0000 (17:49 +0900)]
add minimal NetBSD support

mostly ride on the existing FreeBSD support.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agocfm: Implement "demand mode".
Ethan Jackson [Wed, 15 May 2013 21:31:06 +0000 (14:31 -0700)]
cfm: Implement "demand mode".

The new CFM "demand mode" (named after BFD's demand mode) uses
data traffic to indicate interface liveness.  It's helpful on
heavily congested networks where CCMs may be dropped.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
10 years agonetdev: New function netdev_ref().
Ben Pfaff [Tue, 21 May 2013 22:42:44 +0000 (15:42 -0700)]
netdev: New function netdev_ref().

I suspect that this makes it easier to make sure that a netdev stays open
as long as needed in some cases where a module needs access to a netdev
opened by some higher-level module.

CC: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests/ofproto-dpif.at: Add tests for the ofproto/trace command
Alex Wang [Mon, 20 May 2013 18:17:51 +0000 (11:17 -0700)]
tests/ofproto-dpif.at: Add tests for the ofproto/trace command

Two testcases are added to the testsuite, which test the new
command syntax and the corresponding corner cases.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto/ofproto-dpif.c: Re-implement the ofproto/trace command
Alex Wang [Mon, 20 May 2013 18:36:05 +0000 (11:36 -0700)]
ofproto/ofproto-dpif.c: Re-implement the ofproto/trace command

Since the use of single datapath, all bridges belonging to the same type of
datapath will use the same (single) datapath. This causes confusion in the
current 'ofproto/trace' command. Especially, when given the unrelated
'bridge' and 'in_port' combination, the current implementation will still
be able to process and give misleading output. Thusly, this patch changes
the 'ofproto/trace' command syntax to formats shown as follow.

ofproto/trace [datapath] odp_flow [-generate|packet]
ofproto/trace bridge br_flow [-generate|packet]

Also, this patch updates the tests and the manpages accordingly.

Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Don't configure BFD on missing ofports.
Ethan Jackson [Tue, 21 May 2013 02:07:12 +0000 (19:07 -0700)]
ofproto-dpif: Don't configure BFD on missing ofports.

This was causing ovs-vswitchd to core occasionally, even when BFD
wasn't turned on.

Bug #17162.
Signed-off-by: Ethan Jackson <ethan@nicira.com>