]> git.proxmox.com Git - mirror_ovs.git/log
mirror_ovs.git
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>
7 years agodpif-netlink: Flush added ports using netdev flow api
Paul Blakey [Tue, 13 Jun 2017 15:03:32 +0000 (18:03 +0300)]
dpif-netlink: Flush added ports using netdev flow api

If netdev flow offloading is enabled, flush all
added ports 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 agodpif: Save added ports in a port map for netdev flow api use
Paul Blakey [Tue, 13 Jun 2017 15:03:31 +0000 (18:03 +0300)]
dpif: Save added ports in a port map for netdev flow api use

To use netdev flow offloading api, dpifs needs to iterate over
added ports. This addition inserts the added dpif ports in a hash map,
The map will also be used to translate dpif ports to netdevs.

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 agoother-config: Add tc-policy switch to control tc flower flag
Paul Blakey [Tue, 13 Jun 2017 15:03:30 +0000 (18:03 +0300)]
other-config: Add tc-policy switch to control tc flower flag

Add a new configuration tc-policy option that controls tc
flower flag. Possible options are none, skip_sw, skip_hw.
The default is none which is to insert the rule both to sw and hw.
This option is only relevant if hw-offload is 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-dpdk: round up mbuf_size to cache_line_size
Santosh Shukla [Mon, 12 Jun 2017 14:38:18 +0000 (14:38 +0000)]
netdev-dpdk: round up mbuf_size to cache_line_size

Some pmd driver(e.g: vNIC thunderx PMD) want mbuf_size to be multiple of
cache_line_size. With out this fix, Netdev-dpdk initialization would
fail for those PMD.

Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Tested-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Ian Stokes <ian.stokes@intel.com>
7 years agoDebian: Provide multi-arch support
Ben Warren [Thu, 8 Jun 2017 20:47:03 +0000 (13:47 -0700)]
Debian: Provide multi-arch support

This puts all libraries and pkg-config files in architecture-specific
directories for easier cross-compiling.

Signed-off-by: Ben Warren <ben@skyportsystems.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoDebian: Rework libopenvswitch packages
Ben Warren [Thu, 8 Jun 2017 20:47:02 +0000 (13:47 -0700)]
Debian: Rework libopenvswitch packages

The 'openvswitch-common' package did not work well with cross-compiling
since it required Python.  This package is broken into two packages as
follows:
- libopenvwitch: contains library files (.a, .so)
- openvswitch-common: depends on libopenvswitch, contains command-line
  tools such as ovs-ofctl, ovs-appctl etc.

In addition, this 'openvswitch-dev' library is renamed to
'libopenvswitch-dev' to align more closely with Debian policy.  It
depends on libopenvswitch.

Signed-off-by: Ben Warren <ben@skyportsystems.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agocheckpatch: Support checking recent commits in the current repo.
Ben Pfaff [Wed, 14 Jun 2017 20:42:54 +0000 (13:42 -0700)]
checkpatch: Support checking recent commits in the current repo.

Requested-by: Miguel Angel Ajo <majopela@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovs-ofctl: New option "--no-stats" for "ovs-ofctl dump-flows".
Ben Pfaff [Wed, 14 Jun 2017 00:09:05 +0000 (17:09 -0700)]
ovs-ofctl: New option "--no-stats" for "ovs-ofctl dump-flows".

It's pretty common to want to omit statistics from output, to make it
easier to read.  This commit adds an ovs-ofctl option to make that easy.

A lot of the OVS internal tests could use this, too, in place of
ofctl_strip.  This commit adopts it for a subset.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
7 years agoofproto-dpif-xlate: Fix an additional misaligned reference to ovs_u128.
Ben Pfaff [Wed, 14 Jun 2017 16:20:07 +0000 (09:20 -0700)]
ofproto-dpif-xlate: Fix an additional misaligned reference to ovs_u128.

nl_msg_put_unspec_uninit() can return a pointer that is only 4-byte
aligned.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Lance Richardson <lrichard@redhat.com>
7 years agonetlink: Introduce helpers for 128-bit integer attributes.
Ben Pfaff [Wed, 14 Jun 2017 16:07:45 +0000 (09:07 -0700)]
netlink: Introduce helpers for 128-bit integer attributes.

Use the helpers in appropriate places.  In most cases, this fixes a
misaligned reference, since ovs_be128 and ovs_u128 require 8-byte alignment
but Netlink only guarantees 4-byte.

Found by GCC -fsanitize=undefined.

Reported-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Lance Richardson <lrichard@redhat.com>
7 years agounaligned: Introduce helpers for 32-bit aligned 128-bit integers.
Ben Pfaff [Wed, 14 Jun 2017 15:46:32 +0000 (08:46 -0700)]
unaligned: Introduce helpers for 32-bit aligned 128-bit integers.

