cascardo/ovs.git
9 years agodatapath: Backport __ip_select_ident() function
Pravin B Shelar [Wed, 25 Sep 2013 01:42:43 +0000 (18:42 -0700)]
datapath: Backport __ip_select_ident() function

definition of __ip_select_ident() changed in newer kernel and
it is backported to stable kernel, Therefore adding configure
check to detect the new function.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
9 years agoopenvswitch.h: Fix the type of struct ovs_key_nd nd_target field.
Jarno Rajahalme [Wed, 10 Sep 2014 20:02:46 +0000 (13:02 -0700)]
openvswitch.h: Fix the type of struct ovs_key_nd nd_target field.

Should be the same as other IPv6 address fields.

Current master produces sparse warnings without this change.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoovs-vtep: Handle physical ports with '-' in its name.
Gurucharan Shetty [Wed, 10 Sep 2014 17:32:26 +0000 (10:32 -0700)]
ovs-vtep: Handle physical ports with '-' in its name.

As of now, if a physical port has a '-' in its name, ovs-vtep
throws a ValueError exception. This patch fixes the problem.

Reported-by: Mark Maglana <mmaglana@gmail.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agolib/rstp-common: Remove double spaces.
Daniele Venturino [Wed, 10 Sep 2014 16:28:03 +0000 (16:28 +0000)]
lib/rstp-common: Remove double spaces.

Signed-off by: Daniele Venturino <daniele.venturino@m3s.it>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agolib/rstp: Use ovs_refcount_unref_relaxed.
Daniele Venturino [Wed, 10 Sep 2014 16:28:01 +0000 (16:28 +0000)]
lib/rstp: Use ovs_refcount_unref_relaxed.

Access to RSTP and RSTP port objects is protected by a mutex, so the
refcount unref operation can have relaxed memory order semantics (See
commit 24f8381214966e90819bf4a9ecabf076cbfc1b08).

Signed-off by: Daniele Venturino <daniele.venturino@m3s.it>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agolib/rstp: Use RSTP_OPER_P2P_MAC_STATE_ENABLED instead of 1.
Daniele Venturino [Wed, 10 Sep 2014 16:28:00 +0000 (16:28 +0000)]
lib/rstp: Use RSTP_OPER_P2P_MAC_STATE_ENABLED instead of 1.

Signed-off by: Daniele Venturino <daniele.venturino@m3s.it>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agodatapath-windows: update CodingStyle guideline for variable names
Nithin Raju [Tue, 9 Sep 2014 16:02:36 +0000 (09:02 -0700)]
datapath-windows: update CodingStyle guideline for variable names

During a review, it seemed that some of the conventions were not clear.
Fixing them in this patch.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Reported-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
9 years agorconn: Prevent redefinition of 'MAX_MONITORS' in Windows.
Gurucharan Shetty [Tue, 9 Sep 2014 20:19:22 +0000 (13:19 -0700)]
rconn: Prevent redefinition of 'MAX_MONITORS' in Windows.

Windows already has a MAX_MONITORS defined in ddeml.h.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agoofproto-dpif-xlate: Work around Linux netdev_max_backlog limit.
Ben Pfaff [Tue, 9 Sep 2014 22:06:52 +0000 (15:06 -0700)]
ofproto-dpif-xlate: Work around Linux netdev_max_backlog limit.

Linux has an internal queue that temporarily holds packets transmitted to
certain network devices.  If too many packets are transmitted to such
network devices within a single list of actions, then packets tend to get
dropped.  Broadcast or flooded or multicast packets on bridges with
thousands of ports are examples of how this can occur.

This commit avoids the problem by implementing a flow in userspace when it
outputs its packet more times than the maximum length of the queue.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
Tested-by: Flavio Leitner <fbl@redhat.com>
9 years agolib/odp-util: Reduce duplicated code.
Jarno Rajahalme [Fri, 5 Sep 2014 22:44:20 +0000 (15:44 -0700)]
lib/odp-util: Reduce duplicated code.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib/odp-util: Fix mapping to Netlink frag mask.
Jarno Rajahalme [Fri, 5 Sep 2014 22:44:20 +0000 (15:44 -0700)]
lib/odp-util: Fix mapping to Netlink frag mask.

The frag member in the Netlink interface is an uint8_t enumeration
type, not a bitfield, so it should always be either fully masked or
not masked at all.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib/odp: Use masked set actions.
Jarno Rajahalme [Fri, 5 Sep 2014 23:00:49 +0000 (16:00 -0700)]
lib/odp: Use masked set actions.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoofproto: Probe for masked set action support.
Jarno Rajahalme [Fri, 5 Sep 2014 22:44:20 +0000 (15:44 -0700)]
ofproto: Probe for masked set action support.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib/odp-util: Skip ignored fields when parsing and formatting.
Jarno Rajahalme [Tue, 9 Sep 2014 21:50:36 +0000 (14:50 -0700)]
lib/odp-util: Skip ignored fields when parsing and formatting.

When a whole field of a key value is ignored, skip it when formatting
the key, and allow it to be left out when parsing the key from a
string.  However, when the 'verbose' formatting is requested those are
still formatted, as it may help in debugging.

Now the named key fields can also be given in arbitrary order.
Duplicate field values are not checked for, so the last one will
remain in effect.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib/odp-execute: Use dpif_packet_set_dp_hash() instead of ->dp_hash
Daniele Di Proietto [Tue, 9 Sep 2014 21:21:41 +0000 (14:21 -0700)]
lib/odp-execute: Use dpif_packet_set_dp_hash() instead of ->dp_hash

When building with DPDK support, 'struct dpif_packet' won't have 'dp_hash'
member. dpif_packet_set_dp_hash() and dpif_packet_get_dp_hash() should be used.

Furthermore, the masked set action shouldn't read 'md->dp_hash' (which is
shared in a batch), but should use dpif_packet_get_dp_hash() to get each packet
private hash.

