]> git.proxmox.com Git - mirror_ovs.git/log
mirror_ovs.git
7 years agoMakefile: Drop vestiges of support for non-GNU Make.
Ben Pfaff [Wed, 8 Mar 2017 04:48:08 +0000 (20:48 -0800)]
Makefile: Drop vestiges of support for non-GNU Make.

Open vSwitch has documented a requirement for GNU Make for a long time, yet
it had vestiges catering to other make implementations.  This removes
those.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
7 years agopackaging: Make Fedora spec file CentOS compatible
Leif Madsen [Mon, 6 Mar 2017 20:46:43 +0000 (15:46 -0500)]
packaging: Make Fedora spec file CentOS compatible

On CentOS, the package names aren't prefixed with python2, but rather
are prefixed with simply python. This change addresses that and fixes
up some documentation that was outdated, and updates the Vagrantfile
to use the proper spec file and package names.

Fixes: bb1a7ca21107 ("fedora: Add python3-openvswitch split package")
Signed-off-by: Leif Madsen <lmadsen@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agovagrant: Use official boxes for Fedora and Centos
Timothy Redaelli [Thu, 9 Feb 2017 14:00:36 +0000 (15:00 +0100)]
vagrant: Use official boxes for Fedora and Centos

Change CentOS version to last 7 (7.3 at the moment),
since old kernel-devel version is no longer available.

Add net-tools to CentOS since netstat is needed for some tests.

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Andy Zhou <azhou@ovn.org>
7 years agoodp-execute: Apply clone action on batch of packets instead of one by one.
Sugesh Chandran [Thu, 9 Feb 2017 15:41:53 +0000 (15:41 +0000)]
odp-execute: Apply clone action on batch of packets instead of one by one.

Clone action is optimized by cloning a batch of packets together instead of
executing independently on every packet in a batch.

Signed-off-by: Sugesh Chandran <sugesh.chandran@intel.com>
Signed-off-by: Zoltán Balogh <zoltan.balogh@ericsson.com>
Co-authored-by: Zoltán Balogh <zoltan.balogh@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoMakefile: Break the build if .gitignore files are distributed.
Ben Pfaff [Wed, 8 Mar 2017 00:29:53 +0000 (16:29 -0800)]
Makefile: Break the build if .gitignore files are distributed.

This would have found a .gitignore file recently added to the distribution.

CC: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Markos Chandras <mchandras@suse.de>
7 years agodoc: Add info on distributions shipping openvswitch package.
Bhanuprakash Bodireddy [Tue, 7 Feb 2017 21:18:23 +0000 (21:18 +0000)]
doc: Add info on distributions shipping openvswitch package.

List details of various popular distributions shipping Open vSwitch
packages. Also include the information of the distros supporting DPDK
accelerated datapath.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoDocumentation: Update DPDK doc with extended statistics.
Bhanuprakash Bodireddy [Tue, 7 Feb 2017 21:18:22 +0000 (21:18 +0000)]
Documentation: Update DPDK doc with extended statistics.

Add instructions on how to retrieve extended statistics for DPDK physical
and vhost ports.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agowindows: Fix uninitialized variable in netlink-socket
Alin Serdean [Mon, 6 Mar 2017 16:22:39 +0000 (16:22 +0000)]
windows: Fix uninitialized variable in netlink-socket

The variable `request_nlmsg` was used without being initialized.

This patch assigns a value to it before being used.

Found by inspection.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agowindows: automake.mk: Remove the .gitignore file from distributed files
Markos Chandras [Sat, 4 Feb 2017 17:11:11 +0000 (17:11 +0000)]
windows: automake.mk: Remove the .gitignore file from distributed files

Commit d183efc22b2b ("This commit adds the windows installer to the
OVS tree.) added the .gitignore file to the distributed files but this
file shouldn't be part of the distributed archive.

CC: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Fixes: d183efc22b2b ("This commit adds the windows installer to the OVS tree.")
Signed-off-by: Markos Chandras <mchandras@suse.de>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovn: specify options:nat-addresses as "router"
Mickey Spiegel [Fri, 3 Feb 2017 04:48:24 +0000 (20:48 -0800)]
ovn: specify options:nat-addresses as "router"

Currently in OVN, the "nat-addresses" in the "options" column of a
logical switch port of type "router" must be specified manually.
Typically the user would specify as "nat-addresses" all of the NAT
external IP addresses and load balancer IP addresses that have
already been specified separately on the router.

This patch allows the logical switch port's "nat-addresses" to be
specified as the string "router".  When ovn-northd sees this string,
it automatically copies the following into the southbound
Port_Binding's "nat-addresses" in the "options" column:
    The options:router-port's MAC address.
    Each NAT external IP address (of any NAT type) specified on the
    logical router of options:router-port.
    Each load balancer IP address specified on the logical router of
    options:router-port.
This will cause the controller where the gateway router resides to
issue gratuitous ARPs for each NAT external IP address and for each
load balancer IP address specified on the gateway router.

Signed-off-by: Mickey Spiegel <mickeys.dev@gmail.com>
Acked-by: Gurucharan Shetty <guru@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agowindows: add include to stream-windows.c
Alin Serdean [Mon, 6 Feb 2017 04:41:41 +0000 (04:41 +0000)]
windows: add include to stream-windows.c

fatal_signal_unlink_file_now is used but the header for it is missing in
the include section.

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 agowindows: add function definition to poll-loop.h
Alin Serdean [Mon, 6 Feb 2017 04:41:41 +0000 (04:41 +0000)]
windows: add function definition to poll-loop.h

poll_wevent_wait_at is used in the #define but the function definition
is missing.

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 agowindows: fix calls in netlink-socket
Alin Serdean [Mon, 6 Feb 2017 04:41:40 +0000 (04:41 +0000)]
windows: fix calls in netlink-socket

Add nl_sock_transact forward declaration, since it is used before
being on implemented. This applies only on Windows.

Move nl_sock_subscribe_packet__ function before it is used.

It makes more sense to move it rather than adding a forward declaration
since it is used by the two functions defined above it.

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 agowindows: add forward declaration to dpif-netlink
Alin Serdean [Mon, 6 Feb 2017 04:41:40 +0000 (04:41 +0000)]
windows: add forward declaration to dpif-netlink

dpif_netlink_port_query__ is used before it is defined on Windows.

Add a forward declaration to it.

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 agowindows: Add definition of getrusage
Alin Serdean [Mon, 6 Feb 2017 04:41:40 +0000 (04:41 +0000)]
windows: Add definition of getrusage

getrusage is implemented in lib/getrusage-windows.c.

This patch just adds its definition to include/windows/sys/resource.h,
which serves for files that include <sys/resource.h>.

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 agowindows: Remove dead code in daemon-windows
Alin Serdean [Sun, 5 Feb 2017 23:49:29 +0000 (23:49 +0000)]
windows: Remove dead code in daemon-windows

Found by inspection.

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: Trigger conntrack event after setting mark and label
Sairam Venugopal [Thu, 2 Mar 2017 21:41:03 +0000 (13:41 -0800)]
datapath-windows: Trigger conntrack event after setting mark and label

New Conntrack Entry event should be triggered after setting the mark and
label fields. The current RW lock implementation prevents Event Handler
from reading the entry until mark/label is set.

Fixing the workflow to trigger the event after setting mark/label.

Signed-off-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Shashank Ram <rams@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agoflake8: Fix build with flake8-import-order installed.
Russell Bryant [Tue, 7 Mar 2017 16:14:30 +0000 (11:14 -0500)]
flake8: Fix build with flake8-import-order installed.

OpenStack CI is currently failing due to some flake8 warnings
emitted from the flake8-import-order plugin.  Just ignore all of
those warnings since they're just style things that aren't important.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoofproto-dpif-xlate: fix build.
Jarno Rajahalme [Tue, 7 Mar 2017 00:02:55 +0000 (16:02 -0800)]
ofproto-dpif-xlate: fix build.

