cascardo/ovs.git
10 years agoovs-check-dead-ifs: Flush buffer before calling execvp.
Gurucharan Shetty [Fri, 20 Dec 2013 17:30:21 +0000 (09:30 -0800)]
ovs-check-dead-ifs: Flush buffer before calling execvp.

According to Python documentation here for execvp:
http://docs.python.org/2/library/os.html
"The current process is replaced immediately. Open file objects
and descriptors are not flushed, so if there may be data buffered
on these open files, you should flush them using sys.stdout.flush()
or os.fsync() before calling an exec* function.

Without the flush, we will miss the print statements before that
if we redirect the o/p to a file.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-print: Print durations with at least three decimals.
Ben Pfaff [Fri, 20 Dec 2013 16:39:27 +0000 (08:39 -0800)]
ofp-print: Print durations with at least three decimals.

Occasionally I run a command like this:
    watch -n.1 ovs-ofctl dump-flows br0
to see how flows change over time.  Until now, it has been more difficult
than necessary to spot real changes, because flows "jump around" as the
number of decimals printed for duration changes from moment to moment.
That is, you might see
    cookie=0x0, duration=4.566s, table=0, n_packets=0, ...
one moment, and then
    cookie=0x0, duration=4.8s, table=0, n_packets=0, ...
the next moment.  Shortening 4.8 to 4.800 shifts everything following it
two places to the left, creating a visual jump.

This commit avoids that problem by always printing at least three decimals
if we print any.  There can still be an occasional jump if a duration is
exactly on a second boundary, but that only happens 1/1000 of the time.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agolib/flow: Skip minimask value checks.
Jarno Rajahalme [Fri, 20 Dec 2013 16:16:31 +0000 (08:16 -0800)]
lib/flow: Skip minimask value checks.

We allow zero 'values' in a miniflow for it to have the same map
as the corresponding minimask.  Minimasks themselves never have
zero data values, though.  Document this and optimize the code
accordingly.

v2:
- Made miniflow_get_map_in_range() to return data offset instead of
  a pointer via the last parameter.
- Simplified minimatch_hash_in_range() by removing pointer arithmetic.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agotests/learn.at: Workaround a race
YAMAMOTO Takashi [Fri, 20 Dec 2013 10:31:06 +0000 (19:31 +0900)]
tests/learn.at: Workaround a race

This test seems to assume that the switch completes
processing of the first packet before start processing
the second one.  I don't see any code ensuring that.
Workaround the problem by giving 1 second for the upcall.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotimeval: Workaround for threaded test failures
YAMAMOTO Takashi [Fri, 20 Dec 2013 10:31:05 +0000 (19:31 +0900)]
timeval: Workaround for threaded test failures

BFD tests have the code like the following.

    # wait for a while to stablize everything.
    for i in `seq 0 9`; do ovs-appctl time/warp 500; done

They no longer work as intended because BFD code is run in a
separate monitor thread these days.  The loop merely "warp"
the time by 5000.  The monitor thread should have been woken
at least once, but it's far from "wait for a while to stablize
everything."

This commit mitigates the problem by sleeping a little in the
appctl handler.  This is not ideal but makes BFD tests success
on my environment.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests/ofproto-dpif.at: Workaround a race
YAMAMOTO Takashi [Fri, 20 Dec 2013 10:31:04 +0000 (19:31 +0900)]
tests/ofproto-dpif.at: Workaround a race

This test seems to assume only the first packets in flows
counted as 'miss'.  I don't see any code ensuring that.
The test would fail if the upcall handler for the flow doesn't
run fast enough.  Workaround the problem by giving 1 second
for the miss upcall.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-upcall: Reduce log level of "Spent unreasonably long" msg
YAMAMOTO Takashi [Fri, 20 Dec 2013 10:31:03 +0000 (19:31 +0900)]
ofproto-dpif-upcall: Reduce log level of "Spent unreasonably long" msg

This message can be caused by a time warp and make tests fail.

The message was introduced by commit e79a6c83.
("ofproto: Handle flow installation and eviction in upcall.")

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests/ofproto.at: Avoid stdout/stderr ordering assumptions
YAMAMOTO Takashi [Fri, 20 Dec 2013 10:31:02 +0000 (19:31 +0900)]
tests/ofproto.at: Avoid stdout/stderr ordering assumptions

Stop assuming the order of outputs from separate streams.
(stdout and stderr)

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests/ofproto-dpif.at: Portability improvement
YAMAMOTO Takashi [Fri, 20 Dec 2013 10:31:01 +0000 (19:31 +0900)]
tests/ofproto-dpif.at: Portability improvement

The output of "wc -l" have leading spaces on some platforms.
(NetBSD, OSX, ...)

This fixes a test failure introduced by commit e79a6c83.
("ofproto: Handle flow installation and eviction in upcall.")

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotests/daemon-py.at: Skip if no python
YAMAMOTO Takashi [Fri, 20 Dec 2013 10:31:00 +0000 (19:31 +0900)]
tests/daemon-py.at: Skip if no python

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years ago.gitignore: add /libtool
Lorand Jakab [Fri, 20 Dec 2013 10:46:53 +0000 (12:46 +0200)]
.gitignore: add /libtool

The ./configure script now generates a 'libtool' file in the top-level
directory.  Add it to .gitignore

Signed-off-by: Lorand Jakab <lojakab@cisco.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Handle flow installation and eviction in upcall.
Ethan Jackson [Tue, 24 Sep 2013 20:39:56 +0000 (13:39 -0700)]
ofproto: Handle flow installation and eviction in upcall.