This commit fixes the build with DPDK.

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agonetlink-socket: remove local variable in do_lookup_genl_family.
Nithin Raju [Tue, 9 Sep 2014 20:50:57 +0000 (13:50 -0700)]
netlink-socket: remove local variable in do_lookup_genl_family.

'sock' is not initialized and hence should not be un-initialized
as well in the failure path.

Reported-by: Gurucharan Shetty <shettyg@nicira.com>
Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agodatapath-windows: refactor code to setup dump start state
Nithin Raju [Tue, 9 Sep 2014 20:14:31 +0000 (13:14 -0700)]
datapath-windows: refactor code to setup dump start state

Per review comment, in this patch we refactor the code to create a
OvsSetupDumpStart() which can be leveraged by dump functions in the
future. I have not refactored the code that continues the dump
operation primarily since it is not final yet. Once the netlink set
APIs are in place, we can refactor that too.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agonetlink-socket: Add support for async notification on Windows.
Eitan Eliahu [Tue, 9 Sep 2014 03:08:12 +0000 (20:08 -0700)]
netlink-socket: Add support for async notification on Windows.

We keep an outstanding, out of band, I/O request in the driver at all time.
Once an event generated the driver queues the event message, completes the
pending I/O and unblocks the calling thread through setting the event in the
overlapped structure in the NL socket. The thread will read all all event
messages synchronously through the call of nl_sock_recv()

Signed-off-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
Acked-by: Saurabh Shah <ssaurabh@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoNEWS: Mention RSTP.
Jarno Rajahalme [Tue, 9 Sep 2014 18:21:36 +0000 (11:21 -0700)]
NEWS: Mention RSTP.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agolib/rstp: Use hmap instead of a list for ports.
Jarno Rajahalme [Fri, 22 Aug 2014 16:01:36 +0000 (09:01 -0700)]
lib/rstp: Use hmap instead of a list for ports.

Finding a given port is faster.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Daniele Venturino <daniele.venturino@m3s.it>
9 years agolib/rstp: Eliminate ports_count.
Jarno Rajahalme [Tue, 9 Sep 2014 18:13:26 +0000 (11:13 -0700)]
lib/rstp: Eliminate ports_count.

It was only used to guard against unintialized list.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Daniele Venturino <daniele.venturino@m3s.it>
9 years agolib/rstp: Simplify priority vector comparison.
Jarno Rajahalme [Fri, 22 Aug 2014 16:01:36 +0000 (09:01 -0700)]
lib/rstp: Simplify priority vector comparison.

Testing for sameness first makes the logic simpler to follow.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Daniele Venturino <daniele.venturino@m3s.it>
9 years agolib/rstp: CodingStyle fixes.
Jarno Rajahalme [Fri, 22 Aug 2014 16:01:35 +0000 (09:01 -0700)]
lib/rstp: CodingStyle fixes.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Daniele Venturino <daniele.venturino@m3s.it>
9 years agolib/rstp: Remove lock recursion.
Jarno Rajahalme [Fri, 22 Aug 2014 16:01:35 +0000 (09:01 -0700)]
lib/rstp: Remove lock recursion.

Change the RSTP send_bpdu interface so that a recursive mutex is not
needed.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Daniele Venturino <daniele.venturino@m3s.it>
9 years agolib/rstp: More robust thread safety.
Jarno Rajahalme [Tue, 9 Sep 2014 18:11:18 +0000 (11:11 -0700)]
lib/rstp: More robust thread safety.

Current code expects there to be a single thread that is responsible
for creating rstp and creating and deleting rstp_port objects.  rstp
objects are also deleted from other threads, as managed by reference
counting.

rstp port objects are not reference counted, which means that
references to rstp ports may only be held while holding the rstp
mutex, or by the thread that creates and deletes them.

This patch adds reference counting to RSTP ports, which allows ports
to be passed from ofproto-dpif to ofproto-dpif-xlate without using the
RSTP port number.  This simplifies RSTP port reconfiguration, as the
port need not be resynchronized with xlate if just the port number
changes.  This also avoids lookups on the processing of RSTP BPDUs.

This patch also:

1. Exposes the rstp mutex so that related thread safety annotations
   can be used also within rstp-state-machines.c.

2. Internal variants of most setter an getter functions are defined,
   suffixed with two underscores.  These are annotated to be callable
   only when the mutex is held.

3. Port setters were only called in a specific pattern.  The new external
   port setter combines them in a single rspt_port_set() function.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Daniele Venturino <daniele.venturino@m3s.it>
9 years agolib/rstp: Inline trivial predicate functions.
Jarno Rajahalme [Fri, 22 Aug 2014 16:01:35 +0000 (09:01 -0700)]
lib/rstp: Inline trivial predicate functions.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Daniele Venturino <daniele.venturino@m3s.it>
9 years agolib/rstp: CodingStyle changes.
Jarno Rajahalme [Fri, 22 Aug 2014 16:01:35 +0000 (09:01 -0700)]
lib/rstp: CodingStyle changes.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Daniele Venturino <daniele.venturino@m3s.it>
9 years agolib/rstp: Refactor port initialization.
Jarno Rajahalme [Fri, 22 Aug 2014 16:01:35 +0000 (09:01 -0700)]
lib/rstp: Refactor port initialization.

Prior to this patch the default values for ports were set in three
different places.  This refactors them all to one helper function.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Daniele Venturino <daniele.venturino@m3s.it>
9 years agolib/rstp: Refactor port number allocation.
Jarno Rajahalme [Fri, 22 Aug 2014 16:01:35 +0000 (09:01 -0700)]
lib/rstp: Refactor port number allocation.

Port number allocation was O(N^3), this refactoring will make it O(N^2).

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Daniele Venturino <daniele.venturino@m3s.it>
9 years agolib/rstp: Refactor priority vector recalculation.
Jarno Rajahalme [Fri, 22 Aug 2014 16:01:35 +0000 (09:01 -0700)]
lib/rstp: Refactor priority vector recalculation.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Daniele Venturino <daniele.venturino@m3s.it>
9 years agolib/rstp: Better debug messages, style fixes.
Jarno Rajahalme [Tue, 9 Sep 2014 16:01:16 +0000 (09:01 -0700)]
lib/rstp: Better debug messages, style fixes.

