cascardo/ovs.git
8 years agoSet release dates for 2.4.0. v2.4.0
Justin Pettit [Fri, 21 Aug 2015 00:23:56 +0000 (17:23 -0700)]
Set release dates for 2.4.0.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agometa-flow: Fix ip_frag handling in mf_set_wild().
Jarno Rajahalme [Thu, 20 Aug 2015 20:10:07 +0000 (13:10 -0700)]
meta-flow: Fix ip_frag handling in mf_set_wild().

The wildcard bits were set when they should have been cleared.

Found by inspection.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoodp-util: Fix put_nd_key().
Jarno Rajahalme [Thu, 20 Aug 2015 20:10:07 +0000 (13:10 -0700)]
odp-util: Fix put_nd_key().

Actually copy the 'nd_target' from the key.

Found by inspection.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoclassifier: Fix comment.
Jarno Rajahalme [Wed, 12 Aug 2015 23:00:48 +0000 (16:00 -0700)]
classifier: Fix comment.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
8 years agodatapath: Fix L4 checksum handling when dealing with IP fragments
Glenn Griffin [Mon, 17 Aug 2015 14:50:51 +0000 (07:50 -0700)]
datapath: Fix L4 checksum handling when dealing with IP fragments

openvswitch modifies the L4 checksum of a packet when modifying
the ip address. When an IP packet is fragmented only the first
fragment contains an L4 header and checksum. Prior to this change
openvswitch would modify all fragments, modifying application data
in non-first fragments, causing checksum failures in the
reassembled packet.

