]> git.proxmox.com Git - mirror_ovs.git/log
mirror_ovs.git
6 years agodpctl: add CT Stats for Connections per protocol.
Antonio Fischetti [Fri, 23 Jun 2017 12:28:21 +0000 (13:28 +0100)]
dpctl: add CT Stats for Connections per protocol.

Adds CT stats to report number of connections grouped by
protocol.
By using
 utilities/ovs-appctl dpctl/ct-stats-show
it can display something like:
Connections Stats:
    Total: 1808
        TCP: 1808

With the verbose options:
 utilities/ovs-appctl dpctl/ct-stats-show verbose
it can display:
Connections Stats:
    Total: 2671
        TCP: 2671
          Conn per TCP states:
          [ESTABLISHED]=1000
          [CLOSING]=1
          [TIME_WAIT]=1670

Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>
Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Co-authored-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoFix coding style and some typos.
Antonio Fischetti [Fri, 23 Jun 2017 12:28:20 +0000 (13:28 +0100)]
Fix coding style and some typos.

Fixes some lines exceeding 80 chars and a couple of typos.

Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodatapath-windows: allow catalog creation with local time on WDK 10
Alin Serdean [Tue, 20 Jun 2017 21:33:11 +0000 (21:33 +0000)]
datapath-windows: allow catalog creation with local time on WDK 10

When compiling with WDK10 we are using server time when creating the catalog
file.

This patch enables the use of local time.

For reference:
https://github.com/cloudbase/ovs/commit/6b3706dc9afb26c3e39985d44a99bc9251bcf792

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agotests: use full option name in bridge tests
Lance Richardson [Mon, 10 Jul 2017 17:57:13 +0000 (13:57 -0400)]
tests: use full option name in bridge tests

GNU getopt_long() accepts abbreviated long option names that are
unambiguous, but other implemenations (notably musl libc) do not.

Avoid issues with non-GNU implementations by using the full option
name.

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agopackets: Fix the reset dp_packet buffer issue in packet_put_ra_prefix_opt
Numan Siddique [Thu, 15 Jun 2017 08:38:15 +0000 (14:08 +0530)]
packets: Fix the reset dp_packet buffer issue in packet_put_ra_prefix_opt

packet_put_ra_prefix_opt() resets the dp_packet buffer incorrectly.

Fixes: b24ab67c2dfd ("packets: add compose_nd_ra")
Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto-dpif: Fix the clone issue with continuation
Numan Siddique [Thu, 15 Jun 2017 08:37:59 +0000 (14:07 +0530)]
ofproto-dpif: Fix the clone issue with continuation

When the clone action is composed and if the inner clone actions
modifies any of the metadata fields, the updated values are not
preserved when xlate_clone() returns. This causes the controller
to receive invalid metadata if the cloned packet has a 'controller'
action with the 'pause' flag set. When the controller resumes the
packet the resumed packet will not continue properly.

This patch addresses this issue.

The issue can be reproduced running the test case added in this
patch without the fix.

Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agomake logs not readable by other
Timothy Redaelli [Mon, 19 Jun 2017 14:50:21 +0000 (16:50 +0200)]
make logs not readable by other

The Open vSwitch log directory and files are currently set world readable.

However, since only Open vSwitch users and processes need to access this
directory and these files there is no need to allow the world to access them,
since it can result in the exposure of sensitive information.

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodatapath-windows: Add validations in fragmentation module
Anand Kumar [Sat, 10 Jun 2017 02:54:45 +0000 (19:54 -0700)]
datapath-windows: Add validations in fragmentation module

- Minimum valid fragment size is 400 bytes, any fragment smaller
is likely to be intentionally crafted (CVE-2000-0305).

- Validate maximum length of an Ip datagram

- Added counters to keep track of number of fragments for a given
Ip datagram.

Signed-off-by: Anand Kumar <kumaranand@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
6 years agotreewide: .gitignore updates
Lance Richardson [Fri, 30 Jun 2017 14:28:03 +0000 (10:28 -0400)]
treewide: .gitignore updates

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Justin Pettit <jpettit@ovn.org>
6 years agoovn-controller: decouple localnet_port update from patch_run
Han Zhou [Wed, 7 Jun 2017 16:32:45 +0000 (09:32 -0700)]
ovn-controller: decouple localnet_port update from patch_run

We figure out local datapaths in binding_run() but update the field
localnet_port for each local datapath that has localnet port in
patch_run(). This patch updates the localnet_port field in binding_run
directly and removes the logic in patch_run(), since the logic is
more about port-binding processing, and patch_run() is focusing on
patch port creation only.

In a future patch binding_run() will be used in a new thread for
pinctrl, but patch_run() will not.

Signed-off-by: Han Zhou <zhouhan@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoAUTHORS: Add zhongbaisong.
Ben Pfaff [Fri, 7 Jul 2017 18:13:08 +0000 (11:13 -0700)]
AUTHORS: Add zhongbaisong.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofp-util: fix memory leak in ofputil_pull_ofp11_buckets
zhongbaisong [Wed, 28 Jun 2017 09:14:41 +0000 (17:14 +0800)]
ofp-util: fix memory leak in ofputil_pull_ofp11_buckets

Signed-off-by: zhongbaisong <zhongbaisong@huawei.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoconfigure: Fix check for rte_config.h to handle cross-compilation.
Ben Pfaff [Fri, 7 Jul 2017 16:16:27 +0000 (09:16 -0700)]
configure: Fix check for rte_config.h to handle cross-compilation.

The check for rte_config.h in acinclude.m4 used AC_CHECK_FILE, but this
macro is intended to check for a file on the host system, not the build
system, which means that it fails unconditionally in a cross-compilation
environment.  However, the intended check here is for a header file,
which is part of the build system.  To check for part of the build system,
we can just use "test", so this commit makes that change.

Reported-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-March/329994.html
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Darrell Ball <dlu998@gmail.com>
6 years agoofp-util: Check length of buckets in ofputil_pull_ofp15_group_mod().
Ben Pfaff [Fri, 26 May 2017 19:59:06 +0000 (12:59 -0700)]
ofp-util: Check length of buckets in ofputil_pull_ofp15_group_mod().

This code blindly read forward for the number of bytes specified by the
message without checking that it was in range.

This bug is part of OpenFlow 1.5 support.  Open vSwitch does not enable
OpenFlow 1.5 support by default.

Reported-by: Bhargava Shastry <bshastry@sec.t-labs.tu-berlin.de>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
6 years agoofp-print: Don't abort on unknown reason in role status message.
Ben Pfaff [Fri, 26 May 2017 20:22:26 +0000 (13:22 -0700)]
ofp-print: Don't abort on unknown reason in role status message.

