]> git.proxmox.com Git - mirror_ovs.git/log
mirror_ovs.git
5 years agoOVN: update RA next_announce according to {min, max}_interval
Lorenzo Bianconi [Mon, 4 Mar 2019 16:14:14 +0000 (17:14 +0100)]
OVN: update RA next_announce according to {min, max}_interval

Update RA next_announce whenever min_interval and/or max_interval are
updated in sbrec_port_binding option. In the current implementation
if ipv6_ra_configs:send_periodic is set to true before setting
ipv6_ra_configs:{min,max}_interval, next_announce will be set using
default values and it will not be updated until we send the first IPv6
router advertisement

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agolib/tc: add ingress ratelimiting support for tc-offload
Pieter Jansen van Vuuren [Fri, 1 Feb 2019 10:19:32 +0000 (10:19 +0000)]
lib/tc: add ingress ratelimiting support for tc-offload

Firstly this patch introduces the notion of reserved priority, as the
filter implementing ingress policing would require the highest priority.
Secondly it allows setting rate limiters while tc-offloads has been
enabled. Lastly it installs a matchall filter that matches all traffic
and then applies a police action, when configuring an ingress rate
limiter.

An example of what to expect:

OvS CLI:
ovs-vsctl set interface <netdev_name> ingress_policing_rate=5000
ovs-vsctl set interface <netdev_name> ingress_policing_burst=100

Resulting TC filter:
filter protocol ip pref 1 matchall chain 0
filter protocol ip pref 1 matchall chain 0 handle 0x1
  not_in_hw
action order 1:  police 0x1 rate 5Mbit burst 125Kb mtu 64Kb
action drop/continue overhead 0b
        ref 1 bind 1 installed 3 sec used 3 sec
        Action statistics:
        Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to
10.0.0.200 () port 0 AF_INET : demo
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

131072  16384  16384    60.13       4.49

ovs-vsctl list interface <netdev_name>
_uuid               : 2ca774e8-8b95-430f-a2c2-f8f742613ab1
admin_state         : up
...
ingress_policing_burst: 100
ingress_policing_rate: 5000
...
type                : ""

Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
5 years agodpdk: Fix case-sensitivity of dpdk-init knob.
Ilya Maximets [Fri, 1 Mar 2019 11:59:33 +0000 (14:59 +0300)]
dpdk: Fix case-sensitivity of dpdk-init knob.

Before supporting the DPDK initialization status in DB 'dpdk-init' was
just a boolean and 'smap_get_bool', which is case-insensitive, was used
to get the value.

Current code uses simple 'strcmp' that fails to recognize values like
"True". As a result this breaks different OVS configuration tools.
For example, kolla-ansible uses 'other_config:dpdk-init=True' but OVS
is not able to recognize it leading to broken installations.

'strcasecmp' should be used instead to fix the issue.

CC: Aaron Conole <aconole@redhat.com>
Fixes: 3e52fa5644cd ("dpdk: reflect status and version in the database")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
5 years agoovsdb: Add NEWS for fast-resync feature.
Han Zhou [Sat, 2 Mar 2019 03:46:42 +0000 (19:46 -0800)]
ovsdb: Add NEWS for fast-resync feature.

Signed-off-by: Han Zhou <hzhou8@ebay.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agorconn: Avoid occasional immediate connection failures.
Ben Pfaff [Fri, 1 Mar 2019 18:51:16 +0000 (10:51 -0800)]
rconn: Avoid occasional immediate connection failures.

The rconn connection timer measures time on the granularity of seconds,
which means that sometimes the actual timeout can be just a millsecond or
so, which led to occasional immediate connection failures from ovs-ofctl.

VMware-BZ: #2295760
Fixes: 476d2551abd2 ("rconn: Introduce new invariant to fix assertion failure in corner case.")
Reported-by: Ken Ajiro <ken-ajiro@xr.jp.nec.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agorhel: Fix tests on mock and koji
Timothy Redaelli [Thu, 28 Feb 2019 15:55:11 +0000 (16:55 +0100)]
rhel: Fix tests on mock and koji

Currently many tests fails on mock/koji since /etc/resolv.conf is not
present. The unexpected warning causes them to abort.

After this patch an empty resolv.conf is created and used before issuing
"make check".

Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agorhel: Use PIDFile on forking systemd service files
Timothy Redaelli [Thu, 28 Feb 2019 17:27:46 +0000 (18:27 +0100)]
rhel: Use PIDFile on forking systemd service files

Currently, PIDFile is not used in systemd service files with
Type=forking. This means sometimes systemd fails to restart a daemon
that is killed (with SIGKILL) or that is crashed.

This commit adds PIDFile to all systemd service file with Type=forking
in order to always have the correct PID to monitor.

Reported-at: https://bugzilla.redhat.com/1653717
Reported-by: Candido Campos <ccamposr@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoNEWS: Clean up the 2.11.0 release notes a bit.
Justin Pettit [Thu, 28 Feb 2019 18:38:29 +0000 (10:38 -0800)]
NEWS: Clean up the 2.11.0 release notes a bit.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
5 years agorhel: limit stack size to 2M.
Flavio Leitner [Thu, 28 Feb 2019 16:13:57 +0000 (13:13 -0300)]
rhel: limit stack size to 2M.

The default stack size in Fedora/RHEL is 8M, which means when ovs-vswitchd
daemon starts and uses --mlockall (default), it will dirty all memory
regions for all threads which is proportionally to the number of CPUs.

On a big host this increases memory usage to many hundreds of megabytes
while OVS actually requires much less.

This patch relies on systemd to limit to 2M/thread. That is much more
than the minimum documented at function ovs_thread_create():

    /* Some small systems use a default stack size as small as 80 kB, but OVS
     * requires approximately 384 kB according to the following analysis:
     * https://mail.openvswitch.org/pipermail/ovs-dev/2016-January/308592.html
     *
     * We use 512 kB to give us some margin of error. */

Acked-By: Timothy Redaelli <tredaelli@redhat.com>
Tested-By: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoAUTHORS: Add Brian Haley.
Ben Pfaff [Thu, 28 Feb 2019 19:23:56 +0000 (11:23 -0800)]
AUTHORS: Add Brian Haley.

Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoovn: Make DHCP log messages unique
Brian Haley [Thu, 28 Feb 2019 18:06:50 +0000 (13:06 -0500)]
ovn: Make DHCP log messages unique

Two messags were using the same string, add info to one
to make it unique.  Also cleaned-up some of the others
to make them consistent throughout.

Signed-off-by: Brian Haley <haleyb.dev@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoovsdb-idl: Fast resync from server when connection reset.
Han Zhou [Thu, 28 Feb 2019 17:15:20 +0000 (09:15 -0800)]
ovsdb-idl: Fast resync from server when connection reset.

Use monitor_cond_since to request changes after last version of local
data when connection to server is reset, without clearing the local
data. It falls back to clearing and repopulating all the data when
the requested id cannot be fulfilled by the server.