Remove unused struct rstp_priority_vector4 definition, fix coding
style, fix sparse warnings.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Daniele Venturino <daniele.venturino@m3s.it>
9 years agolib/stp: Some debugging support.
Jarno Rajahalme [Fri, 22 Aug 2014 16:01:34 +0000 (09:01 -0700)]
lib/stp: Some debugging support.

Set the stp port name before enabling it, so that debugging messages
have the name to print out.

Do not treat the first state initialization as a state change.  Zero
is not a valid state, so changing from zero to STP_DISABLED is not a
state change.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Daniele Venturino <daniele.venturino@m3s.it>
9 years agolib/stp,rstp: Add unit more unit tests.
Jarno Rajahalme [Fri, 22 Aug 2014 16:01:34 +0000 (09:01 -0700)]
lib/stp,rstp: Add unit more unit tests.

Existing STP and RSTP test cases only test the protocols with test
utilities.  These tests test them as part of OVS using the
netdev-dummy device.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Daniele Venturino <daniele.venturino@m3s.it>
9 years agovswitch.xml: Fix RSTP configuration documentation.
Jarno Rajahalme [Fri, 22 Aug 2014 16:01:35 +0000 (09:01 -0700)]
vswitch.xml: Fix RSTP configuration documentation.

Move port's configuration options where they belong, add typing, and
correct errors.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Daniele Venturino <daniele.venturino@m3s.it>
9 years agoRapid Spanning Tree Protocol (IEEE 802.1D).
Daniele Venturino [Fri, 22 Aug 2014 16:01:34 +0000 (09:01 -0700)]
Rapid Spanning Tree Protocol (IEEE 802.1D).

This is the v5 from June 12th, 2014, rebased to OVS master, further
changes in following patches.

Signed-off by: Daniele Venturino <daniele.venturino@m3s.it>
Signed-off by: Martino Fornasa <mf@fornasa.it>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Daniele Venturino <daniele.venturino@m3s.it>
9 years agolib/dpif-netdev: Make emc_mutex recursive.
Jarno Rajahalme [Mon, 8 Sep 2014 22:33:00 +0000 (15:33 -0700)]
lib/dpif-netdev: Make emc_mutex recursive.

dpif_netdev_execute may be called while doing upcall processing.
Since the context of the input port is not tracked upto this point, we
use the shared dp->emc_cache for packet execution, where the emc_cache
is needed for recirculation.

While recursive mutexes can make thread safety analysis hard, for now
we change emc_mutex to be recursive.  Forthcoming new unit tests will
fail with the current non-recursive mutex.  Later improvements may
remove the need for this recursion.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Daniele Di Proietto <ddiproietto@vmware.com>
9 years agolib/odp-util: Add tunnel tp_src, tp_dst parsing and formatting.
Jarno Rajahalme [Fri, 5 Sep 2014 22:44:20 +0000 (15:44 -0700)]
lib/odp-util: Add tunnel tp_src, tp_dst parsing and formatting.

tp_src and tp_dst fields were recently added to struct flow_tnl, but
parsing and printing was missing.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib: Unify flags parsing and formatting.
Jarno Rajahalme [Fri, 5 Sep 2014 22:44:20 +0000 (15:44 -0700)]
lib: Unify flags parsing and formatting.

Use the "+-" syntax more uniformly when printing masked flags, and use
the syntax of delimited 1-flags also for formatting fully masked TCP
flags.

The "+-" syntax only deals with masked flags, but if there are many of
those, the printout becomes long and confusing.  Typically there are
many flags only when flags are fully masked, but even then most of
them are zeros, so it makes sense to print the flags that are set
(ones) and omit the zero flags.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib/odp-util: Refine odp_mask_attr_is_exact().
Jarno Rajahalme [Fri, 5 Sep 2014 22:44:20 +0000 (15:44 -0700)]
lib/odp-util: Refine odp_mask_attr_is_exact().

Some attributes are exact matches even when all bits are not ones.
Make odp_mask_attr_is_exact() to return true if the mask is set for
all the bits we actually care about.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib/util: Change is_all_zeros and is_all_ones to take a void *.
Jarno Rajahalme [Fri, 5 Sep 2014 22:44:19 +0000 (15:44 -0700)]
lib/util: Change is_all_zeros and is_all_ones to take a void *.

is_all_zeros() and is_all_ones() operate on bytes, but just like with
memset, it is easier to use if the first argument is a void *.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib/odp: Masked set action execution and printing.
Jarno Rajahalme [Fri, 5 Sep 2014 22:44:19 +0000 (15:44 -0700)]
lib/odp: Masked set action execution and printing.

Add a new action type OVS_ACTION_ATTR_SET_MASKED, and support for
parsing, printing, and committing them.

Masked set actions add a mask, immediately following the netlink
attribute data, within the netlink attribute itself.  Thus the key
attribute size for a masked set action is exactly double of the
non-masked set action.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath: Remove unused dp parameter.
Pravin B Shelar [Mon, 8 Sep 2014 19:46:03 +0000 (12:46 -0700)]
datapath: Remove unused dp parameter.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
9 years agoofproto-dpif-upcall: Fix a free of uninitialized memory.
Alex Wang [Mon, 8 Sep 2014 17:41:36 +0000 (10:41 -0700)]
ofproto-dpif-upcall: Fix a free of uninitialized memory.

On current master, when 'upcall_receive()' returns error, the
ofpbuf 'upcall->put_actions' is uninitialized.  In some usecase,
the failure of 'upcall_receive()' will cause uninitialize of
'upcall->put_actions' and free of uninitialized pointer.

This commit fixes the issue by making the caller not conduct
the uninitialize of the 'upcall' when there is error.

Found by inspection.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-numa: Fix a missing initialization.
Alex Wang [Mon, 8 Sep 2014 15:24:15 +0000 (08:24 -0700)]
ovs-numa: Fix a missing initialization.

