sliver-openvswitch.git
10 years agodatapath: Fix ovs_flow_free() ovs-lock assert.
Pravin B Shelar [Tue, 28 Jan 2014 02:18:33 +0000 (18:18 -0800)]
datapath: Fix ovs_flow_free() ovs-lock assert.

ovs_flow_free() is not called under ovs-lock during packet
execute path (ovs_packet_cmd_execute()). Since packet execute
does not touch flow->mask, there is no need to take that
lock either. So move assert in case where flow->mask is checked.

Found by code inspection.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agocccl: Handle library paths for one shot compilation.
Gurucharan Shetty [Thu, 30 Jan 2014 00:08:49 +0000 (16:08 -0800)]
cccl: Handle library paths for one shot compilation.

When one wishes to compile and link a program with an
external library in one shot, additional
option "-link" is expected after all the other options. For example,

$ cl -I/c/OpenSSL-Win32/include 3.c -link -LIBPATH:"C:/OpenSSL-Win32/lib"

This is needed in an upcoming commit to compile conftest.c in autoconf.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agoBUILD.Windows: Add documentation to handle the libtool change.
Gurucharan Shetty [Wed, 29 Jan 2014 23:34:03 +0000 (15:34 -0800)]
BUILD.Windows: Add documentation to handle the libtool change.

With the recent change to libtool, the default behavior is to use
MinGW's 'ld'. Set the LD variable to direct it to Visual Studio's
linker.

The wordings for the documentation is copied from INSTALL.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agoBUILD.Windows: Clarify on the correct linker.
Gurucharan Shetty [Wed, 29 Jan 2014 23:28:42 +0000 (15:28 -0800)]
BUILD.Windows: Clarify on the correct linker.

This has tripped a couple of people.

The workaround in cccl does not actually work. So get rid of it and
clarify in documentation.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agobridge: Set ofport column in every database transaction.
Ben Pfaff [Fri, 31 Jan 2014 00:57:16 +0000 (16:57 -0800)]
bridge: Set ofport column in every database transaction.

Database transactions can occasionally fail due to concurrent changes in
the database.  When that happens, the next transaction should repeat the
changes that ovs-vswitchd tried to make the first time (adjusted for the
changes to the database).

The code to report the OpenFlow port number in use didn't do that.  It set
the ofport field once when it created the port and never set it again, even
if the transaction to set it failed.  This commit fixes the problem.

Bug #23047.
Reported-by: Suganya Ramachandran <suganyar@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
10 years agoofproto-dpif-upcall: Hardcode max_idle to 1500ms.
Ethan Jackson [Tue, 28 Jan 2014 00:40:27 +0000 (16:40 -0800)]
ofproto-dpif-upcall: Hardcode max_idle to 1500ms.

Before this patch, OVS tried to guess an optimal max idle time for
datapath flows based on the number of datapath flows relative to the
limit.  This caused instability because the limit was based on the
dump duration which was affected by the max idle time.  This patch
chooses instead to hardcode the max idle time to 1.5s except in
extreme case where the datapath flow limit is exceeded.  1.5s was
chosen to ensure pings occurring at once per second stay cached in the
datapath.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agoupcall: Avoid divide-by-zero calculating flow limit
Joe Stringer [Tue, 28 Jan 2014 21:04:35 +0000 (13:04 -0800)]
upcall: Avoid divide-by-zero calculating flow limit

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoutil: A generic function to convert error to string for windows.
Gurucharan Shetty [Thu, 16 Jan 2014 21:49:38 +0000 (13:49 -0800)]
util: A generic function to convert error to string for windows.

More users will be added in an upcoming commit.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agogetopt_long: Copy over the implementation from netbsd.
Gurucharan Shetty [Mon, 27 Jan 2014 16:52:57 +0000 (08:52 -0800)]
getopt_long: Copy over the implementation from netbsd.

Windows does not have a getopt_long function. This commit
copies over the getopt_long implementation from netbsd with
some minor modifications and is used only on Windows platform.

Modifications on top of the version in NetBSD repo.
* Remove header files not available in Visual Studio.
* Remove some unwanted #defines.
* Add Open vSwitch specific header files like config.h, vlog.h, util.h
* Add the following #define's
define __UNCONST(a)    ((void *)(unsigned long)(const void *)(a))
define _DIAGASSERT(q) ovs_assert(q)
define warnx VLOG_WARN
* Add extern declaration in getopt.h for optarg, optind.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-dev.py: Only build the Linux datapath with GCC.
Ethan Jackson [Wed, 22 Jan 2014 19:06:23 +0000 (11:06 -0800)]
ovs-dev.py: Only build the Linux datapath with GCC.

In practice, Linux kernel modules are only built with GCC, so it
doesn't make much sense to spend time compiling them with clang.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agodaemon: Cleanup some functions.
Gurucharan Shetty [Fri, 10 Jan 2014 16:33:15 +0000 (08:33 -0800)]
daemon: Cleanup some functions.

Some functions are unused and some functions can be
declared as static.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agosyslog: Provide stub functions for openlog and syslog.
Gurucharan Shetty [Mon, 6 Jan 2014 21:54:21 +0000 (13:54 -0800)]
syslog: Provide stub functions for openlog and syslog.

One option to implement openlog and syslog functionality in Windows
is to use windows event logger. But it looks like it involves changing
registry settings and in general looks complicated.

For the time being, do nothing for syslog. All the information needed for
debugging will be present through the 'file' option anyways.

We can start OVS daemons on Windows with "-vfile:info -vsyslog:off".

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agosyslog: Add LOG_LOCALX definitions.
Gurucharan Shetty [Mon, 6 Jan 2014 21:12:21 +0000 (13:12 -0800)]
syslog: Add LOG_LOCALX definitions.