Test result at ovn-scale-test environment using clustered mode:
- 1K HVs (ovsdb clients)
- 10K lports

Without the patch it took 30+ min for the SB ovsdb-server to calm down
and HVs to stablize the connectin and finish syncing data.

With the patch there were no noticible CPU spike of SB ovsdb-server,
and all HVs were in sync with SB within 1 min, which is the probe
interval set in this test (so it took at most 1 min for HVs to notice
the TCP connection reset and reconnect and resync finished immediately
after that).

Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2018-September/047457.html
Signed-off-by: Han Zhou <hzhou8@ebay.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoovsdb-idl: Support monitor_cond_since method in C IDL.
Han Zhou [Thu, 28 Feb 2019 17:15:19 +0000 (09:15 -0800)]
ovsdb-idl: Support monitor_cond_since method in C IDL.

Use monitor_cond_since in C IDL. If it is not supported by server,
fall back to old method (monitor_cond, or monitor).

Signed-off-by: Han Zhou <hzhou8@ebay.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoovsdb-monitor: Support monitor_cond_since.
Han Zhou [Thu, 28 Feb 2019 17:15:18 +0000 (09:15 -0800)]
ovsdb-monitor: Support monitor_cond_since.

Support the new monitor method monitor_cond_since so that a client
can request monitoring start from a specific point instead of always
from beginning. This will reduce the cost at scenarios when server
is restarted/failed-over but client still has all existing data. In
these scenarios only new changes (and in most cases no change) needed
to be transfered to client. When ovsdb-server restarted, history
transactions are read from disk file; when ovsdb-server failed over,
history transactions exists already in the memory of the new server.

There are situations that the requested transaction may not be found.
For example, a transaction that is too old and has been discarded
from the maintained history list in memory, or the transactions on
disk has been compacted during ovsdb compaction. In those situations
the server fall backs to transfer all data start from begining.

For more details of the protocol change, see
Documentation/ref/ovsdb-server.7.rst.

This change includes both server side and ovsdb-client side changes
with the new protocol. IDLs using this capability will be added in
future patches.

Now the feature takes effect only for cluster mode of ovsdb-server,
because cluster mode is the only mode that supports unique transcation
uuid today. For other modes, the monitor_cond_since always fall back
to transfer all data with found = false. Support for those modes can
be added in the future.

Signed-off-by: Han Zhou <hzhou8@ebay.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoovsdb-server: Transaction history tracking.
Han Zhou [Thu, 28 Feb 2019 17:15:17 +0000 (09:15 -0800)]
ovsdb-server: Transaction history tracking.

Maintaining last N (n = 100) transactions in memory, which will be
used for future patches for generating monitor data from any point
in this N transactions.

Signed-off-by: Han Zhou <hzhou8@ebay.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoovsdb-monitor: Refactor ovsdb monitor implementation.
Han Zhou [Thu, 28 Feb 2019 17:15:16 +0000 (09:15 -0800)]
ovsdb-monitor: Refactor ovsdb monitor implementation.

Current ovsdb monitor maintains its own transaction version through an
incremental integer and use it to identify changes starting from different
version, and also use it to figure out if each set of changes should be
flushed. In particular, it uses number 0 to represent that the change set
contains all data for initial client population.  It is a smart way but it
prevents further extension of the monitoring mechanism to support future use
case for clients to request changes starting from a given history point. This
patch refactors the structures so that change sets are referenced directly
through the pointer. It uses additional members such as init_change_set,
new_change_set to indicates the specific change set explicitely, instead of
through calculated version numbers based on implicite rules.

At the same time, this patch provides better encapsulation for change set
(composed of data in a list of tables), while still allowing traversing
across change sets for a given table.

Signed-off-by: Han Zhou <hzhou8@ebay.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agooss-fuzz: Fix oss build errors because of ovs API change
Yifeng Sun [Wed, 27 Feb 2019 22:21:00 +0000 (14:21 -0800)]
oss-fuzz: Fix oss build errors because of ovs API change

Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13432
Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agodp-packet: Constantify offloading APIs.
Ilya Maximets [Tue, 26 Feb 2019 10:38:36 +0000 (13:38 +0300)]
dp-packet: Constantify offloading APIs.

Getters should have const arguments.

Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
5 years agodpif-netdev: Reduce log level for not found mark id.
Ilya Maximets [Tue, 26 Feb 2019 10:38:35 +0000 (13:38 +0300)]
dpif-netdev: Reduce log level for not found mark id.

It's a normal case for 'find' function, especially because this
happens for every first packet of flow that was not offloaded yet.
Should not warn about this. Dropped to DBG to avoid log trashing in
case of big number of new flows.

CC: Yuanhan Liu <yliu@fridaylinux.org>
Fixes: 241bad15d99a ("dpif-netdev: associate flow with a mark id")
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
5 years agonetdev-dpdk: Use single struct/union for flow offload items.
Ilya Maximets [Wed, 6 Feb 2019 15:40:36 +0000 (18:40 +0300)]
netdev-dpdk: Use single struct/union for flow offload items.

Having a single structure allows to simplify the code path and
clear all the items at once (probably faster). This does not
increase stack memory usage because all the L4 related items
grouped in a union.

Changes:
  - Memsets combined.
  - 'ipv4_next_proto_mask' dropped as we already know the address
    and able to use 'mask.ipv4.hdr.next_proto_id' directly.
  - Group of 'if' statements for L4 protocols turned to a 'switch'.
    We can do that, because we don't have semi-local variables anymore.
  - Eliminated 'end_proto_check' label. Not needed with 'switch'.

Additionally 'rte_memcpy' replaced with simple 'memcpy' as it makes no
sense to use 'rte_memcpy' for 6 bytes.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Asaf Penso <asafp@mellanox.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
5 years agohash: Enable hash_bytes128 optimization for aarch64.
Yanqin Wei [Wed, 27 Feb 2019 09:44:06 +0000 (17:44 +0800)]
hash: Enable hash_bytes128 optimization for aarch64.

"hash_bytes128" has two versions for 64 bits and 32 bits system. This
should be common optimization for their respective platforms. But 64 bits
version was only enabled in x86-64. This patch enable it for aarch64
platform.
Micro benchmarking test was run in two kinds of arm platform. It was
observed that 50% performance improvement in thunderX2 and 40% improvement
in TaiShan(Cortex-A72).

Signed-off-by: Yanqin Wei <Yanqin.Wei@arm.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoovn-nbctl: Add lsp-get-ls command
Lucas Alvares Gomes [Wed, 27 Feb 2019 17:28:53 +0000 (17:28 +0000)]
ovn-nbctl: Add lsp-get-ls command

This commit adds the following command:

lsp-get-ls: Get the logical switch which the port belongs to.