This commit updates the pointer to 'struct numa_node'
when initializing the 'struct cpu_core'.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath: Set packet egress_tun_info.
Pravin B Shelar [Sun, 7 Sep 2014 22:18:07 +0000 (15:18 -0700)]
datapath: Set packet egress_tun_info.

packet execute is setting egress_tun_info in skb->cb, rather
than packet->cb. skb is netlink msg skb. This causes corruption
in netlink skb state stored in skb->cb (NETLINK_CB) which
results in following deadlock in netlink code.

=============================================
[ INFO: possible recursive locking detected ]
3.2.62 #2
---------------------------------------------
handler55/22851 is trying to acquire lock:
 (genl_mutex){+.+.+.}, at: [<ffffffff81471ad7>] genl_lock+0x17/0x20

but task is already holding lock:
 (genl_mutex){+.+.+.}, at: [<ffffffff81471ad7>] genl_lock+0x17/0x20

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(genl_mutex);
  lock(genl_mutex);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

1 lock held by handler55/22851:
 #0:  (genl_mutex){+.+.+.}, at: [<ffffffff81471ad7>] genl_lock+0x17/0x20

stack backtrace:
Pid: 22851, comm: handler55 Tainted: G           O 3.2.62 #2
Call Trace:
 [<ffffffff81097bb2>] print_deadlock_bug+0xf2/0x100
 [<ffffffff81099b99>] validate_chain+0x579/0x860
 [<ffffffff8109a17c>] __lock_acquire+0x2fc/0x4f0
 [<ffffffff8109aab0>] lock_acquire+0xa0/0x180
 [<ffffffff81519070>] __mutex_lock_common+0x60/0x420
 [<ffffffff8151959a>] mutex_lock_nested+0x4a/0x60
 [<ffffffff81471ad7>] genl_lock+0x17/0x20
 [<ffffffff81471af6>] genl_rcv+0x16/0x40
 [<ffffffff8146ff72>] netlink_unicast+0x2f2/0x310
 [<ffffffff81470159>] netlink_ack+0x109/0x1f0
 [<ffffffff8147030b>] netlink_rcv_skb+0xcb/0xd0
 [<ffffffff81471b05>] genl_rcv+0x25/0x40
 [<ffffffff8146ff72>] netlink_unicast+0x2f2/0x310
 [<ffffffff8147134c>] netlink_sendmsg+0x28c/0x3d0
 [<ffffffff8143375f>] sock_sendmsg+0xef/0x120
 [<ffffffff81435766>] ___sys_sendmsg+0x416/0x430
 [<ffffffff81435949>] __sys_sendmsg+0x49/0x90
 [<ffffffff814359a9>] sys_sendmsg+0x19/0x20
 [<ffffffff8152432b>] system_call_fastpath+0x16/0x1b

Reported-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
9 years agodatapath: distinguish between the dropped and consumed skb
Li RongQing [Sun, 7 Sep 2014 21:49:02 +0000 (14:49 -0700)]
datapath: distinguish between the dropped and consumed skb

distinguish between the dropped and consumed skb, not assume the skb
is consumed always

Cc: Thomas Graf <tgraf@noironetworks.com>
Cc: Pravin Shelar <pshelar@nicira.com>
Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
9 years agodatapath: fix panic with multiple vlan headers
Jiri Benc [Sun, 7 Sep 2014 21:36:01 +0000 (14:36 -0700)]
datapath: fix panic with multiple vlan headers

When there are multiple vlan headers present in a received frame, the
first one is put into vlan_tci and protocol is set to ETH_P_8021Q.
Anything in the skb beyond the VLAN TPID may be still non-linear,
including the inner TCI and ethertype. While ovs_flow_extract takes
care of IP and IPv6 headers, it does nothing with ETH_P_8021Q. Later,
if OVS_ACTION_ATTR_POP_VLAN is executed, __pop_vlan_tci pulls the
next vlan header into vlan_tci.

This leads to two things:

1. Part of the resulting ethernet header is in the non-linear part of
   the skb. When eth_type_trans is called later as the result of
   OVS_ACTION_ATTR_OUTPUT, kernel BUGs in __skb_pull. Also,
   __pop_vlan_tci is in fact accessing random data when it reads
   past the TPID.

2. network_header points into the ethernet header instead of behind it.
   mac_len is set to a wrong value (10), too.

Reported-by: Yulong Pei <ypei@redhat.com>
Signed-off-by: Jiri Benc <jbenc@redhat.com>
I have dropped second change. Since it assumes inner mac header is of
ETH_HLEN len which is not always true.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
9 years agodatapath: Implement recirc action without recursion
Andy Zhou [Mon, 11 Aug 2014 07:14:05 +0000 (00:14 -0700)]
datapath: Implement recirc action without recursion

Since kernel stack is limited in size, it is not wise to using
recursive function with large stack frames.

This patch provides an alternative implementation of recirc action
without using recursion.

A per CPU fixed sized, 'deferred action FIFO', is used to store either
recirc or sample actions encountered during execution of an action
list. Not executing recirc or sample action in place, but rather execute
them laster as 'deferred actions' avoids recursion.

Deferred actions are only executed after all other actions has been
executed, including the ones triggered by loopback from the kernel
network stack.

The size of the private FIFO, currently set to 20, limits the number
of total 'deferred actions' any one packet can accumulate.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agodatapath: Remove recirc stack depth limit check
Andy Zhou [Fri, 15 Aug 2014 08:53:30 +0000 (01:53 -0700)]
datapath: Remove recirc stack depth limit check

Future patches will change the recirc action implementation to not
using recursion. The stack depth detection is no longer necessary.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoovs-numa: Add module description.
Alex Wang [Fri, 5 Sep 2014 06:17:34 +0000 (06:17 +0000)]
ovs-numa: Add module description.