These are analogous to the existing helpers for 32-bit aligned 64-bit
integers, and will have users in upcoming commits.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Lance Richardson <lrichard@redhat.com>
7 years agoodp-util: Avoid misaligned references to ip6_hdr.
Ben Pfaff [Wed, 14 Jun 2017 15:38:02 +0000 (08:38 -0700)]
odp-util: Avoid misaligned references to ip6_hdr.

Found by GCC -fsanitize=undefined.

Reported-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovs-ofctl: Avoid read overrun in ofperr_decode_msg().
Ben Pfaff [Tue, 13 Jun 2017 23:04:29 +0000 (16:04 -0700)]
ovs-ofctl: Avoid read overrun in ofperr_decode_msg().

vconn_add_bundle_error() was keeping at most 64 bytes of an OpenFlow
error message, then it was passing it to ofperr_decode_msg(), which assumed
that the full message was available.  This led to a buffer overread.
There's no good reason why it was only keeping the first 64 bytes, so this
commit changes it to keep the whole error message, sidestepping the
problem.

struct vconn_bundle_error only existed for this special case, so remove it
in favor of a chain of ofpbufs.

Found via gcc's address sanitizer.

Reported-by: Lance Richardson <lrichard@redhat.com>
Fixes: 506c1ddb3404 ("vconn: Better bundle error management.")
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahlame <jarno@ovn.org>
7 years agoother-config: Add hw-offload switch to control netdev flow offloading
Paul Blakey [Tue, 13 Jun 2017 15:03:29 +0000 (18:03 +0300)]
other-config: Add hw-offload switch to control netdev flow offloading

Add a new configuration option - hw-offload that enables netdev
flow api. Enabling this option will allow offloading flows
using netdev implementation instead of the kernel datapath.
This configuration option defaults to false - disabled.

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: Adding a new netdev API to be used for offloading flows
Paul Blakey [Tue, 13 Jun 2017 15:03:28 +0000 (18:03 +0300)]
netdev: Adding a new netdev API to be used for offloading flows

Add a new API interface for offloading dpif flows to netdev.
The API consist on the following:
  flow_put - offload a new flow
  flow_get - query an offloaded flow
  flow_del - delete an offloaded flow
  flow_flush - flush all offloaded flows
  flow_dump_* - dump all offloaded flows

In upcoming commits we will introduce an implementation of this
API for netdev-linux.

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 agotc: Add tc flower functions
Roi Dayan [Tue, 13 Jun 2017 15:03:27 +0000 (18:03 +0300)]
tc: Add tc flower functions

Add tc helper functions to query and manipulate the flower classifier.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Co-authored-by: Roi Dayan <roid@mellanox.com>
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 agotc: Move functions the create/parse handle to be static inline
Roi Dayan [Tue, 13 Jun 2017 15:03:26 +0000 (18:03 +0300)]
tc: Move functions the create/parse handle to be static inline

Those functions are just wrappers to available macros for readability.
Move them to tc.h to avoid function-call overhead.

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 agotc: Refactor tcm handle assignment when creating filter qdisc
Roi Dayan [Tue, 13 Jun 2017 15:03:25 +0000 (18:03 +0300)]
tc: Refactor tcm handle assignment when creating filter qdisc

Use the available TC macros instead of 0xffff.

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 agotc: Introduce tc module
Paul Blakey [Tue, 13 Jun 2017 15:03:24 +0000 (18:03 +0300)]
tc: Introduce tc module

Add tc module to expose tc operations to be used by other modules.
Move some tc related functions from netdev-linux.c to tc.c
This patch doesn't change any functionality.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Co-authored-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Roi Dayan <roid@mellanox.com>
Acked-by: Joe Stringer <joe@ovn.org>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agonetdev-linux: Refactor two tc functions
Roi Dayan [Tue, 13 Jun 2017 15:03:23 +0000 (18:03 +0300)]
netdev-linux: Refactor two tc functions

Refactor tc_make_request and tc_add_del_ingress_qdisc to accept
ifindex instead of netdev struct.
We later want to move those outside netdev-linux module to be
used by other modules.
This patch doesn't change any functionality.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Co-authored-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: Paul Blakey <paulb@mellanox.com>
Acked-by: Joe Stringer <joe@ovn.org>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
7 years agosandbox: disable ssl for backup ovn southbound db
Lance Richardson [Tue, 13 Jun 2017 17:51:06 +0000 (13:51 -0400)]
sandbox: disable ssl for backup ovn southbound db

Since the sandbox environment was changed to enable SSL usage for
OVN_Southbound connections, the backup southbound server emits
the log message "socket_util|ERR|6642: bind: Address already in use"
every 2.5 seconds.

