cascardo/ovs.git
9 years agolex: New lexical analyzer module for use in OVN.
Ben Pfaff [Wed, 15 Apr 2015 23:18:04 +0000 (16:18 -0700)]
lex: New lexical analyzer module for use in OVN.

I'm determined not to let the terrible style of pseudo-parsing we have in
OVS leak into OVN.  Here's the first step.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
9 years agoovn-architecture: Fix description of powering off VMs
GalSagie [Thu, 9 Apr 2015 20:20:32 +0000 (23:20 +0300)]
ovn-architecture: Fix description of powering off VMs

Signed-off-by: Gal Sagie <gal,sagie@gmail.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
9 years agoMerge remote-tracking branch 'origin/master' into ovn
Justin Pettit [Sun, 12 Apr 2015 17:13:59 +0000 (10:13 -0700)]
Merge remote-tracking branch 'origin/master' into ovn

Conflicts:
tutorial/ovs-sandbox

9 years agoovn: Introduce ovn-controller.
Justin Pettit [Thu, 9 Apr 2015 07:52:43 +0000 (00:52 -0700)]
ovn: Introduce ovn-controller.

Add new ovn-controller daemon that runs locally on transport nodes.
This initial version registers itself in the Chassis table and registers
logical ports to the appropriate rows in the Bindings table.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
9 years agotests: gre: fix flags endianness
Flavio Leitner [Fri, 10 Apr 2015 14:08:10 +0000 (11:08 -0300)]
tests: gre: fix flags endianness

The flags field is 16 bits so use network byte order in the
test case and use the proper conversion methods when parsing
and dumping.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
9 years agotest-csum: endianess fix
Flavio Leitner [Fri, 10 Apr 2015 14:07:50 +0000 (11:07 -0300)]
test-csum: endianess fix

The math is done in network byte order so the 32 bits won't
match between big and little endian, so the assert fails.

Reduce to 16 bits and then compare to the converted constant.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
9 years agodpif-netdev: Count exact match cache hits.
Daniele Di Proietto [Tue, 7 Apr 2015 19:02:15 +0000 (20:02 +0100)]
dpif-netdev: Count exact match cache hits.

We used to count exact match cache hits and masked classifier hits
together. This commit splits the DP_STAT_HIT counter into two.
This change will be used by future commits.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
9 years agodpif-netdev: Make datapath and flow stats atomic.
Daniele Di Proietto [Tue, 7 Apr 2015 19:02:14 +0000 (20:02 +0100)]
dpif-netdev: Make datapath and flow stats atomic.

A read operation from a non atomic shared value (without external
locking) can return incorrect values.  Using the atomic semantics
prevents this from happening.

However:
* No memory barriers are used.  We don't need that kind of consistency
  for statistics (we use relaxed operations).
* The updates are not atomic, just the loads and stores.  This is ok
  because there's a single writer.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
9 years agodpif-netdev: Group statistics updates in the slow path.
Daniele Di Proietto [Tue, 7 Apr 2015 19:02:13 +0000 (20:02 +0100)]
dpif-netdev: Group statistics updates in the slow path.

Since statistics updates might require locking (in future commits)
grouping them will reduce the locking overhead.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
9 years agodatapath: Account for "udptunnels: Call handle_offloads after inserting vlan tag."
Jesse Gross [Tue, 7 Apr 2015 23:11:23 +0000 (16:11 -0700)]
datapath: Account for "udptunnels: Call handle_offloads after inserting vlan tag."

Upstream commit:
    udptunnels: Call handle_offloads after inserting vlan tag.

    handle_offloads() calls skb_reset_inner_headers() to store
    the layer pointers to the encapsulated packet. However, we
    currently push the vlag tag (if there is one) onto the packet
    afterwards. This changes the MAC header for the encapsulated
    packet but it is not reflected in skb->inner_mac_header, which
    breaks GSO and drivers which attempt to use this for encapsulation
    offloads.

    Fixes: b736a623 ("vxlan: Add tx-vlan offload support.")
Signed-off-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: 4aac884d ("udptunnels: Call handle_offloads after inserting vlan tag.")
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agotunneling: Invalid packets should be cleared.
Jesse Gross [Wed, 8 Apr 2015 19:56:50 +0000 (12:56 -0700)]
tunneling: Invalid packets should be cleared.

If we receive a packet with an invalid tunnel header, we
should drop the packet without further processing. Currently
we do this by removing any parsed tunnel metadata. However,
this is not sufficient to stop processing - this only results
in the packet getting dropped by chance when something
usually runs across part of the packet that does not make
sense. Since both the packet and its metadata are in an
inconsistent state, it's also possible that the result is
an ovs-vswitchd crash or forwarding of a mangled packet.

Rather than clear the metadata, an alternate solution is to
remove all of the packet data. This guarantees that the
packet gets dropped during the next round of processing.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agotunneling: Convert tunnel push/pop functions to act on single packets.
Jesse Gross [Wed, 8 Apr 2015 00:45:40 +0000 (17:45 -0700)]
tunneling: Convert tunnel push/pop functions to act on single packets.

The userspace tunneling API for pushing and popping tunnel headers
is currently based on processing batches of packets. However, there
is no obvious way to take advantage of batching for these operations
and so each tunnel operation has a pair of loops to process the
batch. This changes the API to operate on single packets to enable
better code reuse.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoINSTALL.Windows: Add documentation about Windows services.
Gurucharan Shetty [Thu, 9 Apr 2015 15:54:23 +0000 (08:54 -0700)]
INSTALL.Windows: Add documentation about Windows services.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Nithin Raju <nithin@vmware.com>
9 years agoINSTALL.Windows: Add details about local build and installation.
Gurucharan Shetty [Thu, 9 Apr 2015 15:00:13 +0000 (08:00 -0700)]
INSTALL.Windows: Add details about local build and installation.