Recent patch 27d931da3ac ("ofproto-dpif: Enhance
execute_controller_action().") missed some new action enumerations
added previously.

Fixes: 27d931da3ac ("ofproto-dpif: Enhance execute_controller_action().")
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
7 years agoxlate: Translate openflow clone into odp sample action.
Andy Zhou [Tue, 14 Feb 2017 22:40:04 +0000 (14:40 -0800)]
xlate: Translate openflow clone into odp sample action.

When datapath does not support the 'clone' action directly, generate
sample action (with 100% probability) instead.

Specifically, currently, there is no plan to support the 'clone'
action on the Linux kernel datapath directly, so the sample action
will be used to translate the openflow clone action for this datapath.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
7 years agolib: Refactor nested netlink APIs.
Andy Zhou [Tue, 14 Feb 2017 22:39:48 +0000 (14:39 -0800)]
lib: Refactor nested netlink APIs.

Future patches will make use of those changes.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
7 years agoofproto-dpif: Enhance execute_controller_action().
Andy Zhou [Mon, 13 Feb 2017 22:28:35 +0000 (14:28 -0800)]
ofproto-dpif: Enhance execute_controller_action().

Allow execute_controller_action() to accept actions encoded with
nested netlink attributes.

execute_controller_action() can be called during 'xlate_actions'. It
tries executes all actions translated so far to get the current packet
that needs to be sent to the controller.  This works fine until when
the action is enclosed within a nested netlink message, and the
action translation has not finished yet.

For example;
A, clone(B, controller, C)

In this case, we can not execute 'clone' since its translation has not
be finished (missing C), However, A still needs to be executed before
the packet can be sent to the controller.

This solution is to make a copy of the odp actions translated so far,
and 'fix up' the copy so that it can be executed. The original odp
actions are left intact so that xlate can continue.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
7 years agoconntrack: Fix checks for TCP, UDP, and IPv6 header sizes.
Ben Pfaff [Sat, 4 Mar 2017 05:16:17 +0000 (21:16 -0800)]
conntrack: Fix checks for TCP, UDP, and IPv6 header sizes.

Otherwise a malformed packet could cause a read up to about 40 bytes past
the end of the packet.  The packet would still likely be dropped because
of checksum verification.

Reported-by: Bhargava Shastry <bshastry@sec.t-labs.tu-berlin.de>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
7 years agoFAQ: Add another question about do-nothing flows.
Ben Pfaff [Mon, 6 Mar 2017 16:10:59 +0000 (08:10 -0800)]
FAQ: Add another question about do-nothing flows.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Gurucharan Shetty <guru@ovn.org>
7 years agodatapath-windows: Fix GENEVE option header
Alin Serdean [Mon, 6 Mar 2017 16:16:38 +0000 (16:16 +0000)]
datapath-windows: Fix GENEVE option header

The GENEVE option header is defined in big endian, however we support only
little endian on Windows at the moment.

This patch changes the GENEVE option header into little endian.

Found while testing.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Yin Lin <linyi@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agorhel: remove duplicate line from rhel/automake.mk
Lance Richardson [Thu, 9 Feb 2017 21:30:26 +0000 (16:30 -0500)]
rhel: remove duplicate line from rhel/automake.mk

Fixes: commit 55f36be59122 ("rhel: Firewall service files for OVN.")
Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agotun-metadata: Fix memory leak in tun_metadata_table_mod().
Yi-Hung Wei [Tue, 7 Feb 2017 21:14:27 +0000 (13:14 -0800)]
tun-metadata: Fix memory leak in tun_metadata_table_mod().

In testcase "tunnel - Geneve metadata", valgrind reports a memory leak with
the following call stack.
    xcalloc (util.c:95)
    tun_metadata_alloc (tun-metadata.c:89)
    tun_metadata_table_mod (tun-metadata.c:151)
    handle_tlv_table_mod (ofproto.c:7782)
    handle_openflow__ (ofproto.c:7961)
    handle_openflow (ofproto.c:8023)
    ofconn_run (connmgr.c:1427)
    connmgr_run (connmgr.c:363)
    ofproto_run (ofproto.c:1813)
    bridge_run__ (bridge.c:2899)
    bridge_run (bridge.c:2956)
    main (ovs-vswitchd.c:111)

Reported-by: William Tu <u9012063@gmail.com>
Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: Simplify do_execute_actions().
andy zhou [Fri, 3 Mar 2017 03:29:52 +0000 (19:29 -0800)]
datapath: Simplify do_execute_actions().

Upstream commit:
    commit 5b8784aaf29be20ba8d363e1124d7436d42ef9bf
    Author: Andy Zhou <azhou@ovn.org>
    Date: Fri Jan 27 13:45:28 2017 -0800

    openvswitch: Simplify do_execute_actions().

    do_execute_actions() implements a worthwhile optimization: in case
    an output action is the last action in an action list, skb_clone()
    can be avoided by outputing the current skb. However, the
    implementation is more complicated than necessary.  This patch
    simplify this logic.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: 5b8784aaf29b ("openvswitch: Simplify do_execute_actions().")
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
7 years agodatapath: maintain correct checksum state in conntrack actions.
Lance Richardson [Fri, 3 Mar 2017 03:29:51 +0000 (19:29 -0800)]
datapath: maintain correct checksum state in conntrack actions.

Upstream commit:
    commit 75f01a4c9cc291ff5cb28ca1216adb163b7a20ee
    Author: Lance Richardson <lrichard@redhat.com>
    Date: Thu Jan 12 19:33:18 2017 -0500

    openvswitch: maintain correct checksum state in conntrack actions

    When executing conntrack actions on skbuffs with checksum mode
    CHECKSUM_COMPLETE, the checksum must be updated to account for
    header pushes and pulls. Otherwise we get "hw csum failure"
    logs similar to this (ICMP packet received on geneve tunnel
    via ixgbe NIC):

    [  405.740065] genev_sys_6081: hw csum failure
    [  405.740106] CPU: 3 PID: 0 Comm: swapper/3 Tainted: G          I     4.10.0-rc3+ #1
    [  405.740108] Call Trace:
    [  405.740110]  <IRQ>
    [  405.740113]  dump_stack+0x63/0x87
    [  405.740116]  netdev_rx_csum_fault+0x3a/0x40
    [  405.740118]  __skb_checksum_complete+0xcf/0xe0
    [  405.740120]  nf_ip_checksum+0xc8/0xf0
    [  405.740124]  icmp_error+0x1de/0x351 [nf_conntrack_ipv4]
    [  405.740132]  nf_conntrack_in+0xe1/0x550 [nf_conntrack]
    [  405.740137]  ? find_bucket.isra.2+0x62/0x70 [openvswitch]
    [  405.740143]  __ovs_ct_lookup+0x95/0x980 [openvswitch]
    [  405.740145]  ? netif_rx_internal+0x44/0x110
    [  405.740149]  ovs_ct_execute+0x147/0x4b0 [openvswitch]
    [  405.740153]  do_execute_actions+0x22e/0xa70 [openvswitch]
    [  405.740157]  ovs_execute_actions+0x40/0x120 [openvswitch]
    [  405.740161]  ovs_dp_process_packet+0x84/0x120 [openvswitch]
    [  405.740166]  ovs_vport_receive+0x73/0xd0 [openvswitch]
    [  405.740168]  ? udp_rcv+0x1a/0x20
    [  405.740170]  ? ip_local_deliver_finish+0x93/0x1e0
    [  405.740172]  ? ip_local_deliver+0x6f/0xe0
    [  405.740174]  ? ip_rcv_finish+0x3a0/0x3a0
    [  405.740176]  ? ip_rcv_finish+0xdb/0x3a0
    [  405.740177]  ? ip_rcv+0x2a7/0x400
    [  405.740180]  ? __netif_receive_skb_core+0x970/0xa00
    [  405.740185]  netdev_frame_hook+0xd3/0x160 [openvswitch]
    [  405.740187]  __netif_receive_skb_core+0x1dc/0xa00
    [  405.740194]  ? ixgbe_clean_rx_irq+0x46d/0xa20 [ixgbe]
    [  405.740197]  __netif_receive_skb+0x18/0x60
    [  405.740199]  netif_receive_skb_internal+0x40/0xb0
    [  405.740201]  napi_gro_receive+0xcd/0x120
    [  405.740204]  gro_cell_poll+0x57/0x80 [geneve]
    [  405.740206]  net_rx_action+0x260/0x3c0
    [  405.740209]  __do_softirq+0xc9/0x28c
    [  405.740211]  irq_exit+0xd9/0xf0
    [  405.740213]  do_IRQ+0x51/0xd0
    [  405.740215]  common_interrupt+0x93/0x93

Fixes: 7f8a436eaa2c ("openvswitch: Add conntrack action")
Signed-off-by: Lance Richardson <lrichard@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: 75f01a4c9cc2 ("openvswitch: maintain correct checksum state in conntrack actions")
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
7 years agodatapath: make ndo_get_stats64 a void function
stephen hemminger [Wed, 1 Mar 2017 01:17:17 +0000 (17:17 -0800)]
datapath: make ndo_get_stats64 a void function

Upstream commit:
    commit bc1f44709cf27fb2a5766cadafe7e2ad5e9cb221
    Author: stephen hemminger <stephen@networkplumber.org>
    Date:   Fri Jan 6 19:12:52 2017 -0800

    net: make ndo_get_stats64 a void function

    The network device operation for reading statistics is only called
    in one place, and it ignores the return value. Having a structure
    return value is potentially confusing because some future driver could
    incorrectly assume that the return value was used.

    Fix all drivers with ndo_get_stats64 to have a void function.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This seems to be fine for all prior Linux versions as well.

Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agolacp: Fix formatting typo.
nickcooper-zhangtonghao [Thu, 2 Mar 2017 13:02:53 +0000 (05:02 -0800)]
lacp: Fix formatting typo.

Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodpdk: Improve manpage for dpdk memory configuration.
nickcooper-zhangtonghao [Thu, 2 Mar 2017 13:02:52 +0000 (05:02 -0800)]
dpdk: Improve manpage for dpdk memory configuration.

Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodoc: Fix issues.rst formatting typo.
nickcooper-zhangtonghao [Thu, 2 Mar 2017 13:02:51 +0000 (05:02 -0800)]
doc: Fix issues.rst formatting typo.

The preformatted block is only finished when the text
falls back to the same indentation level as a paragraph
prior to the preformatted block.

Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agomcast-snooping: Add and improve mcast-snooping tests.
nickcooper-zhangtonghao [Fri, 3 Mar 2017 11:08:47 +0000 (03:08 -0800)]
mcast-snooping: Add and improve mcast-snooping tests.

Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agomcast-snooping: Avoid segfault for vswitchd.
nickcooper-zhangtonghao [Fri, 3 Mar 2017 09:37:21 +0000 (01:37 -0800)]
mcast-snooping: Avoid segfault for vswitchd.

The ports which are attached mrouters or hosts, were destroyed
by users via ovs-vsctl commands. Currently the vswitch will
segfault if users use "ovs-appctl mdb/show" to show mdb info.
This patch avoids a segfault.

Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agomcast-snooping: Flush ports mdb when VLAN configuration changed.
nickcooper-zhangtonghao [Fri, 3 Mar 2017 09:37:20 +0000 (01:37 -0800)]
mcast-snooping: Flush ports mdb when VLAN configuration changed.

If VLAN configuration(e.g. id, mode) change occurs, the IGMP
snooping-learned multicast groups from this port on the VLAN are
deleted. This avoids a MCAST_ENTRY_DEFAULT_IDLE_TIME delay before
mdb is updated again. Hardware switches (e.g. cisco) also do that.

Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodatapath: netns: make struct pernet_operations::id unsigned int.
Alexey Dobriyan [Wed, 1 Mar 2017 01:35:07 +0000 (17:35 -0800)]
datapath: netns: make struct pernet_operations::id unsigned int.

Upstream commit:
    commit c7d03a00b56fc23c3a01a8353789ad257363e281
    Author: Alexey Dobriyan <adobriyan@gmail.com>
    Date:   Thu Nov 17 04:58:21 2016 +0300

    netns: make struct pernet_operations::id unsigned int

    Make struct pernet_operations::id unsigned.

    There are 2 reasons to do so:

    1)
    This field is really an index into an zero based array and
    thus is unsigned entity. Using negative value is out-of-bound
    access by definition.

    2)
    On x86_64 unsigned 32-bit data which are mixed with pointers
    via array indexing or offsets added or subtracted to pointers
    are preffered to signed 32-bit data.

    "int" being used as an array index needs to be sign-extended
    to 64-bit before being used.

            void f(long *p, int i)
            {
                    g(p[i]);
            }

      roughly translates to

            movsx   rsi, esi
            mov     rdi, [rsi+...]
            call    g

    MOVSX is 3 byte instruction which isn't necessary if the variable is
    unsigned because x86_64 is zero extending by default.

    Now, there is net_generic() function which, you guessed it right, uses
    "int" as an array index:

            static inline void *net_generic(const struct net *net, int id)
            {
                    ...
                    ptr = ng->ptr[id - 1];
                    ...
            }

    And this function is used a lot, so those sign extensions add up.

    Patch snipes ~1730 bytes on allyesconfig kernel (without all junk
    messing with code generation):

            add/remove: 0/0 grow/shrink: 70/598 up/down: 396/-2126 (-1730)

    Unfortunately some functions actually grow bigger.
    This is a semmingly random artefact of code generation with register
    allocator being used differently. gcc decides that some variable
    needs to live in new r8+ registers and every access now requires REX
    prefix. Or it is shifted into r12, so [r12+0] addressing mode has to be
    used which is longer than [r8]

    However, overall balance is in negative direction:

            add/remove: 0/0 grow/shrink: 70/598 up/down: 396/-2126 (-1730)
            function                                     old     new   delta
            nfsd4_lock                                  3886    3959     +73
            tipc_link_build_proto_msg                   1096    1140     +44
            mac80211_hwsim_new_radio                    2776    2808     +32
            tipc_mon_rcv                                1032    1058     +26
            svcauth_gss_legacy_init                     1413    1429     +16
            tipc_bcbase_select_primary                   379     392     +13
            nfsd4_exchange_id                           1247    1260     +13
            nfsd4_setclientid_confirm                    782     793     +11
                    ...
            put_client_renew_locked                      494     480     -14
            ip_set_sockfn_get                            730     716     -14
            geneve_sock_add                              829     813     -16
            nfsd4_sequence_done                          721     703     -18
            nlmclnt_lookup_host                          708     686     -22
            nfsd4_lockt                                 1085    1063     -22
            nfs_get_client                              1077    1050     -27
            tcf_bpf_init                                1106    1076     -30
            nfsd4_encode_fattr                          5997    5930     -67
            Total: Before=154856051, After=154854321, chg -0.00%

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[Committer notes]