Fix by configuring the backup db server to not use remote configuration
from the database (the unix: socket can still be used, as was the
case before SSL was enabled).

Fixes: 0ced2a5c5e47 ("sandbox: use ssl for ovn-controller to sb db connection")
Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoconntrack: Reset nat_info in un_nat conns.
Darrell Ball [Tue, 13 Jun 2017 14:46:29 +0000 (07:46 -0700)]
conntrack: Reset nat_info in un_nat conns.

Un-nat conns have no nat_info as do default conns.
However, un-nat conns are originally templated from the
corresponding default conns and therefore need to
have their nat_info explicitly nulled.  This
otherwise exposes a double free if conntrack_destroy()
were to be used to destroy the connection tracker.  This
would apply to cleaning the datapath after testing.

Fixes: 286de2729955 ("dpdk: Userspace Datapath: Introduce NAT Support.")
Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Greg Rose <gvrose8192@gmail.com>
7 years agoredhat: make the rpm aware of the lock file
Aaron Conole [Tue, 13 Jun 2017 18:26:03 +0000 (14:26 -0400)]
redhat: make the rpm aware of the lock file

Currently, the db lockfile will cause the openvswitch directory to
linger after uninstall because the rpm database isn't aware that it
should be treated as part of the system.  This commit informs the rpmdb
properly as a 'ghost' so that when the package is uninstalled, it will
be removed automatically.  This means that if no extra files exist in
/etc/openvswitch, the whole directory will be removed from /etc/.

Acked-by: Flavio Leitner <fbl@sysclose.org>
Reviewed-by: Markos Chandras <mchandra@suse.de>
Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agosandbox: ovn rbac support for sandbox environment
Lance Richardson [Mon, 12 Jun 2017 22:42:39 +0000 (18:42 -0400)]
sandbox: ovn rbac support for sandbox environment

Enable OVN_Southbound RBAC by default in the sandbox environment,
provide a new option "--no-ovn-rbac" to disable it.

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agotreewide: Avoid undefined behavior passing null in nonnull parameters.
Lance Richardson [Tue, 13 Jun 2017 16:57:38 +0000 (12:57 -0400)]
treewide: Avoid undefined behavior passing null in nonnull parameters.

Eliminate a number of instances of undefined behavior related to
passing NULL in parameters having "nonnull" annotations.

Found with gcc's undefined behavior sanitizer.

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agohash: Remove conflicting hash_finish() prototype.
Ben Pfaff [Tue, 13 Jun 2017 15:30:02 +0000 (08:30 -0700)]
hash: Remove conflicting hash_finish() prototype.

Normally, hash_finish() is declared as:
static inline uint32_t hash_finish(uint32_t hash, uint32_t final)

When __SSE4_2__ && __x86_64__, it is declared as:
static inline uint32_t hash_finish(uint64_t hash, uint64_t final)

A recent commit added an unneeded prototype in the first form, which caused
an error due to the redeclaration of a different type when the second form
was actually used.  This removes the prototype, fixing the problem.

It may not be a great idea to have two different forms for this function,
but it's long standing and so I don't want to change it immediately without
proper consideration.

Reported-by: "Fischetti, Antonio" <antonio.fischetti@intel.com>
Fixes: 67702b79d845 ("hash: New helper functions for adding words in a buffer to a hash.")
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Darrell Ball <dlu998@gmail.com>
7 years agobyte-order: Fix undefined behavior of BYTES_TO_BE32.
Ben Pfaff [Tue, 13 Jun 2017 04:51:14 +0000 (21:51 -0700)]
byte-order: Fix undefined behavior of BYTES_TO_BE32.

A left shift that would produce a result that is not representable
by the type of the expression's result has "undefined behavior"
according to the C language standard. Avoid this by casting values
that could set the upper bit to unsigned types.

Also document and convert a macro to a function.

While we're at it, delete the unused macro BE16S_TO_BE32.

Found via gcc's undefined behavior sanitizer.

Reported-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Lance Richardson <lrichard@redhat.com>
7 years agoconntrack: Add hash_finish() to conn_key_hash().
Darrell Ball [Fri, 9 Jun 2017 22:30:44 +0000 (15:30 -0700)]
conntrack: Add hash_finish() to conn_key_hash().

The function conn_key_hash() is updated to include
a call to hash_finish() and also to make use of a
new hash abstraction - ct_endpoint_hash_add().

Fixes: a489b16854b5 ("conntrack: New userspace connection tracker.")
Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoconntrack: Hash entire NAT data structure in nat_range_hash().
Darrell Ball [Fri, 9 Jun 2017 22:30:43 +0000 (15:30 -0700)]
conntrack: Hash entire NAT data structure in nat_range_hash().

Part of the hash input for nat_range_hash() was accidentally
omitted, so this fixes the problem.  Also, add a missing call to
hash_finish().