This command is handy for scripting since there's no logical switch id
in the Logical_Switch_Port table.

Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoAUTHORS: Add Moshe Levi.
Ben Pfaff [Tue, 26 Feb 2019 13:51:37 +0000 (05:51 -0800)]
AUTHORS: Add Moshe Levi.

Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoovn: update ovn-ctl usage with status, promote and demote commands
Moshe Levi [Tue, 26 Feb 2019 07:13:16 +0000 (09:13 +0200)]
ovn: update ovn-ctl usage with status, promote and demote commands

Signed-off-by: Moshe Levi <moshele@mellanox.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoconntrack: Consolidate 2 selection statements.
Darrell Ball [Tue, 26 Feb 2019 00:37:50 +0000 (16:37 -0800)]
conntrack: Consolidate 2 selection statements.

No functional change.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoconntrack: Skip ephemeral ports with specified port range.
Darrell Ball [Mon, 25 Feb 2019 23:36:32 +0000 (15:36 -0800)]
conntrack: Skip ephemeral ports with specified port range.

This patch removes the fallback to ephemeral ports when a SNAT port
range is specified;  DNAT already does not fallback to ephemeral ports,
in general.  This is not restrictive to the user and makes it easier to
limit NAT L4 port selection.

The documentation is updated and a new test is added to enforce the
behavior.

Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2019-February/356607.html
Fixes: 286de2729955 ("dpdk: Userspace Datapath: Introduce NAT Support.")
Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoconntrack: Fix wasted work for ICMP NAT.
Darrell Ball [Mon, 25 Feb 2019 23:36:31 +0000 (15:36 -0800)]
conntrack: Fix wasted work for ICMP NAT.

ICMPv4 and ICMPv6 are not subject to port address translation (PAT),
however, a loop increments a local variable unnecessarily for
ephemeral ports, resulting in wasted work for ICMPv4 and ICMPv6 packets
subject to NAT.  Fix this by checking for PAT being enabled before
incrementing the local port variable and bail out otherwise.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoodp-util: Improve log messages and error reporting for Netlink parsing.
Ben Pfaff [Sat, 15 Dec 2018 02:16:55 +0000 (18:16 -0800)]
odp-util: Improve log messages and error reporting for Netlink parsing.

As a side effect, this also reduces a lot of log messages' severities from
ERR to WARN.  They just didn't seem like messages that in general reported
anything that would prevent functioning.

Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agovlog: Better handle syslog handler exceptions.
Ilya Maximets [Mon, 25 Feb 2019 17:43:36 +0000 (20:43 +0300)]
vlog: Better handle syslog handler exceptions.

'set_levels_from_string' doesn't check for exceptions that could
happen while opening syslog files or connecting to syslog sockets.

For example, if rsyslog stopped on a system:

  $ test-unixctl.py -vFACILITY:daemon --detach
  Traceback (most recent call last):
    File "../../../../tests/test-unixctl.py", line 90, in <module>
      main()
    File "../../../../tests/test-unixctl.py", line 61, in main
      ovs.vlog.handle_args(args)
    File "python/ovs/vlog.py", line 463, in handle_args
      msg = Vlog.set_levels_from_string(verbose)
    File "python/ovs/vlog.py", line 345, in set_levels_from_string
      Vlog.add_syslog_handler(words[1])
    File "python/ovs/vlog.py", line 321, in add_syslog_handler
      facility=syslog_facility)
    File "/python2.7/logging/handlers.py", line 759, in __init__
      self._connect_unixsocket(address)
    File "/python2.7/logging/handlers.py", line 787, in _connect_unixsocket
      self.socket.connect(address)
    File "/python2.7/socket.py", line 224, in meth
      return getattr(self._sock,name)(*args)
  socket.error: [Errno 111] Connection refused

In this case "/dev/log" file exists, so the check inside
'add_syslog_handler' doesn't help.

We need to catch the exceptions in 'set_levels_from_string' same way
as it done in 'init' function.
Also, we don't really need to check for '/dev/log' existence, because
exception will be catched on the upper layer and properly handled by
disabling the corresponding logger.