This commits adds the following.

* Clearly callout to set pthread-win32's dll path in $PATH
* Details about running parallel make and parallel unit tests.
* Installing Open vSwitch locally via 'make install'
* Update the steps to run the user processes by relying on
  the previous 'make install'. The steps now run the daemons
  in the background with the creation of a logfile and pidfile.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Nithin Raju <nithin@vmware.com>
9 years agoovn: Update comments related to "ovn" to "ovn-sb" switch.
Justin Pettit [Thu, 9 Apr 2015 05:52:29 +0000 (22:52 -0700)]
ovn: Update comments related to "ovn" to "ovn-sb" switch.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
9 years agoovs-sandbox: Use new ovn-sb database name.
Justin Pettit [Thu, 9 Apr 2015 05:51:10 +0000 (22:51 -0700)]
ovs-sandbox: Use new ovn-sb database name.

Commit ec78987 (ovn: Rename "ovn" database to "ovn-sb".) changed the
name of the database, but didn't update ovs-sandbox to use this new
name.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
9 years agoovn-nbd: Add basic OVSDB transaction comments.
Justin Pettit [Thu, 9 Apr 2015 07:10:12 +0000 (00:10 -0700)]
ovn-nbd: Add basic OVSDB transaction comments.

These comments aren't particularly detailed, but it's helpful to at
least see what is modifying the database contents.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
9 years agoovn-nbctl: Add OVSDB transaction comment.
Justin Pettit [Thu, 9 Apr 2015 07:01:44 +0000 (00:01 -0700)]
ovn-nbctl: Add OVSDB transaction comment.

Add a comment to the transaction that contains the command that was
executed to aid looking at the transaction log.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
9 years agotestsuite: ofproto-dpif: fix test names
Flavio Leitner [Wed, 8 Apr 2015 17:30:40 +0000 (14:30 -0300)]
testsuite: ofproto-dpif: fix test names

Some tests were not included when running the
make TESTSUITEFLAGS="-k ofproto-dpif" check because
the test name was out of the expected pattern.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
9 years agoINSTALL.Windows: update documentation
Nithin Raju [Wed, 8 Apr 2015 23:41:36 +0000 (16:41 -0700)]
INSTALL.Windows: update documentation

The documentation to run the executables has fallen behind quite
a bit. In this patch, we make a few updates. There's more to come.

The patch assumes the user has not run 'make install' or does not
have access to an installer.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agotestsuite: work around patch bug
Flavio Leitner [Wed, 8 Apr 2015 16:35:54 +0000 (13:35 -0300)]
testsuite: work around patch bug

Due to a CVE bug, the patch was modified to not allow following
symlinks out of the workdir.  However, this causes a bug when
there is a regular file out of the workdir which breaks the current
testsuite build.

Steps to reproduce:
  ./boot.sh
  mkdir _gcc && cd _gcc
  ../configure
  make
  [...]
  /bin/sh /home/fleitner/ovs/testsuite/build-aux/missing autom4te
  --language=autotest -I '..' -o ../tests/testsuite.tmp
  ../tests/testsuite.at
  patch -p0 ../tests/testsuite.tmp ../tests/testsuite.patch
  Invalid file name ../tests/testsuite.tmp -- skipping patch
  Makefile:5155: recipe for target '../tests/testsuite' failed
  make[2]: *** [../tests/testsuite] Error 1
  make[2]: Leaving directory
  '/home/fleitner/NetworkingServices/openvswitch/repo/testsuite/_gcc'
  Makefile:4087: recipe for target 'all-recursive' failed
  make[1]: *** [all-recursive] Error 1

Since it's just a temporary file, this patch changes to use the
workdir as the place to put the file.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agoovn-nbd: Rename "ovn_txn" variable to "ovnsb_txn".
Justin Pettit [Wed, 8 Apr 2015 16:21:47 +0000 (09:21 -0700)]
ovn-nbd: Rename "ovn_txn" variable to "ovnsb_txn".

Commit ec78987 (ovn: Rename "ovn" database to "ovn-sb".) changed most of
the instances of "ovn" to some variation of "ovn-sb", but missed one in
ovn-nbd.

Suggested-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
9 years agogeneve: Zero header before parsing userspace tunneling action.
Jesse Gross [Wed, 8 Apr 2015 01:55:54 +0000 (18:55 -0700)]
geneve: Zero header before parsing userspace tunneling action.

When we parse the text representation of the Geneve action the
header is not fully initialized. Besides the obvious potential
to generate an action that the user did not actually specify, this
also causes intermittent unit test failures when an action is
read in and printed out and the result is different.

Signed-off-by: Jesse Gross <jesse@nicira.com>
9 years agoovn: Rename "ovn" database to "ovn-sb".
Justin Pettit [Wed, 8 Apr 2015 00:40:48 +0000 (17:40 -0700)]
ovn: Rename "ovn" database to "ovn-sb".

It was confusing having a database called "ovn", since it's also the
name of the project.  Since we have an "ovn-nb", rename "ovn" to
"ovn-sb".

Signed-off-by: Justin Pettit <jpettit@nicira.com>
9 years agopacket: Avoid array of struct with zero length member.
Jesse Gross [Wed, 8 Apr 2015 00:57:36 +0000 (17:57 -0700)]
packet: Avoid array of struct with zero length member.

Windows doesn't like that the Geneve header has an array of
options with each have a zero length member (the variable data).
Nothing is accessing the data now, so just replace the member with
a comment - we can use pointer arithmetic when necessary.

Reported-by: Gurucharan Shetty <shettyg@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
9 years agotunneling: Add UDP checksum support for userspace tunnels.
Jesse Gross [Thu, 26 Mar 2015 21:27:19 +0000 (14:27 -0700)]
tunneling: Add UDP checksum support for userspace tunnels.

