]> git.proxmox.com Git - ovs.git/log
ovs.git
6 years agonetdev-dpdk: Remove uneeded call to rte_eth_dev_count().
Kevin Traynor [Mon, 27 Nov 2017 17:25:49 +0000 (17:25 +0000)]
netdev-dpdk: Remove uneeded call to rte_eth_dev_count().

The call to rte_eth_dev_count() was added as workaround
for rte_eth_dev_get_port_by_name() not handling cases
when there was no DPDK ports.

In versions of DPDK >= 17.02 rte_eth_dev_get_port_by_name()
does handle this case (DPDK commit f9ae888b1e19).
rte_eth_dev_count() is no longer needed so remove it.

Acked-by: Ciara Loftus <ciara.loftus@intel.com>
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
6 years agonetdev-dpdk: Add comment about variables naming convention.
Ilya Maximets [Thu, 23 Nov 2017 13:48:26 +0000 (16:48 +0300)]
netdev-dpdk: Add comment about variables naming convention.

It'll be nice to document current naming convention for variables of
the following types used in netdev-dpdk:

* netdev
* netdev_dpdk
* netdev_rxq
* netdev_rxq_dpdk

to be sure that we will not return to chaos which was before
commit d46285a2206f ("netdev-dpdk: Consistent variable naming.").

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
6 years agonetdev-dpdk: Fix variables naming in set_admin_state function.
Ilya Maximets [Thu, 23 Nov 2017 13:48:25 +0000 (16:48 +0300)]
netdev-dpdk: Fix variables naming in set_admin_state function.

Function 'netdev_dpdk_set_admin_state()' was missed while fixing
variables naming according to the following convention:

    'struct netdev':'netdev'
    'struct netdev_dpdk':'dev'
    'struct netdev_rxq':'rxq'
    'struct netdev_rxq_dpdk':'rx'

