]> git.proxmox.com Git - mirror_ovs.git/log
mirror_ovs.git
6 years agoDon't shadow variables.
Justin Pettit [Wed, 28 Feb 2018 01:34:14 +0000 (17:34 -0800)]
Don't shadow variables.

Rename the remaining variables that were shadowing another definition.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoovs-numa: Prevent shadowing 'dummy_config'.
Justin Pettit [Tue, 27 Feb 2018 22:50:25 +0000 (14:50 -0800)]
ovs-numa: Prevent shadowing 'dummy_config'.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agodb-ctl-base: Don't shadow 'invalidate_cache' callback.
Justin Pettit [Tue, 27 Feb 2018 22:24:23 +0000 (14:24 -0800)]
db-ctl-base: Don't shadow 'invalidate_cache' callback.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoDon't shadow iterator values.
Justin Pettit [Tue, 27 Feb 2018 20:32:29 +0000 (12:32 -0800)]
Don't shadow iterator values.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agodp-packet: Add index to DP_PACKET_BATCH_FOR_EACH to prevent shadowing.
Justin Pettit [Tue, 27 Feb 2018 18:41:30 +0000 (10:41 -0800)]
dp-packet: Add index to DP_PACKET_BATCH_FOR_EACH to prevent shadowing.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agocmap: Allow CMAP_FOR_EACH to be nested without shadowing variables.
Justin Pettit [Tue, 27 Feb 2018 18:33:51 +0000 (10:33 -0800)]
cmap: Allow CMAP_FOR_EACH to be nested without shadowing variables.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoDon't shadow global VLOG "rl" definition.
Justin Pettit [Tue, 27 Feb 2018 18:44:13 +0000 (10:44 -0800)]
Don't shadow global VLOG "rl" definition.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto: fix comment about ofproto-dpif
William Tu [Mon, 26 Feb 2018 23:56:46 +0000 (15:56 -0800)]
ofproto: fix comment about ofproto-dpif

"dpif-netlink" is the dpif to communicate with kernel.
So replace "dpif-linux" with "dpif-netlink".

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agotravis: build the selinux policy under linux
Aaron Conole [Tue, 27 Feb 2018 15:11:38 +0000 (10:11 -0500)]
travis: build the selinux policy under linux

When performing a linux build, create the selinux policy.  This
ensures that the selinux policy files are at least 'compile' tested
when changes occur.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoselinux: drop autogenerated files
Aaron Conole [Tue, 27 Feb 2018 15:11:37 +0000 (10:11 -0500)]
selinux: drop autogenerated files

When running a make clean, it is desirable for the autogenerated files to be
removed.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agopython: avoid useless JSON conversion to enhance performance
Daniel Alvarez [Wed, 28 Feb 2018 09:11:09 +0000 (10:11 +0100)]
python: avoid useless JSON conversion to enhance performance

This patch removes a useless conversion to/from JSON in the
processing of any 'modify' operations inside the process_update2
method in Python IDL implementation.

Previous code will make resources creation take longer as the number
of elements in the row grows because of that JSON conversion. This
patch eliminates it and now the time remains consant regardless
of the database contents improving performance and scaling.

Reported-by: Daniel Alvarez <dalvarez@redhat.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2018-February/046263.html
Signed-off-by: Daniel Alvarez <dalvarez@redhat.com>
Acked-by: Terry Wilson <twilson@redhat.com>
Tested-By: Terry Wilson <twilson@redhat.com>
Acked-by: Han Zhou <hzhou8@ebay.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agocmap: Fix example provided for CMAP_FOR_EACH.
Justin Pettit [Wed, 28 Feb 2018 06:51:47 +0000 (22:51 -0800)]
cmap: Fix example provided for CMAP_FOR_EACH.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoAUTHORS: update email address for Mark Kavanagh
Mark Kavanagh [Wed, 28 Feb 2018 10:33:33 +0000 (10:33 +0000)]
AUTHORS: update email address for Mark Kavanagh

Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoFix type-setting in ovsdb-idlc man page.
Jakub Sitnicki [Wed, 28 Feb 2018 16:06:45 +0000 (17:06 +0100)]
Fix type-setting in ovsdb-idlc man page.

- Remove extra escape sequences for switching to bold font.
- Add missing escape sequences for switching back to normal font.

Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2018-February/344591.html
Signed-off-by: Jakub Sitnicki <jkbs@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn-sbctl: Remove incorrect manpage options.
Dan Williams [Wed, 28 Feb 2018 17:47:23 +0000 (11:47 -0600)]
ovn-sbctl: Remove incorrect manpage options.

These options are not implemented by ovn-sbctl.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agocompat: Fix RHEL 7 build warnings
Greg Rose [Mon, 26 Feb 2018 22:10:16 +0000 (14:10 -0800)]
compat: Fix RHEL 7 build warnings

A prior commit to fix up netdev_master_upper_dev_link for recent
kernels caused a compile warning on RHEL 7 builds.

Fixes: 36d3520b5f ("datapath: Fix netdev_master_upper_dev_link for 4.14")
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agocompat: Fix RHEL 7 compile
Greg Rose [Mon, 26 Feb 2018 22:10:15 +0000 (14:10 -0800)]
compat: Fix RHEL 7 compile

frag_percpu_counter_batch is a variable, not a define, so checking if
it is defined is an error and causes warning messages during compile
on RHEL 7 (or other 3.10 based) builds.  Use a compat #define from
acinclude.m4 instead.

Fixes: 64d8cb7295 ("compat:inet_frag.h: Check for frag_percpu_counter_batch")
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath-windows: fix hash creation on ct mark
Alin Gabriel Serdean [Wed, 21 Feb 2018 14:57:29 +0000 (16:57 +0200)]
datapath-windows: fix hash creation on ct mark

Use key->ct.mark instead of key->ct.zone when generating the hash
over the mark.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Acked-by: Anand Kumar <kumaranand@vmware.com>
6 years agoselinux: include the svirt_t type
Aaron Conole [Tue, 27 Feb 2018 14:21:52 +0000 (09:21 -0500)]
selinux: include the svirt_t type

The dpdk policy adds support for interacting with libvirt, but failed
to include the appropriate svirt_t type.  This results in an error
like:

    openvswitch-custom.te:53:ERROR 'unknown type svirt_t' at token ';' on line 1060:

Reported-by: Guoshuai Li <ligs@dtdream.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Ansis Atteka <aatteka@ovn.org>
6 years agotests: Make packet-type-aware.at hash independent
Balazs Nemeth [Mon, 26 Feb 2018 09:10:35 +0000 (09:10 +0000)]
tests: Make packet-type-aware.at hash independent

When compiling with -msse4.2 a test case of packet-type-aware.at will
fail due to the CRC32 based hash function is different from mhash.
Fix this issue with parsing the port statistics one-by-one.

Signed-off-by: Balazs Nemeth <balazs.nemeth@ericsson.com>
CC: Jan Scheurich <jan.scheurich@ericsson.com>
CC: Zoltan Balogh <zoltan.balogh@ericsson.com>
Fixes: 00135b869d7c ("xlate: fix xport lookup for recirc")
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoRefer to database manpages in *ctl manpages
Mark Michelson [Mon, 26 Feb 2018 20:04:02 +0000 (14:04 -0600)]
Refer to database manpages in *ctl manpages