Fixes: 286de2729955 ("dpdk: Userspace Datapath: Introduce NAT Support.")
Co-authored-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agohash: New helper functions for adding words in a buffer to a hash.
Ben Pfaff [Fri, 9 Jun 2017 22:30:42 +0000 (15:30 -0700)]
hash: New helper functions for adding words in a buffer to a hash.

These will receive their first user (outside of hash.h) in the following
commit.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agotestsuite: exit gracefully if it fails.
Flavio Leitner [Fri, 9 Jun 2017 15:58:57 +0000 (12:58 -0300)]
testsuite: exit gracefully if it fails.

The daemon is killed leaving resources behind when a test fails.
This fixes to first signal the daemon to exit gracefully.

Fixes: 0f28164be02ac ("netdev-linux: make tap devices persistent")
Suggested-by: Joe Stringer <joe@ovn.org>
Co-authored-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Joe Stringer <joe@ovn.org>
7 years agowindows-datapath: Temporary workaround checksum issue with NAT
Alin Gabriel Serdean [Fri, 9 Jun 2017 22:16:07 +0000 (15:16 -0700)]
windows-datapath: Temporary workaround checksum issue with NAT

There is a known bug with NAT where checksum computation is wrong on
the RX path if offload is enabled. This patch works around the problem
by always computing a software checksum and should be reverted once
we figure out the root cause of checksum error.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agodatapath-windows: NAT integration with conntrack
Yin Lin [Fri, 9 Jun 2017 22:16:06 +0000 (15:16 -0700)]
datapath-windows: NAT integration with conntrack

This patch integrates NAT module with existing conntrack module. NAT
action is now supported.

Signed-off-by: Yin Lin <linyi@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agodatapath-windows: Add NAT module in conntrack
Yin Lin [Fri, 9 Jun 2017 22:16:05 +0000 (15:16 -0700)]
datapath-windows: Add NAT module in conntrack

Signed-off-by: Yin Lin <linyi@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agodatapath-windows: Add support for NAT in conntrack
Anand Kumar [Fri, 9 Jun 2017 22:16:04 +0000 (15:16 -0700)]
datapath-windows: Add support for NAT in conntrack

Add support for parsing netlink attributes related to NAT
in conntrack.

Co-Authored-by: Yin Lin <linyi@vmware.com>
Co-Authored-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Anand Kumar <kumaranand@vmware.com>
Signed-off-by: Yin Lin <linyi@vmware.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agotreewide: Fix spelling of "prerequisites".
Ben Pfaff [Sat, 10 Jun 2017 02:47:50 +0000 (19:47 -0700)]
treewide: Fix spelling of "prerequisites".

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Greg Rose <gvrose8192@gmail.com>
7 years agoofp-actions: Properly interpret "output:in_port".
Ben Pfaff [Mon, 12 Jun 2017 15:35:48 +0000 (08:35 -0700)]
ofp-actions: Properly interpret "output:in_port".

It was being misinterpreted as output:NXM_OF_IN_PORT[].  This
interpretation is incorrect because of OpenFlow rules that say that only
the special form generated by output:in_port (or "in_port" on its own)
actually outputs to the input port.  The interpretation here was a no-op.

Fixes: 21b2fa617126 ("ofp-parse: Allow match field names in actions and brackets in matches.")
Reported-by: nickcooper-zhangtonghao <nic@opencloud.tech>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoofp-util: Initialize tunnel metadata for OpenFlow 1.0 matches.
Ben Pfaff [Fri, 9 Jun 2017 05:09:19 +0000 (22:09 -0700)]
ofp-util: Initialize tunnel metadata for OpenFlow 1.0 matches.

Found by valgrind.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Lance Richardson <lrichard@redhat.com>
Acked-by: Lance Richardson <lrichard@redhat.com>
7 years agodpdk: Deprecate vhost-user server ports.
Aaron Conole [Thu, 8 Jun 2017 20:41:32 +0000 (16:41 -0400)]
dpdk: Deprecate vhost-user server ports.

Since vhost-user server mode ports are the preferred mechanism for
interconnecting Open vSwitch with VMs when using DPDK, and since there
are currently no known use cases for vhost-user server mode ports apart
from version incompatibilities with QEMU, announce that server mode ports
are considered deprecated and will be removed in a future release.

Cc: Ciara Loftus <ciara.loftus@intel.com>
Cc: Kevin Traynor <ktraynor@redhat.com>
Suggested-by: Darrell Ball <dball@vmware.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agorstp: Add the 'ovs-appctl rstp/show' command.
nickcooper-zhangtonghao [Thu, 1 Jun 2017 03:38:16 +0000 (20:38 -0700)]
rstp: Add the 'ovs-appctl rstp/show' command.