This patch moves flow installation and eviction from ofproto-dpif and
the main thread, into ofproto-dpif-upcall.  This performs
significantly better (approximately 2x TCP_CRR improvement), and
allows ovs-vswitchd to maintain significantly larger datapath flow
tables.  On top of that, it significantly simplifies the code,
retiring "struct facet" and friends.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agounixctl: Make dpif/dump-flows fetch kernel flows.
Joe Stringer [Wed, 20 Nov 2013 22:25:43 +0000 (14:25 -0800)]
unixctl: Make dpif/dump-flows fetch kernel flows.

Previously we used facets for ovs-appctl dpif/dump-flows commands.
This switches to fetching flows directly from the dpif.  This is
necessary because future patches remove facets and subfacet entirely.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Fix build failure on RHEL 6.4
Pravin B Shelar [Wed, 18 Dec 2013 18:57:33 +0000 (10:57 -0800)]
datapath: Fix build failure on RHEL 6.4

Patch fixes following build failure:-

make[4]: Entering directory
`/usr/src/kernels/2.6.32-358.18.1.el6.x86_64'
  CC [M]  openvswitch/datapath/linux/actions.o
In file included from
openvswitch/datapath/linux/actions.c:21:
openvswitch/datapath/linux/compat/include/linux/skbuff.h:273:
error: redefinition of â€˜__skb_fill_page_desc’
include/linux/skbuff.h:1123: note: previous definition of
‘__skb_fill_page_desc’ was here
-----

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agoentropy: Add Windows support.
Alin Serdean [Thu, 19 Dec 2013 17:20:17 +0000 (09:20 -0800)]
entropy: Add Windows support.

Signed-off-by: Alin Serdean <aserdean at cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoxenserver: Fix build failures because of libraries in /usr/lib.
Gurucharan Shetty [Thu, 19 Dec 2013 05:35:09 +0000 (21:35 -0800)]
xenserver: Fix build failures because of libraries in /usr/lib.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Fix deadlock during stats update.
Pravin B Shelar [Tue, 17 Dec 2013 23:43:30 +0000 (15:43 -0800)]
datapath: Fix deadlock during stats update.

Stats-read needs to lock stats but same lock is taken in stats
update in irq context. Therefore it needs to disable irq to
avoid following deadlock :-

BUG: soft lockup - CPU#1 stuck for 23s! [ovs-vswitchd:1425]
CPU 1
Pid: 1425, comm: ovs-vswitchd Tainted: G           O 3.2.39-server-nn23 #1 VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform
RIP: 0010:[<ffffffff8103db22>]  [<ffffffff8103db22>] __ticket_spin_lock+0x22/0x30
RSP: 0018:ffff88003fd03b30  EFLAGS: 00000297
RAX: 0000000000000001 RBX: 0000000000000000 RCX: 0000000000000050
RDX: 0000000000000002 RSI: ffff88003d0a9900 RDI: ffff88003ae19598
RBP: ffff88003fd03b30 R08: 0000000000000000 R09: ffff88003ad44048
R10: 0000000000000001 R11: 0000000000000001 R12: ffff88003fd03aa8
R13: ffffffff8164e5de R14: ffff88003fd03b30 R15: ffff88003ae19580
FS:  00007ffb0b428940(0000) GS:ffff88003fd00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f3c0ef94000 CR3: 00000000250e2000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process ovs-vswitchd (pid: 1425, threadinfo ffff88002514a000, task ffff8800250aae00)
Stack:
 ffff88003fd03b40 ffffffff8164596e ffff88003fd03b70 ffffffffa027622d
 ffff88003d0a9900 ffffe8ffffd03800 ffff8800297f5a80 ffff88003fd03ba8
 ffff88003fd03c60 ffffffffa02759af ffff88003fd03de0 ffff88003fd03e4c
Call Trace:
 <IRQ>
 [<ffffffff8164596e>] _raw_spin_lock+0xe/0x20
 [<ffffffffa027622d>] ovs_flow_stats_update+0x5d/0x100 [openvswitch]
 [<ffffffffa02759af>] ovs_dp_process_received_packet+0x8f/0x130 [openvswitch]
 [<ffffffffa027c0ca>] ovs_vport_receive+0x2a/0x30 [openvswitch]
 [<ffffffffa027db18>] netdev_frame_hook+0xb8/0x120 [openvswitch]
 [<ffffffffa027da60>] ? free_port_rcu+0x30/0x30 [openvswitch]
 [<ffffffff81539318>] __netif_receive_skb+0x1c8/0x620
 [<ffffffff8153a4c0>] netif_receive_skb+0x80/0x90
 [<ffffffff8115f14c>] ? ksize+0x1c/0xc0
 [<ffffffff8153a610>] napi_skb_finish+0x50/0x70
 [<ffffffff8153ac15>] napi_gro_receive+0xf5/0x140
 [<ffffffffa00368ae>] vmxnet3_rq_rx_complete+0x51e/0x7c0 [vmxnet3]
 [<ffffffff8101ac90>] ? nommu_map_sg+0xe0/0xe0
 [<ffffffffa0036da5>] vmxnet3_poll_rx_only+0x45/0xc0 [vmxnet3]
 [<ffffffff8153ae64>] net_rx_action+0x134/0x290
 [<ffffffff8103db0d>] ? __ticket_spin_lock+0xd/0x30
 [<ffffffff8106e1a8>] __do_softirq+0xa8/0x210
 [<ffffffff8164596e>] ? _raw_spin_lock+0xe/0x20
 [<ffffffff8164fd6c>] call_softirq+0x1c/0x30
 [<ffffffff81016215>] do_softirq+0x65/0xa0
 [<ffffffff8106e58e>] irq_exit+0x8e/0xb0
 [<ffffffff81650633>] do_IRQ+0x63/0xe0
 [<ffffffff81645e2e>] common_interrupt+0x6e/0x6e

-----------
Bug #21853
Reported-by: Pawan Shukla <shuklap@vmware.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agoofproto-dpif: Get rid of mirror_mask_ffs() function.
Ben Pfaff [Wed, 18 Dec 2013 17:20:49 +0000 (09:20 -0800)]
ofproto-dpif: Get rid of mirror_mask_ffs() function.

There's no need for it because we have the equivalent (actually more
convenient) function raw_ctz(), which works with any integer type.

Signed-off-by: Ben Pfaff <blp@nicira.com>
CC: Alin Serdean <aserdean@cloudbasesolutions.com>
CC: Gurucharan Shetty <shettyg@nicira.com>
10 years agorhel: Fix build failures because of libraries in /usr/lib.
Gurucharan Shetty [Wed, 18 Dec 2013 17:05:40 +0000 (09:05 -0800)]
rhel: Fix build failures because of libraries in /usr/lib.

Reported-by: Igor Sever <igor@xorops.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-tcpdump: Fix tcpdump patch breakage due to libtool.
Ben Pfaff [Wed, 18 Dec 2013 21:47:16 +0000 (13:47 -0800)]
ofp-tcpdump: Fix tcpdump patch breakage due to libtool.

The recently introduced use of libtool, in commit 38b7a52b618b98
(openvswitch: Use libtool and allow building shared libs) broke the
tcpdump patch.  This fixes the problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
10 years agoAUTHORS: update my entry
YAMAMOTO Takashi [Wed, 18 Dec 2013 08:21:23 +0000 (17:21 +0900)]
AUTHORS: update my entry

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-bsd: remove an unused variable
YAMAMOTO Takashi [Wed, 18 Dec 2013 08:16:15 +0000 (17:16 +0900)]
netdev-bsd: remove an unused variable

this is a leftover of commit da4a6191.
("netdev: Globally track port status changes")

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoINSTALL: Mention --enable-Werror.
Ben Pfaff [Wed, 18 Dec 2013 05:44:25 +0000 (21:44 -0800)]
INSTALL: Mention --enable-Werror.

I think that some developers haven't noticed this, but it's useful, so
mention it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoofproto: Add table config to struct ofproto
Simon Horman [Mon, 16 Dec 2013 08:53:22 +0000 (17:53 +0900)]
ofproto: Add table config to struct ofproto

Add table config to to struct ofproto and set it
when a table mod message is received.

This is in preparation for changing the behaviour of the switch
based on table config.

Cc: Andy Zhou <azhou@nicira.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Remove unnecessary parameters from dp_netdev_port_input()
Simon Horman [Wed, 27 Nov 2013 05:08:41 +0000 (14:08 +0900)]
dpif-netdev: Remove unnecessary parameters from dp_netdev_port_input()

The skb_priority, pkt_mark and tunl parameters of dp_netdev_port_input()
are always passed as 0, 0 and NULL respectively. So rather than
passing these values to dp_netdev_port_input() just use them directly.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoopenvswitch: Use libtool and allow building shared libs
Helmut Schaa [Fri, 13 Dec 2013 17:54:28 +0000 (18:54 +0100)]
openvswitch: Use libtool and allow building shared libs

Currently openvswitch builds all libraries static only. However,
libopenvswitch is linked into nearly all openvswitch executables
making it hardly possible to run openvswitch on embedded devices
(for example running OpenWrt).

Convert openvswitch to use libtool for building its internal libs.
This allows "--enable-shared" and "--enable-static" as configure
arguments. Default is "--disable-shared" thus keeping the current
behavior with the only change that static libs are installed by
"make install".

Since the openvswitch library interfaces are internal and thus not
stable (yet) encode the openvswitch version into the library name:
libopenvswitch-2.0.90.so

Binary size is reduced to around 1/3 when using shared libs.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agocfm: Add test for fault_override
Joe Stringer [Mon, 16 Dec 2013 18:08:08 +0000 (10:08 -0800)]
cfm: Add test for fault_override

This patch adds tests for the cfm fault_override feature which can be
set through "ovs-appctl cfm/set-fault <port> <value>". It brings up two
ports with CFM, sets a fault, then checks that the fault status has
propagated correctly to the CFM module and the database. Finally, it
sets the fault override behaviour to normal and checks that the fault
has gone away.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoDo not free uninitialized packets.
Jarno Rajahalme [Tue, 17 Dec 2013 23:54:30 +0000 (15:54 -0800)]
Do not free uninitialized packets.

Commit da546e0 (dpif: Allow execute to modify the packet.) uninitializes
the "dpif_upcall.packet" of "struct upcall" when dpif_recv() returns error.
The packet ofpbuf is likely uninitialized in this case, hence calling
ofpbuf_uninit() on it will likely cause a SEGFAULT.

This commit fixes this bug by only uninitializing packet's ofpbuf on
successfully received upcalls.

A note warning about this is added on the comment of dpif_recv() in
dpif.c and dpif-provider.h.

Reported-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoRemove unnecessary memset().
Jarno Rajahalme [Tue, 17 Dec 2013 23:54:30 +0000 (15:54 -0800)]
Remove unnecessary memset().

We already set all the fields of the upcall, so memsetting right before
is unnecessary.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-monitor: Acquire write lock in monitor_run().
Alex Wang [Fri, 13 Dec 2013 19:29:09 +0000 (11:29 -0800)]
ofproto-dpif-monitor: Acquire write lock in monitor_run().

Commit 307464a1 (ofproto-dpif-monitor: Use heap to order the mport
wakeup time.) re-heapifies the heap in monitor_run().  So the
monitor_run() should be protected by the write lock, rather than
the read lock.

This commit fixes the issue.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-linux: Do not call nl_sock_pid() on NULL sock pointer.
Alex Wang [Tue, 17 Dec 2013 22:37:10 +0000 (14:37 -0800)]
dpif-linux: Do not call nl_sock_pid() on NULL sock pointer.

This commit adds check of sock pointer in dpif_linux_port_get_pid().
If the pointer is NULL, do not call nl_sock_pid().

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-linux: Fix the return type of dpif_linux_port_dump_next__().
Alex Wang [Tue, 17 Dec 2013 22:37:09 +0000 (14:37 -0800)]
dpif-linux: Fix the return type of dpif_linux_port_dump_next__().

Commit 222837 (dpif-linux: Factor out port dumping helper functions.)
introduced a bug by making dpif_linux_port_dump_next__() return 'bool'
instead of 'int' as defined in dpif-provider.h.  This bug causes ovs-
vswitchd failure with SEGFAULT when processing slow-path packet.

This commit fixes the bug by following the dpif-provider specification.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoRemove stream, vconn, and rconn functions to get local/remote IPs/ports.
Ben Pfaff [Tue, 17 Dec 2013 23:07:12 +0000 (15:07 -0800)]
Remove stream, vconn, and rconn functions to get local/remote IPs/ports.

These functions don't have any ultimate users.  The in-band control code
used to use them, but not anymore, so we might as well delete them all.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agodatapath: make functions local
Stephen Hemminger [Tue, 17 Dec 2013 22:57:46 +0000 (14:57 -0800)]
datapath: make functions local

Several functions and datastructures could be local
Found with 'make namespacecheck'

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agobfd: Set next_tx correctly when processing packets
Joe Stringer [Fri, 6 Dec 2013 20:22:07 +0000 (12:22 -0800)]
bfd: Set next_tx correctly when processing packets

In the case where we have not yet sent a control packet for a bfd
connection, and we receive a control packet from the remote host,
bfd->next_tx is updated to an unusual value. This causes the logging to
incorrectly report that there has been long delays (in the order of
weeks) since the last bfd transmission time.

This patch only modifies bfd->next_tx in this case if we are not
expecting to immediately send a control packet. This should mean that
bfd->next_tx is either 0 (immediate tx) or in the order of time_msec().

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolacp: Give LACP a moment to initialize before testing its state, in tests.
Ben Pfaff [Tue, 17 Dec 2013 22:14:52 +0000 (14:14 -0800)]
lacp: Give LACP a moment to initialize before testing its state, in tests.

These tests configured LACP and then immediately dumped out its state.
Most of the time, this worked, but there was a brief race window in which
the "negotiated" flag could be missing because this took one pass through
the main loop.  This fixes the problem.

This race may be seen in the failures of tests 11 and 12 here:
https://launchpadlibrarian.net/151884888/buildlog_ubuntu-precise-amd64.openvswitch_2.0~201309300804-1ppa1~precise_FAILEDTOBUILD.txt.gz

Reported-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agobridge: Let ofprotos run once before reporting configuration complete.
Ben Pfaff [Mon, 30 Sep 2013 20:07:35 +0000 (13:07 -0700)]
bridge: Let ofprotos run once before reporting configuration complete.

Occasionally in the unit tests the following race can happen:

   1. ovs-vsctl updates database
   2. ovs-vswitchd reconfigures, notifies ovs-vsctl that it is complete
   3. ovs-appctl ofproto/trace fails to see newly added port
   4. ovs-vswitchd main loop calls ofproto's ->type_run(), making the
      new port visible to translation.

This race may be seen in the failures of tests 5 and 624 here:
https://launchpadlibrarian.net/151884888/buildlog_ubuntu-precise-amd64.openvswitch_2.0~201309300804-1ppa1~precise_FAILEDTOBUILD.txt.gz

Reported-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-linux: fix the size of n_masks
Francesco Fusco [Tue, 17 Dec 2013 19:18:18 +0000 (20:18 +0100)]
dpif-linux: fix the size of n_masks

The command ovs-dpctl can wrongly output the masks even if the
datapath does not implement mega flows. In this case the output
will be similar to the following:

system@ovs-system:
lookups: hit:14 missed:41 lost:0
flows: 0
masks: hit:18446744073709551615 total:4294967295
hit/pkt:335395346794719104.00
port 0: ovs-system (internal)
port 1: gre_system (gre: df_default=false, ttl=0)
port 2: ots-br0 (internal)
port 3: int0 (internal)
port 4: vnet0
port 5: vnet1

The problem depends on the fact that n_masks stats is stored as a
uint32 in the struct ovs_dp_megaflow_stats and as a uint64 in the
struct dpif_dp_stats. UINT32_MAX instead of UINT64_MAX should be
used to detect if the datapath supports megaflows or not.

Signed-off-by: Francesco Fusco <ffusco@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoRename NOT_REACHED to OVS_NOT_REACHED
Harold Lim [Tue, 17 Dec 2013 18:32:12 +0000 (10:32 -0800)]
Rename NOT_REACHED to OVS_NOT_REACHED

This allows other libraries to use util.h that has already
defined NOT_REACHED.

Signed-off-by: Harold Lim <haroldl@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoUpdate openvswitch to allow linking from C++ projects
Harold Lim [Tue, 17 Dec 2013 18:32:11 +0000 (10:32 -0800)]
Update openvswitch to allow linking from C++ projects

The input variable of ovs_scan is changed from 'template' to
'format'. template is a keyword in C++.

Signed-off-by: Harold Lim <haroldl@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agovtep: add "Arp_sources" tables
Bruce Davie [Mon, 25 Nov 2013 16:19:50 +0000 (08:19 -0800)]
vtep: add "Arp_sources" tables

Add two new tables to the VTEP schema in support of distributed L3.
Each table contains MAC addresses to be used by VTEPs (both hardware
and software) when issuing ARP requests on behalf of a logical router.

Signed-off-by: Bruce Davie <bdavie@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoFAQ: Reference 2.0, not 1.12.
Justin Pettit [Tue, 17 Dec 2013 20:50:50 +0000 (12:50 -0800)]
FAQ: Reference 2.0, not 1.12.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoFAQ: Update to reflect that tunneling is now in upstream Linux.
Jesse Gross [Tue, 17 Dec 2013 18:49:26 +0000 (10:49 -0800)]
FAQ: Update to reflect that tunneling is now in upstream Linux.

Reported-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: pritesh <pritesh.kothari@cisco.com>
10 years agodpif-linux: Fix a bug.
Alex Wang [Tue, 17 Dec 2013 16:16:24 +0000 (16:16 +0000)]
dpif-linux: Fix a bug.

Commit da546e0 (dpif: Allow execute to modify the packet.) introduced
a bug by subtracting the zero-value ofpbuf size by "sizeof(struct
nlattr)" and assigning the result back to the ofpbuf size.  This bug
causes the ovs-assert failure in facet_push_stats().

This commit fixes the bug by assigning the right value to the ofpbuf
size.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agorconn: Update comments on is_admitted_msg().
Ben Pfaff [Thu, 21 Nov 2013 23:03:23 +0000 (15:03 -0800)]
rconn: Update comments on is_admitted_msg().

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoFAQ: Explain how to add QoS features to Open vSwitch.
Ben Pfaff [Fri, 22 Nov 2013 01:03:13 +0000 (17:03 -0800)]
FAQ: Explain how to add QoS features to Open vSwitch.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoFAQ: Describe weak and strong ES models.
Ben Pfaff [Tue, 17 Dec 2013 06:19:08 +0000 (22:19 -0800)]
FAQ: Describe weak and strong ES models.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agodatapath: Handle different definitions of page in skb_frag_t.
Jesse Gross [Tue, 17 Dec 2013 05:03:09 +0000 (21:03 -0800)]
datapath: Handle different definitions of page in skb_frag_t.

Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Add hash library to .gitignore.
Jesse Gross [Tue, 17 Dec 2013 02:10:40 +0000 (18:10 -0800)]
datapath: Add hash library to .gitignore.

Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Backport __skb_fill_page_desc
Jesse Gross [Tue, 17 Dec 2013 02:07:16 +0000 (18:07 -0800)]
datapath: Backport __skb_fill_page_desc

Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Backport skb_has_frag_list().
Jesse Gross [Tue, 17 Dec 2013 02:05:01 +0000 (18:05 -0800)]
datapath: Backport skb_has_frag_list().

Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Backport skb_frag_ functions
Pravin B Shelar [Sun, 3 Mar 2013 07:53:52 +0000 (23:53 -0800)]
datapath: Backport skb_frag_ functions

Define accessors skb_frag_* functions whch were introduced in 3.2

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
10 years agodatapath: Add missing #include for skb page accessors.
Jesse Gross [Tue, 31 Jan 2012 21:15:30 +0000 (13:15 -0800)]
datapath: Add missing #include for skb page accessors.

Reported-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Compute checksum in skb_gso_segment() if needed
Thomas Graf [Tue, 17 Dec 2013 01:03:45 +0000 (17:03 -0800)]
datapath: Compute checksum in skb_gso_segment() if needed

The copy & csum optimization is no longer present with zerocopy
enabled. Compute the checksum in skb_gso_segment() directly by
dropping the HW CSUM capability from the features passed in.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Use skb_zerocopy() for upcall
Thomas Graf [Tue, 17 Dec 2013 00:56:03 +0000 (16:56 -0800)]
datapath: Use skb_zerocopy() for upcall

Use of skb_zerocopy() can avoid the expensive call to memcpy()
when copying the packet data into the Netlink skb. Completes
checksum through skb_checksum_help() if not already done in
GSO segmentation.

Zerocopy is only performed if user space supported unaligned
Netlink messages. memory mapped netlink i/o is preferred over
zerocopy if it is set up.

Cost of upcall is significantly reduced from:
+   7.48%       vhost-8471  [k] memcpy
+   5.57%     ovs-vswitchd  [k] memcpy
+   2.81%       vhost-8471  [k] csum_partial_copy_generic

to:
+   5.72%     ovs-vswitchd  [k] memcpy
+   3.32%       vhost-5153  [k] memcpy
+   0.68%       vhost-5153  [k] skb_zerocopy

(megaflows disabled)

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Pass datapath into userspace queue functions
Thomas Graf [Tue, 17 Dec 2013 00:51:07 +0000 (16:51 -0800)]
datapath: Pass datapath into userspace queue functions

Allows removing the net and dp_ifindex argument and simplify the
code.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Drop user features if old user space attempted to create datapath
Thomas Graf [Wed, 4 Dec 2013 04:56:22 +0000 (20:56 -0800)]
datapath: Drop user features if old user space attempted to create datapath

Drop user features if an outdated user space instance that does not
understand the concept of user_features attempted to create a new
datapath.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Reviewed-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Allow user space to announce ability to accept unaligned Netlink messages
Thomas Graf [Wed, 4 Dec 2013 04:47:24 +0000 (20:47 -0800)]
datapath: Allow user space to announce ability to accept unaligned Netlink messages

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Reviewed-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Backport skb_zerocopy() functions.
Jesse Gross [Wed, 4 Dec 2013 04:41:15 +0000 (20:41 -0800)]
datapath: Backport skb_zerocopy() functions.

These functions will be factored out and exported upstream. On
kernels 3.5 and newer the backport will provide zero copy support
but older kernels will work as before (due to lack of skb->head_frag).

Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoofproto/trace: Fix memory leak on error path.
Jarno Rajahalme [Mon, 16 Dec 2013 23:03:38 +0000 (15:03 -0800)]
ofproto/trace: Fix memory leak on error path.

Propagate error response from parse_ofp_exact_flow() to the caller and
properly free() it afterward.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: use CRC32 accelerated flow hash if available
Francesco Fusco [Mon, 16 Dec 2013 09:22:43 +0000 (01:22 -0800)]
datapath: use CRC32 accelerated flow hash if available

Currently OVS uses jhash2() for calculating flow hashes in its
internal flow_hash() function. The performance of the flow_hash()
function is critical, as the input data can be hundreds of bytes
long.

OVS is largely deployed in x86_64 based datacenters.  Therefore,
we argue that the performance critical fast path of OVS should
exploit underlying CPU features in order to reduce the per packet
processing costs. We replace jhash2 with the hash implementation
provided by the kernel hash lib, which exploits the crc32l
instruction to achieve high performance

Our patch greatly reduces the hash footprint from ~200 cycles of
jhash2() to around ~90 cycles in case of ovs_flow_hash_crc()
(measured with rdtsc over maximum length flow keys on an i7 Intel
CPU).

Additionally, we wrote a microbenchmark to stress the flow table
performance. The benchmark inserts random flows into the flow
hash and then performs lookups. Our hash deployed on a CRC32
capable CPU reduces the lookup for 1000 flows, 100 masks from
~10,100us to ~6,700us, for example.

Thus, simply use the newly introduced arch_fast_hash2() as a
drop-in replacement.

Signed-off-by: Francesco Fusco <ffusco@redhat.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Backport for architecture hash library.
Jesse Gross [Mon, 16 Dec 2013 08:44:05 +0000 (00:44 -0800)]
datapath: Backport for architecture hash library.

The architecture-specific hash library automatically selects either
jhash or CRC32 if it is available on the current processor.

Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: remove duplicated include from flow_table.c
Wei Yongjun [Mon, 16 Dec 2013 08:46:04 +0000 (00:46 -0800)]
datapath: remove duplicated include from flow_table.c

Remove duplicated include.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoconnmgr: Fix attempt to take mutex recursively when exiting fail-open.
Ben Pfaff [Mon, 16 Dec 2013 18:58:29 +0000 (10:58 -0800)]
connmgr: Fix attempt to take mutex recursively when exiting fail-open.

If one configured a controller which does not exist, waited for the switch
to enter fail-open mode, and then deleted the controller, then
ofproto_set_controllers() would take ofproto_mutex and call
update_fail_open(), which would call fail_open_destroy(), which would call
fail_open_recover(), which would call ofproto_delete_flow(), which requires
ofproto_mutex not to be held since it eventually try to take it.  This
caused OVS to abort.

This fixes the problem by releasing ofproto_mutex earlier, since nothing
seems to require it being held so long (a comment in
connmgr_set_controllers() says that this is likely to be the case).

Better annotations would have found this problem at compile time.  A later
patch adds them.

Reported-by: ZhengLingyun <konghuarukhr@163.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agobridge: Remove superfluous "inline" from ofp12_controller_role_to_str().
Ben Pfaff [Mon, 16 Dec 2013 17:20:12 +0000 (09:20 -0800)]
bridge: Remove superfluous "inline" from ofp12_controller_role_to_str().

Putting "static inline" on a function definition in a .c file does not help
the compiler and does suppress warnings for unused functions that one would
want, should the function ever become unused.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agodpif: Allow execute to modify the packet.
Jarno Rajahalme [Mon, 16 Dec 2013 16:14:52 +0000 (08:14 -0800)]
dpif: Allow execute to modify the packet.

Allowing the packet to be modified by execution allows less data
copying for userspace action execution.  Some users of the
dpif_execute already expect that the packet may be modified.  This
patch makes this behavior uniform and makes the userspace datapath and
the execution helpers modify the packet as it is being executed.
Userspace action now steals the packet if given permission, as the
packet is normally not needed after it.  The only exception is the
sample action, and this is accounted for my keeping track of any
actions that could be following the userspace action.

The packet in dpif_upcall is changed from a pointer to a struct,
allowing the packet to be honest about it's headroom.  After this
change the packet can safely be pushed on over the precarious 4 byte
limit earlier allowed by the netlink data preceding the packet.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agomonitor: Replace monitor_seq with periodic wakeup
Joe Stringer [Sat, 14 Dec 2013 01:24:10 +0000 (17:24 -0800)]
monitor: Replace monitor_seq with periodic wakeup

Currently, every time a monitoring port is added or reconfigured, the
main thread notifies the monitoring thread to wake up immediately using
monitor_seq. When adding a large number of ports at once, this causes
contention as the threads fight over access to the monitor heap---one
thread adding new ports, the other popping and processing the new ports.

This patch removes this mechanism in favour of a simple periodic wakeup
in the monitor thread. When configuring batches of 500 tunnels at once,
up to a total of 5000 tunnels, this reduces configuration time by up to
35%. New port monitor port configuration may not take effect for as long
as ~100ms, although it may be less if the timer has not recently timed
out, or if a monitoring port is due to send a packet.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agofedora-build: Remove %{build_number} from the configure line
Kyle Mestery [Sat, 14 Dec 2013 02:53:25 +0000 (21:53 -0500)]
fedora-build: Remove %{build_number} from the configure line

Fixes the OVS builds on Fedora, which are currently broken upstream.

Signed-off-by: Kyle Mestery <kmestery@cisco.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agoovs-thread: Fix crash by making count_cpu_count() return type a signed int.
Ben Pfaff [Fri, 13 Dec 2013 22:31:27 +0000 (14:31 -0800)]
ovs-thread: Fix crash by making count_cpu_count() return type a signed int.

ofproto_set_threads() uses the calculation MAX(count_cpu_cores() - 2, 1)
to decide on the default thread count.  However, count_cpu_cores() returns
0 if it can't count the number of cores, or 1 if there's only one core,
and that causes the calculation to come out as UINT_MAX-2 or UINT_MAX-1,
respectively, which causes a memory allocation failure later.

There are other ways to fix this problem, too, of course.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agovconn: Reply with OFPBRC_BAD_VERSION for bad version.
Ben Pfaff [Thu, 7 Nov 2013 17:39:03 +0000 (09:39 -0800)]
vconn: Reply with OFPBRC_BAD_VERSION for bad version.

Testers keep wanting to know why this doesn't work.  I think it's a silly
test, but it's easy enough to make them happy.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-linux: Fix fd leak for vports that disappear from the datapath.
Ben Pfaff [Thu, 2 May 2013 00:13:14 +0000 (17:13 -0700)]
dpif-linux: Fix fd leak for vports that disappear from the datapath.

When ovs-vswitchd deletes a port with dpif_linux_port_del(), that function
uses del_channel() to delete the corresponding channel, including closing
its Netlink socket fd.  However, if the vport gets removed by some other
process (e.g. "ip link delete" for veths) then this function never gets
called and thus the channel never gets deleted.

This commit fixes the problem by resynchronizing channels with the
datapath whenever a vport gets deleted.

Bug #16784.
Reported-by: Paul Ingram <paul@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-linux: Generalize dpif_linux_recv_set() to synchronize channels.
Ben Pfaff [Wed, 4 Dec 2013 21:37:31 +0000 (13:37 -0800)]
dpif-linux: Generalize dpif_linux_recv_set() to synchronize channels.

Until now, the code in dpif_linux_recv_set() has assumed it is starting
from a clean slate with no channels at all.  This commit generalizes it to
compare the existing set of channels against the ones that should exist
given the vports that the kernel has, adding any new ones that are missing
and removing any that should not exist.  A followup commit will make good
use of this functionality.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-linux: Factor out port dumping helper functions.
Ben Pfaff [Wed, 1 May 2013 21:40:38 +0000 (14:40 -0700)]
dpif-linux: Factor out port dumping helper functions.

These helpers simplify new code to be added in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agojsonrpc-server: Add test for disconnecting connections with too long queues.
Ben Pfaff [Wed, 27 Mar 2013 21:39:05 +0000 (14:39 -0700)]
jsonrpc-server: Add test for disconnecting connections with too long queues.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovsdb-client: Make "monitor" command able to monitor all tables.
Ben Pfaff [Wed, 27 Mar 2013 21:26:21 +0000 (14:26 -0700)]
ovsdb-client: Make "monitor" command able to monitor all tables.

Users may find this feature useful, but the reason to add this feature is
to allow a test to use it in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agocfm: Refine the cfm_extended manual.
Alex Wang [Sat, 26 Oct 2013 00:18:02 +0000 (17:18 -0700)]
cfm: Refine the cfm_extended manual.

Commit 348f01e3e3 (cfm: Eight byte MPIDs in extended mode.) allows
eight byte MPIDs when running in extended mode.  This commit explains
this change in the vswitch.conf.db.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-thread: Break recursion for coverage counters.
Gurucharan Shetty [Wed, 11 Dec 2013 23:55:03 +0000 (15:55 -0800)]
ovs-thread: Break recursion for coverage counters.

For systems that do not have either HAVE_THREAD_LOCAL or
HAVE___THREAD (ex: windows using MSVC), a COVERAGE_INC() calls xmalloc
which inturn calls COVERAGE_INC() creating a recursion that causes a
stack overflow.

This commit breaks the recursion by calling malloc() instead of
xmalloc().

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agocfm: Notify connectivity_seq on cfm_set_fault
Joe Stringer [Sat, 14 Dec 2013 02:18:13 +0000 (02:18 +0000)]
cfm: Notify connectivity_seq on cfm_set_fault

Commit f23d157c ("ofproto-dpif: Don't poll ports when nothing changes"
changed how cfm information is propagated to ovsdb, but did not ensure
that this happened when users made "appctl cfm/set_fault" calls. This
patch fixes this case.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agocoverage: Use size_t for coverage counter array lengths.
Ethan Jackson [Fri, 13 Dec 2013 17:57:38 +0000 (09:57 -0800)]
coverage:  Use size_t for coverage counter array lengths.

Fixes the following warning on my system.

../lib/coverage.c:54:40: error: incompatible pointer types passing
'unsigned int *' to parameter of type 'size_t *' (aka 'unsigned long
*')

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agostring: Use workaround for #include_next when it is not available.
Ben Pfaff [Fri, 13 Dec 2013 17:54:55 +0000 (09:54 -0800)]
string: Use workaround for #include_next when it is not available.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoconfigure: Add macros to check for #include_next and add a workaround.
Ben Pfaff [Fri, 13 Dec 2013 17:46:44 +0000 (09:46 -0800)]
configure: Add macros to check for #include_next and add a workaround.

This will be used for the #include_next in string.h in the following
commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Simplify thread creation API.
Ethan Jackson [Fri, 8 Nov 2013 21:47:49 +0000 (13:47 -0800)]
ofproto: Simplify thread creation API.

There's no particular reason for the function controlling the number
of threads to be bound up with dpif_recv_set().  This patch breaks
them up, but as a side effect means threads will run doing nothing
when datapath upcall receiving is disabled.  By doing this, the udpif
thread creation API becomes a bit easier to reason about once there
are multiple types of thread introduced in future patches.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-ofctl: Replace TODO with XXX.
Ethan Jackson [Sat, 7 Dec 2013 23:07:01 +0000 (15:07 -0800)]
ovs-ofctl: Replace TODO with XXX.

In accordance with the style guidelines.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoflow: New function flow_unwildcard_tp_ports().
Ethan Jackson [Sat, 7 Dec 2013 02:53:12 +0000 (18:53 -0800)]
flow: New function flow_unwildcard_tp_ports().

This patch adds a new function flow_unildcard_tp_ports() which doesn't
unwildcard the upper half of tp_src and tp_dst with ICMP packets.
Unfortunately, this matters in future patches when we compare masks
carefully to determine if flows should be evicted from the datapath.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoRemove unused USE_LINKER_SECTIONS and OVS_LINK2_IFELSE
Helmut Schaa [Fri, 13 Dec 2013 13:05:03 +0000 (14:05 +0100)]
Remove unused USE_LINKER_SECTIONS and OVS_LINK2_IFELSE

They are unused and can be removed.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agocoverage: Use OVS_CONSTRUCTOR to initialize the coverage counter array
Helmut Schaa [Fri, 13 Dec 2013 13:05:02 +0000 (14:05 +0100)]
coverage: Use OVS_CONSTRUCTOR to initialize the coverage counter array

Use a static array in coverage.c that gets initialized by constructor
functions per coverage definition.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agovlog: Use OVS_CONSTRUCTOR for vlog initialization
Helmut Schaa [Fri, 13 Dec 2013 13:05:01 +0000 (14:05 +0100)]
vlog: Use OVS_CONSTRUCTOR for vlog initialization

This allows to get rid of some special segment handling to allow
distributed registering of vlog modules.

Instead use a global list and vlog module constructor functions to
build up the list. That means vlog modules reside within the
compilation unit they are defined in and can be iterated upon
by using the global list vlog_modules.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agocompiler: Add OVS_CONSTRUCTOR to mark functions as init functions
Helmut Schaa [Fri, 13 Dec 2013 13:05:00 +0000 (14:05 +0100)]
compiler: Add OVS_CONSTRUCTOR to mark functions as init functions

Functions marked with OVS_CONSTRUCTOR are called unconditionally
before main.

Tested with GCC. Untested with MSVC.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolib/util: Make some functions in util.c inline
Helmut Schaa [Fri, 13 Dec 2013 13:17:17 +0000 (14:17 +0100)]
lib/util: Make some functions in util.c inline

str_to_uint, str_to_ulong and str_to_ullong are just wrappers
around the corresponding signed functions. Move these to util.h
and make them inline saving some library exports and letting
the compiler do some more magic.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolib/mac-learning: Add missing semicolon
Helmut Schaa [Fri, 13 Dec 2013 13:17:15 +0000 (14:17 +0100)]
lib/mac-learning: Add missing semicolon

Does not matter as long as ovs_assert is a simple macro but if ovs_assert
is converted to a function this will fail.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolib/random: Make some functions in random.c inline
Helmut Schaa [Fri, 13 Dec 2013 13:17:14 +0000 (14:17 +0100)]
lib/random: Make some functions in random.c inline

random_range, random_uint8 and random_uint16 are basically just wrappers
around random_uint32. Hence, don't export these functions so the compiler
can be smarter when it comes to optimizations.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolib/ofp: Consolidate some struct field orders
Helmut Schaa [Fri, 13 Dec 2013 13:17:13 +0000 (14:17 +0100)]
lib/ofp: Consolidate some struct field orders

Avoid "holes" in structs by moving "small" members together.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Remove ovs-appctl dpif/del-flows.
Ethan Jackson [Sat, 7 Dec 2013 23:04:09 +0000 (15:04 -0800)]
ofproto-dpif: Remove ovs-appctl dpif/del-flows.

It's not entirely clear why someone would want to delete the flows
associated with only one bridge and not be fine with simply using
ovs-dpctl del-flows to get all of them.  Additionally, this will be
hard to implement cleanly in the future, so this patch removes it.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Remove avg_subfacet_life.
Ethan Jackson [Thu, 21 Nov 2013 00:18:24 +0000 (16:18 -0800)]
ofproto-dpif: Remove avg_subfacet_life.

This is going to be hard to compute efficiently in the new
architecture introduced in future patches.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-upcall: New ovs-appctl upcall/show.
Ethan Jackson [Thu, 21 Nov 2013 02:06:12 +0000 (18:06 -0800)]
ofproto-dpif-upcall: New ovs-appctl upcall/show.

Shows debugging information related to upcall handling.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-upcall: Add memory usage stats.
Ethan Jackson [Thu, 21 Nov 2013 01:41:02 +0000 (17:41 -0800)]
ofproto-dpif-upcall: Add memory usage stats.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Remove run_fast() functions.
Ethan Jackson [Thu, 21 Nov 2013 01:12:40 +0000 (17:12 -0800)]
ofproto: Remove run_fast() functions.

They don't really make sense in a multithreaded architecture.  Once
flow miss batches are dispatched with, they will be extra useless.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Replace reval_seq with a struct seq.
Ethan Jackson [Tue, 17 Sep 2013 21:35:53 +0000 (14:35 -0700)]
ofproto: Replace reval_seq with a struct seq.

Future patches will need to poll_block() on it.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-xlate: Add a mechanism to skip wildcard calculation.
Ethan Jackson [Thu, 5 Dec 2013 21:09:27 +0000 (13:09 -0800)]
ofproto-dpif-xlate: Add a mechanism to skip wildcard calculation.

As time goes on and the classifier becomes more complicated, calculate
the wildcard mask will get more and more expensive.  This patch adds a
mechanism to xlate_actions() allowing callers to disable wildcard
calculation when it isn't really necessary.  Used in future patches.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Move all statistics accounting into xlate_actions().
Ethan Jackson [Wed, 13 Nov 2013 02:18:01 +0000 (18:18 -0800)]
ofproto: Move all statistics accounting into xlate_actions().

This patch moves statistics accounting for netflow, bonding, netdev,
and mirroring inside xlate_actions().  Moving all statistics into one
place makes it very difficult to mess up.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>