Kernel based OVS recently added the ability to support checksums
for UDP based tunnels (Geneve and VXLAN). This adds similar support
for the userspace datapath to bring feature parity.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agopacket: Add IP pseudoheader checksum calculation.
Jesse Gross [Mon, 30 Mar 2015 19:17:05 +0000 (12:17 -0700)]
packet: Add IP pseudoheader checksum calculation.

As OVS adds userspace support for being the endpoint in protocols
like tunnels, it will need to be able to calculate pseudoheaders
as part of the checksum calculation.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agotunneling: Add userspace tunnel support for Geneve.
Jesse Gross [Thu, 26 Mar 2015 20:51:06 +0000 (13:51 -0700)]
tunneling: Add userspace tunnel support for Geneve.

This adds basic userspace dataplane support for the Geneve
tunneling protocol. The rest of userspace only has the ability
to handle Geneve without options and this follows that pattern
for the time being. However, when the rest of userspace is updated
it should be easy to extend the dataplane as well.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agotunneling: Factor out common UDP tunnel code.
Jesse Gross [Thu, 26 Mar 2015 19:07:02 +0000 (12:07 -0700)]
tunneling: Factor out common UDP tunnel code.

Currently, the userspace VXLAN implementation contains the code
for generating and parsing both the UDP and VXLAN headers. This
pulls out the UDP portion for better layering and to make it
easier to support additional UDP based tunnels and features.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agovxlan: Set FLOW_TNL_F_KEY for received packets.
Jesse Gross [Tue, 7 Apr 2015 23:40:18 +0000 (16:40 -0700)]
vxlan: Set FLOW_TNL_F_KEY for received packets.

The VNI is always present in the VXLAN header, so we should
set the FLOW_TNL_F_KEY flag to indicate this. However, the
userspace implementation of VXLAN currently does not.

Signed-off-by: Jesse Gross <jesse@nicira.com>
9 years agoodp-util: Shift VXLAN VNI when printing/parsing.
Jesse Gross [Sat, 28 Mar 2015 00:51:35 +0000 (17:51 -0700)]
odp-util: Shift VXLAN VNI when printing/parsing.

Currently when printing a userspace tunnel action for VXLAN, the
VNI is treated as a 32 bit field rather than 24 bit. Even if this
is the representation that we use internally, we should still show
the right VNI to avoid confusing people.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pritesh Kothari <pritesh.kothari@cisco.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agotunneling: Use flow flag for GRE checksum calculation.
Jesse Gross [Fri, 27 Mar 2015 05:55:53 +0000 (22:55 -0700)]
tunneling: Use flow flag for GRE checksum calculation.

The indication to calculate the GRE checksum is currently the port
config rather than the tunnel flow. Currently there is a one to one
mapping between the two so there is no difference. However, the
kernel datapath must use the flow and it is also potentially more
flexible, so this switches how we decide whether to calculate the
checksum.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pritesh Kothari <pritesh.kothari@cisco.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agotunneling: Fix location of GRE checksums.
Jesse Gross [Fri, 27 Mar 2015 00:09:38 +0000 (17:09 -0700)]
tunneling: Fix location of GRE checksums.

The GRE checksum is a 16 bit field stored in a 32 bit option (the
rest is reserved). The current code treats the checksum as a 32-bit
field and places it in the right place for little endian systems but
not big endian. This fixes the problem by storing the 16 bit field
directly.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pritesh Kothari <pritesh.kothari@cisco.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agotunneling: Add check for GRE protocol is Ethernet.
Jesse Gross [Thu, 26 Mar 2015 23:53:39 +0000 (16:53 -0700)]
tunneling: Add check for GRE protocol is Ethernet.

On receive, the userspace GRE code doesn't check the protocol
field. Since OVS only understands Ethernet packets, this adds a
check that the inner protocol is Ethernet and discards other types
of packets.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pritesh Kothari <pritesh.kothari@cisco.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agotunneling: Include IP TTL in flow metadata.
Jesse Gross [Fri, 27 Mar 2015 14:39:18 +0000 (07:39 -0700)]
tunneling: Include IP TTL in flow metadata.

The IP TTL is currently omitted in the extracted tunnel information
that is stored in the flow for userspace tunneling. This includes it
so that the same logic used by the kernel also applies.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pritesh Kothari <pritesh.kothari@cisco.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agodatapath-windows: Solved BSOD when uninstalling the driver (race condition)
Sorin Vinturis [Tue, 7 Apr 2015 16:35:54 +0000 (16:35 +0000)]
datapath-windows: Solved BSOD when uninstalling the driver (race condition)

The BSOD occurred because the FilterAttach routine released the switch
context, while there were IRPs in processing.

The solution was to add a reference count to prevent premature deallocation of the
global switch context structure, gOvsSwitchContext.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/58
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
9 years agospecify -w to set variables for sysctl(8) on NetBSD
Kevin Lo [Tue, 7 Apr 2015 08:18:47 +0000 (16:18 +0800)]
specify -w to set variables for sysctl(8) on NetBSD

We have to specify -w to set tunable sysctls on NetBSD.

Signed-off-by: Kevin Lo <kevlo at FreeBSD.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
9 years agorhel: Make Fedora %files and %install section wildcards match.
Ben Pfaff [Mon, 6 Apr 2015 20:56:04 +0000 (13:56 -0700)]
rhel: Make Fedora %files and %install section wildcards match.

Since %install puts every .ko file into /lib/modules, %files should make
sure that all of them are packaged.

Suggested-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
9 years agohmap: Add comment warning about pitfall in HMAP_FOR_EACH_* usage.
Ben Pfaff [Mon, 6 Apr 2015 21:39:06 +0000 (14:39 -0700)]
hmap: Add comment warning about pitfall in HMAP_FOR_EACH_* usage.