Fixes: d69d61c7c175 ("vlog: Ability to override the default log facility.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoipf: More cleanup.
Darrell Ball [Sat, 23 Feb 2019 02:48:46 +0000 (18:48 -0800)]
ipf: More cleanup.

No functional changes here.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoMerge pull request #276 from petrutlucian94/py_requirements
Alin Gabriel Serdean [Mon, 25 Feb 2019 13:50:26 +0000 (15:50 +0200)]
Merge pull request #276 from petrutlucian94/py_requirements

Update Python package requirements

5 years agoUpdate Python package requirements
Lucian Petrut [Fri, 22 Feb 2019 13:24:23 +0000 (15:24 +0200)]
Update Python package requirements

The Python ovs package relies on pywin32 for Windows support.
For this reason, pywin32 should be included in the requirements
list.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
5 years agoconntrack: Fix L4 csum for V6 extension hdr pkts.
Darrell Ball [Sat, 23 Feb 2019 01:17:42 +0000 (17:17 -0800)]
conntrack: Fix L4 csum for V6 extension hdr pkts.

It is a day one issue that got copied to subsequent code.

Fixes: a489b16854b5 ("conntrack: New userspace connection tracker.")
Fixes: bd5e81a0e596 ("Userspace Datapath: Add ALG infra and FTP.")
CC: Daniele Di Proietto <diproiettod@ovn.org>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agopackets: Change return type for 'packet_csum_upperlayer6()'.
Darrell Ball [Sat, 23 Feb 2019 01:17:41 +0000 (17:17 -0800)]
packets: Change return type for 'packet_csum_upperlayer6()'.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoovn-controller: Provide the option to set the datapath-type of br-int
Numan Siddique [Mon, 18 Feb 2019 04:42:22 +0000 (10:12 +0530)]
ovn-controller: Provide the option to set the datapath-type of br-int

If the integration bridge is deleted, ovn-controller recreates it
but the previous datapath-type value is lost if it was set. This
patch adds the code in ovn-controller to set the datapath-type
if it is configured by the user in the 'external_ids:ovn-bridge-datapath-type'
column of OpenvSwitch table.

Acked-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoAUTHORS: Add Matthias May.
Ben Pfaff [Fri, 22 Feb 2019 23:13:25 +0000 (15:13 -0800)]
AUTHORS: Add Matthias May.

Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agorstp: add ability to receive VLAN-tagged BPDUs
Matthias May [Thu, 14 Feb 2019 23:16:14 +0000 (00:16 +0100)]
rstp: add ability to receive VLAN-tagged BPDUs

There are switches which allow to transmit their BPDUs VLAN-tagged.
With this change OVS is able to receive VLAN-tagged BPDUs, but still
transmits its own BPDUs untagged.
This was tested against Westermo RFI-207-F4G-T3G.

Signed-off-by: Matthias May <matthias.may@neratec.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoovsdb_monitor: Fix style of prototypes.
Han Zhou [Fri, 15 Feb 2019 20:25:58 +0000 (12:25 -0800)]
ovsdb_monitor: Fix style of prototypes.

Ommiting the parameter names in prototypes, as suggested by coding
style: Omit parameter names from function prototypes when the names
do not give useful information.

Adjust orders of parameters as suggested by coding style.

Signed-off-by: Han Zhou <hzhou8@ebay.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoovsdb-client: Fix typo.
Han Zhou [Fri, 15 Feb 2019 20:25:57 +0000 (12:25 -0800)]
ovsdb-client: Fix typo.

Signed-off-by: Han Zhou <hzhou8@ebay.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoipf: Handle non-zero L2 padding for first fragments.
Darrell Ball [Wed, 20 Feb 2019 16:17:18 +0000 (08:17 -0800)]
ipf: Handle non-zero L2 padding for first fragments.

Fixes: 4ea96698f667 ("Userspace datapath: Add fragmentation handling.")
Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agotests: Fix udp checksums for some tests.
Darrell Ball [Wed, 20 Feb 2019 16:17:17 +0000 (08:17 -0800)]
tests: Fix udp checksums for some tests.

Also, enable the kernel side tests since these will pass now.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoipf: Check minimum fragment against L3 size.
Darrell Ball [Wed, 20 Feb 2019 16:17:16 +0000 (08:17 -0800)]
ipf: Check minimum fragment against L3 size.

Fixes: 4ea96698f667 ("Userspace datapath: Add fragmentation handling.")
Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoipf: Do not preallocate more than needed.
Darrell Ball [Wed, 20 Feb 2019 16:17:15 +0000 (08:17 -0800)]
ipf: Do not preallocate more than needed.

ipf_reassemble_v4_frags() and ipf_reassemble_v6_frags() are
preallocating more than needed for the reassembled packet.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoipf: Misc Cleanup.
Darrell Ball [Wed, 20 Feb 2019 16:17:14 +0000 (08:17 -0800)]
ipf: Misc Cleanup.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agofaq: Return GRE-IPv6 tunneling support.
Ilya Maximets [Fri, 15 Feb 2019 10:37:20 +0000 (13:37 +0300)]
faq: Return GRE-IPv6 tunneling support.

Accidentially changed while updating conntrack support.

CC: Darrell Ball <dlu998@gmail.com>
Fixes: 4ea96698f667 ("Userspace datapath: Add fragmentation handling.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoovn-nbctl: Daemon mode should retry when IDL connection lost.
Han Zhou [Sat, 16 Feb 2019 02:49:52 +0000 (18:49 -0800)]
ovn-nbctl: Daemon mode should retry when IDL connection lost.

When creating IDL, "retry" was set to false. However, in daemon
mode, reconnecting upon DB server failure should be transparent
to user. This even impacts HA mode. E.g. in clustered mode, although
IDL tries to connect to next server, but at the first retry the
server fail-over may not be completed yet, and it stops retry after
N (N = number of remotes) times.

This patch makes sure in daemon mode retry is set to true so that
the daemon will automatically retry forever.

Signed-off-by: Han Zhou <hzhou8@ebay.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoAdd a simple test to check port binding when "encap-ip" external_ids is set.
root [Sat, 16 Feb 2019 00:45:24 +0000 (16:45 -0800)]
Add a simple test to check port binding when "encap-ip" external_ids is set.

5 years agoSupport for multiple VTEP in OVN
venu iyer [Tue, 15 Jan 2019 01:30:43 +0000 (17:30 -0800)]
Support for multiple VTEP in OVN

OVN uses tunnels to achieve logical network connectivity. The tunnel IP
to be used when communicating with a node is configured using an external_ids
field called "ovn-encap-ip" (and "ovn-encap-type" to indicate the type of
tunnel - geneve, vxlan, stt).

The fact that "ovn-encap-ip" is a single IP is significantly limiting when
used in certain scenarios. Primarly, if we have multiple NICs on a system and
want to assign SR-IOV VFs from different NICs to a guest (as logical ports),
then we'll still end up using the "ovn-encap-ip" to encapsulate traffic from
different VFs. This means we'll end up using only one NIC on the
physical, thereby not maintaining the VF-PF association while also not using
all the physical NICs. It is possible to bond all the NICs and use the
bond IP as the "encap-ip", but bonding multiple NICs has its own limitations,
i.e. NICs supporting OVS flows offload don't work with bonding - this
severly undermines SR-IOV use with OVS (i.e. if all the processing needs
to be done in the host despite giving VFs to guests).

    +-------------------------------------------------------+       +-------------------------~
    |Hypervisor I   (chassis-ID = HV1)                      |       |Hypervisor II
    |                                                       |       |
    |+----------------------+                               |       |
    ||      guest           |                               |       |
    ||                      |                               |       |
    |+-------|----------|---+                               |       | (ovn-chassis-id)
    |        |          |           vf0_rep +-------+       |       |               +-------+
    |        |          |      encap-ip=IP1 |       |       |       |     (HV1@IP1) |       |
    |        |------------------------------|       |-------------------------------|       |
    |        |          |                   |br-int |       |       |               |br-int |
    |        |          |           vf0_rep |       |       |       |     (HV1@IP2) |       |
    |        |          |      encap-ip=IP2 |       |-------------------------------|       |
    |        |          |-------------------|       |       |   |   |               +-------+
    |        |          |                   +-------+       |   |   |
    |        |vf0       |vf0                                |   |   |
    |   +---------+  +---------+                            |   |   |
    +---|  nic1   |--|  nic2   |----------------------------+   |   +--------------------------~
        +---------+  +---------+                                V
            |           |                                  Tunnel Ports
            |pf=IP1     |pf=IP2                         between Hypervisors.

Note: The above uses a NIC that supports OVS with SR-IOV (e.g. Mellanox CX-5) which
uses a "representor" to plug in a VF to the OVS bridge.

This patch enables a list of comma separated IP addresses to be specified in
"ovn-encap-ip", thus allowing the node to be reached via any IP combined with the
"ovn-encap-type" - assuming physical routing allows that. Additionally, it also
introduces an way to specify the encap IP to be used for a logical port (so that
the VF-PF mapping is maintained when traversing the logical path over
a tunnel). A new "encap-ip" external_ids can be configured on an
Interface to indicate this.

On the SB these changes appear as an additional column in port_bindings
as "encap". The encap record for a port points to an encap record
on its chassis. If the port is not explicitly associated with an
encap-ip (using external_ids), the encap record is empty, which
means the preferred tunnel will be used to reach the port's chassis.

The intention is also to have no functional changes in the default case, i.e
when there is only one "ovn-encap-ip".

The changes have been tested with multiple encap-ip addresses, SR-IOV and
for backwards compatibality (in the case where there is only one ovn-encap-ip)
with an OVN SB that doesn't include these changes.

5 years agoofctl: break the loop if ovs_pcap_read returns error
Li RongQing [Mon, 18 Feb 2019 02:56:38 +0000 (10:56 +0800)]
ofctl: break the loop if ovs_pcap_read returns error

otherwise packet is NULL, and dereference it to cause segfault

Signed-off-by: Li RongQing <lirongqing@baidu.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agocheckpatch: Escape range operators inside regex.
Ilya Maximets [Mon, 18 Feb 2019 15:35:02 +0000 (18:35 +0300)]
checkpatch: Escape range operators inside regex.

' -(' matches a single character in the range between ' ' (index 32)
and '(' (index 40). This leads to the false positive:

  WARNING: Line lacks whitespace around operator
  #445 FILE: ovsdb/monitor.c:573:
      if (--mcs->n_refs == 0) {

Need to escape '-' to have a right behaviour.
This patch additionally escapes all other '-' chars in the similar
regexes and makes them be one per line to ease the review in case of
future changes.

Basic unit tests added.

CC: Joe Stringer <joe@ovn.org>
Fixes: 0d7b16daea50 ("checkpatch: Check for infix operator whitespace.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agonetlink: added check to prevent netlink attribute overflow
Toms Atteka [Tue, 19 Feb 2019 18:55:02 +0000 (10:55 -0800)]
netlink: added check to prevent netlink attribute overflow

If enough large input is passed to odp_actions_from_string it can
cause netlink attribute to overflow.
Check for buffer size was added to prevent entering this function
and returning appropriate error code.

Basic manual testing was performed.

Reported-by: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12231
Signed-off-by: Toms Atteka <cpp.code.lv@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoSet release dates for 2.11.0.
Justin Pettit [Wed, 20 Feb 2019 05:42:57 +0000 (21:42 -0800)]
Set release dates for 2.11.0.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Flavio Leitner <fbl@sysclose.org>
5 years agonetdev-dpdk: Flow validation refactoring.
Ilya Maximets [Mon, 12 Nov 2018 09:28:39 +0000 (12:28 +0300)]
netdev-dpdk: Flow validation refactoring.

* Dropped 'is_all_zero' function, which is equal to 'is_all_zeros'
  from util.h .
* util.h added to includes. Includes re-sorted within their blocks.
  (it's hard to figure out where to put new one if there is no order.)
  Note: linux/if.h depends on sys/socket.h .
* 'ovs_u128_is_zero' used instead of manual checking of fields.
* Code simplified by using direct pointer to 'match->wc.masks'.
* 'sizeof's rewritten to be coding-style complient.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
5 years agodoc: Add "Representors" topic document
Ophir Munk [Sun, 17 Feb 2019 17:37:21 +0000 (17:37 +0000)]
doc: Add "Representors" topic document

This details how to configure representors ports.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
5 years agoAUTHORS: Add Eli Britstein <elibr@mellanox.com>
Ian Stokes [Mon, 18 Feb 2019 16:20:52 +0000 (16:20 +0000)]
AUTHORS: Add Eli Britstein <elibr@mellanox.com>

Signed-off-by: Ian Stokes <ian.stokes@intel.com>
5 years agoacinclude: Omit unnecessary define
Eli Britstein [Mon, 11 Feb 2019 11:32:35 +0000 (13:32 +0200)]
acinclude: Omit unnecessary define

Commit fc3b425fa02f ("acinclude: Include libmnl when needed") added
unnecessary include of DPDK_MNL. Omit it.

Fixes: fc3b425fa02f ("acinclude: Include libmnl when needed")
Signed-off-by: Eli Britstein <elibr@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
5 years agoacinclude: Include libverbs and libmlx4 when needed
Eli Britstein [Mon, 11 Feb 2019 11:32:34 +0000 (13:32 +0200)]
acinclude: Include libverbs and libmlx4 when needed

DPDK 18.11 uses libverbs and libmlx4 when MLX4 PMD is enabled.

This commit makes OVS to link to libverbs and libmlx4 when MLX4 PMD is
enabled on DPDK.

Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Asaf Penso <asafp@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
5 years agoacinclude: Include libverbs and libmlx5 when needed
Eli Britstein [Mon, 11 Feb 2019 11:32:33 +0000 (13:32 +0200)]
acinclude: Include libverbs and libmlx5 when needed

DPDK 18.11 uses libverbs and libmlx5 when MLX5 PMD is enabled.

This commit makes OVS to link to libverbs and libmlx5 when MLX5 PMD is
enabled on DPDK.

Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Shahaf Shuler <shahafs@mellanox.com>
Reviewed-by: Asaf Penso <asafp@mellanox.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
5 years agoInitialize the right database.
Ted Elhourani [Fri, 15 Feb 2019 00:59:57 +0000 (00:59 +0000)]
Initialize the right database.

Use value of db parameter in order to initialize the correct database.

Signed-off-by: Ted Elhourani <ted.elhourani@nutanix.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoconntrack: Simplify 'ct_addr'.
Darrell Ball [Thu, 14 Feb 2019 21:15:08 +0000 (13:15 -0800)]
conntrack: Simplify 'ct_addr'.

Remove the struct wrapper and remove the unneeded union members.
There may even be a portability benefit here because of the
type punning.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoconntrack: Remove redundant call to 'hash_finish()'.
Darrell Ball [Thu, 14 Feb 2019 21:15:07 +0000 (13:15 -0800)]
conntrack: Remove redundant call to 'hash_finish()'.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoUserspace datapath: Add fragmentation handling.
Darrell Ball [Wed, 13 Feb 2019 23:34:21 +0000 (15:34 -0800)]
Userspace datapath: Add fragmentation handling.

Fragmentation handling is added for supporting conntrack.
Both v4 and v6 are supported.

After discussion with several people, I decided to not store
configuration state in the database to be more consistent with
the kernel in future, similarity with other conntrack configuration
which will not be in the database as well and overall simplicity.
Accordingly, fragmentation handling is enabled by default.

This patch enables fragmentation tests for the userspace datapath.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agodp-packet: Add 'do_not_steal' packet batch flag.
Darrell Ball [Wed, 13 Feb 2019 23:34:20 +0000 (15:34 -0800)]
dp-packet: Add 'do_not_steal' packet batch flag.

This is needed in a subsequent patch and may otherwise be useful.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agodp-packet: Add 'dp_packet_batch_is_full()' api.
Darrell Ball [Wed, 13 Feb 2019 23:34:19 +0000 (15:34 -0800)]
dp-packet: Add 'dp_packet_batch_is_full()' api.

This new api is used in a subsequent patch and may otherwise be useful.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoovs-atomic: Add 64 bit apis.
Darrell Ball [Wed, 13 Feb 2019 23:34:18 +0000 (15:34 -0800)]
ovs-atomic: Add 64 bit apis.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoconntrack: Reword conntrack_execute() description.
Darrell Ball [Wed, 13 Feb 2019 23:34:17 +0000 (15:34 -0800)]
conntrack: Reword conntrack_execute() description.

Use 'must' instead of 'should'.

Suggested-by: Justin Pettit <jpettit@ovn.org>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agotests: Add missed local stack checks.
Darrell Ball [Wed, 13 Feb 2019 23:34:16 +0000 (15:34 -0800)]
tests: Add missed local stack checks.

Acked-by: Justin Pettit <jpettit@ovn.org>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoflow: Enhance parse_ipv6_ext_hdrs.
Darrell Ball [Wed, 13 Feb 2019 23:34:15 +0000 (15:34 -0800)]
flow: Enhance parse_ipv6_ext_hdrs.

Acked-by: Justin Pettit <jpettit@ovn.org>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agodp-packet: Add const qualifiers for checksum apis.
Darrell Ball [Wed, 13 Feb 2019 23:34:14 +0000 (15:34 -0800)]
dp-packet: Add const qualifiers for checksum apis.

Acked-by: Justin Pettit <jpettit@ovn.org>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agomonitor: Fix crash when monitor condition adds new columns.
Han Zhou [Tue, 12 Feb 2019 02:19:21 +0000 (18:19 -0800)]
monitor: Fix crash when monitor condition adds new columns.

The OVSDB conditional monitor implementation allows many clients
to share same copy of monitored data if the clients are sharing
same tables and columns being monitored, while they can have
different monitor conditions. In monitor conditions they can
have different columns which can be different from the columns
being monitored. So the struct ovsdb_monitor_table maintains the
union of the all the columns being used in any conditions.

The problem of the current implementation is that for each change
set generated, it doesn't maintain any metadata for the number of
columns for the data that has already populated in it. Instead, it
always rely on the n_columns field of the struct ovsdb_monitor_table
to manipulate the data. However, the n_columns in struct
ovsdb_monitor_table can increase (e.g. when a client changes its
condition which involves more columns). So it can result in that
the existing rows in a change set with N columns being later processed
as if it had more than N columns, typically, when the row is freed.
This causes the ovsdb-server crashing (see an example of the
backtrace).

The patch fixes the problem by maintaining n_columns for each
change set, and added a test case which fails without the fix.

(gdb) bt
at lib/ovsdb-data.c:1031
out>, mt=<optimized out>) at ovsdb/monitor.c:320
mt=0x1e7b940) at ovsdb/monitor.c:333
out>, transaction=<optimized out>) at ovsdb/monitor.c:527
initial=<optimized out>, cond_updated=cond_updated@entry=false,
unflushed_=unflushed_@entry=0x20dae70,
    condition=<optimized out>, version=<optimized out>) at ovsdb/monitor.c:1156
(m=m@entry=0x20dae40, initial=initial@entry=false) at
ovsdb/jsonrpc-server.c:1655
at ovsdb/jsonrpc-server.c:1729
ovsdb/jsonrpc-server.c:551
ovsdb/jsonrpc-server.c:586
ovsdb/jsonrpc-server.c:401
exiting=0x7ffdb947f76f, run_process=0x0, remotes=0x7ffdb947f7c0,
unixctl=0x1e7a560, all_dbs=0x7ffdb947f800,
    jsonrpc=<optimized out>, config=0x7ffdb947f820) at ovsdb/ovsdb-server.c:209

