cascardo/ovs.git
7 years agodatapath: Add support for kernel 4.5
Pravin B Shelar [Mon, 18 Jul 2016 02:24:07 +0000 (19:24 -0700)]
datapath: Add support for kernel 4.5

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agoovn-sbctl: eliminate a spurious test case error cause
Lance Richardson [Thu, 7 Jul 2016 21:30:01 +0000 (17:30 -0400)]
ovn-sbctl: eliminate a spurious test case error cause

The "ovn-sbctl" test fails occasionally due to log messages
similar to these:

  jsonrpc|WARN|unix: receive error: Connection reset by peer
  reconnect|WARN|unix: connection dropped (Connection reset by peer)

Since we're already ignoring "Broken pipe" messages in this test
case, and the difference between EPIPE and ECONNRESET on send
is simply a matter of whether the peer had unconsumed data
in its receive buffer when the peer socket was closed, it should
be OK to ignore "reset by peer" logs as well.

This same type of failure has been observed in ovs-nbctl and
ovn-vtep-controller tests, so fix it there as well.

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Acked-by: Ryan Moats <rmoats@us.ibm.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agoovn-northd.8.xml: Remove outdated flow.
Russell Bryant [Fri, 15 Jul 2016 16:36:18 +0000 (12:36 -0400)]
ovn-northd.8.xml: Remove outdated flow.

This flow was a duplicate and was removed in a previous commit.  Update
the docs to reflect the removal.

Fixes: 6a9d35dde4a9 ("ovn-northd: Remove extraneous ip4 mulicast logical flow.")
Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ryan Moats <rmoats@us.ibm.com>
7 years agoovn: Add datapath column to the MAC_Binding table
Liran Schour [Mon, 18 Jul 2016 08:45:59 +0000 (11:45 +0300)]
ovn: Add datapath column to the MAC_Binding table

This will allow ovn-controller to conditionally monitor MAC_Binding table
according to datapath column.

Signed-off-by: Liran Schour <lirans@il.ibm.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agolib: add monitor_cond_change API to C IDL lib
Liran Schour [Mon, 18 Jul 2016 08:45:58 +0000 (11:45 +0300)]
lib: add monitor_cond_change API to C IDL lib

Add to IDL API that allows the user to add and remove clauses on a table's condition
iteratively. IDL maintain tables condition and send monitor_cond_change to the server
upon condition change.
Add tests for conditional monitoring to IDL.

Signed-off-by: Liran Schour <lirans@il.ibm.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agopython: move Python idl to work with monitor_cond
Liran Schour [Mon, 18 Jul 2016 08:45:57 +0000 (11:45 +0300)]
python: move Python idl to work with monitor_cond

Python idl works now with "monitor_cond" method. Add test
for backward compatibility with old "monitor" method.

Signed-off-by: Liran Schour <lirans@il.ibm.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agolib: add to ovsdb-idl monitor_id
Liran Schour [Mon, 18 Jul 2016 08:45:56 +0000 (11:45 +0300)]
lib: add to ovsdb-idl monitor_id

IDL uses now a uuid to specify a monitoring session that is being
sent to the server on "monitor_cond" request.
This uuid will be used to issue ongoing "monitor_cond_change" requests
for this monitoring session.

Signed-off-by: Liran Schour <lirans@il.ibm.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovsdb-client: support monitor-cond method
Liran Schour [Mon, 18 Jul 2016 08:45:55 +0000 (11:45 +0300)]
ovsdb-client: support monitor-cond method

Add monitor_cond method to ovsdb-client. Enable testing of monitor_cond_change
via unixctl command.Add unit tests for monitor_cond and monitor_cond_change.
See ovsdb-client(1) man page for details.
Replace monitor2 with monitor_cond.

Signed-off-by: Liran Schour <lirans@il.ibm.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovsdb: optimize match_any_clause() condition evaluation
Liran Schour [Mon, 18 Jul 2016 08:45:54 +0000 (11:45 +0300)]
ovsdb: optimize match_any_clause() condition evaluation