CC: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
9 years agobridge: Wait for previous stats update transation when it is incomplete.
Alex Wang [Wed, 1 Apr 2015 00:07:03 +0000 (17:07 -0700)]
bridge: Wait for previous stats update transation when it is incomplete.

When ovsdb happens to get blocked for few seconds, the 'stats_timer'
will not be updated due to incompletion of previous transaction.
When the current time passes the 'stats_timer', the call to
poll_timer_wait_until(stats_timer) will keep waking up ovs-vswitchd,
causing 100% cpu utilization.

This commit fixes this issue by making ovs-vswitchd wait on the
previous idl transaction when it is incomplete rather than the
'stats_timer'.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agobridge: Do not wait for status update when there is no bridge.
Alex Wang [Tue, 31 Mar 2015 23:53:47 +0000 (16:53 -0700)]
bridge: Do not wait for status update when there is no bridge.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovn-nbctl: Add lport-get-up command.
Russell Bryant [Mon, 6 Apr 2015 15:27:05 +0000 (11:27 -0400)]
ovn-nbctl: Add lport-get-up command.

Add a command to get the 'up' state of a logical port.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
[blp@nicira.com changed true/false output to up/down]
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agolib/list: Add LIST_FOR_EACH_POP.
Jarno Rajahalme [Mon, 6 Apr 2015 21:02:28 +0000 (14:02 -0700)]
lib/list: Add LIST_FOR_EACH_POP.

Makes popping each member of the list a bit easier.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoauto-attach: Fix segfault when enabling auto attach.
Dennis Flynn [Mon, 6 Apr 2015 14:59:19 +0000 (10:59 -0400)]
auto-attach: Fix segfault when enabling auto attach.

This commit fixes a segmentation fault observed when enabling lldp prior to
establishing auto attach mappings.

Signed-off-by: Dennis Flynn <drflynn@avaya.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows Release lock on HVUpdateNIC
Alin Serdean [Mon, 6 Apr 2015 17:22:06 +0000 (17:22 +0000)]
datapath-windows Release lock on HVUpdateNIC

Release switchContext->dispatchLock in case the vport has not been found.

Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Allow NdisSwitchPortTypeSynthetic to be updated
Alin Serdean [Mon, 6 Apr 2015 17:28:42 +0000 (17:28 +0000)]
datapath-windows: Allow NdisSwitchPortTypeSynthetic to be updated

Allow the port to be updated if it the type is only:
NdisSwitchPortTypeSynthetic

Acked-by: Nithin Raju <nithin@vmware.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-dev.py: Remove vport-*.ko at same time as openvswitch.ko.
Ben Pfaff [Sun, 5 Apr 2015 19:12:14 +0000 (12:12 -0700)]
ovs-dev.py: Remove vport-*.ko at same time as openvswitch.ko.

My guess is that this is the intent.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
9 years agorhel: Package vport-*.ko in Fedora kernel package.
Ben Pfaff [Sun, 5 Apr 2015 19:12:13 +0000 (12:12 -0700)]
rhel: Package vport-*.ko in Fedora kernel package.

Fixes a presumed build break due to unpackaged files.  (Only "presumed" at
this point because it is masked in the VMware build system by the similar
XenServer build failure.)

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
9 years agoxenserver: Package vport-*.ko with kernel module.
Ben Pfaff [Sun, 5 Apr 2015 19:12:12 +0000 (12:12 -0700)]
xenserver: Package vport-*.ko with kernel module.

Fixes a build error due to unpackaged files.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
9 years agoovs-sandbox: Tell gdb to start the daemon.
Russell Bryant [Fri, 3 Apr 2015 20:04:14 +0000 (16:04 -0400)]
ovs-sandbox: Tell gdb to start the daemon.

The current gdb support launches gdb but doesn't start the daemon.
If you start ovsdb-server with gdb, ovs-sandbox produces an error as
it tries to run ovs-vsctl before ovsdb-server is running.  Telling gdb
to start the daemon immediately avoids this error.

There are cases where it's useful to go straight to the gdb prompt,
too.  For example, someone may want to set a breakpoint.  In that
case, it's easy enough to just kill it, set a breakpoint, and execute
'run' again.

In passing, fix indentation to use spaces instead of tabs.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovn: Add section titles to automake.mk.
Justin Pettit [Sat, 4 Apr 2015 22:02:42 +0000 (15:02 -0700)]
ovn: Add section titles to automake.mk.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
9 years agoovn: Add ovn-nbd to .gitignore.
Justin Pettit [Sat, 4 Apr 2015 22:01:47 +0000 (15:01 -0700)]
ovn: Add ovn-nbd to .gitignore.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
9 years agoMakefile.am: Clarify error message about missing distribution files.
Justin Pettit [Sat, 4 Apr 2015 23:30:44 +0000 (16:30 -0700)]
Makefile.am: Clarify error message about missing distribution files.

The error message did not make it clear that the problem was due to
files being in git but not the distribution.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoAUTHORS: Add Kevin Lo.
Ben Pfaff [Sun, 5 Apr 2015 16:58:06 +0000 (09:58 -0700)]
AUTHORS: Add Kevin Lo.

Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agonetdev-bsd: Fix sign extension bug in ifr_flags on FreeBSD.
Kevin Lo [Sat, 4 Apr 2015 16:59:26 +0000 (00:59 +0800)]
netdev-bsd: Fix sign extension bug in ifr_flags on FreeBSD.

FreeBSD fills the int return value with ifr_flagshigh in the high
16 bits and ifr_flags in the low 16 bits rather than blindly promoting
ifr_flags to an int, which will preserve the sign.
This commit makes sure the flags returned isn't negative and apply mask
0xffff to flags.

Signed-off-by: Kevin Lo <kevlo@FreeBSD.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath: Turn vports with dependencies into separate modules
Thomas Graf [Sat, 4 Apr 2015 06:24:13 +0000 (08:24 +0200)]
datapath: Turn vports with dependencies into separate modules