It looks like changing the type of this doesn't affect the build on older
kernels, so we can just make the change. I didn't go through all of the
compat code to update the net_id variables there as none of that code should
be enabled on kernels with this patch.

Upstream: c7d03a00b56f ("netns: make struct pernet_operations::id unsigned int")
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
7 years agodatapath: allow L3 netdev ports
Yang, Yi Y [Mon, 6 Feb 2017 13:04:42 +0000 (21:04 +0800)]
datapath: allow L3 netdev ports

Upstream commit:
    commit 217ac77a3c2524d999730b2a80b61fcc2d0f734a
    Author: Jiri Benc <jbenc@redhat.com>
    Date:   Thu Nov 10 16:28:24 2016 +0100

    openvswitch: allow L3 netdev ports

    Allow ARPHRD_NONE interfaces to be added to ovs bridge.

    Based on previous versions by Lorand Jakab and Simon Horman.

Signed-off-by: Lorand Jakab <lojakab@cisco.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: add Ethernet push and pop actions
Yang, Yi Y [Mon, 6 Feb 2017 13:04:41 +0000 (21:04 +0800)]
datapath: add Ethernet push and pop actions

Upstream commit:
    commit 91820da6ae85904d95ed53bf3a83f9ec44a6b80a
    Author: Jiri Benc <jbenc@redhat.com>
    Date:   Thu Nov 10 16:28:23 2016 +0100

    openvswitch: add Ethernet push and pop actions

    It's not allowed to push Ethernet header in front of another Ethernet
    header.

    It's not allowed to pop Ethernet header if there's a vlan tag. This
    preserves the invariant that L3 packet never has a vlan tag.

    Based on previous versions by Lorand Jakab and Simon Horman.

Signed-off-by: Lorand Jakab <lojakab@cisco.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
[Committer notes]

Fix build with the upstream commit by folding in the required switch
case enum handlers.

Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: netlink: support L3 packets
Yang, Yi Y [Mon, 6 Feb 2017 13:04:40 +0000 (21:04 +0800)]
datapath: netlink: support L3 packets

Upstream commit:
    commit 0a6410fbde597ebcf82dda4a0b0e889e82242678
    Author: Jiri Benc <jbenc@redhat.com>
    Date:   Thu Nov 10 16:28:22 2016 +0100

    openvswitch: netlink: support L3 packets

    Extend the ovs flow netlink protocol to support L3 packets. Packets without
    OVS_KEY_ATTR_ETHERNET attribute specify L3 packets; for those, the
    OVS_KEY_ATTR_ETHERTYPE attribute is mandatory.

    Push/pop vlan actions are only supported for Ethernet packets.

    Based on previous versions by Lorand Jakab and Simon Horman.

Signed-off-by: Lorand Jakab <lojakab@cisco.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream commit:
    commit 87e159c59d9f325d571689d4027115617adb32e6
    Author: Jarno Rajahalme <jarno@ovn.org>
    Date:   Mon Dec 19 17:06:33 2016 -0800

    openvswitch: Add a missing break statement.

    Add a break statement to prevent fall-through from
    OVS_KEY_ATTR_ETHERNET to OVS_KEY_ATTR_TUNNEL.  Without the break
    actions setting ethernet addresses fail to validate with log messages
    complaining about invalid tunnel attributes.

Fixes: 0a6410fbde ("openvswitch: netlink: support L3 packets")
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream commit:
    commit df30f7408b187929dbde72661c7f7c615268f1d0
    Author: pravin shelar <pshelar@ovn.org>
    Date:   Mon Dec 26 08:31:27 2016 -0800

    openvswitch: upcall: Fix vlan handling.

    Networking stack accelerate vlan tag handling by
    keeping topmost vlan header in skb. This works as
    long as packet remains in OVS datapath. But during
    OVS upcall vlan header is pushed on to the packet.
    When such packet is sent back to OVS datapath, core
    networking stack might not handle it correctly. Following
    patch avoids this issue by accelerating the vlan tag
    during flow key extract. This simplifies datapath by
    bringing uniform packet processing for packets from
    all code paths.

Fixes: 5108bbaddc ("openvswitch: add processing of L3 packets").
CC: Jarno Rajahalme <jarno@ovn.org>
CC: Jiri Benc <jbenc@redhat.com>
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
[Committer Notes]

