sliver-openvswitch.git
10 years agodatapath: Use with RCU_INIT_POINTER(x, NULL) in vport-gre.c
Monam Agarwal [Fri, 28 Mar 2014 03:12:22 +0000 (20:12 -0700)]
datapath: Use with RCU_INIT_POINTER(x, NULL) in vport-gre.c

This patch replaces rcu_assign_pointer(x, NULL) with RCU_INIT_POINTER(x, NULL)

The rcu_assign_pointer() ensures that the initialization of a structure
is carried out before storing a pointer to that structure.
And in the case of the NULL pointer, there is no structure to initialize.
So, rcu_assign_pointer(p, NULL) can be safely converted to RCU_INIT_POINTER(p, NULL)

Signed-off-by: Monam Agarwal <monamagarwal123@gmail.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agosparse: workaround for a bug in sparse.
Pritesh Kothari [Fri, 28 Mar 2014 19:20:00 +0000 (12:20 -0700)]
sparse: workaround for a bug in sparse.

sparse emits the following warning:
lib/dpif-netdev.c:1755:15: warning: Initializer entry defined twice
lib/dpif-netdev.c:1755:15:   also defined here
due to a bug in sparse which doesn't like inlined functions which
expands a #define within it. This commit removes inline to make
sparse happy.

Signed-off-by: Pritesh Kothari <pritesh.kothari@cisco.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agosparse: fix the order of include paths to make sparse happy.
Pritesh Kothari [Fri, 28 Mar 2014 19:19:59 +0000 (12:19 -0700)]
sparse: fix the order of include paths to make sparse happy.

This fix restores the order of include path such that the local include/ comes
before the system /usr/include in the #include path. Thus by making sure that
include/linux/types.h and include/linux/openvswitch.h take precedence over the
similar files in /usr/include/ directory.

Signed-off-by: Pritesh Kothari <pritesh.kothari@cisco.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agorecirculation: Some cosmetic fixes
YAMAMOTO Takashi [Thu, 27 Mar 2014 14:38:57 +0000 (14:38 +0000)]
recirculation: Some cosmetic fixes

Wrap long lines, fix whitespaces, and fix a typo in a comment.
No functional changes are intended.

Cc: Andy Zhou <azhou@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Andy Zhou <azhou@nicira.com>
10 years agolib/packet.h: add hash_mac()
Andy Zhou [Fri, 28 Mar 2014 03:22:37 +0000 (20:22 -0700)]
lib/packet.h: add hash_mac()

Add hash_mac() and apply it when appropriate.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agolib/hash.h: add hash_uint64()
Andy Zhou [Fri, 28 Mar 2014 02:38:04 +0000 (19:38 -0700)]
lib/hash.h: add hash_uint64()

Add hash_uint64() and apply it when appropriate.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agolib/hash.h: fix hash_2words
Andy Zhou [Fri, 28 Mar 2014 02:08:36 +0000 (19:08 -0700)]
lib/hash.h: fix hash_2words

Number of bytes in 2 words should be 8, instead of 4 bytes,
to better follow the mhash_finish() API. It is unlikely the fix
will improve the quality of hashing results.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-appctl: A port for Windows.
Gurucharan Shetty [Fri, 28 Mar 2014 15:37:36 +0000 (08:37 -0700)]
ovs-appctl: A port for Windows.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agounixctl: Add support for Windows.
Gurucharan Shetty [Fri, 28 Mar 2014 15:19:59 +0000 (08:19 -0700)]
unixctl: Add support for Windows.

For Windows, use a kernel assigned localhost TCP port to listen for
runtime management connections and then write it into a file
so that a client can read it and then make a TCP connection.

Since we do not have the infrastructure to create pidfiles on
windows as of now, we create the *.ctl file without a pid. This
should be okay since we use different OVS_RUNDIR when we run
multiple copies of a daemon.

We do not generate man pages on Windows. But we still update them
for Windows so that anyone can read it elsewhere. Since we do not
generate it directly, we cannot dynamically show the configured
OVS_RUNDIR in windows. So, I have a not so nice \fIOVS_RUNDIR\fR
in the man page.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agostream-tcp: Use closesocket instead of close for sockets.
Gurucharan Shetty [Thu, 27 Mar 2014 23:39:35 +0000 (16:39 -0700)]
stream-tcp: Use closesocket instead of close for sockets.