Upstream commit:
    The internal and netdev vport remain part of openvswitch.ko. Encap
    vports including vxlan, gre, and geneve can be built as separate
    modules and are loaded on demand. Modules can be unloaded after use.
    Datapath ports keep a reference to the vport module during their
    lifetime.

    Allows to remove the error prone maintenance of the global list
    vport_ops_list.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Also folds in the follow-up commits 9ba559d9ca3 to turned the non-GPL
symbol exports to GPL exports, and fa2d8ff4e35 which fixes a module
reference release bug.

Exports various backwards compat functions linked into the main
openvswitch module as GPL symbols to ensure vport modules can use them.

Some fiddling with the Makefile was needed to work around the fact
that Makefile variables can't contain '-' characters needed to define
'vport-xxx' module sources. Also, Kbuild complains heavily if a
$(module)-y = $(module).o is defined which is actually backed with a .c
file of the same name. Therefore, a new $(build_multi_modules) variable
is defined which lists all module which consist of more than one source
file.

Upstream: 62b9c8d0372 ("ovs: Turn vports with dependencies into separate modules")
Upstream: 9ba559d9ca3 ("openvswitch: Export symbols as GPL symbols.")
Upstream: fa2d8ff4e35 ("openvswitch: Return vport module ref before destruction")
Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoacinclude: Always assume buggy strtok_r() for glibc < 2.8.
Ben Pfaff [Fri, 3 Apr 2015 22:10:57 +0000 (15:10 -0700)]
acinclude: Always assume buggy strtok_r() for glibc < 2.8.

Lately our internal build system has been seeing intermittent failures that
I can't explain.  With old glibc versions, the "configure" time check will
pass, but the equivalent (almost identical) "make check" test will fail.
One possibility, I guess, is that occasionally address space randomization
will put valid data at the 0xc0ffee address that the test assumes will
segfault, and another is that some change in compiler optimization flags
is making a difference.  At any rate, I think it's safe to just always
assume that this strtok_r() bug is present whenever glibc before 2.8 is
in use.

Specifically we've seen this happen intermittently when building against
the XenServer DDK 5.6.100 build 39265, which uses glibc 2.5.

Reported-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
9 years agoovn-nbd: Populate OVN Bindings table.
Russell Bryant [Fri, 3 Apr 2015 00:09:16 +0000 (20:09 -0400)]
ovn-nbd: Populate OVN Bindings table.

When ovn-nbd gets notified that the contents of the OVN_Northbound
database have changed, it will now ensure that the contents of the
Bindings table in the OVN database are up to date.  It will create a
binding if none exists.  If one does exist, it will update its
contents as necessary, though today the only thing supported is the
list of MAC addresses.  Finally, any binding associated with a logical
port that has been deleted will be removed from the OVN database.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovn.xml: Add a tiny bit more detail.
Ben Pfaff [Thu, 2 Apr 2015 23:02:04 +0000 (16:02 -0700)]
ovn.xml: Add a tiny bit more detail.

Also correct spelling error: s/ndb/nbd/.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
9 years agoINSTALL.md: Add note about EXTRA_CFLAGS.
Russell Bryant [Thu, 2 Apr 2015 21:51:49 +0000 (17:51 -0400)]
INSTALL.md: Add note about EXTRA_CFLAGS.

Add a note about the use of EXTRA_CFLAGS to provide custom CFLAGS for
the build of the Linux kernel module.

This addition is technically in the "configuring the sources" section
of the document.  However, it's the spot where custom CFLAGS is
discussed already, so that seemed like the best place to put it.
Alternatively, it could go in the "Building the Sources" section
instead.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodpif-netdev: Remove support for DPIF_FP_ZERO_STATS flag
Daniele Di Proietto [Wed, 1 Apr 2015 16:20:57 +0000 (17:20 +0100)]
dpif-netdev: Remove support for DPIF_FP_ZERO_STATS flag

Since flow statistics are thread local and updated without any lock,
it is not correct to do a memset from another thread.

This commit simply removes the support for the flag.  It is not needed
by ofproto-dpif, it is only exposed by dpctl commands.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
9 years agoINSTALL.md: Document how to add custom compiler flags.
Ben Pfaff [Thu, 2 Apr 2015 16:52:03 +0000 (09:52 -0700)]
INSTALL.md: Document how to add custom compiler flags.

CC: Mark B Kavanagh <mark.b.kavanagh@intel.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
9 years agodatapath-windows: Make GET_PID a separate IOCTL
Sorin Vinturis [Thu, 2 Apr 2015 19:35:32 +0000 (19:35 +0000)]
datapath-windows: Make GET_PID a separate IOCTL

Added a new IOCTL in order to retrieve the PID from the kernel datapath.
The new method uses a direct and cleaner way, as opposed to the old way
of using a Netlink transaction, avoiding the unnecessary overhead.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/31
Acked-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-sandbox: Add support for ovn-nbd.
Russell Bryant [Thu, 2 Apr 2015 15:49:47 +0000 (11:49 -0400)]
ovs-sandbox: Add support for ovn-nbd.

Update ovs-sandbox to run ovn-nbd when it is run with OVN enabled.  In
passing, also fix the indentation of two lines to use spaces instead
of tabs.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovn-nbd: Calculate 'up' state for logical ports.
Russell Bryant [Thu, 2 Apr 2015 00:04:21 +0000 (20:04 -0400)]
ovn-nbd: Calculate 'up' state for logical ports.

When the state of the chassis column in the Bindings table changes for
any row, ovn-nbd will notice and trigger recalculating the 'up' state
for all logical ports.

