]> git.proxmox.com Git - mirror_ovs.git/log
mirror_ovs.git
6 years agobuild-windows: Suppress output from MSBuild
Alin Gabriel Serdean [Mon, 6 Nov 2017 10:11:58 +0000 (12:11 +0200)]
build-windows: Suppress output from MSBuild

Add `nologo` parameter to MSBuild to suppress the banner.

This will make tidier log messages.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
6 years agoofp-actions: Add compare to offsetof need for MSVC 2015/17
Alin Gabriel Serdean [Wed, 1 Nov 2017 17:19:07 +0000 (19:19 +0200)]
ofp-actions: Add compare to offsetof need for MSVC 2015/17

Unfortunately starting from VS 2015, the "C" definition for `offsetof`
has been changed. Please see:
https://stackoverflow.com/questions/42725929/using-offsetof-with-enum-does-not-compile-in-visual-studio-2015/42726424

Several people reported the bug for 2015 and also 2017 (i.e. :
https://developercommunity.visualstudio.com/content/problem/22196/static-assert-cannot-compile-constexprs-method-tha.html
), but we don't have a fix yet.

This patch adds an explicit compare, although we could redefine the macro
for the same effect.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Acked-by: Anand Kumar <kumaranand@vmware.com>
6 years agobuild-windows: Add check for struct timespec
Alin Gabriel Serdean [Wed, 1 Nov 2017 17:19:06 +0000 (19:19 +0200)]
build-windows: Add check for struct timespec

Starting from WDK 10 the structure `timespec` is defined in <time.h>.

This patch adds a check for the structure to make <pthread.h> aware of it, so
it doesn't try to redefine the structure.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Acked-by: Anand Kumar <kumaranand@vmware.com>
6 years agowindows: Add interlocked function definitions for VS 2015
Alin Gabriel Serdean [Wed, 1 Nov 2017 17:19:05 +0000 (19:19 +0200)]
windows: Add interlocked function definitions for VS 2015