We should use closesocket() while closing sockets so that
closing sockets work fine on both POSIX and Windows.
(In POSIX, we #define closesocket close)

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-appctl: Close the connection during error.
Gurucharan Shetty [Thu, 27 Mar 2014 22:40:25 +0000 (15:40 -0700)]
ovs-appctl: Close the connection during error.

When we send a wrong command to a Open vSwitch daemon, it returns
an error. In that case, close the connection to the daemon.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-upcall: Fix a race.
Alex Wang [Tue, 25 Mar 2014 20:57:25 +0000 (13:57 -0700)]
ofproto-dpif-upcall: Fix a race.

Commit 61057e884ca9c(ofproto-dpif-upcall: Slightly simplify
udpif_upcall_handler().) restructured the main loop in
udpif_upcall_handler() and discarded the check for the
'exit_latch' after acquiring the mutex.  This makes it
possible for the following race:

- main thread sets the 'exit_latch' after the handler thread
  checking it.
- main thread acquires the handler thread mutex and signals the
  condition variable of handler thread.
- main thread releases the mutex and 'join' the handler thread.
- handler thread acquires the mutex, finds that n_upcalls is 0
  and waits on the signal of condition variable.
- then OVS will hang forever.

This commit fixes the above issue by adding a check for the
'exit_latch' after acquiring the mutex.

Bug #1217229

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoovs-vsctl: Improve error reporting
Andy Zhou [Thu, 27 Mar 2014 16:10:31 +0000 (17:10 +0100)]
ovs-vsctl: Improve error reporting

ovs-vsctl is a command-line interface to the Open vSwitch database,
and as such it just modifies the desired Open vSwitch configuration in
the database.  ovs-vswitchd, on the other hand, monitors the database
and implements the actual configuration specified in the database.
This can lead to surprises when the user makes a change to the
database, with ovs-vsctl, that ovs-vswitchd cannot actually
implement. In such a case, the ovs-vsctl command silently succeeds
(because the database was successfully updated) but its desired
effects don't actually take place. One good example of such a change
is attempting to add a port with a misspelled name (e.g. ``ovs-vsctl
add-port br0 fth0'', where fth0 should be eth0); another is creating
a bridge or a port whose name is longer than supported
(e.g. ``ovs-vsctl add-br'' with a 16-character bridge name on
Linux). It can take users a long time to realize the error, because it
requires looking through the ovs-vswitchd log.

The patch improves the situation by checking whether operations that
ovs executes succeed and report an error when
they do not.  This patch only report add-br and add-port
operation errors by examining the `ofport' value that
ovs-vswitchd stores into the database record for the newly created
interface.  Until ovs-vswitchd finishes implementing the new
configuration, this column is empty, and after it finishes it is
either -1 (on failure) or a positive number (on success).

Signed-off-by: Andy Zhou <azhou@nicira.com>
Co-authored-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: Thomas Graf <tgraf@redhat.com>
Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovsdb-idlc: Generate new *_get_for_uuid() functions.
Ben Pfaff [Fri, 28 Mar 2014 02:11:20 +0000 (19:11 -0700)]
ovsdb-idlc: Generate new *_get_for_uuid() functions.

This allows a client to obtain the IDL version of a row given its UUID.
It isn't normally useful, but there's a specialized use case for getting
the IDL version of a row given the UUID returned by
ovsdb_idl_txn_get_insert_uuid() following transaction commit.

An alternative would be to generate table-specific versions of
ovsdb_idl_txn_get_insert_uuid().  That seems reasonable to me too.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agostream-tcp: Fix error message for failed TCP_NODELAY setting on Windows.
Ben Pfaff [Thu, 27 Mar 2014 17:04:55 +0000 (10:04 -0700)]
stream-tcp: Fix error message for failed TCP_NODELAY setting on Windows.

Reported-by: Gurucharan Shetty <gshetty@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Kyle Mestery <mestery@noironetworks.com>
Acked-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agoFAQ: Fix supported kernel version.
Pravin [Tue, 25 Mar 2014 18:08:19 +0000 (11:08 -0700)]
FAQ: Fix supported kernel version.

OVS 2.1 does not support kernel 3.12.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Kyle Mestery <mestery@noironetworks.com>
10 years agolib/ofpbuf: Remove 'l7' pointer.
Jarno Rajahalme [Tue, 25 Mar 2014 22:26:23 +0000 (15:26 -0700)]
lib/ofpbuf: Remove 'l7' pointer.

Now that we don't need to parse TCP flags from the packet after
extraction, we usually do not need the 'l7' pointer any more.  When
needed, ofpbuf_get_tcp|udp|sctp|icmp_payload() or ofpbuf_get_l4_size()
can be used instead.

Removal of 'l7' was requested by Pravin for the DPDK datapath work, as
it simplifies packet parsing a bit.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolib/ofpbuf: Inline the trivial ofpbuf functions.
Jarno Rajahalme [Tue, 25 Mar 2014 22:26:23 +0000 (15:26 -0700)]
lib/ofpbuf: Inline the trivial ofpbuf functions.

Inline the most trivial ofpbuf functions to allow for better optimization.
Also inline the most often used ofpbuf_pull() and ofpbuf_try_pull(), which
should help streamline packet parsing.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolib/pcap: Use ofpbuf_tail() instead of ofpbuf_end().
Jarno Rajahalme [Tue, 25 Mar 2014 22:26:23 +0000 (15:26 -0700)]
lib/pcap: Use ofpbuf_tail() instead of ofpbuf_end().

Using ofpbuf_end() to compute payload length would fail if the ofpbuf
had any tailroom.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolockfile: Minor code cleanup.
Ben Pfaff [Tue, 25 Mar 2014 19:35:28 +0000 (12:35 -0700)]
lockfile: Minor code cleanup.

There were more superficial differences between Windows and non-Windows
versions of the code due to naming.  This commit reduces those differences.

CC: Gurucharan Shetty <shettyg@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: user space datapath recirculation
Andy Zhou [Tue, 4 Mar 2014 23:36:03 +0000 (15:36 -0800)]
dpif-netdev: user space datapath recirculation

Add basic recirculation infrastructure and user space
data path support for it. The following bond mega flow patch will
make use of this infrastructure.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Added Per backer recirculation ID management
Andy Zhou [Mon, 27 Jan 2014 09:18:30 +0000 (01:18 -0800)]
ofproto-dpif: Added Per backer recirculation ID management

Recirculation ID needs to be unique per datapath. Its usage will be
tracked by the backer that corresponds to the datapath.

In theory, Recirculation ID can be any uint32_t value, except 0. This
implementation limits to a smaller range just for ease of debugging.
Make the range size 0 effectively disables recirculation.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agolib/flow: add dp_hash and recirc_id to struct flow
Andy Zhou [Tue, 4 Mar 2014 22:20:19 +0000 (14:20 -0800)]
lib/flow: add dp_hash and recirc_id to struct flow

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agonetdev-bsd: compilation fixes
YAMAMOTO Takashi [Tue, 25 Mar 2014 20:13:43 +0000 (05:13 +0900)]
netdev-bsd: compilation fixes

This fixes regressions from commit f7791740
("netdev: Rename netdev_rx to netdev_rxq")
and commit df1e5a3b.
("netdev: Extend rx_recv to pass multiple packets.")

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Clarify locking.
Jarno Rajahalme [Tue, 25 Mar 2014 16:12:44 +0000 (09:12 -0700)]
datapath: Clarify locking.

Remove unnecessary locking from functions that are always called with
appropriate locking.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Thomas Graf <tgraf@redhat.com>
10 years agodpif-netdev: Fix a compilation warning
Andy Zhou [Tue, 25 Mar 2014 04:10:39 +0000 (21:10 -0700)]
dpif-netdev: Fix a compilation warning

Building OVS tree without DPDK produced the following warning message:
    lib/dpif-netdev.c:1868:5: error: statement with no effect

This error message is complaining the return value of the following
macro not being used.
#define pmd_thread_setaffinity_cpu(c) (0)

The patch fixed this warnning by making the stub functions
as inline funtions.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
10 years agonetdev-dpdk: Use multiple core for dpdk IO.
Pravin [Fri, 21 Mar 2014 05:07:44 +0000 (22:07 -0700)]
netdev-dpdk: Use multiple core for dpdk IO.

DPDK need to set _lcore_id for using multiple core.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Thomas Graf <tgraf@redhat.com>
10 years agodpif-netdev: Add DPDK netdev.
Pravin [Tue, 25 Mar 2014 02:23:08 +0000 (19:23 -0700)]
dpif-netdev: Add DPDK netdev.

Following patch adds DPDK netdev-class to userspace datapath. Now
OVS can use DPDK port for IO by just configuring DPDK port and then
adding dpdk type port to userspace datapath.

Refer to INSTALL.DPDK doc for further info.

This is based a patch from Gerald Rogers.

Signed-off-by: Gerald Rogers <gerald.rogers@intel.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Thomas Graf <tgraf@redhat.com>
10 years agoutils: Introduce xsleep for RCU quiescent state
Pravin [Fri, 21 Mar 2014 16:20:42 +0000 (09:20 -0700)]
utils: Introduce xsleep for RCU quiescent state

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofpbuf: Add OFPBUF_DPDK type.
Pravin [Thu, 20 Mar 2014 18:00:14 +0000 (11:00 -0700)]
ofpbuf: Add OFPBUF_DPDK type.

This will be used by DPDK for zero copy IO.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
10 years agonetdev: Add support multiqueue recv.
Pravin [Fri, 21 Mar 2014 03:52:06 +0000 (20:52 -0700)]
netdev: Add support multiqueue recv.

new netdev type like DPDK can support multi-queue IO. Following
patch Adds support for same.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Thomas Graf <tgraf@redhat.com>
10 years agonetdev: Rename netdev_rx to netdev_rxq
Pravin [Fri, 21 Mar 2014 02:38:14 +0000 (19:38 -0700)]
netdev: Rename netdev_rx to netdev_rxq

Preparation for multi queue netdev IO.  There are no functional changes
in this patch.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Thomas Graf <tgraf@redhat.com>
10 years agodpif-netdev: Add poll-mode-device thread.
Pravin [Thu, 20 Mar 2014 17:57:41 +0000 (10:57 -0700)]
dpif-netdev: Add poll-mode-device thread.

This patch adds PMD type netdev for netdevice with poll-mode
drivers.  Since there is no way to get signal on a packet recv
from these devices we need to poll them in busy loop.  So minimize
system call overhead this patch uses dpif-thread exclusively
for PMD devices and rest of devices which needs system calls to
do IO are moved to dpif-netdev-run().
PMD device like DPDK work in userspace so there is no system call
overhead for them.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Thomas Graf <tgraf@redhat.com>
10 years agodpif-netdev: Add ref-counting for port.
Pravin [Thu, 20 Mar 2014 17:57:19 +0000 (10:57 -0700)]
dpif-netdev: Add ref-counting for port.

DPDK Poll mode thread need to keep ref to dpif-port.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Thomas Graf <tgraf@redhat.com>
10 years agonetdev: Send ofpbuf directly to netdev.
Pravin [Thu, 20 Mar 2014 17:56:51 +0000 (10:56 -0700)]
netdev: Send ofpbuf directly to netdev.

DPDK netdev need to access ofpbuf while sending buffer. Following
patch changes netdev_send accordingly.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Thomas Graf <tgraf@redhat.com>
10 years agonetdev: Extend rx_recv to pass multiple packets.
Pravin [Thu, 20 Mar 2014 17:54:37 +0000 (10:54 -0700)]
netdev: Extend rx_recv to pass multiple packets.

DPDK can receive multiple packets but current netdev API does
not allow that.  Following patch allows dpif-netdev receive batch
of packet in a rx_recv() call for any netdev port.  This will be
used by dpdk-netdev.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
10 years agodatapath: Avoid assigning a NULL pointer to flow actions.
Jarno Rajahalme [Tue, 25 Mar 2014 00:34:48 +0000 (17:34 -0700)]
datapath: Avoid assigning a NULL pointer to flow actions.

Flow SET can accept an empty set of actions, with the intended
semantics of leaving existing actions unmodified.  This seems to have
been brokin after OVS 1.7, as we have assigned the flow's actions
pointer to NULL in this case, but we never check for the NULL pointer
later on.  This patch restores the intended behavior and documents it
in the include/linux/openvswitch.h.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
10 years agodatapath: Remove a debugging message.
Jarno Rajahalme [Tue, 25 Mar 2014 00:34:48 +0000 (17:34 -0700)]
datapath: Remove a debugging message.

This was left in accidentally.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agolib/flow: Fix flow_hash_5tuple().
Jarno Rajahalme [Tue, 25 Mar 2014 00:34:48 +0000 (17:34 -0700)]
lib/flow: Fix flow_hash_5tuple().

First part of the hash was discarded as basis was used too late.

Also be explicit about the input type expected by mhash_add().

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
10 years agopackets: packet metadata from flow function instead of macro.
Gurucharan Shetty [Fri, 21 Mar 2014 17:36:52 +0000 (10:36 -0700)]
packets: packet metadata from flow function instead of macro.

Commit 03fbdf8d9c80a (lib/flow: Retain ODPP_NONE on flow_extract())
replaced packet metadata initialization function by a macro.
Visual studio does not like nested structure initialization that
is done in that macro.

This commit replaces the macro by a function.

CC: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agodatapath: Compact sw_flow_key.
Jarno Rajahalme [Tue, 18 Mar 2014 23:32:45 +0000 (16:32 -0700)]
datapath: Compact sw_flow_key.

Minimize padding in sw_flow_key and move 'tp' top the main struct.
These changes simplify code when accessing the transport port numbers
and the tcp flags, and makes the sw_flow_key 8 bytes smaller on 64-bit
systems (128->120 bytes).  These changes also make the keys for IPv4
packets to fit in one cache line.

There is a valid concern for safety of packing the struct
ovs_key_ipv4_tunnel, as it would be possible to take the address of
the tun_id member as a __be64 * which could result in unaligned access
in some systems. However:

- sw_flow_key itself is 64-bit aligned, so the tun_id within is always
  64-bit aligned.
- We never make arrays of ovs_key_ipv4_tunnel (which would force every
  second tun_key to be misaligned).
- We never take the address of the tun_id in to a __be64 *.
- Whereever we use struct ovs_key_ipv4_tunnel outside the sw_flow_key,
  it is in stack (on tunnel input functions), where compiler has full
  control of the alignment.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
10 years agoofp-util: Fix inconsistencies in table features type.
Jarno Rajahalme [Mon, 24 Mar 2014 17:16:03 +0000 (10:16 -0700)]
ofp-util: Fix inconsistencies in table features type.

'metadata_match' and 'metadata_write' fields are defined as ovs_be64,
but sometimes used and referred to as uint64_t.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agodatapath: Use TCP flags in the flow key for stats.
Jarno Rajahalme [Tue, 18 Mar 2014 23:32:45 +0000 (16:32 -0700)]
datapath: Use TCP flags in the flow key for stats.

We already extract the TCP flags for the key, might as well use that
for stats.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
10 years agodatapath: Fix output of SCTP mask.
Jarno Rajahalme [Tue, 18 Mar 2014 23:32:45 +0000 (16:32 -0700)]
datapath: Fix output of SCTP mask.

The 'output' argument of the ovs_nla_put_flow() is the one from which
the bits are written to the netlink attributes.  For SCTP we
accidentally used the bits from the 'swkey' instead.  This caused the
mask attributes to include the bits from the actual flow key instead
of the mask.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
10 years agoofp-util: Implement OFPMP_TABLE_FEATURES decoding and printing.
Alexander Wu [Mon, 24 Mar 2014 06:20:04 +0000 (23:20 -0700)]
ofp-util: Implement OFPMP_TABLE_FEATURES decoding and printing.

Signed-off-by: Alexander Wu <alexander.wu@huawei.com>
Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobitmap: Make bitmap_scan() able to scan for 0-bits or 1-bits.
Ben Pfaff [Mon, 24 Mar 2014 06:00:17 +0000 (23:00 -0700)]
bitmap: Make bitmap_scan() able to scan for 0-bits or 1-bits.

An upcoming commit will make use of this feature.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-actions: Complete ofp13_action_type.
Alexander Wu [Fri, 17 Jan 2014 21:19:35 +0000 (13:19 -0800)]
ofp-actions: Complete ofp13_action_type.

Signed-off-by: Alexander Wu <alexander.wu@huawei.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-actions: New function ovs_instruction_type_from_inst_type().
Alexander Wu [Fri, 17 Jan 2014 21:18:16 +0000 (13:18 -0800)]
ofp-actions: New function ovs_instruction_type_from_inst_type().

Signed-off-by: Alexander Wu <alexander.wu@huawei.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoDisable OF1.4 in ovs-vswitchd and ovs-ofctl without specially enabling.
Ben Pfaff [Sun, 23 Mar 2014 21:47:47 +0000 (14:47 -0700)]
Disable OF1.4 in ovs-vswitchd and ovs-ofctl without specially enabling.

When the OF1.4 is made safe, so that receiving an unimplemented message
cannot crash the switch, this commit should be reverted.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Allow the use of the OpenFlow 1.4 protocol
Alexandru Copot [Mon, 3 Mar 2014 13:22:32 +0000 (15:22 +0200)]
ofproto: Allow the use of the OpenFlow 1.4 protocol

This defines the version number for OpenFlow 1.4 so that the switch
can actually use it. The ovsdb schema is also modified.

Signed-off-by: Alexandru Copot <alex.mihai.c@gmail.com>
Cc: Daniel Baluta <dbaluta@ixiacom.com>
[blp@nicira.com adjusted code in cases where 1.3 and 1.4 are the same]
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Differentiate between different miss types in packet in
Simon Horman [Thu, 13 Mar 2014 06:52:55 +0000 (15:52 +0900)]
ofproto-dpif: Differentiate between different miss types in packet in

Replace the generated_by_table_miss field of struct ofproto_packet_in
with a miss_type field.

The generated_by_table_miss field allowed packet-in messages generated
by table-miss rules to be differentiated. This differentiation
is still provided for by miss_type being set to OFPROTO_PACKET_IN_MISS_FLOW.

This patch allows further differentiation by setting miss_type
to OFPROTO_PACKET_IN_MISS_WITHOUT_FLOW if the packet-in message
is generated by a table-miss which is not handled by a table-miss rule.

This is in preparation for OpenFlow 1.3 version-specific
handling of the default action for such misses.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Add table-miss flow tests
Simon Horman [Thu, 13 Mar 2014 06:52:54 +0000 (15:52 +0900)]
ofproto-dpif: Add table-miss flow tests

Cc: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoodp-util: Fix VLAN parsing behavior in parse_8021q_onward().
Ben Pfaff [Tue, 31 Dec 2013 18:35:27 +0000 (10:35 -0800)]
odp-util: Fix VLAN parsing behavior in parse_8021q_onward().

Anytime there is a VLAN the flow needs to properly reflect that.  Keeping
the TPID in dl_type never makes sense and will probably cause problems.
The existing code did the right thing in the common case but not in corner
cases where it returned ODP_FIT_TOO_MUCH or ODP_FIT_TOO_LITTLE (the cases
where it returned an error don't matter since nothing looks at the flow
in that case).

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Honour Table Mod settings for table-miss handling
Simon Horman [Thu, 20 Mar 2014 20:42:22 +0000 (13:42 -0700)]
ofproto: Honour Table Mod settings for table-miss handling

This reworks lookup of rules for both table 0 and table action translation.
The result is that Table Mod settings, which can alter the miss-behaviour
of tables, including table 0, on a per-table basis may be honoured.

Previous patches proposed by myself which build on earlier merged patches
by Andy Zhou implement the ofproto side of Table Mod. So with this patch
the feature should be complete.

Neither this patch, nor any other patches it builds on, alter the default
behaviour of Open vSwitch. And in particular the OpenFlow1.1 behaviour is
the default regardless of which OpenFlow version is negotiated between the
switch and the controller.

An implementation detail, which lends itself to future work, is the
handling of OFPTC_TABLE_MISS_CONTINUE. If a table has this behaviour set by
Table Mod and a miss occurs then a loop is created, skipping to the next
table. It is quite easy to create a situation where this loop covers ~255
tables which is very expensive as the lookup for each table involves taking
locks, amongst other things.

Cc: Andy Zhou <azhou@nicira.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
[blp@nicira.com updated comments and refactored]
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agocfm: Add test for the update of CFM status to OVSDB.
Alex Wang [Wed, 19 Mar 2014 23:19:44 +0000 (16:19 -0700)]
cfm: Add test for the update of CFM status to OVSDB.

Since daemons can use the cfm status from OVSDB, it is useful
to add a test to guarantee that the update is in time.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agocfm: Define old_cfm_fault as 'enum cfm_fault_reason'.
Alex Wang [Wed, 19 Mar 2014 23:19:28 +0000 (16:19 -0700)]
cfm: Define old_cfm_fault as 'enum cfm_fault_reason'.

CFM fault variable type has been changed to 'enum cfm_fault_reason' for
long time.  However, inside cfm_run(), the old_cfm_fault is still defined
as boolean.  This commit fixes the issue.

Found by inspection.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Implement the API functions to allow multiple handler
Alex Wang [Wed, 26 Feb 2014 18:07:38 +0000 (10:07 -0800)]
dpif-netdev: Implement the API functions to allow multiple handler
threads read upcall.

This commit implements the API functions to allow multiple handler
threads read upcall.

Also, this commit removes the handling priority of DPIF_UC_MISS
over DPIF_UC_ACTION.  So, both misses will be put to the same
queue.  The decision is based on the fact that a lot has changed
since the age when flow setup rate is most treasured and starving
all actions in the presence of any flow misses doesn't seem like
a sound balancing solution.

Thusly the current implementation will be put in testing and
investigation for better balancing solution will continue if
there is an issue.

Also note, the introduction and use of flow_hash_5tuple() will
put missed ICMP packets from same source but with different
type/code to different handler queues.  This may cause reordering
of these packets.  For now, we do not count this as a problem.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodpif: Change dpif API to allow multiple handler threads read upcall.
Alex Wang [Fri, 7 Mar 2014 18:57:36 +0000 (10:57 -0800)]
dpif: Change dpif API to allow multiple handler threads read upcall.

This commit changes the API in 'dpif-provider.h' to allow multiple
handler threads call dpif_recv() simultaneously.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agosocket-util: Fix an inverted use of LINUX
YAMAMOTO Takashi [Thu, 20 Mar 2014 06:00:14 +0000 (15:00 +0900)]
socket-util: Fix an inverted use of LINUX

Fix a regression introduced by commit fce314cd.
("socket-util: Fix definition of LINUX.")

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoCodingStyle: Allow designated initializers.
Ben Pfaff [Thu, 20 Mar 2014 00:34:55 +0000 (17:34 -0700)]
CodingStyle: Allow designated initializers.

MSVC 2013 finally implements them, 14 years after they became part of C,
so we can use them in generic code now.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
10 years agolib/packets: Remove packet_get_tcp_flags().
Jarno Rajahalme [Wed, 19 Mar 2014 23:13:32 +0000 (16:13 -0700)]
lib/packets: Remove packet_get_tcp_flags().

This function has no more users, so remove it.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolib: Use tcp_flags from flow.
Jarno Rajahalme [Wed, 19 Mar 2014 23:13:32 +0000 (16:13 -0700)]
lib: Use tcp_flags from flow.

TCP flags are already extracted from the flow, no need to parse them
again.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Use packet key to parse TCP flags.
Jarno Rajahalme [Wed, 19 Mar 2014 23:13:32 +0000 (16:13 -0700)]
dpif-netdev: Use packet key to parse TCP flags.

The flow that created the netdev_flow might have wildcarded TCP flags,
or it may not be a TCP flow at all.  Fix this by using the freshly
extracted flow key to parse TCP flags.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolib/flow: Retain ODPP_NONE on flow_extract().
Jarno Rajahalme [Wed, 19 Mar 2014 23:13:32 +0000 (16:13 -0700)]
lib/flow: Retain ODPP_NONE on flow_extract().

We used to map ODPP_NONE to port number 0, which is wrong, as
ODPP_NONE is a valid value of the flow's in_port.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agocfm: Notify connectivity_seq on remote maintenance points change.
Alex Wang [Sat, 15 Mar 2014 01:30:39 +0000 (18:30 -0700)]
cfm: Notify connectivity_seq on remote maintenance points change.

Commit f23d157c ("ofproto-dpif: Don't poll ports when nothing changes")
did not ensure the update of the row of remote maintenance points in ovsdb
when it changes.  This commit makes the update happen by notifying the
global connectivity_seq.

Bug #1192265

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-rcu: Call ovsrcu_init() in ovsrcu_quiesce().
Alex Wang [Wed, 19 Mar 2014 17:42:08 +0000 (10:42 -0700)]
ovs-rcu: Call ovsrcu_init() in ovsrcu_quiesce().

This commit fixes a bug introduced by 0f2ea848(ovs-rcu: New library.).
It is possible that ovsrcu_quiesce() is called before ovsrcu_init().
So, it is necessary to call ovsrcu_init() in ovsrcu_quiesce().

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agolib/hmap: Remove the memory fence from hmap_is_empty().
Jarno Rajahalme [Wed, 19 Mar 2014 15:51:52 +0000 (08:51 -0700)]
lib/hmap: Remove the memory fence from hmap_is_empty().

The fence made classifier_lookup() slower.  Access to a size_t 'n' is
safe without synchonizing, and if racing with writers matters,
additional syncronization primitives are used anyway.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Use RCU to protect data.
Ben Pfaff [Thu, 6 Mar 2014 06:41:30 +0000 (22:41 -0800)]
dpif-netdev: Use RCU to protect data.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agodpif-netdev: Use ovsthread_stats for flow stats.
Ben Pfaff [Thu, 23 Jan 2014 00:03:10 +0000 (16:03 -0800)]
dpif-netdev: Use ovsthread_stats for flow stats.

This should scale better than a single mutex, though still not
ideally.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agoovs-thread: Replace ovsthread_counter by more general ovsthread_stats.
Ben Pfaff [Wed, 19 Mar 2014 14:47:12 +0000 (07:47 -0700)]
ovs-thread: Replace ovsthread_counter by more general ovsthread_stats.

This allows clients to do more than just increment a counter.  The
following commit will make the first use of that feature.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agoutil: New functions for allocating memory while avoiding false sharing.
Ben Pfaff [Tue, 11 Mar 2014 07:11:30 +0000 (00:11 -0700)]
util: New functions for allocating memory while avoiding false sharing.

This factors code out of fat-rwlock, making it easily usable by other code.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agoofproto: Use RCU to protect rule_actions.
Ben Pfaff [Fri, 14 Mar 2014 17:47:50 +0000 (10:47 -0700)]
ofproto: Use RCU to protect rule_actions.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agoovs-rcu: New library.
Ben Pfaff [Tue, 18 Mar 2014 23:34:28 +0000 (16:34 -0700)]
ovs-rcu: New library.

RCU allows multiple threads to read objects in parallel without any
performance penalty.  The following commit will introduce the first use.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agotests: Fix small typo in "OpenFlow" in ofproto tests.
Justin Pettit [Tue, 18 Mar 2014 21:29:17 +0000 (14:29 -0700)]
tests: Fix small typo in "OpenFlow" in ofproto tests.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
10 years agostream: Call WSAStartup() before calling any winsock functions.
Gurucharan Shetty [Mon, 17 Mar 2014 16:28:07 +0000 (09:28 -0700)]
stream: Call WSAStartup() before calling any winsock functions.

The WSAStartup function initiates use of the Winsock DLL by a process.
The function should be called before any winsock related functions
are called.

Since, we use stream-fd-windows through pstream_open or stream_open
add the WSAStartup() call there.

The current version of the Windows Sockets specification is version 2.2

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agosocket-util: Fix dscp error check for Windows.
Gurucharan Shetty [Mon, 17 Mar 2014 16:19:24 +0000 (09:19 -0700)]
socket-util: Fix dscp error check for Windows.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoMan ovs-ofctl: Typo in arp_spa & arp_tpa
Arun Sharma [Tue, 18 Mar 2014 12:14:42 +0000 (17:44 +0530)]
Man ovs-ofctl: Typo in arp_spa & arp_tpa

It seems there is a typo in definition of arp_spa & arp_tpa

Signed-off-by: Arun Sharma <arun.sharma@calsoftinc.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: compat: Downstream the reciprocal_div.{c,h}.
Alex Wang [Fri, 14 Mar 2014 18:47:30 +0000 (11:47 -0700)]
datapath: compat: Downstream the reciprocal_div.{c,h}.

The reciprocal division code used in datapath is flawed.  The bug
has been fixed in the linux kernel repo in commit 809fa972fd(
reciprocal_divide: update/correction of the algorithm).

This commit downstreams the reciprocal_div.{c,h} from the linux
kernel repo.

Signed-off-by: Alex Wang <alexw@nicira.com>
Reviewed-by: Thomas Graf <tgraf@redhat.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
10 years agodpif-netdev: init atomic flag dp->destroyed
Andy Zhou [Tue, 18 Mar 2014 05:10:53 +0000 (22:10 -0700)]
dpif-netdev: init atomic flag dp->destroyed

It is better to explicitly initialize the dp->destroy than to rely
on xzalloc().

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoFix typos in documentation.
Ben Pfaff [Mon, 17 Mar 2014 22:28:43 +0000 (15:28 -0700)]
Fix typos in documentation.

Reported-by: Anshuman Manral <anshuman.manral@outlook.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoBUILD.Windows: Update compilable utilities.
Gurucharan Shetty [Thu, 13 Mar 2014 22:02:58 +0000 (15:02 -0700)]
BUILD.Windows: Update compilable utilities.

We can now compile a few OVS userspace components on Windows.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agosystem-stats: Port for Windows.
Gurucharan Shetty [Fri, 14 Mar 2014 14:38:52 +0000 (07:38 -0700)]
system-stats: Port for Windows.

This does not provide us all the functionality that
is available in Linux. But should be a start.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agowindefs: srandom() and random() for windows.
Gurucharan Shetty [Fri, 14 Mar 2014 14:32:08 +0000 (07:32 -0700)]
windefs: srandom() and random() for windows.

Windows does not have a srandom() and random(). But it does
have a srand() and rand(). We use these functions in sflow code.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agostrsep: Copy from netbsd.
Gurucharan Shetty [Thu, 13 Mar 2014 22:20:15 +0000 (15:20 -0700)]
strsep: Copy from netbsd.

Windows does not have a strsep.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agosflow: Include the windefs.h header for windows.
Gurucharan Shetty [Wed, 12 Mar 2014 21:59:02 +0000 (14:59 -0700)]
sflow: Include the windefs.h header for windows.

sflow.h uses u_int32_t that needs windefs.h for compilation
in visual studio.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Don't use DELETE inside enumerator list.
Gurucharan Shetty [Wed, 12 Mar 2014 21:37:05 +0000 (14:37 -0700)]
ofproto: Don't use DELETE inside enumerator list.

Visual studio does not like it. It is mostly a keyword.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-ofctl: Use fcntl instead of sys/fcntl.
Gurucharan Shetty [Wed, 12 Mar 2014 21:35:10 +0000 (14:35 -0700)]
ovs-ofctl: Use fcntl instead of sys/fcntl.

Windows does not have a sys/fcntl.h

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agowindows/unistd: Add definitions for STD*_FILENO.
Gurucharan Shetty [Wed, 12 Mar 2014 20:57:42 +0000 (13:57 -0700)]
windows/unistd: Add definitions for STD*_FILENO.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agowindefs: Include the library advapi32.
Gurucharan Shetty [Wed, 12 Mar 2014 20:43:52 +0000 (13:43 -0700)]
windefs: Include the library advapi32.

advapi32 is needed by multiple functions
So include it in a common place.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agobacktrace: Add log_backtrace()
Andy Zhou [Thu, 13 Mar 2014 22:28:54 +0000 (15:28 -0700)]
backtrace: Add log_backtrace()

log_backtrace() and log_backtrace_msg() logs the back trace into
the log file. It may be most useful when debugging unit tests.
"backtrace.h" documents the usage. It is not being called directly
in the code, but rather as a handy tool available when needed.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Revalidate flows when the group table changes.
Ben Pfaff [Mon, 17 Mar 2014 20:25:19 +0000 (13:25 -0700)]
ofproto-dpif: Revalidate flows when the group table changes.

Otherwise group table modifications won't be immediately reflected in the
treatment of flows already passing through the switch.

Reported-by: Hyojoon Kim <joonk@gatech.edu>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Tested-by: Hyojoon Kim <joonk@gatech.edu>
10 years agoFAQ: Add question about meter support.
Ben Pfaff [Mon, 17 Mar 2014 20:06:07 +0000 (13:06 -0700)]
FAQ: Add question about meter support.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Pritesh Kothari <pritesh.kothari@cisco.com>
10 years agosocket-util: Fix definition of LINUX.
Ben Pfaff [Mon, 17 Mar 2014 20:00:30 +0000 (13:00 -0700)]
socket-util: Fix definition of LINUX.

Reported-by: Mukesh Hira <mhira@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Pritesh Kothari <pritesh.kothari@cisco.com>
10 years agoudpif: Bug fix updif_flush
Andy Zhou [Fri, 14 Mar 2014 04:48:55 +0000 (21:48 -0700)]
udpif:  Bug fix updif_flush

Before this commit, all datapath flows are cleared with dpif_flush(),
but the revalidator thread still holds ukeys, which are caches of the
datapath flows in the revalidaor.  Flushing ukeys causes flow_del
messages to be sent to the datapath again on flows that have been
deleted by the dpif_flush() already.

Double deletion by itself is not problem, per se, may an efficiency
issue. However, for ever flow_del message sent to the datapath, a log
message, at the warning level, will be generated in case datapath
failed to execute the command. In addition to cause spurious log
messages, Double deletion causes unit tests to report erroneous
failures as all warning messages are considered test failures.

The fix is to simply shut down the revalidator threads to flush all
ukeys, then flush the datapth before restarting the revalidator threads.

dpif_flush() was implemented as flush flows of all datapaths while
most of its invocation should only flush its local datapath.
Only megaflow on/off commands should flush all dapapaths. This bug is
also fixed.

Found during development.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agostp: Fix bpdu tx problem in listening state
kmindg [Sun, 9 Mar 2014 09:48:52 +0000 (17:48 +0800)]
stp: Fix bpdu tx problem in listening state

The restriction only allows to send bpdu in forwarding state in
compose_output_action__. But a port could send bpdu in listening
and learning state according to comments in lib/stp.h(State of
an STP port).

Until this commit, OVS did not send out BPDUs in listening and learning
states.  But those two states are temporary, the stp port will be in
forwarding state and send out BPDUs eventually (In the default
configuration listening and learning states last 15+15 second).  Therefore,
this bug increased convergence time but did not entirely break STP.

Signed-off-by: kmindg <kmindg@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoopenflow-1.4.h: Add bundle structure definitions
Alexandru Copot [Thu, 13 Mar 2014 20:08:48 +0000 (22:08 +0200)]
openflow-1.4.h: Add bundle structure definitions

Signed-off-by: Alexandru Copot <alex.mihai.c@gmail.com>
Cc: Daniel Baluta <dbaluta@ixiacom.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agowindows/sys: Define sa_family_t for easy compilation.
Gurucharan Shetty [Wed, 12 Mar 2014 16:47:57 +0000 (09:47 -0700)]
windows/sys: Define sa_family_t for easy compilation.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agowindefs: Add definition for pid_t.
Gurucharan Shetty [Wed, 12 Mar 2014 17:00:41 +0000 (10:00 -0700)]
windefs: Add definition for pid_t.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agoovs-thread: We don't use fork in Windows.
Gurucharan Shetty [Wed, 12 Mar 2014 17:32:59 +0000 (10:32 -0700)]
ovs-thread: We don't use fork in Windows.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agowindows/net: Definition for IFNAMSIZ.
Gurucharan Shetty [Wed, 12 Mar 2014 16:51:13 +0000 (09:51 -0700)]
windows/net: Definition for IFNAMSIZ.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>