Signed-off-by: Han Zhou <hzhou8@ebay.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoacinclude: Also use LIBS from dpkg pkg-config
Christian Ehrhardt [Tue, 12 Feb 2019 06:29:58 +0000 (07:29 +0100)]
acinclude: Also use LIBS from dpkg pkg-config

DPDK 18.11 builds using the more modern meson build system no more
provide the -ldpdk linker script. Instead it is expected to use
pkgconfig for linker options as well.

This change will set DPDK_LIB from pkg-config (if pkg-config was
available) and since that already carries the whole-archive flags
around the PMDs skips the further wrapping in more whole-archive
if that is already part of DPDK_LIB.

To work reliable in all environments this needs pkg-config 0.29.1.
We want to be able to use PKG_CHECK_MODULES_STATIC which
is not yet available in 0.24. Therefore update pkg.m4
to pkg-config 0.29.1.

This should be backport-safe as these macro files are all versioned.
autoconf is smart enough to check the version if you have it locally,
and if the system's is higher, it will use that one instead.

Acked-by: Luca Boccassi <bluca@debian.org>
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
5 years agofaq: Update OVS/DPDK version table for OVS 2.11.
Kevin Traynor [Wed, 13 Feb 2019 16:27:00 +0000 (16:27 +0000)]
faq: Update OVS/DPDK version table for OVS 2.11.