For some unclear and accidental reasons, the Windows 10 SDK
renamed _Interlocked* functions to _InlineInterlocked* (although the
documentation still points to the old form:
https://msdn.microsoft.com/en-us/library/191ca0sk.aspx).

This patch adds mappings for used functions.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Acked-by: Anand Kumar <kumaranand@vmware.com>
6 years agowindows: _set_output_format is no longer required from VS2015
Alin Gabriel Serdean [Wed, 1 Nov 2017 17:19:04 +0000 (19:19 +0200)]
windows: _set_output_format is no longer required from VS2015

_set_output_format is deprecated ang no longer required
starting from MSC_VER 1900 (VS 2015):
https://msdn.microsoft.com/en-us/library/bb531344(v=vs.140).aspx .

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Acked-by: Anand Kumar <kumaranand@vmware.com>
6 years agonetdev, dpif: fix the crash/assert on port delete
Ashish Varma [Mon, 6 Nov 2017 20:17:45 +0000 (12:17 -0800)]
netdev, dpif: fix the crash/assert on port delete

a crash is seen in "netdev_ports_remove" when an interface is deleted and added
back in the system and when the interface is part of a bridge configuration.
e.g. steps:
  create a tap0 interface using "ip tuntap add.."
  add the tap0 interface to br0 using "ovs-vsctl add-port.."
  delete the tap0 interface from system using "ip tuntap del.."
  add the tap0 interface back in system using "ip tuntap add.."
                       (this changes the ifindex of the interface)
  delete tap0 from br0 using "ovs-vsctl del-port.."

In the function "netdev_ports_insert", two hmap entries were created for
mapping "portnum -> netdev" and "ifindex -> portnum".
When the interface is deleted from the system, the "netdev_ports_remove"
function is not getting called and the old ifindex entry is not getting
cleaned up from the "ifindex_to_port" hmap.

As part of the fix, added function "dpif_port_remove" which will call
"netdev_ports_remove" in the path where the interface deletion from the system
is detected.
Also, in "netdev_ports_remove", added the code where the "ifindex_to_port_data"
(ifindex -> portnum map node) is getting freed when the ifindex is not
available any more. (as the interface is already deleted.)

VMware-BZ: #1975788
Signed-off-by: Ashish Varma <ashishvarma.ovs@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovs-tcpdump: handle large interface names on linux
Aaron Conole [Fri, 10 Nov 2017 22:33:20 +0000 (17:33 -0500)]
ovs-tcpdump: handle large interface names on linux

Linux has a fixed size interface name, which will not change.  This means
that attempts to dump interfaces whose names are larger than the max size
will result in an error making the tap device.

This commit brings a new function.  When the generated name would be too
large, use a random number prefixed by 'ovsmi' instead.

Reported-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn: Add document describing new features in OVN added in version 2.8.
Ben Pfaff [Thu, 9 Nov 2017 22:02:29 +0000 (14:02 -0800)]
ovn: Add document describing new features in OVN added in version 2.8.

This is adapted from a talk I gave at OpenStack Summit Sydney on Nov. 6.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Acked-by: Miguel Angel Ajo <majopela@redhat.com>
6 years agoovs-ctl: Don't remember vport-* kernel modules
Gurucharan Shetty [Fri, 10 Nov 2017 22:30:00 +0000 (14:30 -0800)]
ovs-ctl: Don't remember vport-* kernel modules

From OVS 2.8, ovs-vswitchd, when it starts, will
load the kernel modules for tunnels. It has logic
inside it to choose either upstream kernel module
or vport-* kernel module.

So, when we run 'force-reload-kmod' to upgrade to
OVS 2.8 from a previous version,  we do not need to
remember the vport-* kernel module that was previously
loaded.  It is not really harmful to load vport-* kernel
module though.

On RHEL7.x and OVS 2.8, we use the upstream "geneve" kernel
module for tunnels.

But, on RHEL 7.x we have hit a bug caused by iptables
startup script which tries to remove all kernel modules
related to linux conntrack. It fails to unload openvswitch
kernel module because it has a reference count on it. But it
succeeds in unloading vport-geneve and in turn the upstream
"geneve" kernel module.  This causes the tunnels to go down.

With this patch, we avoid the above situation, by not loading
vport-geneve kernel module.  ovs-vswitchd when it starts will
load upstream geneve. And when "iptables stop" runs, since
"geneve" has nothing to do with conntrack, it spares it.
Ideally, we should fix this by incrementing the refcount
on the kernel modules.

Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Acked-by: William Tu <u9012063@gmail.com>
6 years agodpif-netdev: Remove unnecessary resets on new rxqs.
Kevin Traynor [Sun, 12 Nov 2017 11:47:18 +0000 (11:47 +0000)]
dpif-netdev: Remove unnecessary resets on new rxqs.

Commit 38259bd7eb21 (dpif-netdev: Initialize new rxqs in
port_reconfigure().) added a memset for the dp_netdev_rxq of new rxq's
to remove a valgrind warning for an index field in that struct.  With
the addition of that memset, it also means there are some existing
resets on other fields in that struct that are no longer needed and
gives the opportunity to simplify by removing them.

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev: Remove EOPNOTSUPP related comment for netdev_send().
Ilya Maximets [Thu, 9 Nov 2017 12:34:08 +0000 (15:34 +0300)]
netdev: Remove EOPNOTSUPP related comment for netdev_send().

Since 57eebbb4c315, the caller must make sure that 'netdev' supports
sending. This mentioned at the start of the comment.

Fixes: 57eebbb4c315 ("dpif-netdev: Don't try to output on a device without txqs.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agoNSH: Adjust NSH wire format to the latest IETF draft
Jan Scheurich [Mon, 6 Nov 2017 23:40:21 +0000 (00:40 +0100)]
NSH: Adjust NSH wire format to the latest IETF draft

This commit adjusts the NSH user space implementation in OVS to
the latest wire format defined in draft-ietf-sfc-nsh-28 (November 3
2017). The NSH_MDTYPE field was reduced from 8 to 4 bits. The FLAGS
field is reduced from 8 to 2 bits. A new 6 bit TTL header field is
added. The TTL field is set to 63 at encap(nsh).

Match and set_field support for the newly introduced TTL header field
and a corresponding dec_nsh_ttl action is not yet included and will be
implemented in a future patch.

Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoNSH: Minor bugfixes
Jan Scheurich [Tue, 7 Nov 2017 14:48:39 +0000 (15:48 +0100)]
NSH: Minor bugfixes

- Fix 2 incorrect length checks
- Remove unnecessary limit of MD length to 16 bytes
- Remove incorrect comments stating MD2 was not supported
- Pad metadata in encap_nsh with zeroes if not multiple of 4 bytes

Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agorhel: Add support for "systemctl reload openvswitch"
Timothy Redaelli [Fri, 3 Nov 2017 20:39:17 +0000 (21:39 +0100)]
rhel: Add support for "systemctl reload openvswitch"

The reload procedure will trigger a script that saves the flows and tlv
maps (using ovs-save) then it restarts ovsdb-server, it stops ovs-vswitchd,
it sets other_config:flow-restore-wait=true (to wait till flow restore is
finished), it starts ovs-vswitchd, it restore the backupped flows/tlv
maps and it removes other_config:flow-restore-wait=true (logic mostly ripped
from ovs-ctl).

It uses systemctl with --job-mode=ignore-dependencies to restart ovsdb-server
and stop and start ovs-vswitchd in order to avoid systemd to restart the other
components due to dependencies (as explained in rhel/README.RHEL.rst).

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Flavio Leitner <fbl@sysclose.org>
6 years agoDocumentation: Fix for userspace testsuite directory name
László Sürü [Wed, 8 Nov 2017 10:20:20 +0000 (10:20 +0000)]
Documentation: Fix for userspace testsuite directory name

Open vSwitch Testing documentation Userspace datapath section shows incorrect directory name for test result.
Morever to this check-system-userspace test fails if another OVS instance is running.
This patch corrects the directory name and adds a note for other running instances.

Signed-off-by: László Sürü <laszlo.suru@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agovswitch.xml: Fix nonbreaking spaces.
Ben Pfaff [Wed, 8 Nov 2017 09:35:16 +0000 (01:35 -0800)]
vswitch.xml: Fix nonbreaking spaces.

Fixes: fb9fdd72893d ("vswitchd: Document option dst_port.")
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agovswitchd: Document option dst_port.
duanjiong [Mon, 6 Nov 2017 05:43:23 +0000 (13:43 +0800)]
vswitchd: Document option dst_port.

Otherwise the user does not know how to change it

Signed-off-by: Duan Jiong <djduanjiong@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agopackets: Move declarations inside extern "C".
duanjiong [Mon, 6 Nov 2017 06:06:12 +0000 (14:06 +0800)]
packets: Move declarations inside extern "C".

It doesn't matter but it seems "more correct" this way.

Signed-off-by: Duan Jiong <djduanjiong@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoconntrack: Include <sys/types.h> before <netinet/icmp6.h>.
Borja Marcos EA2EKH [Mon, 6 Nov 2017 09:32:12 +0000 (10:32 +0100)]
conntrack: Include <sys/types.h> before <netinet/icmp6.h>.

FreeBSD and Mac OS X require this.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodpctl: manage ret value when dumping CT entries.
antonio.fischetti@intel.com [Tue, 26 Sep 2017 09:37:09 +0000 (10:37 +0100)]
dpctl: manage ret value when dumping CT entries.

Manage error value returned by ct_dpif_dump_next.

Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agoAUTHORS: Add Matteo Croce.
Ben Pfaff [Fri, 3 Nov 2017 21:51:24 +0000 (14:51 -0700)]
AUTHORS: Add Matteo Croce.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovs-lib: dont't purge corrupted DB
Matteo Croce [Wed, 27 Sep 2017 13:46:13 +0000 (15:46 +0200)]
ovs-lib: dont't purge corrupted DB

In ovs-lib there is a function named upgrade_db which tries to convert a
database after OVS {up,down}grades. This function uses ovsdb-tool to
check if the DB needs to be upgraded. If the upgrade fails,
it purges the DB and create an empty one.
ovsdb-tool returns "yes" or "no" to indicate if the DB needs upgrading,
but if the DB is corrupted it returns a list of errors.
Change a condition from "!= no" to "= yes" because in case of DB
corruption upgrade_db would purge the existing DB without writing
anything in the logs.

Signed-off-by: Matteo Croce <mcroce@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
6 years agodpctl: Comment functions retrieving the datapath name.
antonio.fischetti@intel.com [Fri, 13 Oct 2017 08:25:13 +0000 (09:25 +0100)]
dpctl: Comment functions retrieving the datapath name.

Add a comment to functions retrieving the datapath name.

CC: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn: Fix remote not receive GARP, when localnet Port has vlan tag.
Guoshuai Li [Fri, 13 Oct 2017 14:09:51 +0000 (22:09 +0800)]
ovn: Fix remote not receive GARP, when localnet Port has vlan tag.

When sending a localnet port with vlan, the GARP packet needs push_vlan.

Signed-off-by: Guoshuai Li <ligs@dtdream.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodpif-netdev: Set MAX_RECIRC_DEPTH to 6.
Guoshuai Li [Fri, 22 Sep 2017 14:49:43 +0000 (22:49 +0800)]
dpif-netdev: Set MAX_RECIRC_DEPTH to 6.

In an ovn gateway node with DPDK, the RECIRC_DEPTH may be greater than 5.

Scenes:
VM ping self floating IP, or
VM ping Floating IP of VMs with the same network.

It need process UNDNAT SNAT in LRouter egress and
UNSNAT DNAT in LRouter ingress, and
output to geneve tunnel also need recirc.

This has an WARN:
dpif_netdev(pmd36)|WARN|Packet dropped. Max recirculation depth exceeded.

Signed-off-by: Guoshuai Li <ligs@dtdream.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovsdb: Remove break after OVS_NOT_REACHED.
Bhanuprakash Bodireddy [Sun, 1 Oct 2017 07:57:40 +0000 (08:57 +0100)]
ovsdb: Remove break after OVS_NOT_REACHED.

The break statement would never be executed as OVS_NOT_REACHED()
internally invokes abort() and causes process termination.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofp-actions: Remove return after OVS_NOT_REACHED.
Bhanuprakash Bodireddy [Sun, 1 Oct 2017 07:57:39 +0000 (08:57 +0100)]
ofp-actions: Remove return after OVS_NOT_REACHED.

The return statement would never be executed as OVS_NOT_REACHED()
internally invokes abort() and causes process termination.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto: Remove break after OVS_NOT_REACHED.
Bhanuprakash Bodireddy [Sun, 1 Oct 2017 07:57:38 +0000 (08:57 +0100)]
ofproto: Remove break after OVS_NOT_REACHED.

The break statement would never be executed as OVS_NOT_REACHED()
internally invokes abort() and causes process termination.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev-dpdk: Refactor netdev_dpdk structure.
Bhanuprakash Bodireddy [Sun, 1 Oct 2017 07:57:37 +0000 (08:57 +0100)]
netdev-dpdk: Refactor netdev_dpdk structure.

This commit introduces below changes to netdev_dpdk structure.

- Mark cachelines and reorder few member variables.
- Maintain the grouping of related member variables.
- Add comment on the information on pad bytes where ever appropriate, so
  new members can be introduced in the future to fill the gaps.

  Below is how this structure looks with this commit.

                  Member                    size

         OVS_CACHE_LINE_MARKER cacheline0;
             dpdk_port_t port_id;            1
             bool attached;                  1
             ...

         OVS_CACHE_LINE_MARKER cacheline1;
             struct ovs_mutex;              48
             struct dpdk_mp *dpdk_mp;        8
             ...

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodpif_netdev: Refactor dp_netdev_pmd_thread structure.
Bhanuprakash Bodireddy [Sun, 1 Oct 2017 07:57:36 +0000 (08:57 +0100)]
dpif_netdev: Refactor dp_netdev_pmd_thread structure.

This commit introduces below changes to dp_netdev_pmd_thread
structure.

- Mark cachelines and in this process reorder few members to avoid
  holes.
- Align emc_cache to a cacheline.
- Maintain the grouping of related member variables.
- Add comment on the information on pad bytes whereever appropriate so
  that new member variables may be introduced to fill the holes in future.

  Below is how the structure looks with this commit.

              Member                    size

     OVS_CACHE_LINE_MARKER cacheline0;
         struct dp_netdev * dp;          8
         struct cmap_node node;          8
         pthread_cond_t cond;           48

     OVS_CACHE_LINE_MARKER cacheline1;
         struct ovs_mutex cond_mutex;   48
         pthread_t  thread;              8
         unsigned int core_id;           4
         int        numa_id;             4

     OVS_CACHE_LINE_MARKER cacheline2;
         struct emc_cache flow_cache;   4849672

     ###cachelineX: 64 bytes, 0 pad bytes####
         struct cmap flow_table;         8
         ....

     ###cachelineY: 59 bytes, 5 pad bytes####
       struct dp_netdev_pmd_stats stats 40
         ....

     ###cachelineZ: 48 bytes, 16 pad bytes###
         struct ovs_mutex port_mutex;   48
         ....

This change also improve the performance marginally.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agocmap: Use PADDED_MEMBERS_CACHELINE_MARKER in cmap_impl.
Bhanuprakash Bodireddy [Sun, 1 Oct 2017 07:57:35 +0000 (08:57 +0100)]
cmap: Use PADDED_MEMBERS_CACHELINE_MARKER in cmap_impl.

Instead of explicitly adding the pad bytes to force the structure an
exact multiple of cacheline size, let the macro do the job. This way
the pad bytes will be auto adjusted when the new members get introduced
in to the structure.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoccmap: Use PADDED_MEMBERS macro in ccmap_impl structure.
Bhanuprakash Bodireddy [Sun, 1 Oct 2017 07:57:34 +0000 (08:57 +0100)]
ccmap: Use PADDED_MEMBERS macro in ccmap_impl structure.

Instead of explicitly adding the pad bytes to force the structure an exact
multiple of cacheline size, let the PADDED_MEMBERS macro do the job.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoodp-execute: Use const qualifer for batch size.
Bhanuprakash Bodireddy [Wed, 20 Sep 2017 13:12:59 +0000 (14:12 +0100)]
odp-execute: Use const qualifer for batch size.

It is recommended to use const qualifer for 'num' that tracks the
packet batch count. This way 'num' can't be modified by iterator.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev-linux: Clean up netdev_linux_sock_batch_send().
Bhanuprakash Bodireddy [Wed, 20 Sep 2017 13:12:56 +0000 (14:12 +0100)]
netdev-linux: Clean up netdev_linux_sock_batch_send().

Use DP_PACKET_BATCH_FOR_EACH macro and dp_packet_batch_size() API
in netdev_linux_sock_batch_send().

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev-linux: Use DP_PACKET_BATCH_FOR_EACH in netdev_linux_tap_batch_send.
Bhanuprakash Bodireddy [Wed, 20 Sep 2017 13:12:51 +0000 (14:12 +0100)]
netdev-linux: Use DP_PACKET_BATCH_FOR_EACH in netdev_linux_tap_batch_send.

Use DP_PACKET_BATCH_FOR_EACH macro in netdev_linux_tap_batch_send().

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodpif-netdev: Reorder elements in dp_netdev_rxq structure.
Bhanuprakash Bodireddy [Fri, 8 Sep 2017 17:59:20 +0000 (18:59 +0100)]
dpif-netdev: Reorder elements in dp_netdev_rxq structure.

By reordering elements in dp_netdev_rxq structure, pad bytes and a hole
can be removed.

Before: structure size: 104, sum holes: 1, sum padbytes:4, cachelines:2
After : structure size:  96, sum holes: 0, sum padbytes:0, cachelines:2

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev-provider: Reorder elements in netdev structure.
Bhanuprakash Bodireddy [Fri, 8 Sep 2017 17:59:19 +0000 (18:59 +0100)]
netdev-provider: Reorder elements in netdev structure.

By reordering elements in netdev structure, holes can be removed.

Before: structure size: 88, sum holes: 10, cachelines:2
After : structure size: 80, sum holes:  2, cachelines:2

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev-provider: Reorder element in netdev_flow_dump structure.
Bhanuprakash Bodireddy [Fri, 8 Sep 2017 17:59:18 +0000 (18:59 +0100)]
netdev-provider: Reorder element in netdev_flow_dump structure.

By reordering bool in netdev_flow_dump structure, pad bytes can be
reduced.

Before: structure size: 32, sum holes: 4, sum padbytes:7, cachelines:1
After : structure size: 24, sum holes: 3, sum padbytes:0, cachelines:1

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev: Reorder elements in netdev_tunnel_config structure.
Bhanuprakash Bodireddy [Fri, 8 Sep 2017 17:59:17 +0000 (18:59 +0100)]
netdev: Reorder elements in netdev_tunnel_config structure.

By reordering elements in netdev_tunnel_config structure, sum holes and
pad bytes can be reduced.

Before: structure size: 96, sum holes: 17, pad bytes: 4, cachelines:2
After : structure size: 80, sum holes:  5, pad bytes: 0, cachelines:2

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev-dummy: Reorder elements in dummy_packet_stream structure.
Bhanuprakash Bodireddy [Fri, 8 Sep 2017 17:59:14 +0000 (18:59 +0100)]
netdev-dummy: Reorder elements in dummy_packet_stream structure.

By reordering elements in dummy_packet_stream structure, sum holes
can be reduced, thus saving a cache line.

Before: structure size: 784, sum holes: 56, cachelines:13
After : structure size: 768, sum holes: 40, cachelines:12

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agotun-metadata: Reorder elements in tun_meta_entry structure.
Bhanuprakash Bodireddy [Fri, 8 Sep 2017 17:59:15 +0000 (18:59 +0100)]
tun-metadata: Reorder elements in tun_meta_entry structure.

By reordering elements in tun_meta_entry structure, sum holes and pad
bytes can be reduced there by reducing the tun_table size.

Before: structure size: 56, sum holes: 4, pad bytes: 7  cachelines:1
After : structure size: 48, sum holes: 0, pad bytes: 3, cachelines:1

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agobond: Reorder elements in bond_slave structure.
Bhanuprakash Bodireddy [Fri, 8 Sep 2017 17:59:13 +0000 (18:59 +0100)]
bond: Reorder elements in bond_slave structure.

By reordering elements in bond_slave structure, holes can be removed and
saves a cache line.

Before: structure size: 136, sum holes: 10, cachelines:3
After : structure size: 128, sum holes:  2, cachelines:2

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto-dpif: Put bundle_lookup ahead to simplify the code.
Duan Jiong [Fri, 8 Sep 2017 01:51:38 +0000 (09:51 +0800)]
ofproto-dpif: Put bundle_lookup ahead to simplify the code.

Signed-off-by: Duan Jiong <djduanjiong@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agoAUTHORS: Add Duan Jiong.
Ben Pfaff [Fri, 3 Nov 2017 19:24:13 +0000 (12:24 -0700)]
AUTHORS: Add Duan Jiong.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto-dpif: Fix comment in struct ofbundle.
Duan Jiong [Fri, 8 Sep 2017 01:34:07 +0000 (09:34 +0800)]
ofproto-dpif: Fix comment in struct ofbundle.

The ovs_list ports should contain struct ofport_dpif.

Signed-off-by: Duan Jiong <djduanjiong@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agolib: Remove lib/pool-loop.h from lib_libopenvswitch_la_SOURCES
Timothy Redaelli [Fri, 3 Nov 2017 18:18:05 +0000 (19:18 +0100)]
lib: Remove lib/pool-loop.h from lib_libopenvswitch_la_SOURCES

lib/pool-loop.h is moved to to include/openvswitch, but lib/pool-loop.h
is still used in lib_libopenvswitch_la_SOURCES.

This commit removes lib/pool-loop.h from lib_libopenvswitch_la_SOURCES.

CC: Xiao Liang <shaw.leon@gmail.com>
Fixes: fd016ae3fb84 ("lib: Move lib/poll-loop.h to include/openvswitch")
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agolib: Move lib/poll-loop.h to include/openvswitch
Xiao Liang [Fri, 3 Nov 2017 05:53:53 +0000 (13:53 +0800)]
lib: Move lib/poll-loop.h to include/openvswitch

Poll-loop is the core to implement main loop. It should be available in
libopenvswitch.

Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agometa-flow: Fix format in documentation.
Yi-Hung Wei [Fri, 3 Nov 2017 17:32:57 +0000 (10:32 -0700)]
meta-flow: Fix format in documentation.

Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofp-util: Update OpenFlow 1.6 port support to track latest proposal.
Ben Pfaff [Fri, 14 Jul 2017 19:51:43 +0000 (12:51 -0700)]
ofp-util: Update OpenFlow 1.6 port support to track latest proposal.

The latest updates to the OpenFlow 1.6 proposal removes the hw_addr_type
fields from ofp_port and ofp_port_mod.  This commit updates the OVS
prototype to match the updated proposal.

ONF-JIRA: EXT-566
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
6 years agoovn-northd.8: Fix wrong description
wei [Fri, 3 Nov 2017 01:08:26 +0000 (09:08 +0800)]
ovn-northd.8: Fix wrong description

Signed-off-by: wei <liw@dtdream.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoNEWS: Add recently added OVN IPv6 features
Numan Siddique [Fri, 3 Nov 2017 03:43:16 +0000 (09:13 +0530)]
NEWS: Add recently added OVN IPv6 features

OVN now supports sending IPv6 RA packet in response to the RS packet
and resolves the unknown next hop MACs by generating a NS packet.

Mention this in the NEWS.

Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoDocumentation: Add the Open vSwitch project charter.
Ben Pfaff [Tue, 24 Oct 2017 16:33:07 +0000 (09:33 -0700)]
Documentation: Add the Open vSwitch project charter.

It always seems odd that this isn't in the repo, so this adds it, with
internal links properly directed.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
6 years agoofproto-dpif-upcall: Transition ukey on dp_ops error.
Joe Stringer [Wed, 6 Sep 2017 22:12:52 +0000 (15:12 -0700)]
ofproto-dpif-upcall: Transition ukey on dp_ops error.

In most situations, we don't expect that a flow we've successfully
dumped, which we intend to delete, cannot be deleted. However, to make
this code more resilient to ensure that ukeys *will* transition in all
cases (including an error at this stage), grab the lock and transition
this ukey forward to the evicted state, effectively treating a failure
to delete as "this flow is already gone".

If we subsequently find out that it wasn't deleted, then that's ok - we
will re-dump, and validate at that stage, which should lead to creating
a new ukey or deleting the datapath flow when that happens.

Signed-off-by: Joe Stringer <joe@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agodpif-netlink-rtnl: Fix ovs_geneve probing after restart.
William Tu [Thu, 2 Nov 2017 19:01:17 +0000 (12:01 -0700)]
dpif-netlink-rtnl: Fix ovs_geneve probing after restart.

When using the out-of-tree (openvswitch compat) geneve module,
the first time oot tunnel probing returns true (correct).
Without unloading the geneve module, if the userspace ovs-vswitchd
restarts, because the 'geneve_sys_6081' still exists, the probing
incorrectly returns false and loads the in-tree (upstream kernel)
geneve module.

The patch fixes it by querying the geneve device's kind when exists.
The out-of-tree modules uses kind string as 'ovs_geneve', while the
in-tree module uses 'geneve'.  To reproduce the issue, start the ovs
> /etc/init.d/openvswitch-switch start
> creat a bridge and attach a geneve port using out-of-tree geneve
> /etc/init.d/openvswitch-switch restart

Fixes: 921c370a9df5 ("dpif-netlink: Probe for out-of-tree tunnels, decides used interface")
Signed-off-by: William Tu <u9012063@gmail.com>
Acked-by: Eric Garver <e@erig.me>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
6 years agoovsdb-server: Fix memory leak
Yifeng Sun [Tue, 31 Oct 2017 17:52:10 +0000 (10:52 -0700)]
ovsdb-server: Fix memory leak

Valgrind testcase 2349 (ovn -- DSCP marking check) reports the leak below:
21 bytes in 21 blocks are definitely lost in loss record 24 of 362
    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x436FD4: xmalloc (util.c:120)
    by 0x437044: xmemdup0 (util.c:150)
    by 0x408C97: add_manager_options (ovsdb-server.c:709)
    by 0x408C97: query_db_remotes (ovsdb-server.c:765)
    by 0x408C97: reconfigure_remotes (ovsdb-server.c:926)
    by 0x406273: main_loop (ovsdb-server.c:194)
    by 0x406273: main (ovsdb-server.c:434)

When options are freed, options->role need to be freed explicitly.

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agotest-ovsdb: Fix memory leak
Yifeng Sun [Tue, 31 Oct 2017 17:52:09 +0000 (10:52 -0700)]
test-ovsdb: Fix memory leak

Valgrind testcase 1465 (integer atom enum from string) reports the leak below:
16 bytes in 1 blocks are definitely lost in loss record 2 of 5
    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x43F5F4: xmalloc (util.c:120)
    by 0x424AC6: alloc_default_atoms (ovsdb-data.c:315)
    by 0x4271E0: ovsdb_atom_from_string__ (ovsdb-data.c:508)
    by 0x4271E0: ovsdb_atom_from_string (ovsdb-data.c:632)
    by 0x40ADCC: do_parse_atom_strings (test-ovsdb.c:566)
    by 0x41BA73: ovs_cmdl_run_command__ (command-line.c:115)
    by 0x4051C9: main (test-ovsdb.c:72)

range_end_atom is allocated in ovsdb_atom_from_string__() and no one is
holding a reference to it at the end of do_parse_atom_strings(). It should
be freed here, as also pointed out by ovsdb_atom_destroy().

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovsdb-idl: Fix memory leak
Yifeng Sun [Tue, 31 Oct 2017 17:52:08 +0000 (10:52 -0700)]
ovsdb-idl: Fix memory leak

Valgrind testcase 2339 (ovn -- ipam connectivity) reports the leak below:
45 (32 direct, 13 indirect) bytes in 1 blocks are definitely lost in loss record 65 of 83
    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x4A6D64: xmalloc (util.c:120)
    by 0x49C847: shash_add_nocopy__ (shash.c:109)
    by 0x49C847: shash_add_nocopy (shash.c:121)
    by 0x49CA85: shash_add (shash.c:129)
    by 0x49CA85: shash_add_once (shash.c:136)
    by 0x4914B5: ovsdb_idl_create_index (ovsdb-idl.c:2067)
    by 0x406C98: create_ovnsb_indexes (ovn-controller.c:568)
    by 0x406C98: main (ovn-controller.c:619)

The leak happens when vsdb_idl_table is freed but its indexes are not freed.

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev-dummy: Avoid double-free in netdev_dummy_ip4addr().
Yifeng Sun [Thu, 2 Nov 2017 13:42:22 +0000 (06:42 -0700)]
netdev-dummy: Avoid double-free in netdev_dummy_ip4addr().

netdev_dummy_ip6addr() calls netdev_close() twice though it increases
netdev's reference only once from netdev_from_name(). As a result, Valgrind
test 788 (tunnel_push_pop - action) reports the error below:

==20465== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
 Invalid read of size 8
    at 0x493FE0: netdev_get_name (netdev.c:911)
    by 0x5125D3: tnl_port_map_delete_ipdev (tnl-ports.c:470)
    by 0x4E551C: __rt_entry_delete (ovs-router.c:252)
    by 0x4E64AA: ovs_router_flush (ovs-router.c:478)
    by 0x475CA8: call_hooks.part.2 (fatal-signal.c:254)
    by 0x5E53FF7: __run_exit_handlers (exit.c:82)
    by 0x5E54044: exit (exit.c:104)
    by 0x5E3A836: (below main) (libc-start.c:325)
  Address 0x65ea680 is 0 bytes inside a block of size 640 free'd
    at 0x4C2EDEB: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x492BA2: netdev_unref (netdev.c:572)
    by 0x41646E: ofport_destroy__ (ofproto.c:2516)
    by 0x41FD58: ofproto_destroy (ofproto.c:1645)
    by 0x40B96B: bridge_destroy (bridge.c:3273)
    by 0x410238: bridge_exit (bridge.c:506)
    by 0x40700E: main (ovs-vswitchd.c:135)
  Block was alloc'd at
    at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x516A82: xcalloc (util.c:103)
    by 0x48D74D: netdev_dummy_alloc (netdev-dummy.c:661)
    by 0x4931D1: netdev_open.part.12 (netdev.c:406)
    by 0x40A985: iface_do_create (bridge.c:1784)
    by 0x40A985: iface_create (bridge.c:1837)
    by 0x40A985: bridge_add_ports__ (bridge.c:931)
    by 0x40C7EA: bridge_add_ports (bridge.c:947)
    by 0x40C7EA: bridge_reconfigure (bridge.c:663)
    by 0x410485: bridge_run (bridge.c:2998)
    by 0x406F64: main (ovs-vswitchd.c:119)

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn: Generate Neighbor Solicitation packet for unknown MAC IPv6 packets
Numan Siddique [Thu, 2 Nov 2017 00:50:02 +0000 (06:20 +0530)]
ovn: Generate Neighbor Solicitation packet for unknown MAC IPv6 packets

In the router ingress pipeline, if the destination mac is unresolved
by the time the packet reaches the ARP_REQUEST stage, OVN should generate an
IPv6 Neighbor Solicitation packet to learn the MAC address. This feature is
presently missing. This patch adds this feature.  A new action "nd_ns" is
added  which replaces an IPv6 packet being processed with an IPv6 Neighbor
Solicitation packet. ovn-northd adds a flow in the ARP_REQUEST router ingress
pipeline stage if the eth.dst is zero which applies this action. This action is
similar to the IPv4 counterpart "arp" action.

OVN already has the support to learn the MAC from the IPv6 Neighbor Advertisement
packets and storing in the south bound MAC_Binding table.

Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn-northd: Add logical flows to support native IPv6 RA
Zongkai LI [Thu, 2 Nov 2017 00:49:45 +0000 (06:19 +0530)]
ovn-northd: Add logical flows to support native IPv6 RA

This patch adds logical flows which sends IPv6 Router Advertisement
packet in response to the IPv6 Router Solicitation request. It uses
the actions "put_nd_ra_opts" to transform the RS packet to RA packet
in the newly added ingress stage "lr_in_nd_ra_options" in router
pipeline. If the action "put_nd_ra_opts" is successful, it sends the
RA packet back to the originating port in the next ingress stage
"lr_in_nd_ra_response".

A new column "ipv6_ra_configs" is added in the Logical_Router_Port
table, which the CMS is expected to configure IPv6 RA
configurations - "address_mode" and "mtu" for adding these flows.

Co-authored-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Zongkai LI <zealokii@gmail.com>
Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Acked-by: Miguel Angel Ajo <majopela@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn-controller: Add a new action - 'put_nd_ra_opts'
Numan Siddique [Thu, 2 Nov 2017 00:49:24 +0000 (06:19 +0530)]
ovn-controller: Add a new action - 'put_nd_ra_opts'

This patch adds a new OVN action 'put_nd_ra_opts' to support native
IPv6 Router Advertisement in OVN. This action can be used to respond
to the IPv6 Router Solicitation requests.

ovn-controller parses this action and adds a NXT_PACKET_IN2 OF flow
with 'pause' flag set and the RA options stored in 'userdata' field.
This action is similar to 'put_dhcp_opts' and 'put_dhcpv6_opts'.

When a valid IPv6 RS packet is received by the pinctrl module of
ovn-controller, it frames a new RA packet and sets the RA options
from the 'userdata' field and resumes the packet storing 1 in the
1-bit result sub-field. If the packet is invalid, it resumes the
packet without any modifications storing 0 in the 1-bit result
sub-field.

Eg. reg0[5] = put_nd_ra_opts(address_mode = "slaac", mtu = 1450,
                             slla = 01:02:03:04:05:06, prefix = aef0::/64)

Note that unlike DHCPv4/v6, a new table to store the supported IPv6 ND RA
options is not added in SB DB since there are only 3 ND RA options.

Co-authored-by: Zongkai LI <zealokii@gmail.com>
Signed-off-by: Zongkai LI <zealokii@gmail.com>
Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn util: Refactor dhcp_opts_map to make it generic
Numan Siddique [Thu, 2 Nov 2017 00:48:34 +0000 (06:18 +0530)]
ovn util: Refactor dhcp_opts_map to make it generic

Renamed 'struct dhcp_opts_map' to 'struct gen_opts_map' and
renamed ovn-dhcp.h to ovn-l7.h. An upcoming commit to support IPv6
Router Advertisement, will make use of the refactored code to store
the IPv6 ND RA options in 'struct gen_opts_map'.

Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Acked-by: Miguel Angel Ajo <majopela@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev-linux: Fix wrong ceil rate when max-rate less than 8bit.
Kaige Fu [Thu, 2 Nov 2017 03:07:02 +0000 (11:07 +0800)]
netdev-linux: Fix wrong ceil rate when max-rate less than 8bit.

When max-rate is less than 8bit, the hc->max_rate will be set
as htb->max_rate mistakenly instead of mtu of netdev.

Fixes: 13c1637 ("smap: New function smap_get_ullong().")
Signed-off-by: Kaige Fu <fukaige@huawei.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agopackets: Fix C++ compilation issues when include packets.h
Yi-Hung Wei [Wed, 1 Nov 2017 21:40:27 +0000 (14:40 -0700)]
packets: Fix C++ compilation issues when include packets.h

This patch fixes three C++ compilation errors when it includes
"lib/packets.h".

1) Fix in "include/openvswitch/util.h" is to avoid duplicated
named_member__ in struct pkt_metadata.

2) Fix in "lib/packets.h" is because designated initializers are not
implemented in GNU C++ [1].