LOG_LOCAL0 is used in lib/vlog.c.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Handle negative number of threads.
Gurucharan Shetty [Wed, 22 Jan 2014 21:26:33 +0000 (13:26 -0800)]
ofproto: Handle negative number of threads.

As of now, setting other_config:n-handler-threads to a negative
value causes ovs-vswitchd to crash.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agonetdev-dummy: Add support for active stream
Andy Zhou [Wed, 18 Dec 2013 21:55:25 +0000 (13:55 -0800)]
netdev-dummy: Add support for active stream

The dummy ports thus far only support passive connections. It can
listen for multiple incoming connection requests but not make active
connections. This patch adds support of active stream, so that a
dummy port can be configured with either passive or active connections.

The net result is that dummy ports can now connect to each other,
without being patch ports. This feature will be useful in adding test
cases of future commits.

Signed-off-by: Andy Zhou <azhou@nicira.com>
10 years agonetlink: Rename 'dump->seq' to 'dump->nl_seq'
Joe Stringer [Tue, 21 Jan 2014 19:29:26 +0000 (11:29 -0800)]
netlink: Rename 'dump->seq' to 'dump->nl_seq'

An upcoming patch will introduce another, completely unrelated seq to
'struct nl_dump'. Giving this one a better name should reduce confusion.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: use const in some local vars and casts
Daniele Di Proietto [Thu, 23 Jan 2014 16:19:29 +0000 (17:19 +0100)]
datapath: use const in some local vars and casts

In few functions, const formal parameters are assigned or cast to
non-const.
These changes suppress warnings if compiled with -Wcast-qual.

Signed-off-by: Daniele Di Proietto <daniele.di.proietto@gmail.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Fix ovs_dp_cmd_msg_size()
Daniele Di Proietto [Thu, 23 Jan 2014 16:18:59 +0000 (17:18 +0100)]
datapath: Fix ovs_dp_cmd_msg_size()

commit c58cc9a460fd158e5250e59902e96ac677dc115f (datapath: Allow user space to
announce ability to accept unaligned Netlink messages) introduced
OVS_DP_ATTR_USER_FEATURES netlink attribute in datapath responses,
but the attribute size was not taken into account in ovs_dp_cmd_msg_size().

Signed-off-by: Daniele Di Proietto <daniele.di.proietto@gmail.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodpif-linux: Fix flow_dump_next annotation.
Joe Stringer [Tue, 21 Jan 2014 19:29:24 +0000 (11:29 -0800)]
dpif-linux: Fix flow_dump_next annotation.

The 'dpif_' parameter of dpif_linux_flow_dump_next() was marked as
OVS_UNUSED, even though it's passed down to dpif_linux_flow_get__().

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolib/pcap-file: add 'ovs_' prefix to pcap functions
Luigi Rizzo [Thu, 23 Jan 2014 16:24:03 +0000 (17:24 +0100)]
lib/pcap-file: add 'ovs_' prefix to pcap functions

This is done to avoid collisions and confusions with libpcap symbols,
like pcap_read()

Signed-off-by: Luigi Rizzo <rizzo@iet.unipi.it>
Signed-off-by: Daniele Di Proietto <daniele.di.proietto@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolib/netdev-bsd: simplify multiple struct definitions
Daniele Di Proietto [Thu, 23 Jan 2014 16:19:56 +0000 (17:19 +0100)]
lib/netdev-bsd: simplify multiple struct definitions

Use a macro helper to initialize different netdev_*_class for bsd, like
in lib/netdev-linux.c
This helps adding other netdev types for bsd

Signed-off-by: Daniele Di Proietto <daniele.di.proietto@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoMakefile: Use AM_V_GEN instead of echo.
Ethan Jackson [Wed, 22 Jan 2014 01:55:41 +0000 (17:55 -0800)]
Makefile: Use AM_V_GEN instead of echo.

The AM_V_GEN macro fits more cleanly with the automake silent rules
option.  When enabled it will print "GEN <filename>" instead of simply
echoing the command as before.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoconfigure: Enable silent rules.
Ethan Jackson [Wed, 22 Jan 2014 00:22:08 +0000 (16:22 -0800)]
configure: Enable silent rules.

Configure has an option which supports quieter compilation.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agoovs-dev.py: Configure silently.
Ethan Jackson [Wed, 22 Jan 2014 00:35:35 +0000 (16:35 -0800)]
ovs-dev.py: Configure silently.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agoovs-dev.py: Add compiler optimization options.
Ethan Jackson [Fri, 17 Jan 2014 00:20:17 +0000 (16:20 -0800)]
ovs-dev.py:  Add compiler optimization options.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoovs-dev.py: Add "-fno-omit-frame-pointer" compiler argument.
Ethan Jackson [Fri, 17 Jan 2014 00:21:43 +0000 (16:21 -0800)]
ovs-dev.py: Add "-fno-omit-frame-pointer" compiler argument.

This makes it easier for development tools including "perf", give
clean backtraces on x86-64 systems.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoofp-parse: Fix GCC compiler warnings with -O3.
Ethan Jackson [Fri, 17 Jan 2014 00:26:37 +0000 (16:26 -0800)]
ofp-parse: Fix GCC compiler warnings with -O3.

When compiling with -O3, GCC can no longer tell that the following
warnings are not valid.  At any rate, they're easy enough to silence.

ofp-parse.c:764:45: error: 'ttl' may be used uninitialized in this
function

ofp-parse.c:752:17: error: 'ecn' may be used uninitialized in this
function

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoipsec: install iptables rules that set IPsec bit in skb mark
Ansis Atteka [Tue, 21 Jan 2014 01:16:39 +0000 (17:16 -0800)]
ipsec: install iptables rules that set IPsec bit in skb mark