This can be tested manually by starting up ovs-sandbox with ovn support
enabled, running ovn-nbd, and then running the following commands:

  ovn-nbctl lswitch-add sw0
  ovn-nbctl lport-add sw0-port0 sw0
  port_uuid=$(ovn-nbctl lport-list sw0 | awk '{print $1}')
  ovsdb-client transact "[\"OVN\",\
    {\"uuid-name\":\"rowd4eca046_9233_4094_bc55_e28dd49217f9\",\
    \"row\":{\"logical_port\":\"$port_uuid\",\"chassis\":\"hostname\"},\
    \"op\":\"insert\",\"table\":\"Bindings\"}]"

ovn-nbd will then see that the 'chassis' column is set in the Bindings
row for the logical port and will mark the logical port as 'up' in the
northbound db.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovn-nbd: Make minor skeleton updates.
Russell Bryant [Thu, 2 Apr 2015 00:04:20 +0000 (20:04 -0400)]
ovn-nbd: Make minor skeleton updates.

These changes are just some minor changes I have made to the skeleton
since the version that has been merged.  It adds the daemon related
options, updates the table/columns we monitor from the OVN db, and
some other minor tweaks.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agobridge: Execute bridge_run() only after retrieving db contents.
Alex Wang [Wed, 1 Apr 2015 23:11:19 +0000 (16:11 -0700)]
bridge: Execute bridge_run() only after retrieving db contents.

During upgrade of ovs-vswitchd, we do not want to recreate the already
configured kernel interfaces.  Especially when IP address is assigned to
the internal port, the recreation will cause the lost of connection.
Therefore, ovs-vswitchd should read current ovsdb content first and then
reuse the existing kernel interfaces that are configured in ovsdb.  In
terms of the code language, ovs-vswitchd should only execute bridge_run()
after it finishes reading the ovsdb content.

However, this expected behavior is broken by the recent commit d18e52e
(ovsdb-idl: Tolerate missing tables and columns.) which causes the
execution of bridge_run() before getting the hint of configured interfaces
from ovsdb.

To fix the issue, this commit makes sure that the execution of bridge_run()
happens only after retrieving the ovsdb contents.

VMware-BZ: #1424342

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoovn-nbd: Add skeleton for northbound daemon.
Russell Bryant [Tue, 31 Mar 2015 20:03:04 +0000 (16:03 -0400)]
ovn-nbd: Add skeleton for northbound daemon.

Initially, this just detects ovn and ovn-nb db changes.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovn-nbctl: Fix leak of ovsdb_idl_txn.
Russell Bryant [Wed, 1 Apr 2015 17:40:07 +0000 (13:40 -0400)]
ovn-nbctl: Fix leak of ovsdb_idl_txn.

A new transaction is allocated before executing the command.  If the
result from committing the transaction is TRY_AGAIN, the code leaked
the allocated transaction since it creates a new one when it comes
back around to retry.  The old transaction is now destroyed before
continuing to allow the command to be retried.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovsdb-server: Correct malformed error replies to certain JSON-RPC requests.
Ben Pfaff [Fri, 20 Mar 2015 04:00:46 +0000 (21:00 -0700)]
ovsdb-server: Correct malformed error replies to certain JSON-RPC requests.

I realized that this bug existed only a few weeks ago, but it has been
there since the earliest ovsdb-server code.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
9 years agoovsdb-idl: Tolerate missing tables and columns.
Ben Pfaff [Fri, 20 Mar 2015 06:45:42 +0000 (23:45 -0700)]
ovsdb-idl: Tolerate missing tables and columns.

Until now, if ovs-vsctl (or another client of the C ovsdb-idl library) was
compiled against a schema that had a column or table that was not in the
database actually being used (e.g. during an upgrade), and the column or
table was selected for monitoring, then ovsdb-idl would fail to get any
data at all because ovsdb-server would report an error due to a request
about a column or a table it didn't know about.

This commit fixes the problem by making ovsdb-idl retrieve the database
schema from the database server and omit any tables or columns that don't
exist from its monitoring request.  This works OK for the kinds of upgrades
that OVSDB otherwise supports gracefully because it will simply make the
missing columns or tables appear empty, which clients of the ovsdb-idl
library already have to tolerate.

VMware-BZ: #1413562
Reported-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
9 years agovswitch.xml: Improve description of forward-bpdu.
Ben Pfaff [Wed, 1 Apr 2015 00:08:49 +0000 (17:08 -0700)]
vswitch.xml: Improve description of forward-bpdu.

The description was at best incomplete and difficult to understand.

Reported-by: Brian Field <Brian_Field@cable.comcast.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
9 years agoovn-nbctl: Sync code and docs for --db option.
Russell Bryant [Tue, 31 Mar 2015 19:55:00 +0000 (15:55 -0400)]
ovn-nbctl: Sync code and docs for --db option.

The usage() output said the option was --db.  The code and man page
said --database.  Switch everything over to --db to be consistent with
the option name used in ovs-vsctl.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agolockfile: Support \-delimited file names in lockfile_name().
Alin Serdean [Tue, 31 Mar 2015 19:16:58 +0000 (19:16 +0000)]
lockfile: Support \-delimited file names in lockfile_name().

Currently paths that have only forward slashes like the following
"C:/package/binaries/conf.db" work seamlessly.

If we try the native windows filepaths i.e. "C:\package\binaries\conf.db" we
will hit the following problem:
2015-03-31T15:54:17Z|00001|lockfile|WARN|.c:\package\binaries\conf.db.~lock~:
failed to open lock file: Invalid argument

2015-03-31T15:54:17Z|00002|lockfile|WARN|.c:\package\binaries\conf.db.~lock~:
failed to lock file: Invalid argument
ovsdb-server: I/O error: c:\package\binaries\conf.db: failed to lock lockfile
(Invalid argument)

