]> git.proxmox.com Git - mirror_ovs.git/log
mirror_ovs.git
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>
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>