Without these two iptables rules (one for UDP encapsulated IPsec and
another for direct IPsec), ovs-vswitchd would incorrectly conclude
that GRE packet belonged to a plain GRE tunnel instead of IPsec GRE
tunnel.

Reported-by: Aryan TaheriMonfared <aryan.taherimonfared@uis.no>
Reported-by: Daniel Hiltgen <daniel@netkine.com>
Signed-off-by: Ansis Atteka <aatteka@nicira.com>
10 years agoupcall: Cache the number of flows from the datapath.
Joe Stringer [Wed, 22 Jan 2014 06:50:49 +0000 (06:50 +0000)]
upcall: Cache the number of flows from the datapath.

Fetching the number of flows in the datapath has been causing
unnecessary contention on the kernel ovs_lock in recent TCP CRR tests.
This patch caches this number for up to 100ms in the userspace to reduce
such kernel calls.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Co-authored-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off--by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agobfd: Add bfd_src_ip and bfd_dst_ip.
Alex Wang [Tue, 21 Jan 2014 22:23:27 +0000 (14:23 -0800)]
bfd: Add bfd_src_ip and bfd_dst_ip.

This commit adds two new options, bfd_src_ip and bfd_dst_ip
respectively, which allows user to configure the source and
destination IP address of bfd control packet.  If the user
specified address cannot be parsed, the default address
will be used.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agovlog: Avoid deadlock in vlog_init__() corner case.
Ben Pfaff [Fri, 6 Dec 2013 00:59:13 +0000 (16:59 -0800)]
vlog: Avoid deadlock in vlog_init__() corner case.

Anything inside vlog_init__() that tried to log a message was going to
deadlock, since it would hit pthread_once() recursively and wait for the
previous call to complete.  Unfortunately, there was a VLOG_ERR call inside
vlog_init__(), only called in the corner case where the system's clock was
wrong.

This fixes the problem by rearranging code so that the logging isn't
inside the "once-only" region.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-util: Ignore out_group in flow_mods for commands other than delete.
Ben Pfaff [Fri, 6 Dec 2013 05:29:14 +0000 (21:29 -0800)]
ofp-util: Ignore out_group in flow_mods for commands other than delete.

OpenFlow 1.1 through 1.4 say that the out_group in a flow_mod, for commands
other than OFPFC_DELETE or OFPFC_DELETE_STRICT, should be ignored.  OVS
actually reported an error.  This fixes the problem.

Reported-by: chen zhang <3zhangchen9211@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agopoll-loop: Port to Windows.
Linda Sun [Fri, 10 Jan 2014 00:26:12 +0000 (16:26 -0800)]
poll-loop: Port to Windows.

Use WaitForMultipleObjects for polling on windows.  This works on all kinds
of objects, e.g. sockets, files, especially ioctl calls to the kernel.
poll_fd_wait_event() is used if events need to be passed to pollfds.  latch
is signaled with event, to be waited/polled by WaitForMultipleObjects() as
well.  Changed array of fds to hmap to check for duplicate fds.

Signed-off-by: Linda Sun <lsun@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Fix kernel panic on ovs_flow_free
Andy Zhou [Fri, 10 Jan 2014 23:57:04 +0000 (15:57 -0800)]
datapath: Fix kernel panic on ovs_flow_free

Both mega flow mask's reference counter and per flow table mask list
should only be accessed when holding ovs_mutex() lock. However
this is not true with ovs_flow_table_flush(). The patch fixes this bug.

Reported-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
10 years agonetdev-linux: Fix build break on RHEL 6.1.
Ben Pfaff [Fri, 17 Jan 2014 01:21:55 +0000 (17:21 -0800)]
netdev-linux: Fix build break on RHEL 6.1.

Commit 73c85181d (netdev-linux: Read packet auxdata to obtain vlan_tid)
added #include <linux/if_packet.h> to this file, to get the definition
of PACKET_AUXDATA and some other definitions, but on RHEL 6.1 this
provoked compiler errors:

In file included from /usr/include/linux/rtnetlink.h:5,
    from lib/netdev-linux.c:34:
/usr/include/linux/netlink.h:34: error: expected specifier-qualifier-list
    before 'sa_family_t'

Since the old #includes worked everywhere, and this file already defined
its own versions of most of the new macros that it needed, this commit just
reverts the old #includes and adds the one macro definition it didn't
already have.