Squashed in the following upstream commits to retain bisectability:
87e159c59d9f ("openvswitch: Add a missing break statement.")
df30f7408b18 ("openvswitch: upcall: Fix vlan handling.")

Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: add processing of L3 packets
Yang, Yi Y [Mon, 6 Feb 2017 13:04:39 +0000 (21:04 +0800)]
datapath: add processing of L3 packets

Upstream commit:
    commit 5108bbaddc37c1c8583f0cf2562d7d3463cd12cb
    Author: Jiri Benc <jbenc@redhat.com>
    Date:   Thu Nov 10 16:28:21 2016 +0100

    openvswitch: add processing of L3 packets

    Support receiving, extracting flow key and sending of L3 packets (packets
    without an Ethernet header).

    Note that even after this patch, non-Ethernet interfaces are still not
    allowed to be added to bridges. Similarly, netlink interface for sending and
    receiving L3 packets to/from user space is not in place yet.

    Based on previous versions by Lorand Jakab and Simon Horman.

Signed-off-by: Lorand Jakab <lojakab@cisco.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: support MPLS push and pop for L3 packets
Yang, Yi Y [Mon, 6 Feb 2017 13:04:38 +0000 (21:04 +0800)]
datapath: support MPLS push and pop for L3 packets

Upstream commit:
    commit 1560a074df6297e76278e459ca3eb9ff83a6f878
    Author: Jiri Benc <jbenc@redhat.com>
    Date:   Thu Nov 10 16:28:20 2016 +0100

    openvswitch: support MPLS push and pop for L3 packets

    Update Ethernet header only if there is one.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: pass mac_proto to ovs_vport_send
Yang, Yi Y [Mon, 6 Feb 2017 13:04:37 +0000 (21:04 +0800)]
datapath: pass mac_proto to ovs_vport_send

Upstream commit:
    commit e2d9d8358cb961340ef88620b6a25ba4557033d5
    Author: Jiri Benc <jbenc@redhat.com>
    Date:   Thu Nov 10 16:28:19 2016 +0100

    openvswitch: pass mac_proto to ovs_vport_send

    We'll need it to alter packets sent to ARPHRD_NONE interfaces.

    Change do_output() to use the actual L2 header size of the packet when
    deciding on the minimum cutlen. The assumption here is that what matters is
    not the output interface hard_header_len but rather the L2 header of the
    particular packet. For example, ARPHRD_NONE tunnels that encapsulate
    Ethernet should get at least the Ethernet header.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
[Committer notes]