Signed-off-by: Glenn Griffin <ggriffin.kernel@gmail.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: 3576fd794b3 ("openvswitch: Fix L4 checksum handling when
dealing with IP fragments").

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
8 years agodatapath: allocate nr_node_ids flow_stats instead of num_possible_nodes
Chris J Arges [Mon, 17 Aug 2015 14:40:43 +0000 (07:40 -0700)]
datapath: allocate nr_node_ids flow_stats instead of num_possible_nodes

Some architectures like POWER can have a NUMA node_possible_map that
contains sparse entries. This causes memory corruption with openvswitch
since it allocates flow_cache with a multiple of num_possible_nodes() and
assumes the node variable returned by for_each_node will index into
flow->stats[node].

Use nr_node_ids to allocate a maximal sparse array instead of
num_possible_nodes().

The crash was noticed after 3af229f2 was applied as it changed the
node_possible_map to match node_online_map on boot.
Fixes: 3af229f2071f5b5cb31664be6109561fbe19c861

Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: bac541e4631 ("openvswitch: allocate nr_node_ids flow_stats
instead of num_possible_nodes")

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
8 years agodatapath: disable LRO
Jiri Benc [Mon, 17 Aug 2015 14:38:01 +0000 (07:38 -0700)]
datapath: disable LRO

Currently, openvswitch tries to disable LRO from the user space. This does
not work correctly when the device added is a vlan interface, though.
Instead of dealing with possibly complex stacked cross name space relations
in the user space, do the same as bridging does and call dev_disable_lro in
the kernel.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: 640b2b107c ("openvswitch: disable LRO").

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
8 years agoflow: Ignore invalid ICMPv6 fields when parsing packets
Simon Horman [Thu, 13 Aug 2015 07:55:32 +0000 (16:55 +0900)]
flow: Ignore invalid ICMPv6 fields when parsing packets

There is a miss-match between the handling of invalid ICMPv6 fields in the
implementations of parse_icmpv6() in user-space and in the kernel datapath.

This patch addresses that by modifying the user-space implementation to
match that of the kernel datapath; processing is terminated without
rather than with an error and partial information is cleared.

With these changes the user-space implementation of parse_icmpv6()
never returns an error. Accordingly the return type and caller have been
updated.

The original motivation for this is to allow matching the ICMPv6 type and
code of packets with invalid neighbour discovery options although only the
change around the '(!opt_len || opt_len > *sizep)' conditional is necessary
to achieve that goal.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
8 years agoINSTALL.DPDK.md: Add details of XL710 restrictions for DPDK
Ian Stokes [Thu, 6 Aug 2015 15:58:47 +0000 (16:58 +0100)]
INSTALL.DPDK.md: Add details of XL710 restrictions for DPDK

Currently there are restrictions regarding the use of the XL710 network
interface with OVS and DPDK. This patch details those restrictions in
INSTALL.DPDK.md.

Signed-off-by: Ian Stokes <ian.stokes@intel.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
8 years agonetdev-dpdk: Retry tx/rx queue setup until we don't get any failure.
Daniele Di Proietto [Thu, 16 Jul 2015 18:48:24 +0000 (19:48 +0100)]
netdev-dpdk: Retry tx/rx queue setup until we don't get any failure.

It has been observed that some DPDK device (e.g intel xl710) report an
high number of queues but make some of them available only for special
functions (SRIOV).  Therefore the queues will be counted in
rte_eth_dev_info_get(), but rte_eth_tx_queue_setup() will fail.

This commit works around the issue by retrying the device initialization
with a smaller number of queues, if a queue fails to setup.

Reported-by: Ian Stokes <ian.stokes@intel.com>
Tested-by: Ian Stokes <ian.stokes@intel.com>
Acked-by: Kevin Traynor <kevin.traynor@intel.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
8 years agodatapath: Fix STT protocol field for sampling packet.
Pravin B Shelar [Fri, 31 Jul 2015 03:51:15 +0000 (20:51 -0700)]
datapath: Fix STT protocol field for sampling packet.

Fixes typo in STT sampling code.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
8 years agotype-props: Suppress warnings in newer Clang and GCC.
Ben Pfaff [Fri, 31 Jul 2015 00:44:26 +0000 (17:44 -0700)]
type-props: Suppress warnings in newer Clang and GCC.

Until now, Clang 3.7+ and sufficiently new versions of GCC complained about
TYPE_MAXIMUM(int), etc., because it shifts a negative value.  This commit
fixes the problem.

This commit also gives these macros sensible definitions for _Bool, and
documents all of them.

Reported-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
8 years agotype-props: Avoid a MSVC warning.
Gurucharan Shetty [Fri, 17 Jul 2015 15:48:23 +0000 (08:48 -0700)]
type-props: Avoid a MSVC warning.

Currently, MSVC complains when you have a macro of the
form TYPE_MAXIMUM(uint64_t) because a part of macro becomes
~(uint64_t)0 << 64 with a warning:

C4293: '<<' : shift count negative or too big, undefined behavior.

This commit makes changes to the macro to prevent that warning.

Suggested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agorhel: Add buildrequires for libtool and automake.
Flavio Leitner [Thu, 30 Jul 2015 18:16:30 +0000 (15:16 -0300)]
rhel: Add buildrequires for libtool and automake.

Those two packages are needed to build but they might not
be present in the system.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoFix treatment of OpenFlow 1.1+ bucket weights.
Ben Pfaff [Wed, 29 Jul 2015 05:01:24 +0000 (22:01 -0700)]
Fix treatment of OpenFlow 1.1+ bucket weights.

Until now, OVS has parsed all OF1.1+ group buckets that lack a weight
as having weight 1.  Unfortunately, OpenFlow says that only "select"
groups may have a nonzero weight, and requires reporting an error for
other kinds of groups that have a nonzero weight.  This commit fixes
the problem by parsing only select groups with a default weight of 1
and other groups with a default weight of 0.  It also adds the
OpenFlow-required check for nonzero weights for other kinds of groups.

This complies with OpenFlow 1.1 and later.  OF1.1 says in section 5.8:

    If a specified group type is invalid (ie: includes fields such as
    weight that are undefined for the specified group type) then the
    switch must refuse to add the group entry and must send an
    ofp_error_msg with OFPET_GROUP_MOD_FAILED type and
    OFPGMFC_INVALID_GROUP code.

Found by OFTest.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
8 years agoofp-actions: OFPP_ANY (aka OFPP_NONE) is not a valid output port.
Ben Pfaff [Wed, 29 Jul 2015 15:36:07 +0000 (08:36 -0700)]
ofp-actions: OFPP_ANY (aka OFPP_NONE) is not a valid output port.

This is implied by the list of ports that are valid for output in the
various versions of the OpenFlow specification.

Found by OFTest.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
8 years agoofproto: Ignore generation ID for role change to "equal".
Ben Pfaff [Mon, 25 May 2015 21:14:05 +0000 (14:14 -0700)]
ofproto: Ignore generation ID for role change to "equal".

The OpenFlow specification says that only role changes to slave or master
check the generation ID, so this is a bug fix.

OpenFlow 1.2 section A.3.9 phrases the requirement this way:

    Additionally, if the role value in the message is OFPCR_ROLE_MASTER
    or OFPCR_ROLE_SLAVE, the switch must validate generation_id to check
    for stale messages.

Found by OFTest.

Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodpdk: Fix detection of vhost_cuse in dpdk rte_config.h
Gary Mussar [Thu, 23 Jul 2015 17:48:53 +0000 (10:48 -0700)]
dpdk: Fix detection of vhost_cuse in dpdk rte_config.h

Dpdk allows users to create a config that includes other config files and
then override values.

Eg.
defconfig_x86_64-native_vhost_cuse-linuxapp-gcc:

CONFIG_RTE_BUILD_COMBINE_LIBS=y
CONFIG_RTE_BUILD_SHARED_LIB=n
CONFIG_RTE_LIBRTE_VHOST=y
CONFIG_RTE_LIBRTE_VHOST_USER=n

This allows you to have both a vhostuser and vhostcuse config in the same
source tree without the need to replicate everything in those config files
just to change a couple of settings. The resultant .config file has all of
the settings from the included files with the updated settings at the end.
The resultant rte_config.h contains multiple undefs and defines for the
overridden settings.

Eg.
  > grep RTE_LIBRTE_VHOST_USER x86_64-native_vhost_cuse-linuxapp-gcc/include/rte_config.h
  #undef RTE_LIBRTE_VHOST_USER
  #define RTE_LIBRTE_VHOST_USER 1
  #undef RTE_LIBRTE_VHOST_USER

The current mechanism to detect the RTE_LIBRTE_VHOST_USER setting merely
greps the rte_config.h file for the string "define RTE_LIBRTE_VHOST_USER 1"
rather than the final setting of RTE_LIBRTE_VHOST_USER. The following patch
changes this test to detect the final setting of RTE_LIBRTE_VHOST_USER.

Signed-off-by: Gary Mussar <gmussar@ciena.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com
8 years agotunnel: Mark GRE64 tunnel protocol deprecated.
Pravin B Shelar [Tue, 28 Jul 2015 18:29:54 +0000 (11:29 -0700)]
tunnel: Mark GRE64 tunnel protocol deprecated.

GRE64 was introduced to extend GRE key from 32-bit to 64-bit using
key and sequence number field. But GRE64 is not standard
protocol. There are not many users of this protocol. Therefore we
have decided to deprecate it. Since GRE64 is not in upstream
OVS kernel module removing it will bring upstream and out-of-tree
module closer.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
8 years agodatapath-windows: Fixed spelling errors in OVS
Sorin Vinturis [Wed, 15 Jul 2015 08:30:09 +0000 (08:30 +0000)]
datapath-windows: Fixed spelling errors in OVS

Solved some spelling errors observed in the datapath code.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agonetdev-linux: Cache the result of previous reading of in4 address.
Alex Wang [Fri, 24 Jul 2015 21:28:42 +0000 (14:28 -0700)]
netdev-linux: Cache the result of previous reading of in4 address.

This commit makes netdev_linux_set_in4() cache the result of previous
reading of in4 address (successful or not).

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agonetdev-linux: Make netdev_linux_get_in6() conform to API definition.
Alex Wang [Thu, 23 Jul 2015 23:25:32 +0000 (16:25 -0700)]
netdev-linux: Make netdev_linux_get_in6() conform to API definition.

The get_in6() API defined in netdev-provider.h requires the return
of error values when the 'netdev' has no assigned IPv6 address or
the 'netdev' does not support IPv6.  However, the netdev_linux_get_in6()
implementation does not follow this (always return 0).  And this
causes the a bug in deleting vlan interfaces created for vlan
splinter.

This commit makes netdev_linux_get_in6() conform to the API definition
and returns the specified error value when failing to get IPv6 address.

VMware-BZ: #1485521
Reported-by: Ronald Lee <ronaldlee@vmware.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agonetdev-linux: Make netdev_linux_notify_sock join RTNLGRP_IPV4_IFADDR
Alex Wang [Tue, 28 Jul 2015 06:43:27 +0000 (23:43 -0700)]
netdev-linux: Make netdev_linux_notify_sock join RTNLGRP_IPV4_IFADDR
and RTNLGRP_IPV6_IFADDR.

Currently the netdev_linux_notify_sock only joins multicast group
RTNLGRP_LINK for link status change notification.  Some ovs features
also require the detection of ip addresses changes and update of the
netdev-linux's cache.  To achieve this, we need to make
netdev_linux_notify_sock join the multicast group RTNLGRP_IPV4_IFADDR
and RTNLGRP_IPV6_IFADDR.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agortnetlink: Extend rtnetlink to support RTNLGRP_IPV4_IFADDR and
Alex Wang [Fri, 24 Jul 2015 21:03:06 +0000 (14:03 -0700)]
rtnetlink: Extend rtnetlink to support RTNLGRP_IPV4_IFADDR and
RTNLGRP_IPV6_IFADDR.

This commit renames the rtnetlink-link.{c,h} to rtnetlink.{c,h}
and extends the module to support RTNLGRP_IPV4_IFADDR and
RTNLGRP_IPV4_IFADDR multicast groups.  A later patch will start
using this module to react to interface address changes.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Avoid BSOD when cleaning up a tunnel vport
Sorin Vinturis [Tue, 28 Jul 2015 10:04:07 +0000 (10:04 +0000)]
datapath-windows: Avoid BSOD when cleaning up a tunnel vport

If an error appears when creating a tunnel vport the cleanup is performed
twice, which causes the tunnel vport to be released also twice and
generate a BSOD.

This patch modifies the tunnel filter cleanup logic to avoid this issue.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/97
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto-dpif-mirror: Fix insane waste of memory and time in checking VLANs.
Ben Pfaff [Fri, 24 Jul 2015 22:30:58 +0000 (15:30 -0700)]
ofproto-dpif-mirror: Fix insane waste of memory and time in checking VLANs.

When a mirror was restricted to particular VLANs, this code was allocating,
copying, and freeing a 512-byte block of memory just to check the value of
a single bit in the block.  This fixes the problem.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
8 years agoofproto-dpif-xlate: Fix handling of write_actions(group(5),output(10)).
Ben Pfaff [Thu, 23 Jul 2015 22:45:05 +0000 (15:45 -0700)]
ofproto-dpif-xlate: Fix handling of write_actions(group(5),output(10)).

This keeps actset_output as OFPP_UNSET in the special case where a single
write_actions() contains a group action followed by an output action.  The
presumably more common case where instructions in separate action lists
contained output and group actions was already properly handled.

Without the fix added by this commit, the test case as updated by this
commit fails.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agodatapath: allocate nr_node_ids flow_stats instead of num_possible_nodes
Chris J Arges [Wed, 22 Jul 2015 11:39:11 +0000 (04:39 -0700)]
datapath: allocate nr_node_ids flow_stats instead of num_possible_nodes

Some architectures like POWER can have a NUMA node_possible_map that
contains sparse entries. This causes memory corruption with openvswitch
since it allocates flow_cache with a multiple of num_possible_nodes()
and
assumes the node variable returned by for_each_node will index into
flow->stats[node].

Use nr_node_ids to allocate a maximal sparse array instead of
num_possible_nodes().

The crash was noticed after 3af229f2 was applied as it changed the
node_possible_map to match node_online_map on boot.
Fixes: 3af229f2071f5b5cb31664be6109561fbe19c861

Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
8 years agorhel: Fix ifup-ovs to delete ports first.
Flavio Leitner [Fri, 17 Jul 2015 16:56:21 +0000 (13:56 -0300)]
rhel: Fix ifup-ovs to delete ports first.

When ifdown isn't executed (system didn't shut down properly),
the interfaces remain in the openvswitch's database.  For the
internal ports or devices that are available when openvswitch
service starts that's not an issue.

However, ovs-vsctl won't do anything for devices created later
(Linux vlan devices for instance) since they are already in the
database. That leaves a inconsistency behind because they will
be left out of the kernel's datapath.

The ifup/ifdown will operate only on configured interfaces, so
this patch fixes the issue by deleting the interface from the
database before attempt to configure it.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agolib: Fix dependencies on ofp-errors.inc and ofp-msgs.inc.
Ben Pfaff [Mon, 20 Jul 2015 20:24:29 +0000 (13:24 -0700)]
lib: Fix dependencies on ofp-errors.inc and ofp-msgs.inc.

Commit e21a4c0271e6f (lib/automake.mk: Fix dependency typos.) was
crossported from master to fix some observed Debian build failures, but it
was not crossported correctly.  The version on master (commit 5b3c194faa61)
did not include the $(srcdir) prefixes because master had a previous commit
ab70cd304210e (Makefiles: Stop distributing files because building them
requires Python.) that is not on branch-2.4, and when I did the crossport I
failed to pay enough attention to realize that retaining $(srcdir) for the
target was incorrect: an .lo file would always be in the builddir.  Thus,
this commit fixes the problem.

Reported-by: Alex Wang <alexw@nicira.com>
Reported-at: http://openvswitch.org/pipermail/dev/2015-July/057779.html
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
Tested-by: Alex Wang <alexw@nicira.com>
8 years agoacinclude: Silence OVS_FIND_FIELD_IFELSE.
Joe Stringer [Thu, 16 Jul 2015 23:34:03 +0000 (16:34 -0700)]
acinclude: Silence OVS_FIND_FIELD_IFELSE.

Fields found using OVS_FIND_FIELD_IFELSE would previously be printed in
the console during configure. Clean up the output.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofpbuf: Update msg when resizing ofpbuf.
Alex Wang [Mon, 20 Jul 2015 06:13:14 +0000 (23:13 -0700)]
ofpbuf: Update msg when resizing ofpbuf.

Commit 6fd6ed7 (ofpbuf: Simplify ofpbuf API.) introduced the
'header' and 'msg' pointers to 'struct ofpbuf'.  However, we
forget to update the 'msg' pointer when resizing ofpbuf.

This bug could cause serious issue.  For example, in the function
ofputil_encode_nx_packet_in(), the 'msg' pointer is populated in
ofpraw_alloc_xid() when creating the ofpbuf .  Later, the ofpbuf
memory can be reallocated due to the writing to the ofpbuf.
However, since the 'msg' pointer is not updated, the later use of
the 'ofpbuf->msg' will end up writing to either free'ed memory or
memory allocated for other struct.

This commit fixes the bug by always updating the 'header' and
'msg' pointers when the ofpbuf is resized.  Also, a simple test
is added.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoacinclude: Require libfuse only for DPDK with vhost-cuse.
Daniele Di Proietto [Thu, 25 Jun 2015 14:46:55 +0000 (07:46 -0700)]
acinclude: Require libfuse only for DPDK with vhost-cuse.

DPDK with vhost-user doesn't require libfuse, so we shouldn't link OVS
with libfuse unless DPDK is built with vhost-cuse support.

CC: Rapelly, Varun <vrapelly@sonusnet.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
8 years agoovs-appctl: register unixctl commands in the beginning
Huanle Han [Wed, 15 Jul 2015 15:41:05 +0000 (23:41 +0800)]
ovs-appctl: register unixctl commands in the beginning

Some commands of ovs-appctl were lazily registered when first
bridg or bfd was added. Before that, calling these commands raised a
error("xxx is not a valid command"). The problem commangs included
"bfd/...", "upcall/...","dpif/...","fdb/..." and so on.

Fix this by moving the register into the "bridge_init" and
"bridge_init_ofproto". All commands are registered at the moment
ovs-vswitchd starts.

Signed-off-by: Huanle Han <hanxueluo@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agonetdev-linux: do not warn when getting stats for netdev with no vport
Thadeu Lima de Souza Cascardo [Tue, 7 Jul 2015 18:38:51 +0000 (15:38 -0300)]
netdev-linux: do not warn when getting stats for netdev with no vport

When there is no vport for a given netdev, dpif_netlink_vport_get might return
ENODEV. Do not warn a failure to get port stats when that's the case.

This happens when the userspace switch is used.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: update extension information
Alin Gabriel Serdean [Wed, 15 Jul 2015 17:44:14 +0000 (10:44 -0700)]
datapath-windows: update extension information

This patch sets additional information about the driver used by various
applications.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Update VXLAN header information
Alin Serdean [Mon, 13 Jul 2015 16:59:26 +0000 (16:59 +0000)]
datapath-windows: Update VXLAN header information

Use tunnel key information on the IP header preceding the VXLAN header.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Solved BSOD when cleaning up the VXLAN tunnel
Sorin Vinturis [Fri, 10 Jul 2015 08:26:51 +0000 (08:26 +0000)]
datapath-windows: Solved BSOD when cleaning up the VXLAN tunnel

When removing vport also remove the vxlan tunnel port.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/94
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agolib/automake.mk: Fix dependency typos.
Kyle Upton [Thu, 9 Jul 2015 19:22:46 +0000 (15:22 -0400)]
lib/automake.mk: Fix dependency typos.

Fix dependency issues with lib/ofp-errors.lo and lib/ofp-msgs.lo that
caused problems when building debian packages.

Signed-off-by: Kyle Upton <kupton@baymicrosystems.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodpif-netlink: Fix compiler warning.
Alin Serdean [Mon, 13 Jul 2015 14:15:33 +0000 (14:15 +0000)]
dpif-netlink: Fix compiler warning.

warning C4098: 'dpif_netlink_init_flow_del' : 'void' function returning a value

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodpif-netlink: Suppress DPIF_FP_PROBE here instead of in ofproto-dpif.
Ben Pfaff [Sat, 11 Jul 2015 15:27:43 +0000 (08:27 -0700)]
dpif-netlink: Suppress DPIF_FP_PROBE here instead of in ofproto-dpif.

Commit 22b4ccf4f (ofproto-dpif: Don't try to use dpif_probe_feature() with
Windows datapath.) stopped ofproto-dpif from trying to use the DPIF_FP_PROBE
feature of the datapath interface, because it doesn't work with Windows
yet.  However, it was *too* broad--it also stopped ofproto-dpif from
using DPIF_FP_PROBE with the netdev datapath, which still does support
DPIF_FP_PROBE on Windows.  This commit moves disabling DPIF_FP_PROBE a
couple of layers down, to a place where the two datapaths can be easily
distinguished.

Reported-by: Gurucharan Shetty <shettyg@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
8 years agoUndefined symbol make_unix_socket
Alin Serdean [Wed, 1 Jul 2015 19:01:44 +0000 (19:01 +0000)]
Undefined symbol make_unix_socket

syslog_direct_create defined in (lib/syslog-direct.c) uses make_unix_socket
which is currently undefined on the windows build.

We either can remove the new file from the chain but this patch proposes
to define a wrapper to make_unix_socket in which we return EINVAL.

This will avoid this kind of problems in the future.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
8 years agowindows: Avoid OVS_UNUSED in Windows stubs for syslog.h.
Alin Serdean [Tue, 30 Jun 2015 16:27:27 +0000 (16:27 +0000)]
windows: Avoid OVS_UNUSED in Windows stubs for syslog.h.

Currently OVS_UNUSED is defined in compiler.h since syslog.h is a
standalone wrapper remove it from the parameters.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
8 years agoofp-util: Require inner and outer message in bundle add to be same version.
Ben Pfaff [Mon, 6 Jul 2015 17:19:02 +0000 (10:19 -0700)]
ofp-util: Require inner and outer message in bundle add to be same version.

It doesn't make sense for the messages added to a bundle to have a
different OpenFlow version from the outer OpenFlow version.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agodatapath-windows: Solved BSOD when adding OVS ports
Sorin Vinturis [Thu, 2 Jul 2015 11:39:14 +0000 (11:39 +0000)]
datapath-windows: Solved BSOD when adding OVS ports

This BSOD occurred in the context of a packet (NBL) with multiple
NET_BUFFER(s) (NBs). The reason for the BSOD is due to the marking
of NBLs created by OVS as being external and wrongly completing them.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/82
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoovs-bugtool: Remove argument of "ovs-appctl dpif/show".
Huanle Han [Mon, 6 Jul 2015 13:51:13 +0000 (21:51 +0800)]
ovs-bugtool: Remove argument of "ovs-appctl dpif/show".

"ovs-appctl dpif/show" no longer takes any argument after commit dc54ef36
(ofproto: Track subfacet stats in the backer).

Signed-off-by: Huanle Han <hanxueluo@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agostream-ssl: Set SSL session cache mode to disables.
Guru Chaitanya Perakam [Fri, 3 Jul 2015 05:17:31 +0000 (10:47 +0530)]
stream-ssl: Set SSL session cache mode to disables.

To enable SSL clients to reconnect with the ovs-testcontoller without being
rejected, one must either set the SSL Session ID flag or disable the
SSL caching. This patch disables the SSL caching/reuse.

In the absence of this fix, the error message from ovs-testcontroller is as
below:

  SSL protocol error: SSL_accept (error:140D9115:SSL
  routines:SSL_GET_PREV_SESSION:session id context uninitialized)

See <https://www.openssl.org/docs/ssl/SSL_CTX_set_session_id_context.html>.

Validation: Tested with ovs-testcontroller, by performing SSL reconnection
with OpenSSL based SSL client.

Signed-off-by: Guru Chaitanya Perakam <gperakam@brocade.com>
Reported-by: Guru Chaitanya Perakam <gperakam@brocade.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto: Hold ofproto_mutex when enabling or disabling eviction.
Ben Pfaff [Thu, 2 Jul 2015 19:50:59 +0000 (12:50 -0700)]
ofproto: Hold ofproto_mutex when enabling or disabling eviction.

ofproto_enable_eviction() and ofproto_disable_eviction() require
ofproto_mutex (and they were even annotated that way, though not on their
prototypes but only at definition), but it wasn't being held.  This fixes
the problem.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agodatapath-windows: Solved memory leak in OVS datapath
Sorin Vinturis [Thu, 2 Jul 2015 06:53:08 +0000 (06:53 +0000)]
datapath-windows: Solved memory leak in OVS datapath

When closing opened instances, make sure the user dump state is cleared.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/90
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoSolved datapath-windows: BSOD when initializing switch context
Alin Serdean [Thu, 2 Jul 2015 06:35:58 +0000 (06:35 +0000)]
Solved datapath-windows: BSOD when initializing switch context

Add check in case of NdisAllocateRWLock fails to allocate the resources.

Check datapath->lock before trying to free it.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/92
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Solved BSOD when handling flows
Sorin Vinturis [Wed, 1 Jul 2015 20:03:01 +0000 (20:03 +0000)]
datapath-windows: Solved BSOD when handling flows

OvsPrepareFlow() returns an error only when the new flow allocation
fails. In this case HandleFlowPut() should return error without trying
to free the flow, thus avoiding the BSOD.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/91
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Rename 'vport->isPresentOnHv' to 'isAbsentOnHv'
Nithin Raju [Fri, 26 Jun 2015 18:51:29 +0000 (11:51 -0700)]
datapath-windows: Rename 'vport->isPresentOnHv' to 'isAbsentOnHv'

Looking at the code, the flag 'vport->isPresentOnHv' is actually
indicating if the vport is present on the Hyper-V switch or not, but the
logic seems to be inverse. 'isPresentOnHv == TRUE' indicates that the
vport is not present on the Hyper-V switch. Eg. VXLAN port, would have
isPresentOnHv == TRUE.

In this patch, we rename the variable to reflect its meaning.

vport->isAbsentOnHv is TRUE iff:
- vport is bridge internal port
- vport is tunnel port
- vport was added from Hyper-V and also from OVS, but got deleted from
Hyper-V

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Code refactoring and fixes in Vport.c
Nithin Raju [Fri, 26 Jun 2015 18:51:28 +0000 (11:51 -0700)]
datapath-windows: Code refactoring and fixes in Vport.c

In this patch, there a couple of fixes and some code refactoring:
1. During deletion of "internal" and "external" in
   OvsRemoveAndDeleteVport(), we need to check if 'hvDelete' is TRUE before
   updating the data structures. Added code comments explaining the
   same.

2. Added a OvsRemoveTunnelPort() that gets called from
   OvsRemoveAndDeletePort() for the special processing for tunnel ports.

3. Folded in OvsCleanupVportCommon() back into OvsRemoveAndDeletePort(),
   since we only need a part of the functionality of
   OvsCleanupVportCommon() to be called from
   OvsTunnelVportPendingUninit(), and not the entire function.

4. Renamed OvsTunnelVportPendingUninit() to
   OvsTunnelVportPendingRemove() since it is basically a "pending" version
   of OvsVportTunnelRemove().

Validation:
- Add external port from Hyper-V, add external port from OVS, remove
external port from OVS, remove external port from Hyper-V. No ASSERT
hit.
- Add external port from Hyper-V, add external port from OVS, remove
external port from Hyper-V, remove external port from OVS. No ASSERT
hit.
- Vxlan tunnel port creation/deletion
- Stt tunnel port creation/deletion
- Ping on Vxlan/Stt tunnels
- Ovs Extension load/unload. There's an unrelated issue I found that is
reported in: https://github.com/openvswitch/ovs-issues/issues/86

Signed-off-by: Nithin Raju <nithin@vmware.com>V
Reported-at: https://github.com/openvswitch/ovs-issues/issues/79
Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Reported-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoINSTALL.DPDK.md: Fix wrong command for creating dpdkvhostuser.
Wei li [Mon, 29 Jun 2015 10:35:13 +0000 (18:35 +0800)]
INSTALL.DPDK.md: Fix wrong command for creating dpdkvhostuser.

Signed-off-by: Wei li <liw@dtdream.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Failed initialization for datapath tunnel ports
Sorin Vinturis [Wed, 1 Jul 2015 15:32:18 +0000 (15:32 +0000)]
datapath-windows: Failed initialization for datapath tunnel ports

Tunnel ports are not initialized with the corresponding default port.
The newly allocated vport is not yet initialized and the ovsType
member does not reflect the correct tunnel port type, thus the
transport port destination won't be correctly initialized.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/88
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Avoid double incrementation of tx VXLAN packet statistics
Sorin Vinturis [Wed, 1 Jul 2015 15:21:03 +0000 (15:21 +0000)]
datapath-windows: Avoid double incrementation of tx VXLAN packet statistics

VXLAN tunnel tx packet stats are incorrectly incremented.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/89
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Duplicate tag for STT pools
Sorin Vinturis [Wed, 1 Jul 2015 15:20:27 +0000 (15:20 +0000)]
datapath-windows: Duplicate tag for STT pools

All pool allocations should have unique tags.
OVS_STT_POOL_TAG matches the OVS_MEMORY_TAG.

Changed the OVS_STT_POOL_TAG to make it unique.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agorhel: Add dkms support for ovs datapath build.
Alex Wang [Sun, 28 Jun 2015 23:31:16 +0000 (16:31 -0700)]
rhel: Add dkms support for ovs datapath build.

This commit adds a rpmbuild spec file for building ovs datapath
in dkms similar to the one for debian.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
8 years agovlog: add "vlog/list-pattern" command
Ansis Atteka [Sat, 13 Jun 2015 20:28:02 +0000 (13:28 -0700)]
vlog: add "vlog/list-pattern" command

This patch allows to query logging format at the runtime for each destination
with "vlog/list-pattern" command.

Signed-off-by: Ansis Atteka <aatteka@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agovlog: abstract out interface to syslog daemon
Ansis Atteka [Sun, 14 Jun 2015 00:22:15 +0000 (17:22 -0700)]
vlog: abstract out interface to syslog daemon

This patch helps to address two issues that are present on Ubuntu
15.04 (and most likely other Linux distributions) where rsyslog daemon
is configured to relay log messages from OVS to a remote log collector
and syslog format being used is something other than the one defined in
RFC 3164.  These two issues are:

1. libc syslog() function always adds RFC 3164 prefix to syslog
   messages before sending them over /dev/log Unix domain socket.
   This does not allow us to use libc syslog() function to log in
   RFC 5424 format;  and

2. rsyslogd daemon that comes with Ubuntu 15.04 is too old and
   uses hardcoded syslog message parser when it received messages
   over /dev/log UNIX domain socket.

Solution to those two issues would be to use the newly introduced
--syslog-method=udp:127.0.0.1:514 command line argument when starting
OVS.

Signed-off-by: Ansis Atteka <aatteka@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Conflicts:
NEWS

8 years agoofproto: Fix use-after-free in bridge destruction with groups.
Ben Pfaff [Tue, 23 Jun 2015 18:38:56 +0000 (11:38 -0700)]
ofproto: Fix use-after-free in bridge destruction with groups.

Groups were not destroyed until after lots of other important bridge
data had been destroyed, including the connection manager.  There was an
indirect dependency on the connection manager for bridge destruction
because destroying a group also destroys all of the flows that reference
the group, which in turn causes the ofmonitor to be invoked to report that
the flows had been destroyed.  This commit fixes the problem by destroying
groups earlier.

The problem can be observed by reverting the code changes in this commit
then running "make check-valgrind" with the test that this commit
introduces.

Reported-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
8 years agoofp-actions: Support mixing "conjunction" and "note" actions.
Ben Pfaff [Fri, 26 Jun 2015 15:14:15 +0000 (08:14 -0700)]
ofp-actions: Support mixing "conjunction" and "note" actions.

It doesn't make sense to mix "conjunction" actions with most other kinds
of actions.  That's because flows with "conjunction" actions aren't ever
actually executed, so any actions mixed up with them would never do
anything useful.  "note" actions are a little different because they never
do anything useful anyway: they are just there to allow a controller to
annotate flows.  It makes as much sense to annotate a flow with
"conjunction" actions as it does to annotate any other flow, so this
commit makes this possible.

Requested-by: Soner Sevinc <sevincs@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
8 years agotunneling: Don't match on source IP address for native tunnels.
Jesse Gross [Wed, 24 Jun 2015 21:44:50 +0000 (14:44 -0700)]
tunneling: Don't match on source IP address for native tunnels.

When doing native tunneling, we look at packets destined to the
local port to see if they match tunnel protocols that we should
intercept. The criteria are IP protocol, destination UDP port, etc.

However, we also look at the source IP address of the packets. This
should be a function of the port-based tunnel layer and not the
tunnel receive code itself. For comparison, the kernel tunnel code
has no idea about the IP addresses of its link partners. If port
based tunnel is desired, it can be handled using the normal port
tunnel layer, regardless of whether the packets originally came
from userspace or the kernel.

For port based tunneling, this bug has no effect - the check is
simply redundant. However, it breaks flow-based native tunnels
because the remote IP address is not known at port creation time.

CC: Pravin Shelar <pshelar@nicira.com>
Reported-by: David Griswold <David.Griswold@overturenetworks.com>
Tested-by: David Griswold <David.Griswold@overturenetworks.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
8 years agonetdev-dpdk: Reset RSS hash when receiving from a vhost device.
Daniele Di Proietto [Wed, 24 Jun 2015 15:55:40 +0000 (08:55 -0700)]
netdev-dpdk: Reset RSS hash when receiving from a vhost device.

A vhost device, being a virtual interface, doesn't provide a valid RSS
hash.  As a workaround we set the value to 0, which suggests the
datapath to recompute the hash in software.

Reported-by: Dongjun <dongj@dtdream.com>
CC: Traynor, Kevin <kevin.traynor@intel.com>
CC: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
8 years agonetdev-dpdk: Fix sparse and clang warnings
Daniele Di Proietto [Wed, 24 Jun 2015 15:55:39 +0000 (08:55 -0700)]
netdev-dpdk: Fix sparse and clang warnings

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
8 years agodpif-netdev: log port/core affinity
Mark Kavanagh [Tue, 9 Jun 2015 14:49:18 +0000 (07:49 -0700)]
dpif-netdev: log port/core affinity

When using multiple PMDs and numerous ports, a performance gain
may be achieved in some use cases by pinning a PMD/port to a
particular (set of) core(s).

This patch provides a summary of the switch's port/core affinities
each time that the status of the switch's ports is modified.
Based on this information, a user may determine what affinity
modifications are required to optimise performance for their
particular use case.

Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Signed-off-by: Wojciech Andralojc <wojciechx.andralojc@intel.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
8 years agonetdev-dpdk: Do not flush tx queue which is shared among CPUs since it is always...
Wei li [Thu, 25 Jun 2015 09:45:08 +0000 (02:45 -0700)]
netdev-dpdk: Do not flush tx queue which is shared among CPUs since it is always flushed

When tx queue is shared among CPUS,the pkts always be flush
in 'netdev_dpdk_eth_send'. So it is unnecessarily for flushing
in netdev_dpdk_rxq_recv Otherwise tx will be accessed without
locking.

Signed-off-by: Wei li <liw@dtdream.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
8 years agoofproto-dpif: Don't try to use dpif_probe_feature() with Windows datapath.
Alin Serdean [Thu, 25 Jun 2015 17:18:41 +0000 (17:18 +0000)]
ofproto-dpif: Don't try to use dpif_probe_feature() with Windows datapath.

This patch disables features which are not currently supported in the
Windows datapath.

Unfortunately we have to do it in userspace because dpif_probe_feature is
not treated accordingly in the Windows datapath.  Fixing that is the
correct solution; this commit works around it for branch-2.4.

I opened the issue to track the feature for later implementations:
https://github.com/openvswitch/ovs-issues/issues/85

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agotests: Use taskkill if tskill is not available, on Windows.
Ben Pfaff [Thu, 25 Jun 2015 15:34:39 +0000 (08:34 -0700)]
tests: Use taskkill if tskill is not available, on Windows.

This is not the minimal change; it "improves" the rest of the code as well.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
8 years agopython: Fix issue with probes for JSONRPC connections
Sumit Garg [Thu, 25 Jun 2015 13:24:54 +0000 (09:24 -0400)]
python: Fix issue with probes for JSONRPC connections

When opening a JSONRPC connection, the health probes
are incorrectly getting turned off for connections
that need probes.

In other words, when stream_or_pstream_needs_probes()
return non-zero, the probes are gettting disabled as
the probe interval is getting set to zero. This leads
to incorrect behavior such that probes are:

  - not getting turned off for unix: connections
  - getting turned off for tcp:/ssl: connections

The changes in this commit fix this issue.

Signed-off-by: Sumit Garg <sumit@extremenetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agopython: Fix writing to non-"alert" column for newly inserted row.
Sumit Garg [Thu, 25 Jun 2015 15:51:42 +0000 (08:51 -0700)]
python: Fix writing to non-"alert" column for newly inserted row.

When 'alert' was turned off on a column, the code was erroring out when
value for that column was being set in a newly inserted row. This is
because the row._data was None at this time.

It seems that new rows are not initialized to defaults and that's why the
NULL error happens.  IMO a newly inserted row should automatically get
intialized to default values.  This new behavior can be implemented as a
separate improvement sometime in the future.

For now, I don't see an issue with adding the additional check. This new
check can continue as-is even after the new behavior is implemented.

Signed-off-by: Sumit Garg <sumit@extremenetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agopython: Fix attempt to use a bool as a function.
Sumit Garg [Thu, 25 Jun 2015 12:44:10 +0000 (08:44 -0400)]
python: Fix attempt to use a bool as a function.

A bool (has_lock) was being accessed as a function call leading to a
runtime exception.

Signed-off-by: Sumit Garg <sumit@extremenetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agotests: Reduce user burden for running "make check".
Alin Serdean [Thu, 25 Jun 2015 15:30:34 +0000 (15:30 +0000)]
tests: Reduce user burden for running "make check".

With this commit, users do not have to manually add the pthread-win32
DLL directory to their PATH.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agonx-match: Fix distribution of hash function for NXM/OXM headers.
Ben Pfaff [Wed, 24 Jun 2015 18:17:12 +0000 (11:17 -0700)]
nx-match: Fix distribution of hash function for NXM/OXM headers.

NXM/OXM headers as represented in this file are 64-bit long and the low
bits are essentially constant (almost always 0) so using hash_int(),
which takes an uint32_t, is going to be a useless hash function.  This
commit fixes the problem.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
8 years agodatapath-windows: Wrong cleanup of newly created multiple NBLs
Sorin Vinturis [Wed, 24 Jun 2015 10:56:55 +0000 (10:56 +0000)]
datapath-windows: Wrong cleanup of newly created multiple NBLs

Bug found in OvsPartialCopyToMultipleNBLs function in the cleanup part of
the code. Before completing the current NBL (newNbl) the NEXT link for the
following NBL (firstNbl) was broken, instead of the current one (newNbl).

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/87
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath-windows: Return success for already existing WFP objects
Sorin Vinturis [Thu, 18 Jun 2015 18:37:13 +0000 (18:37 +0000)]
datapath-windows: Return success for already existing WFP objects

There are cases when the WFP callout or sublayer, being persistent
objects, already exists when we try to register the OVS callout. In
this cases, when trying to add again these WFP objects the return code
is STATUS_FWP_ALREADY_EXISTS, which we are interpreting as an error.
This is incorrect and this patch changes that.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/84
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agotests: Adjust output of vconn for windows.
Gurucharan Shetty [Mon, 15 Jun 2015 15:13:06 +0000 (08:13 -0700)]
tests: Adjust output of vconn for windows.

Recent tests added for openflow atomic bundle support
looks for Linux specific output in logs. Adjust them
so that tests pass in Windows too.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
8 years agoofproto.at: Don't specify the specific error.
Gurucharan Shetty [Fri, 12 Jun 2015 17:40:57 +0000 (10:40 -0700)]
ofproto.at: Don't specify the specific error.

On Windows, we don't do a good job of translating errors to Linux
type errors.  So in the tests, don't look for a specific type of
error.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
8 years agoofproto: Don't report that group chaining is supported.
Ben Pfaff [Sat, 6 Jun 2015 05:42:10 +0000 (22:42 -0700)]
ofproto: Don't report that group chaining is supported.

Group chaining hasn't been supported, so we shouldn't report that it is.
(This is a good demonstration of why I don't like feature bits like this.
It's too easy for even well-intentioned implementers to get them wrong.)

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
8 years agodatapath-windows: Initialize reference count when enabling extension
Sorin Vinturis [Fri, 19 Jun 2015 16:33:56 +0000 (16:33 +0000)]
datapath-windows: Initialize reference count when enabling extension

When the extension is initialized the global reference count, used for
preventing early deallocation of the switch extension, is set to 1.
Enabling and then disabling the extension leaves the latter reference
count to zero. Because of this the switch context fails to be acquired,
i.e OvsAcquireSwitchContext returns zero, and that affects driver's
communication to the userspace.

The solution is to initialize the reference count each time the extension
is enabled.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Nithin Raju <nithin@vmware.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/86
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
8 years agodatapath-windows: use correct dst port during Vxlan Tx
Nithin Raju [Fri, 19 Jun 2015 16:13:08 +0000 (09:13 -0700)]
datapath-windows: use correct dst port during Vxlan Tx

A previous commit used the wrong DST port in the UDP header during Vxlan
Tx which caused Vxlan tunneling to break. Fixing it here..

Also included is a cosmetic fix in OvsDetectTunnelRxPkt() where we were
using htons() instead of ntohs(). Doesn't make a difference in practice
though.

One more change is, OvsIpHlprCbVxlan() has been nuked since it is not
used. Not sure if it is worth being resurrected.

Testing done: Ping across Vxlan tunnel and Stt tunnel.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Reported-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
8 years agoPrepare for 2.4.0.
Justin Pettit [Wed, 17 Jun 2015 23:09:48 +0000 (16:09 -0700)]
Prepare for 2.4.0.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
8 years agodatapath-windows: Return pending for IRPs completed later
Sorin Vinturis [Thu, 18 Jun 2015 13:48:09 +0000 (13:48 +0000)]
datapath-windows: Return pending for IRPs completed later

Return STATUS_PENDING for IRPs that are completed later in another
thread.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/83
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoAUTHORS: Add Thadeu Lima de Souza Cascardo.
Ben Pfaff [Wed, 17 Jun 2015 18:14:31 +0000 (11:14 -0700)]
AUTHORS: Add Thadeu Lima de Souza Cascardo.

Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoAdd IGMPv3 support.
Thadeu Lima de Souza Cascardo [Wed, 17 Jun 2015 17:12:20 +0000 (14:12 -0300)]
Add IGMPv3 support.

Support IGMPv3 messages with multiple records. Make sure all IGMPv3
messages go through slow path, since they may carry multiple multicast
addresses, unlike IGMPv2.

Tests done:

* multiple addresses in IGMPv3 report are inserted in mdb;
* address is removed from IGMPv3 if record is INCLUDE_MODE;
* reports sent on a burst with same flow all go to userspace;
* IGMPv3 reports go to mrouters, i.e., ports that have issued a query.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto-dpif-xlate: Make IGMP packets always take slow path.
Thadeu Lima de Souza Cascardo [Wed, 17 Jun 2015 17:12:19 +0000 (14:12 -0300)]
ofproto-dpif-xlate: Make IGMP packets always take slow path.

IGMP packets need to take the slow path. Otherwise, packets that match
the same flow will not be processed by OVS. That might prevent OVS from
updating the expire time for entries already in the mdb, but also to
lose packets with different addresses in the payload.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agolacp: Remove packed attribute from struct lacp_pdu.
Ben Pfaff [Tue, 16 Jun 2015 15:47:34 +0000 (08:47 -0700)]
lacp: Remove packed attribute from struct lacp_pdu.

The packed annotation doesn't do anything here because all of the members
in the structure are naturally aligned.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Ethan Jackson <ethan@nicira.com>
8 years agoauto-attach: Cleanup i-sid/vlan mappings associated with lldp-enabled port.
Dennis Flynn [Tue, 16 Jun 2015 21:33:35 +0000 (17:33 -0400)]
auto-attach: Cleanup i-sid/vlan mappings associated with lldp-enabled port.

This commit fixes a bug where the i-sid/vlan mapping structures associated with
an lldp-enabled port were not being freed during general port cleanup.

Signed-off-by: Dennis Flynn <drflynn@avaya.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodocs: Fix alignment for diagram in native-tunneling.md.
Mark D. Gray [Wed, 17 Jun 2015 11:49:25 +0000 (12:49 +0100)]
docs: Fix alignment for diagram in native-tunneling.md.

Markdown was not formatted correctly and, as a result,
was displaying incorrectly on github.

Signed-off-by: Mark D. Gray <mark.d.gray@intel.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoovs-vtep: Support userspace datapaths.
Daniele Di Proietto [Tue, 16 Jun 2015 15:25:24 +0000 (16:25 +0100)]
ovs-vtep: Support userspace datapaths.

With this commit, the VTEP emulator detects the datapath_type of the
bridge used as a "physical" switch, and creates subsequent bridges
with the same type.  This allows ovs-vtep to work with the userspace
datapath.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Gurucharan Shetty <gshetty@nicira.com>
8 years agodatapath-windows: BSOD when disabling the extension
Sorin Vinturis [Thu, 28 May 2015 20:30:57 +0000 (20:30 +0000)]
datapath-windows: BSOD when disabling the extension

When the filter detach routine is called while there are packets
still in processing, the OvsUninitSwitchContext function call will
decrement the switch context reference count without releasing the
switch context structure. This behaviour is correct and expected,
but the BSOD is caused in this case because the gOvsSwitchContext
variable is set to NULL, which is wrong.

The gOvsSwitchContext global variable must be set to NULL only when
the switch context structure is actually released.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/80
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodpif-netdev: Prefetch next packet before miniflow_extract().
Daniele Di Proietto [Mon, 15 Jun 2015 18:06:39 +0000 (19:06 +0100)]
dpif-netdev: Prefetch next packet before miniflow_extract().

It appears that miniflow_extract() in emc_processing() spends a lot of
cycles waiting for the packet's data to be read.

Prefetching the next packet's data while parsing removes this delay.
For a single flow pipeline the throughput improves by ~10%.  With a
more realistic pipeline the change has a much smaller effect (~0.5%
improvement)

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
8 years agoovs-ctl: let openvswitch startup to NOT hold up system boot upon error
Sabyasachi Sengupta [Mon, 15 Jun 2015 21:57:53 +0000 (14:57 -0700)]
ovs-ctl: let openvswitch startup to NOT hold up system boot upon error

Abort openvswitch startup script if ovsdb startup fails for
some reason. This helps in getting the system startup to NOT hang
indefinitely, as was seen in a recent report when ovsdb failed with
"I/O error: /etc/openvswitch/conf.db: failed to lock lockfile
(Resource temporarily unavailable)" and system remained in hung state
forever, unless manually rebooted from console.

Signed-off-by: Sabyasachi Sengupta <sabyasachi.sengupta@alcatel-lucent.com>
[blp@nicira.com changed an 'if' statement to '||']
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoflow: Make assertions about offsets within struct flow easier to follow.
Ben Pfaff [Tue, 9 Jun 2015 18:32:24 +0000 (11:32 -0700)]
flow: Make assertions about offsets within struct flow easier to follow.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agonetdev-dpdk: add dpdk vhost-user ports
Ciara Loftus [Thu, 4 Jun 2015 13:51:40 +0000 (06:51 -0700)]
netdev-dpdk: add dpdk vhost-user ports

This patch adds support for a new port type to the userspace
datapath called dpdkvhostuser.

A new dpdkvhostuser port will create a unix domain socket which
when provided to QEMU is used to facilitate communication between
the virtio-net device on the VM and the OVS port on the host.

vhost-cuse ('dpdkvhost') ports are still available as 'dpdkvhostcuse'
ports and will be enabled if vhost-cuse support is detected in the
DPDK build specified during compilation of the switch. Otherwise,
vhost-user ports are enabled.

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
8 years agoofproto: Support port mods in bundles.
Jarno Rajahalme [Fri, 12 Jun 2015 23:12:56 +0000 (16:12 -0700)]
ofproto: Support port mods in bundles.

Add support for port mods in an OpenFlow 1.4 bundle, as required for
the minimum support level by the OpenFlow 1.4 specification.  If the
bundle includes port mods, it may not specify the OFPBF_ATOMIC flag.
Port mods and flow mods in a bundle are always applied in order and
the consecutive flow mods between port mods are made available to
lookups atomically.

Note that ovs-ofctl does not support creating bundles with port mods.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofproto: Postpone sending flow removed messages.
Jarno Rajahalme [Fri, 12 Jun 2015 23:12:56 +0000 (16:12 -0700)]
ofproto: Postpone sending flow removed messages.

The final flow stats are available only after there are no references
to the rule.  Postpone sending the flow removed message until the
final stats are available.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoclassifier: Simplify versioning.
Jarno Rajahalme [Fri, 12 Jun 2015 23:12:56 +0000 (16:12 -0700)]
classifier: Simplify versioning.

After all, there are some cases in which both the insertion version
and removal version of a rule need to be considered.  This makes the
cls_match a bit bigger, but makes classifier versioning much simpler
to understand.

Also, avoid using type larger than int in an enum, as it is not
portable C.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoovs-rcu: Comment fixes.
Ben Pfaff [Fri, 12 Jun 2015 17:58:27 +0000 (10:58 -0700)]
ovs-rcu: Comment fixes.

A comment referred to a "Usage" section but the section was named "Use".
This fixes the problem (also a grammar error).

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
8 years agorculist: Remove postponed poisoning.
Jarno Rajahalme [Fri, 12 Jun 2015 00:28:37 +0000 (17:28 -0700)]
rculist: Remove postponed poisoning.

Postponed 'next' member poisoning was based on the faulty assumption
that postponed functions would be called in the order they were
postponed.  This assumption holds only for the functions postponed by
any single thread.  When functions are postponed by different
threads, there are no guarantees of the order in which the functions
may be called, or timing between those calls after the next grace
period has passed.

Given this, the postponed poisoning could have executed after
postponed destruction of the object containing the rculist element.

This bug was revealed after the memory leaks on rule deletion were
recently fixed.

This patch removes the postponed 'next' member poisoning and adds
documentation describing the ordering limitations in OVS RCU.

Alex Wang dug out the root cause of the resulting crashes, thanks!

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>