]> git.proxmox.com Git - mirror_ovs.git/log
mirror_ovs.git
6 years agom4: Add pkg.m4 from pkg-config.
Ben Pfaff [Tue, 8 Aug 2017 23:02:20 +0000 (16:02 -0700)]
m4: Add pkg.m4 from pkg-config.

This way, users do not have to install the m4 file from pkg-config, which
was not previously a requirement.  Without this change, "configure" fails
when pkg.m4 is not available via aclocal:

./configure: line 26189: `        PKG_CHECK_MODULES(DPDK, libdpdk,'

Reported-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
6 years agoovsschema: Fix line lengths.
Bhanuprakash Bodireddy [Thu, 13 Jul 2017 01:29:39 +0000 (02:29 +0100)]
ovsschema: Fix line lengths.

According to coding style the line lengths should  be <=79. Fix the
schema file and update the checksum and version number to reflect the
change.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovs-vsctl-bashcomp: Make compatible with busybox "awk".
Ben Pfaff [Fri, 14 Jul 2017 04:42:54 +0000 (21:42 -0700)]
ovs-vsctl-bashcomp: Make compatible with busybox "awk".

It seems that awk in busybox doesn't think that an empty string is part of
a larger string, but that GNU awk does.  This commit adds an extra test to
make _ovs_vsctl_check_startswith_string work either way.

This allows the following tests to pass with busybox awk:

vsctl bashcomp unit tests

  7: vsctl-bashcomp - basic verification             ok
  8: vsctl-bashcomp - argument completion            ok

Reported-by: Stuart Cardall <developer@it-offshore.co.uk>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Lance Richardson <lrichard@redhat.com>
6 years agoredhat: allow dpdk to also run as non-root user
aaron conole [Fri, 4 Aug 2017 17:00:57 +0000 (13:00 -0400)]
redhat: allow dpdk to also run as non-root user

After this commit, users may start a dpdk-enabled ovs setup as a
non-root user.  This is accomplished by exporting the $HOME directory,
which dpdk uses to fill in it's semi-persistent RTE configuration.

This change may be a bit controversial since it modifies /dev/hugepages
as part of starting the ovs-vswitchd to set a hugetlbfs group
ownership.  This is used to enable writing to /dev/hugepages so that the
dpdk_init will successfully complete.  There is an alternate way of
accomplishing this - namely to initialize DPDK before dropping
privileges.  However, this would mean that if DPDK ever grows an uninit
/ reinit function, non-root ovs likely could never use it.

This does not change OvS+DPDK's SELinux requirements.  It still must be
disabled.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
6 years agoredhat: dynamic service file for vswitchd
aaron conole [Fri, 4 Aug 2017 17:00:56 +0000 (13:00 -0400)]
redhat: dynamic service file for vswitchd

This commit changes the service file from static configuration to an
autogenerated file, produced during the build.  This will be relevant in a
future commit.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
6 years agodpdkstrip: add a preprocessor tool for stripping dpdk blocks
aaron conole [Fri, 4 Aug 2017 17:00:55 +0000 (13:00 -0400)]
dpdkstrip: add a preprocessor tool for stripping dpdk blocks

Normally, in C code, pre-processing macros can be used to enable/disable
specific functionality based on switches passed to configure.  This works
for DPDK using the --with-dpdk flag, which sets the DPDK_NETDEV define to
the appropriate value.

However, not all files are processed with the C pre-processor.  For those
files which are not, this commit adds a new pre-processor tool for .in
files to either include or exclude those stanzas as appropriate.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
6 years agoredhat: dynamically allocate and reference ovs user
aaron conole [Fri, 4 Aug 2017 17:00:54 +0000 (13:00 -0400)]
redhat: dynamically allocate and reference ovs user

After this commit, the fedora RPM will create the openvswitch user, from the
non-static pool, for use as an Open vSwitch daemon user.  This only happens
on install - not upgrade.  This will be the default user:group
combination for the openvswitch daemons.

To do this in a way that doesn't impact existing installations, the
/etc/openvswitch directory will be created during the installation,
rather than being provided as part of the rpm.

Acked-by: Markos Chandras <mchandras@suse.de>
Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
6 years agoredhat: allow arbitrary user:group
aaron conole [Fri, 4 Aug 2017 17:00:53 +0000 (13:00 -0400)]
redhat: allow arbitrary user:group

Under rpm based distributions, the only user:group that the rhel daemons run
as is 'root:root'.  This is fine as a default, but as part of a security
procedure, users may want to run as an alternate uid/gid.  This commit
adds an OVS_USER_ID environment variable for systemd, which defaults to
root:root, but can be overridden by changing the /etc/sysconfig/openvswitch
environment file.

Acked-by: Markos Chandras <mchandras@suse.de>
Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
6 years agosystem-kmod-macros: Load TFTP module.
Joe Stringer [Mon, 7 Aug 2017 21:58:45 +0000 (14:58 -0700)]
system-kmod-macros: Load TFTP module.

Just like the FTP module needs to be loaded to ensure that the FTP tests
work, the TFTP module needs to be loaded to ensure that the TFTP tests
work. This patch does so.

Fixes: 200a9af97d1c ("System tests: Add 4 new ftp and tftp tests.")
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
6 years agosystem-traffic: Fix TFTP NAT skip check.
Joe Stringer [Mon, 7 Aug 2017 20:05:21 +0000 (13:05 -0700)]
system-traffic: Fix TFTP NAT skip check.

This test checked whether FTP support was available rather than TFTP.
It should check for TFTP, fix it.

Fixes: 200a9af97d1c ("System tests: Add 4 new ftp and tftp tests.")
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
6 years agoMAINTAINERS: Add Alin Serdean.
Ben Pfaff [Mon, 7 Aug 2017 15:04:31 +0000 (08:04 -0700)]
MAINTAINERS: Add Alin Serdean.

Alin was elected by the Open vSwitch committers on Friday.  Welcome to
the team, Alin!

CC: Alin Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoAdd NSH support information in NEWS
Yi Yang [Mon, 7 Aug 2017 19:33:32 +0000 (03:33 +0800)]
Add NSH support information in NEWS

Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoacinclude: Also support pkg-config for configuring dpdk.
Christian Ehrhardt [Fri, 14 Jul 2017 06:36:39 +0000 (08:36 +0200)]
acinclude: Also support pkg-config for configuring dpdk.

If available use dpdk pkg-config info of libdpdk to set the right
include paths.
That for example, allows packagers to provide non default include
paths in a common way (pkg-config).

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Suggested-by: Luca Boccassi <luca.boccassi@gmail.com>
Acked-by: Luca Boccassi <luca.boccassi@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto-dpif-upcall: Fix key attr iteration.
Joe Stringer [Mon, 31 Jul 2017 23:54:22 +0000 (16:54 -0700)]
ofproto-dpif-upcall: Fix key attr iteration.

This call is operating on messages generated by the datapath. If a
datapath implementation sends improperly formatted netlink attributes,
then it's possible for a revalidator thread to end up trapped in an
infinite loop iterating across these attributes. Rather than using the
UNSAFE variation of this iterator, use the regular version.

Fixes: 994fcc5a15d3 ("upcall: Check for recirc_id in ukey_create_from_dpif_flow()")
Signed-off-by: Joe Stringer <joe@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto-dpif-upcall: Fix action attr iteration.
Joe Stringer [Mon, 31 Jul 2017 23:54:21 +0000 (16:54 -0700)]
ofproto-dpif-upcall: Fix action attr iteration.

This calls is operating on messages generated by the datapath. If a
datapath implementation sends improperly formatted netlink attributes,
then it's possible for a revalidator thread to end up trapped in an
infinite loop iterating across the actions attributes. Rather than using
the UNSAFE variation of this iterator, use the regular version.

Fixes: e672ff9b4d22 ("ofproto-dpif: Restore metadata and registers on recirculation.")
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoAUTHORS: Add Wang Zhike.
Joe Stringer [Mon, 7 Aug 2017 17:50:45 +0000 (10:50 -0700)]
AUTHORS: Add Wang Zhike.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoNSH unit test cases using encap and decap actions
Jan Scheurich [Sat, 5 Aug 2017 05:41:12 +0000 (13:41 +0800)]
NSH unit test cases using encap and decap actions

With the support of generic encap and decap actions for Ethernet and NSH
it is now possible to build test cases that mimic realistic OVS
configurations and OF pipelines for Service Function Chaining. Packets
are being encapsulated in NSH, forwarded based on NSH headers, sent over
Ethernet links and VXLAN-GPE tunnels, and decapsulated at the end of
a service chain.

Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoGeneric encap and decap support for NSH
Jan Scheurich [Sat, 5 Aug 2017 05:41:11 +0000 (13:41 +0800)]
Generic encap and decap support for NSH

This commit adds translation and netdev datapath support for generic
encap and decap actions for the NSH MD1 header. The generic encap and
decap actions are mapped to specific encap_nsh and decap_nsh actions
in the datapath.

The translation follows that general scheme that decap() of an NSH
packet triggers recirculation after decapsulation, while encap(nsh)
just modifies struct flow and sets the ctx->pending_encap flag to
generate the encap_nsh action at the next commit to be able to include
subsequent set_field actions for NSH headers.

Support for the flexible MD2 format using TLV properties is foreseen
in encap(nsh), but not yet fully implemented.

The CLI syntax for encap of NSH is
encap(nsh(md_type=1))
encap(nsh(md_type=2[,tlv(<tlv_class>,<tlv_type>,<hex_string>),...]))

Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agouserspace: add NSH support to vxlan-gpe tunnels
Jan Scheurich [Sat, 5 Aug 2017 05:41:10 +0000 (13:41 +0800)]
userspace: add NSH support to vxlan-gpe tunnels

Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoAdding nsh.at for NSH unit tests
Jan Scheurich [Sat, 5 Aug 2017 05:41:09 +0000 (13:41 +0800)]
Adding nsh.at for NSH unit tests

First basic NSH test case implemented and working.

Unconditionally show matched packet_type in megaflows, even when
matching on eth.

Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agouserspace: Add support for NSH MD1 match fields
Jan Scheurich [Sat, 5 Aug 2017 05:41:08 +0000 (13:41 +0800)]
userspace: Add support for NSH MD1 match fields

This patch adds support for NSH packet header fields to the OVS
control plane and the userspace datapath. Initially we support the
fields of the NSH base header as defined in
https://www.ietf.org/id/draft-ietf-sfc-nsh-13.txt
and the fixed context headers specified for metadata format MD1.
The variable length MD2 format is parsed but the TLV context headers
are not yet available for matching.

The NSH fields are modelled as experimenter fields with the dedicated
experimenter class 0x005ad650 proposed for NSH in ONF. The following
fields are defined:

NXOXM code            ofctl name    Size      Comment
=====================================================================
NXOXM_NSH_FLAGS       nsh_flags       8       Bits 2-9 of 1st NSH word
(0x005ad650,1)
NXOXM_NSH_MDTYPE      nsh_mdtype      8       Bits 16-23
(0x005ad650,2)
NXOXM_NSH_NEXTPROTO   nsh_np          8       Bits 24-31
(0x005ad650,3)
NXOXM_NSH_SPI         nsh_spi         24      Bits 0-23 of 2nd NSH word
(0x005ad650,4)
NXOXM_NSH_SI          nsh_si          8       Bits 24-31
(0x005ad650,5)
NXOXM_NSH_C1          nsh_c1          32      Maskable, nsh_mdtype==1
(0x005ad650,6)
NXOXM_NSH_C2          nsh_c2          32      Maskable, nsh_mdtype==1
(0x005ad650,7)
NXOXM_NSH_C3          nsh_c3          32      Maskable, nsh_mdtype==1
(0x005ad650,8)
NXOXM_NSH_C4          nsh_c4          32      Maskable, nsh_mdtype==1
(0x005ad650,9)

Co-authored-by: Johnson Li <johnson.li@intel.com>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoNEWS: Announce userspace datapath ALG support.
Darrell Ball [Sun, 6 Aug 2017 17:51:18 +0000 (10:51 -0700)]
NEWS: Announce userspace datapath ALG support.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoSystem tests: Add 4 new ftp and tftp tests.
Darrell Ball [Sun, 6 Aug 2017 17:51:17 +0000 (10:51 -0700)]
System tests: Add 4 new ftp and tftp tests.

In order to have full coverage of ALGs for the userspace
datapath, it is necessary to add 4 new tests. Three of these will
cover passive ftp, including basic V6 passive ftp, V4 passive ftp
with NAT and sequence skew and V6 passive ftp with NAT. The last
test will cover tftp with NAT. Before these additions, there was
only one part of one test covering passive ftp without NAT and
one basic tftp test without NAT.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoSystem tests: Enable ALGs for userspace.
Darrell Ball [Sun, 6 Aug 2017 17:51:16 +0000 (10:51 -0700)]
System tests: Enable ALGs for userspace.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoUserspace Datapath: Add TFTP support.
Darrell Ball [Sun, 6 Aug 2017 17:51:15 +0000 (10:51 -0700)]
Userspace Datapath: Add TFTP support.

Both ipv4 and ipv6 are supported. Also, NAT support is included.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoUserspace Datapath: Add ALG infra and FTP.
Darrell Ball [Sun, 6 Aug 2017 17:51:14 +0000 (10:51 -0700)]
Userspace Datapath: Add ALG infra and FTP.

ALG infra and FTP (both V4 and V6) support is added to the userspace
datapath.  Also, NAT support is included.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoUserspace Datapath: Introduce conn_key_cmp().
Darrell Ball [Sun, 6 Aug 2017 17:51:13 +0000 (10:51 -0700)]
Userspace Datapath: Introduce conn_key_cmp().

A new function conn_key_cmp() is introduced and used to replace
memcmp of conn_keys. Given that OVS runs on with many compilers and
on many architectures, it seems prudent to avoid memcmp in case
existing and future holes in conn_key are not handled by a given
compiler for a given architecture.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Suggested-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agostring: Implement strcasestr for Windows.
Darrell Ball [Sun, 6 Aug 2017 17:51:12 +0000 (10:51 -0700)]
string: Implement strcasestr for Windows.

strcasestr is not defined for Windows, so implement a version
that could be used on Windows. This is needed for an upcoming
patch.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Co-authored-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodebian: Add note on interfaces in "auto" section.
Gurucharan Shetty [Mon, 7 Aug 2017 05:53:03 +0000 (22:53 -0700)]
debian: Add note on interfaces in "auto" section.

We had a note about the issues with adding OVS interfaces
in the "auto" section.  This commit clarifies what an
"auto" section is and also adds another note about
how adding OVS bridges in the "auto" section can cause
race conditions with systemd.

Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoRevert "netdev-vport: Always implement get_ifindex for netdev-vport"
Ben Pfaff [Mon, 7 Aug 2017 17:03:24 +0000 (10:03 -0700)]
Revert "netdev-vport: Always implement get_ifindex for netdev-vport"

This reverts commit 327d98eb197bf04da90e23c03d88093a6eeeb6f3,
which several unit tests to fail due to new warning messages in
the logs.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovs-bugtool: Run the 'dmesg' command without condition.
Gurucharan Shetty [Tue, 25 Jul 2017 07:20:57 +0000 (00:20 -0700)]
ovs-bugtool: Run the 'dmesg' command without condition.

Currently we look for files with the name of "dmesg"
in "/var/log". If it exists, we don't run the command
"dmesg". This is unreliable as the file does not always
contain the latest dmesg information.

Since OVS kernel module emits information to dmesg,
we need this information to debug bugs. So always
run the "dmesg" command and collect its output.

Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
Tested-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoovs-bugtool: Collect OVS logs with "--ovs" option.
Gurucharan Shetty [Tue, 25 Jul 2017 07:04:24 +0000 (00:04 -0700)]
ovs-bugtool: Collect OVS logs with "--ovs" option.

ovs-bugtool collects a lot of data. This can be time
consuming and can end up collecting a lot of redundant data.
A option "--ovs" was added a while ago to only collect
OVS relevent data. We missed adding the OVS logs to this
filter.

Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
Tested-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev-vport: Always implement get_ifindex for netdev-vport
Paul Blakey [Mon, 7 Aug 2017 04:32:02 +0000 (07:32 +0300)]
netdev-vport: Always implement get_ifindex for netdev-vport

Always implement get_ifindex without checking if offload is
enabled or not as this should not be related. From ovs-dpctl
we cannot tell if offload is enabled or not as other_config is
not being read.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev-tc-offloads: Fix parsing SCTP in dump flows
Roi Dayan [Sun, 6 Aug 2017 07:54:59 +0000 (10:54 +0300)]
netdev-tc-offloads: Fix parsing SCTP in dump flows

After splitting the unions of tcp/udp the sctp was forgotten
when parsing flower back to match.

Fixes: 2b1d9fa90909 ("tc: Split IPs and transport layer ports unions in flower struct")
Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Simon Horman <simon.horman@netronome.com>
6 years agoPrepare for post-2.8.0 (2.8.90).
Ben Pfaff [Fri, 4 Aug 2017 22:01:55 +0000 (15:01 -0700)]
Prepare for post-2.8.0 (2.8.90).

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoPrepare for 2.8.0.
Ben Pfaff [Tue, 1 Aug 2017 17:09:52 +0000 (10:09 -0700)]
Prepare for 2.8.0.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovsdb-server: Document clarification for some bad wording in RFC 7047.
Ben Pfaff [Thu, 27 Jul 2017 23:20:24 +0000 (16:20 -0700)]
ovsdb-server: Document clarification for some bad wording in RFC 7047.

Reported-by: Harish Kanakaraju <hkanakaraju@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
6 years agodebian.rst: Clarify that "dpkg" needs manual help with dependencies.
Ben Pfaff [Mon, 29 May 2017 18:40:51 +0000 (11:40 -0700)]
debian.rst: Clarify that "dpkg" needs manual help with dependencies.

Reported-by: Mircea Ulinic <ping@mirceaulinic.net>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
6 years agotests: fix wrapped comment
Lance Richardson [Fri, 4 Aug 2017 14:15:37 +0000 (10:15 -0400)]
tests: fix wrapped comment

Add missing '#' to comment line.

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
6 years agotests: avoid non-posix options to wc
Lance Richardson [Fri, 4 Aug 2017 14:26:02 +0000 (10:26 -0400)]
tests: avoid non-posix options to wc

The '--lines' option for the wc command is a GNU extension and is not
recognized by some implemenations. Use the POSIX 1003.1 '-l' option
instead.

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
6 years agoAUTHORS: Add Jorge Arturo Sauma Vargas and fix a misspelling.
Ben Pfaff [Thu, 3 Aug 2017 21:55:55 +0000 (14:55 -0700)]
AUTHORS: Add Jorge Arturo Sauma Vargas and fix a misspelling.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn-controller: use idl indexes for logical datapath
Lance Richardson [Thu, 3 Aug 2017 18:20:32 +0000 (14:20 -0400)]
ovn-controller: use idl indexes for logical datapath

Use IDL index to iterate over all logical ports in a given logical
datapath, avoiding the overhead of creating/destroying an indexing
data structure in each iteration of the ovn-controller main loop.

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn-controller: use idl indexes for logical port table
Lance Richardson [Thu, 3 Aug 2017 18:20:28 +0000 (14:20 -0400)]
ovn-controller: use idl indexes for logical port table

Use IDL index for logical port table lookups, avoiding the overhead
of creating/destroying an index hmap for each iteration of the
ovn-controller main loop.

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn-controller: use idl index for multicast group table
Lance Richardson [Thu, 3 Aug 2017 18:20:23 +0000 (14:20 -0400)]
ovn-controller: use idl index for multicast group table

Use IDL index for multicast group table lookups, avoiding the overhead
of creating/destroying an index hmap for each iteration of the
ovn-controller main loop.

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovsdb-idl: Autogenerated functions for compound indexes
Lance Richardson [Thu, 3 Aug 2017 18:20:19 +0000 (14:20 -0400)]
ovsdb-idl: Autogenerated functions for compound indexes

Generates and fills in the default comparators for columns with
type int, real, string. Also creates the macros that allow
iteration over the contents of the index, and perform
queries.

Signed-off-by: Arnoldo Lutz Guevara <arnoldo.lutz.guevara@hpe.com>
Signed-off-by: Esteban Rodriguez Betancourt <estebarb@hpe.com>
Co-authored-by: Arnoldo Lutz Guevara <arnoldo.lutz.guevara@hpe.com>
Co-authored-by: Esteban Rodriguez Betancourt <estebarb@hpe.com>
Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovsdb-idl: idl compound indexes implementation
Lance Richardson [Thu, 3 Aug 2017 18:20:15 +0000 (14:20 -0400)]
ovsdb-idl: idl compound indexes implementation

This patch adds support for the creation of multicolumn indexes
in the C IDL to enable for efficient search and retrieval of database
rows by key.

Signed-off-by: Esteban Rodriguez Betancourt <estebarb@hpe.com>
Co-authored-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agolib: skiplist implementation
Lance Richardson [Thu, 3 Aug 2017 18:20:11 +0000 (14:20 -0400)]
lib: skiplist implementation

Skiplist implementation intended for use in the IDL compound indexes
feature.

Signed-off-by: Esteban Rodriguez Betancourt <estebarb@hpe.com>
Co-authored-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovsdb-idl: compound indexes design document
Lance Richardson [Thu, 3 Aug 2017 18:20:05 +0000 (14:20 -0400)]
ovsdb-idl: compound indexes design document

In the work made in our projects, it was found the need to have a faster
access to the rows contained in tables in the replica, as well to have
the possibility to loop over a subset of rows that meet some specified
criteria.
Those needs lead us to design and implement a functionality that
satisfies those requirements, so an implementation of special indexes were
done.
In order to keep the OVSDB server implementation unmodified and avoid
extra load of processing, the indexes are created as part of the IDL.
The indexes are created as part of the initialization of the replica request
and are maintained automatically when there are changes in the replica.

This document explains the design rationale of the compound indexes feature.

Signed-off-by: Javier Albornoz <javier.albornoz@hpe.com>
Signed-off-by: Esteban Rodriguez Betancourt <estebarb@hpe.com>
Signed-off-by: Jorge Arturo Sauma Vargas <jorge.sauma@hpe.com>
Co-authored-by: Javier Albornoz <javier.albornoz@hpe.com>
Co-authored-by: Esteban Rodriguez Betancourt <estebarb@hpe.com>
Co-authored-by: Jorge Arturo Sauma Vargas <jorge.sauma@hpe.com>
Co-aughored-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodatapath-windows: Fix conntrack lookups for reversed keys
Sairam Venugopal [Tue, 1 Aug 2017 22:01:44 +0000 (15:01 -0700)]
datapath-windows: Fix conntrack lookups for reversed keys

The conntrack table needs to be queried for entries in either directions
to determine if the packet is in forward direction or reply direction.

The current behavior ends up reversing the incoming packet's 5-Tuple for
every entry in the loop instead of doing it only once.

Testing Done:
- Verified that ICMP requests are no longer treated as replies
in Conntrack.

Co-authored-by: Sairam Venugopal <vsairam@vmware.com>
Signed-off-by: Anand Kumar <kumaranand@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Shashank Ram <rams@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
6 years agobridge: Avoid read of uninitialized data configuring Auto-Attach.
Ben Pfaff [Thu, 6 Jul 2017 21:33:42 +0000 (14:33 -0700)]
bridge: Avoid read of uninitialized data configuring Auto-Attach.

Reported-by: "qintao (F)" <qintao5@huawei.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2017-April/044309.html
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
6 years agoovs-ofctl: Avoid unnecessary flow replacement in "replace-flows" command.
Ben Pfaff [Thu, 6 Jul 2017 23:40:30 +0000 (16:40 -0700)]
ovs-ofctl: Avoid unnecessary flow replacement in "replace-flows" command.

The ovs-ofctl "diff-flows" and "replace-flows" command compare the flows
in two flow tables.  Until now, the "replace-flows" command has considered
certain almost meaningless differences related to the version of OpenFlow
used to add a flow as significant, which caused it to replace a flow by an
identical-in-practice version, e.g. in the following, the "replace-flows"
command prints a FLOW_MOD that adds the flow that was already added
previously:

    $ cat > flows
    actions=resubmit(,1)
    $ ovs-vsctl add-br br0
    $ ovs-ofctl del-flows br0
    $ ovs-ofctl add-flows br0 flows
    $ ovs-ofctl -vvconn replace-flows br0 flows 2>&1 | grep FLOW_MOD

Re-adding an existing flow has some effects, for example, it resets the
flow's duration, so it's better to avoid it.

This commit fixes the problem using the same trick previously used for a
similar problem with the "diff-flows" command, which was fixed in commit
98f7f427bf8b ("ovs-ofctl: Avoid printing false differences on "ovs-ofctl
diff-flows".").

Reported-by: Kevin Lin <kevin@quilt.io>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
6 years agoofproto-dpif-xlate: Add OFPACT_ENCAP, OFPACT_DECAP to reversible_actions().
Ben Pfaff [Thu, 3 Aug 2017 20:19:20 +0000 (13:19 -0700)]
ofproto-dpif-xlate: Add OFPACT_ENCAP, OFPACT_DECAP to reversible_actions().

Fixes a broken build when building with --enable-Werror.

I guess that encap and decap are often reversible, but it's safe to
consider them irreversible.

Fixes: eee693934aac ("xlate: Emit datapath clone only when necessary.")
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
6 years agoovs-ovctl: Fix "OpenFlow versions" in ovs-ofctl -V
Timothy Redaelli [Thu, 27 Jul 2017 15:43:49 +0000 (17:43 +0200)]
ovs-ovctl: Fix "OpenFlow versions" in ovs-ofctl -V

Fix the output of "ovs-ofctl -V" to show OpenFlow 1.4 as max supported
versions since OpenFlow 1.4 was enabled by default in commit
8d3485791188 ("OpenFlow: Enable OpenFlow 1.4 by default.")

CC: Ben Pfaff <blp@ovn.org>
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agotnl-ports: Open tunnel type if device name has special prefix
Paul Blakey [Wed, 2 Aug 2017 11:17:29 +0000 (14:17 +0300)]
tnl-ports: Open tunnel type if device name has special prefix

There is a race between listening on route changes from route-table
netlink which then calls ovs_router_insert() where it adds the involved
netdev to the tnl-ports map (tnl_port_map_insert_ipdev()),
and netdev_open from from normal opening of the port.

tnl-ports open the netdev as type system (type == NULL) when it doesn't
exists before it is opened normally, e.g from dumping the ports
in dpctl.

This solves 'ovs-dpctl show' EExists error on vxlan ports as both
(dpctl/tnl-ports) will open the ports as vxlan type.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agotc: Correct convert ticks to msecs on parsing tc TM
Paul Blakey [Sun, 30 Jul 2017 05:01:52 +0000 (08:01 +0300)]
tc: Correct convert ticks to msecs on parsing tc TM

Use sysconf(_SC_CLK_TCK) to read run time "number of clock ticks per
second" and use that to convert ticks to msecs.
This is how iproute does the conversion when parsing tc filters.
The system call is done only once.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Joe Stringer <joe@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoodp-util: Support zero mask on ipv4 frag
Paul Blakey [Thu, 3 Aug 2017 13:27:07 +0000 (16:27 +0300)]
odp-util: Support zero mask on ipv4 frag

Don't print frag parsing error if mask is zero,
instead just don't print it.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoxlate: Emit datapath clone only when necessary.
Andy Zhou [Tue, 18 Jul 2017 05:30:01 +0000 (22:30 -0700)]
xlate: Emit datapath clone only when necessary.

Currently the open flow 'clone' action is always translated into
datapath clone. While this is valid translation, the datapath
'clone' action is more expensive and has more restrictions than
not using them.

This patch optimizing the open flow 'clone' translation. Whenever
the open flow actions within the 'clone' is reversible, i.e.
any datapath actions that modifies a packet can be reversed
by using another datapath action. Reversible actions can be
translated without emitting datapath clone.

This patch combines xlate_clone() and compose_clone() into
a single compose_clone() API, since the layering boundary is not
obvious.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoxlate: Refactor compose_clone() API
Andy Zhou [Tue, 18 Jul 2017 00:39:11 +0000 (17:39 -0700)]
xlate: Refactor compose_clone() API

Create a new function that hides the details of netlink encoding
for the translated clone action.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto-dpif: Remove ofprto/tnl-push-pop command.
Andy Zhou [Fri, 14 Jul 2017 19:20:59 +0000 (12:20 -0700)]
ofproto-dpif: Remove ofprto/tnl-push-pop command.

Use dpif/set-dp-features command instead.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto-dpif: Remove dpif/disable-truncate command.
Andy Zhou [Fri, 14 Jul 2017 00:29:16 +0000 (17:29 -0700)]
ofproto-dpif: Remove dpif/disable-truncate command.

Use 'dpif/set-dp-features' command instead.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto-dpif: Remove dpif/disable-dp-clone command.
Andy Zhou [Thu, 13 Jul 2017 23:12:41 +0000 (16:12 -0700)]
ofproto-dpif: Remove dpif/disable-dp-clone command.

Use 'dpif/set-dp-features' command instead.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto-dpif: Add boottime support field.
Andy Zhou [Sat, 17 Jun 2017 06:39:31 +0000 (23:39 -0700)]
ofproto-dpif: Add boottime support field.

When changing support fields, it may be unsafe to set support level
beyond what datapath can support.

This patch introduce the notion of boot time support and
runtime support fields. Boot time support are set only
once during ofproto start up phase, and not changed during
runtime. The runtime support fields are the same as boot time
support fields at the startup time, but can be changed via
the 'ovs-appctl' command.  However, each change will
be checked against the corresponding boot time support field. Only
feature reduction from the boot time support is allowed.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto-dpif: A new command for changing dpif support fields
Andy Zhou [Sat, 17 Jun 2017 06:22:32 +0000 (23:22 -0700)]
ofproto-dpif: A new command for changing dpif support fields

dpif support fields contain various datapath capabilities detected
by ofproto at start up time. Usually those fields are read-only,
not intended to be changed at runtime.

However in practice, when writing tests or running experiments, it
becomes necessary to set those fields to emulate different
datapath feature combinations.

Currently there are several separate commands that can be used
defeature individual support fields. This patch generalize those
implementations, provides a single command to change any support
fields. Later patches will remove those individual defeature
commands.

The new command also allow the support fields to be
changed multiple times. Currently defeature commands does not
allow the support level to be restored.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev-tc-offloads: Parse ip related fields only if eth type is ip
Paul Blakey [Thu, 3 Aug 2017 13:38:25 +0000 (16:38 +0300)]
netdev-tc-offloads: Parse ip related fields only if eth type is ip

There is no need to parse ip related fields if eth type is not ip.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agotc: Split IPs and transport layer ports unions in flower struct
Paul Blakey [Thu, 3 Aug 2017 13:38:24 +0000 (16:38 +0300)]
tc: Split IPs and transport layer ports unions in flower struct

Split dst/src_port and ipv4/ipv6 union so we can
distingush them easily for later features.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agotc: Refactor nl_msg_put_flower_options
Paul Blakey [Thu, 3 Aug 2017 13:38:23 +0000 (16:38 +0300)]
tc: Refactor nl_msg_put_flower_options

Refactor nl_msg_put_flower_options to be more readable.
This commit doesn't change functionality.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovs-ctl: Remove a leftover restore_interfaces in restart
Timothy Redaelli [Wed, 26 Jul 2017 13:48:33 +0000 (15:48 +0200)]
ovs-ctl: Remove a leftover restore_interfaces in restart

Since commit c416eaf8c247 ("ovs-ctl: Remove code for upgrading from Open
vSwitch 1.9 and earlier.") the kernel configuration of the specified
network interfaces is not saved anymore for restart command so there is no
need to try to restore it.

CC: Ben Pfaff <blp@ovn.org>
Fixes: c416eaf8c247 ("ovs-ctl: Remove code for upgrading from Open vSwitch 1.9 and earlier.")
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agopackets: Reorganize the pkt_metadata structure.
Bhanuprakash Bodireddy [Tue, 25 Jul 2017 04:14:44 +0000 (05:14 +0100)]
packets: Reorganize the pkt_metadata structure.

pkt_metadata_init() is called for every packet in userspace datapath and
initializes few members in pkt_metadata. Before this the members that
needs to be initialized are prefetched using pkt_metadata_prefetch_init().

The above functions are critical to the userspace datapath performance
and should be in sync. Any changes to the pkt_metadata should also include
changes to metadata_init() and prefetch_init() if necessary.

This commit slightly refactors the pkt_metadata structure and introduces
cache line markers to catch any violations to the structure. Also only
prefetch the cachelines having the members that needs to be zeroed out.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoutil: Add PADDED_MEMBERS_CACHELINE_MARKER macro to mark cachelines.
Bhanuprakash Bodireddy [Tue, 25 Jul 2017 04:14:43 +0000 (05:14 +0100)]
util: Add PADDED_MEMBERS_CACHELINE_MARKER macro to mark cachelines.

PADDED_MEMBERS_CACHELINE_MARKER macro introduces a way to mark
cachelines.

This macro expands to an anonymous union containing cacheline marker,
members in nested anonymous structure, followed by array of bytes that
is multiple of UNIT bytes.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovs-router: Remove redundant headers.
Tonghao Zhang [Wed, 19 Jul 2017 03:44:14 +0000 (20:44 -0700)]
ovs-router: Remove redundant headers.

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agorhel: Use systemd Restart option for ovn-controllers.
Mark Michelson [Wed, 2 Aug 2017 18:43:04 +0000 (13:43 -0500)]
rhel: Use systemd Restart option for ovn-controllers.

This change stops the use of OVS's monitor for the ovn-controller and
ovn-controller-vtep systemd services. Instead, the services use the
systemd Restart option to restart the services automatically if they
fail.

This patch changes the ovn-controller service Type from "oneshot" to
"forking". The Restart option is incompatible with oneshot services. The
patch does not change the ovn-controller-vtep service type from
"simple", however.

Signed-off-by: Mark Michelson <mmichels@redhat.com>
Acked-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
6 years agonetdev-linux: Replace sendmsg with sendmmsg in netdev_linux_send
Zhenyu Gao [Wed, 2 Aug 2017 21:58:24 +0000 (14:58 -0700)]
netdev-linux: Replace sendmsg with sendmmsg in netdev_linux_send

Sendmmsg can reduce cpu cycles in sending packets to kernel.
Replace sendmsg with sendmmsg in function netdev_linux_send to send
batch packets if sendmmsg is available.

If kernel side doesn't support sendmmsg, will fallback to sendmsg.

    netserver
|------------|
|            |
|  container |
|----veth----|
          |
          |        |------------|
          |---veth-|   dpdk-ovs |      netperf
                   |            |  |--------------|
                   |----dpdk----|  | bare-metal   |
                         |         |--------------|
                         |              |
                         |              |
                        pnic-----------pnic

Netperf was consumed to test the performance:

1)cmd:netperf -H remote-container -t UDP_STREAM -l 60 -- -m 1400
result: netserver received 2383.21Mb(sendmsg)/2551.64Mb(sendmmsg)

2)cmd:netperf -H remote-container -t UDP_STREAM -l 60 -- -m 60
result: netserver received 109.72Mb(sendmsg)/115.18Mb(sendmmsg)

Sendmmsg show about 6% improvement in netperf UDP testing.

Signed-off-by: Zhenyu Gao <sysugaozhenyu@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodp-packet: New function dp_packet_get_send_len().
Ben Pfaff [Wed, 2 Aug 2017 21:58:23 +0000 (14:58 -0700)]
dp-packet: New function dp_packet_get_send_len().

This function is useful in a few places for representing the packet's
length minus the cutlen.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto-dpif-ipfix: add support for per-flow drop counters
Przemyslaw Szczerbik [Fri, 28 Jul 2017 06:17:44 +0000 (07:17 +0100)]
ofproto-dpif-ipfix: add support for per-flow drop counters

Patch based on RFC 5102, section 5.10. It implements per-flow drop counters:
- droppedPacketDeltaCount
- droppedPacketTotalCount
- droppedOctetDeltaCount
- droppedOctetTotalCount

In order to determine if packet is going to be dropped, flow actions associated
with packet are read. If at least one of the following conditions is met,
packet is not marked as dropped.

 Packet has at least one:
 - OVS_ACTION_ATTR_OUTPUT action
 - OVS_ACTION_ATTR_CLONE action with nested OVS_ACTION_ATTR_OUTPUT action
 - OVS_ACTION_ATTR_SAMPLE action with nested OVS_ACTION_ATTR_OUTPUT action and
   sampling probability is set to 100%

Signed-off-by: Przemyslaw Szczerbik <przemyslawx.szczerbik@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodatapath-windows: Refactor OvsCreateNewNBLsFromMultipleNBs
Shashank Ram [Mon, 24 Jul 2017 22:31:38 +0000 (15:31 -0700)]
datapath-windows: Refactor OvsCreateNewNBLsFromMultipleNBs

Previously, the function would take the curNbl and nextNbl
as inputs, and modify the linked list, and merge the input
linked list with the newly generated newNbl list.

This is confusing for the caller, and the function has
unnecessary logic for merging linked lists that instead
the caller should take care of. This is because the
OvsCreateNewNBLsFromMultipleNBs() is a generic API
that can be used by other functions as well, and its
natural for different callers to have different needs.

This patch refactors the behavior of OvsCreateNewNBLsFromMultipleNBs
to take in the curNbl and lastNbl, and it returns
a linked list of NBLs and sets the HEAD and TAIL of the
new list obtained from the curNbl. If the caller wants
to chain a new linked list at the HEAD or TAIL, it
can make use of the curNbl and lastNbl to do so.

Signed-off-by: Shashank Ram <rams@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Anand Kumar <kumaranand@vmware.com>
6 years agoofproto-dpif-xlate: Always process IGMP packets in userspace.
Ben Pfaff [Tue, 11 Jul 2017 18:32:52 +0000 (11:32 -0700)]
ofproto-dpif-xlate: Always process IGMP packets in userspace.

Open vSwitch needs to always process IGMP packets in the userspace slow
path so that they can have their desired side effects.  However, userspace
was only applying SLOW_ACTION to IGMP packets in some cases, as opposed to
all cases, which meant that sometimes IGMP packets were ignored.  This
fixes that particular problem.

A problem remains: there is a mismatch between userspace support for IGMP
matching and kernel (lack of) support for IGMP matching.  This should
probably be handled better.  See the original report for more information.

Reported-by: Huanle Han <hanxueluo@gmail.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-July/335690.html
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoEliminate most shadowing for local variable names.
Ben Pfaff [Wed, 2 Aug 2017 22:03:06 +0000 (15:03 -0700)]
Eliminate most shadowing for local variable names.

Shadowing is when a variable with a given name in an inner scope hides a
different variable with the same name in a surrounding scope.  This is
generally undesirable because it can confuse programmers.  This commit
eliminates most of it.

Found with -Wshadow=local in GCC 7.  The repo is not really ready to enable
this option by default because of a few cases that are harder to fix, and
harmless, such as nested use of CMAP_FOR_EACH.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
6 years agoofproto-dpif-xlate: Eliminate duplicate read of xcfgp.
Ben Pfaff [Wed, 2 Aug 2017 15:36:07 +0000 (08:36 -0700)]
ofproto-dpif-xlate: Eliminate duplicate read of xcfgp.

This inner 'xcfg' shadowed the outer one and could have read a different
value if 'xcfgp' was changing, so this is possibly a bug fix.

Found by -Wshadow=local in GCC 7.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
6 years agohash: Add "fall through" annotations for 32-bit builds as well.
Ben Pfaff [Thu, 13 Jul 2017 17:15:42 +0000 (10:15 -0700)]
hash: Add "fall through" annotations for 32-bit builds as well.

Commit 73c7216a5329 ("Fix some -Wimplicit-fallthrough warnings building with
GCC 7") missed a few fall through annotations that only appear in 32-bit
builds.  This commit adds them.

CC: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
6 years agonetdev: Fix netdev_open() to track and recreate classless interfaces
Eelco Chaudron [Fri, 14 Jul 2017 12:33:27 +0000 (14:33 +0200)]
netdev: Fix netdev_open() to track and recreate classless interfaces

Due to commit 67ac844 an existing issue with OVS persisten ports
surfaced. If we revert the commit we no longer get the error, and
basic traffic will flow. However the wrong netdev class is used, hence
the wrong callbacks get called.

The main issue is with netdev_open() being called with type = NULL
before the interface is actually configured in the system. This patch
tracks these "auto" generated interfaces, and once netdev_open() gets
called with a valid type, re-configures (re-create) it.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn-controller: Monitor port bindings of parent ports.
wangqianyu [Wed, 2 Aug 2017 20:36:29 +0000 (13:36 -0700)]
ovn-controller: Monitor port bindings of parent ports.

Neutron configure a trunk-sub port. The parent-port and sub-port located
in different network. there is a vm attached to parent port. And no vm
attached to the network of sub-port in the same chassis. In this
situation, the ovn-controller can not get the configuration info of
sub-port.

The reason is that ovn-controller does not monitor the port-binding with
parent.

This patch fix this bug.

Signed-off-by: wangqianyu <wang.qianyu@zte.com.cn>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agolacp: enable bond slave immediately after lacp attach
Huanle Han [Wed, 12 Jul 2017 14:35:58 +0000 (22:35 +0800)]
lacp: enable bond slave immediately after lacp attach

There is a long interval (5~20 seconds) between lacp slave attach
and bond slave enable. During the interval, ovs drop all received
packets from that slave because bond_check_admissibility() check
fails. The root cause is that connectivity_seq is not changed
after lacp update and lacp status is not populated into port->may_enable
by port_run() immediately.

Signed-off-by: Huanle Han <hanxueluo@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agovlog: reopen log file in monitor process
Huanle Han [Wed, 2 Aug 2017 14:08:15 +0000 (10:08 -0400)]
vlog: reopen log file in monitor process

ovs daemon process will reopen file after every log rotate.
However, it doesn't happen to monitor process. That is to say,
fd of log file in monitor proces always point to oldest disk file,
which is deleted after log rotate. Once daemon process restarts
from a crash, it inherits parent's fds, including the deleted log file.

This commit reopens log file in monitor process everytime it
wakes up from waitpid.

Signed-off-by: Huanle Han <hanxueluo@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodatapath-windows: Fix shared variables which use Interlocked functions
Alin Serdean [Fri, 14 Jul 2017 04:40:58 +0000 (04:40 +0000)]
datapath-windows: Fix shared variables which use Interlocked functions

Instead of assigning a value directly to the variable use `InterlockedAdd`
with 0.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Shashank Ram <rams@vmware.com>
6 years agodatapath-windows: Add annotation for OvsIpFragmentEntryCleaner
Alin Serdean [Fri, 14 Jul 2017 04:40:58 +0000 (04:40 +0000)]
datapath-windows: Add annotation for OvsIpFragmentEntryCleaner

Make the function `OvsIpFragmentEntryCleaner` aware it is a kstart_routine.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Shashank Ram <rams@vmware.com>
6 years agodatapath-windows: Add annotation for OvsCtRelatedEntryCleaner
Alin Serdean [Fri, 14 Jul 2017 04:40:57 +0000 (04:40 +0000)]
datapath-windows: Add annotation for OvsCtRelatedEntryCleaner

Make the function `OvsCtRelatedEntryCleaner` aware it is a kstart_routine.

Also, the function is not compliant with the coding standard.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Shashank Ram <rams@vmware.com>
6 years agodatapath-windows: Treat TCP_HDR_LEN static analysis warnings
Alin Serdean [Fri, 14 Jul 2017 04:40:57 +0000 (04:40 +0000)]
datapath-windows: Treat TCP_HDR_LEN static analysis warnings

Using the shift operator in macros makes the static analyzer on WDK 8.1 confused.

Switch to multiplication when trying to get the data offset of the TCP header.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Shashank Ram <rams@vmware.com>
6 years agodatapath-windows: Check return status when using APIs
Alin Serdean [Fri, 14 Jul 2017 04:40:57 +0000 (04:40 +0000)]
datapath-windows: Check return status when using APIs

Check the return status of `ConvertInterfaceLuidToAlias` and `RtlStringCbLengthW`
and treat them accordingly.

Also remove unneeded initialization for `interfaceName`.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Shashank Ram <rams@vmware.com>
6 years agodatapath-windows: fix excessive stack usage in iphelper
Alin Serdean [Fri, 14 Jul 2017 04:40:57 +0000 (04:40 +0000)]
datapath-windows: fix excessive stack usage in iphelper

`OvsGetOrResolveIPNeigh` uses a stack over 1024 bytes.

Switch one parameter to be a pointer.

Found using WDK 8.1 static code analysis.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Shashank Ram <rams@vmware.com>
6 years agodatapath-windows: Add dummy parameter for NotifyRouteChange2
Alin Serdean [Fri, 14 Jul 2017 04:40:56 +0000 (04:40 +0000)]
datapath-windows: Add dummy parameter for NotifyRouteChange2

Add a dummy parameter when using `NotifyRouteChange2` to keep static
static analysis happy.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Shashank Ram <rams@vmware.com>
6 years agodatapath-windows: Suppress warning in jhash
Alin Serdean [Fri, 14 Jul 2017 04:40:56 +0000 (04:40 +0000)]
datapath-windows: Suppress warning in jhash

Suppress overflow warning to keep static code analysis happy.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Shashank Ram <rams@vmware.com>
6 years agodatapath-windows: Fix possible NULL deference in OvsFullCopyNBL
Alin Serdean [Fri, 14 Jul 2017 04:40:56 +0000 (04:40 +0000)]
datapath-windows: Fix possible NULL deference in OvsFullCopyNBL

Check if the first net buffer exists before trying to copy it.

Found using WDK 10 static code analysis.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Shashank Ram <rams@vmware.com>
6 years agodatapath-windows: Add assert in OvsPartialCopyNBL
Alin Serdean [Fri, 14 Jul 2017 04:40:56 +0000 (04:40 +0000)]
datapath-windows: Add assert in OvsPartialCopyNBL

`srcNb` should never be NULL since it was copied over from another nbl.
Add an assertion just in case and to keep static analysis happy.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Shashank Ram <rams@vmware.com>
6 years agodatapath-windows: Use annotations instead for macros
Alin Serdean [Fri, 14 Jul 2017 04:40:56 +0000 (04:40 +0000)]
datapath-windows: Use annotations instead for macros

We can safely use function annotations to instead of defining out own macros.
Nuke implementation of `OVS_VERIFY_IRQL_LE` and OVS_VERIFY_IRQL (unused).

Add function annotations to the functions which were using OVS_VERIFY_IRQL_LE`.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Shashank Ram <rams@vmware.com>
6 years agodatapath-windows: Fix misspelling in comment.
Alin Serdean [Fri, 14 Jul 2017 04:40:55 +0000 (04:40 +0000)]
datapath-windows: Fix misspelling in comment.