The rstp/show command will help users and developers to
get more details about rstp. This patch works together with
the previous patches.

Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agorstp: Add internal functions without locks.
nickcooper-zhangtonghao [Thu, 1 Jun 2017 03:38:15 +0000 (20:38 -0700)]
rstp: Add internal functions without locks.

This patch adds some internal functions which
does not use the locks. This patch is used for
next patch.

Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agorstp: Add rstp port name for human reading.
nickcooper-zhangtonghao [Thu, 1 Jun 2017 03:38:14 +0000 (20:38 -0700)]
rstp: Add rstp port name for human reading.

This patch is useful to debug rstp subsystem and log the
port name instead of port number. This patch will also
be used to display rstp info for next patches.

Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovn-sbctl: support setting rbac role for remote connections
Lance Richardson [Wed, 31 May 2017 23:06:11 +0000 (19:06 -0400)]
ovn-sbctl: support setting rbac role for remote connections

Add support for specifying rbac "role" when setting remote
connection configuration in the southbound database.

Prior to this change, usage examples included:

    ovn-sbctl set-connection ptcp:6642
    ovn-sbctl set-connection pssl:6642 \
                             read-only ptcp:7777 \
                             read-write punix:/tmp.foo

With this change, in addition to the above:

    ovn-sbctl set-connection role=ovn-controller pssl:6642 \
                             read-only role= ptcp:7777 \
                             read-write punix:/tmp/foo

As with the "read-only"/"read-write" attributes, the specified
role is applied to all subsequent connections until changed.

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovn: add rbac tables to ovn southbound schema
Lance Richardson [Wed, 31 May 2017 23:04:47 +0000 (19:04 -0400)]
ovn: add rbac tables to ovn southbound schema

Add rbac "roles" and "permissions" tables to ovn southbound
database schema, add support to ovn-northd for managing these
tables.

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovsdb: add support for role-based access controls
Lance Richardson [Wed, 31 May 2017 23:04:32 +0000 (19:04 -0400)]
ovsdb: add support for role-based access controls

Add suport for ovsdb RBAC (role-based access control). This includes:

   - Support for "RBAC_Role" table. A db schema containing a table
     by this name will enable role-based access controls using
     this table for RBAC role configuration.

     The "RBAC_Role" table has one row per role, with each row having a
     "name" column (role name) and a "permissions" column (map of
     table name to UUID of row in separate permission table.) The
     permission table has one row per access control configuration,
     with the following columns:
          "name"          - name of table to which this row applies
          "authorization" - set of column names and column:key pairs
                            to be compared against client ID to
                            determine authorization status
          "insert_delete" - boolean, true if insertions and
                            authorized deletions are allowed.
          "update"        - Set of columns and column:key pairs for
                            which authorized updates are allowed.
   - Support for a new "role" column in the remote configuration
     table.
   - Logic for applying the RBAC role and permission tables, in
     combination with session role from the remote connection table
     and client id, to determine whether operations modifying database
     contents should be permitted.
   - Support for specifying RBAC role string as a command-line option
     to ovsdb-tool (Ben Pfaff).

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Co-authored-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agonetdev-dpdk: Show Rx checksum status when false.
Kevin Traynor [Thu, 8 Jun 2017 17:12:20 +0000 (18:12 +0100)]
netdev-dpdk: Show Rx checksum status when false.

Currently ovs-appctl dpctl/show only shows the Rx checksum offload
status when true. Change to also show the status when false.

CC: Sugesh Chandran <sugesh.chandran@intel.com>
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodatapath-windows: Add original conntrack tuple to FlowKey
Sairam Venugopal [Fri, 2 Jun 2017 17:37:22 +0000 (10:37 -0700)]
datapath-windows: Add original conntrack tuple to FlowKey

Add the original tuple to Flow Key. In case of ICMP and UDP, default the
parent entry to NULL until related connections is supported.

Signed-off-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agocheckpatch: Also allow .at files to have leading tabs.
Ben Pfaff [Tue, 6 Jun 2017 15:39:34 +0000 (08:39 -0700)]
checkpatch: Also allow .at files to have leading tabs.

Autotest .at files often have lines with samples of expected output from
various programs, which fairly often includes leading tabs, so this warning
causes false positives there.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Aaron Conole <aconole@redhat.com>
7 years agotestsuite: release resources when vswitch exits.
Flavio Leitner [Wed, 7 Jun 2017 20:58:10 +0000 (17:58 -0300)]
testsuite: release resources when vswitch exits.

This change the testsuite macro to release the resources
configured by ovs-vswitchd when exiting as it used to be.