Optimize ovsdb_condition_match_any_clause() to be in O(#columns in condition)
and not O(#clauses) in case condition's caluses function is boolean or "==".

Signed-off-by: Liran Schour <lirans@il.ibm.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovsdb: enable jsonrpc-server to service "monitor_cond_change" request
Liran Schour [Mon, 18 Jul 2016 08:45:53 +0000 (11:45 +0300)]
ovsdb: enable jsonrpc-server to service "monitor_cond_change" request

ovsdb-server now accepts "monitor_cond_change" request. After conditions change
we compose update notification according to the current state of the
database without using a change list before sending reply to the monitor_cond_change
request.
Sees ovsdb-server (1) man page for details of monitor_cond_change.

Signed-off-by: Liran Schour <lirans@il.ibm.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovsdb: generate update notifications for monitor_cond session
Liran Schour [Mon, 18 Jul 2016 08:45:52 +0000 (11:45 +0300)]
ovsdb: generate update notifications for monitor_cond session

Hold session's conditions in ovsdb_monitor_session_condition. Pass it
to ovsdb_monitor for generating "update2" notifications.
Add functions that can generate "update2" notification for a
"monitor_cond" session.
JSON cache is enabled only for session's with true condition only.
"monitor_cond" and "monitor_cond_change" are RFC 7047 extensions
described by ovsdb-server(1) manpage.

Performance evaluation:
OVN is the main candidate for conditional monitoring usage. It is clear that
conditional monitoring reduces computation on the ovn-controller (client) side
due to the reduced size of flow tables and update messages. Performance
evaluation shows up to 75% computation reduction.
However, performance evaluation shows also a reduction in computation on the SB
ovsdb-server side proportional to the degree that each logical network is
spread over physical hosts in the DC. Evaluation shows that in a realistic
scenarios there is a computation reduction also in the server side.

Evaluation on simulated environment of 50 hosts and 1000 logical ports shows
the following results (cycles #):

LN spread over # hosts|    master    | patch        | change
-------------------------------------------------------------
            1         | 24597200127  | 24339235374  |  1.0%
            6         | 23788521572  | 19145229352  | 19.5%
           12         | 23886405758  | 17913143176  | 25.0%
           18         | 25812686279  | 23675094540  |  8.2%
           24         | 28414671499  | 24770202308  | 12.8%
           30         | 31487218890  | 28397543436  |  9.8%
           36         | 36116993930  | 34105388739  |  5.5%
           42         | 37898342465  | 38647139083  | -1.9%
           48         | 41637996229  | 41846616306  | -0.5%
           50         | 41679995357  | 43455565977  | -4.2%

Signed-off-by: Liran Schour <lirans@il.ibm.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovsdb: allow unmonitored columns in condition evaluation
Liran Schour [Mon, 18 Jul 2016 08:45:51 +0000 (11:45 +0300)]
ovsdb: allow unmonitored columns in condition evaluation

This commit allows to add unmonitored columns to a monitored table
due to condition update.
It will be used to evaluate conditions on unmonitored columns.
Update notification includes only monitored columns.
Due to the limited number of columns, we do not remove unused unmonitored
columns on condition update for code simplicity.

Signed-off-by: Liran Schour <lirans@il.ibm.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovsdb: add conditions utilities to support monitor_cond
Liran Schour [Mon, 18 Jul 2016 08:45:50 +0000 (11:45 +0300)]
ovsdb: add conditions utilities to support monitor_cond

Change ovsdb_condition to be a 3-element json array or a boolean value (see ovsdb-server
man page).
Conditions utilities will be used later for conditional monitoring.

Signed-off-by: Liran Schour <lirans@il.ibm.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovsdb: create column index mapping between ovsdb row to monitor row
Liran Schour [Mon, 18 Jul 2016 08:45:49 +0000 (11:45 +0300)]
ovsdb: create column index mapping between ovsdb row to monitor row

Columns indexing is different in ovsdb_row then in ovsdb_monitor_row.
We need mapping between the 2 for condition evaluation.

Signed-off-by: Liran Schour <lirans@il.ibm.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoovn-controller: Persist ovn flow tables
Ryan Moats [Mon, 18 Jul 2016 21:21:16 +0000 (16:21 -0500)]
ovn-controller: Persist ovn flow tables

Ensure that ovn flow tables are persisted so that changes to
them chan be applied incrementally - this is a prereq for
making lflow_run and physical_run incremental.

As part of this change, add a one-to-many hindex for finding
desired flows by their parent's UUID.  Also extend the mapping
by match from one-to-one to one-to-many.

Signed-off-by: Ryan Moats <rmoats@us.ibm.com>
[blp@ovn.org adjusted style and comments and added
 HINDEX_FOR_EACH_WITH_HASH_SAFE]
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agodatapath: Add support for kernel 4.4
Pravin B Shelar [Mon, 18 Jul 2016 22:13:15 +0000 (15:13 -0700)]
datapath: Add support for kernel 4.4

Most of changes are related to ip-fragment API and genetlink
API changes.

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agoovs-vsctl: Add another Flow_Table example.
Ben Pfaff [Mon, 18 Jul 2016 17:55:05 +0000 (10:55 -0700)]
ovs-vsctl: Add another Flow_Table example.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Ryan Moats <rmoats@us.ibm.com>
7 years agoovn-controller: Drop remove_local_datapath_by_binding().
Russell Bryant [Mon, 18 Jul 2016 20:25:20 +0000 (16:25 -0400)]
ovn-controller: Drop remove_local_datapath_by_binding().

ovn-controller has an hmap called 'local_datapaths' which tracks
all OVN datapaths that have at least one port binding on the local
chassis.  This patch corrects the case where a port binding row is
deleted from the southbound DB while it's still bound to the chassis,
meaning it was deleted before the ovs interface was deleted.

The previous code tried to handle this case by calling
remove_local_datapath_by_binding().  The function appears to try
to look up local_datapath by the binding UUID.  If it finds it,
it will delete the local datapath entry.  On the surface, this
looks like a bug where it deletes a local datapath entry even
when there could be other ports still bound to the chassis.
The reality is that this function was always a no-op.  It was
doing a lookup using a different hash value than how local_datapath
entries are actually hashed. In practice, this wasn't a big problem
because local_datapaths are correctly cleaned in in the
process_full_binding case after an ovs interface is added or removed.

The new change ensures that we run the process_full_binding code
in this case right away, even if the interface is not deleted.

Fixes: 263064aeaa31 ("Convert binding_run to incremental processing.")
Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ryan Moats <rmoats@us.ibm.com>
7 years agodataoath: compat: Do not use upstream fill-meta-data function for compat tunnel
Pravin B Shelar [Mon, 18 Jul 2016 20:53:29 +0000 (13:53 -0700)]
dataoath: compat: Do not use upstream fill-meta-data function for compat tunnel

upstream dev_fill_metadata_dst() uses upstream tunnel-dst which could
be different from OVS defined tun-dst.  Therefore use fill-meta-data
function from compat layer.

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: backport: allow output of MPLS packets on tunnel vports
Pravin B Shelar [Mon, 18 Jul 2016 20:53:29 +0000 (13:53 -0700)]
datapath: backport: allow output of MPLS packets on tunnel vports

Upstream commit:
    commit fe3a5f6c795810edb1646a840fec3c8c350c2a4e
    Author: Simon Horman <simon.horman@netronome.com>

    openvswitch: allow output of MPLS packets on tunnel vports

    Currently output of MPLS packets on tunnel vports is not allowed by Open
    vSwitch. This is because historically encapsulation was done in such a way
    that the inner_protocol field of the skb needed to hold the inner protocol
    for both MPLS and tunnel encapsulation in order for GSO segmentation to be
    performed correctly.

    Since b2acd1dc3949 ("openvswitch: Use regular GRE net_device instead of
    vport") Open vSwitch makes use of lwt to output to tunnel netdevs which
    perform encapsulation. As no drivers expose support for MPLS offloads this
    means that GSO packets are segmented in software by validate_xmit_skb(),
    which is called from __dev_queue_xmit(), before tunnel encapsulation occurs.
    This means that the inner protocol of MPLS is no longer needed by the time
    encapsulation occurs and the contention on the inner_protocol field of the
    skb no longer occurs.

    Thus it is now safe to output MPLS to tunnel vports.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Reviewed-by: Jesse Gross <jesse@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: genlmsg_new_unicast to genlmsg_new
Pravin B Shelar [Mon, 18 Jul 2016 20:53:29 +0000 (13:53 -0700)]
datapath: genlmsg_new_unicast to genlmsg_new

API changes are related commit:
    openvswitch: Revert: "Enable memory mapped Netlink i/o"

    revert commit 795449d8b846 ("openvswitch: Enable memory mapped Netlink i/o").
    Following the mmaped netlink removal this code can be removed.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: Sync OVS recursive loop counter with upstream.
Pravin B Shelar [Mon, 18 Jul 2016 20:53:29 +0000 (13:53 -0700)]
datapath: Sync OVS recursive loop counter with upstream.

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agoovn-controller: Remove local_datapaths_by_uuid.
Russell Bryant [Fri, 15 Jul 2016 23:29:55 +0000 (19:29 -0400)]
ovn-controller: Remove local_datapaths_by_uuid.

binding.c included a static local_datapaths_by_uuid but it was not used
for anything.  In fact, the hash node used when inserting into this hmap
is overwritten in another code path for a different hmap.

Fixes: 263064aeaa31 ("Convert binding_run to incremental processing.")
Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ryan Moats <rmoats@us.ibm.com>
7 years agoovn: Remove a completed TODO item.
Russell Bryant [Mon, 18 Jul 2016 19:31:46 +0000 (15:31 -0400)]
ovn: Remove a completed TODO item.

This TODO item was implemented a while ago, so remove it from the TODO
file.

Fixes: 0ee8aaf658dd ("ovn: Send GARP on localnet.")
Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-By: Kyle Mestery <mestery@mestery.com>
7 years agoovn-controller: Clean up bindings handling.
Russell Bryant [Tue, 12 Jul 2016 17:33:08 +0000 (13:33 -0400)]
ovn-controller: Clean up bindings handling.

Remove the global set of logical port IDs called 'all_lports'.  This is
no longer used for anything after conntrack ID assignment was moved out
of binding.c.

Remove the global smap of logical port IDs to ovsrec_interface records.
We can't persist references to these records, as we may be holding
references to freed memory.  Instead, replace it with a new global sset
of logical port IDs called 'local_ids'.  This is used to track when
interfaces have been added or removed.  We also build a temporary
shash of logical port IDs to ovs interfaces used for fast lookup
of the right interface as needed.

Found by inspection.

Fixes: a478c4efef4d ("ovn-controller: Refactor conntrack zone allocation.")
Fixes: 263064aeaa31 ("Convert binding_run to incremental processing.")
Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ryan Moats <rmoats@us.ibm.com>
7 years agoovn.at: A "peer" is only for interconnected routers.
Gurucharan Shetty [Mon, 18 Jul 2016 06:56:38 +0000 (23:56 -0700)]
ovn.at: A "peer" is only for interconnected routers.

We should not use "peer" while connecting a router to a switch.
(Doing so, will cause ovn-northd to constantly create and destroy
logical_flow records which causes CPU utilization of ovn-controller to
spike up.)

Fixes: 31114af758c7e6 ("ovn-nbctl: Update logical router port commands.")
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Acked-by: Flavio Fernandes <flavio@flaviof.com>
7 years agoovs-vsctl: Fix typo in comment.
Ben Pfaff [Mon, 18 Jul 2016 16:15:19 +0000 (09:15 -0700)]
ovs-vsctl: Fix typo in comment.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Ryan Moats <rmoats@us.ibm.com>
7 years agoovn: Add 128-bit support for ct_label
Numan Siddique [Fri, 15 Jul 2016 15:03:59 +0000 (20:33 +0530)]
ovn: Add 128-bit support for ct_label

To support 128-bits in ct_label, the value of the ct_label is expected
as a hex string in the 'ct_commit' action.

Added a new accessor in the 'mf_subvalue' struct to access ovs_be128
values.

Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agosystem-ovn.at: Add a OVN load-balancing unit test.
Gurucharan Shetty [Tue, 12 Jul 2016 06:18:24 +0000 (23:18 -0700)]
system-ovn.at: Add a OVN load-balancing unit test.

Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Acked-by: Joe Stringer <joe@ovn.org>
7 years agosystem-ovn.at: Add a OVN NAT test using OVN gateway.
Gurucharan Shetty [Sun, 10 Jul 2016 12:57:00 +0000 (05:57 -0700)]
system-ovn.at: Add a OVN NAT test using OVN gateway.

This unit test adds a basic OVN NAT test that tests north-south
DNAT, south-north SNAT and east-west DNAT and SNAT. It uses network
namespaces connected to br-int using veth pairs to act as logical
ports. This test does not cover multi-host scenarios, so there is
a gap. But userspace OVN tests do multi-host scenarios (without NAT
testing), so it should still be a decent coverage.

Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Acked-by: Joe Stringer <joe@ovn.org>
7 years agodatapath: Check for flow key tunnel proto to detect tunnel.
Pravin B Shelar [Sun, 17 Jul 2016 16:52:11 +0000 (09:52 -0700)]
datapath: Check for flow key tunnel proto to detect tunnel.

This brings in missing hunks from upstream commit 00a93babd06aaa
("openvswitch: add tunnel protocol to sw_flow_key").

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: openvswitch: update checksum in {push,pop}_mpls
Pravin B Shelar [Sun, 17 Jul 2016 16:52:11 +0000 (09:52 -0700)]
datapath: openvswitch: update checksum in {push,pop}_mpls

Upstream commit:
    commit bc7cc5999fd392cc799630d7e375b2f4e29cc398
    Author: Simon Horman <simon.horman@netronome.com>

    openvswitch: update checksum in {push,pop}_mpls

    In the case of CHECKSUM_COMPLETE the skb checksum should be updated in
    {push,pop}_mpls() as they the type in the ethernet header.

    As suggested by Pravin Shelar.

Cc: Pravin Shelar <pshelar@ovn.org>
    Fixes: 25cd9ba0abc0 ("openvswitch: Add basic MPLS support to kernel")
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: vxlan: enable zero checksum on recv.
Pravin B Shelar [Sun, 17 Jul 2016 16:52:11 +0000 (09:52 -0700)]
datapath: vxlan: enable zero checksum on recv.

partialy backport commit c868ee7063bdb5 ("lwt: fix rx checksum setting
for lwt devices tunneling over ipv6").

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: internal-dev: set IFF_NO_QUEUE
Pravin B Shelar [Sun, 17 Jul 2016 16:52:11 +0000 (09:52 -0700)]
datapath: internal-dev: set IFF_NO_QUEUE

Introduced by upstream commit 4272cc51a6d ("openvswitch: Convert to
using IFF_NO_QUEUE").

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: backport: ovs: set name assign type of internal port
Pravin B Shelar [Sun, 17 Jul 2016 16:52:11 +0000 (09:52 -0700)]
datapath: backport: ovs: set name assign type of internal port

upstream commit:
    commit 684ff4ef5edd758c47929b852b4ea79be56f8bc0
    Author: Zhang Shengju <zhangshengju@cmss.chinamobile.com>

    ovs: set name assign type of internal port

    Set name_assign_type of internal port to NET_NAME_USER.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: backport: ovs: do not allocate memory from offline numa node
Pravin B Shelar [Sun, 17 Jul 2016 16:52:11 +0000 (09:52 -0700)]
datapath: backport: ovs: do not allocate memory from offline numa node

Upstream commit:
    commit 598c12d0ba6de9060f04999746eb1e015774044b
    Author: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>

    ovs: do not allocate memory from offline numa node

    When openvswitch tries allocate memory from offline numa node 0:
    stats = kmem_cache_alloc_node(flow_stats_cache, GFP_KERNEL | __GFP_ZERO, 0)
    It catches VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES || !node_online(nid))
    [ replaced with VM_WARN_ON(!node_online(nid)) recently ] in linux/gfp.h
    This patch disables numa affinity in this case.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: Move key memset to ovs_flow_key_extract_userspace()
Pravin B Shelar [Sun, 17 Jul 2016 16:52:11 +0000 (09:52 -0700)]
datapath: Move key memset to ovs_flow_key_extract_userspace()

Synchronize code with upstream ovs_nla_get_flow_metadata().

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: use PTR_ERR_OR_ZERO
Pravin B Shelar [Sun, 17 Jul 2016 16:52:11 +0000 (09:52 -0700)]
datapath: use PTR_ERR_OR_ZERO

Upstream commit:
    commit f35423c137b0e64155f52c166db1d13834a551f2
    Author: Fabian Frederick <fabf@skynet.be>

    openvswitch: use PTR_ERR_OR_ZERO

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: backport: libnl: nla_put_be64(): align on a 64-bit area
Pravin B Shelar [Sun, 17 Jul 2016 16:52:11 +0000 (09:52 -0700)]
datapath: backport: libnl: nla_put_be64(): align on a 64-bit area

Upstream commit:
    commit b46f6ded906ef0be52a4881ba50a084aeca64d7e
    Author: Nicolas Dichtel <nicolas.dichtel@6wind.com>

    libnl: nla_put_be64(): align on a 64-bit area

    nla_data() is now aligned on a 64-bit area.

    A temporary version (nla_put_be64_32bit()) is added for nla_put_net64().
    This function is removed in the next patch.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: backport: ovs: propagate per dp max headroom to all vports
Pravin B Shelar [Sun, 17 Jul 2016 16:52:11 +0000 (09:52 -0700)]
datapath: backport: ovs: propagate per dp max headroom to all vports

Upstream commit:
    commit 3a927bc7cf9d0fbe8f4a8189dd5f8440228f64e7
    Author: Paolo Abeni <pabeni@redhat.com>

    ovs: propagate per dp max headroom to all vports

    This patch implements bookkeeping support to compute the maximum
    headroom for all the devices in each datapath. When said value
    changes, the underlying devs are notified via the
    ndo_set_rx_headroom method.

    This also increases the internal vports xmit performance.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: backport: ovs: use nla_put_u64_64bit()
Pravin B Shelar [Sun, 17 Jul 2016 16:52:11 +0000 (09:52 -0700)]
datapath: backport: ovs: use nla_put_u64_64bit()

Upstream commit:

    commit 0238b7204b7ff1bad1d2d4489f010d670cbd89f2
    Author: Nicolas Dichtel <nicolas.dichtel@6wind.com>

    ovs: use nla_put_u64_64bit()

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: backport: ovs: align nlattr properly when needed
Pravin B Shelar [Sun, 17 Jul 2016 16:52:10 +0000 (09:52 -0700)]
datapath: backport: ovs: align nlattr properly when needed

Upstream commit:
    commit 66c7a5ee1a6b7c69d41dfd68d207fdd54efba56a
    Author: Nicolas Dichtel <nicolas.dichtel@6wind.com>

    ovs: align nlattr properly when needed

    I also fix commit 8b32ab9e6ef1: use nla_total_size_64bit() for
    OVS_FLOW_ATTR_USED in ovs_flow_cmd_msg_size().

    Fixes: 8b32ab9e6ef1 ("ovs: use nla_put_u64_64bit()")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: backport: ovs: allow nl 'flow set' to use ufid without flow key
Pravin B Shelar [Sun, 17 Jul 2016 16:52:08 +0000 (09:52 -0700)]
datapath: backport: ovs: allow nl 'flow set' to use ufid without flow key

Upstream commit:
    commit 6f15cdbf8a8ac2e22767cc8b1eae225702733c95
    Author: Samuel Gauthier <samuel.gauthier@6wind.com>

    ovs: allow nl 'flow set' to use ufid without flow key

    When we want to change a flow using netlink, we have to identify it to
    be able to perform a lookup. Both the flow key and unique flow ID
    (ufid) are valid identifiers, but we always have to specify the flow
    key in the netlink message. When both attributes are there, the ufid
    is used. The flow key is used to validate the actions provided by
    the userland.

    This commit allows to use the ufid without having to provide the flow
    key, as it is already done in the netlink 'flow get' and 'flow del'
    path. The flow key remains mandatory when an action is provided.

Signed-off-by: Samuel Gauthier <samuel.gauthier@6wind.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: backport: retain parsed IPv6 header fields in flow on error skipping extens...
Pravin B Shelar [Sun, 17 Jul 2016 16:52:07 +0000 (09:52 -0700)]
datapath: backport: retain parsed IPv6 header fields in flow on error skipping extension headers

Upstream commit:
    commit c30da497893718abc6cec4f1d34d35875200edee
    Author: Simon Horman <simon.horman@netronome.com>

    openvswitch: retain parsed IPv6 header fields in flow on error skipping extension headers

    When an error occurs skipping IPv6 extension headers retain the already
    parsed IP protocol and IPv6 addresses in the flow. Also assume that the
    packet is not a fragment in the absence of information to the contrary;
    that is always use the frag_off value set by ipv6_skip_exthdr().

    This allows matching on the IP protocol and IPv6 addresses of packets
    with malformed extension headers.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: backport: openvswitch: allow management from inside user namespaces
Pravin B Shelar [Sun, 17 Jul 2016 16:52:06 +0000 (09:52 -0700)]
datapath: backport: openvswitch: allow management from inside user namespaces

Upstream commit:
    commit 4a92602aa1cd5bbaeedbd9536ff992f7d26fe9d1
    Author: Tycho Andersen <tycho.andersen@canonical.com>

    openvswitch: allow management from inside user namespaces

    Operations with the GENL_ADMIN_PERM flag fail permissions checks because
    this flag means we call netlink_capable, which uses the init user ns.

    Instead, let's introduce a new flag, GENL_UNS_ADMIN_PERM for operations
    which should be allowed inside a user namespace.

    The motivation for this is to be able to run openvswitch in unprivileged
    containers. I've tested this and it seems to work, but I really have no
    idea about the security consequences of this patch, so thoughts would be
    much appreciated.

    v2: use the GENL_UNS_ADMIN_PERM flag instead of a check in each function
    v3: use separate ifs for UNS_ADMIN_PERM and ADMIN_PERM, instead of one
        massive one

Reported-by: James Page <james.page@canonical.com>
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
CC: Eric Biederman <ebiederm@xmission.com>
CC: Pravin Shelar <pshelar@ovn.org>
CC: Justin Pettit <jpettit@ovn.org>
CC: "David S. Miller" <davem@davemloft.net>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: remove get_pcpu_ptr
Pravin B Shelar [Sun, 17 Jul 2016 16:52:05 +0000 (09:52 -0700)]
datapath: remove get_pcpu_ptr

There is no need to support old kernel so now we can use
newer api to access per cpu data.

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: Use skb_postpush_rcsum()
Pravin B Shelar [Sun, 17 Jul 2016 16:52:05 +0000 (09:52 -0700)]
datapath: Use skb_postpush_rcsum()

Use kernel function to update checksum.

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: compat: reset md_dst on recieve.
Pravin B Shelar [Sun, 17 Jul 2016 16:52:04 +0000 (09:52 -0700)]
datapath: compat: reset md_dst on recieve.

On transmit metadata dst is cleared, do same on recieve.

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: compat: Set OVS-GSO segment handler only for GSO packet.
Pravin B Shelar [Sun, 17 Jul 2016 16:52:02 +0000 (09:52 -0700)]
datapath: compat: Set OVS-GSO segment handler only for GSO packet.

This simplify OVS compat code where non gso packet can be directly sent
to network stack.

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: tnl-segmentation: clone dst for each segment.
Pravin B Shelar [Sun, 17 Jul 2016 16:52:02 +0000 (09:52 -0700)]
datapath: tnl-segmentation: clone dst for each segment.

Each skb segment needs a dst entry.

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: compat: clear skb IPCB block.
Pravin B Shelar [Sun, 17 Jul 2016 16:52:01 +0000 (09:52 -0700)]
datapath: compat: clear skb IPCB block.

OVS compat ip_local_out/ip6_local_out clear out skb IPCB, we also
need to do it for non compat version.

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agopackaging: Remove PyQt4 dependency.
Joe Stringer [Fri, 15 Jul 2016 00:53:46 +0000 (17:53 -0700)]
packaging: Remove PyQt4 dependency.

This doesn't seem to have been necessary since ovsdbmonitor was removed
in commit 7868fbc6c97c ("ovsdbmonitor: Remove."). Drop the dependency.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agodatapath-windows: Fixed packet limits on STT protocol
Paul Boca [Mon, 4 Jul 2016 09:53:23 +0000 (09:53 +0000)]
datapath-windows: Fixed packet limits on STT protocol

"If the length of the payload to be encapsulated exceeds 64KB, or if
the offset to the L4 header exceeds 255 bytes, then it will not be
possible to offload the packet to the NIC for segmentation." (STT RFC)
In this case the packet needs to be segmented by us, before sending it.

Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agoovs-vtep: Handle tunnel key configuration in any order.
Darrell Ball [Thu, 14 Jul 2016 21:59:00 +0000 (14:59 -0700)]
ovs-vtep: Handle tunnel key configuration in any order.

Presently, ovs-vtep expects the datapath tunnel key to be available
in the VTEP DB at startup. This may not be the case which is also
observed as interrmittent unit test failures. This patch allows
for the tunnel key to later appear in the VTEP database.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Acked-by: Russell Bryant <russell@ovn.org>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
7 years agoovn-controller-vtep: occasional failure in "binding 1" test case
Lance Richardson [Fri, 15 Jul 2016 13:15:05 +0000 (09:15 -0400)]
ovn-controller-vtep: occasional failure in "binding 1" test case

The ovn-controller-vtep "binding 1" test case fails occasionally
due to a race with the ovs-vtep daemon.  If ovs-vtep happens to
execute handle_physical() after "ovs-vsctl del-port p0", but before
the test script has executed "vtep-ctl del-port br-vtep p0", the
latter command will fail because ovs-vtep will have already deleted
p0 from the vtep db.

Eliminate this race while adding an additional check to verify that
ovs-vtep is working as expected by waiting for ovs-vtep to remove
entries for the deleted physical ports from the vtep db.

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Suggested-by: Darrell Ball <dlu998@gmail.com>
Acked-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agosystem-traffic: Remove datapath specific tests and macro.
William Tu [Fri, 1 Jul 2016 16:45:52 +0000 (09:45 -0700)]
system-traffic: Remove datapath specific tests and macro.

We generally try to keep the testsuite independent of the underlying
datapath. This patch removes the datapath-specific tests and macros.

Tested-at: https://travis-ci.org/williamtu/ovs-travis/builds/141642065
Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
7 years agoovn-northd: Remove extraneous ip4 mulicast logical flow.
Ryan Moats [Thu, 14 Jul 2016 18:34:54 +0000 (13:34 -0500)]
ovn-northd: Remove extraneous ip4 mulicast logical flow.

IPv4 multicast is already dropped by a previous logical flow
written for the logical router, so there is no reason to add
a lower priority rule for it.

Signed-off-by: Ryan Moats <rmoats@us.ibm.com>
Acked-by: Flavio Fernandes <flavio@flaviof.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
7 years agotests: daemon specific tests
Alin Serdean [Tue, 12 Jul 2016 15:36:02 +0000 (15:36 +0000)]
tests: daemon specific tests

Testing out the named pipe implementation revealed a problem in
"daemon --detach startup errors". If the daemon actually started nobody
is stopping it.
In the case of test failure kill the daemon.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Paul Boca <pboca@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agoofp-actions: Remove XXX comment for write-actions in ofpacts_format().
Ben Pfaff [Wed, 13 Jul 2016 23:43:08 +0000 (16:43 -0700)]
ofp-actions: Remove XXX comment for write-actions in ofpacts_format().

I don't know why this was here.  The write_actions instruction works fine.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
7 years agoofp-actions: Translate OF1.1+ mod_nw_ttl action to OF1.0 properly.
Ben Pfaff [Wed, 13 Jul 2016 23:41:00 +0000 (16:41 -0700)]
ofp-actions: Translate OF1.1+ mod_nw_ttl action to OF1.0 properly.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
7 years agoofp-actions: Translate mod_nw_ecn action to OF1.1 properly.
Ben Pfaff [Wed, 13 Jul 2016 23:50:33 +0000 (16:50 -0700)]
ofp-actions: Translate mod_nw_ecn action to OF1.1 properly.

Also, translate OF1.2+ "set_field" on OXM_OF_IP_ECN properly to OF1.1
"mod_nw_ecn".

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
7 years agoofp-actions: Translate OF1.0 "enqueue" actions for OF1.1+.
Ben Pfaff [Wed, 13 Jul 2016 22:53:20 +0000 (15:53 -0700)]
ofp-actions: Translate OF1.0 "enqueue" actions for OF1.1+.

Previously, the OF1.0 "enqueue" action was simply omitted when actions
were translated into OpenFlow 1.1 or later, which do not have a similar
action.  This commit translates this action into an equivalent sequence
of actions.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
7 years agoOVN-Tutorial: Update sample output.
Russell Bryant [Thu, 7 Jul 2016 19:03:41 +0000 (15:03 -0400)]
OVN-Tutorial: Update sample output.

A previous patch made some additions to section 1 of this tutorial.
This patch includes updates to the sample output that I got while
testing the additions to the tutorial.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ryan Moats <rmoats@us.ibm.com>
7 years agoofp-actions: Add extension to support "group" action in OF1.0.
Ben Pfaff [Thu, 14 Jul 2016 15:27:21 +0000 (08:27 -0700)]
ofp-actions: Add extension to support "group" action in OF1.0.

From time to time it confuses users that "group" actions disappear when
using OpenFlow 1.0.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
7 years agoAUTHORS: Add Eziz Durdyyev.
Ben Pfaff [Thu, 14 Jul 2016 14:56:07 +0000 (07:56 -0700)]
AUTHORS: Add Eziz Durdyyev.

Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agotoken-bucket: Correctly truncate existing tokens.
Eziz Durdyyev [Tue, 5 Jul 2016 17:41:50 +0000 (22:41 +0500)]
token-bucket: Correctly truncate existing tokens.

Submitted-at: https://github.com/openvswitch/ovs/pull/141
Signed-off-by: Eziz Durdyyev <ezizdurdy@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
7 years agoWindows: Use NETLINK_NETFILTER instead of NETLINK_GENERIC
Sairam Venugopal [Mon, 11 Jul 2016 21:59:50 +0000 (14:59 -0700)]
Windows: Use NETLINK_NETFILTER instead of NETLINK_GENERIC

Windows datapath lacked support for different Netlink Family protocols.
Now that Windows supports different Netlink protocol, revert the change to
override NETLINK_NETFILTER to use NETLINK_GENERIC.

Signed-off-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agoWindows: Add support for handling protocol (netlink family)
Sairam Venugopal [Mon, 11 Jul 2016 21:59:49 +0000 (14:59 -0700)]
Windows: Add support for handling protocol (netlink family)

Windows datapath currently has no notion of netlink family.
It assumes all netlink messages to belong to NETLINK_GENERIC family.
This patch adds support for handling other protocols if the userspace sends it down to kernel.

This patch introduces a new NETLINK_CMD - OVS_CTRL_CMD_SOCK_PROP to manage
all properties associated with a socket. The properties are passed down as
netlink message attributes. This makes it easier to introduce other
properties in the future.

Signed-off-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agoovn-sbctl: Adjust formatting of lflow-list.
Russell Bryant [Sun, 10 Jul 2016 21:46:26 +0000 (17:46 -0400)]
ovn-sbctl: Adjust formatting of lflow-list.

Adjust the field width for a couple of elements in the output of the
lflow-list sub-command of ovn-sbctl. We now have a table ID of 10, so
set a field width of 2 to keep output aligned. Table names have grown to
a max of 19 characters, so update the field width to keep output
aligned.  Finally, left justify values in fields, as I find that to look
a little nicer.

Also update sample output in OVN-Tutorial.md to match the current state.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoofproto: Fix consistent hashing
Liran Schour [Tue, 12 Jul 2016 06:15:40 +0000 (09:15 +0300)]
ofproto: Fix consistent hashing

Hashing will not be consistent as long as we use for hashing the index of the
bucket in the list (for remove/insert of buckets not from/to the end of the
bucket list).
Use bucket_id for hashing instead.

Signed-off-by: Liran Schour <lirans@il.ibm.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Simon Horman <simon.horman@netronome.com>
7 years agosset: New function sset_from_delimited_string().
Ben Pfaff [Sat, 25 Jun 2016 04:30:39 +0000 (21:30 -0700)]
sset: New function sset_from_delimited_string().

This simplifies code in a couple of places.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-By: Ryan Moats <rmoats@us.ibm.com>
7 years agoovn-northd: Use ovs_be32 for an IP address in find_lrp_member_ip().
Ben Pfaff [Wed, 13 Jul 2016 20:02:59 +0000 (13:02 -0700)]
ovn-northd: Use ovs_be32 for an IP address in find_lrp_member_ip().

Fixes a number of warnings from "sparse".

Fixes: 4685e523695c ("ovn: Support multiple addresses on a single logical router port.")
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Gurucharan Shetty <guru@ovn.org>
7 years agosystem-common-macros.at: Add a iface-id to interfaces.
Gurucharan Shetty [Mon, 11 Jul 2016 10:06:21 +0000 (03:06 -0700)]
system-common-macros.at: Add a iface-id to interfaces.

IntegrationGuide.md explains the meaning of the key 'iface-id'. Adding
it as part of ADD_VETH is useful for OVN related tests. For non-OVN
tests, it should have no effect. Upcoming commits take advantage of this.

Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Acked-by: Joe Stringer <joe@ovn.org>
7 years agosystem-common-macros: Enhance ADD_VETH to take mac and gateway.
Gurucharan Shetty [Mon, 11 Jul 2016 09:55:59 +0000 (02:55 -0700)]
system-common-macros: Enhance ADD_VETH to take mac and gateway.

It is useful to set the mac address and gateway while using ADD_VETH
to connect a namespace to a OVN logical topology. Upcoming commits
use this enhancement.

Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Acked-by: Joe Stringer <joe@ovn.org>
7 years agoovsdb-client: Move iterator definition to prevent shadowing.
Justin Pettit [Tue, 12 Jul 2016 19:51:22 +0000 (12:51 -0700)]
ovsdb-client: Move iterator definition to prevent shadowing.

This doesn't fix a bug, but is more standard.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
7 years agodpctl: Fix shadowed iterator in show_dpif().
Justin Pettit [Tue, 12 Jul 2016 19:46:20 +0000 (12:46 -0700)]
dpctl: Fix shadowed iterator in show_dpif().

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
7 years agoovn-northd: Fix shadowed iterators in port security functions.
Justin Pettit [Tue, 12 Jul 2016 18:15:00 +0000 (11:15 -0700)]
ovn-northd: Fix shadowed iterators in port security functions.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
7 years agoovn-nbctl: Print router port networks in "show".
Justin Pettit [Mon, 11 Jul 2016 07:23:17 +0000 (00:23 -0700)]
ovn-nbctl: Print router port networks in "show".

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoovn: Support multiple addresses on a single logical router port.
Justin Pettit [Sat, 9 Jul 2016 16:55:20 +0000 (09:55 -0700)]
ovn: Support multiple addresses on a single logical router port.

Supporting multiple addresses is only mildly interesting for IPv4.
However, it is a requirement for IPv6, which will arrive in a future
commit.

This commit introduces the extract_lrp_networks() function to ovn-util.[ch].

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoovn-northd: Use strings from extract_lsp_addresses().
Justin Pettit [Sat, 4 Jun 2016 18:49:46 +0000 (11:49 -0700)]
ovn-northd: Use strings from extract_lsp_addresses().

Extract port security and logical switch port addresses once and store
them as part of the ovn_port structure.  Use the string representations
from the extracted addresses.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoovn-util: Remove 'store_ipv6' argument from extract_lsp_addresses().
Justin Pettit [Fri, 3 Jun 2016 05:37:31 +0000 (22:37 -0700)]
ovn-util: Remove 'store_ipv6' argument from extract_lsp_addresses().

With the addition of IPv6 routing, there won't be much need to
special-case not parsing IPv6 addresses.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoovn-util: Add string representations to 'lport_addresses'.
Justin Pettit [Fri, 3 Jun 2016 04:44:38 +0000 (21:44 -0700)]
ovn-util: Add string representations to 'lport_addresses'.

A future commit will reduce the amount of conversions used by the
existing users of 'lport_addresses'.  This change will also make it
possible to use this structure for logical router port networks.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoovn-northd: Use strings for IP addresses in router instances of "ovn_port".
Justin Pettit [Mon, 26 Oct 2015 03:35:58 +0000 (20:35 -0700)]
ovn-northd: Use strings for IP addresses in router instances of "ovn_port".

Reduce the amount of string conversions necessary.  This will be
convenient when we want to start using IPv6 addresses, too.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoovn-northd: Use dynamic strings when building router and switch flows.
Justin Pettit [Fri, 8 Jul 2016 23:25:08 +0000 (16:25 -0700)]
ovn-northd: Use dynamic strings when building router and switch flows.

Reduce the number of memory allocations and risk of introducing shadow
variables.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoovn: Remove 'default_gw' from logical router table.
Justin Pettit [Tue, 17 May 2016 13:02:53 +0000 (06:02 -0700)]
ovn: Remove 'default_gw' from logical router table.

With static routes, it's not necessary to have a separate default
gateway parameter.  This also makes configuring router ports clearer
when IPv6 and IPv4 addresses may be assigned to the same port.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoovn: Add xxreg[01] symbols.
Justin Pettit [Tue, 12 Jul 2016 01:25:24 +0000 (18:25 -0700)]
ovn: Add xxreg[01] symbols.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoovn: Renumber logical field registers to the newly extended registers.
Justin Pettit [Fri, 24 Jun 2016 03:39:18 +0000 (20:39 -0700)]
ovn: Renumber logical field registers to the newly extended registers.

IPv6 addresses use four standard OVS registers, so move the existing
named registers back to make room for using more logical registers.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoIntroduce 128-bit xxregs.
Justin Pettit [Sat, 31 Oct 2015 11:45:28 +0000 (04:45 -0700)]
Introduce 128-bit xxregs.

These are needed to handle IPv6 addresses.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoIncrease number of registers to 16.
Justin Pettit [Fri, 24 Jun 2016 00:54:26 +0000 (17:54 -0700)]
Increase number of registers to 16.

With eight 32-bit registers, we can only store two IPv6 addresses, which is
pretty tight.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoovn-northd: Fix comments about the flows.
Justin Pettit [Tue, 12 Jul 2016 06:21:29 +0000 (23:21 -0700)]
ovn-northd: Fix comments about the flows.

References to the specifc tables should probably be dropped, since
they'll continue to drift towards wrong.  In the meantime, correct the
ones that are there.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoovn-controller: Log OpenFlow errors at "info" level.
Justin Pettit [Tue, 21 Jun 2016 21:06:29 +0000 (14:06 -0700)]
ovn-controller: Log OpenFlow errors at "info" level.

Otherwise, errors are logged at "debug" level.  Errors when pushing
flows can then seemingly be silently lost.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoofctrl: Fix non-sensical comment.
Justin Pettit [Sun, 3 Jul 2016 12:30:06 +0000 (05:30 -0700)]
ofctrl: Fix non-sensical comment.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agoovs-bugtool: Port to python3.
Joe Stringer [Fri, 24 Jun 2016 21:15:21 +0000 (14:15 -0700)]
ovs-bugtool: Port to python3.

Fix python2-specific code in ovs-bugtool:
* python2 long() is the same as python2 int() and python3 int(). Convert
  the long() to int().
* raw_input() was renamed to input(). Use python-six's input() on python2.
* Drop lambda tuple unpacking, we can go back to regular lambda syntax.
* file() can be replaced with open().

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
7 years agosystem-traffic: Use NC_EOF_OPT in truncate tests.
Joe Stringer [Mon, 11 Jul 2016 17:29:18 +0000 (10:29 -0700)]
system-traffic: Use NC_EOF_OPT in truncate tests.

NC_EOF_OPT should always be passed to netcat in system-traffic tests
when invoking netcat to send a single packet that does not expect a
response. While on typical fedora/RH based distributions the default
behaviour is to send the packet then return, there are multiple other
implementations of netcat that do not do this (for example, those used
by Debian and Ubuntu by default). For these alternative implementations,
we provide $NC_EOF_OPT to ensure that netcat simply sends the packet
then returns immediately.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
7 years agodatapath: Fix ip tunnel compilation for newer kernel.
Pravin B Shelar [Mon, 11 Jul 2016 20:06:10 +0000 (13:06 -0700)]
datapath: Fix ip tunnel compilation for newer kernel.

compat iptunnel_xmit is used in backported tunnel code. but
it was only defined for kernel older than 3.18, This patch fixes
it by compiling it for all kernel which needs to use backported
tunnel implementation.

Reported-by: Justin Pettit <jpettit@ovn.org>
Reported-by: Joe Stringer <joe@ovn.org>
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath-windows: remove unused 'ovsUserTimestampDelta'
Nithin Raju [Sat, 9 Jul 2016 00:45:40 +0000 (17:45 -0700)]
datapath-windows: remove unused 'ovsUserTimestampDelta'

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agoovn-controller: Change strategy for gateway conntrack zone allocation.
Gurucharan Shetty [Fri, 8 Jul 2016 07:15:49 +0000 (00:15 -0700)]
ovn-controller: Change strategy for gateway conntrack zone allocation.

Commit 263064aeaa31e7 (Convert binding_run to incremental processing.)
changed the way patched_datapaths were handled. Previously we would
destroy the datastructure in every run and re-create it fresh. The new
way causes problems with the way conntrack zones are allocated as now
we can have stale port_binding entries causing segmentation faults.

With this commit, we simply don't depend on port_binding records in
conntrack zone allocation and instead store the UUID as a string in
the patch_datapath datastructure.

(The test enhanced with this commit would fail without the changes
in the commit. i.e. ovn-controller would crash. )

Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Acked-by: Ryan Moats <rmoats@us.ibm.com>
7 years agoovn: Remove unreferenced patched datapaths.
Darrell Ball [Fri, 8 Jul 2016 02:26:06 +0000 (19:26 -0700)]
ovn: Remove unreferenced patched datapaths.

Patched datapaths that are no longer referenced should be removed from
the patched_datapaths map; otherwise incorrect state references for a
patched datapath may be used and also datapaths that are absent will be
interpreted as present.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Acked-by: Ryan Moats <rmoats@us.ibm.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
7 years agodatapath: backport: iptunnel: make rx/tx bytes counters consistent
Pravin B Shelar [Fri, 8 Jul 2016 23:37:34 +0000 (16:37 -0700)]
datapath: backport: iptunnel: make rx/tx bytes counters consistent

Upstream commit:
commit bc22a0e2ea03b75b51a1f722f93821744b5b5ff1
Author: Nicolas Dichtel <nicolas.dichtel@6wind.com>

    iptunnel: make rx/tx bytes counters consistent

    This was already done a long time ago in
    commit 64194c31a0b6 ("inet: Make tunnel RX/TX byte counters more consistent")
    but tx path was broken (at least since 3.10).

    Before the patch the gre header was included on tx.

    After the patch:
    $ ping -c1 192.168.0.121 ; ip -s l ls dev gre1
    PING 192.168.0.121 (192.168.0.121) 56(84) bytes of data.
    64 bytes from 192.168.0.121: icmp_req=1 ttl=64 time=2.95 ms

    --- 192.168.0.121 ping statistics ---
    1 packets transmitted, 1 received, 0% packet loss, time 0ms
    rtt min/avg/max/mdev = 2.955/2.955/2.955/0.000 ms
    7: gre1@NONE: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1468 qdisc noqueue state UNKNOWN mode DEFAULT group default
        link/gre 10.16.0.249 peer 10.16.0.121
        RX: bytes  packets  errors  dropped overrun mcast
        84         1        0       0       0       0
        TX: bytes  packets  errors  dropped carrier collsns
        84         1        0       0       0       0

Reported-by: Julien Meunier <julien.meunier@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
7 years agodatapath: backport: ovs/vxlan: fix rtnl notifications on iface deletion
Pravin B Shelar [Fri, 8 Jul 2016 23:37:30 +0000 (16:37 -0700)]
datapath: backport: ovs/vxlan: fix rtnl notifications on iface deletion

At this point OVS tunneling is insync with upstream net
branch (commit 9a0fee2b552b1).

upstream commit:
    commit cf5da330bbdd0c06b05c525a3d1d58ccd82c87a6
    Author: Nicolas Dichtel <nicolas.dichtel@6wind.com>

    ovs/vxlan: fix rtnl notifications on iface deletion

    The function vxlan_dev_create() (only used by ovs) never calls
    rtnl_configure_link(). The consequence is that dev->rtnl_link_stat is
    never set to RTNL_LINK_INITIALIZED.
    During the deletion phase, the function rollback_registered_many() sends
    a RTM_DELLINK only if dev->rtnl_link_state is set to RTNL_LINK_INITIALIZED.

    Note that the function vxlan_dev_create() is moved after the rtnl stuff so
    that vxlan_dellink() can be called in this function.

    Fixes: dcc38c033b32 ("openvswitch: Re-add CONFIG_OPENVSWITCH_VXLAN")
CC: Thomas Graf <tgraf@suug.ch>
CC: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>