The ovn-nbctl, ovn-sbctl, and ovs-vsctl manpages are inconsistent in
their "Database Commands" section when it comes to referring to what
database tables exist. This commit amends this by making each *ctl
manpage reference the corresponding database manpage instead.

To aid in having a more handy list, the --help text of ovn-nbctl,
ovn-sbctl, and ovs-vsctl have been modified to list the available
tables. This is also referenced in the manpages for those applications.

Signed-off-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn-northd: Consistently use Datapath_Binding UUID for hashing flows.
Ben Pfaff [Fri, 23 Feb 2018 21:03:07 +0000 (13:03 -0800)]
ovn-northd: Consistently use Datapath_Binding UUID for hashing flows.

In one place, ovn-northd was hashing Logical_Switch or Logical_Router UUIDs
for ovn_lflow, and in another place it was hashing Datapath_Binding UUIDs.
This caused problems.  This commit changes ovn-northd to always hash the
Datapath_Binding UUID.

Jacob Sitnicki reported the following performance improvement for a similar
fix:

  Children      Self  Command     Shared Object        Symbol
before:
    76.19%     0.01%  ovn-northd  ovn-northd           [.] ovnnb_db_run
    11.04%     0.43%  ovn-northd  ovn-northd           [.] ovn_lflow_find
after:
    75.16%     0.05%  ovn-northd  ovn-northd           [.] ovnnb_db_run
     2.49%     0.17%  ovn-northd  ovn-northd           [.] ovn_lflow_find

Fixes: 8bf332225d4a ("ovn-northd: Reduce amount of flow hashing.")
Reported-by: Jakub Sitnicki <jkbs@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto-dpif-upcall: Fix using uninitialized fitness.
Ilya Maximets [Mon, 26 Feb 2018 08:10:11 +0000 (11:10 +0300)]
ofproto-dpif-upcall: Fix using uninitialized fitness.

'upcall_xlate()' makes a decision to compose slow path actions
by checking the 'upcall->fitness', which is not initialized in
case of calling from the 'upcall_cb()'.

'upcall_cb()' receives the real flow, so the fitness should be
initialized as perfect.

Fixes following tests on travis:

    ofproto-dpif.at: ofproto-dpif megaflow - disabled - pmd
    ofproto-dpif.at: ofproto-dpif - conntrack - output action