Fixes: 0f28164be02ac ("netdev-linux: make tap devices persistent")
Fixes: fe13ccdca6a22 ("vswitchd: Add --cleanup option to the 'appctl
                       exit' command")

Reported-by: Eric Garver <e@erig.me>
Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agotest-hash: Fix unaligned pointer value error.
Joe Stringer [Fri, 26 May 2017 21:11:31 +0000 (14:11 -0700)]
test-hash: Fix unaligned pointer value error.

Clang 4.0 complains:

../tests/test-hash.c:160:16: error: taking address of packed member 'b' of
class or structure 'offset_ovs_u128' may result in an unaligned pointer value
      [-Werror,-Waddress-of-packed-member]
        in0 = &in0_data.b;

Set the bit in the aligned u128 first then copy the contents into the
offset u128 so that we don't have to take the address of the non-aligned
u128 and pass it to set_bit128.

For the 256byte_hash, fix it up so that it's actually testing the 256B
hash inside a 32-bit offset u128 as well.

Suggested-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agodocs: Update dpdk vdev naming instructions.
Ciara Loftus [Tue, 6 Jun 2017 15:26:18 +0000 (16:26 +0100)]
docs: Update dpdk vdev naming instructions.

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Stephen Finucane <stephen@that.guru>
7 years agoovn-sb.xml: Update and improve documentation.
Ben Pfaff [Wed, 7 Jun 2017 19:38:38 +0000 (12:38 -0700)]
ovn-sb.xml: Update and improve documentation.

Some of the abbreviations at the head of this document, like LN and PN,
turn out to not be very useful, so expand them for clarity.

Some of the statements in this document are more about planning the design
than the current design.  Remove these for clarity.

Port_Binding rows used to all be about physical locations, except for
patch ports, but there are more kinds of rows now.  Elaborate for clarity.

Expand on the purpose of the Datapath_Binding table.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
7 years agoCopy external_ids from Logical_Switch_Port to SB database
Daniel Alvarez Sanchez [Tue, 6 Jun 2017 10:08:03 +0000 (10:08 +0000)]
Copy external_ids from Logical_Switch_Port to SB database

This patch makes ovn-northd copy all string-string pairs in
external_ids column of the Logical_Switch_Port table in Northbound
database to the equivalent column of the Port_Binding table in
Southbound database.

OpenStack Neutron will add some useful data to NB database that can be
later read by networking-ovn-metadata-agent without the need of
maintaining a connection to NB database. This data would include
the CIDR's of a port or the project and device ID's which are needed
when talking to Nova to request metadata.

Signed-off-by: Daniel Alvarez <dalvarez@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agoovn-sb.xml: Fix indentation.
Dong Jun [Tue, 6 Jun 2017 08:00:17 +0000 (16:00 +0800)]
ovn-sb.xml: Fix indentation.

Signed-off-by: Dong Jun <dongj@dtdream.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovn: ssl proto/cipher configuration in nb/sb db
Lance Richardson [Wed, 7 Jun 2017 17:35:20 +0000 (13:35 -0400)]
ovn: ssl proto/cipher configuration in nb/sb db

Add SSL protocol and cipher columns to SSL tables in northbound
and southbound databases. Start nb/sb ovsdb-server with command-
line options to use these columns. Add support to ovn-nbctl
and ovn-sbctl "set-ssl" commands for user-friendly management
of these settings.

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoflow: Refactor ct_orig_tuple check in miniflow_extract().
Darrell Ball [Mon, 5 Jun 2017 13:34:33 +0000 (06:34 -0700)]
flow: Refactor ct_orig_tuple check in miniflow_extract().

The checks to populate ct_orig_tuple in miniflow_extract
include recirc_id being non-zero.  Now, ct_orig_tuple
is only populated if the packet has passed through the
connection tracker, which is a prerequisite for having
valid ct_orig_tuple information.  This is recognized by
having a non-zero ct_state.  This has an added benefit
of saving some processing time.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodpdk: Move tcp_payload_length to include file.
Darrell Ball [Tue, 30 May 2017 21:21:33 +0000 (14:21 -0700)]
dpdk: Move tcp_payload_length to include file.

The function tcp_payload_length is moved to a private
include file to be used by other conntrack files.  A
sanity check is added for general use, although
previous usage was safe in that filtering is already
done by the time it is called.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agotests: Export PYTHONCOERCECLOCALE=0 for python3 tests
Timothy Redaelli [Mon, 5 Jun 2017 13:28:38 +0000 (15:28 +0200)]
tests: Export PYTHONCOERCECLOCALE=0 for python3 tests

This patch exports PYTHONCOERCECLOCALE=0 when you have Python3 tests
enabled.
This is needed since testsuite forces LC_ALL=C and Python 3, with PEP 538,
prints the following warning on stderr:

"Python runtime initialized with LC_CTYPE=C (a locale with default ASCII
encoding), which may cause Unicode compatibility problems. Using C.UTF-8,
C.utf8, or UTF-8 (if available) as alternative Unicode-compatible locales is
recommended."