Add a short description of the module and its assumption.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoovs-numa: Add function for getting numa node id from core id.
Alex Wang [Fri, 5 Sep 2014 06:17:33 +0000 (06:17 +0000)]
ovs-numa: Add function for getting numa node id from core id.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoovs-numa: Relax the ovs_numa_*() input argument check.
Alex Wang [Fri, 5 Sep 2014 06:17:32 +0000 (06:17 +0000)]
ovs-numa: Relax the ovs_numa_*() input argument check.

Many of the ovs_numa_*() functions abort the program when the
input cpu socket or core id is invalid.  This commit relaxes
the input check and makes these functions return OVS_*_UNSPEC
when the check fails.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoovs-numa: Replace name 'cpu_socket' with 'numa_node'.
Alex Wang [Fri, 5 Sep 2014 06:17:31 +0000 (06:17 +0000)]
ovs-numa: Replace name 'cpu_socket' with 'numa_node'.

'numa' and 'socket' are currently used interchangeably in ovs-numa.
But they are not always equivalent as some platform can have multiple
sockets on a numa node.  To avoid confusion, this commit renames all
the 'cpu_socket' to 'numa_node'.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agocccl: Ability to enable compiler optimization.
Gurucharan Shetty [Thu, 28 Aug 2014 16:25:56 +0000 (09:25 -0700)]
cccl: Ability to enable compiler optimization.

MSVC has a '-O2' compiler optimization flag which makes code run
fast and is the recommended option for released code. For e.g.,
running "./tests/ovstest.exe test-cmap benchmark 1000000 3 1"
shows a 3x improvement for some cmap micro-benchmarks.

In the Visual Studio world, there is a concept of "release" build
(fast code, harder to debug) and a "debug" build (easier to debug).
The IDE provides this option and the IDE users expect something similar
for command line build.

So this commit, introduces a "--with-debug" configure option for Windows
and does not use '-O2' as a compiler option when specified. This can
be extended further if there are more compiler options that distinguish
a "release" build vs "debug" build.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Saurabh Shah <ssaurabh@vmware.com>
9 years agocccl: Enable ability to parallel build.
Gurucharan Shetty [Thu, 28 Aug 2014 16:20:21 +0000 (09:20 -0700)]
cccl: Enable ability to parallel build.

The /FS option allows serial access to PDB file creation letting
parallel builds succeed with mingw32-make (with some tricks). The
'make' that comes with MSYS has a bug that causes hangs with
parallel builds which supposedly has been fixed in the upcoming
1.0.19 release.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Saurabh Shah <ssaurabh@vmware.com>
9 years agoovs-atomics: Add atomic support Windows.
Gurucharan Shetty [Thu, 21 Aug 2014 20:57:37 +0000 (13:57 -0700)]
ovs-atomics: Add atomic support Windows.

Before this change (i.e., with pthread locks for atomics on Windows),
the benchmark for cmap and hmap was as follows:

$ ./tests/ovstest.exe test-cmap benchmark 10000000 3 1
Benchmarking with n=10000000, 3 threads, 1.00% mutations:
cmap insert:  61070 ms
cmap iterate:  2750 ms
cmap search:  14238 ms
cmap destroy:  8354 ms

hmap insert:   1701 ms
hmap iterate:   985 ms
hmap search:   3755 ms
hmap destroy:  1052 ms

After this change, the benchmark is as follows:
$ ./tests/ovstest.exe test-cmap benchmark 10000000 3 1
Benchmarking with n=10000000, 3 threads, 1.00% mutations:
cmap insert:   3666 ms
cmap iterate:   365 ms
cmap search:   2016 ms
cmap destroy:  1331 ms

hmap insert:   1495 ms
hmap iterate:  1026 ms
hmap search:   4167 ms
hmap destroy:  1046 ms

So there is clearly a big improvement for cmap.

But the correspondig test on Linux (with gcc 4.6) yeilds the following:

./tests/ovstest test-cmap benchmark 10000000 3 1
Benchmarking with n=10000000, 3 threads, 1.00% mutations:
cmap insert:   3917 ms
cmap iterate:   355 ms
cmap search:    871 ms
cmap destroy:  1158 ms

hmap insert:   1988 ms
hmap iterate:  1005 ms
hmap search:   5428 ms
hmap destroy:   980 ms

So for this particular test, except for "cmap search", Windows and
Linux have similar performance. Windows is around 2.5x slower in "cmap search"
compared to Linux. This has to be investigated.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
[With a lot of inputs and help from Jarno]
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoAUTHORS: Add Ariel Tubaltsev to AUTHORS.
Gurucharan Shetty [Thu, 4 Sep 2014 22:55:56 +0000 (15:55 -0700)]
AUTHORS: Add Ariel Tubaltsev to AUTHORS.

I missed it while adding commit 6ee1400bbff(vtep: additions to BFD
configuration and status reporting)

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agodatapath-windows: add support for GET_DP command to dump datpaths
Nithin Raju [Fri, 29 Aug 2014 22:48:10 +0000 (15:48 -0700)]
datapath-windows: add support for GET_DP command to dump datpaths

In this patch, we add support for the GET_DP netlink command to dump
the datpaaths. The userspace workflow to get this to work is the same
as on Linux. dpif-linux.c initiates a dump start by writing a netlink
message, and after that continues to read data from the kernel while
the kernel has data. The state is maintained in the kernel, and not in
userspace. This approach was taken since there was not great benefit
of maintaining state in userspace, and also to avoid userspace changes
specific to Windows.

This hopefully serves as a template to base the other dump commands on.

validation:
- With a hacked up dpif-linux.c to work on Windows,
  dpif_linux_enumerate() successfully enumerated the datapaths in the
  kernel.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Saurabh Shah <ssaurabh@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: add a context structure for user parameters
Nithin Raju [Fri, 29 Aug 2014 22:47:49 +0000 (15:47 -0700)]
datapath-windows: add a context structure for user parameters

In this patch we add a context structure for collecting all the parameters
passed from usersapce in one place. The idea is to reduce the number of
parameters being passed to the netlink command handler functions.