This is not identical to upstream, because the OVS tree is missing
upstream commit c66549ffd666 ("openvswitch: correctly fragment packet
with mpls headers")

Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: add mac_proto field to the flow key
Yang, Yi Y [Mon, 6 Feb 2017 13:04:36 +0000 (21:04 +0800)]
datapath: add mac_proto field to the flow key

Upstream commit:
    commit 329f45bc4f191c663dc156c510816411a4310578
    Author: Jiri Benc <jbenc@redhat.com>
    Date:   Thu Nov 10 16:28:18 2016 +0100

    openvswitch: add mac_proto field to the flow key

    Use a hole in the structure. We support only Ethernet so far and will add
    a support for L2-less packets shortly. We could use a bool to indicate
    whether the Ethernet header is present or not but the approach with the
    mac_proto field is more generic and occupies the same number of bytes in the
    struct, while allowing later extensibility. It also makes the code in the
    next patches more self explaining.

    It would be nice to use ARPHRD_ constants but those are u16 which would be
    waste. Thus define our own constants.

    Another upside of this is that we can overload this new field to also denote
    whether the flow key is valid. This has the advantage that on
    refragmentation, we don't have to reparse the packet but can rely on the
    stored eth.type. This is especially important for the next patches in this
    series - instead of adding another branch for L2-less packets before calling
    ovs_fragment, we can just remove all those branches completely.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: use hard_header_len instead of hardcoded ETH_HLEN
Yang, Yi Y [Mon, 6 Feb 2017 13:04:35 +0000 (21:04 +0800)]
datapath: use hard_header_len instead of hardcoded ETH_HLEN

Upstream commit:
    commit 738314a084aae5f76ff760279034b39d52c42e8b
    Author: Jiri Benc <jbenc@redhat.com>
    Date:   Thu Nov 10 16:28:17 2016 +0100

    openvswitch: use hard_header_len instead of hardcoded ETH_HLEN

    On tx, use hard_header_len while deciding whether to refragment or drop the
    packet. That way, all combinations are calculated correctly:

    * L2 packet going to L2 interface (the L2 header len is subtracted),
    * L2 packet going to L3 interface (the L2 header is included in the packet
      lenght),
    * L3 packet going to L3 interface.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: handle NF_REPEAT from nf_conntrack_in()
Pablo Neira Ayuso [Thu, 16 Feb 2017 01:34:20 +0000 (17:34 -0800)]
datapath: handle NF_REPEAT from nf_conntrack_in()

Upstream commit:
    commit 08733a0cb7decce40bbbd0331a0449465f13c444
    Author: Pablo Neira Ayuso <pablo@netfilter.org>
    Date:   Thu Nov 3 10:56:43 2016 +0100

    netfilter: handle NF_REPEAT from nf_conntrack_in()

    NF_REPEAT is only needed from nf_conntrack_in() under a very specific
    case required by the TCP protocol tracker, we can handle this case
    without returning to the core hook path. Handling of NF_REPEAT from the
    nf_reinject() is left untouched.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
[Committer notes]
    Shift the functionality into the compat code, protected by v4.10
    version check. This allows the datapath/conntrack.c to match
    upstream.

Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: use core MTU range checking in core net infra
Jarod Wilson [Thu, 16 Feb 2017 01:34:19 +0000 (17:34 -0800)]
datapath: use core MTU range checking in core net infra

Upstream commit:
    commit 61e84623ace35ce48975e8f90bbbac7557c43d61
    Author: Jarod Wilson <jarod@redhat.com>
    Date:   Fri Oct 7 22:04:33 2016 -0400

    net: centralize net_device min/max MTU checking

    While looking into an MTU issue with sfc, I started noticing that almost
    every NIC driver with an ndo_change_mtu function implemented almost
    exactly the same range checks, and in many cases, that was the only
    practical thing their ndo_change_mtu function was doing. Quite a few
    drivers have either 68, 64, 60 or 46 as their minimum MTU value checked,
    and then various sizes from 1500 to 65535 for their maximum MTU value. We
    can remove a whole lot of redundant code here if we simple store min_mtu
    and max_mtu in net_device, and check against those in net/core/dev.c's
    dev_set_mtu().

    In theory, there should be zero functional change with this patch, it just
    puts the infrastructure in place. Subsequent patches will attempt to start
    using said infrastructure, with theoretically zero change in
    functionality.

CC: netdev@vger.kernel.org
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream commit:
    commit 91572088e3fdbf4fe31cf397926d8b890fdb3237
    Author: Jarod Wilson <jarod@redhat.com>
    Date:   Thu Oct 20 13:55:20 2016 -0400

    net: use core MTU range checking in core net infra

    ...

    openvswitch:
    - set min/max_mtu, remove internal_dev_change_mtu
    - note: max_mtu wasn't checked previously, it's been set to 65535, which
      is the largest possible size supported

    ...

Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Upstream commit:
    commit 425df17ce3a26d98f76e2b6b0af2acf4aeb0b026
    Author: Jarno Rajahalme <jarno@ovn.org>
    Date:   Tue Feb 14 21:16:28 2017 -0800

    openvswitch: Set internal device max mtu to ETH_MAX_MTU.

    Commit 91572088e3fd ("net: use core MTU range checking in core net
    infra") changed the openvswitch internal device to use the core net
    infra for controlling the MTU range, but failed to actually set the
    max_mtu as described in the commit message, which now defaults to
    ETH_DATA_LEN.

    This patch fixes this by setting max_mtu to ETH_MAX_MTU after
    ether_setup() call.

Fixes: 91572088e3fd ("net: use core MTU range checking in core net infra")
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This backport detects the new max_mtu field in the struct netdevice
and uses the upstream code if it exists, and local backport code if
not.  The latter case is amended with bounds checks with new upstream
macros ETH_MIN_MTU and ETH_MAX_MTU and the corresponding error
messages from the upstream commit.

Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: remove unnecessary EXPORT_SYMBOLs
Jiri Benc [Thu, 16 Feb 2017 01:34:18 +0000 (17:34 -0800)]
datapath: remove unnecessary EXPORT_SYMBOLs

Upstream commit:
    commit 76e4cc7731a1e0c07e202999b9834f9d9be66de4
    Author: Jiri Benc <jbenc@redhat.com>
    Date:   Wed Oct 19 11:26:37 2016 +0200

    openvswitch: remove unnecessary EXPORT_SYMBOLs

    Some symbols exported to other modules are really used only by
    openvswitch.ko. Remove the exports.

    Tested by loading all 4 openvswitch modules, nothing breaks.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: remove unused functions
Jiri Benc [Thu, 16 Feb 2017 01:34:17 +0000 (17:34 -0800)]
datapath: remove unused functions

Upstream commit:
    commit f33eb0cf9984f79e8643eaac888e4b6a06a8e221
    Author: Jiri Benc <jbenc@redhat.com>
    Date:   Wed Oct 19 11:26:36 2016 +0200

    openvswitch: remove unused functions

    ovs_vport_deferred_free is not used anywhere. It's the only caller of
    free_vport_rcu thus this one can be removed, too.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: add NETIF_F_HW_VLAN_STAG_TX to internal dev.
Jiri Benc [Mon, 10 Oct 2016 15:02:44 +0000 (17:02 +0200)]
datapath: add NETIF_F_HW_VLAN_STAG_TX to internal dev.

Upstream commit:
    commit 3145c037e74926dea9241a3f68ada6f294b0119a
    Author: Jiri Benc <jbenc@redhat.com>
    Date:   Mon Oct 10 17:02:44 2016 +0200

    openvswitch: add NETIF_F_HW_VLAN_STAG_TX to internal dev

    The internal device does support 802.1AD offloading since 018c1dda5ff1
    ("openvswitch: 802.1AD Flow handling, actions, vlan parsing, netlink
    attributes").

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Eric Garver <e@erig.me>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: 3145c037e749 ("openvswitch: add NETIF_F_HW_VLAN_STAG_TX to internal dev")
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
7 years agodatapath: avoid resetting flow key while installing new flow.
pravin shelar [Thu, 16 Feb 2017 01:34:16 +0000 (17:34 -0800)]
datapath: avoid resetting flow key while installing new flow.

Upstream commit:
    commit 2279994d07ab67ff7a1d09bfbd65588332dfb6d8
    Author: pravin shelar <pshelar@ovn.org>
    Date:   Mon Sep 19 13:51:00 2016 -0700

    openvswitch: avoid resetting flow key while installing new flow.

    since commit commit db74a3335e0f6 ("openvswitch: use percpu
    flow stats") flow alloc resets flow-key. So there is no need
    to reset the flow-key again if OVS is using newly allocated
    flow-key.

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: Fix Frame-size larger than 1024 bytes warning.
pravin shelar [Thu, 16 Feb 2017 01:34:15 +0000 (17:34 -0800)]
datapath: Fix Frame-size larger than 1024 bytes warning.

Upstream commit:
    commit 190aa3e77880a05332ea1ccb382a51285d57adb5
    Author: pravin shelar <pshelar@ovn.org>
    Date:   Mon Sep 19 13:50:59 2016 -0700

    openvswitch: Fix Frame-size larger than 1024 bytes warning.

    There is no need to declare separate key on stack,
    we can just use sw_flow->key to store the key directly.

    This commit fixes following warning:

    net/openvswitch/datapath.c: In function ‘ovs_flow_cmd_new’:
    net/openvswitch/datapath.c:1080:1: warning: the frame size of 1040 bytes
    is larger than 1024 bytes [-Wframe-larger-than=]

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: use percpu flow stats
Thadeu Lima de Souza Cascardo [Thu, 16 Feb 2017 01:34:14 +0000 (17:34 -0800)]
datapath: use percpu flow stats

Upstream commit:
    commit db74a3335e0f645e3139c80bcfc90feb01d8e304
    Author: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
    Date:   Thu Sep 15 19:11:53 2016 -0300

    openvswitch: use percpu flow stats

    Instead of using flow stats per NUMA node, use it per CPU. When using
    megaflows, the stats lock can be a bottleneck in scalability.

    On a E5-2690 12-core system, usual throughput went from ~4Mpps to
    ~15Mpps when forwarding between two 40GbE ports with a single flow
    configured on the datapath.

    This has been tested on a system with possible CPUs 0-7,16-23. After
    module removal, there were no corruption on the slab cache.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Cc: pravin shelar <pshelar@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: fix flow stats accounting when node 0 is not possible
Thadeu Lima de Souza Cascardo [Thu, 16 Feb 2017 01:34:13 +0000 (17:34 -0800)]
datapath: fix flow stats accounting when node 0 is not possible

Upstream commit:
    commit 40773966ccf1985a1b2bb570a03cbeaf1cbd4e00
    Author: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
    Date:   Thu Sep 15 19:11:52 2016 -0300

    openvswitch: fix flow stats accounting when node 0 is not possible

    On a system with only node 1 as possible, all statistics is going to be
    accounted on node 0 as it will have a single writer.

    However, when getting and clearing the statistics, node 0 is not going
    to be considered, as it's not a possible node.

    Tested that statistics are not zero on a system with only node 1
    possible. Also compile-tested with CONFIG_NUMA off.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This patch contained a memory leak that is fixed in this backport.
The next patch silently fixed that in upstream, too.

Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: 802.1AD Flow handling, actions, vlan parsing, netlink attributes
Yang, Yi Y [Mon, 13 Feb 2017 02:39:15 +0000 (10:39 +0800)]
datapath: 802.1AD Flow handling, actions, vlan parsing, netlink attributes

Upstream commit:
    commit 018c1dda5ff1e7bd1fe2d9fd1d0f5b82dc6fc0cd
    Author: Eric Garver <e@erig.me>
    Date:   Wed Sep 7 12:56:59 2016 -0400

    openvswitch: 802.1AD Flow handling, actions, vlan parsing, netlink attributes

    Add support for 802.1ad including the ability to push and pop double
    tagged vlans. Add support for 802.1ad to netlink parsing and flow
    conversion. Uses double nested encap attributes to represent double
    tagged vlan. Inner TPID encoded along with ctci in nested attributes.

    This is based on Thomas F Herbert's original v20 patch. I made some
    small clean ups and bug fixes.

Signed-off-by: Thomas F Herbert <thomasfherbert@gmail.com>
Signed-off-by: Eric Garver <e@erig.me>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream commit:
    commit 20ecf1e4e30005ad50f561a92c888b6477f99341
    Author: Jiri Benc <jbenc@redhat.com>
    Date:   Mon Oct 10 17:02:42 2016 +0200

    openvswitch: vlan: remove wrong likely statement

    This code is called whenever flow key is being extracted from the packet.
    The packet may be as likely vlan tagged as not.

Fixes: 018c1dda5ff1 ("openvswitch: 802.1AD Flow handling, actions, vlan parsing, netlink attributes")
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Eric Garver <e@erig.me>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream commit:
    commit 72ec108d701506fa6cd2f66ec5b15ea71df3c464
    Author: Jiri Benc <jbenc@redhat.com>
    Date:   Mon Oct 10 17:02:43 2016 +0200

    openvswitch: fix vlan subtraction from packet length

    When the packet has its vlan tag in skb->vlan_tci, the length of the VLAN
    header is not counted in skb->len. It doesn't make sense to subtract it.

Fixes: 018c1dda5ff1 ("openvswitch: 802.1AD Flow handling, actions, vlan parsing, netlink attributes")
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Eric Garver <e@erig.me>
Signed-off-by: David S. Miller <davem@davemloft.net>
[Committer notes]

The following commits upstream fix bugs in this patch, so to retain
bisectability of the OVS tree they were rolled into this commit:

20ecf1e4e300 openvswitch: vlan: remove wrong likely statement
72ec108d7015 openvswitch: fix vlan subtraction from packet length

Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Acked-by: Eric Garver <e@erig.me>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: backport: vlan: Check for vlan ethernet types for 8021.q or 802.1ad
Yang, Yi Y [Mon, 13 Feb 2017 02:39:14 +0000 (10:39 +0800)]
datapath: backport: vlan: Check for vlan ethernet types for 8021.q or 802.1ad

Upstream commit:
    commit fe19c4f971a55cea3be442d8032a5f6021702791
    Author: Eric Garver <e@erig.me>
    Date:   Wed Sep 7 12:56:58 2016 -0400

    This is to simplify using double tagged vlans. This function allows all
    valid vlan ethertypes to be checked in a single function call.
    Also replace some instances that check for both ETH_P_8021Q and
    ETH_P_8021AD.

    Patch based on one originally by Thomas F Herbert.

Signed-off-by: Thomas F Herbert <thomasfherbert@gmail.com>
Signed-off-by: Eric Garver <e@erig.me>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Acked-by: Eric Garver <e@erig.me>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: backport: openvswitch: 802.1ad uapi changes.
Yang, Yi Y [Mon, 13 Feb 2017 02:39:13 +0000 (10:39 +0800)]
datapath: backport: openvswitch: 802.1ad uapi changes.

Upstream commit:
    commit 8c146bb9d59aa2ac45222171916ece186c4b3943
    Author: Thomas F Herbert <thomasfherbert@gmail.com>
    Date:   Wed Sep 7 12:56:57 2016 -0400

    openvswitch: Add support for 8021.AD

    Change the description of the VLAN tpid field.

Signed-off-by: Thomas F Herbert <thomasfherbert@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Acked-by: Eric Garver <e@erig.me>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: backport: vlan: Introduce helper functions to check if skb is tagged
Yang, Yi Y [Mon, 13 Feb 2017 02:39:12 +0000 (10:39 +0800)]
datapath: backport: vlan: Introduce helper functions to check if skb is tagged

Upstream commit:
    commit f5a7fb88e1f82542ca14ba93a1d4fa35471c60ca
    Author: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
    Date:   Fri Mar 27 14:31:11 2015 +0900

    vlan: Introduce helper functions to check if skb is tagged

    Separate the two checks for single vlan and multiple vlans in
    netif_skb_features().  This allows us to move the check for multiple
    vlans to another function later.

Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Acked-by: Eric Garver <e@erig.me>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: backport: Fix vlan_insert_tag_set_proto().
Yang, Yi Y [Mon, 13 Feb 2017 02:39:16 +0000 (10:39 +0800)]
datapath: backport: Fix vlan_insert_tag_set_proto().

Fix cvlan test failure on old kernel versions with 802.1ad. The root
cause is the upcall re-inserts the VLAN back into the raw packet data,
but the TPID is hard coded to 0x8100. This affects kernels for which
HAVE_VLAN_INSERT_TAG_SET_PROTO is not set.

The below patch allows the cvlan and 802.ad tests to pass on debian
with 3.16 kernel.

Signed-off-by: Eric Garver <e@erig.me>
Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Acked-by: Eric Garver <e@erig.me>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agoFAQ: Update kernel support info.
Jarno Rajahalme [Tue, 28 Feb 2017 01:44:52 +0000 (17:44 -0800)]
FAQ: Update kernel support info.

OVS 2.7 works with Linux kernels 3.10-4.9.

Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
7 years agorhel-systemd: Document systemd behavior
Eelco Chaudron [Wed, 8 Feb 2017 16:28:22 +0000 (17:28 +0100)]
rhel-systemd: Document systemd behavior

This is a follow up patch to document the systemd behavior including
the change introduced by the "rhel-systemd: Restart openvswitch
service if a daemon crashes", still under review.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agorhel-systemd: Restart openvswitch service if a daemon crashes
Eelco Chaudron [Mon, 27 Feb 2017 20:56:41 +0000 (15:56 -0500)]
rhel-systemd: Restart openvswitch service if a daemon crashes

Currently if either ovsdb-server or ovs-vswitchd is crashing the
daemon is not restarting leaving the system in faulty state.
This patch will detect the daemon crash and will restart the
openvswitch service.

Here is a (bit to wide) table showing the behavior before and after
the patch. Note that only the Crash behavior has changed:

Before patch:
                               |       Process Status        |             systemctl <> status            |
                               | ovs-vswitchd | ovsdb-server | openvswitch  | ovs-vswitchd | ovsdb-server |
                               +--------------+--------------+--------------+--------------+--------------+
systemctl start openvswitch*   | started      | started      |active,exited |active,running|active,running|
Crash vswitchd                 | crashed      | stopped      |inactive, dead|failed        |inactive,dead |
Crash ovsdb                    | stopped      | crashed      |inactive, dead|inactive,dead |failed        |
systemctl restart openvswitch  | re-started   | re-started   |active,exited |active,running|active,running|
systemctl restart ovs-vswitchd | re-started   | re-started   |active,exited |active,running|active,running|
systemctl restart ovsdb-server | re-started   | re-started   |active,exited |active,running|active,running|
systemctl stop openvswitch     | stopped      | stopped      |inactive, dead|inactive,dead |inactive,dead |
systemctl stop ovs-vswitchd    | stopped      | stopped      |inactive, dead|inactive,dead |inactive,dead |
systemctl stop ovsdb-server    | stopped      | stopped      |inactive, dead|inactive,dead |inactive,dead |
systemctl start ovs-vswitchd*  | started      | started      |inactive, dead|active,running|active,running|
systemctl start ovsdb-server*  | not started  | started      |inactive, dead|inactive, dead|active,running|

With patch:
                               |       Process Status        |             systemctk <> status            |
                               | ovs-vswitchd | ovsdb-server | openvswitch  | ovs-vswitchd | ovsdb-server |
                               +--------------+--------------+--------------+--------------+--------------+
systemctl start openvswitch*   | started      | started      |active,exited |active,running|active,running|
Crash vswitchd                 | crash,started| re-started   |active,exited |active,running|active,running|
Crash ovsdb                    | re-started   | crash,started|active,exited |active,running|active,running|
systemctl restart openvswitch  | re-started   | re-started   |active,exited |active,running|active,running|
systemctl restart ovs-vswitchd | re-started   | re-started   |active,exited |active,running|active,running|
systemctl restart ovsdb-server | re-started   | re-started   |active,exited |active,running|active,running|
systemctl stop openvswitch     | stopped      | stopped      |inactive, dead|inactive,dead |inactive,dead |
systemctl stop ovs-vswitchd    | stopped      | stopped      |inactive, dead|inactive,dead |inactive,dead |
systemctl stop ovsdb-server    | stopped      | stopped      |inactive, dead|inactive,dead |inactive,dead |
systemctl start ovs-vswitchd*  | started      | started      |inactive, dead|active,running|active,running|
systemctl start ovsdb-server*  | not started  | started      |inactive, dead|inactive, dead|active,running|

* These commands where executed when no ovs related processes where
  running. All other commands where executed when OVS was successfully
  running.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Markos Chandras <mchandras@suse.de>
Acked-by: Aaron Conole <aconole@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agomsi: add ovs-vswitchd trigger info
Alin Serdean [Tue, 21 Feb 2017 21:50:53 +0000 (21:50 +0000)]
msi: add ovs-vswitchd trigger info

This patch changes the service ovs-vswitchd from "auto" execution to
"demand" start.

This patch also introduces a custom action for the ovs-vswitchd service
in which the following command will be executed before the service startup:

sc triggerinfo ovs-vswitchd \
start/strcustom/6066F867-7CA1-4418-85FD-36E3F9C0600C/VmmsWmiEventProvider

The above command is a service trigger available since Windows 7.
More on the topic:
https://msdn.microsoft.com/en-us/library/windows/desktop/dd405513%28v=vs.85%29.aspx

In out case we will wait until Microsoft-Windows-Hyper-V-VMMS has triggered
that the WMI provider: VmmsWmiEventProvider has started.

The change is needed because the network service inside VMMS starts slower than
ovs-vswitchd, which will cause a race condition because we check if the OVS
extension is enabled on a single switch.

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 agoovs-ctl: allow passing user:group to daemons
Aaron Conole [Tue, 21 Feb 2017 22:31:05 +0000 (17:31 -0500)]
ovs-ctl: allow passing user:group to daemons

The Open vSwitch daemons allow passing --user user[:group] to allow
spawning under different user privileges.  ovs-ctl now accepts --ovs-user
in the same form to pass this argument on, as well as create databases and
data directories with the appropriate privileges.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Reviewed-by: Markos Chandras <mchandras@suse.de>
Signed-off-by: Andy Zhou <azhou@ovn.org>
7 years agoofproto/bond: fix interal flow leak of tcp-balance bond
Huanle Han [Sun, 19 Feb 2017 10:41:27 +0000 (18:41 +0800)]
ofproto/bond: fix interal flow leak of tcp-balance bond

ofproto_dpif_delete_internal_flow() never deletes any flows
because out_port and out_group mismatch.

Signed-off-by: Huanle Han <hanxueluo@gmail.com>
Signed-off-by: Andy Zhou <azhou@ovn.org>
7 years agoofproto/bond: Fix bond post recirc rule leak.
Andy Zhou [Thu, 23 Feb 2017 08:38:16 +0000 (00:38 -0800)]
ofproto/bond: Fix bond post recirc rule leak.

When bond is removed or when its configuration changes,
the post recirculation rules that are installed by current
bond configuration, if any, should be also be removed.

Reported-by: Huanle Han <hanxueluo@gmail.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-February/328969.html
CC: Huanle Han <hanxueluo@gmail.com>
Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
Acked-by: Huanle Han <hanxueluo@gmail.com>
7 years agoofproto/bond: Fix bond reconfiguration race condition.
Andy Zhou [Thu, 23 Feb 2017 07:31:31 +0000 (23:31 -0800)]
ofproto/bond: Fix bond reconfiguration race condition.

During the upcall thread bond output translation, bond_may_recirc()
is currently called outside the lock. In case the main thread executes
bond_reconfigure() at the same time, the upcall thread may find bond
state to be inconsistent when calling bond_update_post_recirc_rules().

This patch fixes the race condition by acquiring the write lock
before calling bond_may_recirc(). The APIs are refactored slightly.

The race condition can result in the following stack trace. Copied
from 'Reported-at':

    Thread 23 handler69:
    Invalid write of size 8
        update_recirc_rules (bond.c:385)
        bond_update_post_recirc_rules__ (bond.c:952)
        bond_update_post_recirc_rules (bond.c:960)
        output_normal (ofproto-dpif-xlate.c:2102)
        xlate_normal (ofproto-dpif-xlate.c:2858)
        xlate_output_action (ofproto-dpif-xlate.c:4407)
        do_xlate_actions (ofproto-dpif-xlate.c:5335)
        xlate_actions (ofproto-dpif-xlate.c:6198)
        upcall_xlate (ofproto-dpif-upcall.c:1129)
        process_upcall (ofproto-dpif-upcall.c:1271)
        recv_upcalls (ofproto-dpif-upcall.c:822)
        udpif_upcall_handler (ofproto-dpif-upcall.c:740)
    Address 0x18630490 is 1,904 bytes inside a block of size 12,288 free'd
        free (vg_replace_malloc.c:529)
        bond_entry_reset (bond.c:1635)
        bond_reconfigure (bond.c:457)
        bundle_set (ofproto-dpif.c:2896)
        ofproto_bundle_register (ofproto.c:1343)
        port_configure (bridge.c:1159)
        bridge_reconfigure (bridge.c:785)
        bridge_run (bridge.c:3099)
        main (ovs-vswitchd.c:111)
    Block was alloc'd at
        malloc (vg_replace_malloc.c:298)
        xmalloc (util.c:110)
        bond_entry_reset (bond.c:1629)
        bond_reconfigure (bond.c:457)
        bond_create (bond.c:245)
        bundle_set (ofproto-dpif.c:2900)
        ofproto_bundle_register (ofproto.c:1343)
        port_configure (bridge.c:1159)
        bridge_reconfigure (bridge.c:785)
        bridge_run (bridge.c:3099)
        main (ovs-vswitchd.c:111)

Reported-by: Huanle Han <hanxueluo@gmail.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-February/328969.html
CC: Huanle Han <hanxueluo@gmail.com>
Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
Acked-by: Huanle Han <hanxueluo@gmail.com>
7 years agoovs-appctl: Document -T and --timeout options.
Ben Pfaff [Thu, 23 Feb 2017 20:40:01 +0000 (12:40 -0800)]
ovs-appctl: Document -T and --timeout options.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
7 years agorhel: Add hostname as dependency
Jakub Libosvar [Thu, 9 Feb 2017 11:11:28 +0000 (12:11 +0100)]
rhel: Add hostname as dependency

ovs-ctl script uses hostname. This patch adds dependency for
rhel systems.

Signed-off-by: Jakub Libosvar <libosvar@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agofedora: Add python3-openvswitch split package
Timothy Redaelli [Tue, 21 Feb 2017 15:29:51 +0000 (16:29 +0100)]
fedora: Add python3-openvswitch split package

Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1412694
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agoofproto: Remove 'ofproto/self-check' from ovs-vswitchd manpage
Timothy Redaelli [Tue, 21 Feb 2017 11:13:42 +0000 (12:13 +0100)]
ofproto: Remove 'ofproto/self-check' from ovs-vswitchd manpage

ofproto/self-check was removed in commit e79a6c83, so this patch
removes the man page item.

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodocs: fix typo in testing.rst
Lance Richardson [Mon, 20 Feb 2017 18:12:30 +0000 (13:12 -0500)]
docs: fix typo in testing.rst

Coverage section refers to "check-lcoc" target, should be
"check-lcov".

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agoMakefile.am: Suppress echoing of config-h-check.
Timothy Redaelli [Wed, 22 Feb 2017 16:18:28 +0000 (17:18 +0100)]
Makefile.am: Suppress echoing of config-h-check.

Fixes: c458e4a372d1 ("Makefile.am: Avoid include/ depending on lib/.")
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agoovn pacemaker: Pass --db-(n/s)b-addr option when starting ovsdb-servers
Numan Siddique [Wed, 22 Feb 2017 14:58:36 +0000 (20:28 +0530)]
ovn pacemaker: Pass --db-(n/s)b-addr option when starting ovsdb-servers

When pacemaker script, starts the ovsdb-servers in all the nodes,
it doesn't pass the --db-(n/s)b-addr=MASTER_IP option.
When pacemaker promotes a master, it won't be listening on the
master ip address unless "ovn-nbctl set-connection" is used.

In this patch this option, along with --db-(n/s)b-create-insecure-remote=yes
for "tcp" connection types is passed when starting the OVN ovsdb-servers
to overcome this issue.

Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Andy Zhou <azhou@ovn.org>
7 years agowindows: Broken internal netdevs
Alin Serdean [Fri, 17 Feb 2017 11:10:27 +0000 (11:10 +0000)]
windows: Broken internal netdevs

Commit fa07525f9cf3fa698ebc23ea09da477d3d881a87 fixed error logging for
for regular netdevs, however it overlooked "internal" netdevs.

This patch allows "internal" netdev objects to be created and passed to
dpif_port_add().

Reported-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Nithin Raju <Nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agodoc: Describe backporting process.
Joe Stringer [Fri, 10 Feb 2017 23:01:11 +0000 (15:01 -0800)]
doc: Describe backporting process.

This patch documents the backporting process, and provides a walkthrough
for developers who would like to backport upstream Linux patches into
the Open vSwitch tree. Nothing in this documentation should be
surprising or new; it merely puts the existing process into words.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
Acked-by: Stephen Finucane <stephen@that.guru>
7 years agoMakefile.am: Avoid include/ depending on lib/.
Yi-Hung Wei [Sat, 18 Feb 2017 01:47:45 +0000 (17:47 -0800)]
Makefile.am: Avoid include/ depending on lib/.

Add a build check that public openvswitch header file should not include
internal library.

Suggested-by: Joe Stringer <joe@ovn.org>
Suggested-by: Daniele Di Proietto <diproiettod@vmware.com>
Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agometa-flow: Remove cmap dependency.
Yi-Hung Wei [Sat, 18 Feb 2017 01:47:44 +0000 (17:47 -0800)]
meta-flow: Remove cmap dependency.

Previous patch 04f48a68 ("ofp-actions: Fix variable length meta-flow OXMs.")
introduced dependency of an internal library (cmap.h) to ovs public
interface (meta-flow.h) that may cause potential building problem. In this
patch, we remove cmap from struct mf_field, and provide a wrapper struct
vl_mff_map that resolve the dependency problem.

Fixes: 04f48a68c428 ("ofp-actions: Fix variable length meta-flow OXMs.")
Suggested-by: Joe Stringer <joe@ovn.org>
Suggested-by: Daniele Di Proietto <diproiettod@vmware.com>
Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agoofp-msgs: Remove unnecessary #include.
Yi-Hung Wei [Sat, 18 Feb 2017 01:47:43 +0000 (17:47 -0800)]
ofp-msgs: Remove unnecessary #include.

Include of lib/*.h from include/openvswitch/*.h is disallowed.

Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agoofproto/bond: Fix bond/show when all interfaces are disabled
Andy Zhou [Wed, 15 Feb 2017 22:04:29 +0000 (14:04 -0800)]
ofproto/bond: Fix bond/show when all interfaces are disabled

Without this patch, when all slaves are disabled, the 'bond/show'
command still shows the mac address of last active slave in
'active slave mac' output. This patch clears them to zeros.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: nickcooper-zhangtonghao <nic@opencloud.tech>
7 years agopython: Prevent extra unexpected reply debug logs.
Terry Wilson [Fri, 17 Feb 2017 17:27:46 +0000 (11:27 -0600)]
python: Prevent extra unexpected reply debug logs.

Since __txn_process_reply always returns None, the existing code
will always hit the final else for replies and log a debug message
about receiving an unexpected reply. In the C version,
ovsdb_idl_txn_process_reply returns true any time the txn is found,
so that behavior is duplicated here.

Signed-off-by: Terry Wilson <twilson@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agonetdev-dpdk: Fix rx_error stat for dpdk ports.
Ian Stokes [Thu, 16 Feb 2017 15:31:22 +0000 (15:31 +0000)]
netdev-dpdk: Fix rx_error stat for dpdk ports.

"rx_error" stat for a DPDK interface was calculated with the assumption that
dropped packets due to hardware buffer overload were counted as errors
in DPDK and the rte ierror stat included rte imissed packets i.e.

rx_errors = rte_stats.ierrors - rte_stats.imissed

This results in negative statistic values as imissed packets are no longer
counted as part of ierror since DPDK v.16.04.

Fix this by setting rx_errors equal to ierrors only.

Fixes: 9e3ddd45 (netdev-dpdk: Add some missing statistics.)
CC: Timo Puha <timox.puha@intel.com>)
Reported-by: Stepan Andrushko <stepanx.andrushko@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
7 years agoovs-appctl: Print lacp_fallback_ab info in "bond/show".
nickcooper-zhangtonghao [Thu, 16 Feb 2017 10:52:45 +0000 (02:52 -0800)]
ovs-appctl: Print lacp_fallback_ab info in "bond/show".

Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
Signed-off-by: Andy Zhou <azhou@ovn.org>
7 years agoofproto/bond: Drop traffic in balance-tcp mode without lacp.
nickcooper-zhangtonghao [Thu, 16 Feb 2017 01:32:18 +0000 (17:32 -0800)]
ofproto/bond: Drop traffic in balance-tcp mode without lacp.

The balance-tcp mode requires the upstream switch to support 802.3ad
with successful LACP negotiation. When bond ports are configured to
balance-tcp mode without lacp, drop the traffic.

Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
Signed-off-by: Andy Zhou <azhou@ovn.org>
7 years agodpif-netdev: Conditional EMC insert
Ciara Loftus [Thu, 16 Feb 2017 10:22:10 +0000 (10:22 +0000)]
dpif-netdev: Conditional EMC insert

Unconditional insertion of EMC entries results in EMC thrashing at high
numbers of parallel flows. When this occurs, the performance of the EMC
often falls below that of the dpcls classifier, rendering the EMC
practically useless.

Instead of unconditionally inserting entries into the EMC when a miss
occurs, use a 1% probability of insertion. This ensures that the most
frequent flows have the highest chance of creating an entry in the EMC,
and the probability of thrashing the EMC is also greatly reduced.

The probability of insertion is configurable, via the
other_config:emc-insert-inv-prob option. This value sets the average
probability of insertion to 1/emc-insert-inv-prob.

For example the following command changes the insertion probability to
(on average) 1 in every 20 packets ie. 1/20 ie. 5%.

ovs-vsctl set Open_vSwitch . other_config:emc-insert-inv-prob=20

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Signed-off-by: Georg Schmuecking <georg.schmuecking@ericsson.com>
Co-authored-by: Georg Schmuecking <georg.schmuecking@ericsson.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
7 years agoovn: Mention distributed NAT in NEWS
Mickey Spiegel [Fri, 10 Feb 2017 23:07:28 +0000 (15:07 -0800)]
ovn: Mention distributed NAT in NEWS

Signed-off-by: Mickey Spiegel <mickeys.dev@gmail.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agodocker.rst: Add documentation to open up TCP ports.
Gurucharan Shetty [Tue, 7 Feb 2017 12:53:16 +0000 (04:53 -0800)]
docker.rst: Add documentation to open up TCP ports.

Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
7 years agovswitchd: Move config_ofproto_types call before bridge_add_port
Shashank Ram [Wed, 15 Feb 2017 18:02:40 +0000 (10:02 -0800)]
vswitchd: Move config_ofproto_types call before bridge_add_port

Currently, the call to config_ofproto_types() happens at the end
of bridge_reconfigure(), after missing ofprotos and ports are created.
However, it might be usefull to make this call before adding missing
ports through the dpif interface. With the current use case
(dpif-netdev), this will save us a reconfiguration cycle.

The call to config_ofproto_types() was introduced as a
part of passing the Openvswitch other_config smap to dpif.
However, if we want to do this before the ports are added,
it needs to be done after ofproto_create() is called so that
dpif_backer is added to all_dpif_backers list. Once the
dpif_backer is added, the call to config_ofproto_types()
will ensure that the set_config handler in dpif-netdev/netlink.c
is called.

Signed-off-by: Shashank Ram <rams@vmware.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
7 years agodoc: Updates bonding.rst because of api changed.
nickcooper-zhangtonghao [Tue, 14 Feb 2017 06:52:53 +0000 (22:52 -0800)]
doc: Updates bonding.rst because of api changed.

Signed-off-by: Andy Zhou <azhou@ovn.org>
7 years agoofproto/bond: Validate active-slave mac.
nickcooper-zhangtonghao [Tue, 14 Feb 2017 06:52:50 +0000 (22:52 -0800)]
ofproto/bond: Validate active-slave mac.

That the mac of active-slave is invalid(e.g. 00:00:00:00:00:00)
is incidental. The reason is described as below.

In the bridge_reconfig():
1. bond devices created in port_configure().
2. the bonded interfaces may be disabled even calling bridge_run__(),
   because the interface link is not ready.

The OvS will run bridge_run__() in next loop. In next loop, the
active-slave may be selected. But OvS the bridge_reconfig() again,
the bond_reconfigure() set active-slave mac zero and flag false.
If using the 'ovs-appctl bond/show bond-name' to check active-slave
mac, you will find the mac is zero and mac in the ovsdb is also zero.

The active_slave_mac and active_slave_changed should be initialized
when created.

Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
Signed-off-by: Andy Zhou <azhou@ovn.org>
7 years agoovn-northd ipam: handle the static MAC updates by the user
Numan Siddique [Mon, 13 Feb 2017 07:13:03 +0000 (12:43 +0530)]
ovn-northd ipam: handle the static MAC updates by the user

Changing the logical port's address from "MAC1 dynamic"
to "MAC2 dynamic" is not handled by ovn-northd. This patch
fixes this issue.

Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1408121
Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agoovsdb: Print enum elements for man pages in alphabetical order.
Justin Pettit [Wed, 15 Feb 2017 00:50:32 +0000 (16:50 -0800)]
ovsdb: Print enum elements for man pages in alphabetical order.

The previous behavior printed them in a pseudorandom order, which made
them look odd in man pages.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
7 years agoRemove build-time generated files when "make clean" is run.
Justin Pettit [Tue, 14 Feb 2017 01:20:56 +0000 (17:20 -0800)]
Remove build-time generated files when "make clean" is run.

"make clean" should remove all files generated by building a program, while
"make distclean" should also remove files generated by configuring the
program.  Previously some generated files during the build process, such
as man pages, were left behind when "make clean" was run.  This commit
only leaves configuration files after "make clean" is run, and removes
all other generated files.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoovsdb: Prevent OVSDB server from replicating itself.
Andy Zhou [Mon, 6 Feb 2017 22:00:22 +0000 (14:00 -0800)]
ovsdb: Prevent OVSDB server from replicating itself.

Replication OVSDB server from itself is usually caused by configuration
errors. Such configuration errors can lead to OVSDB server data loss.
See "reported-at" for more details.

This patch adds logics that prevent OVSDB server from replicating
itself.

Reported-by: Guishuai Li <ligs@dtdream.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-January/326963.html
Suggested-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoovsdb: Add OVSDB server per instance UUID.
Andy Zhou [Mon, 6 Feb 2017 20:43:35 +0000 (12:43 -0800)]
ovsdb: Add OVSDB server per instance UUID.

Currently, there is no way for an OVSDB server to ID itself. This patch
adds a UUID field that is populated every time OVSDB server runs.
Later patch will make use this UUID to detect and stop and OVSDB server
from replicating itself.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoovsdb: Gracefully handle replication errors.
Andy Zhou [Wed, 8 Feb 2017 03:38:13 +0000 (19:38 -0800)]
ovsdb: Gracefully handle replication errors.

Sometimes replication session can fail mostly due to replication
configurations. i.e. replicating from a database with a different
version of the schema.

Currently, those errors are treated as fatal errors, and stops the
OVSDB server. A better way to handle those error may be to stop
only the replication session, and leave the OVSDB server up, so that
the replication can be restarted, may be with a different configuration,
at a later time.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoAUTHORS: Add Mickey Spiegel
Mickey Spiegel [Fri, 10 Feb 2017 23:15:14 +0000 (15:15 -0800)]
AUTHORS: Add Mickey Spiegel

Signed-off-by: Mickey Spiegel <mickeys.dev@gmail.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agorhel: make openvswitch service start return when ready
Alan Pevec [Sat, 11 Feb 2017 00:03:19 +0000 (19:03 -0500)]
rhel: make openvswitch service start return when ready

In OVS 2.6 openvswitch systemd service was changed to use BindsTo
instead of Requires for sub-services but also removed them from After

This made main openvswitch service return before sub-services were ready
breaking scripts which assumed everything is ready after systemctl start
e.g. in OpenStack CI infra [1] is calling ovs-vsctl immediately after
service start exposing a race in virtualized CI environment:
2017-02-09T23:11:12.498Z|00007|bridge|INFO|ovs-vswitchd (Open vSwitch) 2.6.1
but ovs-ctl tried to access it few msec too early:
2017-02-09 23:11:12.352493 | ovs-vsctl: unix:/var/run/openvswitch/db.sock: database connection failed (No such file or directory)

Solution is to add ordering dependencies, BindsTo/Requires do not ensure it [2]

[1] https://github.com/openstack-infra/devstack-gate/blob/c435a724bd257b22a2e39e8e9125c11302a8c81d/functions.sh#L1057-L1078

[2] https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Requires=

Fixes: 84ad120 ("rhel: Improved Systemd Integration")
Signed-off-by: Alan Pevec <alan.pevec@redhat.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agorhel: Fix dpdk-devel version and dependencies in fedora packager
Timothy Redaelli [Thu, 9 Feb 2017 14:47:50 +0000 (15:47 +0100)]
rhel: Fix dpdk-devel version and dependencies in fedora packager

Now dpdk-devel >= 16.11 is needed and also libpcap-devel numactl-devel

Tested on mock with rawhide chroot and Fedora 23 vagrant machine by using the
rawhide dpdk and dpdk-devel packages

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
7 years agodpdk: Fixes memory leak in dpdk_init__().
nickcooper-zhangtonghao [Thu, 9 Feb 2017 11:25:41 +0000 (03:25 -0800)]
dpdk: Fixes memory leak in dpdk_init__().

If users configure the 'vhost-sock-dir' for dpdk, the memory
allocated by xstrdup(ovs_rundir()) is not freed. This patch
allows the process_vhost_flags to xstrdup() for val or
default_val according to configuration and the caller must
free new_val when it is no longer needed.

Fixes: 01961bbdd34a ("dpdk: New module with some code from netdev-dpdk.")
CC: Daniele Di Proietto <diproiettod@vmware.com>
Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
Reviewed-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>