AT_CHECK reports it as an error since stderr is not empty as it should be.

This patch is needed, at least, on Fedora 26 and Rawhide (backported PEP
538 on Python 3.6).
This will also be needed on any distribution with Python 3.7 (PEP 538).

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agostream: include ssl protocol/cipher options in run-time help
Lance Richardson [Wed, 7 Jun 2017 14:54:52 +0000 (10:54 -0400)]
stream: include ssl protocol/cipher options in run-time help

Include --ssl-protocols and --ssl-ciphers options in run-time
help output.

Sample output with this change:

PKI configuration (required to use SSL):
  -p, --private-key=FILE  file with private key
  -c, --certificate=FILE  file with certificate for private key
  -C, --ca-cert=FILE      file with peer CA certificate
  --bootstrap-ca-cert=FILE  file with peer CA certificate to read or create
SSL options:
  --ssl-protocols=PROTOS  list of SSL protocols to enable
  --ssl-ciphers=CIPHERS   list of SSL ciphers to enable

Output formatting options:

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agonetdev-linux: maintain original device's state
Flavio Leitner [Mon, 29 May 2017 19:40:23 +0000 (16:40 -0300)]
netdev-linux: maintain original device's state

It is important to maintain the original state when
the device already exists in the system.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agonetdev-linux: make tap devices persistent.
Flavio Leitner [Mon, 29 May 2017 19:40:22 +0000 (16:40 -0300)]
netdev-linux: make tap devices persistent.

When using data path type "netdev", bridge port is a tun device
and when OVS restarts, that device and its network configuration
is lost.

This patch enables the tap device to persist instead.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovs-router: fix refcnt leak when program terminates.
Flavio Leitner [Mon, 29 May 2017 19:40:21 +0000 (16:40 -0300)]
ovs-router: fix refcnt leak when program terminates.

Install a handler to flush routes and release devices when
the program is terminating.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodocs: Document dpdkr ports
Stephen Finucane [Fri, 26 May 2017 14:12:38 +0000 (15:12 +0100)]
docs: Document dpdkr ports

I has an idea what these were but that idea was somewhat incorrect and
out-of-date. Add a minimal guide to fill in these gaps, along with a
warning about how useless these things generally are now (yay,
vhost-user).

Signed-off-by: Stephen Finucane <stephen@that.guru>
Cc: Ciara Loftus <ciara.loftus@intel.com>
Cc: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodocs: Clarify the superiority of dpdkvhostuserclient
Stephen Finucane [Fri, 26 May 2017 14:12:37 +0000 (15:12 +0100)]
docs: Clarify the superiority of dpdkvhostuserclient

Apparently dpdkvhostuser interfaces are inferior to dpdkvhostuserclient.
Explain why.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Cc: Ciara Loftus <ciara.loftus@intel.com>
Cc: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
7 years agoovn-controller: refactor and abstract ovs_idl registering
Han Zhou [Fri, 26 May 2017 00:26:46 +0000 (17:26 -0700)]
ovn-controller: refactor and abstract ovs_idl registering

Abstract as a function so that it can be used by other modules.

Signed-off-by: Han Zhou <zhouhan@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agobfd: Detect Multiplier configuration
Szucs Gabor [Tue, 6 Jun 2017 15:11:54 +0000 (17:11 +0200)]
bfd: Detect Multiplier configuration

Mult value (bfd.DetectMult in RFC5880) is hard-coded and equal to 3 in
current openvswitch. As a consequence remote and local mult is the same.

In this commit the mult (Detect Multiplier/bfd.DetectMult/Detect Mult)
can be set on each interface setting the mult=<value> in bfd Column
in Interface table of ovsdb database.
Example:
ovs-vsctl set Interface p1 bfd:mult=4
sets mult=4 on p1 interface

The modification based on RFC5880 June 2010.
The relevant paragraphs are:
4.1. Generic BFD Control Packet Format
6.8.4. Calculating the Detection Time
6.8.7. Transmitting BFD Control Packets
6.8.12. Detect Multiplier Change

The mult value is set to default 3 if it is not set in ovsdb. This
provides backward compatibility to previous openvswitch behaviour.
The RFC5880 says in 6.8.1 that DetectMult shall be a non-zero integer.
In RFC5880 4.1. "Detect Mult" has 8 bit length and is declared
as a 8 bit unsigned integer in bfd.c.
Consequently mult value shall be greater than 0 and less then 256.
In case of incorrect mult value is given in ovsdb the default value (3)
will be set and a message is logged into ovs-vswitchd.log on that.
Local or remote mult value change is also logged into ovs-vswitchd.log.

