Simon Horman [Thu, 12 Jun 2014 05:30:47 +0000 (14:30 +0900)]
connmgr: Do not use OFPRR_METER_DELETE before OF1.4
OFPRR_METER_DELETE was introduced in OF1.4 however meters were introduced
in OF1.3.
Regardless of the OF version when flows are deleted cause flows to be
deleted handle_delete_meter() calls delete_flows__() with
OFPRR_METER_DELETE as the reason.
In order to avoid sending OFPRR_METER_DELETE to controllers connected
using OF1.3 map OFPRR_METER_DELETE to OFPRR_DELETE which exists in that
version.
Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Simon Horman [Wed, 11 Jun 2014 00:28:05 +0000 (09:28 +0900)]
ofproto-dpif: Add idle_timeout parameter to ofproto_dpif_add_internal_flow()
This is in preparation for using the same helper as part of support
for using recirculation in conjunction series of actions including
with MPLS actions that are currently not able to be translated.
In that scenario the idle timeout will be used to expire internal
rules that are added to handle recirculation.
Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Simon Horman [Wed, 11 Jun 2014 00:28:04 +0000 (09:28 +0900)]
ofproto-dpif: Add recirc_id field to struct rule_dpif
This is to allow a recirculation id to be associated with a rule
in the case that its actions cause recirculation.
In such a case if the recirc_id field is non-zero then that value should be
used, otherwise a value should be obtained using
ofproto_dpif_alloc_recirc_id and saved in recirc_id field.
When destructing the rule if the recirc_id field is non-zero then
the associated internal flow should be deleted.
This is in preparation for using the same helper as part of support
for using recirculation in conjunction series of actions including
with MPLS actions that are currently not able to be translated.
Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Simon Horman [Wed, 11 Jun 2014 00:28:03 +0000 (09:28 +0900)]
ofproto-dpif: Move RECIRC_RULE_PRIORITY to common header
This is in preparation for using this value
in ofproto-dpif-xlate.c when composing recirculation
actions added as a result of processing (MPLS) actions.
Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
According to msdn documentation, one is discouraged from using
IP_TOS for ipv4 sockets (it apparently does not actually set
anything). Also, IPV6_TCLASS does not work in
Windows (it always returns an error and also is undocumented).
Looks like Microsoft recommends QoS2 APIs to achieve
the same. Till we add those API calls, simply return on Windows.
(Noticed while running unit tests for ipv6. set_dscp would fail.)
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Jarno Rajahalme [Wed, 11 Jun 2014 18:07:43 +0000 (11:07 -0700)]
lib/cmap: Simplify iteration with C99 loop declaration.
This further eases porting existing hmap code to use cmap instead.
The iterator variants taking an explicit cursor are retained (renamed)
as they are needed when iteration is to be continued from the last
iterated node.
Simon Horman [Fri, 30 May 2014 08:14:14 +0000 (17:14 +0900)]
ofproto: Use OFPRR_GROUP_DELETE
Use OFPRR_GROUP_DELETE as the reason for deleting flows due
to the removal of a group that they use.
This implementation adds an delete_reason member to struct ofputil_flow_mod
as a convenient way to set the reason used by delete_flows__() when it is
called indirectly from delete_group__().
Signed-off-by: Simon Horman <horms@verge.net.au>
[blp@nicira.com initialized the new member in a few more places] Signed-off-by: Ben Pfaff <blp@nicira.com>
Andy Zhou [Fri, 6 Jun 2014 22:36:14 +0000 (15:36 -0700)]
test: Remove explicit sleeps from ofproto-dpif bond tests
Ofproto-dpif bond tests relies on netdev-dummy ports to set up
socket connection before actual tests. The time required
for socket connection varies depends on system load, making the test
prone to failure with simple sleep calls. On the other hand,
conservative sleep value for the slowest machine may be excessive on
a faster machine.
This patch removes the sleep calls. Replace them with
WAIT_FOR_DUMMY_PORTS() introduced in the last patch, thus removing
the timing dependency.
testsuite.at: pids can have zero after first character.
Fix the bug which did not kill the processes with pids that had
a zero in them. Also, some tests do a AT_CHECK([kill `cat pid`]) which
on windows prints something on the stdout causing the tests to fail.
So supress it.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
With Visual Studio and Msys combination, something is going
wrong when we do a '3<pcap' followed by fdopen(3, 'rb'). fdopen
fails. I do not know the exact reason for the failure. But the
workaround is straightforward.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Anoob Soman [Tue, 20 May 2014 11:40:35 +0000 (12:40 +0100)]
netflow: Fold netflow_expire() into netflow_flow_clear().
netflow_flow_clear() asserted that no packets or bytes were included
in the statistics for the flow being cleared. Before threading Open
vSwitch, this assertion was always true because netflow_expire() was
always called before calling netflow_flow_clear(). Since Open
vSwitch was threaded, however, it was possible that a packet arrived
after netflow_expire() but before netflow_flow_clear(), since each of
these function separately took the netflow mutex.
This commit fixes the problem by merging netflow_expire() into
netflow_flow_clear(), under a single acquisition of the netflow
mutex.
Signed-off-by: Anoob Soman <anoob.soman@citrix.com>
[blp@nicira.com modified the patch to remove netflow_expire() and
rewrote the commit message] Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Thu, 5 Jun 2014 22:27:31 +0000 (15:27 -0700)]
ofp-actions: Store cookie in network byte order in struct ofpact_learn.
Most other code in Open vSwitch that works with flow cookies keeps them
in network byte order. Using network byte order in struct ofpact_learn,
also, reduces the number of byte order conversions needed across the
source tree.
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Thomas Graf <tgraf@suug.ch>
Ben Pfaff [Fri, 6 Jun 2014 04:37:04 +0000 (21:37 -0700)]
ovs-ofctl: Support "send_flow_rem" in "learn" actions.
This flag was overlooked when support for the "learn" action was added.
(It was always supported in the OpenFlow code, just not in the ovs-ofctl
interface.)
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Thomas Graf <tgraf@suug.ch>
Joe Stringer [Wed, 14 May 2014 04:17:25 +0000 (16:17 +1200)]
revalidator: Replace ukey->mark with dump_seq.
Rather than setting and resetting the 'mark' field in the ukey, this
patch introduces a seq to track whether a flow has been seen during the
most recent dump. This tidies the code and simplifies the logic for
detecting when flows are duplicated from the datapath.
Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
Simon Horman [Thu, 5 Jun 2014 09:54:47 +0000 (18:54 +0900)]
ofproto: Send monitor updates if a flow mod changes a rules actions
Without this change a monitor update will be sent when a flow mod changes
a rules cookie but not if only the actions are updated. This appears
to be a logic error.
I noticed this while working on implementing OpenFlow1.4 flow monitor
as an OpenFlow1.4 flow mod does not update a rules cookie.
Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Thu, 5 Jun 2014 19:53:55 +0000 (12:53 -0700)]
CONTRIBUTING: Describe commonly used tags; introduce Reported-at.
This is partly documentation of how patches are tagged in practice in Open
vSwitch. The bits at the end about "Reported-at:" and "VMware-BZ:" are
an attempt to influence future practices; I cannot say how successful they
will be.
I am not sure whether these key-value pairs at the end of commit messages
are actually commonly called "tags". I'm happy to use a different term if
that one seems wrong.
Ben Pfaff [Wed, 4 Jun 2014 22:47:16 +0000 (15:47 -0700)]
poll-loop: Ignore 'wevent' in poll_fd_wait_at() on non-Windows.
'wevent' isn't actually used on non-Windows systems, but poll_fd_wait_at()
and find_poll_node() treat events with different 'wevent' as different, so
it seems better to make sure that 'wevent' doesn't matter.
Alternatively, one could ovs_assert(!wevent). I guess that would catch
a caller accidentally swapping the 'fd' and 'wevent' arguments.
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Gurucharan Shetty <gshetty@nicira.com>
Ben Pfaff [Wed, 4 Jun 2014 22:41:09 +0000 (15:41 -0700)]
dpif-netdev: Fix another use-after-free in port_unref().
Commit 87400a3d4cc4a (dpif-netdev: Fix use-after-free in port_unref().)
fixed one use-after-free in the common case of port_unref(). However,
there was another, similar case: if port->netdev has no rxqs, then
the netdev_close() causes port->netdev to be destroyed and thus the
following call to netdev_n_rxq() accesses freed memory. This commit fixes
the problem.
Found by valgrind.
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
Joe Stringer [Thu, 5 Jun 2014 06:08:40 +0000 (06:08 +0000)]
revalidator: Use xcache when revalidation is required.
One of the reasons that xlate_cache was introduced was to ensure that
statistics were attributed to the correct rules and interfaces according
to the flow that was installed into the datapath, rather than according
to the current state of the flow table.
This patch makes the revalidators use the xlate_cache to attribute stats
when full revalidation is required, as the statistics belong to the old
ruleset. However, when revalidating, the rules may have changed while
leaving the datapath flows intact, so we still re-create the xcache at
that point.
Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Alex Wang <alexw@nicira.com>
Joe Stringer [Wed, 4 Jun 2014 09:59:23 +0000 (09:59 +0000)]
revalidator: Refactor ukey creation/lookup.
This patch refactors the code around ukey creation and lookup to
simplify the code for callers. A new function ukey_acquire() combines
these functions and attempts to acquire a lock on the ukey. Failure to
acquire a lock on the ukey is usually a sign that another thread is
handling the same flow concurrently, which means the flow does not need
to be handled anyway.
Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
Ryan Wilson [Wed, 4 Jun 2014 20:49:06 +0000 (13:49 -0700)]
dpif-netdev: Upcall: Remove an extra memcpy of packet data.
When a bridge of datatype type netdev receives a packet, it
copies the packet from the NIC to a buffer in userspace.
Currently, when making an upcall, the packet is again copied
to the upcall's buffer. However, this extra copy is not
necessary when the datapath exists in userspace as the upcall
can directly access the packet data.
This patch eliminates this extra copy of the packet data in
most cases. In cases where the packet may still be used later
by callers of dp_netdev_execute_actions, making a copy of the
packet data is still necessary.
This patch also adds a dpdk_buf field to 'struct ofpbuf' when
using DPDK. This field holds a pointer to the allocated DPDK
buffer in the rte_mempool. Thus, an upcall packet ofpbuf
allocated on the stack can now share data and free memory of
a rte_mempool allocated ofpbuf.
Signed-off-by: Ryan Wilson <wryan@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
Andy Zhou [Thu, 29 May 2014 00:00:48 +0000 (17:00 -0700)]
dpif: Fix slow action handling for DP_HASH and RECIRC
In case DP_HASH and RECIRC actions need to be executed in slow path,
current implementation simply don't handle them -- vswitchd simply
crashes. This patch fixes them by supply an implementation for them.
RECIRC will be handled by the datapath, same as the output action.
DP_HASH, on the other hand, is handled in the user space. Although the
resulting hash values may not match those computed by the datapath, it
is less expensive; current use case (bonding) does not require a strict
match to work properly.
Ryan Wilson [Tue, 3 Jun 2014 05:47:15 +0000 (22:47 -0700)]
timeval: Add monotonic time functionality for NetBSD and FreeBSD.
This patch also checks the system platform as clock_gettime
could exist on different platforms but with different values of
CLOCK_MONOTONIC and different definitions of 'struct timespec'.
In this case, the system call would be expected to catch the
error, which is dangerous.
This patch ensures Linux, NetBSD and FreeBSD platforms use
clock_gettime with their corresponding correct values and
definitions. All other platforms use time.time().
Signed-off-by: Ryan Wilson <wryan@nicira.com> Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Jarno Rajahalme [Wed, 4 Jun 2014 16:15:48 +0000 (09:15 -0700)]
INSTALL: Note about compiler atomics support.
OVS is slow when compiled with pthreads atomics. Add a generic note
in INSTALL, with a reference to lib/ovs-atomic.h, where a new comment
provides additional detail.
Simon Horman [Wed, 4 Jun 2014 16:56:09 +0000 (16:56 +0000)]
odp-util: Do not set port mask of non-IP packets
In the case that an flow for an IP packet has an mpls_push action applied
the L3 and L4 portions of the flow will be cleared in flow_push_mpls().
Without this change commit_set_port_action() will set the tp_src and tp_dst
mask for the flow to all-ones because the base and flow port values no
longer match. Even though there will be no corresponding set action for the
ports; because the flow is no longer IP.
In this case where nw_proto is not part of the match this manifests
in a problem because the kernel datapath rejects flows whose masks
have non-zero values for tp_src or dp_dst if the nw_proto mask is
not all-ones.
This patch resolves this problem by having commit_set_port_action() return
without doing anything if flow->nw_proto is zero. The same logic is present
in commit_set_nw_action().
Also enhance one of the MPLS tests to exercise this logic. The enhanced
tests inputs a UDP packet with non-zero ports rather than an IP packet with
zeroed ports: zeroed ports cause commit_set_port_action() always return
without doing anything..
Commit 691d39b ("upcall: Remove redundant xlate_actions_for_side_effects().")
causes xlate_in_init() to be called for every packet that has an upcall.
This has the effect of indirectly calling commit_set_port_action() when
translating a controller action which may not have previously been the case
depending on the flow.
The result is that the behaviour described in the changelog above can be
exercised via a minor enhancement to one of the existing MPLS tests. This
illustrates that the problem exists for the user-space datapath whereas I
had previously incorrectly assumed it only manifested when using the kernel
datapath because I had only observed it there.
Signed-off-by: Simon Horman <horms@verge.net.au> Acked-by: Jarno Rajahalme <jrajahame@nicira.com>
Joe Stringer [Tue, 3 Jun 2014 08:44:35 +0000 (20:44 +1200)]
ofproto-dpif-xlate: Cache full flowmod for learning.
Caching the results of xlate_learn was previously dependent on the state
of the 'may_learn' flag. This meant that if the caller did not specify
that this flow may learn, then a learn entry would not be cached.
However, the xlate_cache tends to be used on a recurring basis, so
failing to cache the learn entry can provide unexpected behaviour later
on, particularly in corner cases.
Such a corner case occurred previously:-
* Revalidation was requested.
* A flow with a learn action was dumped.
* The flow had no packets.
* The flow's corresponding xcache was cleared, and the flow revalidated.
* The flow went on to receive packets after the xcache is re-created.
In this case, the xcache would be re-created, but would not refresh the
timeouts on the learnt flow until the next time it was cleared, even if
it received more traffic. This would cause flows to time out sooner than
expected. Symptoms of this bug may include unexpected forwarding
behaviour or extraneous statistics being attributed to the wrong flow.
This patch fixes the issue by caching the entire flow_mod, including
actions, upon translating an xlate_learn action. This is used to perform
a flow_mod from scratch with the original flow, rather than simply
refreshing the rule that was created during the creation of the xcache.
Reported-by: Scott Hendricks <shendricks@vmware.com> Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Alex Wang <alexw@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Jarno Rajahalme [Tue, 3 Jun 2014 15:35:16 +0000 (08:35 -0700)]
lib/ovs-rcu: Rename ovsrcu_init() as ovsrcu_set_hidden().
ovsrcu_init() was named after the atomic_init(), but the semantics are
different enough to warrant a different name. Basically C11
atomic_init is defined in a way that allows the implementation to
assign the value without any syncronization, so in theory stores via
atomic_init could be seen by others after stores via atomic_set, even
if the atomic_init appeared earlier in the code.
ovsrcu_set_hidden() can be used to set an RCU protected variable when
it is not yet accessible by any active reader, but will be made
visible later via an ovsrcu_set call on some other pointer.
This patch also adds a new ovsrcu_init() that can be used to initilize
RCU protected variables when the readers are not yet executing. The
new ovsrcu_init() is implemented with atomic_init(), so it does not
provide any kind of syncronization.
Jarno Rajahalme [Tue, 3 Jun 2014 15:35:16 +0000 (08:35 -0700)]
lib/ovs-rcu: Evaluate parameters before ovsrcu_set and ovsrcu_init.
ovsrcu_set() and ovsrcu_init() look like functions, so users are
justified in expecting the arguments to be evaluated before any of
the body of ovsrcu_set or ovsrcu_init().
With ovs-atomic-pthreads, a fallback ovs-atomics implementation used
when no C11 atomics are available or with GCC older than 4.0, the
prior definitions led to nested mutex locking when the 'VALUE'
argument was an atomic_read(). This is resolved by ensuring function
argument semantics for the parameters. For non-GCC compilers this is
done with an inline function. GCC implementation of ovs-rcu does not
fix the RCU variable type, so a GCC macro needs to be used instead.
Joe Stringer [Wed, 28 May 2014 03:23:42 +0000 (15:23 +1200)]
revalidator: Eliminate duplicate flow handling.
A series of bugs have been identified recently that are caused by a
combination of the awkward flow dump API, possibility of duplicate flows
in a flow dump, and premature optimisation of the revalidator logic.
This patch attempts to simplify the revalidator logic by combining
multiple critical sections into one, which should make the state more
consistent.
The new flow of logic is:
+ Lookup the ukey.
+ If the ukey doesn't exist, create it.
+ Insert the ukey into the udpif. If we can't insert it, skip this flow.
+ Lock the ukey. If we can't lock it, skip it.
+ Determine if the ukey was already handled. If it has, skip it.
+ Revalidate.
+ Update ukey's fields (mark, flow_exists).
+ Unlock the ukey.
Previously, we would attempt process a flow without creating a ukey if
it hadn't been dumped before and it was due to be deleted. This patch
changes this to always create a ukey, allowing the ukey's
mutex to be used as the basis for preventing a flow from being handled
twice. This improves code correctness and readability.
Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
Simon Horman [Mon, 2 Jun 2014 12:36:28 +0000 (21:36 +0900)]
ofp-errors: Duplicate instruction error
Add OFPERR_OFPBIC_DUP_INST (type = OFPET_BAD_INSTRUCTION, code = 9)
and use it for OpenFlow1.4+.
For OpenFlow1.1 - 1.3 map this error to ONFBIC_DUP_INSTRUCTION
(experimenter = ONF, type = 2600) which is proposed in
OpenFlow enhancement proposal EXT-260 "Add error
code for duplicate instruction.".
Previously ONFBIC_DUP_INSTRUCTION was used for OpenFlow1.3+.
Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ryan Wilson [Fri, 30 May 2014 22:38:51 +0000 (15:38 -0700)]
timeval: Use monotonic time in OVS Python timeval library.
Python's time.time() function uses the system wall clock. However,
if NTP resets the wall clock to be a time in the past, then this
causes any applications that poll block based on time, such as
ovs-xapi-sync, to poll block indefinitely since the time is
unexpectedly negative.
This patch fixes the issue by using time.monotonic() if Python's
version >= 3.3. Otherwise, the timeval module calls out to the
librt C shared library and uses the clock_gettime function with
CLOCK_MONOTONIC.
Note this is only enabled on Linux-based platforms. This has been
tested on Ubuntu 12.04 and Redhat 6.4.
Bug #1189434 Signed-off-by: Ryan Wilson <wryan@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
Ansis Atteka [Fri, 23 May 2014 21:15:28 +0000 (14:15 -0700)]
process: block signals while spawning child processes
Between fork() and execvp() calls in the process_start()
function both child and parent processes share the same
file descriptors. This means that, if a child process
received a signal during this time interval, then it could
potentially write data to a shared file descriptor.
One such example is fatal signal handler, where, if
child process received SIGTERM signal, then it would
write data into pipe. Then a read event would occur
on the other end of the pipe where parent process is
listening and this would make parent process to incorrectly
believe that it was the one who received SIGTERM.
Also, since parent process never reads data from this
pipe, then this bug would make parent process to consume
100% CPU by immediately waking up from the event loop.
This patch will help to avoid this problem by blocking
signals until child closes all its file descriptors.
Ryan Wilson [Fri, 30 May 2014 06:35:30 +0000 (23:35 -0700)]
rtbsd: Make rtbsd module thread-safe.
Due to patch fe83f8 (netdev: Remove netdev from global shash when
the user is changing interface configuration), netdevs can be
destructed and deallocated by revalidator and RCU threads. When
netdevs with class bsd are destroyed, the rtbsd notifier is
unregistered, possibly causing memory to be freed. This causes a
race condition with the main thread which calls rtbsd_notifier_run
periodically to check for any netdev change events.
This patch makes the rtbsd module thread-safe via a mutex.
Note this patch removes rtbsd_notifier_run() in
rtbsd_notifier_register() due to locking requirements. Since the
rtbsd_notifier_run() is always run by the main thread often,
receiving stale notifications from the notifier is unlikely.
Bug #1258532 Signed-off-by: Ryan Wilson <wryan@nicira.com> Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Acked-by: Alex Wang <alexw@nicira.com> Signed-off-by: Alex Wang <alexw@nicira.com>
Ryan Wilson [Thu, 29 May 2014 21:56:09 +0000 (14:56 -0700)]
route-table: Make route-table module thread-safe.
Due to patch fe83f8 (netdev: Remove netdev from global shash when
the user is changing interface configuration), netdevs can be
destructed and deallocated by revalidator and RCU threads. When
netdevs with class vport are destroyed, the routing table is
unregistered, possibly causing memory to be freed. This causes a
race condition with the main thread which calls route_table_run
periodically to check for routing table updates.
This patch makes the route-table module thread-safe via a mutex.
Bug #1258532 Signed-off-by: Ryan Wilson <wryan@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Alex Wang <alexw@nicira.com>
Ben Pfaff [Wed, 28 May 2014 23:27:02 +0000 (16:27 -0700)]
ofproto: Fix comments.
The comments on the "group" functions had been shamelessly copied without
significant update from the corresponding flow table functions. This
commit fixes the errors.
This commit also removes an obsolete comment in ofopgroup_complete().
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
YAMAMOTO Takashi [Thu, 29 May 2014 16:12:24 +0000 (16:12 +0000)]
configure.ac: Check C99 compiler
This ends up to add -std=gnu99 and fixes the following
compilation problem introduced by commit 08feeb75.
("lib/flow: Use C99 declaration in for statement.")
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I ../include -I ../lib -I ./lib -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare -Wpointer-arith -Wno-format-zero-length -Wswitch-enum -Wunused-parameter -Wstrict-aliasing -Wbad-function-cast -Wcast-align -Wmissing-prototypes -Wmissing-field-initializers -g -O2 -MT lib/classifier.lo -MD -MP -MF lib/.deps/classifier.Tpo -c ../lib/classifier.c -o lib/classifier.o
../lib/classifier.c: In function 'miniflow_and_mask_matches_flow':
../lib/classifier.c:1722:5: error: 'for' loop initial declarations are only allowed in C99 mode
../lib/classifier.c:1722:5: note: use option -std=c99 or -std=gnu99 to compile your code
Makefile:3013: recipe for target 'lib/classifier.lo' failed
% gcc --version
gcc (NetBSD nb1 20120916) 4.5.4
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Jarno Rajahalme [Wed, 28 May 2014 23:56:29 +0000 (16:56 -0700)]
lib/cmap: Use atomics for all bucket data.
The documentation of the memory order argument of atomic operations
states that memory loads after an atomic load with a
memory_order_acquire cannot be moved before the atomic operation.
This still leaves open the possibility that non-atomic loads before
the atomic load could be moved after it, hence breaking down the
synchronization used for cmap_find().
This patch fixes this my using atomics (with appropriate memory_order)
also for the struct cmap_node pointer and hash values.
struct cmap_node itself is used for the pointer, since it already
contains an RCU pointer (which is atomic) for a struct cmap_node.
This also helps simplify some of the code previously dealing
separately with the cmap_node pointer in the bucket v.s. a cmap_node.
Hash values are also accessed using atomics. Otherwise it might be
legal for a compiler to read the hash values once, and keep using the
same values through all the retries.
These should have no effect on performance.
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Jarno Rajahalme [Wed, 28 May 2014 23:56:29 +0000 (16:56 -0700)]
lib/flow: Use C99 declaration in for statement.
C99 declarations within code are allowed now. Change the
FLOW_FOR_EACH_IN_MAP to use loop variable within the for statement.
This makes this macro more generally useful.
The loop variable name is suffixed with two underscores with the
intention that there would be a low likelihood of collision with any
of the macro parameters.
Also fix the return type of flow_get_next_in_map().
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Wed, 28 May 2014 17:36:23 +0000 (10:36 -0700)]
vtep: Don't try to both distribute and distclean the manpage.
Since the initial checkin of the vtep code, the manpage has been both
distributed and distcleaned. That's contradictory. This commit fixes it.
This commit also moves the vtep manpage from the source directory to the
build directory. There's no real reason for the manpage to be in the
source directory, and it can't be if it's not distributed (because "make"
is not supposed to update the source directory in a freshly untarred
source distribution, and doing so breaks "make distcheck").
Found by "make distcheck".
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Joe Stringer <joestringer@nicira.com>
socket-util: Log the kernel assigned port number when asked.
So far, we log the kernel assigned port number when the port number is
not specified. On Windows, this happens multiple times because "unix"
sockets are implemented internally via TCP ports. This means that many tests,
specially the ovs-ofctl monitor tests, need to filter out the
additional messages. Doing that is not a big deal, but I think it will
keep manifesting in future tests added by Linux developers.
With this commit, we simply don't print the kernel assigned TCP ports
on Windows when done for "unix" sockets.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
ovs-ofctl: Enable the ability to 'detach' on Windows.
This is mostly for unit tests that use ovs-ofctl monitor.
service_start() creates a new process and waits till
daemonize_complete() is called by the child.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
ovsdb-client's 'monitor' command works with --detach such
that the parent detaches after printing initial transactions in
the database. This is a little tricky to implement
in windows. So for windows, send the process to background with
'&' and then sleep for a second to let the intial transactions
printed. (We can do the same for Linux, but it slows down the
test run)
Also let the perl script that looks at the o/p be aware of
CR LF in windows.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Ryan Wilson [Wed, 28 May 2014 00:34:14 +0000 (17:34 -0700)]
ofproto-dpif-xlate: Implement RCU locking in ofproto-dpif-xlate.
Before, a global read-write lock protected the ofproto-dpif
/ ofproto-dpif-xlate interface. Handler and revalidator threads
had to wait while configuration was being changed. This patch
implements RCU locking which allows handlers and revalidators
to operate while configuration is being updated.
Signed-off-by: Ryan Wilson <wryan@nicira.com> Acked-by: Alex Wang <alexw@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Alex Wang <alexw@nicira.com>
rhel: support persistent mac addresses on OVS bridges
This patch adds support for RHEL-derived systems (RHEL/CentOS/Fedora)
for setting the persistent MAC address of an OVS bridge via the MACADDR
setting in the interface configuration file.
Without this change, when an administrator provides MACADDR in the
interface configuration file that address will be set in ifup-eth using
the "ip link set" command. While this appears to work, any operation
that updates the OVS configuration will cause the MAC address to revert.
Persistent MAC addresses must be set using ovs-vsctl.
(Resubmitted with whitespace and grammar corrections)
Signed-off-by: Lars Kellogg-Stedman <lars@redhat.com> Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Flavio Leitner <fbl@redhat.com>
As a result of commit a0bab87 (ofproto: Remove per-flow miss hash
table from upcall handler.) we're guaranteed that every packet has had
xlate_actions() called on it at least once. Therefore, there's no
need to re-xlate slow path flows just to shove their packets through
the system.
This also may fix a bug discussed here:
http://openvswitch.org/pipermail/discuss/2014-April/013670.html
Signed-off-by: Ethan Jackson <ethan@nicira.com> Reported-by: Murphy McCauley <murphy.mccauley@gmail.com> Acked-by: Ben Pfaff <blp@nicira.com>
Andy Zhou [Thu, 22 May 2014 06:57:21 +0000 (23:57 -0700)]
ofproto: Remove ofproto_group_write_lookup()
ofproto_group_write_lookup() slightly different from
ofproto_group_lookup() in handling reference counting.
Currently, it has only one caller: modify_group().
It seems the abstraction is not adding value here.
Remove the function, along with some refactoring, makes modify_group()
easier to understand.
Signed-off-by: Andy Zhou <azhou@nicira.com> Acked-by: Ryan Wilson <wryan@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>