Indicate that OVS 2.11 uses DPDK 18.11.

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
5 years agopython: Fix E117 over-indented.
Ilya Maximets [Tue, 12 Feb 2019 15:34:02 +0000 (18:34 +0300)]
python: Fix E117 over-indented.

New check was added to recent pycodestyle-2.5.0 and flake8
complains while building on Travis:

  ../utilities/bugtool/ovs-bugtool.in:767:17: E117 over-indented
  ../utilities/bugtool/ovs-bugtool.in:771:17: E117 over-indented
  ../utilities/bugtool/ovs-bugtool.in:774:17: E117 over-indented
  ../utilities/bugtool/ovs-bugtool.in:778:17: E117 over-indented
  ../python/ovs/db/error.py:33:17: E117 over-indented
  ../python/ovs/poller.py:118:21: E117 over-indented
  ../python/ovs/reconnect.py:244:17: E117 over-indented

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agodebian: Add libelf-dev dependency for dkms
Greg Rose [Tue, 12 Feb 2019 20:37:03 +0000 (12:37 -0800)]
debian: Add libelf-dev dependency for dkms

Newer kernels define CONFIG_UNWINDER_ORC for their kernel configurations
and to build this the kernel compilation requires the libelf-dev
package.  Add the dependency to the dkms build requirements.

VMware-BZ: #2287968
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoacinclude: Check for rte_config.h before checking dependencies.
Ilya Maximets [Tue, 12 Feb 2019 13:19:31 +0000 (16:19 +0300)]
acinclude: Check for rte_config.h before checking dependencies.

Current ./configure script shows misleading errors in case of wrong
DPDK path:

  # ./configure --with-dpdk=/wrong/path
  ...
  checking whether dpdk datapath is enabled... yes
  checking for library containing get_mempolicy... -lnuma
  checking for library containing pcap_dump... -lpcap
  checking for library containing mnl_attr_put... no
  configure: error: unable to find libmnl, install the dependency package

This happens because we're not checking for headers before checking
for dependencies. All the compile attempts fails and script thinks
that we need more dependencies.

With this change script will check for 'rte_config.h' availability
and produce sane error message:

  # ./configure --with-dpdk=/wrong/path
  ...
  checking for rte_config.h... no
  configure: error: unable to find rte_config.h in /wrong/path