3) Fix in "lib/util.h" is because __builtin_types_compatible_p and
__builtin_choose_expr are only supported in GCC. I use one solution
for C++ that is type-safe and works at compile time from [2].

[1]: https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
[2]: https://goo.gl/xNe48A

Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto/trace: Fix memory leak in oftrace_push_ct_state()
Yi-Hung Wei [Wed, 1 Nov 2017 23:59:52 +0000 (16:59 -0700)]
ofproto/trace: Fix memory leak in oftrace_push_ct_state()

Free the allocated memory in the pop function.

Fixes: 0f2f05bbcf743 ("ofproto/trace: Add --ct-next option to ofproto/trace")
Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto-dpif-upcall: Fix null pointer dereference on exit.
Ben Pfaff [Fri, 27 Oct 2017 15:40:23 +0000 (08:40 -0700)]
ofproto-dpif-upcall: Fix null pointer dereference on exit.

When revalidation occurs at the same time that a bridge is being removed
or ovs-vswitchd is exiting, xlate_lookup_ofproto() races with deletion of
the ofproto.  This caused a null pointer dereference if revalidation lost
the race.  This commit fixes the problem.

Reported-by: Jakub Sitnicki <jkbs@redhat.com>
Tested-by: Jakub Sitnicki <jkbs@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn: Add IPv6 capability to ovn-nbctl lb-add
Mark Michelson [Thu, 2 Nov 2017 16:13:59 +0000 (11:13 -0500)]
ovn: Add IPv6 capability to ovn-nbctl lb-add