Found by inspection.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Shashank Ram <rams@vmware.com>
6 years agodatapath-windows: Add annotations for OvsAcquirePidHashLock
Alin Serdean [Fri, 14 Jul 2017 04:40:55 +0000 (04:40 +0000)]
datapath-windows: Add annotations for OvsAcquirePidHashLock

Add annotations to the function ` OvsAcquirePidHashLock`.
We make it aware that it raises the dispatch level, where it saves the
dispatch level and it acquires a lock.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Shashank Ram <rams@vmware.com>
6 years agodatapath-windows: Add annotations for OvsReleasePidHashLock
Alin Serdean [Fri, 14 Jul 2017 04:40:55 +0000 (04:40 +0000)]
datapath-windows: Add annotations for OvsReleasePidHashLock

Add function annotations for ` OvsReleasePidHashLock`.
We make it aware that it requires a certain dispatch level, that it
restores the dispatch level, that it requires a lock held and releases
a lock.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Shashank Ram <rams@vmware.com>
6 years agodatapath-windows: Add annotations for OvsReleaseEventQueueLock
Alin Serdean [Fri, 14 Jul 2017 04:40:55 +0000 (04:40 +0000)]
datapath-windows: Add annotations for OvsReleaseEventQueueLock

Add function annotations for ` OvsReleaseEventQueueLock`.
We make it aware that it requires a certain dispatch level, that it
restores the dispatch level, that it requires a lock held and releases
a lock.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Shashank Ram <rams@vmware.com>
6 years agodatapath-windows: Add function annotations for OvsAcquireEventQueueLock
Alin Serdean [Fri, 14 Jul 2017 04:40:55 +0000 (04:40 +0000)]
datapath-windows: Add function annotations for OvsAcquireEventQueueLock

The function should be aware that it raises the dispatch level, saves the
dispatch level and acquires a lock.

This patch adds annotation for that.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Shashank Ram <rams@vmware.com>
6 years agodatapath-windows: Add function annotations for OvsCancelIrpDatapath
Alin Serdean [Fri, 14 Jul 2017 04:40:55 +0000 (04:40 +0000)]
datapath-windows: Add function annotations for OvsCancelIrpDatapath

The function should be aware that it is cancel routine.

This patch adds annotation for that.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Shashank Ram <rams@vmware.com>