A buggy or malicious switch could send a role status message with a bad
reason code, which if printed by OVS would cause it to abort.  This fixes
the problem.

Reported-by: Bhargava Shastry <bshastry@sec.t-labs.tu-berlin.de>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
6 years agoMakefiles: Fail build for flake8 only when configured with --enable-Werror.
Ben Pfaff [Thu, 6 Jul 2017 22:12:00 +0000 (15:12 -0700)]
Makefiles: Fail build for flake8 only when configured with --enable-Werror.

flake8 checking is useful.  Until now, it always failed the build for any
flake8 errors.  This is too aggressive, for the same reason that always
failing the build for any compiler warnings is too aggressive: compilers
change over time and asynchronously from OVS itself.  Thus, if we release
some version of OVS today, even if it's flake8-clean today, it might not
be flake8-clean tomorrow, even with the same settings.  We don't want to
have to track flake8 warnings on every release branch.

Thus, this adopts the same policy for compiler warnings: always report
them, but only fail the build if --enable-Werror was configured.  Usually
just developers use that configure option, and they're prepared to deal
with the fallout.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
6 years agoAUTHORS: Add Clint Byrum.
Ben Pfaff [Fri, 7 Jul 2017 15:58:30 +0000 (08:58 -0700)]
AUTHORS: Add Clint Byrum.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodebian: Use debhelper for DEB_UPSTREAM_VERSION
Clint Byrum [Thu, 6 Jul 2017 20:23:11 +0000 (13:23 -0700)]
debian: Use debhelper for DEB_UPSTREAM_VERSION

debhelper provides helpers to get parts of the version number, including
this part which was until now figured out in an open-coded way.

Signed-off-by: Clint Byrum <clint@fewbar.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodpif-netdev: Change definitions of 'idle' & 'processing' cycles
Ciara Loftus [Mon, 20 Feb 2017 12:53:00 +0000 (12:53 +0000)]
dpif-netdev: Change definitions of 'idle' & 'processing' cycles

Instead of counting all polling cycles as processing cycles, only count
the cycles where packets were received from the polling.

Signed-off-by: Georg Schmuecking <georg.schmuecking@ericsson.com>
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Co-authored-by: Georg Schmuecking <georg.schmuecking@ericsson.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Ian Stokes <ian.stokes@intel.com>
Tested-by: Ian Stokes <ian.stokes@intel.com>
Acked-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoAUTHORS: Add Jason Wessel.
Ben Pfaff [Thu, 6 Jul 2017 21:01:27 +0000 (14:01 -0700)]
AUTHORS: Add Jason Wessel.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoPython3 compatibility: unicode to str
Jason Wessel [Fri, 30 Jun 2017 03:33:23 +0000 (20:33 -0700)]
Python3 compatibility: unicode to str

When transitioning from python2 to python3 the following type class
changes occured:

python2 -> python3
unicode -> str
str -> bytes

That means we have to check the python version and do the right type
check python3 will throw an error when it tries to use the unicode
type because it doesn't exist.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoPython3 compatibility: math error compatibility
Jason Wessel [Fri, 30 Jun 2017 03:33:23 +0000 (20:33 -0700)]
Python3 compatibility: math error compatibility

The way math is handled with typing is completely different in python3.

% python2<<EOF
x=10
y=8
print((x + (y - 1)) / y * y)
EOF
16

python3<<EOF
x=10
y=8
print((x + (y - 1)) / y * y)
EOF
17.0

So we need to force an integer for the round function as follows and
maintain compatibility with python2.

python3<<EOF
x=10
y=8
print(int((x + (y - 1)) / y) * y)
EOF
16

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoPython3 compatibility: fix integer problems
Jason Wessel [Fri, 30 Jun 2017 03:33:23 +0000 (20:33 -0700)]
Python3 compatibility: fix integer problems

In python3 maxint is not defined, but maxsize is defined in both
python2 and python3.

The put_text() will not automatically use a value which came in as
float due to a pior math function and python3 will throw an exception.
The simple answer is to convert it with int() and move on.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoPython3 compatibility: iteritems to items
Jason Wessel [Fri, 30 Jun 2017 03:33:23 +0000 (20:33 -0700)]
Python3 compatibility: iteritems to items

Allow compability with python3 and python2 by changing iteritems() to
items().

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoPython3 compatibility: execfile to exec
Jason Wessel [Fri, 30 Jun 2017 03:33:23 +0000 (20:33 -0700)]
Python3 compatibility: execfile to exec

Allow compability with python3 and python2 by changing execfile() to
exec().

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoPython3 compatibility: exception cleanup
Jason Wessel [Fri, 30 Jun 2017 03:33:23 +0000 (20:33 -0700)]
Python3 compatibility: exception cleanup

The exception syntax which is compatible with python2 and python3 is
to use the "as" form for "except:".

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoPython3 compatibility: Convert print statements
Jason Wessel [Fri, 30 Jun 2017 03:33:23 +0000 (20:33 -0700)]
Python3 compatibility: Convert print statements

This patch fixes up all the print statements to work with python3 or
python2.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodocs: Use DPDK 16.11.2 stable release.
Ian Stokes [Tue, 20 Jun 2017 12:57:03 +0000 (13:57 +0100)]
docs: Use DPDK 16.11.2 stable release.

Modify docs and travis linux build script to use the DPDK 16.11.2 stable
branch to benefit from most recent bug fixes.

Signed-off-by: Ian Stokes <ian.stokes@intel.com>
Acked-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Acked-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Justin Pettit <jpettit@ovn.org>
6 years agoFix nonstandard isatty on Windows
Alin Serdean [Tue, 20 Jun 2017 16:31:12 +0000 (16:31 +0000)]
Fix nonstandard isatty on Windows

A lot of tests are failing, due to the open flow ports being outputted using
names instead of numbers.
i.e.: http://64.119.130.115/ovs/beb75a40fdc295bfd6521b0068b4cd12f6de507c/testsuite.dir/0464/testsuite.log.gz