ovn-nbctl will now accept IPv6 addresses for load balancer VIPs and
desetination addresses.

In addition, the ovn-nbctl lb-list, lr-lb-list, and ls-lb-list have been
modified to be able to fit IPv6 addresses on screen.

Signed-off-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn: Allow northd to install IPv6 ct_lb logical flows.
Mark Michelson [Thu, 2 Nov 2017 16:13:58 +0000 (11:13 -0500)]
ovn: Allow northd to install IPv6 ct_lb logical flows.

For this commit, ovn-northd will now accept both IPv4 and IPv6 addresses
in the northbound database for a load balancer VIP or destination
addresses. For IPv4, the behavior remains the same. For IPv6, the
following logical flows will be added to the southbound database:

* An ND_NA response for incoming ND_NS requests for the load balancer
  VIP.
* A ct_lb flow with the configured IPv6 addresses.

The ovn-northd manpage has been updated to indicate what flows are
added for load balancers with IPv6 VIPs.

Signed-off-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn: Allow ct_lb actions to take IPv6 address arguments.
Mark Michelson [Thu, 2 Nov 2017 16:13:57 +0000 (11:13 -0500)]
ovn: Allow ct_lb actions to take IPv6 address arguments.

The ct_lb action previously assumed that any address arguments were
IPv4. This patch expands the parsing, formatting, and encoding of ct_lb
to be amenable to IPv6 addresses as well.