(RHEL 6.1 isn't necessarily the only platform where this is a problem, but
it's the first one for which we noticed the problem.)

This switches the definition of sockaddr_ll used from the Linux one, which
uses __be16 for sll_protocol, to the glibc one, which uses plain "unsigned
short int".  This makes sparse complain (rightly), so this commit also
adds a sparse-specific header that uses ovs_be16 to prevent the warning.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agovswitchd: Inherit parents mac address for fake bridges
Helmut Schaa [Fri, 6 Dec 2013 15:18:42 +0000 (16:18 +0100)]
vswitchd: Inherit parents mac address for fake bridges

When adding a physical port to the main bridge the mac address
of the bridge is updated. We can do the same for fake bridges by
copying the mac address of the parent bridge.

There exists only one fake bridge per vlan, hence it is safe
to copy the mac address of the parent bridge.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-linux: Read packet auxdata to obtain vlan_tid
Simon Horman [Wed, 15 Jan 2014 08:17:02 +0000 (17:17 +0900)]
netdev-linux: Read packet auxdata to obtain vlan_tid

If VLAN acceleration is used when the kernel receives a packet
then the outer-most VLAN tag will not be present in the packet
when it is received by netdev-linux. Rather, it will be present
in auxdata.

This patch uses recvmsg() instead of recv() to read auxdata for
each packet and if the vlan_tid is set then it is added to the packet.

Adding the vlan_tid makes use of headroom available
in the buffer parameter of rx_recv.

Signed-off-by: Simon Horman <horms@verge.net.au>
Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolib: Add tpid parameter to eth_push_vlan()
Simon Horman [Wed, 15 Jan 2014 08:17:01 +0000 (17:17 +0900)]
lib: Add tpid parameter to eth_push_vlan()

This is in preparation for pushing vlan tags
using the TPID provided by the kernel via auxdata.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev_class: Pass a struct ofpbuf * to rx_recv()
Simon Horman [Wed, 15 Jan 2014 08:17:00 +0000 (17:17 +0900)]
netdev_class: Pass a struct ofpbuf * to rx_recv()

Update the netdev_class so that struct ofpbuf * is passed to rx_recv()
to provide both the data and size of the data to read a packet into.

On success, update struct ofpbuf size inside netdev_class rx_recv
implementation and return 0. This moves logic from the caller.
On error a positive error code is returned, whereas previously
a negative error code was returned. This is a more common convention.

This patch should not have any behavioural changes.

This patch is in preparation for the netdev-linux variant of rx_recv()
making use of headroom in the struct ofpbuf * parameter to push a VLAN tag
obtained from auxdata.

Signed-off-by: Simon Horman <horms@verge.net.au>
Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests: Fix path for distcleaning ovs-controller.8
Joe Stringer [Fri, 10 Jan 2014 21:45:47 +0000 (13:45 -0800)]
tests: Fix path for distcleaning ovs-controller.8

Fixes the following error on distcheck:-

ERROR: files left in build directory after distclean:
./tests/test-controller.8
make[1]: *** [distcleancheck] Error 1

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-monitor: Change global rwlock into mutex.
Ben Pfaff [Wed, 15 Jan 2014 20:37:04 +0000 (12:37 -0800)]
ofproto-dpif-monitor: Change global rwlock into mutex.

Nothing ever took monitor_rwlock's read lock, so it might as well be a
mutex.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Add more lock annotations.
Ben Pfaff [Wed, 15 Jan 2014 18:22:20 +0000 (10:22 -0800)]
ofproto-dpif: Add more lock annotations.

This annotation would have caught the bug fixed by commit 491a67a0005347130
(ofproto-dpif-xlate: Avoid recursive acquisition of xlate_rwlock.).

Signed-off-by: Ben Pfaff <blp@nicira.com>
CC: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
10 years agodatapath: Pad OVS_PACKET_ATTR_PACKET if linear copy was performed
Thomas Graf [Tue, 14 Jan 2014 09:27:02 +0000 (01:27 -0800)]
datapath: Pad OVS_PACKET_ATTR_PACKET if linear copy was performed

While the zerocopy method is correctly omitted if user space
does not support unaligned Netlink messages. The attribute is
still not padded correctly as skb_zerocopy() will not ensure
padding and the attribute size is no longer pre calculated
though nla_reserve() which ensured padding previously.

This patch applies appropriate padding if a linear data copy
was performed in skb_zerocopy().

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Acked-by: Zoltan Kiss <zoltan.kiss@citrix.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoofproto-dpif-xlate: Avoid recursive acquisition of xlate_rwlock.
YAMAMOTO Takashi [Wed, 15 Jan 2014 18:06:40 +0000 (10:06 -0800)]
ofproto-dpif-xlate: Avoid recursive acquisition of xlate_rwlock.

Currently xlate_rwlock is recursively acquired.
(xlate_send_packet -> ofproto_dpif_execute_actions -> xlate_actions)
Due to writer-preference in rwlock implementations, this causes
deadlock if another thread tries to acquire the lock exclusively
behind us.

This change avoids the problem by making xlate_send_packet drop
the lock before calling ofproto_dpif_execute_actions.  This is the
simplest fix but opens a race window against port reconfigurations.
Given the way xlate_send_packet is currently used, the race does not
seem a big problem.  An alternative would be passing down the
"xlate_rwlock is held" info to ofproto_dpif_execute_actions.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobridge: Update a comment
YAMAMOTO Takashi [Wed, 15 Jan 2014 03:41:23 +0000 (12:41 +0900)]
bridge: Update a comment

This looks like a leftover of commit 2a73b1d73d.
("bridge: Reconfigure in single pass.")

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-xlate: Fix a whitespace error.
YAMAMOTO Takashi [Wed, 15 Jan 2014 03:41:22 +0000 (12:41 +0900)]
ofproto-dpif-xlate: Fix a whitespace error.

No functional changes.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agofat-rwlock: Don't forget to destroy a mutex
YAMAMOTO Takashi [Wed, 15 Jan 2014 03:41:21 +0000 (12:41 +0900)]
fat-rwlock: Don't forget to destroy a mutex

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoclassifier: Use fat_rwlock instead of ovs_rwlock.
Ben Pfaff [Mon, 13 Jan 2014 19:21:12 +0000 (11:21 -0800)]
classifier: Use fat_rwlock instead of ovs_rwlock.

Jarno Rajahalme reported up to 40% performance gain on netperf TCP_CRR with
an earlier version of this patch in combination with a kernel NUMA patch,
together with a reduction in variance:
    http://openvswitch.org/pipermail/dev/2014-January/035867.html

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agofat-rwlock: New big but fast synchronization primitive.
Ben Pfaff [Mon, 13 Jan 2014 19:17:55 +0000 (11:17 -0800)]
fat-rwlock: New big but fast synchronization primitive.

This implements a reader-writer lock that uses a lot of memory (128 to 192
bytes per thread that takes the lock) but avoids cache line bouncing when
taking the read side.  Thus, a fat_rwlock is a good choice for rwlocks
taken frequently by readers.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoovs-thread: Add new support for thread-specific data.
Ben Pfaff [Tue, 14 Jan 2014 22:35:48 +0000 (14:35 -0800)]
ovs-thread: Add new support for thread-specific data.

A couple of times I've wanted to create a dynamic data structure that has
thread-specific data, but I've not been able to do that because
PTHREAD_KEYS_MAX is so low (POSIX says at least 128, glibc is only a little
bigger at 1024).  This commit introduces a new form of thread-specific data
that supports a large number of items.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoutil: Set program_name for windows correctly.
Gurucharan Shetty [Mon, 6 Jan 2014 16:47:57 +0000 (08:47 -0800)]
util: Set program_name for windows correctly.

Windows path uses backward slashes. Also, the executable name
has a .exe extension in it. While creating log files, we use
the program name to create log file names. It feels a little odd
to have log file names like ovsdb-server.exe.log etc. Using
_splitpath_s() is a way to have same log file names on both
windows and linux platforms.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agorhel: Enable DHCP support for internal ports.
Flavio Leitner [Tue, 14 Jan 2014 02:22:07 +0000 (00:22 -0200)]
rhel: Enable DHCP support for internal ports.

The current initscripts ifup-ovs brings up internal ports as
an ordinary ethernet device, so BOOTPROTO=dhcp|none does not
consider any OVS/bridge detail.

Since DHCP requires a port in the bridge to reach the server,
bring up the required port before in the same way it does for
OVS bridge.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agoofproto-dpif: Un-wildcard nw_frag only for protocols that have fragments.
Ben Pfaff [Fri, 10 Jan 2014 23:17:43 +0000 (15:17 -0800)]
ofproto-dpif: Un-wildcard nw_frag only for protocols that have fragments.

The revalidator code in ofproto-dpif-upcall.c, in revalidate_ukey(),
deletes any datapath flow for which the kernel reports wildcarded bits
that userspace requires to be matched.  Until now, a couple of pieces of
code in ofproto-dpif always marked nw_frag (which tracks whether a packet
is an IPv4 or IPV6 fragment) as exact-match.  For non-IP protocols, this
wasn't meaningful, so adding such a flow to the datapath and then receiving
it back caused nw_frag to become wildcarded, so revalidate_ukey() always
deleted them.

This fixes the problem by only un-wildcarding nw_frag for protocols where
it is defined (IPv4 and IPv6).

Noticed while observing CFM traffic (which isn't IP based) over a tunnel.

Reported-by: Guolin Yang <gyang@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotunnel: Un-wildcard only flags that really exist in tnl_xlate_init().
Ben Pfaff [Fri, 10 Jan 2014 23:14:27 +0000 (15:14 -0800)]
tunnel: Un-wildcard only flags that really exist in tnl_xlate_init().

The revalidator code in ofproto-dpif-upcall.c, in revalidate_ukey(),
deletes any datapath flow for which the kernel reports wildcarded bits
that userspace requires to be matched.  Until now, tnl_xlate_init() marked
every bit in the tunnel flags as required to be matched.  Since most of
those bits don't actually have defined flags, adding such a flow to the
datapath and then receiving it back caused those bits to become wildcarded,
which meant that revalidate_ukey() always deleted them.

This fixes the problem by only un-wildcarding defined flags.

Reported-by: Guolin Yang <gyang@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-upcall: Avoid unnecessarily installing datapath flows.
Ben Pfaff [Mon, 13 Jan 2014 23:33:27 +0000 (15:33 -0800)]
ofproto-dpif-upcall: Avoid unnecessarily installing datapath flows.

handle_upcalls() always installed a flow for every packet, as long as
the datapath didn't already have too many flows, but there are cases where
we don't want to do this:

    - If we get multiple packets in a single microflow all in one batch
      (perhaps due to GSO breaking up a large TCP packet for sending to
      userspace, or for another reason), then we only need to install the
      datapath flow once.

    - For a slow-pathed flow received via a slow-path action in the kernel,
      we know that the kernel flow is already there (because otherwise it
      would have been received as "no match" instead of an action), so
      there is no benefit to reinstalling it.

Noticed because a CFM slow-pathed flow was getting reinstalled every time
a CFM packet was received.

Reported-by: Guolin Yang <gyang@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetlink: Update comment for nl_dump_start().
Joe Stringer [Mon, 13 Jan 2014 21:50:22 +0000 (13:50 -0800)]
netlink: Update comment for nl_dump_start().

The function comment still referred to a 'msg' variable, which has been
renamed.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
[blp@nicira.com did further proofreading]
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agosFlow: clear the padding
Francesco Fusco [Thu, 19 Dec 2013 17:16:24 +0000 (18:16 +0100)]
sFlow: clear the padding

putString pads the string to the 4-byte boundary without
clearing the "padded" memory. This patch simply set the
padding to zero.

Signed-off-by: Francesco Fusco <ffusco@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovsdbmonitor: Remove.
Ben Pfaff [Fri, 10 Jan 2014 23:25:40 +0000 (15:25 -0800)]
ovsdbmonitor: Remove.

ovsdbmonitor was poorly maintained and not widely used.

Acked-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Add more thread safety annotations.
Ben Pfaff [Fri, 10 Jan 2014 19:36:35 +0000 (11:36 -0800)]
ofproto: Add more thread safety annotations.

These would have found the problem fixed in commit c7be3f559349 (connmgr:
Fix attempt to take mutex recursively when exiting fail-open.).

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoUpdate build requirements.
Ben Pfaff [Tue, 31 Dec 2013 22:23:34 +0000 (14:23 -0800)]
Update build requirements.

Libtool is now required as of commit 38b7a52b61 (openvswitch: Use libtool
and allow building shared libs).

It seems that a build requirement for Python slipped in a while back, for
generating ovs-vswitchd.conf.db.5, and no one complained, so we might as
well make it official.  (That will let us simplify some bits of the build,
too, since they won't have to be conditional on Python anymore, so I'm all
in favor of this change.)

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoconfigure: Make autoconf fail if libtool is not installed.
Ben Pfaff [Tue, 31 Dec 2013 22:20:01 +0000 (14:20 -0800)]
configure: Make autoconf fail if libtool is not installed.

Otherwise users get an error later like:
    ./configure: line 5093: syntax error near unexpected token
    `disable-shared' ./configure: line 5093: `LT_INIT(disable-shared)'
It's probably friendlier to make configuration fail earlier.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agofedora package: fix systemd ordering and deps.
Flavio Leitner [Thu, 9 Jan 2014 03:04:33 +0000 (01:04 -0200)]
fedora package: fix systemd ordering and deps.

There is a chicken and egg issue where common OVS
configuration uses a controller which is only accessible
via the network. So starting OVS before network.target
would break those configurations.

However, the network doesn't come up after boot because
OVS isn't started until after the network scripts tries
to configure the ovs.

This is partially fixed by commits:
   commit: 602453000e28ec1076c0482ce13c284765a84409
   rhel: Automatically start openvswitch service before bringing an ovs interfa

   commit: 3214851c31538e8690e31f95702f8927a8c0838b
   rhel: Add OVSREQUIRES to automatically bring up OpenFlow interface dependencies

But still there is the dependency issue between network.target
and openvswitch which this patch fixes it.  It provides two systemd
service units. One to run at any time (openvswitch-nonetwork.service)
which runs 'ovs-ctl start' and the other one (openvswith.service) to
run after network.target which works as a frontend to the admin.

The openvswitch-nonetwork.service is used internally by the
'ifup-ovs/ifdown-ovs' scripts when adding or removing ports to
the bridge or when the openvswitch.service is enabled by the admin.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agobfd: Fix cpath_down set failure.
Alex Wang [Thu, 9 Jan 2014 02:51:43 +0000 (18:51 -0800)]
bfd: Fix cpath_down set failure.

Commit ccc09689 (bfd: Implement Bidirectional Forwarding Detection.)
set the bfd local diagnostic to "Concatenated Path Down" in response
to the set of cpath_down only when the current local diagnostic is
"None".  However, since the bfd local diagnostic is not reset when
the bfd state is restored from last erroneous state, the set of
cpath_down will not update the local diagnostic in that case.

This commit fixes the bug by always checking for local diagnostic
change when cpath_down is set or reset.

Bug #22625
Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agodpif-netdev: Use separate threads for forwarding.
Ben Pfaff [Sat, 28 Dec 2013 01:00:30 +0000 (17:00 -0800)]
dpif-netdev: Use separate threads for forwarding.

For now, we use exactly two threads.  Presumably at some point we will want
to make this configurable.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Make thread-safety much more granular.
Ben Pfaff [Wed, 8 Jan 2014 23:58:11 +0000 (15:58 -0800)]
dpif-netdev: Make thread-safety much more granular.

This will allow for parallelism in multithreaded forwarding in an upcoming
commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Introduce new mutex to protect queues.
Ben Pfaff [Fri, 27 Dec 2013 17:42:51 +0000 (09:42 -0800)]
dpif-netdev: Introduce new mutex to protect queues.

This is a first step in making thread safety more granular in dpif-netdev,
to allow for multithreaded forwarding.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Break actions out into new struct dp_netdev_actions.
Ben Pfaff [Wed, 8 Jan 2014 22:37:13 +0000 (14:37 -0800)]
dpif-netdev: Break actions out into new struct dp_netdev_actions.

This is analogous to the split between rule and rule_actions in
ofproto.  As there, it will allow retaining a reference to a rule's
actions, while processing them, without having to retain a reference
to the rule itself.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Take advantage of ovs_refcount for dp_netdev.
Ben Pfaff [Sat, 28 Dec 2013 03:41:10 +0000 (19:41 -0800)]
dpif-netdev: Take advantage of ovs_refcount for dp_netdev.

By making "destroyed" own a reference, we can treat dp_netdev's ref_cnt
like any other in Open vSwitch.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-atomic: Introduce a new 'struct ovs_refcount'.
Ben Pfaff [Sat, 28 Dec 2013 03:39:24 +0000 (19:39 -0800)]
ovs-atomic: Introduce a new 'struct ovs_refcount'.

This is a thin wrapper around an atomic_uint.  It is useful anyhow because
each ovs_refcount_ref() or ovs_refcount_unref() call saves a few lines of
code.

This commit also changes all the potential direct users over to use the new
data structure.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-atomic: Add atomic_destroy() and use everywhere it is needed.
Ben Pfaff [Wed, 8 Jan 2014 18:42:12 +0000 (10:42 -0800)]
ovs-atomic: Add atomic_destroy() and use everywhere it is needed.

C11 is able to require that atomics don't need to be destroyed, but some
of the OVS implementations do.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-atomic: New functions atomic_flag_init(), atomic_flag_destroy().
Ben Pfaff [Thu, 9 Jan 2014 01:13:28 +0000 (17:13 -0800)]
ovs-atomic: New functions atomic_flag_init(), atomic_flag_destroy().

Standard C11 doesn't need these functions because it is able to require
implementations not to need them.  But we can't construct a portable
implementation that does not need them in every case, so this commit adds
them.

These functions are only needed for atomic_flag objects that are
dynamically allocated (because statically allocated objects can use
ATOMIC_FLAG_INIT).  So far there aren't any of those, but an upcoming
commit will introduce one.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agodpif-netdev: Remove max_mtu tracking.
Ben Pfaff [Mon, 23 Dec 2013 23:46:22 +0000 (15:46 -0800)]
dpif-netdev: Remove max_mtu tracking.

Normally all the ports have the same mtu anyhow, so there is little
advantage in keeping track of the maximum mtu on a per-bridge basis.  In
upcoming commits, tracking mtu will require more locking and present
even less advantage (because the packet buffer will become per-thread, so
that reallocating once per thread becomes essentially a null cost).

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agodpif-netdev: Use hmap instead of list+array for tracking ports.
Ben Pfaff [Wed, 25 Dec 2013 00:08:57 +0000 (16:08 -0800)]
dpif-netdev: Use hmap instead of list+array for tracking ports.

The goal is to make it easy to divide the ports into groups for handling
by threads.  It seems easy enough to do that by hash value, and a little
harder otherwise.

This commit has the side effect of raising the maximum number of ports from
256 to UINT32_MAX-1.  That is why some tests need to be updated:
previously, internally generated port names like "ovs_vxlan_4341" were
ignored because 4341 is bigger than the previous limit of 256.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agodpif-netdev: Use new "ovsthread_counter" to track dp statistics.
Ben Pfaff [Mon, 23 Dec 2013 22:04:13 +0000 (14:04 -0800)]
dpif-netdev: Use new "ovsthread_counter" to track dp statistics.

ovsthread_counter is an abstract interface that could be implemented
different ways.  The initial implementation is simple but less than
optimally efficient.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif: Remove unused 'get_max_ports' from provider interface.
Ben Pfaff [Mon, 23 Dec 2013 22:34:01 +0000 (14:34 -0800)]
dpif: Remove unused 'get_max_ports' from provider interface.

Nothing ever called this function.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agonetdev-dummy: Make netdev_rx_wait() wakeups work cross-thread for dummies.
Ben Pfaff [Thu, 26 Dec 2013 06:27:25 +0000 (22:27 -0800)]
netdev-dummy: Make netdev_rx_wait() wakeups work cross-thread for dummies.

Until now, netdev_dummy_rx_wait() has only checked whether the receive
queue for the dummy device is currently empty.  This has worked OK because
in practice packets were queued to dummy devices only from the same thread
that attempted to receive them.  An upcoming commit will use different
threads for these purposes, so this commit switches to a notification
method that works cross-thread.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agonetdev-dummy: Remove unused member 'listening' from struct netdev_dummy.
Ben Pfaff [Thu, 26 Dec 2013 01:15:20 +0000 (17:15 -0800)]
netdev-dummy: Remove unused member 'listening' from struct netdev_dummy.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif-upcall: Slightly simplify udpif_upcall_handler().
Ben Pfaff [Sat, 28 Dec 2013 00:29:24 +0000 (16:29 -0800)]
ofproto-dpif-upcall: Slightly simplify udpif_upcall_handler().

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto/trace: Show megaflow fields in each resubmit.
Alex Wang [Thu, 9 Jan 2014 00:52:15 +0000 (16:52 -0800)]
ofproto/trace: Show megaflow fields in each resubmit.

This commit makes the ofproto/trace show the megaflow fields
for each resubmit.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto/trace: Change output field name.
Alex Wang [Thu, 9 Jan 2014 00:52:14 +0000 (16:52 -0800)]
ofproto/trace: Change output field name.

This commit changes the output field name from "Relevant fields"
to "Megaflow".

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto/trace: Remove the unused variables.
Alex Wang [Thu, 9 Jan 2014 00:52:13 +0000 (16:52 -0800)]
ofproto/trace: Remove the unused variables.

This commit removes the unused variables in ofproto_trace() function.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto/trace: Use final flow to compute "Relevant fields".
Alex Wang [Thu, 9 Jan 2014 00:52:12 +0000 (16:52 -0800)]
ofproto/trace: Use final flow to compute "Relevant fields".

Commit bcd2633a (ofproto-dpif: Store relevant fields for wildcarding
in facet.) introduced the bug that uses original input flow as final
flow to compute the "Relevant fields" in ofproto/trace ouput.  This
commit fixes this bug.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoutilities: Wrong command syntax in ovs-vsctl manpage.
Daniele Venturino [Thu, 9 Jan 2014 00:03:07 +0000 (16:03 -0800)]
utilities: Wrong command syntax in ovs-vsctl manpage.

The command shown in the man page to disable the STP protocol on a bridge
is:

        ovs-vsctl clear Bridge br0 stp_enable

Calling that, the following warning message is returned:

        ovs-vsctl: "clear" operation cannot be applied to column stp_enable
        of table Bridge, which is not allowed to be empty

It seems correct to use the command:

        ovs-vsctl set Bridge br0 stp_enable=false

Signed-off-by: Daniele Venturino <daniele.venturino@m3s.it>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Use kmem_cache_free() instead of kfree()
Wei Yongjun [Wed, 8 Jan 2014 14:07:52 +0000 (06:07 -0800)]
datapath: Use kmem_cache_free() instead of kfree()

memory allocated by kmem_cache_alloc() should be freed using
kmem_cache_free(), not kfree().

Fixes: e298e5057006 ('openvswitch: Per cpu flow stats.')
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoFix !HAVE_NETLINK build
YAMAMOTO Takashi [Wed, 8 Jan 2014 06:07:30 +0000 (15:07 +0900)]
Fix !HAVE_NETLINK build

Fix a regression introduced by commit 4b97b70d
("ofproto-dpif: Enable NXAST_SAMPLE only if the datapath supports it.")

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Fix a vlan-splinter megaflow bug
Andy Zhou [Tue, 7 Jan 2014 08:17:25 +0000 (00:17 -0800)]
ofproto-dpif: Fix a vlan-splinter megaflow bug

When vlan-splinter is enabled, ovs receives non-vlan flows from the
kernel vlan ports, vlan tag is then added to the incoming flow before
xlating, so that they look like those received from a trunk port.

In case megaflow is enabled, xlating may set vlan masks during rule
processing as usual. If those vlan masks were serialized and downloaded
to the kernel (this bug), those mega flows will be rejected due to
unexpected vlan mask encapsulation, since the original kernel flows do
not have vlan tags. This bug does not break connectivity, but impacts
performance since all traffic received on vlan splinter ports will now
be handled by vswitchd, as no datapath flows can be successfully
installed.

This fix is to make sure no vlan mask encapsulation is generated for
the datapath flow if its in_port was re-written by vlan-splinter
receiving logic.

Bug #22567

Signed-off-by: Andy Zhou <azhou@nicira.com>
10 years agonetdev: Update rx_recv documentation for NULL case
Simon Horman [Tue, 7 Jan 2014 05:33:37 +0000 (14:33 +0900)]
netdev: Update rx_recv documentation for NULL case

Replace truncated description of when rx_recv() may be NULL
with text used for other fields of netdev_class.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-xlate: Correct check for MPLS LSE
Simon Horman [Tue, 7 Jan 2014 04:48:08 +0000 (13:48 +0900)]
ofproto-dpif-xlate: Correct check for MPLS LSE

zero is a valid MPLS LSE so it is not valid check against
that value for MPLS LSE presence. Instead, check against
the flow's dl_type which should be an MPLS type if an LSE is present.

This problem appears to have been introduced by
b2dd70be133bf86c ("Native Set-Field action.").

Cc: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Check for backported sctp_compute_cksum().
Jesse Gross [Fri, 3 Jan 2014 23:44:28 +0000 (15:44 -0800)]
datapath: Check for backported sctp_compute_cksum().

This is backported by RHEL7.

Reported-by: Ashok Byahatti <ashok.byahatti@embrane.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agoFAQ: Add entry on GRE module conflicts.
Jesse Gross [Fri, 3 Jan 2014 17:31:38 +0000 (09:31 -0800)]
FAQ: Add entry on GRE module conflicts.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
10 years agoodp-util: Simplify logic in odp_flow_key_to_flow__().
Ben Pfaff [Tue, 31 Dec 2013 18:36:19 +0000 (10:36 -0800)]
odp-util: Simplify logic in odp_flow_key_to_flow__().

Simplify (a && b) || (!a && c) to just a ? b : c.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoodp-util: Avoid null dereference in parse_8021q_onward().
Ben Pfaff [Tue, 31 Dec 2013 19:32:16 +0000 (11:32 -0800)]
odp-util: Avoid null dereference in parse_8021q_onward().

For parsing a mask, this code in parse_8021q_onward() always read out
the OVS_KEY_ATTR_VLAN attribute without first checking whether it existed.
The correct behavior, implemented by this commit, appears to be treating
the VLAN as wildcarded and to continue parsing the flow.

Bug #22312.
Reported-by: Krishna Miriyala <miriyalak@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
10 years agodpif: Use explicit packet metadata.
Jarno Rajahalme [Mon, 30 Dec 2013 23:58:58 +0000 (15:58 -0800)]
dpif: Use explicit packet metadata.

This helps reduce confusion about when a flow is a flow and when it is
just metadata.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoodp-execute: Consolidate callbacks.
Jarno Rajahalme [Mon, 30 Dec 2013 23:58:58 +0000 (15:58 -0800)]
odp-execute: Consolidate callbacks.

Use one callback instead of many, helps in adding new functionality
later on.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agotests: Make some tests more robust.
Jarno Rajahalme [Mon, 30 Dec 2013 23:42:36 +0000 (15:42 -0800)]
tests: Make some tests more robust.

These tests break if OVS internal hash function is changed.  Some of
this is due to dependency on the order in which elements are iterated
from hash maps, or the algorithm used is just dependent on the
specific hash values produced for specific inputs (groups).  These
changes make these test cases more robust, so that they will not break
so easily due to OVS internal hash function implementation changes.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agobfd: Make bfd decay test robust.
Alex Wang [Mon, 30 Dec 2013 23:15:52 +0000 (15:15 -0800)]
bfd: Make bfd decay test robust.

With ovs multithreading implementation, the bfd decay test
becomes fragile due to its high dependency on timing sequence.
This commit removes these dependencies and makes the test robust.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Enable NXAST_SAMPLE only if the datapath supports it.
Ben Pfaff [Mon, 30 Dec 2013 22:49:25 +0000 (14:49 -0800)]
ofproto-dpif: Enable NXAST_SAMPLE only if the datapath supports it.

This prevents using an older datapath from breaking forwarding.

CC: Romain Lenglet <rlenglet@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobridge: Fix reversed string parsing in bridge_configure_flow_miss_model().
Alex Wang [Mon, 30 Dec 2013 22:21:40 +0000 (14:21 -0800)]
bridge: Fix reversed string parsing in bridge_configure_flow_miss_model().

This commit fixes a command matching error introduced by commit
7155fa52f (ofproto-dpif: Add 'force-miss-model' configuration).

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoconnmgr: Log when a packet-in is dropped due to queue overflow.
Ben Pfaff [Thu, 5 Dec 2013 17:21:14 +0000 (09:21 -0800)]
connmgr: Log when a packet-in is dropped due to queue overflow.

Reported-by: Anton Matsiuk <anton.matsiuk@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-linux: Simplify get_stats_via_netlink().
Ben Pfaff [Wed, 4 Dec 2013 23:46:55 +0000 (15:46 -0800)]
netdev-linux: Simplify get_stats_via_netlink().

There's no need to obtain the ifindex, because RTM_GETLINK is happy to take
the interface name.  There's no need to do a full nl_policy_parse(),
because we only need a single attribute.

Signed-off-by: Ben Pfaff <blp@nicira.com>