In this patch we update the lockfile_name function to also look for
backslashes, and also accommodate if we have a mix of backslashes and forward
slashes.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
[blp@nicira.com simplified the code]
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agohmap: Don't include ovs-atomic.h unnecessarily.
Ben Pfaff [Sun, 29 Mar 2015 22:49:29 +0000 (15:49 -0700)]
hmap: Don't include ovs-atomic.h unnecessarily.

GNU C++ isn't too happy with ovs-atomic.h.  We could fix that (maybe we
should) but the report I received from a C++ user implied to me that it
would be just as useful to just drop the unnecessary #include
"ovs-atomic.h" from hmap.h.

Reported-by: Michael Hu <humichael@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
9 years agoovsdb-idl: Add function comments.
Ben Pfaff [Tue, 31 Mar 2015 18:28:39 +0000 (11:28 -0700)]
ovsdb-idl: Add function comments.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
9 years agojsonrpc: Add function comments.
Ben Pfaff [Tue, 31 Mar 2015 18:28:27 +0000 (11:28 -0700)]
jsonrpc: Add function comments.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
9 years agoovn-nbctl: Don't loop forever on lost db connection.
Russell Bryant [Tue, 31 Mar 2015 17:43:18 +0000 (13:43 -0400)]
ovn-nbctl: Don't loop forever on lost db connection.

The main loop of ovn-nbctl had a condition to catch if the conenction
to the db was lost.  However, it didn't break out of the loop when the
condition occurred.  Now it should log the error once and exit with a
non-zero status code.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agometa-flow: Add convenience members to union mf_subvalue.
Ben Pfaff [Wed, 25 Feb 2015 17:33:54 +0000 (09:33 -0800)]
meta-flow: Add convenience members to union mf_subvalue.

This makes access to the least-significant bits more convenient.  This
commit simplifies a few existing cases; later commits will make more use
of this feature.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
9 years agoovn-nbctl: Allow names that look like UUIDs.
Russell Bryant [Tue, 31 Mar 2015 02:07:04 +0000 (22:07 -0400)]
ovn-nbctl: Allow names that look like UUIDs.

This patch fixes handling of logical switch and logical port names
that look like a UUID.  Previously, if the argument looked like a
UUID, it would only do a UUID lookup for a match.  After this change,
if the UUID lookup fails, it will treat it as a name and look it up
that way.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath: Use alternate name for udp_sock_create() backport
Thomas Graf [Mon, 30 Mar 2015 10:21:09 +0000 (12:21 +0200)]
datapath: Use alternate name for udp_sock_create() backport

Account for kernels which provide udp_sock_create() in an
insufficient version.

Avoids the following error when inserting openvswitch.ko on
respective kernels:

openvswitch: exports duplicate symbol udp_sock_create (owned by udp_tunnel)

Fixes: eb6eebd28 ("datapath: Account for "udp: Add udp_sock_create for UDP tunnels to open listener socket")
Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Cc: Jesse Gross <jesse@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
9 years agodpif-netdev: Account for and free lost packets.
Daniele Di Proietto [Fri, 27 Mar 2015 16:29:50 +0000 (16:29 +0000)]
dpif-netdev: Account for and free lost packets.

Packets for which an upcall has failed (lost packets) must be deleted.
We also need to count them as MISS and LOST.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
9 years agoovn: Provide the correct daemon name.
Gurucharan Shetty [Thu, 19 Mar 2015 14:29:21 +0000 (07:29 -0700)]
ovn: Provide the correct daemon name.

It is ovn-nbd and not ovs-nbd.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
9 years agoovn: Design and Schema changes for Container integration.
Gurucharan Shetty [Wed, 4 Mar 2015 02:01:43 +0000 (18:01 -0800)]
ovn: Design and Schema changes for Container integration.

The design was come up after inputs and discussions with multiple
people, including (in alphabetical order) Aaron Rosen, Ben Pfaff,
Ganesan Chandrashekhar, Justin Pettit, Russell Bryant and Somik Behera.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agobuild-aux/cccl: Enhance --with-debug option
Alin Serdean [Mon, 30 Mar 2015 15:34:28 +0000 (15:34 +0000)]
build-aux/cccl: Enhance --with-debug option

This patch changes the behaviour in case the configure argument: --with-debug
was specified.

Currently the optimization flag in the case of debugging is the following:
https://msdn.microsoft.com/en-us/library/f9534wye.aspx
which does not fully disable optimization, that is why it was changed with
the following flag:
https://msdn.microsoft.com/en-us/library/aafb762y.aspx
which disables all code optimization.

Also this patch includes the definition of the following preprocessor
definitions:
_DEBUG - in case --with-debug is specified

The above definitions usually are defined when compiling with the following
flags:
https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
Since we are not compiling with the above flag, mimic the behaviour the
debug becahviour.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoofproto-dpif: Set need_revalidate when removing cfm from ofport.
Alex Wang [Sat, 28 Mar 2015 06:19:22 +0000 (23:19 -0700)]
ofproto-dpif: Set need_revalidate when removing cfm from ofport.

When cfm is deleted from a port, all modules should release their
reference so that the cfm struct can be removed from the global hmap
and freed.  Therein, the reference held by xlate module can only be
released when the need_revalidate flag is set (e.g set to
REV_RECONFIGURE).  And this flag should be set while removing cfm
from ofport.  Unfortunately, this has never been done before and the
bug was hidden by another bug fixed in recent commit a190839
(netdev-vport: Do not update netdev when there is no config change.)

To fix this issue, this commit makes the code set need_revalidate
when removing cfm from ofport.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agonetdev-linux: Make htb quantum always no less than mtu.
Alex Wang [Fri, 27 Mar 2015 18:34:53 +0000 (11:34 -0700)]
netdev-linux: Make htb quantum always no less than mtu.

Currently, ovs uses hardcoded rate2quantum = 10 for each htb qdisc.
When qdisc class's rate is small, the resulting quantum (calculated
by min_rate / rate2quantum) will be smaller than MTU.  This is not
recommended and tc will keep complaining the following in syslog.