It can be argued that not all functions require all the arguments, but this
approach keeps the code clean, IMO.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Saurabh Shah <ssaurabh@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: make NL version a UIN8 and add a validateDp arg
Nithin Raju [Fri, 29 Aug 2014 22:47:37 +0000 (15:47 -0700)]
datapath-windows: make NL version a UIN8 and add a validateDp arg

I didn't realize earlier that version in a netlink message was a
UINT8. So, fixing that here.

Also, some of the commands don't pass a valid DP value. Hence adding
a field to identify such commands.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Saurabh Shah <ssaurabh@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Data structures and functions for dump state
Nithin Raju [Fri, 29 Aug 2014 22:47:21 +0000 (15:47 -0700)]
datapath-windows: Data structures and functions for dump state

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Saurabh Shah <ssaurabh@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofp-errors: Migrate EXT-444 errors to ONF experimenter ID.
Jean Tourrilhes [Thu, 21 Aug 2014 17:40:51 +0000 (10:40 -0700)]
ofp-errors: Migrate EXT-444 errors to ONF experimenter ID.

Signed-off-by: Jean Tourrilhes <jt@hpl.hp.com>
[blp@nicira.com removed the definitions of these errors in OF1.1 and OF1.2]
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoofp-errors: Fix bugs in treatment of OpenFlow experimenter errors.
Ben Pfaff [Thu, 21 Aug 2014 17:38:15 +0000 (10:38 -0700)]
ofp-errors: Fix bugs in treatment of OpenFlow experimenter errors.

OpenFlow 1.2 and later have "experimenter errors".  The OVS implementation
was buggy in a few ways.  First, a bug in extract-ofp-errors prevented
OF1.2+ experimenter errors from being properly decoded.  Second,
OF1.2+ experimenter errors have only a type, not a code, whereas all other
types of errors (standard errors, OF1.0/1.1 Nicira extension errors) have
both, but extract-ofp-errors didn't properly enforce that.

This commit fixes both problems and improves existing tests to verify that
encoding and decoding of experimenter errors now works properly.

This commit also fixes the definition of OFPBIC_DUP_INST.  It claimed to
have an OF1.1 experimenter error value although OF1.1 didn't have
experimenter errors.  This commit changes it to use a Nicira extension
error in OF1.1 instead.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agonx-match: Serialize standard xregs instead of Nicira registers, in OF1.5.
Ben Pfaff [Thu, 21 Aug 2014 03:59:43 +0000 (20:59 -0700)]
nx-match: Serialize standard xregs instead of Nicira registers, in OF1.5.

Commit 79fe0f4611b60 (meta-flow: Add 64-bit registers.) added support for
the OpenFlow 1.5 (draft) standardized registers, but neglected to cause
them to be serialized when Open vSwitch composes flow matches.  This meant
that they were always sent to a controller as pairs of Nicira extension
registers.  This commit fixes the problem.

Found by inspection.

ONF-JIRA: EXT-244
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agodatapath-windows: NetlinkBuf.c: Minor fix for lines exceeding 79 chars
Ankur Sharma [Wed, 3 Sep 2014 23:33:40 +0000 (16:33 -0700)]
datapath-windows: NetlinkBuf.c: Minor fix for lines exceeding 79 chars

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Tested-by: Ankur Sharma <ankursharma@vmware.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/37
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Netlink.c: Add netlink put APIs.
Ankur Sharma [Wed, 3 Sep 2014 23:33:32 +0000 (16:33 -0700)]
datapath-windows: Netlink.c: Add netlink put APIs.

In this change we have added the APIs for putting
netlink headers, attributes in a buffer.

The buffer is managed through NetlinkBuf.[c|h].

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Tested-by: Ankur Sharma <ankursharma@vmware.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/37
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: OvsTypes.h: Add support for BE16.
Ankur Sharma [Wed, 3 Sep 2014 23:33:24 +0000 (16:33 -0700)]
datapath-windows: OvsTypes.h: Add support for BE16.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Tested-by: Ankur Sharma <ankursharma@vmware.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/37
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: NetlinkProto: Fix typo and add padding macro.
Ankur Sharma [Wed, 3 Sep 2014 23:33:15 +0000 (16:33 -0700)]
datapath-windows: NetlinkProto: Fix typo and add padding macro.

Added a new macro for calculating the number of bytes required
for padding. Fixed a minor typo.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Tested-by: Ankur Sharma <ankursharma@vmware.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/37
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Add Netlink buffer management APIs.
Ankur Sharma [Wed, 3 Sep 2014 23:33:05 +0000 (16:33 -0700)]
datapath-windows: Add Netlink buffer management APIs.

In this change we have introduced buffer mgmt apis which will be
used while creating netlink messages. The basic functionality provided
by apis is on similar lines to ofpbuf in userspace with an exception
that it will not do run time buffer reallocation.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Tested-by: Ankur Sharma <ankursharma@vmware.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/37
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Move netlink files to a new directory.
Ankur Sharma [Wed, 3 Sep 2014 23:32:55 +0000 (16:32 -0700)]
datapath-windows: Move netlink files to a new directory.

In this change we have created a new directory named Netlink
inside datapath-windows/ovsext/. This directory will be used to
keep all the netlink related files.

The reason we have created new directory is that for 'put' related
APIs we will be adding netlink buffer mgmt files as well. These files
will take the count of netlink related files to 5. Hence
we decided to club the netlink files in a single directory.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Tested-by: Ankur Sharma <ankursharma@vmware.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/37
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodpif-netdev: Introduce port_try_ref() to prevent a race.
Alex Wang [Thu, 21 Aug 2014 22:54:07 +0000 (15:54 -0700)]
dpif-netdev: Introduce port_try_ref() to prevent a race.

When pmd thread interates through all ports for queue loading,
the main thread may unreference and 'rcu-free' a port before
pmd thread take new reference of it.  This could cause pmd
thread fail the reference and access freed memory later.

This commit fixes this race by introducing port_try_ref()
which uses ovs_refcount_try_ref_rcu().  And the pmd thread
will only load the port's queue, if port_try_ref() returns
true.