Signed-off-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoAdd general-purpose IP/port parsing function.
Mark Michelson [Thu, 2 Nov 2017 16:13:56 +0000 (11:13 -0500)]
Add general-purpose IP/port parsing function.

OVS has functions for parsing IPv4 addresses, parsing IPv4 addresses
with a port, and parsing IPv6 addresses. What is lacking though is a
function that can take an IPv4 or IPv6 address, with or without a port.

This commit adds ipv46_parse(), which breaks the given input string into
its component parts and stores them in a sockaddr_storage structure. The
function accepts flags that determine how it should behave if a port is
present in the input string.

Signed-off-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoOVN: Don't let peers be set to "<error>" on port bindings.
Mark Michelson [Thu, 26 Oct 2017 18:09:01 +0000 (13:09 -0500)]
OVN: Don't let peers be set to "<error>" on port bindings.

There are a couple of places in ovn-northd that set the "peer" option on
certain ports to "<error>" in certain cases. In every case where a peer is
looked up on a port binding, the code performs a NULL check in order to
ensure a peer exists. None check for the "<error>" string. They assume that the
presence of a peer string means a peer is defined and all is well.

In the past (OVS 2.6 series), this sometimes led to patch ports being created
in ovs that had names like "patch-ro-to-<error>". This particular problem
resolved itself in OVS 2.7 since such patch ports were no longer automatically
created. However, by naming the peer "<error>" the seeds are still sown for
similar issues to occur.