Fixes: d46285a2206f ("netdev-dpdk: Consistent variable naming.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokess <ian.stokes@intel.com>
6 years agoovsdb-data: Add OVS_WARN_UNUSED_RESULT annotations to function definitions.
Ben Pfaff [Wed, 23 Aug 2017 07:15:03 +0000 (00:15 -0700)]
ovsdb-data: Add OVS_WARN_UNUSED_RESULT annotations to function definitions.

The function prototypes in ovsdb-data.h already have these, but it seems
more complete to have the annotation on the definitions too.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agoAUTHORS: Update email address for Thadeu Lima de Souza Cascardo.
Ben Pfaff [Fri, 8 Dec 2017 15:51:08 +0000 (07:51 -0800)]
AUTHORS: Update email address for Thadeu Lima de Souza Cascardo.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Thadeu Lima de Souza Cascardo <cascardo@cascardo.eti.br>
6 years agodatapath-windows: Correct endianness for deleting zone.
Justin Pettit [Tue, 5 Dec 2017 07:22:40 +0000 (23:22 -0800)]
datapath-windows: Correct endianness for deleting zone.

The zone Netlink attribute is supposed to be in network-byte order, but
the Windows code for deleting conntrack entries was treating it as
host-byte order.

Found by inspection.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
6 years agodpctl: Support flush conntrack by conntrack 5-tuple
Yi-Hung Wei [Thu, 7 Dec 2017 18:40:04 +0000 (10:40 -0800)]
dpctl: Support flush conntrack by conntrack 5-tuple

With this patch, "flush-conntrack" in ovs-dpctl and ovs-appctl accept
a conntrack 5-tuple to delete the conntrack entry specified by the 5-tuple.
For example, user can use the following command to flush a conntrack entry
in zone 5.

$ ovs-dpctl flush-conntrack zone=5 \
  'ct_nw_src=10.1.1.2,ct_nw_dst=10.1.1.1,ct_nw_proto=17,ct_tp_src=2,ct_tp_dst=1'

$ ovs-appctl dpctl/flush-conntrack zone=5 \
  'ct_nw_src=10.1.1.2,ct_nw_dst=10.1.1.1,ct_nw_proto=17,ct_tp_src=2,ct_tp_dst=1'

VMWare-BZ: #1983178
Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Justin Pettit <jpettit@ovn.org>
6 years agoct-dpif,dpif-netlink: Support conntrack flush by ct 5-tuple
Yi-Hung Wei [Thu, 7 Dec 2017 18:40:03 +0000 (10:40 -0800)]
ct-dpif,dpif-netlink: Support conntrack flush by ct 5-tuple

This patch adds support of flushing a conntrack entry specified by the
conntrack 5-tuple, and provides the implementation in dpif-netlink.
The implementation of dpif-netlink in the linux datapath utilizes the
NFNL_SUBSYS_CTNETLINK netlink subsystem to delete a conntrack entry in
nf_conntrack.  Future patches will add support for the userspace and
Windows datapaths.

VMWare-BZ: #1983178
Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Justin Pettit <jpettit@ovn.org>
6 years agodpctl: Fix comment describing get_one_dp().
Justin Pettit [Thu, 7 Dec 2017 06:03:18 +0000 (22:03 -0800)]
dpctl: Fix comment describing get_one_dp().

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agotests: Use $(MKDIR_P) instead of mkdir -p.
Ben Pfaff [Wed, 6 Dec 2017 00:27:29 +0000 (16:27 -0800)]
tests: Use $(MKDIR_P) instead of mkdir -p.

It is more portable.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agotests: Use $(MKDIR_P) to avoid races.
Ben Pfaff [Wed, 6 Dec 2017 00:27:13 +0000 (16:27 -0800)]
tests: Use $(MKDIR_P) to avoid races.

"test -d x || mkdir x" has a race when invoked in parallel: it is possible
for two processes to both see that 'x' does not exist and both try to
create it, and if that happens then one of them will fail.  This avoids
the problem.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agoOVN pacemaker: Add the monitor action for Master role
Numan Siddique [Mon, 4 Dec 2017 14:27:08 +0000 (19:57 +0530)]
OVN pacemaker: Add the monitor action for Master role

Pacemaker Resource agent periodically calls the OVN OCF's "monitor" action
periodically to check the status. But the OVN OCF script doesn't add the
action "monitor" for the role "Master" because of which the pacemaker
resource agent do not call the "monitor" action at all for the master.
In case OVN db servers exit for some reason this totally gets undetected
and one of the standby node is not promoted to master.

This patch adds the monitor action for "Master" role. Also the monitor
action do not check for the status of the ovn-northd (if manage_northd is yes).
This patch also checks for the status of the ovn-northd in the monitor action
for the "Master" role. If any of the ovsdb-server or ovn-northd is not running,
monitor action will return OCF_NOT_RUNNING and this will cause the pacemaker
to restart the OVN OCF resource.

Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1512568
Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
CC: Russell Bryant <russell@ovn.org>
Signed-off-by: Russell Bryant <russell@ovn.org>
6 years agoovn/TODO: Remove some completed items.
Justin Pettit [Mon, 27 Nov 2017 22:24:39 +0000 (14:24 -0800)]
ovn/TODO: Remove some completed items.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agodatapath: Fix kernel panic for uninitialized tun_dst of ovs_gso_cb.
Yunjian Wang [Sat, 18 Nov 2017 10:01:27 +0000 (18:01 +0800)]
datapath: Fix kernel panic for uninitialized tun_dst of ovs_gso_cb.

The variable tun_dst in struct ovs_gso_cb isn't necessarily all-zeros which
came from the Netlink layer. When delete a netdev port and immediately add
a vxlan port, they maybe use the same port_no. So the variable tun_dst of
struct ovs_gso_cb hasn't be set, when the skb sent to the vxlan port. And
the panic will be triggered.

BUG: unable to handle kernel NULL pointer dereference at 0000000000000052
IP: [<ffffffffa07954f4>] rpl_vxlan_xmit+0x34/0x60 [openvswitch]
PGD 1f9f374067 PUD 1f9f375067 PMD 0
Oops: 0000 [#1] SMP
RIP: 0010:[<ffffffffa07954f4>]  [<ffffffffa07954f4>] rpl_vxlan_xmit+0x34/0x60 [openvswitch]
RSP: 0018:ffff881fff483898  EFLAGS: 00010202
RAX: 0000000000000040 RBX: ffff881ff2d59f00 RCX: ffff881f742016b0
RDX: 0000000000000001 RSI: ffff881f9f5f0000 RDI: ffff881ff2d59f00
RBP: ffff881fff483898 R08: 000000000000002e R09: 0000000000000000
R10: 0000000000000000 R11: ffff881fff483a50 R12: ffff881f74201680
R13: 000000000000ffbe R14: 0000000000000000 R15: ffff881ff2d59f00
FS:  00007f8b6f7fe700(0000) GS:ffff881fff480000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000052 CR3: 0000001f9f373000 CR4: 00000000000027e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Call Trace:
 <IRQ>
[<ffffffffa0786480>] ovs_vport_send+0xa0/0x180 [openvswitch]
[<ffffffffa077414e>] do_output+0x4e/0xf0 [openvswitch]
[<ffffffffa07758ae>] do_execute_actions+0xa6e/0xa90 [openvswitch]
[<ffffffff815b654f>] ? netlink_unicast+0x16f/0x1b0
[<ffffffff815732bb>] ? skb_zerocopy+0x1fb/0x380
[<ffffffffa07847ca>] ? flow_lookup.isra.8+0x4a/0xc0 [openvswitch]
[<ffffffffa0775b2d>] ovs_execute_actions+0x4d/0x140 [openvswitch]
[<ffffffffa077c604>] ovs_dp_process_packet+0x94/0x140 [openvswitch]
[<ffffffffa07762c4>] ? ovs_ct_update_key+0xc4/0x150 [openvswitch]
[<ffffffffa078637b>] ovs_vport_receive+0x7b/0xe0 [openvswitch]
[<ffffffffa077c604>] ? ovs_dp_process_packet+0x94/0x140 [openvswitch]
[<ffffffff816062d6>] ? __fib_validate_source.isra.13+0x2b6/0x400
[<ffffffff8158da15>] ? dst_init+0xe5/0xf0
[<ffffffffa021a2af>] ? generic_packet+0x1f/0x30 [nf_conntrack]
[<ffffffffa02160d0>] ? nf_conntrack_in+0x350/0x5f0 [nf_conntrack]
[<ffffffffa0787047>] netdev_port_receive+0xa7/0x100 [openvswitch]
[<ffffffffa07870be>] netdev_frame_hook+0x1e/0x30 [openvswitch]
[<ffffffff81581a52>] __netif_receive_skb_core+0x1e2/0x800
[<ffffffff81582088>] __netif_receive_skb+0x18/0x60
[<ffffffff81582110>] netif_receive_skb_internal+0x40/0xc0
[<ffffffff81583228>] napi_gro_receive+0xd8/0x130
[<ffffffffa04ef634>] ixgbe_clean_rx_irq+0x7c4/0xa60 [ixgbe]
[<ffffffffa04f0930>] ixgbe_poll+0x2e0/0x6c0 [ixgbe]
[<ffffffff815828b0>] net_rx_action+0x170/0x380
[<ffffffff81090b0f>] __do_softirq+0xef/0x280
[<ffffffff816ac15c>] call_softirq+0x1c/0x30
[<ffffffff8102e47d>] do_softirq+0x5d/0xb0
[<ffffffff81090ebd>] irq_exit+0x12d/0x140
[<ffffffff816accf8>] do_IRQ+0x58/0xf0
[<ffffffff816a1ced>] common_interrupt+0x6d/0x6d
<EOI>

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Greg Rose <gvrose8192@gmail.com>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agoOVN: Add external_ids to NAT and Logical_Router_Static_Route tables.
Lucas Alvares Gomes [Mon, 4 Dec 2017 13:16:01 +0000 (13:16 +0000)]
OVN: Add external_ids to NAT and Logical_Router_Static_Route tables.

The external_ids column is missing from the NAT and
Logical_Router_Static_Route tables.

Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Daniel Alvarez <dalvarez@redhat.com>
Acked-by: Miguel Angel Ajo <majopela@redhat.com>
6 years agosflow: Correctly document setup command.
Ben Pfaff [Mon, 4 Dec 2017 16:39:39 +0000 (08:39 -0800)]
sflow: Correctly document setup command.

Reported-by: Shivaram Mysore <shivaram.mysore@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agocoding-style: Explain when to break lines before or after binary operators.
Ben Pfaff [Mon, 4 Dec 2017 16:33:49 +0000 (08:33 -0800)]
coding-style: Explain when to break lines before or after binary operators.

The coding style has never been explicit about this.  This commit adds some
explanation of why one position or the other might be favored in a given
situation.

Suggested-by: Flavio Leitner <fbl@sysclose.org>
Suggested-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-November/341091.html
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Tiago Lam <tiagolam@gmail.com>
6 years agoodp-util: Fix another hang in NSH action parsing.
Ben Pfaff [Wed, 29 Nov 2017 16:59:03 +0000 (08:59 -0800)]
odp-util: Fix another hang in NSH action parsing.

Found by libfuzzer.

Reported-by: Bhargava Shastry <bshastry@sec.t-labs.tu-berlin.de>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jan Scheurich <jan.scheurich@ericsson.com>
6 years agolib, ovsdb: Adapt headers for C++ usage
Yi-Hung Wei [Thu, 30 Nov 2017 19:11:50 +0000 (11:11 -0800)]
lib, ovsdb: Adapt headers for C++ usage

This patch adds 'extern "C"' in a couple of header files so that
they can be compiled with C++ compilers.

Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agofedora.rst, rhel.rst: Fix broken build.
Ben Pfaff [Fri, 1 Dec 2017 20:55:11 +0000 (12:55 -0800)]
fedora.rst, rhel.rst: Fix broken build.

This fixes several "ERROR: Unexpected indentation" messages from the
docs-check target.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoRPM: Improve doc to use builddep tool.
Flavio Leitner [Tue, 14 Nov 2017 22:23:55 +0000 (20:23 -0200)]
RPM: Improve doc to use builddep tool.

Instead of listing all the dependencies, use the RPM group
'Development Tools' and the builddep tool to find specific
ones.

Signed-off-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
6 years agoovn-ctl: Add new commands 'run_nb_server' and 'run_sb_server'
Numan Siddique [Fri, 1 Dec 2017 09:07:38 +0000 (14:37 +0530)]
ovn-ctl: Add new commands 'run_nb_server' and 'run_sb_server'

Presently if the user wants to start OVN db servers as separate containers,
'ovn-ctl' script is not useful as '--detach' option is passed when
ovsdb-servers are started.  If the container command is 'ovn-ctl
start_nb_ovsdb', the  container exits as soon as ovn-ctl exits.

This patch adds two new commands - 'run_nb_server' and 'run_sb_server'. This
will be really useful for the above mentioned requirement.

Without these commands, the user may have to first generate the db by running
'ovsdb-tool' and then start the container with the command 'ovsdb-server
ovnnb_db.db ....' and this is very inconvenient.

This patch also updates the documentation in ovn-ctl.8.xml.

Suggested-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoodp-util: Fix parsing corner case for encap_nsh() actions.
Ben Pfaff [Tue, 28 Nov 2017 18:20:32 +0000 (10:20 -0800)]
odp-util: Fix parsing corner case for encap_nsh() actions.

When nothing matched, the code would loop forever.

Found with libfuzzer.

Reported-by: Bhargava Shastry <bshastry@sec.t-labs.tu-berlin.de>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jan Scheurich <jan.scheurich@ericsson.com>
6 years agonetdev: netdev_get_etheraddr is not functioning as advertised.
Yifeng Sun [Thu, 30 Nov 2017 16:31:24 +0000 (08:31 -0800)]
netdev: netdev_get_etheraddr is not functioning as advertised.

netdev_get_etheraddr claims to clear 'mac' on error, but it fails to do so.
When looking further into both netdev_windows_get_etheraddr() and
netdev_linux_get_etheraddr(), 'mac' is also not cleared. This will lead to
usage of uninitialised ofputil_phy_port.hw_addr.

v1 -> v2: fixed a bug in v1 found by Ben, thanks Ben.

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoodp-execute: Add helpful comment to odp_execute_actions().
Ben Pfaff [Wed, 29 Nov 2017 22:14:50 +0000 (14:14 -0800)]
odp-execute: Add helpful comment to odp_execute_actions().

It wasn't obvious how ownership transferred to odp_execute_actions() or
to its callback.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
6 years agoodp-execute: Skip processing actions when batch is emptied
Vishal Deep Ajmera [Thu, 30 Nov 2017 05:37:57 +0000 (05:37 +0000)]
odp-execute: Skip processing actions when batch is emptied

Today in OVS, when errors are encountered during the execution
of an action the entire batch of packets may be deleted (for e.g.
in processing push_tnl_action, if the port is not found in the
port_cache of PMD). The remaining actions continue to be executed
even though there are no packets to be processed.

It is assumed that the code dealing with each action checks that
the batch is not empty before executing. Crashes may occur if the
assumption is not met.

The patch makes OVS skip processing of further actions from the
action-set once a batch is emptied. Doing so centralizes the check
in one place and avoids the possibility of crashes.

This change DOES NOT fix any existing bug in the code, only a
precautionary measure to avoid crashes if new actions does not
take care of empty batches.

Signed-off-by: Vishal Deep Ajmera <vishal.deep.ajmera@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agotypes: Avoid compound literals as initializers.
Ben Pfaff [Thu, 30 Nov 2017 17:45:11 +0000 (09:45 -0800)]
types: Avoid compound literals as initializers.

Older GCC can't cope.

Reported-by: Guoshuai Li <ligs@dtdream.com>
Reported-by: Vishal Deep Ajmera <vishal.deep.ajmera@ericsson.com>
Reported-by: Terry Wilson <twilson@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agocmap: Use PADDED_MEMBERS macro for cmap_bucket padding.
Ilya Maximets [Thu, 30 Nov 2017 12:55:03 +0000 (15:55 +0300)]
cmap: Use PADDED_MEMBERS macro for cmap_bucket padding.

Current implementation of manual padding inside struct cmap_bucket
doesn't work for some cacheline sizes. For example, if CACHE_LINE_SIZE
equals to 128, compiler adds an additional 8 bytes: 4 bytes between
'hashes' and 'nodes' and 4 bytes after the manual 'pad'. This leads to
build time assertion, because sizeof(struct cmap_bucket) == 136.

Fix that by using PADDED_MEMBERS macro, which will handle all the
unexpected compiler paddings.
This is safe because we still have build time assert for the structure
size. Other possible solution is to pack the structure, but the padding
marco looks better and matches the other code.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoofproto-dpif-xlate: Fix bug that may leak ofproto_flow_mod
Yifeng Sun [Mon, 20 Nov 2017 12:26:39 +0000 (04:26 -0800)]
ofproto-dpif-xlate: Fix bug that may leak ofproto_flow_mod

When ofm is not referenced by xc_entry, we should release its
resources by calling ofproto_flow_mod_uninit because no one is
going to use it in this function.

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agobfd: Fix memory leak
Yifeng Sun [Wed, 15 Nov 2017 14:59:26 +0000 (06:59 -0800)]
bfd: Fix memory leak

Valgrind complains in test 2359 ():

864 (576 direct, 288 indirect) bytes in 18 blocks are definitely
lost in loss record 96 of 101
   by 0x4A6D64: xmalloc (util.c:120)
   by 0x40BC04: gateway_chassis_get_ordered (gchassis.c:73)
   by 0x408CF0: bfd_calculate_chassis (bfd.c:219)
   by 0x408CF0: bfd_run (bfd.c:257)
   by 0x407F72: main (ovn-controller.c:718)

gateway_chassis wasn't released before the 'continue' line.

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Greg Rose <gvrose8192@gmail.com>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agodpif: Fix memory leak
Yifeng Sun [Wed, 15 Nov 2017 14:59:25 +0000 (06:59 -0800)]
dpif: Fix memory leak

Valgrind complains in test 2322 (ovn -- 3 HVs, 3 LS, 3 lports/LS, 1 LR):

31,584 (26,496 direct, 5,088 indirect) bytes in 48 blocks are definitely
lost in loss record 422 of 427
   by 0x5165F4: xmalloc (util.c:120)
   by 0x466194: dp_packet_new (dp-packet.c:138)
   by 0x466194: dp_packet_new_with_headroom (dp-packet.c:148)
   by 0x46621B: dp_packet_clone_data_with_headroom (dp-packet.c:210)
   by 0x46621B: dp_packet_clone_with_headroom (dp-packet.c:170)
   by 0x49DD46: dp_packet_batch_clone (dp-packet.h:789)
   by 0x49DD46: odp_execute_clone (odp-execute.c:616)
   by 0x49DD46: odp_execute_actions (odp-execute.c:795)
   by 0x471663: dpif_execute_with_help (dpif.c:1296)
   by 0x473795: dpif_operate (dpif.c:1411)
   by 0x473E20: dpif_execute.part.21 (dpif.c:1320)
   by 0x428D38: packet_execute (ofproto-dpif.c:4682)
   by 0x41EB51: ofproto_packet_out_finish (ofproto.c:3540)
   by 0x41EB51: handle_packet_out (ofproto.c:3581)
   by 0x4233DA: handle_openflow__ (ofproto.c:8044)
   by 0x4233DA: handle_openflow (ofproto.c:8219)
   by 0x4514AA: ofconn_run (connmgr.c:1437)
   by 0x4514AA: connmgr_run (connmgr.c:363)
   by 0x41C8B5: ofproto_run (ofproto.c:1813)
   by 0x40B103: bridge_run__ (bridge.c:2919)
   by 0x4103B3: bridge_run (bridge.c:2977)
   by 0x406F14: main (ovs-vswitchd.c:119)

the parameter dp_packet_batch is leaked when 'may_steal' is true.

When dpif_execute_helper_cb is passed with a true 'may_steal', it
is supposed to take the ownership of dp_packet_batch and release
it when done.

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoexecution: Fix bug that leaks ovsdb_row
Yifeng Sun [Mon, 20 Nov 2017 12:26:38 +0000 (04:26 -0800)]
execution: Fix bug that leaks ovsdb_row

If there is an error after ovsdb_rbac_insert, 'row' is leaked.
So move the existing ovsdb_row_destroy to the function end.

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoflow: Avoid buffer overread in parse_nsh() for malformed packet.
Ben Pfaff [Wed, 29 Nov 2017 16:30:00 +0000 (08:30 -0800)]
flow: Avoid buffer overread in parse_nsh() for malformed packet.

Found by libfuzzer.

CC: Jan Scheurich <jan.scheurich@ericsson.com>
Fixes: 7edef47b4896 ("NSH: Minor bugfixes")
Reported-by: Bhargava Shastry <bshastry@sec.t-labs.tu-berlin.de>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jan Scheurich <jan.scheurich@ericsson.com>
6 years agotypes: New macros ETH_ADDR_C and ETH_ADDR64_C.
Ben Pfaff [Tue, 28 Nov 2017 23:32:24 +0000 (15:32 -0800)]
types: New macros ETH_ADDR_C and ETH_ADDR64_C.

These macros expand to constants of type struct eth_addr and struct
eth_addr64, respectively, and make it more convenient to initialize or
assign to an Ethernet address object.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
6 years agoutil: Make xmalloc_cacheline() allocate full cachelines.
Ben Pfaff [Tue, 28 Nov 2017 18:28:33 +0000 (10:28 -0800)]
util: Make xmalloc_cacheline() allocate full cachelines.

Until now, xmalloc_cacheline() has provided its caller memory that does not
share a cache line, but when posix_memalign() is not available it did not
provide a full cache line; instead, it returned memory that was offset 8
bytes into a cache line.  This makes it hard for clients to design
structures to be cache line-aligned.  This commit changes
xmalloc_cacheline() to always return a full cache line instead of memory
offset into one.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Bhanuprakash Bodireddy <Bhanuprakash.bodireddy@intel.com>
Tested-by: Bhanuprakash Bodireddy <Bhanuprakash.bodireddy@intel.com>
Tested-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-November/341362.html

6 years agoredhat: Create /etc/openvswitch/* with openvswitch as user/group
Timothy Redaelli [Wed, 29 Nov 2017 16:46:53 +0000 (17:46 +0100)]
redhat: Create /etc/openvswitch/* with openvswitch as user/group

Without this commit is not possible to upgrade an openvswitch release
that includes the commit ac416a3ab2d2 (for example 2.8.0) with another release
that includes the commit ac416a3ab2d2 (for example master or 2.8.1), because
rpm changes the user/group of /etc/openvswitch to root/root, but ovsdb-server
starts with the user openvswitch and so it doesn't have permissions to write in
/etc/openvswitch/conf.db.

This patch tell rpm to use the openvswitch user and group for
/etc/openvswitch and /etc/openvswitch/default.conf.

Reported-by: Mark Michelson <mmichels@redhat.com>
CC: aaron conole <aconole@redhat.com>
Fixes: ac416a3ab2d2 ("redhat: dynamically allocate and reference ovs user")
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
Tested-by: Mark Michelson <mmichels@redhat.com>
6 years agosmap: Return default on failure in smap_get_int/ullong.
Ilya Maximets [Wed, 29 Nov 2017 10:50:45 +0000 (13:50 +0300)]
smap: Return default on failure in smap_get_int/ullong.

Currently smap_get_int/ullong doesn't check any conversion errors.
Most implementations of atoi/strtoull return 0 in case of failure.

This leads to returning zero in case of wrongly set database values.
For example, commands

ovs-vsctl set interface iface options:key=\"\"
ovs-vsctl set interface iface options:key=qwe123
ovs-vsctl set interface iface options:key=abc

will have exactly same effect as

ovs-vsctl set interface iface options:key=0

in case where 'key' is an integer option of the iface.
Can be checked with 'other_config:emc-insert-inv-prob' or other
integer 'options' and 'other_config's.

0 could be not a default and not safe value for many options and
it'll be better to return default value instead if any.

Conversion functions from 'util' library used to provide proper
error handling.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Jan Scheurich <jan.scheurich@ericsson.com>
Acked-by: Jan Scheurich <jan.scheurich@ericsson.com>
6 years agoutil: Introduce str_to_ullong() helper function.
Ilya Maximets [Wed, 29 Nov 2017 10:50:44 +0000 (13:50 +0300)]
util: Introduce str_to_ullong() helper function.

Will be used to convert strings to unsigned long long.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jan Scheurich <jan.scheurich@ericsson.com>
6 years agoutil: Check ranges on string to int/long conversion.
Ilya Maximets [Wed, 29 Nov 2017 10:50:43 +0000 (13:50 +0300)]
util: Check ranges on string to int/long conversion.

It's required to check ranges to avoid integer overflow because
underlying strtoll() will check only for LLONG_MIN/MAX.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jan Scheurich <jan.scheurich@ericsson.com>
6 years agoovs-ofctl: Fix bad free in colors_parse_from_env().
Lili Huang [Wed, 29 Nov 2017 07:24:05 +0000 (15:24 +0800)]
ovs-ofctl: Fix bad free in colors_parse_from_env().

OVS_COLORS variable color_str is parsed by using xstrdup and strsep,
we should free original address of the string, not used after strsep.

Signed-off-by: Lili Huang <huanglili.huang@huawei.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
6 years agodatapath-windows: Fix possible NULL dereference in IpFragment
Alin Serdean [Mon, 6 Nov 2017 15:33:39 +0000 (17:33 +0200)]
datapath-windows: Fix possible NULL dereference in IpFragment

If we can't allocate the NBL just go to the cleanup sequence.

Found using WDK 10 static code analysis.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Shashank Ram <shashank08@gmail.com>
6 years agodatapath-windows: Fix static analysis warnings around ovsInstanceListLock
Alin Serdean [Mon, 6 Nov 2017 15:33:38 +0000 (17:33 +0200)]
datapath-windows: Fix static analysis warnings around ovsInstanceListLock

Check for return value when trying to initialize ovsInstanceListLock.

Also return the status back to caller of `OvsInitIpHelper`.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Shashank Ram <shashank08@gmail.com>
6 years agodatapath-windows: Fix static analysis warnings in OvsGetTcpPayloadLength
Alin Serdean [Mon, 6 Nov 2017 15:33:37 +0000 (17:33 +0200)]
datapath-windows: Fix static analysis warnings in OvsGetTcpPayloadLength

This fixes the static code analysis over the function
'OvsGetTcpPayloadLength'.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Shashank Ram <shashank08@gmail.com>
6 years agodatapath-windows: Add assert to ethHdr in OvsActionMplsPush
Alin Serdean [Mon, 6 Nov 2017 15:33:36 +0000 (17:33 +0200)]
datapath-windows: Add assert to ethHdr in OvsActionMplsPush

`ethHdr` cannot be NULL because we did a partial copy before it.

Add an assert to keep the static analysis happy.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Shashank Ram <shashank08@gmail.com>
6 years agodatapath-windows: Vport check RtlStringCbLengthW return value
Alin Serdean [Mon, 6 Nov 2017 15:33:35 +0000 (17:33 +0200)]
datapath-windows: Vport check RtlStringCbLengthW return value

The result of `RtlStringCbLengthW` is not currently checked and triggers
a warning using the WDK 8.1 static analysis.

This patch treats the result of `RtlStringCbLengthW`.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Shashank Ram <shashank08@gmail.com>
6 years agodatapath-windows: prettify logging in iphelper
Alin Serdean [Mon, 6 Nov 2017 15:33:34 +0000 (17:33 +0200)]
datapath-windows: prettify logging in iphelper

Found by inspection.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Shashank Ram <shashank08@gmail.com>
6 years agodatapath-windows: Use only non executable memory
Alin Serdean [Mon, 6 Nov 2017 15:33:33 +0000 (17:33 +0200)]
datapath-windows: Use only non executable memory

Use only non-executable memory when using MmGetSystemAddressForMdlSafe.

Introduce a new function called OvsGetMdlWithLowPriority for readability.

Found using WDK 10 static code analysis.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Shashank Ram <shashank08@gmail.com>
6 years agotunnel: Fix deletion of datapath tunnel ports in case of reconfiguration
Balazs Nemeth [Wed, 1 Nov 2017 15:20:47 +0000 (15:20 +0000)]
tunnel: Fix deletion of datapath tunnel ports in case of reconfiguration

There is an issue in OVS with tunnel deletion during the
reconfiguration of OF tunnels. If the dst_port value is changed, the
old tunnel map entry will not be deleted, because the tp_port
argument of tnl_port_map_delete() has the new dst_port setting, hence
the tunnel cannot be found in the list of tnl_port structures.

The patch corrects this mechanism by adding a new argument,
'old_odp_port' to tnl_port_reconfigure(). This value is used to
identify the datapath tunnel port which is being reconfigured. In
connection with this fix, to unify the tunnel port map handling,
odp_port value is used to search the proper port to insert and delete
tunnel map entries as well. This variable can be used instead of
tp_port, as it is unique for all datapath tunnel ports, and there is
no need to reach dst_port from netdev_tunnel_config structure.

This patch also adds a printout to check the reference counter of
a tnl_port structure in tnl-port.c. Extending OVS unit test cases to
have ref_cnt values in the expected dump. Adding new test cases to
check if packet receiving is still working in the case of OF tunnel
port deletion. Adding new test cases to check the reference counter
in case of OF tunnel deletion or reconfiguration.

Signed-off-by: Balazs Nemeth <balazs.nemeth@ericsson.com>
Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
Co-authored-by: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agosystem-stats: Include core number in the process stats.
Bhanuprakash Bodireddy [Wed, 8 Nov 2017 20:49:27 +0000 (20:49 +0000)]
system-stats: Include core number in the process stats.

When dumping process statistics, include the the core number the process
was last scheduled. With 'other_config:enable-statistics=true',

Before:
  {cpu="28", file_systems="/,8474624,7826220 /workspace,223835956,199394160",
  load_average="1.29,1.76,1.33", memory="65861460,27457540,3813488,1999868,0",
  process_ovs-vswitchd="4685896,17452,362920,0,383967,383967",
  process_ovsdb-server="48088,5172,60,0,384057,384057"}

After:
  {cpu="28", file_systems="/,8474624,7826308 /workspace,223835956,199394172",
  load_average="1.30,1.04,1.13", memory="65861460,27469176,3815252,1999868,0",
  process_ovs-vswitchd="4686020,17360,127380,0,148406,148406,3",
  process_ovsdb-server="48096,5212,30,0,148496,148496,4"}

eg:
      process    vsz   , rss , cputime, crashes, booted, uptime, core_id
  ovs-vswitchd="4686020,17360, 127380,      0  , 148406, 148406,  3"

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoprocess: Extend get_process_info() for additional fields.
Bhanuprakash Bodireddy [Wed, 8 Nov 2017 20:49:26 +0000 (20:49 +0000)]
process: Extend get_process_info() for additional fields.

This commit enables the fields relating to process name and the core
number the process was last scheduled. The fields will be used by keepalive
monitoring framework in future commits.

This commit also fixes the following "sparse" warning:

  lib/process.c:439:16: error: use of assignment suppression and length
  modifier together in gnu_scanf format [-Werror=format=].

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoutil: Add high resolution sleep support.
Bhanuprakash Bodireddy [Tue, 28 Nov 2017 22:02:06 +0000 (22:02 +0000)]
util: Add high resolution sleep support.

This commit introduces xnanosleep() for the threads needing high
resolution sleep timeouts.

usleep() that provides microsecond granularity is deprecated and threads
wanting sub-second(ms,us,ns) granularity can use this implementation.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoovn-northd; Treat logical ports of router type as always being up
Jakub Sitnicki [Fri, 29 Sep 2017 15:05:23 +0000 (17:05 +0200)]
ovn-northd; Treat logical ports of router type as always being up

Employ the simplest possible approach to determine the state of logical
ports that connect to logical routers by hardcoding it to always up.
This is intended to be less surprising than the current approach where
router ports appear as being down (with the exception of ones linking to
gateway routers, which are bound).

Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2017-August/045202.html
Signed-off-by: Jakub Sitnicki <jkbs@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Acked-by: Miguel Angel Ajo <majopela@redhat.com>
6 years agoovn-northd: Refactor logic for logical port 'up' state update
Jakub Sitnicki [Fri, 29 Sep 2017 15:05:22 +0000 (17:05 +0200)]
ovn-northd: Refactor logic for logical port 'up' state update

No functional change.  Make it obvious that we determine the logical
port 'up' state by checking for bound chassis, and update the NB DB only
when state has not been set yet or current state is different.

Signed-off-by: Jakub Sitnicki <jkbs@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Acked-by: Miguel Angel Ajo <majopela@redhat.com>
6 years agodatapath-windows: Account for VLAN tag in tunnel Decap
Shashank Ram [Mon, 20 Nov 2017 23:06:14 +0000 (15:06 -0800)]
datapath-windows: Account for VLAN tag in tunnel Decap

Decap functions for tunneling protocols do not compute
the packet header offsets correctly when there is a VLAN
tag in the L2 header. This results in incorrect checksum
computation causing the packet to be dropped.

This patch adds support to account for the VLAN tag in the
packet if its present, and makes use of the OvsExtractLayers()
function to correctly compute the header offsets for different
layers.

Testing done:
- Tested Geneve, STT, Vxlan and Gre and verified that there
  are no regressions.
- Verified that packets with VLAN tags are correctly handled
  in the decap code of all tunneling protocols. Previously,
  this would result in packet drops due to invalid checksums
  being computed.
- Verified that non-VLAN tagged packets are handled correctly.

Signed-off-by: Shashank Ram <rams@vmware.com>
Acked-by: Anand Kumar <kumaranand@vmware.com>
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
6 years agoUpdate mailing list archive pointers to the current server.
Justin Pettit [Mon, 27 Nov 2017 22:19:30 +0000 (14:19 -0800)]
Update mailing list archive pointers to the current server.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agoodp-util: Fix buffer overread in parsing string form of ODP flows.
Ben Pfaff [Mon, 27 Nov 2017 01:34:59 +0000 (17:34 -0800)]
odp-util: Fix buffer overread in parsing string form of ODP flows.

scan_u128() should return 0 on an error but it actually returned an errno
value in some cases, so a command like this:
    ovs-appctl dpctl/add-flow 'ct_label(1/55555555555555555555555555)' ''
could cause a buffer overread.

This bug is not as severe as it may sound because the string form of ODP
flows is not used over OpenFlow or OVSDB, only through the appctl interface
that is normally used just by local system administrators and not exposed
over a network.

Reported-by: Bhargava Shastry <bshastry@sec.t-labs.tu-berlin.de>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Joe Stringer <joe@ovn.org>
6 years agotc: Fix build breakage on GCC 7 by annotating fall-through.
Ben Pfaff [Mon, 27 Nov 2017 00:26:41 +0000 (16:26 -0800)]
tc: Fix build breakage on GCC 7 by annotating fall-through.

Open vSwitch enables the GCC 7+ option that warns about fall-through
switch statements.  This commit fixes newly introduced warnings.

Fixes: d6118e628988 ("netdev-tc-offloads: Verify csum flags on dump from tc")
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Paul Blakey <paulb@mellanox.com>
6 years agoOpenvSwitch logrotate: Use ctl file path as target in ovs-appctl to reset logs
Numan Siddique [Wed, 8 Nov 2017 08:59:07 +0000 (14:29 +0530)]
OpenvSwitch logrotate: Use ctl file path as target in ovs-appctl to reset logs

Presently, logrotate script, searches for the pid files in /var/log/openvswitch
and passes the pid file name (without .pid) as target to ovs-appctl. This approach
doesn't work for OVN DB servers since the ctl files are generated as "ovnnb_db.ctl"
and "ovnsb_db.ctl". So search for the .ctl files instead and use them as target to
ovs-appctl.

Suggested-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
6 years agoovn-ctl: Add -vfile:info option to OVN_NB/SB_LOG options
Numan Siddique [Wed, 8 Nov 2017 08:58:49 +0000 (14:28 +0530)]
ovn-ctl: Add -vfile:info option to OVN_NB/SB_LOG options

In the RHEL environment, when OVN db servers are started using ovn-ctl,
log files are empty. Adding "-vfile:info" option to ovsdb-server is
resolving this issue. Running 'ovs-apptctl -t .. vlog/reopen" results in the
logs appearing in the log files. This issue is seen with 2.7.2.

"-vfile:info" option is passed to ovn-northd and ovn-controller when starting.
There is no harm in adding this to OVN db servers.

Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoRemove Perl dependency.
Ben Pfaff [Wed, 15 Nov 2017 18:24:32 +0000 (10:24 -0800)]
Remove Perl dependency.

Nothing in the OVS tree uses Perl any longer, so remove the dependency.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
6 years agotests: Convert miscellaneous test code from Perl to Python.
Ben Pfaff [Wed, 15 Nov 2017 18:23:39 +0000 (10:23 -0800)]
tests: Convert miscellaneous test code from Perl to Python.

Perl is unfashionable and Python is more widely available and understood,
so this commit converts one of the OVS uses of Perl into Python.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
6 years agotests: Convert dot2pic build tool from Perl to Python.
Ben Pfaff [Mon, 20 Nov 2017 18:05:25 +0000 (10:05 -0800)]
tests: Convert dot2pic build tool from Perl to Python.

Perl is unfashionable and Python is more widely available and understood,
so this commit converts one of the OVS uses of Perl into Python.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
6 years agotests: Convert sodepends build tool from Perl to Python.
Ben Pfaff [Mon, 20 Nov 2017 17:40:45 +0000 (09:40 -0800)]
tests: Convert sodepends build tool from Perl to Python.

Perl is unfashionable and Python is more widely available and understood,
so this commit converts one of the OVS uses of Perl into Python.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
6 years agotests: Convert soexpand build tool from Perl to Python.
Ben Pfaff [Mon, 20 Nov 2017 17:41:42 +0000 (09:41 -0800)]
tests: Convert soexpand build tool from Perl to Python.

Perl is unfashionable and Python is more widely available and understood,
so this commit converts one of the OVS uses of Perl into Python.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
6 years agotests: Convert dpdkstrip utility from Perl to Python.
Ben Pfaff [Wed, 15 Nov 2017 06:58:06 +0000 (22:58 -0800)]
tests: Convert dpdkstrip utility from Perl to Python.

Perl is unfashionable and Python is more widely available and understood,
so this commit converts one of the OVS uses of Perl into Python.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
6 years agotests: Convert flowgen utility from Perl to Python.
Ben Pfaff [Wed, 15 Nov 2017 01:05:43 +0000 (17:05 -0800)]
tests: Convert flowgen utility from Perl to Python.

Perl is unfashionable and Python is more widely available and understood,
so this commit converts one of the OVS uses of Perl into Python.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
6 years agotests: Convert ovsdb-monitor-sort utility from Perl to Python.
Ben Pfaff [Mon, 20 Nov 2017 18:03:18 +0000 (10:03 -0800)]
tests: Convert ovsdb-monitor-sort utility from Perl to Python.

Perl is unfashionable and Python is more widely available and understood,
so this commit converts one of the OVS uses of Perl into Python.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
6 years agotests: Convert uuidfilt utility from Perl to Python.
Ben Pfaff [Mon, 27 Nov 2017 00:07:39 +0000 (16:07 -0800)]
tests: Convert uuidfilt utility from Perl to Python.

Perl is unfashionable and Python is more widely available and understood,
so this commit converts one of the OVS uses of Perl into Python.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
6 years agotc: Send csum action only if we need to update csum
Paul Blakey [Tue, 21 Nov 2017 12:40:42 +0000 (14:40 +0200)]
tc: Send csum action only if we need to update csum

Currently we send the tc csum action even if it's not needed.
Fix that by sending it only if csum update flags isn't zero.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agotc: Fix wrong struct variable order
Paul Blakey [Tue, 21 Nov 2017 12:40:41 +0000 (14:40 +0200)]
tc: Fix wrong struct variable order

Fix the struct variable order to corrospond with
it's usage.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agonetdev-tc-offloads: Remove redundant loop handling ovs action set
Paul Blakey [Tue, 21 Nov 2017 12:40:40 +0000 (14:40 +0200)]
netdev-tc-offloads: Remove redundant loop handling ovs action set

OVS action set always has a single nested OVS_KEY_ATTR_*
so there is no need to iterate it.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agonetdev-tc-offloads: Remove redundant brackets
Paul Blakey [Tue, 21 Nov 2017 12:40:39 +0000 (14:40 +0200)]
netdev-tc-offloads: Remove redundant brackets

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agonetdev-tc-offloads: Verify csum flags on dump from tc
Paul Blakey [Tue, 21 Nov 2017 12:40:38 +0000 (14:40 +0200)]
netdev-tc-offloads: Verify csum flags on dump from tc

On dump, parse and verify the tc csum action update flags
in the same way as we put them.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agonetdev-tc-offloads: Fix accidental skipping of extended pedit keys
Paul Blakey [Tue, 21 Nov 2017 12:40:37 +0000 (14:40 +0200)]
netdev-tc-offloads: Fix accidental skipping of extended pedit keys

We only support extended pedit keys for now, so it's the type we
expect. Skip the legacy ones instead.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agonetdev-tc-offloads: Fix travis compilation error
Paul Blakey [Tue, 21 Nov 2017 12:40:36 +0000 (14:40 +0200)]
netdev-tc-offloads: Fix travis compilation error

Travis complains about variable length array usage, use
a fixed size instead.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agoMerge branch 'dpdk_merge' of https://github.com/istokes/ovs into HEAD
Ben Pfaff [Mon, 20 Nov 2017 16:59:57 +0000 (08:59 -0800)]
Merge branch 'dpdk_merge' of https://github.com/istokes/ovs into HEAD

6 years agoAUHTORS: Add Vishal Deep Ajmera.
Ben Pfaff [Mon, 20 Nov 2017 16:57:24 +0000 (08:57 -0800)]
AUHTORS: Add Vishal Deep Ajmera.

Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoodp-execute: Add missing break statement for CLONE action.
Vishal Deep Ajmera [Thu, 9 Nov 2017 10:15:31 +0000 (10:15 +0000)]
odp-execute: Add missing break statement for CLONE action.

This does not fix any existing bug but it makes the code less hazardous for
future updates.

Signed-off-by: Vishal Deep Ajmera <vishal.deep.ajmera@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev-tc-offloads: update stats properly on flow deletion
Paolo Abeni [Fri, 17 Nov 2017 13:36:22 +0000 (14:36 +0100)]
netdev-tc-offloads: update stats properly on flow deletion

Currently, when an offloaded DP flow is deleted, the related stats
are unconditionally cleared. As a result the counters for the
originating open flow are corrupted.

This change addresses the issue updating the DP stats with the current
values provided by the flower APIs before deleting the tc filter, as
currently done by others DP providers.

Tested vs different OVS H/W offload devices, verifying that the open flow
stats are correct after the expiration of the related, H/W offloaded DP
flow.

Fixes: 30b6b047260b ("netdev-tc-offloads: Implement netdev flow del using tc interface")
CC: Paul Blakey <paulb@mellanox.com>
Reported-by: Kumar Sanghvi <kumaras@chelsio.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agonetdev-dpdk: Fix mempool creation with large MTU.
Ilya Maximets [Fri, 10 Nov 2017 07:12:06 +0000 (10:12 +0300)]
netdev-dpdk: Fix mempool creation with large MTU.

Currently mempool name size limited to 25 characters by
RTE_MEMPOOL_NAMESIZE. netdev-dpdk tries to create mempool with the
following name pattern: "ovs_%{hash}_%{socket}_%{mtu}_%{n_mbuf}".

We have 3 chars for "ovs" + 4 chars for delimiters + 8 chars for
hash (because it's the 32 bit integer printed in hex) + 1 char for
socket_id (mostly 1, but it could be 2 on some systems; larger?) = 16.

Only 25 - 16 = 9 characters remains for mtu + n_mbufs.
Minimum usual value for mtu is 1500 --> 2030 (4 chars) after
dpdk_buf_size conversion and the minimum value for n_mbufs is 16384
(5 chars). So, all the 9 characters are used.

If we'll try to create port with mtu = 9500, mempool creation will
fail, because FRAME_LEN_TO_MTU(dpdk_buf_size(9500)) = 10222 (5 chars)
and this value will overflow the RTE_MEMPOOL_NAMESIZE limit.

Same issue will happen if we'll try to create port with big enough
number of queues or will try to create big enough number of PMD
threads (number of tx queues will enlarge the mempool requirements).

Fix that by removing the delimiters. To keep the readability (at least
partial) of the mempool names exact field sizes with zero padding
are used.

Following limits should be suitable for now:
 - Hash length: 8 chars (uint32_t in hex)
 - Socket ID  : 2 chars (For systems with up to 10 sockets)
 - MTU        : 5 chars (MTU (10^5 - 1) should be enough for now)
 - n_mbufs    : 7 chars (Up to 10^7 of mbufs)

   Total      : 22 + 3 (for "ovs") = 25

CC: Antonio Fischetti <antonio.fischetti@intel.com>
CC: Robert Wojciechowicz <robertx.wojciechowicz@intel.com>
Fixes: f06546a51dd8 ("Fix mempool names to reflect socket id.")
Fixes: d555d9bded5f ("netdev-dpdk: Create separate memory pool for each port.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Antonio Fischetti <antonio.fischetti@intel.com>
Acked-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Tested-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
6 years agodpif-netdev: Rename rxq_interval.
Kevin Traynor [Tue, 7 Nov 2017 17:31:40 +0000 (17:31 +0000)]
dpif-netdev: Rename rxq_interval.

rxq_interval was added before there was other #defines
and code related to rxq intervals.

Rename to rxq_next_cycles_store in order to make it more intuitive.

Requested-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Antonio Fischetti <antonio.fischetti@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
6 years agonetdev-dpdk: Fix calling vhost API with negative vid.
Ilya Maximets [Fri, 6 Oct 2017 10:50:14 +0000 (13:50 +0300)]
netdev-dpdk: Fix calling vhost API with negative vid.

Currently, rx and tx functions for vhost interfaces always obtain
'vid' twice. First time inside 'is_vhost_running' for checking
the value and the second time in enqueue/dequeue function calls to
send/receive packets. But second time we're not checking the
returned value. If vhost device will be destroyed between
checking and enqueue/dequeue, DPDK API will be called with
'-1' instead of valid 'vid'. DPDK API does not validate the 'vid'.
This leads to getting random memory value as a pointer to internal
device structure inside DPDK. Access by this pointer leads to
segmentation fault. For example:

  |00503|dpdk|INFO|VHOST_CONFIG: read message VHOST_USER_GET_VRING_BASE
  [New Thread 0x7fb6754910 (LWP 21246)]

  Program received signal SIGSEGV, Segmentation fault.
  rte_vhost_enqueue_burst at lib/librte_vhost/virtio_net.c:630
  630             if (dev->features & (1 << VIRTIO_NET_F_MRG_RXBUF))
  (gdb) bt full
  #0  rte_vhost_enqueue_burst at lib/librte_vhost/virtio_net.c:630
          dev = 0xffffffff
  #1  __netdev_dpdk_vhost_send at lib/netdev-dpdk.c:1803
          tx_pkts = <optimized out>
          cur_pkts = 0x7f340084f0
          total_pkts = 32
          dropped = 0
          i = <optimized out>
          retries = 0
  ...
  (gdb) p *((struct netdev_dpdk *) netdev)
  $8 = { ... ,
        flags = (NETDEV_UP | NETDEV_PROMISC), ... ,
        vid = {v = -1},
        vhost_reconfigured = false, ... }

Issue can be reproduced by stopping DPDK application (testpmd) inside
guest while heavy traffic flows to this VM.

Fix that by obtaining and checking the 'vid' only once.

CC: Ciara Loftus <ciara.loftus@intel.com>
Fixes: 0a0f39df1d5a ("netdev-dpdk: Add support for DPDK 16.07")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Tested-by: Billy O'Mahony <billy.o.mahony@intel.com>
Acked-by: Billy O'Mahony <billy.o.mahony@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
6 years agonetdev-dpdk: Remove unused MAX_NB_MBUF.
Ilya Maximets [Fri, 10 Nov 2017 15:16:12 +0000 (18:16 +0300)]
netdev-dpdk: Remove unused MAX_NB_MBUF.

MAX_NB_MBUF was used as a default mempool size for almost all ports.
Not used since new per-port mempool allocation introduced.
MIN_NB_MBUF still used as a lower limit.

CC: Robert Wojciechowicz <robertx.wojciechowicz@intel.com>
Fixes: d555d9bded5f ("netdev-dpdk: Create separate memory pool for each port.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Antonio Fischetti <antonio.fischetti@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
6 years agonetdev-dpdk: Factor out struct dpdk_mp.
Ilya Maximets [Fri, 10 Nov 2017 15:16:11 +0000 (18:16 +0300)]
netdev-dpdk: Factor out struct dpdk_mp.

Since commit d555d9bded5f ("netdev-dpdk: Create separate memory pool
for each port."), struct dpdk_mp is redundant because each mempool
can be used by single port only and this port already contains all
the information we store in dpdk_mp.
There is no need to duplicate the information.
Fields of this structure currently used only to generate mempool name.
But it's required only while creation and after that we can use
mp->name directly from the struct rte_mempool.

Let's remove this structure and use struct rte_mempool directly
instead.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Antonio Fischetti <antonio.fischetti@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
6 years agonetdev-dpdk: Fix dpdk_mp leak in case of EEXIST.
Ilya Maximets [Fri, 10 Nov 2017 15:16:10 +0000 (18:16 +0300)]
netdev-dpdk: Fix dpdk_mp leak in case of EEXIST.

In case of EEXIST, 'dpdk_mp_create()' will allocate yet another
'struct dpdk_mp' with same 'mp' pointer inside. We need to free
this structure to avoid the leak.

CC: Robert Wojciechowicz <robertx.wojciechowicz@intel.com>
CC: Antonio Fischetti <antonio.fischetti@intel.com>
Fixes: d555d9bded5f ("netdev-dpdk: Create separate memory pool for each port.")
Fixes: b6b26021d2e2 ("netdev-dpdk: fix management of pre-existing mempools.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Antonio Fischetti <antonio.fischetti@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
6 years agonetdev-dpdk: replace uint8_t with dpdk_port_t
Mark Kavanagh [Fri, 20 Oct 2017 12:37:00 +0000 (13:37 +0100)]
netdev-dpdk: replace uint8_t with dpdk_port_t

netdev_dpdk_detach() declares a 'port_id' variable, of type uint8_t.
This variable should instead be of type dpdk_port_t.

Fixes: bb37956ac ("netdev-dpdk: Use uint8_t for port_id.")
CC: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
6 years agonetdev-tc-offloads: Add support for action set
Paul Blakey [Mon, 18 Sep 2017 04:16:04 +0000 (07:16 +0300)]
netdev-tc-offloads: Add support for action set

Implement support for offloading ovs action set using
tc header rewrite action.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agotc: Add header rewrite using tc pedit action
Paul Blakey [Mon, 18 Sep 2017 04:16:03 +0000 (07:16 +0300)]
tc: Add header rewrite using tc pedit action

To be later used to implement ovs action set offloading.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellacom>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agoodp-util: Expose ovs flow key attr len table for reuse
Paul Blakey [Mon, 18 Sep 2017 04:16:02 +0000 (07:16 +0300)]
odp-util: Expose ovs flow key attr len table for reuse

Make ovs_flow_key_attr_lens() public to be reused by other modules.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agocompat: Add act_pedit compatibility for old kernels
Paul Blakey [Mon, 18 Sep 2017 04:16:01 +0000 (07:16 +0300)]
compat: Add act_pedit compatibility for old kernels

Added compatibility for action pedit.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
6 years agonetdev: Eliminate redundant ifindex mapping.
Ben Pfaff [Tue, 14 Nov 2017 18:15:11 +0000 (10:15 -0800)]
netdev: Eliminate redundant ifindex mapping.

Until now, the code for mapping ODP port number to ifindexes and vice versa
has maintained two completely separate data structures, one for each
direction.  It was possible for the two mappings to become out of sync
with each other since either one could change independently.  This commit
merges them into a single data structure (with two indexes), which at least
means that if one is removed then the other is as well.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: William Tu <u9012063@gmail.com>
6 years agonetdev: Indentation and style fixes.
Ben Pfaff [Tue, 14 Nov 2017 18:15:10 +0000 (10:15 -0800)]
netdev: Indentation and style fixes.

White space changes only.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: William Tu <u9012063@gmail.com>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agoovn.at: Fix MSYS IPv6 interpretation
Alin Gabriel Serdean [Tue, 14 Nov 2017 01:49:44 +0000 (03:49 +0200)]
ovn.at: Fix MSYS IPv6 interpretation

Unfortunately MSYS transforms `0::` into the location of the binaries i.e.:
c:\MinGW\msys\1.0\64.

Currently the test:
`testing ovn -- IPv6 Neighbor Solicitation for unknown MAC`
fails because of the above:
"ovn-nbctl: lrp0_ip6: invalid network address: aef0;c:\MinGW\msys\1.0\64"

This patch uses the full form of the IPv6 address instead of its shorter
notation.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
6 years agonetdev: Change macro to function.
Ben Pfaff [Mon, 13 Nov 2017 20:40:29 +0000 (12:40 -0800)]
netdev: Change macro to function.

There was no reason that this should have been a macro.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
6 years agotests: Try harder to figure out whether IPv6 is supported.
Ben Pfaff [Tue, 14 Nov 2017 00:57:48 +0000 (16:57 -0800)]
tests: Try harder to figure out whether IPv6 is supported.

Until now, the tests have tried to create an IPv6 socket to figure out
whether the system under test supports IPv6.  Recently we've seen test
failures on Travis which appear to be because, although the system supports
IPv6, test programs are not allowed to connect or bind IPv6 addresses.
This commit refines the test for IPv6 to also try to bind the IPv6
localhost address, which should convert the test failures to "skip"s.

Acked-by: William Tu <u9012063@gmail.com>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
Tested-at: https://travis-ci.org/gvrose8192/ovs-experimental
Reported-at: https://github.com/travis-ci/travis-ci/issues/8711
Signed-off-by: Ben Pfaff <blp@ovn.org>
6 years agoinstaller-windows: Add x64 installer build via command line
Alin Gabriel Serdean [Mon, 6 Nov 2017 10:12:03 +0000 (12:12 +0200)]
installer-windows: Add x64 installer build via command line

Add a new variable to know on which platform we are compiling.

Make the msbuild command to be aware of the platform we want to build.

Shorter the msbuild parameters from `property:`->`p:`. Change slashes
to double slashes so msys does not get confused.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
6 years agoinstaller-windows: Modify installer so it can be compiled on x64
Alin Gabriel Serdean [Mon, 6 Nov 2017 10:12:02 +0000 (12:12 +0200)]
installer-windows: Modify installer so it can be compiled on x64

Add variables to know for which platform we are building.

They are needed for the installer to know if it should install
in `Program Files (x86)` or `Program Files` and which registry
it needs to update.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
6 years agoinstaller-windows: Call WIX binaries outside of MSBuild on x64
Alin Gabriel Serdean [Mon, 6 Nov 2017 10:12:01 +0000 (12:12 +0200)]
installer-windows: Call WIX binaries outside of MSBuild on x64

Unfortunately all WIX binaries (candle, heat, etc) are only 32 bit (up to
the latest version 3.11).

For performance reasons they are run as .NET assemblies inside the MSBuild
process. Running 32 bit assemblies inside a 64 bit process (MSBuild) makes
them segfault.

Add a new option for heat to be run as an individual process when the
platform is not x86.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
6 years agoinstaller-windows: Resolve WIX solution build type
Alin Gabriel Serdean [Mon, 6 Nov 2017 10:12:00 +0000 (12:12 +0200)]
installer-windows: Resolve WIX solution build type

Until now the x64 build of the installer solution was pointing to the
x86 build of the WIX project.

This patch changes for them to match.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>
6 years agoinstaller-windows: Remove unused entries from WIX project
Alin Gabriel Serdean [Mon, 6 Nov 2017 10:11:59 +0000 (12:11 +0200)]
installer-windows: Remove unused entries from WIX project

Remove duplicate and obsolete entries from the installer WIX project.

Found by inspection.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>