The issues encountered above is because 'monitor' with 'detach' arguments are
specified, that in turn will call 'close_standard_fds'
(https://github.com/openvswitch/ovs/blob/master/lib/daemon-unix.c#L472)
which will create a duplicate fd over '/dev/null' on Linux and 'nul' on Windows.

'isatty' will be called on those FDs.
What POSIX standard says:
http://pubs.opengroup.org/onlinepubs/009695399/functions/isatty.html
'The isatty() function shall test whether fildes, an open file descriptor,
is associated with a terminal device.'
What MSDN says:
https://msdn.microsoft.com/en-us/library/f4s0ddew(VS.80).aspx
'The _isatty function determines whether fd is associated with a character
device (a terminal, console, printer, or serial port).'

This patch adds another check using 'GetConsoleMode'
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683167(v=vs.85).aspx
which will fail if the handle pointing to the file descriptor is not associated
to a console.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Co-authored-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Anand Kumar <kumaranand@vmware.com>
6 years agocheckpatch: Use default encoding from email library.
Joe Stringer [Tue, 4 Jul 2017 14:16:46 +0000 (07:16 -0700)]
checkpatch: Use default encoding from email library.

There are three paths for running the core checkpatch path: From a file,
from stdin, or reading from git output. Currently, the file version of
this calls the "email" library's decode routine which translates the
stream into a bytes array, which we later call decode() to turn it back
into a regular string. This works on python2 and python3, but the other
paths don't work in python3 due to the following error:

$ utilities/checkpatch.py -1
== Checking HEAD~0 ==
Traceback (most recent call last):
  File "utilities/checkpatch.py", line 491, in <module>
    if ovs_checkpatch_parse(patch, revision):
  File "utilities/checkpatch.py", line 324, in ovs_checkpatch_parse
    for line in text.decode().split('\n'):
AttributeError: 'str' object has no attribute 'decode'

Rather than performing this extra encode/decode, strip these out from
this path so that the stdin and git variants of checkpatch can work in
python3.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoofp-parse: Improve comment for parse_ofp_packet_out_str().
Justin Pettit [Wed, 28 Jun 2017 00:26:52 +0000 (17:26 -0700)]
ofp-parse: Improve comment for parse_ofp_packet_out_str().

This function is a wrapper for parse_ofp_packet_out_str__(), which
states that a couple members must be freed on success.  This commit
updates the wrapper's description to indicate the same.

The existing callers appear to be properly freeing members.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoofp-parse: Fix small memory leak when calling parse_ofp_meter_mod_str().
Justin Pettit [Wed, 28 Jun 2017 00:12:00 +0000 (17:12 -0700)]
ofp-parse: Fix small memory leak when calling parse_ofp_meter_mod_str().

The function parse_ofp_meter_mod_str() allocates a buffer called
'bands', which parse_ofp_meter_mod_str__() then steals for the member
'mm->meter.bands'.  Calling functions didn't free that stolen value and
the comments for those function didn't indicate that was necessary.

Found by valgrind.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto-dpif-ipfix: Fix inefficent memory use in ipfix_send_template_msgs().
Ben Pfaff [Sat, 27 May 2017 04:14:21 +0000 (21:14 -0700)]
ofproto-dpif-ipfix: Fix inefficent memory use in ipfix_send_template_msgs().

This fixes inefficient use of memory in ipfix_send_template_msgs().
This function was setting up a buffer with a stub, but only the first 4
or 8 bytes of the stub were actually used because the "sizeof" call used
to size it was actually getting the size of a pointer.  This meant that
every template message was causing a series of allocations and
reallocations.

This commit fixes the problem.

Found by Coverity.

Reported-at: https://scan3.coverity.com/reports.htm#v16889/p10449/fileInstanceId=14762995&defectInstanceId=4304799&mergedDefectId=180398
Signed-off-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Justin Pettit <jpettit@ovn.org>
6 years agoRevert "ofproto-dpif-ipfix: Fix severe memory leak in ipfix_send_template_msgs()."
Ben Pfaff [Wed, 5 Jul 2017 22:42:49 +0000 (15:42 -0700)]
Revert "ofproto-dpif-ipfix: Fix severe memory leak in ipfix_send_template_msgs()."

This reverts commit 4d6f69df54b7d6ec2956875c683a9564cb175662.
There is nothing wrong with the commit itself, but the commit message is
misleading.  The following commit will re-apply it with a corrected commit
message.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodpif: fix warn msg when failed to open netdev
Marcelo Leitner [Tue, 4 Jul 2017 18:04:04 +0000 (15:04 -0300)]
dpif: fix warn msg when failed to open netdev

Currently it is using the datapath name/type but what has actually
failed was the netdev.

Fix it by using netdev name/type instead and also log why it failed.

Signed-off-by: Marcelo Ricardo Leitner <mleitner@redhat.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
6 years agoodp: Fix crash in parse_8021q_onward().
nickcooper-zhangtonghao [Fri, 16 Jun 2017 11:51:04 +0000 (04:51 -0700)]
odp: Fix crash in parse_8021q_onward().

When we use the 'ovs-appctl ofproto/trace' to send packets,
which include the 'vlan' field, but exclude the 'encap',
the ovs-vswitchd will crash. We should check 'encap' field
in parse_8021q_onward(), before using it.

ovs-appctl ofproto/trace ovs-system  \
    'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),
    eth_type(0x8100),vlan(vid=99,pcp=0)'

    #0  nl_attr_get_size (nla=nla@entry=0x0) at lib/netlink.c:567
    #1  parse_8021q_onward (src_flow=0x7ffd0ec77540, key_len=40,
        key=0x1207e00, flow=0x7ffd0ec77540, expected_attrs=<optimized out>,
        out_of_range_attr=0, present_attrs=120, attrs=0x7ffd0ec77170)
        at lib/odp-util.c:5359
    #2  odp_flow_key_to_flow__ (key=0x1207e00, key_len=40,
        flow=flow@entry=0x7ffd0ec77540, src_flow=src_flow@entry=0x7ffd0ec77540)
        at lib/odp-util.c:5520
    #3  odp_flow_key_to_flow (key=<optimized out>, key_len=<optimized out>,
        flow=flow@entry=0x7ffd0ec77540) at lib/odp-util.c:5555
    #4  parse_flow_and_packet (argc=3, argv=0x12b2220,
        ofprotop=ofprotop@entry=0x7ffd0ec77510, flow=flow@entry=0x7ffd0ec77540,
        packetp=packetp@entry=0x7ffd0ec77518)
        at ofproto/ofproto-dpif-trace.c:211
    #5  ofproto_unixctl_trace (conn=0x1268c20, argc=<optimized out>,
        argv=<optimized out>, aux=<optimized out>) at ofproto/ofproto-dpif-trace.c:309
    #6  process_command (request=<optimized out>, conn=0x1268c20) at lib/unixctl.c:313
    #7  run_connection (conn=0x1268c20) at lib/unixctl.c:347
    #8  unixctl_server_run (server=0x1180970) at lib/unixctl.c:400
    #9  main (argc=5, argv=0x7ffd0ec779c8) at vswitchd/ovs-vswitchd.c:120

Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
Acked-by: Eric Garver <e@erig.me>
Signed-off-by: Joe Stringer <joe@ovn.org>
6 years agodp-packet: Copy trunc flag on batch clone.
Ilya Maximets [Fri, 30 Jun 2017 11:00:14 +0000 (14:00 +0300)]
dp-packet: Copy trunc flag on batch clone.