The solution this patch suggests is to no longer set the "peer" option
on a port binding to "<error>". Instead, if no peer can be set, then we
set no peer. Since other code is already equipped to deal with this,
this poses no problem.

Signed-off-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn: Check for known logical switch port types.
Mark Michelson [Wed, 6 Sep 2017 13:38:40 +0000 (08:38 -0500)]
ovn: Check for known logical switch port types.

OVN is lenient with the types of logical switch ports. Maybe too
lenient. This patch attempts to solve this problem on two fronts:

1) In ovn-nbctl, if you attempt to set the port type to an unknown
type, the command will not end up setting the type.
2) In northd, when copying the port type from the northbound database to
the corresponding port-binding in the southbound database, a warning
will be issued if the port is of an unknown type.

Signed-off-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Lance Richardson <lrichard@redhat.com>
6 years agobond: send learning pkg when non active slave failed.
minglumlu [Wed, 30 Aug 2017 02:58:58 +0000 (03:58 +0100)]
bond: send learning pkg when non active slave failed.

In active-active bond, a non-active slave failure doesn't trigger
the sending of learning packets. This patch fixes this issue.

Signed-off-by: minglumlu <ming.lu@citrix.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodatapath: Remove redundant check for IFF_NO_QUEUE
Kaige Fu [Tue, 31 Oct 2017 01:13:50 +0000 (09:13 +0800)]
datapath: Remove redundant check for IFF_NO_QUEUE