'AC_INCLUDES_DEFAULT' passed explicitly to avoid preprocessor test.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
5 years agodpif-netdev: Add thread safety annotation to sorted_poll_list.
Ilya Maximets [Mon, 11 Feb 2019 17:35:41 +0000 (20:35 +0300)]
dpif-netdev: Add thread safety annotation to sorted_poll_list.

'sorted_poll_list()' uses the 'pmd->poll_list' that should be
guarded by 'pmd->port_mutex'.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
5 years agoacinclude: Use NUMA_AWARE_HUGEPAGES too for libnuma check.
Ilya Maximets [Thu, 7 Feb 2019 13:00:51 +0000 (16:00 +0300)]
acinclude: Use NUMA_AWARE_HUGEPAGES too for libnuma check.

This fixes build with NUMA_AWARE_HUGEPAGES enabled and VHOST_NUMA
disabled. This should not be a usual case. But it's possible to
configure DPDK this way.

Fixes: 5e925ccc2a6f ("netdev-dpdk: DPDK v17.11 upgrade")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
5 years agoconntrack: Exclude l2 padding in 'conn_key_extract()'.
Darrell Ball [Tue, 5 Feb 2019 00:23:07 +0000 (16:23 -0800)]
conntrack: Exclude l2 padding in 'conn_key_extract()'.

'conn_key_extract()' in userspace conntrack is including L2
(Ethernet) pad bytes for both L3 and L4 sizes. One problem is
any packet with non-zero L2 padding can incorrectly fail L4
checksum validation.

This patch fixes conn_key_extract() by ignoring L2 pad bytes.

Fixes: a489b16854b5 ("conntrack: New userspace connection tracker.")
CC: Daniele Di Proietto <diproiettod@ovn.org>
Co-authored-by: Vishal Deep Ajmera <vishal.deep.ajmera@ericsson.com>
Co-authored-by: Venkatesan Pradeep <venkatesan.pradeep@ericsson.com>
Co-authored-by: Nitin Katiyar <nitin.katiyar@ericsson.com>
Signed-off-by: Vishal Deep Ajmera <vishal.deep.ajmera@ericsson.com>
Signed-off-by: Venkatesan Pradeep <venkatesan.pradeep@ericsson.com>
Signed-off-by: Nitin Katiyar <nitin.katiyar@ericsson.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agodp-packet: Add 'dp_packet_l3_size()'.
Darrell Ball [Tue, 5 Feb 2019 00:23:06 +0000 (16:23 -0800)]
dp-packet: Add 'dp_packet_l3_size()'.

The new api will be used in a subsequent patch.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoconntrack: Remove unnecessary check in process_ftp_ctl_v4
Li RongQing [Mon, 11 Feb 2019 02:52:54 +0000 (10:52 +0800)]
conntrack: Remove unnecessary check in process_ftp_ctl_v4

It has been assured that both first and second int from ftp
command are not bigger than 255, so their combination(first
int << 8 +second int) must not bigger than 65535

Co-authored-by: Wang Li <wangli39@baidu.com>
Signed-off-by: Wang Li <wangli39@baidu.com>
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Cc: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agorhel: Add an example to specify custom options
Timothy Redaelli [Mon, 11 Feb 2019 18:55:53 +0000 (19:55 +0100)]
rhel: Add an example to specify custom options

Add an example to specify custom options of ovs-vswitchd and
ovsdb-server.
In the example, the log level for file and console destinations is set to dbg.

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoovs-ctl: Permit to specify additional options
Timothy Redaelli [Mon, 11 Feb 2019 18:55:52 +0000 (19:55 +0100)]
ovs-ctl: Permit to specify additional options

Currently using ovs-ctl is not possible to specify additional options
for ovs-vswitchd and ovsdb-server (for example to specify a different
loglevel during daemon startup).

This patch adds --ovs-vswitchd-options and --ovsdb-server-options
options to ovs-ctl in order to specify the additional options.

Due to word splitting it may not be possible to specify an option that
includes whitespaces.

Reported-at: https://bugzilla.redhat.com/1664794
Reported-by: Matt Flusche <mflusche@redhat.com>
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoovn: change load balancer references to weak in NB schema
Daniel Alvarez [Mon, 11 Feb 2019 16:06:14 +0000 (17:06 +0100)]
ovn: change load balancer references to weak in NB schema

When a load balancer is added to multiple logical switches
and routers it has be to be removed from all of them before
being able to delete due to the current 'strong' reference
in the NB schema.

By changing it to 'weak', users can simply remove the load
balancer without having to remove all the references manually.
In particular, this will make things easier for networking-ovn,
the OpenStack integration project as it'll save some
calculations upon load balancer deletion.

The update path has been successfully from the previous version
of the schema.

Acked-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
Signed-off-by: Daniel Alvarez <dalvarez@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoovs-lib.in: Cleanup old socket and pidfiles in stop_daemon
Timothy Redaelli [Mon, 11 Feb 2019 16:22:53 +0000 (17:22 +0100)]
ovs-lib.in: Cleanup old socket and pidfiles in stop_daemon

Currently if a client crashes (signal 11) the unix socket (.ctl) and the
pidfile may not be deleted when you use ovs-ctl stop or restart.

Moreover since ovs-appctl is used on a closed socket some warnings are
printed.

This commit deletes the pidfile and the unix socket then returns without
running ovs-appctl if the pidfile point to a not-existing pid.

Reported-at: https://bugzilla.redhat.com/1667845
Reported-by: Candido Campos <ccamposr@redhat.com>
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agotravis: Drop redundant DPDK build check.
Ilya Maximets [Fri, 8 Feb 2019 16:49:00 +0000 (19:49 +0300)]
travis: Drop redundant DPDK build check.

This check covered by 'TESTSUITE=1 DPDK=1'.
No need to run it separately.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agotravis: Use parallel jobs for DPDK and sparse builds.
Ilya Maximets [Fri, 8 Feb 2019 16:48:59 +0000 (19:48 +0300)]
travis: Use parallel jobs for DPDK and sparse builds.

This allows to save a few minutes.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agotravis: Enable printing of executed commands.
Ilya Maximets [Fri, 8 Feb 2019 16:48:58 +0000 (19:48 +0300)]
travis: Enable printing of executed commands.

This increases the output by a few lines, but gives important
information regarding commands and their exact arguments.
Very useful for debugging.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agotravis: Dump config.log on configure failures.
Ilya Maximets [Fri, 8 Feb 2019 16:48:57 +0000 (19:48 +0300)]
travis: Dump config.log on configure failures.

Useful for debugging.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agotravis: Run testsuite with desired options.
Ilya Maximets [Fri, 8 Feb 2019 16:48:56 +0000 (19:48 +0300)]
travis: Run testsuite with desired options.

'make distcheck' executes it's own './configure' without any options
provided to the script. This means that in current configuration
Travis CI always re-builds and runs testsuite on a defualt binaries.
i.e. we're not checking testsuite with DPDK, not checking testsuite
with '--enable-shared' and not checking it with '-ljemalloc'.
We just 8 times running the testsuite without arguments. Only compiler
changes (gcc or clang) because CC is exported by Travis.