Without this applying of the cutlen action will not work
on copied batch. Cutlen works for linux and dummy netdevs
only because they tries to apply it per-packet inside
send function.

Cutlen action doesn't work for dpdk ports in case batch clone
occured because invoked by the 'dp_packet_batch_apply_cutlen()'.

CC: Andy Zhou <azhou@ovn.org>
Fixes: 72c84bc2db23 ("dp-packet: Enhance packet batch APIs.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Andy Zhou <azhou@ovn.org>
6 years agoovs-ctl: Fix typo in a comment
Timothy Redaelli [Thu, 29 Jun 2017 15:28:56 +0000 (17:28 +0200)]
ovs-ctl: Fix typo in a comment

s/conenct/connect/

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
6 years agorhel-systemd: start vswitchd after udev
aaron conole [Tue, 18 Apr 2017 15:13:49 +0000 (11:13 -0400)]
rhel-systemd: start vswitchd after udev

It's possible to race with the udev service, such that dpdk ports are
not finished being bound until after ovs-vswitchd has been started.
This means that attempts to use the port will fail.  While it is
possible to work around this for some NICs using port hotplug, not all
port types are supported (for instance vfio), and it requires manual
intervention.

Fixes: 36af136b690c ("rhel-systemd: Delay shutting down the services")
Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1397299
Suggested-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Aaron Conole <aconole@redhat.com>
Tested-by: Karthik Sundaravel <ksundara@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agodatapath: Fix missing "_ATTR" docstrings from some actions.
Justin Pettit [Thu, 13 Apr 2017 00:53:34 +0000 (17:53 -0700)]
datapath: Fix missing "_ATTR" docstrings from some actions.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Joe Stringer <joe@ovn.org>
7 years agoofproto-dpif-ipfix: Fix severe memory leak in ipfix_send_template_msgs().
Ben Pfaff [Sat, 27 May 2017 04:14:21 +0000 (21:14 -0700)]
ofproto-dpif-ipfix: Fix severe memory leak in ipfix_send_template_msgs().

This fixes a seemingly severe memory leak in ipfix_send_template_msgs().
This function was setting up a buffer with a stub, but only the first 4
or 8 bytes of the stub were actually used because the "sizeof" call used
to size it was actually getting the size of a pointer.  It never freed
the buffer, leaking it.

Additionally, after this code sent a template message, it started over
from the same undersized stub, leaking another block of memory.

This commit fixes both problems.

Found by Coverity.

Reported-at: https://scan3.coverity.com/reports.htm#v16889/p10449/fileInstanceId=14762995&defectInstanceId=4304799&mergedDefectId=180398
Signed-off-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Justin Pettit <jpettit@ovn.org>
7 years agoopenvswitch.h: OVS_KEY_ATTR_PACKET_TYPE is userspace-only.
Ben Pfaff [Mon, 19 Jun 2017 23:30:41 +0000 (07:30 +0800)]
openvswitch.h: OVS_KEY_ATTR_PACKET_TYPE is userspace-only.

This wasn't clear before.

Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-June/334271.html
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Greg Rose <gvrose8192@gmail.com>
7 years agouserspace: Introduce packet_type in OF 1.5 packet-out
Zoltán Balogh [Fri, 23 Jun 2017 16:48:47 +0000 (16:48 +0000)]
userspace: Introduce packet_type in OF 1.5 packet-out

Introducing packet_type in OF 1.5 packet-out.
Partly based on Jean Tourrilhes's work.

Add test cases for OF1.5 packet-out
Add negative test case for OF1.5 packet-out

Signed-off-by: Jean Tourrilhes <jt@labs.hpe.com>
Signed-off-by: Zoltan Balogh <zoltan.balogh@ericsson.com>
Co-authored-by: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agouserspace: Complete Packet In handling
Jan Scheurich [Fri, 23 Jun 2017 16:48:38 +0000 (16:48 +0000)]
userspace: Complete Packet In handling

Send packet_in for non-Ethernet packets.
Include packet_type in Packet In for ptap bridges.

Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agotests: Added unit tests in packet-type-aware.at
Jan Scheurich [Fri, 23 Jun 2017 16:48:34 +0000 (16:48 +0000)]
tests: Added unit tests in packet-type-aware.at

First and second unit tests perform basic verification.

The third one is a triangular bridge setup test case. It tests dataplane
in non-PTAP and ptap bridges in conjunction with L2 and L3 GRE tunnels.
It uses veth ports, therefore requires root privileges.

A simplified version of the third test is added to system userspace unit tests.

 GRE tunneling test setup for PTAP bridge

     192.168.10.10           192.168.10.20             192.168.10.30
          n1                       n2                        n3
          |                        |                         |
   +------o------+          +------o------+           +------o------+
   |    br-in1   |          |    br-in2   |           |    br-in3   |
   |             |          |   (PTAP)    |           |             |
   +------o------+          +------o------+           +------o------+
         gre                      gre                       gre
   10.0.0.1                (10.0.0.2)                (10.0.0.3)
  (20.0.0.1)                20.0.0.2                 (20.0.0.3)
  (30.0.0.1) LOCAL         (30.0.0.2) LOCAL           30.0.0.3  LOCAL
   +-----------o-+          +-----------o-+           +-----------o-+
   |    br-p1    |          |    br-p2    |           |    br-p3    |
   +------o------+          +------o------+           +------o------+
     p1-0 |                        | p2-0                    | p3-0
     p0-1 |                        | p0-2                    | p0-3
       +--o------------------------o-------------------------o--+
       |                          br0                           |
       +--------------------------------------------------------+

   GRE tunnel ports:
      No     Bridge      Name        Packet-Type Remote bridge & ports
     -----------------------------------------------------------------------
      1020   br-in1      gre-12      legacy-l2   br-in2 2010 (ptap)
      1021   br-in1      gre-12_l3   legacy-l3         same
      1030   br-in1      gre-13      legacy-l2   br-in3 3010 (l2)
      2010   br-in2      gre-21      ptap        br-in1 1020 (l2), 1021 (l3)
      2030   br-in2      gre-23      ptap        br-in3 3020 (l2), 3021 (l3)
      3010   br-in1      gre-31      legacy-l2   br-in1 1030 (l2)
      3020   br-in1      gre-32      legacy-l2   br-in2 2010 (ptap)
      3021   br-in1      gre-32_l3   legacy-l3         same

Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agouserspace: Handling of versatile tunnel ports
Ben Pfaff [Fri, 23 Jun 2017 16:47:59 +0000 (16:47 +0000)]
userspace: Handling of versatile tunnel ports

In netdev_gre_build_header(), GRE protocol and VXLAN next_potocol is set based
on packet_type of flow. If it's about an Ethernet packet, it is set to
ETP_TYPE_TEB. Otherwise, if the name space is OFPHTN_ETHERNET, it is set
according to the name space type.

Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agouserspace: Add OXM field MFF_PACKET_TYPE
Jan Scheurich [Fri, 23 Jun 2017 16:47:57 +0000 (16:47 +0000)]
userspace: Add OXM field MFF_PACKET_TYPE

Allow packet type namespace OFPHTN_ETHERTYPE as alternative pre-requisite
for matching L3 protocols (MPLS, IP, IPv6, ARP etc).

Change the meta-flow definition of packet_type field to use the new
custom format MFS_PACKET_TYPE representing "(NS,NS_TYPE)".

Parsing routine for MFS_PACKET_TYPE added to meta-flow.c. Formatting
routine for field packet_type extracted from match_format() and moved to
flow.c to be used from meta-flow.c for formatting MFS_PACKET_TYPE.

Updated the ovs-fields man page source meta-flow.xml with documentation
for packet-type-aware bridges and added documentation for field packet_type.

Added packet_type to the matching properties in tests/ofproto.at.

If dl_type is unwildcarded due to later packet modification, make sure it
is cleared again if the original packet_type was not PT_ETH.

Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agonx-match: Add context argument to nxm_put__().
Ben Pfaff [Fri, 23 Jun 2017 16:47:54 +0000 (16:47 +0000)]
nx-match: Add context argument to nxm_put__().

An upcoming commit will need to pass an extra piece of data from
nx_put_raw() into all of its direct and indirect calls to nxm_put__().
This commit prepares for that by switching from a "struct ofpbuf *"
parameter to a context structure that, currently, contains just a
struct ofpbuf *.  The upcoming commit will add another member to the
context struct.

This commit has no visible effect on behavior.

Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoofpbuf: New function ofpbuf_insert().
Ben Pfaff [Fri, 23 Jun 2017 16:47:52 +0000 (16:47 +0000)]
ofpbuf: New function ofpbuf_insert().

This will receive its first users in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodatapath-windows: Include ICMP type and code fields to find a matching ct entry
Anand Kumar [Fri, 23 Jun 2017 21:05:12 +0000 (14:05 -0700)]
datapath-windows: Include ICMP type and code fields to find a matching ct entry

In conntrack lookup, ICMP type and code fields were not being used to
determine a matching entry. As a result, ICMP4_ECHO_REQUEST packet could
be tracked as ICMP4_ECHO_REPLY packet and vice versa, which is invalid.

To fix this, add ICMP type and code fields for matching a conntrack entry.

Signed-off-by: Anand Kumar <kumaranand@vmware.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agodpif: Fix cleanup of userspace datapath.
Darrell Ball [Tue, 27 Jun 2017 02:42:01 +0000 (19:42 -0700)]
dpif: Fix cleanup of userspace datapath.

Hardware offload introduced extra tracking of netdev ports.  This
included ovs-netdev, which is really for internal infra usage for
the userpace datapath.  This breaks cleanup of the userspace
datapath.  One effect is that all userspace datapath system tests
fail except for the first one run. There is no need to do this
extra tracking of tap devices for the hardware offload effort.
Hence, the approach taken is to filter both internal device
and tap device types for hardware offload. Internal devices are
'internal' from the kernel datapath perspective and tap devices
are 'internal' from the userpace datapath perspective.

Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agoodp-util: Use port names in output in more places.
Ben Pfaff [Sun, 18 Jun 2017 01:51:57 +0000 (09:51 +0800)]
odp-util: Use port names in output in more places.

Until now, ODP output only showed port names for in_port matches.  This
commit shows them in other places port numbers appear.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jan Scheurich <jan.scheurich@ericsson.com>
Tested-by: Jan Scheurich <jan.scheurich@ericsson.com>
7 years agoovs-dpctl: New --names option to use port names in flow dumps.
Ben Pfaff [Sun, 18 Jun 2017 01:46:54 +0000 (09:46 +0800)]
ovs-dpctl: New --names option to use port names in flow dumps.

Until now, printing names in "ovs-dpctl dump-flows" was tied to the overall
output verbosity, which in practice meant that to see port names a user had
to see a distracting amount of verbosity.  This decouples names from
verbosity.

I'd like to make showing names the default for interactive usage, but so
far names aren't accepted in input so that would frustrate cut-and-paste,
which is an important use of "ovs-dpctl dump-flows" output.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jan Scheurich <jan.scheurich@ericsson.com>
Tested-by: Jan Scheurich <jan.scheurich@ericsson.com>
7 years agodatapath-windows: Add validations for IP_HEADER_LEN
Shashank Ram [Thu, 15 Jun 2017 22:15:47 +0000 (15:15 -0700)]
datapath-windows: Add validations for IP_HEADER_LEN

Adds validations in OvsGetIp() to make sure the IHL is
within valid bounds. If IHL is invalid, then the packet
is dropped by the callers of this function.

Signed-off-by: Shashank Ram <rams@vmware.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agodatapath-windows: Add support for UPDATE events in Conntrack
Anand Kumar [Wed, 21 Jun 2017 20:33:55 +0000 (13:33 -0700)]
datapath-windows: Add support for UPDATE events in Conntrack

Introduce a new event type OVS_EVENT_CT_UPDATE to send a conntrack event
whenever a MARK and/or LABEL gets changed for an existing conntrack entry.

  - Parse netlink conntrack attribute OVS_CT_ATTR_EVENTMASK, which is used
    to set the mask of bits specifying which conntrack events (IPCT_*)
    should be delivered via the Netfilter netlink multicast groups.
  - Send update event only when OVS_CT_ATTR_EVENTMASK attribute has the mask
    of bits set for IPCT_MARK and/or IPCT_LABEL.

Signed-off-by: Anand Kumar <kumaranand@vmware.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agodatapath-windows: Fix switch-case alignments in Conntrack.c
Sairam Venugopal [Wed, 21 Jun 2017 18:20:48 +0000 (11:20 -0700)]
datapath-windows: Fix switch-case alignments in Conntrack.c

Minor - Fix the switch case alignments. Found by inspection.

Signed-off-by: Sairam Venugopal <vsairam@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agotests: switch from signed to unsigned when formatting
Alin Serdean [Tue, 20 Jun 2017 19:44:42 +0000 (19:44 +0000)]
tests: switch from signed to unsigned when formatting

x->errline is a signed int
Flagged by static code analysis.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agodatapath-windows: Fix potential memory leak while creating conntrack entry
Sairam Venugopal [Wed, 21 Jun 2017 17:08:57 +0000 (10:08 -0700)]
datapath-windows: Fix potential memory leak while creating conntrack entry

OvsCtAddEntry returns TRUE or FALSE depending on whether
OvsNatTranslateCtEntry was successful or not. In the case of an
unsuccesful NAT translation, this will fail to insert the newly created
entry to the Conntrack Table. This entry needs to be freed and the states
should be accordingly in the flowKey instead of returning out.

Consolidated the parentEntry lookup and assignment portion across
different protocols and some minor refactoring to make the code more
readable.

Tests Done: Enabled driver verifier and tested the following:
- TCP & ICMP traffic through Conntrack Module.
- Flushed Conntrack Entries while traffic was flowing.
- Uninstalled and re-installed the driver when traffic was in progress.

Signed-off-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Shashank Ram <rams@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agodistclean: Fix ovs-vtep and docker drivers.
Joe Stringer [Wed, 21 Jun 2017 23:25:19 +0000 (16:25 -0700)]
distclean: Fix ovs-vtep and docker drivers.

Commit b49a959bac47 ("Use @PYTHON@ directly instead of "#! /usr/bin/env"")
broke distclean, as it doesn't clean up the generated python scripts
after building. Fix by adding the new script files to CLEANFILES.

Fixes: b49a959bac47 ("Use @PYTHON@ directly instead of "#! /usr/bin/env"")
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoofp-actions: Store raw type for NXAST_LEARN2.
Joe Stringer [Tue, 20 Jun 2017 22:17:33 +0000 (15:17 -0700)]
ofp-actions: Store raw type for NXAST_LEARN2.

Previously, if a controller wrote a flow with action NXAST_LEARN2, then
OVS would internally store an ofpact_learn structure with the raw type
set to NXAST_LEARN. When re-encoding, if the learn action happened to
have a limit or dst_ofs specified (which can only be specified for
NXAST_LEARN2), then it would re-encode using NXAST_LEARN2. However, if
these fields were both zero then OVS relies on the ofpact 'raw' type to
re-encode the action, so would end up encoding it as NXAST_LEARN in
subsequent serialization.

Fix this issue by storing the raw type when decoding learn actions.

VMWare-BZ: #1897275
Fixes: 4c71600d2256 ("ofp-actions: Add limit to learn action.")
Reported-by: Harold Lim <haroldl@vmware.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
7 years agoUse @PYTHON@ directly instead of "#! /usr/bin/env"
Timothy Redaelli [Tue, 20 Jun 2017 17:53:55 +0000 (19:53 +0200)]
Use @PYTHON@ directly instead of "#! /usr/bin/env"

In some installed python scripts /usr/bin/env is unnecessarily used in
shebang, replace it directly with @PYTHON@.

This will also avoid implicit dependency to /usr/bin/env in RPM distributions
and it will correctly add implicit dependency to /usr/bin/python instead.

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agowindows: Remove vlog_init() from service_start function
Anand Kumar [Fri, 16 Jun 2017 17:06:26 +0000 (10:06 -0700)]
windows: Remove vlog_init() from service_start function

When --syslog-method is passed as a cmd line argument and
ovs daemons are started as a service, --syslog-method argument is not
honoured, as vlog module is initialized by service_start function
before parsing the command line arguments.

Easy way to fix this, is to remove vlog_init() from the service start
function and let the first log message to initialize the vlog module.

Signed-off-by: Anand Kumar <kumaranand@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agodatapath-windows: add open flow defines to Types.h
Alin Serdean [Tue, 20 Jun 2017 14:59:36 +0000 (14:59 +0000)]
datapath-windows: add open flow defines to Types.h

Commit https://github.com/openvswitch/ovs/commit/81765c00a13882acaaf652df23d7fa76fc3ad743
introduced openflow types to the include interface.

The Windows datapath needs to be aware of the new types included in the
common interface.

Fixes broken build on Windows.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agodatapath-windows: Zero initialize Conntrack-ICMP entry
Sairam Venugopal [Thu, 15 Jun 2017 21:07:43 +0000 (14:07 -0700)]
datapath-windows: Zero initialize Conntrack-ICMP entry

Set conntrack-icmp entry to {0}. Add some compile time asserts to ensure
that conn_* struct's first member is OVS_CT_ENTRY.

Signed-off-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Shashank Ram <rams@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agodpctl: Skip invoking qsort on empty list
Bhanuprakash Bodireddy [Mon, 19 Jun 2017 18:54:01 +0000 (19:54 +0100)]
dpctl: Skip invoking qsort on empty list

Clang reports "Argument with 'nonnull' attribute passed null" warning.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodpif-netdev: Skip invoking qsort on empty list.
Bhanuprakash Bodireddy [Mon, 19 Jun 2017 18:54:00 +0000 (19:54 +0100)]
dpif-netdev: Skip invoking qsort on empty list.

sorted_poll_list() returns the sorted list of rxqs mapped to PMD thread
along with the rxq count. Skip sorting the list if there are no rxqs
mapped to the PMD thread. This can be reproduced with manual pinning and
'dpif-netdev/pmd-rxq-show' command.

Also Clang reports that null argument is passed to qsort in this case.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoopenvswitch.h: Use odp_port_t for port numbers in userspace-only structs.
Ben Pfaff [Sun, 18 Jun 2017 00:59:30 +0000 (08:59 +0800)]
openvswitch.h: Use odp_port_t for port numbers in userspace-only structs.

Using the correct type reduces the need for type conversions.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jan Scheurich <jan.scheurich@ericsson.com>
Reviewed-by: nickcooper-zhangtonghao <nic@opencloud.tech>
7 years agoofp-util: Remove prototype for unimplemented function.
Ben Pfaff [Mon, 12 Jun 2017 19:47:55 +0000 (12:47 -0700)]
ofp-util: Remove prototype for unimplemented function.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jan Scheurich <jan.scheurich@ericsson.com>
Reviewed-by: nickcooper-zhangtonghao <nic@opencloud.tech>
7 years agoDocumentation/topics/dpdk/vhost-user.rst small fixes
William Stevenson [Mon, 19 Jun 2017 18:59:39 +0000 (19:59 +0100)]
Documentation/topics/dpdk/vhost-user.rst small fixes

A few trivial fixes to vhost-user documentation including a syntax
error in the included xml file.

Signed-off-by: William Stevenson <yhvh2000@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agotc: Tidy up includes.
Joe Stringer [Mon, 19 Jun 2017 21:33:23 +0000 (14:33 -0700)]
tc: Tidy up includes.

Fix minor style variations and unnecessary includes.

Signed-off-by: Joe Stringer <joe@ovn.org>
Tested-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Greg Rose <gvrose8192@gmail.com>
7 years agotc: Fix compile with Glibc < 2.24 and Linux > 4.5.
Joe Stringer [Mon, 19 Jun 2017 21:33:22 +0000 (14:33 -0700)]
tc: Fix compile with Glibc < 2.24 and Linux > 4.5.

linux/pkt_cls.h indirectly includes linux/stddef.h, which may define
__always_inline when using Linux kernel headers 4.6 or later.

netinet/in.h indirectly includes sys/cdefs.h, which before Glibc 2.24
would unconditionally define __always_inline.

This combination of headers causes compilation failure. Resolve the
issue by placing the netinet/in.h include above linux/pkt_cls.h.

Sourceware-BZ: #20215.
Fixes: f98e418fbdb6 ("tc: Add tc flower functions")
Signed-off-by: Joe Stringer <joe@ovn.org>
Tested-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Greg Rose <gvrose8192@gmail.com>
7 years agodocs: Document that hw-offload is experimental.
Joe Stringer [Thu, 15 Jun 2017 23:36:49 +0000 (16:36 -0700)]
docs: Document that hw-offload is experimental.

Currently, the set of flows that may be offloaded is very small compared
to the overall capabilities of the OpenFlow support in OVS. In the
majority of cases, if a user attempts to enable this flag they are
unlikely to observe a performance increase, because for instance they
lack the correct hardware; lack the correct kernel version; or their
flow tables are too complex for the hardware to handle.

To moderate expectations around this feature, describe it as
experimental. Over time, we expect that the functionality and usefulness
of this feature will grow and we should be in a better shape to revisit
the status of this functionality after it has had some time to mature.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Simon Horman <simon.horman@netronome.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
7 years agocompat: Restrict __ro_after_init usage
Greg Rose [Fri, 16 Jun 2017 23:37:09 +0000 (16:37 -0700)]
compat: Restrict __ro_after_init usage

The attribute __ro_after_init was introduced in Linux kernel 4.5.  If
a data structure is given this attribute then after the driver module
loads the memory page where the data resides will be marked read only.

The compat code in cache.h always defines __ro_after_init if it is not
already defined so that it can be used as an attribute for the datapath
genl_family structure definitions.  If __ro_after_init is defined then
it is used "as-is" where it will apply the read only attribute after
driver initialization.

This is incorrect usage for the Generic Netlink genl_family structure
definitions prior to Linux kernel 4.10.  The genl_family structure
in those kernels includes a list header member that will be written
to when the generic netlink family is unregistered.  This will cause
a subsequent page fault and kernel panic because at this time the
genl_family structure data has been marked read only in the page
descriptor.

A new compat macro is introduced in acinclude.m4 to detect when the
genl_family structure has the family_list list header as a member.
In this case HAVE_GENL_FAMILY_LIST is defined and if __ro_after_init
is also defined then it is undefined and redefined as empty.  This
will prevent the genl_family data structure from being marked read
only in kernels 4.5 through 4.9 and thus prevent the page fault when
the generic netlink families in datapath.c are unregistered.

[Committer notes]
* Rolled a short explanation comment into the code.

Fixes: ba63fe260bd5 ("datapath: Allow compile against current net-next.")
CC: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath-windows: Define NAT_ACTION enum correctly
Shashank Ram [Thu, 15 Jun 2017 19:46:51 +0000 (12:46 -0700)]
datapath-windows: Define NAT_ACTION enum correctly

The existing code throws a warning when compiled
with the Windows 10 SDK:
'typedef ': ignored on left of 'NAT_ACTION' when no variable is declared

Signed-off-by: Shashank Ram <rams@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com<mailto:nithin@vmware.com>>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agodatapath-windows: use NlAttrGet() in Conntrack.c
Nithin Raju [Wed, 14 Jun 2017 23:01:48 +0000 (16:01 -0700)]
datapath-windows: use NlAttrGet() in Conntrack.c

Couple of minor fixes that got flagged with a static checker.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Shashank Ram <rams@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agoopenflow.rst: Update to reflect current status.
Ben Pfaff [Wed, 14 Jun 2017 15:21:24 +0000 (08:21 -0700)]
openflow.rst: Update to reflect current status.

OpenFlow 1.1 and 1.2 support is complete.  Simon Horman is not known to
be working on flow entry notifications.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Greg Rose <gvrose8192@gmail.com>
7 years agocheckpatch: Fix skipping of the most recent commit.
Ilya Maximets [Thu, 15 Jun 2017 11:57:30 +0000 (14:57 +0300)]
checkpatch: Fix skipping of the most recent commit.

'range(n_patches, 0, -1)' generates list starting from 'n_patches'
and not including zero. This leads to checking of N most recent
commits starting from the second one.

New version will generate right list starting from 'n_patches - 1'
and including zero. So, the most recent commit (HEAD~0) will be
checked and desired behavior will be achieved.

Also, 'reversed' looks better than 'range(n_patches - 1, -1, -1)'

Fixes: a1fccabce2cb ("checkpatch: Support checking recent commits in the current repo.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoNEWS: add a note about hw offloading
Roi Dayan [Tue, 13 Jun 2017 15:03:55 +0000 (18:03 +0300)]
NEWS: add a note about hw offloading

Signed-off-by: Roi Dayan <roid@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agodpif-netlink: Use dpif logging functions
Roi Dayan [Tue, 13 Jun 2017 15:03:54 +0000 (18:03 +0300)]
dpif-netlink: Use dpif logging functions

Remove redundant logging functions and reuse
the exposed dpif logging functions.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Paul Blakey <paulb@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agodpif: Refactor flow logging functions to be used by other modules
Roi Dayan [Tue, 13 Jun 2017 15:03:53 +0000 (18:03 +0300)]
dpif: Refactor flow logging functions to be used by other modules

To be reused by other modules.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Paul Blakey <paulb@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agonetdev: Init flow api on already added ports on offload enable
Paul Blakey [Tue, 13 Jun 2017 15:03:52 +0000 (18:03 +0300)]
netdev: Init flow api on already added ports on offload enable

Ports already added to a switch are not being initialized for offloading
so when enabling offload we need to go over those ports.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agotests: Add system-offloads-testsuite
Paul Blakey [Tue, 13 Jun 2017 15:03:51 +0000 (18:03 +0300)]
tests: Add system-offloads-testsuite

The new system-offloads-testsuite, which can be launched via
`make check-offloads`, tests offloading capabilities
to makes sure that certian flows are actually offloaded.

The tests run on virtual netdevices (VETH).

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agodpctl: Indicate if flow is offloaded when dumping flows of all types
Paul Blakey [Tue, 13 Jun 2017 15:03:50 +0000 (18:03 +0300)]
dpctl: Indicate if flow is offloaded when dumping flows of all types

When verbosity is requested on dump-flows (-m) indicate which flows
are offloaded.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agodpctl: Add an option to dump only certain kinds of flows
Paul Blakey [Tue, 13 Jun 2017 15:03:49 +0000 (18:03 +0300)]
dpctl: Add an option to dump only certain kinds of flows

Usage:
    # to dump all datapath flows (default):
    ovs-dpctl dump-flows

    # to dump only flows that in kernel datapath:
    ovs-dpctl dump-flows type=ovs

    # to dump only flows that are offloaded:
    ovs-dpctl dump-flows type=offloaded

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agodpctl: Add filter arg to dump-flows command info
Roi Dayan [Tue, 13 Jun 2017 15:03:48 +0000 (18:03 +0300)]
dpctl: Add filter arg to dump-flows command info

This is for it to appear in bash completion.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agonetdev-tc-offloads: Add ingress on netdev flow api init
Paul Blakey [Tue, 13 Jun 2017 15:03:47 +0000 (18:03 +0300)]
netdev-tc-offloads: Add ingress on netdev flow api init

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agonetdev-vport: Use common offloads interface
Paul Blakey [Tue, 13 Jun 2017 15:03:46 +0000 (18:03 +0300)]
netdev-vport: Use common offloads interface

netdev vports are backed by actualy netdev at the kernel
level, so they can use the common netdev-tc offloads interface
for flow offloading (if enabled).

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agonetdev-linux: Disallow setting policing when configured with hw offload
Paul Blakey [Tue, 13 Jun 2017 15:03:45 +0000 (18:03 +0300)]
netdev-linux: Disallow setting policing when configured with hw offload

Notify as not supported. Otherwise the ingress qdisc is being removed and
offload rules will be removed.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agonetdev-tc-offloads: Implement flow get using tc interface
Paul Blakey [Tue, 13 Jun 2017 15:03:44 +0000 (18:03 +0300)]
netdev-tc-offloads: Implement flow get using tc interface

Search the requested ufid for a offloaded flow, and if found,
dump and parse it back to required format.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agodpif-netlink: Use netdev flow get api to query a flow
Paul Blakey [Tue, 13 Jun 2017 15:03:43 +0000 (18:03 +0300)]
dpif-netlink: Use netdev flow get api to query a flow

Search all datapath added netdevs for a given flow
using netdev flow api and parse it back to dpif flow.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agonetdev-tc-offloads: Implement netdev flow del using tc interface
Paul Blakey [Tue, 13 Jun 2017 15:03:42 +0000 (18:03 +0300)]
netdev-tc-offloads: Implement netdev flow del using tc interface

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agodpif-netlink: Use netdev flow del api to delete a flow
Paul Blakey [Tue, 13 Jun 2017 15:03:41 +0000 (18:03 +0300)]
dpif-netlink: Use netdev flow del api to delete a flow

If a flow was offloaded to a netdev we delete it using netdev
flow api.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agonetdev-tc-offloads: Implement netdev flow put using tc interface
Paul Blakey [Tue, 13 Jun 2017 15:03:40 +0000 (18:03 +0300)]
netdev-tc-offloads: Implement netdev flow put using tc interface

Currently only tunnel offload is supported.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agonetdev-tc-offloads: Add flower mask to priority map
Paul Blakey [Tue, 13 Jun 2017 15:03:39 +0000 (18:03 +0300)]
netdev-tc-offloads: Add flower mask to priority map

Flower classifer requires a different priority per mask,
so we hash the mask and generate a new priority for
each new mask used.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agodpif-netlink: Use netdev flow put api to insert a flow
Paul Blakey [Tue, 13 Jun 2017 15:03:38 +0000 (18:03 +0300)]
dpif-netlink: Use netdev flow put api to insert a flow

Using the new netdev flow api operate will now try and
offload flows to the relevant netdev of the input port.
Other operate methods flows will come in later patches.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agonetdev-tc-offloads: Implement netdev flow dump api using tc interface
Paul Blakey [Tue, 13 Jun 2017 15:03:37 +0000 (18:03 +0300)]
netdev-tc-offloads: Implement netdev flow dump api using tc interface

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agomatch: Add helper function to set tunnel tp_dst
Roi Dayan [Tue, 13 Jun 2017 15:03:36 +0000 (18:03 +0300)]
match: Add helper function to set tunnel tp_dst

Add help function match_set_tun_tp_dst().
Will be used in the next commit.
This patch doesn't change any functionality.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agonetdev-tc-offloads: Add ufid to tc/netdev map
Paul Blakey [Tue, 13 Jun 2017 15:03:35 +0000 (18:03 +0300)]
netdev-tc-offloads: Add ufid to tc/netdev map

Flows offloaded to tc are identified by priority
and handle pair while OVS flows are identified by ufid.
Added a hash map to convert between the two for later
retrieval and deleting of offloaded flows.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agodpif-netlink: Dump netdevs flows on flow dump
Paul Blakey [Tue, 13 Jun 2017 15:03:34 +0000 (18:03 +0300)]
dpif-netlink: Dump netdevs flows on flow dump

While dumping flows, dump flows that were offloaded to
netdev and parse them back to dpif flow.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agonetdev-tc-offloads: Implement netdev flow flush using tc interface
Paul Blakey [Tue, 13 Jun 2017 15:03:33 +0000 (18:03 +0300)]
netdev-tc-offloads: Implement netdev flow flush using tc interface

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>