IFF_NO_QUEUE is checked twice. This cause a situation
that HAVE_IFF_NO_QUEUE is defined no matter whether
the flag IFF_NO_QUEUE is defined in kernel or not.

Signed-off-by: Kaige Fu <fukaige@huawei.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agoofproto-dpif-xlate: Fix bad memory free.
William Tu [Wed, 1 Nov 2017 00:29:50 +0000 (17:29 -0700)]
ofproto-dpif-xlate: Fix bad memory free.

Clang reports possibly bad free of 'ofm' when it comes from the stack
instead of malloc because Clang is not able to verify whether the previous
if condition 'ctx->xin->xcache' still hold the same.  Fix it by
adding additional condition.

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn-sbctl: Fix possible null pointer to qsort.
William Tu [Wed, 1 Nov 2017 00:29:51 +0000 (17:29 -0700)]
ovn-sbctl: Fix possible null pointer to qsort.

Clang reports possible null pointer 'lflows' passed to qsort.
This is due to the checker unable to make sure whether 'lflows'
gets malloc or not in the previous loop.  Fix it by checking the
'n_flows' before calling qsort.

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoacinclude: Fix SKB_GSO_UDP check.
William Tu [Wed, 1 Nov 2017 00:03:41 +0000 (17:03 -0700)]
acinclude: Fix SKB_GSO_UDP check.

The HAVE_SKB_GSO_UDP checks whether skbuff.h defines SKB_GSO_UDP.
However, it falsely returns yes because grep matches SKB_GSO_UDP_TUNNEL.
Thus, add space character '[:space:]' before and after it.

Fixes: ad283644f0e4 ("acinclude: Check for SKB_GSO_UDP")
Signed-off-by: William Tu <u9012063@gmail.com>
Cc: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agotests: Add a default timeout for control utilities
Alin Gabriel Serdean [Mon, 28 Aug 2017 17:14:59 +0000 (20:14 +0300)]
tests: Add a default timeout for control utilities

Let's suppose that ovsdb-server is running properly, but ovs-vswitchd
is not responsive/crashed. We try to add a port via ovs-vsctl and it will
hang.
This patch aims at that scenario and tries to make life easier when
debugging hanging tests.

Some shells do not allow dashes in function names (default behavior),
we shall try to define an alias to overcome dashes if the shell allows it.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Suggested-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agosystem-traffic: Fix conntrack tests
Yi-Hung Wei [Thu, 26 Oct 2017 21:24:09 +0000 (14:24 -0700)]
system-traffic: Fix conntrack tests