This patch reorders the commands in the build script and provides
'DISTCHECK_CONFIGURE_FLAGS' to force 'make distcheck' using our
desired configuration.

Another issue that addressed here is that we will no longe build
twice in case of TESTSUITE.

For linking inside the distcheck we also need to provide absulute path
to DPDK libraries.

'configure' executed before 'distcheck' to have a Makefile target.
It's executed without arguments because 'configure' inside the
'distcheck' will fail if we'll use sparse-wrapped CC.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoautomake: Clean up cxxtest.cc.
Ilya Maximets [Fri, 8 Feb 2019 16:48:55 +0000 (19:48 +0300)]
automake: Clean up cxxtest.cc.

'distcheck' complains on some configurations:

  ERROR: files left in build directory after distclean:
  ./include/openvswitch/cxxtest.cc

CC: Ben Pfaff <blp@ovn.org>
Fixes: 994bfc298502 ("Automatically verify that OVS header files work OK in C++ also.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agodatapath: Clean up some gcov, tmp and cache files.
Ilya Maximets [Fri, 8 Feb 2019 16:48:54 +0000 (19:48 +0300)]
datapath: Clean up some gcov, tmp and cache files.

'distcheck' complains about these files while building --with-linux.

  ERROR: files left in build directory after distclean:
  ./datapath/linux/.tmp_ip6_gre.gcno
  ./datapath/linux/.tmp_ip_tunnels_core.gcno
  ./datapath/linux/.tmp_genetlink-openvswitch.gcno
  ./datapath/linux/.tmp_stt.gcno
  <..>
  ./datapath/linux/.tmp_versions/vport-gre.mod
  ./datapath/linux/.tmp_versions/vport-geneve.mod
  ./datapath/linux/.tmp_versions/vport-vxlan.mod
  ./datapath/linux/.tmp_versions/vport-lisp.mod
  ./datapath/linux/.tmp_versions/vport-stt.mod
  <..>
  ./datapath/linux/.dev-openvswitch.o.d
  ./datapath/linux/.ip_tunnels_core.o.d
  ./datapath/linux/.vport.o.d
  ./datapath/linux/.udp_tunnel.o.d
  ./datapath/linux/.cache.mk

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agotravis: Fix building datapath instead of userspace with DPDK_SHARED.
Ilya Maximets [Fri, 8 Feb 2019 16:48:53 +0000 (19:48 +0300)]
travis: Fix building datapath instead of userspace with DPDK_SHARED.

Current script does not check build of OVS with DPDK.
It builds datapath instead.

CC: Ian Stokes <ian.stokes@intel.com>
Fixes: edfe8d263d2e ("travis: Add dpdk shared library build.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agolib/tc: Support optional tunnel id
Adi Nissim [Thu, 17 Jan 2019 15:41:36 +0000 (17:41 +0200)]
lib/tc: Support optional tunnel id

Currently the TC tunnel_key action is always
initialized with the given tunnel id value. However,
some tunneling protocols define the tunnel id as an optional field.

This patch initializes the id field of tunnel_key:set and tunnel_key:unset
only if a value is provided.

In the case that a tunnel key value is not provided by the user
the key flag will not be set.

Signed-off-by: Adi Nissim <adin@mellanox.com>
Acked-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
5 years agoacinclude: Drop DPDK_EXTRA_LIB variable.
Ilya Maximets [Thu, 7 Feb 2019 12:20:20 +0000 (15:20 +0300)]
acinclude: Drop DPDK_EXTRA_LIB variable.

AC_SEARCH_LIBS enables the libraries itself:

  checking for library containing get_mempolicy... -lnuma
  checking for library containing pcap_dump... -lpcap

So, they are available in LIBS. No need to add them twice.

Also, DPDK_EXTRA_LIB doesn't even work, because each check overwrites
the variable instead of appending the new library. It was first time
misused while making libnuma optional and copy-pasted to several places
after that.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
5 years agoAUTHORS: Add Ophir Munk <ophirmu@mellanox.com>
Ian Stokes [Wed, 6 Feb 2019 12:20:30 +0000 (12:20 +0000)]
AUTHORS: Add Ophir Munk <ophirmu@mellanox.com>

Signed-off-by: Ian Stokes <ian.stokes@intel.com>
5 years agoAUTHORS: Add Asaf Penso <asafp@mellanox.com>
Ian Stokes [Wed, 6 Feb 2019 12:06:33 +0000 (12:06 +0000)]
AUTHORS: Add Asaf Penso <asafp@mellanox.com>

Signed-off-by: Ian Stokes <ian.stokes@intel.com>
5 years agonetdev-dpdk: Memset rte_flow_item on a need basis.
Asaf Penso [Mon, 4 Feb 2019 16:14:41 +0000 (16:14 +0000)]
netdev-dpdk: Memset rte_flow_item on a need basis.

In netdev_dpdk_add_rte_flow_offload function different rte_flow_item are
created as part of the pattern matching.

For most of them, there is a check whether the wildcards are not zero.
In case of zero, nothing is being done with the rte_flow_item.

Befor the wildcard check, and regardless of the result, the
rte_flow_item is being memset.

The patch moves the memset function only if the condition of the
wildcard is true, thus saving cycles of memset if not needed.

Signed-off-by: Asaf Penso <asafp@mellanox.com>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
5 years agoofproto: Don't always treat passive controllers as "equal".
Ben Pfaff [Tue, 9 Oct 2018 18:15:00 +0000 (11:15 -0700)]
ofproto: Don't always treat passive controllers as "equal".

If a passive controller chooses to configure itself as a slave controller,
I don't know a reason why it should be considered "equal" for some
purposes.

Acked-by: Justin Pettit <jpettit@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agovswitchd: Allow user to configure controllers as "primary" or "service".
Ben Pfaff [Fri, 26 Oct 2018 22:53:55 +0000 (15:53 -0700)]
vswitchd: Allow user to configure controllers as "primary" or "service".

Normally it makes sense for an active connection to be primary and a
passive connection to be a service connection, but I've run into a corner
case where it is better for a passive connection to be a primary
connection.  This specific case is for use with OFtest, which expects to be
a primary controller.  However, it also wants to reconnect frequently,
which is slow for active connections because of the backoff; by
configuring a passive, primary controller, OFtest can reconnect as
frequently and as quickly as it wants, making the overall test much faster.

Acked-by: Justin Pettit <jpettit@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
5 years agoRemove support for OpenFlow 1.6 (draft).
Ben Pfaff [Fri, 18 Jan 2019 00:20:20 +0000 (16:20 -0800)]
Remove support for OpenFlow 1.6 (draft).

ONF abandoned the OpenFlow specification, so that OpenFlow 1.6 will never
be completed.  It did not contain much in the way of useful features, so
remove what support Open vSwitch already had.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>