CC: Ben Pfaff <blp@ovn.org>
Fixes: 687bafbb8a79 ("ofproto-dpif-upcall: Slow path flows that
                      datapath can't fully match.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agovlog: fix the incorrect zero padding in format_log_message
zhangliping [Sat, 24 Feb 2018 03:30:58 +0000 (11:30 +0800)]
vlog: fix the incorrect zero padding in format_log_message

If the format specifier does not have the 0 flag, we should pad with
blanks instead of zeroes.

Signed-off-by: zhangliping <zhangliping02@baidu.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Tested-by: Mark Michelson <mmichels@redhat.com>
6 years agocmap: Fix bug in CMAP_FOR_EACH_WITH_HASH_PROTECTED.
zhangliping [Sat, 24 Feb 2018 07:34:39 +0000 (15:34 +0800)]
cmap: Fix bug in CMAP_FOR_EACH_WITH_HASH_PROTECTED.

cmap_find_locked() should be cmap_find_protected().

This does not fix a user-visible bug because this macro did not have any
users.

Signed-off-by: zhangliping <zhangliping02@baidu.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
6 years agoofproto: Make ofproto_port_open_type() faster.
Ben Pfaff [Fri, 23 Feb 2018 22:03:15 +0000 (14:03 -0800)]
ofproto: Make ofproto_port_open_type() faster.

ofproto_port_open_type() was surprisingly slow because it called the
function ofproto_class_find__(), which itself was surprisingly slow because
it actually creates a set of strings and enumerates all of the available
classes.

This patch improves performance by eliminating the call to
ofproto_class_find__() from ofproto_port_open_type().  In turn that
required changing a parameter type and updating all the callers.

Possibly it would be worth making ofproto_class_find__() itself faster,
but it doesn't look like any of its other callers would be used in inner
loops.

For more background, see also
https://mail.openvswitch.org/pipermail/ovs-discuss/2018-February/046140.html

This patch arises as a result of testing done by Ali Ginwala and Han Zhou.
Their test showed that commit 2d4beba resulted in slower performance of
ovs-vswitchd than was seen in previous versions of OVS.

With this patch, Ali retested and reported that performance drastically
improved by ~60%. The test for 10k lports, 40 LSs and 8 LRs and 1k HVs just
got completed in 3 hours 39 min vs 8+ hours for branch-2.9. Cpu utilization
graph of a farm comparing Ben's ofproto patch vs branch-2.9 is available @
https://raw.githubusercontent.com/noah8713/ovn-scale-test/scale_results/results/ovs_2.9_vs_ben_ofproto.png

Reported-by: Mark Michelson <mmichels@redhat.com>
Acked-by: Mark Michelson <mmichels@redhat.com>
Tested-by: aginwala <aginwala@asu.edu>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoselinux: allow dpdkvhostuserclient sockets with newer libvirt
Aaron Conole [Mon, 19 Feb 2018 14:55:43 +0000 (09:55 -0500)]
selinux: allow dpdkvhostuserclient sockets with newer libvirt

Newer libvirt and openstack versions will now label the unix socket as
an `svirt_tmpfs_t` object.  This means that in order to support
deploying with the recommended configuration (using a
dpdkvhostuserclient socket), additional permissions need to be
installed as part of the selinux policy.

An example of some of the AVC violations:

    type=AVC msg=audit(1518752799.102:978): avc:  denied  { write }
    for  pid=14368 comm="ovs-vswitchd" name="vhost0" dev="dm-0" ino=94
    scontext=system_u:system_r:openvswitch_t:s0
    tcontext=system_u:object_r:svirt_tmp_t:s0 tclass=sock_file

    type=AVC msg=audit(1518816172.126:1318): avc:  denied  { connectto }
    for  pid=32717 comm="ovs-vswitchd" path="/tmp/vhost0"
    scontext=system_u:system_r:openvswitch_t:s0
    tcontext=system_u:system_r:svirt_t:s0:c106,c530
    tclass=unix_stream_socket

Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Ansis Atteka <aatteka@ovn.org>
6 years agoselinux: add a new target to build the policy
Aaron Conole [Mon, 19 Feb 2018 15:14:22 +0000 (10:14 -0500)]
selinux: add a new target to build the policy

The selinux policy currently builds manually, as a process that either
the user or distribution maintainer undertakes.  That process consists
of:

  1. Convert the intermediary files into their file form through
     'make' statements at the top level.

  2. Change to the selinux directory and issue the selinux "make -f"
     directive.

This commit introduces a new target 'selinux-policy' which builds the
openvswitch-custom policy files.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Ansis Atteka <aatteka@ovn.org>
6 years agoAUTHORS: update e-mail address of Zoltan Balogh
Zoltan Balogh [Tue, 20 Feb 2018 13:04:02 +0000 (14:04 +0100)]
AUTHORS: update e-mail address of Zoltan Balogh

Signed-off-by: Zoltan Balogh <zoltan.balogh@ericsson.com>
CC: Zoltan Balogh <zoltan.balogh.eth@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoip_tunnels: Fix grammar error.
William Tu [Wed, 21 Feb 2018 22:54:01 +0000 (14:54 -0800)]
ip_tunnels: Fix grammar error.

Trivial grammar fix.

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agoofp-parse: Include missing ofp-actions.h.
Ilya Maximets [Wed, 21 Feb 2018 13:32:39 +0000 (16:32 +0300)]
ofp-parse: Include missing ofp-actions.h.

This fixes MacOS build:

  lib/ofp-parse.c:167:16:
          error: use of undeclared identifier 'IPPORT_FTP'

  lib/ofp-parse.c:171:16:
          error: use of undeclared identifier 'IPPORT_TFTP'

CC: Ben Pfaff <blp@ovn.org>
Fixes: 0d71302e36c4 ("ofp-util, ofp-parse: Break up into many separate modules.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoSet release dates for 2.9.0.
Justin Pettit [Mon, 19 Feb 2018 19:04:49 +0000 (11:04 -0800)]
Set release dates for 2.9.0.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
6 years agoodp.at: fix sed string matching typo.
William Tu [Fri, 16 Feb 2018 18:42:42 +0000 (10:42 -0800)]
odp.at: fix sed string matching typo.

Replace 'set' with 'sed'.

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn-northd: Reduce amount of flow hashing.
Ben Pfaff [Wed, 14 Feb 2018 18:14:02 +0000 (10:14 -0800)]
ovn-northd: Reduce amount of flow hashing.

Jakub Sitnicki demonstrated that repeatedly calculating row hashes is
expensive, so this should improve ovn-northd performance.

Reported-by: Jakub Sitnicki <jkbs@redhat.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2018-February/344404.html
Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Jakub Sitnicki <jkbs@redhat.com>
6 years agoovsdb-idlc: Implement synthetic columns.
Ben Pfaff [Fri, 7 Oct 2016 16:47:43 +0000 (09:47 -0700)]
ovsdb-idlc: Implement synthetic columns.

A synthetic column is one that is not present in the actual database but
instead calculated by code in the client based on columns in the row.  This
can be useful to avoid repeatedly calculating the same function of a row.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovsdb-idlc: Add infrastructure for IDL schema extensions.
Ben Pfaff [Fri, 7 Oct 2016 20:35:29 +0000 (13:35 -0700)]
ovsdb-idlc: Add infrastructure for IDL schema extensions.

An IDL schema is an OVSDB schema with some extra stuff in it.  So far, all
of the extras have been at the top level.  This commit makes it possible
for IDL schemas to have extra information at the table and column levels as
long as it is in an "extensions" member.

No extensions are actually supported yet.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovsdb-idlc: Add "cDecls" and "hDecls" IDL schema extensions.
Ben Pfaff [Wed, 7 Sep 2016 22:23:44 +0000 (15:23 -0700)]
ovsdb-idlc: Add "cDecls" and "hDecls" IDL schema extensions.

An IDL schema is an OVSDB schema with some extra stuff in it: an idlPrefix
and an idlHeader at the top level to indicate what ovsdb-idlc needs to
generate the interface definitions.  This commit adds support for two more
optional IDL schema extensions that allow extra code to be written to the
.c and .h file that ovsdb-idlc generates.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofp-meter: Fix use-after-free for decoding meter mods.
Ben Pfaff [Wed, 14 Feb 2018 22:36:47 +0000 (14:36 -0800)]
ofp-meter: Fix use-after-free for decoding meter mods.

ofputil_pull_bands() may change bands->data.

Found by libfuzzer-ngram.

Reported-by: Bhargava Shastry <bshastry@sect.tu-berlin.de>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun<pkusunyifeng@gmail.com>
6 years agoovs-ofctl: Make ofp-print able to read raw data from a file.
Ben Pfaff [Wed, 14 Feb 2018 22:40:12 +0000 (14:40 -0800)]
ovs-ofctl: Make ofp-print able to read raw data from a file.

Occasionally someone sends me raw OpenFlow data in a file and this saves
time converting it to hex.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agotravis: Update Linux kernel test list
Greg Rose [Wed, 14 Feb 2018 23:18:10 +0000 (15:18 -0800)]
travis: Update Linux kernel test list

Add newly supported 4.15 release and also update the kernel test list
to the LTS list at www.kernel.org.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agoacinclude: Enable building for Linux kernel 4.15
Greg Rose [Wed, 14 Feb 2018 23:18:09 +0000 (15:18 -0800)]
acinclude: Enable building for Linux kernel 4.15

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: Remove padding from packet before L3+ conntrack processing
Ed Swierk [Wed, 14 Feb 2018 23:18:08 +0000 (15:18 -0800)]
datapath: Remove padding from packet before L3+ conntrack processing

Upstream commit:
    commit 9382fe71c0058465e942a633869629929102843d
    Author: Ed Swierk <eswierk@skyportsystems.com>
    Date:   Wed Jan 31 18:48:02 2018 -0800

    openvswitch: Remove padding from packet before L3+ conntrack processing

    IPv4 and IPv6 packets may arrive with lower-layer padding that is not
    included in the L3 length. For example, a short IPv4 packet may have
    up to 6 bytes of padding following the IP payload when received on an
    Ethernet device with a minimum packet length of 64 bytes.

    Higher-layer processing functions in netfilter (e.g. nf_ip_checksum(),
    and help() in nf_conntrack_ftp) assume skb->len reflects the length of
    the L3 header and payload, rather than referring back to
    ip_hdr->tot_len or ipv6_hdr->payload_len, and get confused by
    lower-layer padding.

    In the normal IPv4 receive path, ip_rcv() trims the packet to
    ip_hdr->tot_len before invoking netfilter hooks. In the IPv6 receive
    path, ip6_rcv() does the same using ipv6_hdr->payload_len. Similarly
    in the br_netfilter receive path, br_validate_ipv4() and
    br_validate_ipv6() trim the packet to the L3 length before invoking
    netfilter hooks.

    Currently in the OVS conntrack receive path, ovs_ct_execute() pulls
    the skb to the L3 header but does not trim it to the L3 length before
    calling nf_conntrack_in(NF_INET_PRE_ROUTING). When
    nf_conntrack_proto_tcp encounters a packet with lower-layer padding,
    nf_ip_checksum() fails causing a "nf_ct_tcp: bad TCP checksum" log
    message. While extra zero bytes don't affect the checksum, the length
    in the IP pseudoheader does. That length is based on skb->len, and
    without trimming, it doesn't match the length the sender used when
    computing the checksum.

    In ovs_ct_execute(), trim the skb to the L3 length before higher-layer
    processing.

Signed-off-by: Ed Swierk <eswierk@skyportsystems.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Ed Swierk <eswierk@skyportsystems.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: Remove unneeded semicolons
Christopher Díaz Riveros [Wed, 14 Feb 2018 23:18:07 +0000 (15:18 -0800)]
datapath: Remove unneeded semicolons

Upstream commit:
    commit 89290b831ec1a0b233fdc7aaad84acdf4ebbf6aa
    Author: Christopher Díaz Riveros <chrisadr@gentoo.org>
    Date:   Wed Jan 17 16:10:28 2018 -0500

    flow_netlink: Remove unneeded semicolons

    Trivial fix removes unneeded semicolons after if blocks.

    This issue was detected by using the Coccinelle software.

Signed-off-by: Christopher Díaz Riveros <chrisadr@gentoo.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Christopher Díaz Riveros <chrisadr@gentoo.org>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: remove unused hardirq.h
Yang Shi [Wed, 14 Feb 2018 23:18:06 +0000 (15:18 -0800)]
datapath: remove unused hardirq.h

Upstream commit:
    commit 419091f1cc8afce943fd12af0df26201ee20c1c0
    Author: Yang Shi <yang.s@alibaba-inc.com>
    Date:   Tue Jan 9 03:52:53 2018 +0800

    net: ovs: remove unused hardirq.h

    Preempt counter APIs have been split out, currently, hardirq.h just
    includes irq_enter/exit APIs which are not used by openvswitch at all.

    So, remove the unused hardirq.h.

Signed-off-by: Yang Shi <yang.s@alibaba-inc.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: dev@openvswitch.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Yang Shi <yang.s@alibaba-inc.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Yang Shi <yang.shi@linux.alibaba.com>

6 years agodatapath: drop unneeded newline
Julia Lawall [Wed, 14 Feb 2018 23:18:05 +0000 (15:18 -0800)]
datapath: drop unneeded newline

Upstream commit:
    commit e0b10844d9e617a1a5ce2ddf73d38aaa0a47a2a4
    Author: Julia Lawall <Julia.Lawall@lip6.fr>
    Date:   Wed Dec 27 15:51:38 2017 +0100

    openvswitch: drop unneeded newline

    OVS_NLERR prints a newline at the end of the message string, so the
    message string does not need to include a newline explicitly.  Done
    using Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: Fix pop_vlan action for double tagged frames
Eric Garver [Wed, 14 Feb 2018 23:18:04 +0000 (15:18 -0800)]
datapath: Fix pop_vlan action for double tagged frames

Upstream commit:
    commit c48e74736fccf25fb32bb015426359e1c2016e3b
    Author: Eric Garver <e@erig.me>
    Date:   Wed Dec 20 15:09:22 2017 -0500

    openvswitch: Fix pop_vlan action for double tagged frames

    skb_vlan_pop() expects skb->protocol to be a valid TPID for double
    tagged frames. So set skb->protocol to the TPID and let skb_vlan_pop()
    shift the true ethertype into position for us.

Fixes: 5108bbaddc37 ("openvswitch: add processing of L3 packets")
Signed-off-by: Eric Garver <e@erig.me>
Reviewed-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Eric Garver <e@erig.me>
Fixes: a27c454ee0 ("datapath: add processing of L3 packets")
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: do not propagate headroom updates to internal port
paolo abeni [Wed, 14 Feb 2018 23:18:03 +0000 (15:18 -0800)]
datapath: do not propagate headroom updates to internal port

Upstream commit:
    commit 183dea5818315c0a172d21ecbcd2554894bf01e3
    Author: Paolo Abeni <pabeni@redhat.com>
    Date:   Thu Nov 30 15:35:33 2017 +0100

    openvswitch: do not propagate headroom updates to internal port

    After commit 3a927bc7cf9d ("ovs: propagate per dp max headroom to
    all vports") the need_headroom for the internal vport is updated
    accordingly to the max needed headroom in its datapath.

    That avoids the pskb_expand_head() costs when sending/forwarding
    packets towards tunnel devices, at least for some scenarios.

    We still require such copy when using the ovs-preferred configuration
    for vxlan tunnels:

        br_int
      /       \
    tap      vxlan
               (remote_ip:X)

    br_phy
         \
        NIC

    where the route towards the IP 'X' is via 'br_phy'.

    When forwarding traffic from the tap towards the vxlan device, we
    will call pskb_expand_head() in vxlan_build_skb() because
    br-phy->needed_headroom is equal to tun->needed_headroom.

    With this change we avoid updating the internal vport needed_headroom,
    so that in the above scenario no head copy is needed, giving 5%
    performance improvement in UDP throughput test.

    As a trade-off, packets sent from the internal port towards a tunnel
    device will now experience the head copy overhead. The rationale is
    that the latter use-case is less relevant performance-wise.

Signed-off-by: paolo abeni <pabeni@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: paolo abeni <pabeni@redhat.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agoovn-controller: Fix crash when sending GARP when openflow disconnection.
Guoshuai Li [Thu, 15 Feb 2018 10:52:29 +0000 (18:52 +0800)]
ovn-controller: Fix crash when sending GARP when openflow disconnection.

This is call stack:
Program received signal SIGABRT, Aborted.
1  0x00007ffff6a4f8e8 in __GI_abort () at abort.c:90
2  0x00000000004765d6 in ofputil_protocol_to_ofp_version (protocol=<optimized out>) at lib/ofp-util.c:769
3  0x000000000047c19e in ofputil_encode_packet_out (po=po@entry=0x7fffffffa0e0, protocol=<optimized out>) at lib/ofp-util.c:7060
4  0x0000000000410870 in send_garp (garp=0x83cfe0, current_time=current_time@entry=1200375400) at ovn/controller/pinctrl.c:1738
5  0x000000000041430f in send_garp_run (active_tunnels=<optimized out>, local_datapaths=0x7fffffffc0a0, chassis_index=<optimized out>, chassis=0x8194d0, br_int=<optimized out>, ctx=0x7fffffffc080) at ovn/controller/pinctrl.c:2069

Signed-off-by: Guoshuai Li <ligs@dtdream.com>
Acked-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto-dpif-ipfix: Fix an issue in flow key part
Benli Ye [Thu, 15 Feb 2018 01:52:07 +0000 (17:52 -0800)]
ofproto-dpif-ipfix: Fix an issue in flow key part

As struct ipfix_data_record_flow_key_iface didn't calculate
its length in flow key part, it may cause problem when flow
key part length is not enough. Use MAX_IF_LEN and MAX_IF_DESCR
to pre-allocate memory for ipfix_data_record_flow_key_iface.

Signed-off-by: Daniel Benli Ye <daniely@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovsdb-tool: Indicate "db" and "schema" are optional in man page.
Justin Pettit [Sat, 10 Feb 2018 00:03:40 +0000 (16:03 -0800)]
ovsdb-tool: Indicate "db" and "schema" are optional in man page.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoOVN: rename encode_nested_neighbor_actions in encode_nested_actions
Lorenzo Bianconi [Tue, 13 Feb 2018 14:43:50 +0000 (15:43 +0100)]
OVN: rename encode_nested_neighbor_actions in encode_nested_actions

Rename encode_nested_neighbor_actions routine in encode_nested_actions
in order to have a more general name for nested actions encoder.

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoconntrack: Support conntrack flush by ct 5-tuple
Yi-Hung Wei [Mon, 12 Feb 2018 22:02:37 +0000 (14:02 -0800)]
conntrack: Support conntrack flush by ct 5-tuple

This patch adds support of flushing a conntrack entry specified by the
conntrack 5-tuple in dpif-netdev.

Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Darrell Ball <dlu998@gmail.com>
6 years agotravis: Update kernel test list from kernel.org
Greg Rose [Wed, 7 Feb 2018 15:50:01 +0000 (07:50 -0800)]
travis: Update kernel test list from kernel.org

Also add package libelf-dev - since 4.14 it's required for making
the source.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agoacinclude.m4: Enable Linux 4.14
Greg Rose [Wed, 7 Feb 2018 15:50:00 +0000 (07:50 -0800)]
acinclude.m4: Enable Linux 4.14

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agoDocumentation: Update NEWS and faq
Pravin Shelar [Tue, 13 Feb 2018 23:52:44 +0000 (15:52 -0800)]
Documentation: Update NEWS and faq

Per the Linux 4.14 kernel support.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: meter: Use 64-bit arithmetic instead of 32-bit
Gustavo A. R. Silva [Wed, 7 Feb 2018 15:49:58 +0000 (07:49 -0800)]
datapath: meter: Use 64-bit arithmetic instead of 32-bit

Upstream commit:
    commit 5b7789e8fa8f353ad8f2c44de2385cb161b22d32
    Author: Gustavo A. R. Silva <gustavo@embeddedor.com>
    Date:   Tue Jan 30 22:55:33 2018 -0600

    Add suffix LL to constant 1000 in order to give the compiler
    complete information about the proper arithmetic to use. Notice
    that this constant is used in a context that expects an expression
    of type long long int (64 bits, signed).

    The expression (band->burst_size + band->rate) * 1000 is currently
    being evaluated using 32-bit arithmetic.

    Addresses-Coverity-ID: 1461563 ("Unintentional integer overflow")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: meter: fix NULL pointer dereference in ovs_meter_cmd_reply_start
Gustavo A. R. Silva [Wed, 7 Feb 2018 15:49:57 +0000 (07:49 -0800)]
datapath: meter: fix NULL pointer dereference in ovs_meter_cmd_reply_start

Upstream commit:
    commit b74912a2fdae9aadd20da502644aa8848c861954
    Author: Gustavo A. R. Silva <garsilva@embeddedor.com>
    Date:   Tue Nov 14 14:26:16 2017 -0600

    openvswitch: meter: fix NULL pointer dereference in ovs_meter_cmd_reply_star

    It seems that the intention of the code is to null check the value
    returned by function genlmsg_put. But the current code is null
    checking the address of the pointer that holds the value returned
    by genlmsg_put.

    Fix this by properly null checking the value returned by function
    genlmsg_put in order to avoid a pontential null pointer dereference.

    Addresses-Coverity-ID: 1461561 ("Dereference before null check")
    Addresses-Coverity-ID: 1461562 ("Dereference null return value")
Fixes: 96fbc13d7e77 ("openvswitch: Add meter infrastructure")
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: Using kfree_rcu() to simplify the code
Wei Yongjun [Wed, 7 Feb 2018 15:49:56 +0000 (07:49 -0800)]
datapath: Using kfree_rcu() to simplify the code

Upstream commit:
    commit 6dc14dc40a1d1dafd8491c349b5f3e15aabc4edb
    Author: Wei Yongjun <weiyongjun1@huawei.com>
    Date:   Tue Nov 14 06:27:12 2017 +0000

    openvswitch: Using kfree_rcu() to simplify the code

    The callback function of call_rcu() just calls a kfree(), so we
    can use kfree_rcu() instead of call_rcu() + callback function.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: Fix return value check in ovs_meter_cmd_features()
Wei Yongjun [Wed, 7 Feb 2018 15:49:55 +0000 (07:49 -0800)]
datapath: Fix return value check in ovs_meter_cmd_features()

Upstream commit:
    commit 8a860c2bcc84a8e4fbcabb928cd97e4c51b17d93
    Author: Wei Yongjun <weiyongjun1@huawei.com>
    Date:   Tue Nov 14 06:20:16 2017 +0000

    openvswitch: Fix return value check in ovs_meter_cmd_features()

    In case of error, the function ovs_meter_cmd_reply_start() returns
    ERR_PTR() not NULL. The NULL test in the return value check should
    be replaced with IS_ERR().

Fixes: 96fbc13d7e77 ("openvswitch: Add meter infrastructure")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: Add meter infrastructure
Andy Zhou [Tue, 13 Feb 2018 23:48:24 +0000 (15:48 -0800)]
datapath: Add meter infrastructure

Upstream commit:
    commit 96fbc13d7e770b542d2d1fcf700d0baadc6e8063
    Author: Andy Zhou <azhou@ovn.org>
    Date:   Fri Nov 10 12:09:42 2017 -0800

    openvswitch: Add meter infrastructure

    OVS kernel datapath so far does not support Openflow meter action.
    This is the first stab at adding kernel datapath meter support.
    This implementation supports only drop band type.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Added a compat layer fixup for nla_parse.
Added another compat fixup for ktime_get_ns.

Cc: Andy Zhou <azhou@ovn.org>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: Add meter netlink definitions
Andy Zhou [Wed, 7 Feb 2018 15:49:53 +0000 (07:49 -0800)]
datapath: Add meter netlink definitions

Upstream commit:
    commit 5794040647de4011598a6d005fdad95d24fd385b
    Author: Andy Zhou <azhou@ovn.org>
    Date:   Fri Nov 10 12:09:40 2017 -0800

    openvswitch: Add meter netlink definitions

    Meter has its own netlink family. Define netlink messages and attributes
    for communicating with the user space programs.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Andy Zhou <azhou@ovn.org>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: reliable interface indentification in port dumps
Jiri Benc [Wed, 7 Feb 2018 15:49:52 +0000 (07:49 -0800)]
datapath: reliable interface indentification in port dumps

Upstream commit:
    commit 9354d452034273a50a4fd703bea31e5d6b1fc20b
    Author: Jiri Benc <jbenc@redhat.com>
    Date:   Thu Nov 2 17:04:37 2017 -0200

    openvswitch: reliable interface indentification in port dumps

    This patch allows reliable identification of netdevice interfaces connected
    to openvswitch bridges. In particular, user space queries the netdev
    interfaces belonging to the ports for statistics, up/down state, etc.
    Datapath dump needs to provide enough information for the user space to be
    able to do that.

    Currently, only interface names are returned. This is not sufficient, as
    openvswitch allows its ports to be in different name spaces and the
    interface name is valid only in its name space. What is needed and generally
    used in other netlink APIs, is the pair ifindex+netnsid.

    The solution is addition of the ifindex+netnsid pair (or only ifindex if in
    the same name space) to vport get/dump operation.

    On request side, ideally the ifindex+netnsid pair could be used to
    get/set/del the corresponding vport. This is not implemented by this patch
    and can be added later if needed.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Added compat fixup for peernet2id.

Cc: Jiri Benc <jbenc@redhat.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: export get_dp() API
Andy Zhou [Wed, 7 Feb 2018 15:49:51 +0000 (07:49 -0800)]
datapath: export get_dp() API

Upstream commit:
    commit 9602c01e57f7b868d748c2ba2aef0efa64b71ffc
    Author: Andy Zhou <azhou@ovn.org>
    Date:   Fri Nov 10 12:09:41 2017 -0800

    openvswitch: export get_dp() API.

    Later patches will invoke get_dp() outside of datapath.c. Export it.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Andy Zhou <azhou@ovn.org>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agoofp-flow: Fix return value for ofputil_decode_flow_stats_reply().
Ben Pfaff [Mon, 12 Feb 2018 17:57:14 +0000 (09:57 -0800)]
ofp-flow: Fix return value for ofputil_decode_flow_stats_reply().

This function returned errno values for some errors and OFPERR_* values
for others.  The callers all expected OFPERR_* values.  This fixes the
problem.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agoopenflow: Update list of features.
Ben Pfaff [Thu, 8 Feb 2018 22:56:02 +0000 (14:56 -0800)]
openflow: Update list of features.

Bundles are implemented for both OF1.3 and OF1.4+, so no need to keep it
in the list.  Packet type aware pipeline is now implemented too.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: William Tu <u9012063@gmail.com>
6 years agoofp-errors: Add remaining OF1.4 and OF1.5 errors.
Ben Pfaff [Thu, 8 Feb 2018 22:58:17 +0000 (14:58 -0800)]
ofp-errors: Add remaining OF1.4 and OF1.5 errors.

Also implements the backports of relevant errors to OF1.3 as specified in
ONF extension pack 1 for OF1.3.

ONF-JIRA: EXT-237
ONF-JIRA: EXT-230
ONF-JIRA: EXT-264
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: William Tu <u9012063@gmail.com>
6 years agoextract-ofp-errors: Minor improvements.
Ben Pfaff [Thu, 8 Feb 2018 22:54:09 +0000 (14:54 -0800)]
extract-ofp-errors: Minor improvements.

This removes the requirement of exactly two spaces before the error
description (now one or more is fine).  It also makes an error message
clearer.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: William Tu <u9012063@gmail.com>
6 years agoImplement OF1.3 extension for OF1.4 role status feature.
Ben Pfaff [Thu, 8 Feb 2018 21:25:39 +0000 (13:25 -0800)]
Implement OF1.3 extension for OF1.4 role status feature.

ONF extension pack 1 for OpenFlow 1.3 defines how to implement the OpenFlow
1.4 "role status" message in OpenFlow 1.3.  This commit implements that
feature.

ONF-JIRA: EXT-191
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: William Tu <u9012063@gmail.com>
6 years agoofp-util, ofp-parse: Break up into many separate modules.
Ben Pfaff [Fri, 9 Feb 2018 18:04:26 +0000 (10:04 -0800)]
ofp-util, ofp-parse: Break up into many separate modules.

ofp-util had been far too large and monolithic for a long time.  This
commit breaks it up into units that make some logical sense.  It also
moves the pieces of ofp-parse that were specific to each unit into the
relevant unit.

Most of this commit is just moving code around.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agoofp-util: Remove prototypes for unimplemented functions.
Ben Pfaff [Fri, 9 Feb 2018 18:30:46 +0000 (10:30 -0800)]
ofp-util: Remove prototypes for unimplemented functions.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agodocs: Update supported DPDK versions.
Ian Stokes [Mon, 29 Jan 2018 17:17:56 +0000 (17:17 +0000)]
docs: Update supported DPDK versions.

Update the OVS to DPDK release table to use the latest stable
DPDK 16.11.4 for OVS 2.7.

Signed-off-by: Ian Stokes <ian.stokes@intel.com>
Acked-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
6 years agopoc: Introduce Proof of Concepts (Package building)
Ansis Atteka [Tue, 16 Jan 2018 00:18:30 +0000 (16:18 -0800)]
poc: Introduce Proof of Concepts (Package building)

This patch sets up foundations for Proof of Concepts that
simply materialize documentation into Ansible instructions
executed in virtualized Vagrant environment.

This Proof of Concept allows to easily build:
1. *.deb packages on Ubuntu 16.04; AND
2. *.rpm packages on CentOS 7.4.
It also sets up DEB and RPM repository over HTTP that can
be used to pull these openvswitch packages with apt-get
or yum from another host.

This particular Proof of Concept is intended to address
following use-cases:
1. for new OVS users to see how debian and rpm packages are
   built;
2. for developers to easily check for packaging build
   regressions;
3. for developers to easily share their sandbox builds
   into QE setups (opposed to manually copying binaries);
4. for developers to add other Proof of Concepts
   that possibly may require full end-to-end integration
   with other thirdparty projects (e.g. DPI, libvirt, IPsec)
   and need Open vSwitch packages.

Tested-by: Greg Rose <gvrose8192@gmail.com>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Ansis Atteka <aatteka@ovn.org>
6 years agodatapath: use ktime_get_ts64() instead of ktime_get_ts()
Arnd Bergmann [Wed, 7 Feb 2018 15:30:10 +0000 (07:30 -0800)]
datapath: use ktime_get_ts64() instead of ktime_get_ts()

Upstream commit:
    commit 311af51dcb5629f04976a8e451673f77e3301041
    Author: Arnd Bergmann <arnd@arndb.de>
    Date:   Mon Nov 27 12:41:38 2017 +0100

    openvswitch: use ktime_get_ts64() instead of ktime_get_ts()

    timespec is deprecated because of the y2038 overflow, so let's convert
    this one to ktime_get_ts64(). The code is already safe even on 32-bit
    architectures, since it uses monotonic times. On 64-bit architectures,
    nothing changes, while on 32-bit architectures this avoids one
    type conversion.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Additional compatability check for ktime_get_ts64() exists or not.
If not, then just continue using ktime_get_ts(). I added a new
compatability header file "timekeeping.h".

Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: fix the incorrect flow action alloc size
zhangliping [Wed, 7 Feb 2018 15:30:09 +0000 (07:30 -0800)]
datapath: fix the incorrect flow action alloc size

Upstream commit:
    commit 67c8d22a73128ff910e2287567132530abcf5b71
    Author: zhangliping <zhangliping02@baidu.com>
    Date:   Sat Nov 25 22:02:12 2017 +0800

    openvswitch: fix the incorrect flow action alloc size

    If we want to add a datapath flow, which has more than 500 vxlan outputs'
    action, we will get the following error reports:
      openvswitch: netlink: Flow action size 32832 bytes exceeds max
      openvswitch: netlink: Flow action size 32832 bytes exceeds max
      openvswitch: netlink: Actions may not be safe on all matching packets
      ... ...

    It seems that we can simply enlarge the MAX_ACTIONS_BUFSIZE to fix it, but
    this is not the root cause. For example, for a vxlan output action, we need
    about 60 bytes for the nlattr, but after it is converted to the flow
    action, it only occupies 24 bytes. This means that we can still support
    more than 1000 vxlan output actions for a single datapath flow under the
    the current 32k max limitation.

    So even if the nla_len(attr) is larger than MAX_ACTIONS_BUFSIZE, we
    shouldn't report EINVAL and keep it move on, as the judgement can be
    done by the reserve_sfa_size.

Signed-off-by: zhangliping <zhangliping02@baidu.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: zhangliping <zhangliping02@baidu.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: fix data type in queue_gso_packets
Gustavo A. R. Silva [Wed, 7 Feb 2018 15:30:08 +0000 (07:30 -0800)]
datapath: fix data type in queue_gso_packets

Upstream commit:
    commit 2734166e89639c973c6e125ac8bcfc2d9db72b70
    Author: Gustavo A. R. Silva <garsilva@embeddedor.com>
    Date:   Sat Nov 25 13:14:40 2017 -0600

    net: openvswitch: datapath: fix data type in queue_gso_packets

    gso_type is being used in binary AND operations together with SKB_GSO_UDP.
    The issue is that variable gso_type is of type unsigned short and
    SKB_GSO_UDP expands to more than 16 bits:

    SKB_GSO_UDP = 1 << 16

    this makes any binary AND operation between gso_type and SKB_GSO_UDP to
    be always zero, hence making some code unreachable and likely causing
    undesired behavior.

    Fix this by changing the data type of variable gso_type to unsigned int.

    Addresses-Coverity-ID: 1462223
Fixes: 0c19f846d582 ("net: accept UFO datagrams from tuntap and packet")
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
While backporting this I found another couple of instances of the
same issue so I fixed them up as well.

Cc: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: Fix an error handling path in 'ovs_nla_init_match_and_action()
Christophe JAILLET [Wed, 7 Feb 2018 15:30:07 +0000 (07:30 -0800)]
datapath: Fix an error handling path in 'ovs_nla_init_match_and_action()

Upstream commit:
commit 5829e62ac17a40ab08c1b905565604a4b5fa7af6
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Mon Sep 11 21:56:20 2017 +0200

    openvswitch: Fix an error handling path in 'ovs_nla_init_match_and_action()'

    All other error handling paths in this function go through the 'error'
    label. This one should do the same.

Fixes: 9cc9a5cb176c ("datapath: Avoid using stack larger than 1024.")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Fixes: 850c2a4d1a ("datapath: Avoid using stack larger than 1024.")
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agocompat: Fix compiler headers
Greg Rose [Wed, 7 Feb 2018 15:30:06 +0000 (07:30 -0800)]
compat: Fix compiler headers

Since Linux kernel upstream commit d15155824c50
("linux/compiler.h: Split into compiler.h and compiler_types.h") this
error check for the gcc compiler header is no longer valid.  Remove
so that openvswitch builds for linux kernels 4.14.8 and since.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: Fix SKB_GSO_UDP usage
Greg Rose [Wed, 7 Feb 2018 15:30:05 +0000 (07:30 -0800)]
datapath: Fix SKB_GSO_UDP usage

Using SKB_GSO_UDP breaks the compilation on Linux 4.14. Check for
the HAVE_SKB_GSO_UDP compiler #define.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: conntrack: make protocol tracker pointers const
Florian Westphal [Wed, 7 Feb 2018 15:30:04 +0000 (07:30 -0800)]
datapath: conntrack: make protocol tracker pointers const

Upstream commit:
    commit b3480fe059ac9121b5714205b4ddae14b59ef4be
    Author: Florian Westphal <fw@strlen.de>
    Date:   Sat Aug 12 00:57:08 2017 +0200

    netfilter: conntrack: make protocol tracker pointers const

    Doesn't change generated code, but will make it easier to eventually
    make the actual trackers themselvers const.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Florian Westphal <fw@strlen.de>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agocompat:inet_frag.h: Check for frag_percpu_counter_batch
Greg Rose [Wed, 7 Feb 2018 15:30:03 +0000 (07:30 -0800)]
compat:inet_frag.h: Check for frag_percpu_counter_batch

Fix up the compat layer to check for frag_percpu_counter_batch and
if not present then use atomic_sub and atomic_add as per the
backport in the 3.16.50 LTS kernel.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agocompat: Do not include headers when not compiling
Greg Rose [Wed, 7 Feb 2018 15:30:02 +0000 (07:30 -0800)]
compat: Do not include headers when not compiling

If the entire file is not going to be compiled because OVS is using
upstream tunnel support then also don't bother pulling in the headers.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agodatapath: Fix netdev_master_upper_dev_link for 4.14
Greg Rose [Wed, 7 Feb 2018 15:30:01 +0000 (07:30 -0800)]
datapath: Fix netdev_master_upper_dev_link for 4.14

An extended netlink ack has been added for 4.14 - add compat layer
changes so that it compiles for all kernels up to and including
4.14.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
6 years agotests: Don't include a newline in ovs_fatal() calls.
Justin Pettit [Sat, 10 Feb 2018 01:02:09 +0000 (17:02 -0800)]
tests: Don't include a newline in ovs_fatal() calls.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoovn: Allow DNS lookups over IPv6
Mark Michelson [Fri, 9 Feb 2018 15:11:00 +0000 (09:11 -0600)]
ovn: Allow DNS lookups over IPv6

There was a bug in DNS request handling where the incoming packet was
assumed to be IPv4.

The result was that for the outgoing packet, we would attempt to write
the IPv4 checksum and total length into what was actually an IPv6
header. This resulted in the source IPv6 address getting corrupted.
Later, the source and destination IPv6 addresses would get swapped,
resulting in the DNS response being sent to a nonsense destination.

With this change, we check the ethertype of the packet to determine what
l3 information to write, and where to write it. A test is also included
that verifies that this works as expected.

Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1539608
Signed-off-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodatapath: enable NSH support
Yi Yang [Wed, 31 Jan 2018 13:53:06 +0000 (21:53 +0800)]
datapath: enable NSH support

Upstream commit:
  commit b2d0f5d5dc53532e6f07bc546a476a55ebdfe0f3
  Author: Yi Yang <yi.y.yang@intel.com>
  Date:   Tue Nov 7 21:07:02 2017 +0800

    openvswitch: enable NSH support

    OVS master and 2.8 branch has merged NSH userspace
    patch series, this patch is to enable NSH support
    in kernel data path in order that OVS can support
    NSH in compat mode by porting this.

Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Acked-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Eric Garver <e@erig.me>
Acked-by: Pravin Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agodatapath: nsh: add GSO support
Yi Yang [Wed, 31 Jan 2018 13:53:05 +0000 (21:53 +0800)]
datapath: nsh: add GSO support

Upstream commit:
  commit c411ed854584a71b0e86ac3019b60e4789d88086
  Author: Jiri Benc <jbenc@redhat.com>
  Date:   Mon Aug 28 21:43:24 2017 +0200

    nsh: add GSO support

    Add a new nsh/ directory. It currently holds only GSO functions but more
    will come: in particular, code shared by openvswitch and tc to manipulate
    NSH headers.

    For now, assume there's no hardware support for NSH segmentation. We can
    always introduce netdev->nsh_features later.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agodatapath: net: add NSH header structures and helpers
Yi Yang [Wed, 31 Jan 2018 13:53:04 +0000 (21:53 +0800)]
datapath: net: add NSH header structures and helpers

Upstream commit:
  commit 1f0b7744c50573df464ca33d8e5275be509f852b
  Author: Yi Yang <yi.y.yang@intel.com>
  Date:   Mon Aug 28 21:43:23 2017 +0200

    net: add NSH header structures and helpers

    NSH (Network Service Header)[1] is a new protocol for service
    function chaining, it can be handled as a L3 protocol like
    IPv4 and IPv6, Eth + NSH + Inner packet or VxLAN-gpe + NSH +
    Inner packet are two typical use cases.

    This patch adds NSH header structures and helpers for NSH GSO
    support and Open vSwitch NSH support.

    [1] https://datatracker.ietf.org/doc/draft-ietf-sfc-nsh/

    [Jiri: added nsh_hdr() helper and renamed the header struct to "struct
    nshhdr" to match the usual pattern. Removed packet type defines, these are
    now shared with VXLAN-GPE.]

Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agodatapath: vxlan: factor out VXLAN-GPE next protocol
Yi Yang [Wed, 31 Jan 2018 13:53:03 +0000 (21:53 +0800)]
datapath: vxlan: factor out VXLAN-GPE next protocol

Upstream commit:
  commit fa20e0e32cb3dfc1760b6254b64977f2fb5bd851
  Author: Jiri Benc <jbenc@redhat.com>
  Date:   Mon Aug 28 21:43:22 2017 +0200

    vxlan: factor out VXLAN-GPE next protocol

    The values are shared between VXLAN-GPE and NSH. Originally probably by
    coincidence but I notified both working groups about this last year and they
    seem to keep the values in sync since then.

    Hopefully they'll get a single IANA registry for the values, too. (I asked
    them for that.)

    Factor out the code to be shared by the NSH implementation.

    NSH and MPLS values are added in this patch, too. For MPLS, the drafts
    incorrectly assign only a single value, while we have two MPLS ethertypes.
    I raised the problem with both groups. For now, I assume the value is for
    unicast.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agodatapath: ether: add NSH ethertype
Yi Yang [Wed, 31 Jan 2018 13:53:02 +0000 (21:53 +0800)]
datapath: ether: add NSH ethertype

Upstream commit:
  commit 155e6f649757c902901e599c268f8b575ddac1f8
  Author: Jiri Benc <jbenc@redhat.com>
  Date:   Mon Aug 28 21:43:21 2017 +0200

    ether: add NSH ethertype

    The NSH draft says:

       An IEEE EtherType, 0x894F, has been allocated for NSH.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agoexpr: Add additional invariant check in test.
Ben Pfaff [Tue, 6 Feb 2018 18:00:49 +0000 (10:00 -0800)]
expr: Add additional invariant check in test.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Numan Siddique <nusiddiq@redhat.com>
6 years agoexpr: Make expr_sort() always yield an expr that satisfies invariants.
Ben Pfaff [Tue, 6 Feb 2018 18:00:48 +0000 (10:00 -0800)]
expr: Make expr_sort() always yield an expr that satisfies invariants.

Expressions of type EXPR_T_AND are supposed to follow an invariant that
they have at least 2 clauses, but expr_sort() did not always follow that;
for example, applying it to (x[0] == 1 && x[1] == 1) yielded the 1-child
EXPR_T_AND expression x[0..1] == 3.  This commit fixes the problem.

I don't know of any externally visible negative consequences for this
problem, but it made the code harder to reason about.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Numan Siddique <nusiddiq@redhat.com>
6 years agoexpr: Fix some bad naming.
Ben Pfaff [Tue, 6 Feb 2018 18:00:47 +0000 (10:00 -0800)]
expr: Fix some bad naming.

expr_is_cmp() was badly named because it didn't just check for whether its
argument was an EXPR_T_CMP node.

struct expr_sort's 'relop' member was badly named because it wasn't a
relational operator, it was a symbol.

This commit improves both names.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Numan Siddique <nusiddiq@redhat.com>
6 years agoovs-vsctl: Add commands "add-bond-iface" and "del-bond-iface".
Ben Pfaff [Fri, 2 Feb 2018 21:49:37 +0000 (13:49 -0800)]
ovs-vsctl: Add commands "add-bond-iface" and "del-bond-iface".

It was not too hard to build these commands using the database commands,
but a few people have asked for them over the years, so here they are.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Yifeng Sun <pkusunyifeng@gmail.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agoNEWS: Consolidate ovs-vswitchd sections and fix indentation.
Ben Pfaff [Fri, 2 Feb 2018 21:46:55 +0000 (13:46 -0800)]
NEWS: Consolidate ovs-vswitchd sections and fix indentation.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Yifeng Sun <pkusunyifeng@gmail.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agoovs-vsctl: Use default socket name in tests.
Ben Pfaff [Fri, 2 Feb 2018 21:09:03 +0000 (13:09 -0800)]
ovs-vsctl: Use default socket name in tests.

By using the default socket name "db.sock", instead of "socket", we can
avoid passing --db=unix:socket to all the ovs-vsctl invocations, which is
kind of nice.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Yifeng Sun <pkusunyifeng@gmail.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agoovs-vsctl: Remove superfluous OVS_VSCTL_CLEANUP from tests.
Ben Pfaff [Fri, 2 Feb 2018 18:23:37 +0000 (10:23 -0800)]
ovs-vsctl: Remove superfluous OVS_VSCTL_CLEANUP from tests.

Since on_exit was introduced a long, long time ago, it has no longer been
necessary to have individual calls to OVS_VSCTL_CLEANUP sprinkled
everywhere in the test code.  This change makes the tests easier to read.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Yifeng Sun <pkusunyifeng@gmail.com>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agoovsdb-client: Add --timeout option.
Ben Pfaff [Thu, 28 Dec 2017 16:58:05 +0000 (08:58 -0800)]
ovsdb-client: Add --timeout option.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Acked-by: Justin Pettit <jpettit@ovn.org>
6 years agojson: Make it safe to pass null pointers to json_equal().
Ben Pfaff [Sun, 31 Dec 2017 01:02:22 +0000 (17:02 -0800)]
json: Make it safe to pass null pointers to json_equal().

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Acked-by: Justin Pettit <jpettit@ovn.org>
6 years agojsonrpc: Add comment for jsonrpc_msg_to_json().
Ben Pfaff [Fri, 29 Dec 2017 13:44:35 +0000 (05:44 -0800)]
jsonrpc: Add comment for jsonrpc_msg_to_json().

From a glance at the prototype it wasn't obvious that it destroyed its
argument.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoodp-util: Always report ODP_FIT_TOO_LITTLE for IGMP.
Ben Pfaff [Wed, 24 Jan 2018 19:40:20 +0000 (11:40 -0800)]
odp-util: Always report ODP_FIT_TOO_LITTLE for IGMP.

OVS datapaths don't understand or parse IGMP fields, but OVS userspace
does, so this commit updates odp_flow_key_to_flow() to report that properly
to the caller.

Reported-by: Huanle Han <hanxueluo@gmail.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2018-January/343665.html
Signed-off-by: Ben Pfaff <blp@ovn.org>