Three conntrack system-traffic tests are broken because of a recent
change 7827edcaebd8 ("Add dl_type to flow metadata for correct
interpretation of conntrack metadata"). It can be reproduced by
  $ make check-system-userspace TESTSUITEFLAGS='18 19 37'

This patch modifies the check messages to fix the breakage.

Fixes: 7827edcaebd8 ("Add dl_type to flow metadata for correct interpretation of conntrack metadata")
CC: Daniel Alvarez <dalvarez@redhat.com>
Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: William Tu <u9012063@gmail.com>
6 years agoofproto/trace: Propagate ct_zone in recirculation
Yi-Hung Wei [Fri, 25 Aug 2017 22:51:12 +0000 (15:51 -0700)]
ofproto/trace: Propagate ct_zone in recirculation

This patch propagates ct_zone when ofproto/trace automatically runs
through the recirculation process.

Fixes: e6bc8e749381 ("ofproto/trace: Add support for tracing conntrack recirculation")
Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agopackets: Add ESP header and trailer.
Ian Stokes [Fri, 25 Aug 2017 16:40:25 +0000 (17:40 +0100)]
packets: Add ESP header and trailer.

This patch introduces structs for both ESP headers and ESP trailers
along with expected size assertions.

Signed-off-by: Ian Stokes <ian.stokes@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agotests: fix PTAP system test to check only OF stats
Zoltan Balogh [Tue, 31 Oct 2017 08:59:08 +0000 (09:59 +0100)]
tests: fix PTAP system test to check only OF stats

It turned out, checking datapath flow statistics during system-userspace
test is not reliable. Unwanted packets can be injected depending on
system configuration. As a workaround, this commit removes checking
statistics of datapath flows and does check OpenFlow statistics of the
integrator bridges. Datapath flows can be checked in normal PTAP unit
tests by running 'make check'.

Reported-by: Darrell Ball <dball@vmware.com>
Suggested-by: Jan Scheurich <jan.scheurich@ericsson.com>
Tested-by: Darrell Ball <dball@vmware.com>
Signed-off-by: Zoltan Balogh <zoltan.balogh@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto-dpif-xlate: use xlate error enum for unsupported packet type
Zoltán Balogh [Mon, 21 Aug 2017 08:34:41 +0000 (08:34 +0000)]
ofproto-dpif-xlate: use xlate error enum for unsupported packet type

Instead of using the value 1 a new enum should be used for indicating
translation error which occurs because of unsupported packet type.

Signed-off-by: Zoltan Balogh <zoltan.balogh@ericsson.com>
Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
Co-authored-by: Jan Scheurich <jan.scheurich@ericsson.com>
Fixes: f839892a206a ("OF support and translation of generic encap and decap")
CC: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodatapath: Check maximum netlink message size
Greg Rose [Fri, 22 Sep 2017 14:44:52 +0000 (07:44 -0700)]
datapath: Check maximum netlink message size

In kernels < 4.9 the maximum netlink message size is 16KB.

See http://www.spinics.net/lists/netdev/msg431592.html

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agolib: Move lib/rconn.h to include/openvswitch
Xiao Liang [Wed, 16 Aug 2017 16:06:24 +0000 (00:06 +0800)]
lib: Move lib/rconn.h to include/openvswitch

Rconn provides useful features over vconn. Make it available to library
users.

Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodatapath-windows: Update OvsCompleteNbl argument to match definition
Sairam Venugopal [Tue, 24 Oct 2017 21:51:49 +0000 (14:51 -0700)]
datapath-windows: Update OvsCompleteNbl argument to match definition

Update the OvsCompleteNbl to take in a PVOID and explicitly cast to
POVS_SWITCH_CONTEXT. This is useful when finding declarations in Visual
Studio. The mismatch breaks this functionality.

Found by inspection.

Signed-off-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Shashank Ram <rams@vmware.com>
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
6 years agosparse: eliminate "duplicate initialization" warning
Lance Richardson [Mon, 28 Aug 2017 15:23:16 +0000 (11:23 -0400)]
sparse: eliminate "duplicate initialization" warning

Sparse version 0.5.1 will be released in the near future. Prepare
for it by eliminating the only new warning (as of 0.5.1-rc5):

ofproto/fail-open.c:134:22: error: Initializer entry defined twice
ofproto/fail-open.c:135:22:   also defined here

MATCH_CATCHALL_INITIALIZER effectively sets all fields of .flow to
zero, which is redundant because according to the C99 semantics for
structure initialization, initializing any single member of a
structure results in all other members being initialized to zero,
and the next line initializes a member of the same structure.

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agoAUTHORS: Add Kaige Fu.
Ben Pfaff [Mon, 30 Oct 2017 23:48:40 +0000 (16:48 -0700)]
AUTHORS: Add Kaige Fu.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agodpif: Remove duplicated word in comment for dpif_recv()
Kaige Fu [Sat, 26 Aug 2017 02:27:38 +0000 (10:27 +0800)]
dpif: Remove duplicated word in comment for dpif_recv()

Signed-off-by: Kaige Fu <fukaige@huawei.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agoroute-table: Remove netdevs in netdev_hash when deleted
Kaige Fu [Mon, 14 Aug 2017 07:11:55 +0000 (15:11 +0800)]
route-table: Remove netdevs in netdev_hash when deleted

Start a virtual machine with its backend tap device attached to a brought
up linux bridge.  If we delete the linux bridge when vm is still running,
we'll get the following error when trying to create a ovs bridge with
the same name.

The reason is that ovs-router subsystem add the linux bridge into
netdev_shash, but does not remove it when the bridge is deleted in the
situation. When the bridge is deleted, ovs will receive a RTM_DELLINK msg,
take this chance to remove the bridge in netdev_shash.

ovs-vsctl: Error detected while setting up 'br-eth'.  See ovs-vswitchd log for details.

ovs-vswitchd log:
2017-05-11T03:45:25.293Z|00026|ofproto_dpif|INFO|system@ovs-system: Datapath supports recirculation
2017-05-11T03:45:25.293Z|00027|ofproto_dpif|INFO|system@ovs-system: MPLS label stack length probed as 1
2017-05-11T03:45:25.293Z|00028|ofproto_dpif|INFO|system@ovs-system: Datapath supports unique flow ids
2017-05-11T03:45:25.293Z|00029|ofproto_dpif|INFO|system@ovs-system: Datapath supports ct_state
2017-05-11T03:45:25.293Z|00030|ofproto_dpif|INFO|system@ovs-system: Datapath supports ct_zone
2017-05-11T03:45:25.293Z|00031|ofproto_dpif|INFO|system@ovs-system: Datapath supports ct_mark
2017-05-11T03:45:25.293Z|00032|ofproto_dpif|INFO|system@ovs-system: Datapath supports ct_label
2017-05-11T03:45:25.364Z|00001|ofproto_dpif_upcall(handler226)|INFO|received packet on unassociated datapath port 0
2017-05-11T03:45:25.368Z|00033|netdev_linux|WARN|ethtool command ETHTOOL_GFLAGS on network device br-eth failed: No such device
2017-05-11T03:45:25.368Z|00034|dpif|WARN|system@ovs-system: failed to add br-eth as port: No such device
2017-05-11T03:45:25.368Z|00035|bridge|INFO|bridge br-eth: using datapath ID 00002a51cf9f2841
2017-05-11T03:45:25.368Z|00036|connmgr|INFO|br-eth: added service controller "punix:/var/run/openvswitch/br-eth.mgmt"

Signed-off-by: Kaige Fu <fukaige@huawei.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Greg Rose <gvrose8192@gmail.com>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agonetdev-dpdk: Fix mp_name leak on snprintf failure.
Ilya Maximets [Mon, 30 Oct 2017 12:52:38 +0000 (15:52 +0300)]
netdev-dpdk: Fix mp_name leak on snprintf failure.

CC: Robert Wojciechowicz <robertx.wojciechowicz@intel.com>
CC: Antonio Fischetti <antonio.fischetti@intel.com>
Fixes: d555d9bded5f ("netdev-dpdk: Create separate memory pool for each port.")
Fixes: 65056fd79694 ("netdev-dpdk: manage failure in mempool name creation.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agorhel: Use python2-sphinx as BuildRequires on Fedora
Timothy Redaelli [Fri, 27 Oct 2017 12:18:43 +0000 (14:18 +0200)]
rhel: Use python2-sphinx as BuildRequires on Fedora

python-* package names are deprecated on Fedora
(https://fedoraproject.org/wiki/Packaging:Naming#Python2_binary_package_naming)
so use python2-sphinx, when available, instead.

CC: Lance Richardson <lrichard@redhat.com>
Fixes: cd6121410b52 ("rhel: add python-sphinx as a build dependency")
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agofedora: Use python2-sphinx as dependency instead of python-sphinx
Timothy Redaelli [Fri, 27 Oct 2017 12:03:15 +0000 (14:03 +0200)]
fedora: Use python2-sphinx as dependency instead of python-sphinx

python-* package names are deprecated
(https://fedoraproject.org/wiki/Packaging:Naming#Python2_binary_package_naming)
so use python2-sphinx instead.

CC: Gurucharan Shetty <guru@ovn.org>
Fixes: fc9669525f3f ("rhel, fedora: Add python-sphinx as a dependency.")
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovsdb-idl: fix index row setting with references.
Han Zhou [Mon, 30 Oct 2017 19:21:49 +0000 (12:21 -0700)]
ovsdb-idl: fix index row setting with references.

IDL index should be able to be used without having to be in a
transaction. However, current implementation leads to crash if
a reference type column is being set in an index row for querying
purpose when it is not in a transaction. It is because of the
uninitialized arcs and unnecessary updates of the arcs. This patch
fixes it by identifying index rows by a magic uuid, so that when
parsing index row, the arcs are not updated. A new test case is
added to cover this scenario.

Signed-off-by: Han Zhou <zhouhan@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn-sbctl: Fix dead assignment.
William Tu [Mon, 30 Oct 2017 17:27:54 +0000 (10:27 -0700)]
ovn-sbctl: Fix dead assignment.

Clang reports value stored to 'sb' is never read.
Fix it by removing it.

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofp-actions: Fix dead assignment.
William Tu [Mon, 30 Oct 2017 17:27:53 +0000 (10:27 -0700)]
ofp-actions: Fix dead assignment.

Clang reports value stored to 'eah' in never read.
Fix it by removing it.

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agofaq: Fix header path of ofp-msgs.h.
William Tu [Mon, 30 Oct 2017 17:46:42 +0000 (10:46 -0700)]
faq: Fix header path of ofp-msgs.h.

Replace path 'lib/ofp-msgs.h' with 'include/openvswitch/ofp-msgs.h'

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agofaq: Better document how to add vendor extensions.
Ben Pfaff [Mon, 9 Oct 2017 17:33:15 +0000 (10:33 -0700)]
faq: Better document how to add vendor extensions.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
6 years agotimeval: Check for OS-provided clock_gettime on macOS
Richard Oliver [Sat, 28 Oct 2017 15:38:30 +0000 (16:38 +0100)]
timeval: Check for OS-provided clock_gettime on macOS

[Problem]
Compilation error on newer versions of macOS (Sierra onwards) due to
multiple declarations of clock_gettime.

[Solution]
Have configure check for clock_gettime and check this result in
timeval to avoid incorrectly declaring/defining clock_gettime again.

[Testing]
Source code now successfully builds on macOS.

Signed-off-by: Richard Oliver <richard@richard-oliver.co.uk>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agotreewide: Get rid of "echo -n", and add a test to prevent regression.
Ben Pfaff [Mon, 30 Oct 2017 16:44:52 +0000 (09:44 -0700)]
treewide: Get rid of "echo -n", and add a test to prevent regression.

"echo -n" is not POSIX and has spotty support in shells.

CC: Timothy Redaelli <tredaelli@redhat.com>
CC: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>