Since remote and local mult is not the same calculation of detect time
has been changed. Due to RFC5880 6.8.4 Detection Time is calculated using
mult value of the remote system.
Detection time is recalculated due to remote mult change.

The BFD packet transmission jitter is different in case of mult=1
due to RFC5880 6.8.7. The maximum interval of the transmitted bfd packet
is 90% of the transmission interval.

The value of remote mult is printed in the last line of the output of
ovs-appctl bfd/show command with label: Remote Detect Mult.

There is a feature in openvswitch connected with forwarding_if_rx that
is not the part of RFC5880. This feature also uses mult value but it is
not specified if local or remote since it was the
same in original code. The relevant description in code:
   /* When 'bfd->forwarding_if_rx' is set, at least one bfd control packet
     * is required to be received every 100 * bfd->cfg_min_rx.  If bfd
     * control packet is not received within this interval, even if data
     * packets are received, the bfd->forwarding will still be false. */

Due to lack of specification local mult value is used for calculation of
forwarding_if_rx_detect_time. This detect time is recalculated at mult
change if forwarding_if_rx is true and bfd is in UP state.

A new unit test has been added: "bfd - Edit the Detect Mult values"
The following cases are tested:
- Without setting mult the mult will be the default value (3).
- The setting of the lowest (1) and highest (255) valid mult value
  and the detection of remote mult value.
- The setting of out of range mult value (0, 256) in ovsdb results
  sets default value in ovs-vswitchd
- Clearing non default mult value from ovsdb results sets default
  value in ovs-vswitchd.

Signed-off-by: Gábor Szűcs <gabor.sz.cs@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agotests: Fix spelling error in test name.
Ben Pfaff [Fri, 2 Jun 2017 16:13:30 +0000 (09:13 -0700)]
tests: Fix spelling error in test name.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
7 years agodpdk: Update feature alert documentation.
Darrell Ball [Tue, 30 May 2017 17:49:33 +0000 (10:49 -0700)]
dpdk: Update feature alert documentation.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Daniele Di Proietto <diproiettod@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodpdk: Enable NAT tests for userspace datapath.
Darrell Ball [Tue, 30 May 2017 17:49:32 +0000 (10:49 -0700)]
dpdk: Enable NAT tests for userspace datapath.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Daniele Di Proietto <diproiettod@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agotests: Add some system test fixes.
Darrell Ball [Tue, 30 May 2017 17:49:31 +0000 (10:49 -0700)]
tests: Add some system test fixes.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Daniele Di Proietto <diproiettod@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoSystem Tests: Enhance NAT tests.
Darrell Ball [Tue, 30 May 2017 17:49:30 +0000 (10:49 -0700)]
System Tests: Enhance NAT tests.

Two new tests are added and two other tests were
enhanced.  The use of tcpdump to verify checksums
is introduced.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Daniele Di Proietto <diproiettod@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodpdk: Add orig tuple context recovery.
Darrell Ball [Tue, 30 May 2017 17:49:29 +0000 (10:49 -0700)]
dpdk: Add orig tuple context recovery.

This patch adds orig tuple checking and context
recovery; NAT interactions are factored in.
Orig tuple support exists to better handle policy
changes.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Acked-by: Daniele Di Proietto <diproiettod@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodpdk: Add more ICMP Related NAT support.
Darrell Ball [Tue, 30 May 2017 17:49:28 +0000 (10:49 -0700)]
dpdk: Add more ICMP Related NAT support.

This patch includes more complete support
for icmp4 and icmp6 related NAT handling.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Acked-by: Daniele Di Proietto <diproiettod@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodpdk: Userspace Datapath: Introduce NAT Support.
Darrell Ball [Tue, 30 May 2017 17:49:27 +0000 (10:49 -0700)]
dpdk: Userspace Datapath: Introduce NAT Support.

This patch introduces NAT support for the userspace datapath.
Most conntrack module changes are in this patch, with the
exception of icmp related handling and recent orig tuple
support.

The per packet scope of lookups for NAT and un_NAT is at
the bucket level rather than global. One hash table is
introduced to support create/delete handling. The create/delete
events may be further optimized, if the need becomes clear.

Some NAT options with limited utility (persistent, random) are
not supported yet, but will be supported in a later patch.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Daniele Di Proietto <diproiettod@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodpdk: Remove batch sorting in userspace conntrack.
Darrell Ball [Tue, 30 May 2017 17:49:26 +0000 (10:49 -0700)]
dpdk: Remove batch sorting in userspace conntrack.

Packet batch sorting is removed for three reasons:

1) The following patches for NAT change the locking
    marshalling so batching loses benefit.

2) For real mixtures of flows either in hypervisors
   or gateways, the batch sorting won't provide benefit
   and will just be a tax.

3) Code clarity.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Daniele Di Proietto <diproiettod@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>