localhost kernel: HTB: quantum of class 10003 is small. Consider r2q change.
localhost kernel: HTB: quantum of class 10004 is small. Consider r2q change.
localhost kernel: HTB: quantum of class 10005 is small. Consider r2q change.
localhost kernel: HTB: quantum of class 10006 is small. Consider r2q change.

To fix the issue, this commit makes ovs always use htb quantum no less
than the MTU.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agonetdev-dpdk: Put cuse thread into quiescent state.
Kevin Traynor [Fri, 27 Mar 2015 18:06:57 +0000 (11:06 -0700)]
netdev-dpdk: Put cuse thread into quiescent state.

ovsrcu_synchronize() is used when setting virtio_dev to NULL.
This results in an ovsrcu_quiesce_end() call which means the
cuse thread may not go into quiescent state again for an
indefinite time. Add an ovsrcu_quiesce_start() call to prevent
this.

Signed-off-by: Kevin Traynor <kevin.traynor@intel.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agonetdev-vport: Do not update netdev when there is no config change.
Alex Wang [Fri, 27 Mar 2015 00:35:32 +0000 (17:35 -0700)]
netdev-vport: Do not update netdev when there is no config change.

When there is any update from ovsdb, ovs will call netdev_set_config()
for every vport.  Even though the change is not related to vport, the
current implementation will always increment the per-netdev sequence
number.  Subsequently this could cause even more unwanted effects,
e.g. the recreation of 'struct tnl_port' in ofproto level.

This commit fixes the issue by only updating the netdev when there
is actual configuration change.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoopenvswitch-fedora: remove requires to kernel
Flavio Leitner [Fri, 27 Mar 2015 00:12:17 +0000 (21:12 -0300)]
openvswitch-fedora: remove requires to kernel

That RPM requires helped to work around a bug in
the kernel that was triggered by userspace package.

However, it doesn't force the kernel to be running,
so it's a weak solution.  Also, it makes difficult
to re-use the same spec on other RPM distros.

This patch comments out the requires.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoovs-sandbox: Initialize database before starting ovs-vswitchd.
Ben Pfaff [Thu, 26 Mar 2015 05:25:50 +0000 (22:25 -0700)]
ovs-sandbox: Initialize database before starting ovs-vswitchd.

Otherwise ovs-vswitchd can't immediately start working (until some other
call to ovs-vsctl initializes the database).  This is most obvious if one
runs "ovs-vsctl list Open_vSwitch ." as the first command, because the
output will not show the changes that ovs-vswitchd will make to the
database at startup (in particular initializing datapath_types and
iface_types), which is confusing.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
9 years agonetdev: Fix user space tunneling for set_tunnel action.
Ricky Li [Thu, 26 Mar 2015 13:11:28 +0000 (06:11 -0700)]
netdev: Fix user space tunneling for set_tunnel action.

e.g. Set tunnel id for encapsulated VxLAN packet (out_key=flow):

ovs-vsctl add-port int-br vxlan0 -- set interface vxlan0 \
    type=vxlan options:remote_ip=172.168.1.2 options:out_key=flow

ovs-ofctl add-flow int-br in_port=LOCAL, icmp,\
    actions=set_tunnel:3, output:1 (1 is the port# of vxlan0)

Output tunnel ID should be modified to 3 with this patch.

Signed-off-by: Ricky Li <ricky.li@intel.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
9 years agoflow_format: Do not format "in_port=0".
Jarno Rajahalme [Thu, 26 Mar 2015 22:32:45 +0000 (15:32 -0700)]
flow_format: Do not format "in_port=0".

flow_format() is used mainly for formating the headers of packets
embedded in OpenFlow PACKET_IN messages.  In this case the flow does
not have a valid port number, and printing out "in_port=0" only
confuses the resulting output.  Besides, 0 is not a valid OpenFlow
port number.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Added specific pool tag for vport code
Sorin Vinturis [Thu, 26 Mar 2015 19:59:38 +0000 (19:59 +0000)]
datapath-windows: Added specific pool tag for vport code

All memory allocations within vport code have 'PSVO' pool tag.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/56
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Added specific pool tag for user code
Sorin Vinturis [Thu, 26 Mar 2015 19:59:38 +0000 (19:59 +0000)]
datapath-windows: Added specific pool tag for user code

All memory allocations within user code have 'USVO' pool tag.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/56
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Added specific pool tag for switch code
Sorin Vinturis [Thu, 26 Mar 2015 19:59:37 +0000 (19:59 +0000)]
datapath-windows: Added specific pool tag for switch code

All memory allocations within switch code have 'SSVO' pool tag.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/56
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Added specific pool tag for oid code
Sorin Vinturis [Thu, 26 Mar 2015 19:59:37 +0000 (19:59 +0000)]
datapath-windows: Added specific pool tag for oid code

All memory allocations within oid code have 'ASVO' pool tag.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/56
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Added specific pool tag for iphelper code
Sorin Vinturis [Thu, 26 Mar 2015 19:59:37 +0000 (19:59 +0000)]
datapath-windows: Added specific pool tag for iphelper code

All memory allocations within iphelper code have 'HSVO' pool tag.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/56
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Added specific pool tag for vxlan code
Sorin Vinturis [Thu, 26 Mar 2015 19:59:37 +0000 (19:59 +0000)]
datapath-windows: Added specific pool tag for vxlan code

All memory allocations within vxlan code have 'XSVO' pool tag.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/56
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath-windows: Added specific pool tag for flow code
Sorin Vinturis [Thu, 26 Mar 2015 19:59:37 +0000 (19:59 +0000)]
datapath-windows: Added specific pool tag for flow code

All memory allocations within flow code have 'LSVO' pool tag.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/56
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>