Found by inspection.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agovtep: additions to BFD configuration and status reporting
Ariel Tubaltsev [Tue, 2 Sep 2014 18:27:55 +0000 (11:27 -0700)]
vtep: additions to BFD configuration and status reporting

This commit adds default values for some BFD configuration keys
(bfd_config_local:bfd_dst_mac and bfd_params:enable). It also adds new
BFD status keys (bfd_enabled and bfd_info).

Signed-off-by: Ariel Tubaltsev <atubaltsev@vmware.com>
Signed-off-by: Bruce Davie <bdavie@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agonetdev-dpdk: Show interface status for dpdk0.
Alex Wang [Thu, 21 Aug 2014 22:53:15 +0000 (15:53 -0700)]
netdev-dpdk: Show interface status for dpdk0.

This commit fixes a bug which prevents the display of interface
status for dpdk0.

Found by inspection.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agopacket: Fix sparse warnings ICMPv6.
Jesse Gross [Wed, 3 Sep 2014 00:57:21 +0000 (17:57 -0700)]
packet: Fix sparse warnings ICMPv6.

The system defined ICMPv6 header doesn't have sparse annotation,
so this adds a definition so that endianness can be checked.

Reported-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
9 years agonetdev-dpdk: Make memory pool name contain the socket id.
Alex Wang [Tue, 17 Jun 2014 00:19:11 +0000 (17:19 -0700)]
netdev-dpdk: Make memory pool name contain the socket id.

This commit makes the memory pool name contain the socket id.
Since dpdk library do not allow creation of memory pool with
same name, this commit serves as a simple way of making each
name unique.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agodatapath: fix a memory leak
Li RongQing [Tue, 2 Sep 2014 20:31:12 +0000 (13:31 -0700)]
datapath: fix a memory leak

The user_skb maybe be leaked if the operation on it failed and codes
skipped into the label "out:" without calling genlmsg_unicast.

Cc: Pravin Shelar <pshelar@nicira.com>
Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agogetopt_long: Fix broken sequence of casts in __UNCONST macor.
Eitan Eliahu [Wed, 3 Sep 2014 02:11:13 +0000 (19:11 -0700)]
getopt_long: Fix broken sequence of casts in __UNCONST macor.

Unlike the compilation mode used for OVS x64 Linux Windows long word is
4 bytes for both 32 and 64 bit builds.
Replaced _UNCONST macro with CONST_CAST to avoid the intermediate casting
to an integer.

Testing: 32 and 64 Windows builds.
Signed-off-by: Eitan Eliahu eliahue@vmware.com
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-vsctl: Correctly exit on errors for non-map types in "remove" command.
Ben Pfaff [Tue, 2 Sep 2014 15:35:02 +0000 (08:35 -0700)]
ovs-vsctl: Correctly exit on errors for non-map types in "remove" command.

Reported-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
9 years agoofp-actions: Support "resubmit" actions in action sets.
Srini Seetharaman [Sun, 31 Aug 2014 07:24:46 +0000 (00:24 -0700)]
ofp-actions: Support "resubmit" actions in action sets.

Fixing issue where "resubmit" action in a group action set was not
considered sufficient to retain the full action set. This patch allows
a group action set (considered terminal with OF1.4 and earlier spec)
to have the "output" action come from a different table.

Signed-off-by: Srini Seetharaman <srini.seetharaman@gmail.com>
[blp@nicira.com added documentation]
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agotest-bitmap: Fix multiple minor memory leaks
Thomas Graf [Mon, 1 Sep 2014 16:10:26 +0000 (18:10 +0200)]
test-bitmap: Fix multiple minor memory leaks

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agotest-stp: Fix leak of open file descriptor for input_file
Thomas Graf [Mon, 1 Sep 2014 16:09:57 +0000 (18:09 +0200)]
test-stp: Fix leak of open file descriptor for input_file

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agotravis: Announce travis CI and new build list in NEWS and CONTRIBUTING
Thomas Graf [Mon, 1 Sep 2014 12:52:13 +0000 (14:52 +0200)]
travis: Announce travis CI and new build list in NEWS and CONTRIBUTING

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodpif-netdev: Avoid variable length array on MSVC.
Alin Serdean [Mon, 1 Sep 2014 20:11:54 +0000 (20:11 +0000)]
dpif-netdev: Avoid variable length array on MSVC.

MSVC does not like variable length array either.

This patch treats the following error:

lib/dpif-netdev.c(2272) : error C2057: expected constant expression
lib/dpif-netdev.c(2272) : error C2466: cannot allocate an array of constant size 0
lib/dpif-netdev.c(2272) : error C2133: 'batches' : unknown size
lib/dpif-netdev.c(2273) : error C2057: expected constant expression
lib/dpif-netdev.c(2273) : error C2466: cannot allocate an array of constant size 0
lib/dpif-netdev.c(2273) : error C2133: 'mfs' : unknown size
lib/dpif-netdev.c(2274) : error C2057: expected constant expression
lib/dpif-netdev.c(2274) : error C2466: cannot allocate an array of constant size 0
lib/dpif-netdev.c(2274) : error C2133: 'rules' : unknown size
lib/dpif-netdev.c(2363) : warning C4034: sizeof returns 0
lib/dpif-netdev.c(2381) : error C2057: expected constant expression
lib/dpif-netdev.c(2381) : error C2466: cannot allocate an array of constant size 0
lib/dpif-netdev.c(2381) : error C2133: 'keys' : unknown size
make[2]: *** [lib/dpif-netdev.lo] Error 1

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agotravis: Run 'make distcheck' instead of 'make check'
Thomas Graf [Fri, 29 Aug 2014 23:43:03 +0000 (01:43 +0200)]
travis: Run 'make distcheck' instead of 'make check'

make distcheck runs a superset of make check and will additionally
catch failures in adding new files to the Makefile. It will also test
installation and uninstallation of the package.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodpif-netdev: Exact match cache
Daniele Di Proietto [Fri, 29 Aug 2014 23:06:43 +0000 (16:06 -0700)]
dpif-netdev: Exact match cache

Since lookups in the classifier can be pretty expensive,
we introduce this (thread local) cache which simply
compares the miniflows of the packets

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agopacket-dpif: Add dpif_packet_{get, set}_hash()
Daniele Di Proietto [Fri, 29 Aug 2014 23:06:42 +0000 (16:06 -0700)]
packet-dpif: Add dpif_packet_{get, set}_hash()

These function are used to stored the packet hash. 'netdev-dpdk'
automatically set this value to the RSS hash returned by the
NIC. Other 'netdev's set it to 0 (which is an invalid hash
value), so that callers can compute the hash on their own.

If DPDK support is enabled, struct dpif_packet's member
'dp_hash' is removed and 'pkt.hash.rss' from DPDK mbuf is used

This commit also configure DPDK devices to compute RSS hash
for UDP and IPv6 packets

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agolib/ovs-thread: Avoid atomic read in ovsthread_once_start().
Jarno Rajahalme [Fri, 29 Aug 2014 23:15:44 +0000 (16:15 -0700)]
lib/ovs-thread: Avoid atomic read in ovsthread_once_start().

We can use a normal bool and rely on the mutex_lock/unlock and an
atomic_thread_fence for synchronization.

Also flip the return value of ovsthread_once_start__() to match the
one of ovsthread_once_start().

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib/ovs-thread: Use atomic_count.
Jarno Rajahalme [Fri, 29 Aug 2014 23:15:44 +0000 (16:15 -0700)]
lib/ovs-thread: Use atomic_count.

barrier->count is used as a simple counter and is not expected the
synchronize the state of any other variable, so we can use atomic_count,
which uses relaxed atomics.

Ditto for the 'next_id' within ovsthread_wrapper().

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib/seq: Document acquire-release semantics.
Jarno Rajahalme [Fri, 29 Aug 2014 23:15:44 +0000 (16:15 -0700)]
lib/seq: Document acquire-release semantics.

Seq objects would be really hard to use if they did not provide
acquire-release semantics.  Currently they do that via
ovs_mutex_lock()/ovs_mutex_unlock(), respectively.  Document the
behavior so that it is safer to rely on that elsewhere.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agolib/flow: Use BUILD_MESSAGE() to warn if BUILD_SEQ is not updated
Daniele Di Proietto [Fri, 29 Aug 2014 23:08:11 +0000 (16:08 -0700)]
lib/flow: Use BUILD_MESSAGE() to warn if BUILD_SEQ is not updated

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoAdd BUILD_MESSAGE() macro
Daniele Di Proietto [Fri, 29 Aug 2014 23:08:11 +0000 (16:08 -0700)]
Add BUILD_MESSAGE() macro

This commit introduces the BUILD_MESSAGE() macro. It uses _Pragma("message"),
with compilers that support that, to output a warning-like compile-time message
without blocking the compilation.

Used by next commit.

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoDocumentation: DPDK IVSHMEM VM Communications
Pravin B Shelar [Fri, 29 Aug 2014 22:18:54 +0000 (15:18 -0700)]
Documentation: DPDK IVSHMEM VM Communications

Adds documentation on how to run IVSHMEM communication through VM.

Signed-off-by: Mike A. Polehn <mike.a.polehn@intel.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agonetdev-dpdk: Use different constant for ring size
Daniele Di Proietto [Wed, 30 Jul 2014 15:51:34 +0000 (08:51 -0700)]
netdev-dpdk: Use different constant for ring size

DPDK rings must have a power-of-two size.

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agodatapath: simplify sample action implementation
Andy Zhou [Fri, 29 Aug 2014 20:20:23 +0000 (13:20 -0700)]
datapath: simplify sample action implementation

The current sample() function implementation is more complicated
than necessary in handling single user space action optimization
and skb reference counting. There is no functional changes.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agotravis: Add build@openvswitch.org email list for build notifications.
Thomas Graf [Fri, 29 Aug 2014 17:56:26 +0000 (19:56 +0200)]
travis: Add build@openvswitch.org email list for build notifications.

Enable build notifications to build@openvswitch.org

Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath: Fix checksum calculation when modifying ICMPv6 packets.
Jesse Gross [Fri, 15 Aug 2014 18:01:54 +0000 (11:01 -0700)]
datapath: Fix checksum calculation when modifying ICMPv6 packets.

The checksum of ICMPv6 packets uses the IP pseudoheader as part of
the calculation, unlike ICMP in IPv4. This was not implemented,
which means that modifying the IP addresses of an ICMPv6 packet
would cause the checksum to no longer be correct as the psuedoheader
did not match.

Reported-by: Neal Shrader <icosahedral@gmail.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoINSTALL: Correct typo.
Ben Pfaff [Fri, 29 Aug 2014 17:39:25 +0000 (10:39 -0700)]
INSTALL: Correct typo.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
9 years agothread: Use explicit wide type when shifting > 32 bits
Thomas Graf [Fri, 29 Aug 2014 10:21:49 +0000 (12:21 +0200)]
thread: Use explicit wide type when shifting > 32 bits

Without the explicit wide type, the shift operation may be performed
on a int which will result in implementation defined behaviour on a
system with more than 32 CPUs.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agonetdev-linux: Cast policer rate to uint64_t to avoid overflow
Thomas Graf [Fri, 29 Aug 2014 10:20:21 +0000 (12:20 +0200)]
netdev-linux: Cast policer rate to uint64_t to avoid overflow

tc_fill_rate() takes a 64bit int, casting kbits_rate from int
to uint64_t avoids a possible overflow when translating from
kbits to bytes.

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofproto/ofproto: Use relaxed atomics.
Jarno Rajahalme [Fri, 29 Aug 2014 17:34:53 +0000 (10:34 -0700)]
ofproto/ofproto: Use relaxed atomics.

Neither 'miss_config', 'n_missed', nor 'n_matched' is used to
synchronize the state of any other variable, so we can use relaxed
atomic operations on them.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>