cascardo/ovs.git
8 years agoofproto-dpif-xlate: Remove obsolete special case.
Jarno Rajahalme [Sat, 30 Jan 2016 01:28:08 +0000 (17:28 -0800)]
ofproto-dpif-xlate: Remove obsolete special case.

Bond recirculation used to insert a special rule that jumped from the
internal table to table 0 using GOTO_TABLE.  Since the introduction of
the ofproto-dpif-rid this has not been necessary any more, so we can
remove the special case that allowed GOTO_TABLE to go backwards in
that case.

Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
8 years agobuild: Fix for rename of MAINTAINERS file.
Russell Bryant [Sat, 30 Jan 2016 00:50:07 +0000 (19:50 -0500)]
build: Fix for rename of MAINTAINERS file.

I renamed MAINTAINERS to MAINTAINERS.md, but forgot to update
Makefile.am to reflect the new name.

Signed-off-by: Russell Bryant <russell@ovn.org>
8 years agoovs-thread: Fix missing space.
William Tu [Fri, 29 Jan 2016 23:27:55 +0000 (15:27 -0800)]
ovs-thread: Fix missing space.

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Justin Pettit <jpettit@ovn.org>
8 years agocommitter-grant-revocation.md: Fix link and clarify location.
Justin Pettit [Fri, 29 Jan 2016 11:32:12 +0000 (03:32 -0800)]
committer-grant-revocation.md: Fix link and clarify location.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agodatapath: inet: frag: Always orphan skbs inside ip_defrag().
Joe Stringer [Fri, 29 Jan 2016 19:01:56 +0000 (11:01 -0800)]
datapath: inet: frag: Always orphan skbs inside ip_defrag().

When the linux stack is an endpoint connected to OVS which is performing
IP fragmentation via conntrack actions, it's possible to hit a kernel
BUG. The following upstream commit fixes the issue inside ip_defrag().
For the backport, we provide this inside ip_defrag() for kernels that we
currently backport that function, and also provide just the bugfix for
newer kernels, so we can continue to use upstream functionality as much
as possible.

Upstream commit:
    Later parts of the stack (including fragmentation) expect that there is
    never a socket attached to frag in a frag_list, however this invariant
    was not enforced on all defrag paths. This could lead to the
    BUG_ON(skb->sk) during ip_do_fragment(), as per the call stack at the
    end of this commit message.

    While the call could be added to openvswitch to fix this particular
    error, the head and tail of the frags list are already orphaned
    indirectly inside ip_defrag(), so it seems like the remaining fragments
    should all be orphaned in all circumstances.

    kernel BUG at net/ipv4/ip_output.c:586!
    [...]
    Call Trace:
     <IRQ>
     [<ffffffffa0205270>] ? do_output.isra.29+0x1b0/0x1b0 [openvswitch]
     [<ffffffffa02167a7>] ovs_fragment+0xcc/0x214 [openvswitch]
     [<ffffffff81667830>] ? dst_discard_out+0x20/0x20
     [<ffffffff81667810>] ? dst_ifdown+0x80/0x80
     [<ffffffffa0212072>] ? find_bucket.isra.2+0x62/0x70 [openvswitch]
     [<ffffffff810e0ba5>] ? mod_timer_pending+0x65/0x210
     [<ffffffff810b732b>] ? __lock_acquire+0x3db/0x1b90
     [<ffffffffa03205a2>] ? nf_conntrack_in+0x252/0x500 [nf_conntrack]
     [<ffffffff810b63c4>] ? __lock_is_held+0x54/0x70
     [<ffffffffa02051a3>] do_output.isra.29+0xe3/0x1b0 [openvswitch]
     [<ffffffffa0206411>] do_execute_actions+0xe11/0x11f0 [openvswitch]
     [<ffffffff810b63c4>] ? __lock_is_held+0x54/0x70
     [<ffffffffa0206822>] ovs_execute_actions+0x32/0xd0 [openvswitch]
     [<ffffffffa020b505>] ovs_dp_process_packet+0x85/0x140 [openvswitch]
     [<ffffffff810b63c4>] ? __lock_is_held+0x54/0x70
     [<ffffffffa02068a2>] ovs_execute_actions+0xb2/0xd0 [openvswitch]
     [<ffffffffa020b505>] ovs_dp_process_packet+0x85/0x140 [openvswitch]
     [<ffffffffa0215019>] ? ovs_ct_get_labels+0x49/0x80 [openvswitch]
     [<ffffffffa0213a1d>] ovs_vport_receive+0x5d/0xa0 [openvswitch]
     [<ffffffff810b732b>] ? __lock_acquire+0x3db/0x1b90
     [<ffffffff810b732b>] ? __lock_acquire+0x3db/0x1b90
     [<ffffffff810b732b>] ? __lock_acquire+0x3db/0x1b90
     [<ffffffffa0214895>] ? internal_dev_xmit+0x5/0x140 [openvswitch]
     [<ffffffffa02148fc>] internal_dev_xmit+0x6c/0x140 [openvswitch]
     [<ffffffffa0214895>] ? internal_dev_xmit+0x5/0x140 [openvswitch]
     [<ffffffff81660299>] dev_hard_start_xmit+0x2b9/0x5e0
     [<ffffffff8165fc21>] ? netif_skb_features+0xd1/0x1f0
     [<ffffffff81660f20>] __dev_queue_xmit+0x800/0x930
     [<ffffffff81660770>] ? __dev_queue_xmit+0x50/0x930
     [<ffffffff810b53f1>] ? mark_held_locks+0x71/0x90
     [<ffffffff81669876>] ? neigh_resolve_output+0x106/0x220
     [<ffffffff81661060>] dev_queue_xmit+0x10/0x20
     [<ffffffff816698e8>] neigh_resolve_output+0x178/0x220
     [<ffffffff816a8e6f>] ? ip_finish_output2+0x1ff/0x590
     [<ffffffff816a8e6f>] ip_finish_output2+0x1ff/0x590
     [<ffffffff816a8cee>] ? ip_finish_output2+0x7e/0x590
     [<ffffffff816a9a31>] ip_do_fragment+0x831/0x8a0
     [<ffffffff816a8c70>] ? ip_copy_metadata+0x1b0/0x1b0
     [<ffffffff816a9ae3>] ip_fragment.constprop.49+0x43/0x80
     [<ffffffff816a9c9c>] ip_finish_output+0x17c/0x340
     [<ffffffff8169a6f4>] ? nf_hook_slow+0xe4/0x190
     [<ffffffff816ab4c0>] ip_output+0x70/0x110
     [<ffffffff816a9b20>] ? ip_fragment.constprop.49+0x80/0x80
     [<ffffffff816aa9f9>] ip_local_out+0x39/0x70
     [<ffffffff816abf89>] ip_send_skb+0x19/0x40
     [<ffffffff816abfe3>] ip_push_pending_frames+0x33/0x40
     [<ffffffff816df21a>] icmp_push_reply+0xea/0x120
     [<ffffffff816df93d>] icmp_reply.constprop.23+0x1ed/0x230
     [<ffffffff816df9ce>] icmp_echo.part.21+0x4e/0x50
     [<ffffffff810b63c4>] ? __lock_is_held+0x54/0x70
     [<ffffffff810d5f9e>] ? rcu_read_lock_held+0x5e/0x70
     [<ffffffff816dfa06>] icmp_echo+0x36/0x70
     [<ffffffff816e0d11>] icmp_rcv+0x271/0x450
     [<ffffffff816a4ca7>] ip_local_deliver_finish+0x127/0x3a0
     [<ffffffff816a4bc1>] ? ip_local_deliver_finish+0x41/0x3a0
     [<ffffffff816a5160>] ip_local_deliver+0x60/0xd0
     [<ffffffff816a4b80>] ? ip_rcv_finish+0x560/0x560
     [<ffffffff816a46fd>] ip_rcv_finish+0xdd/0x560
     [<ffffffff816a5453>] ip_rcv+0x283/0x3e0
     [<ffffffff810b6302>] ? match_held_lock+0x192/0x200
     [<ffffffff816a4620>] ? inet_del_offload+0x40/0x40
     [<ffffffff8165d062>] __netif_receive_skb_core+0x392/0xae0
     [<ffffffff8165e68e>] ? process_backlog+0x8e/0x230
     [<ffffffff810b53f1>] ? mark_held_locks+0x71/0x90
     [<ffffffff8165d7c8>] __netif_receive_skb+0x18/0x60
     [<ffffffff8165e678>] process_backlog+0x78/0x230
     [<ffffffff8165e6dd>] ? process_backlog+0xdd/0x230
     [<ffffffff8165e355>] net_rx_action+0x155/0x400
     [<ffffffff8106b48c>] __do_softirq+0xcc/0x420
     [<ffffffff816a8e87>] ? ip_finish_output2+0x217/0x590
     [<ffffffff8178e78c>] do_softirq_own_stack+0x1c/0x30
     <EOI>
     [<ffffffff8106b88e>] do_softirq+0x4e/0x60
     [<ffffffff8106b948>] __local_bh_enable_ip+0xa8/0xb0
     [<ffffffff816a8eb0>] ip_finish_output2+0x240/0x590
     [<ffffffff816a9a31>] ? ip_do_fragment+0x831/0x8a0
     [<ffffffff816a9a31>] ip_do_fragment+0x831/0x8a0
     [<ffffffff816a8c70>] ? ip_copy_metadata+0x1b0/0x1b0
     [<ffffffff816a9ae3>] ip_fragment.constprop.49+0x43/0x80
     [<ffffffff816a9c9c>] ip_finish_output+0x17c/0x340
     [<ffffffff8169a6f4>] ? nf_hook_slow+0xe4/0x190
     [<ffffffff816ab4c0>] ip_output+0x70/0x110
     [<ffffffff816a9b20>] ? ip_fragment.constprop.49+0x80/0x80
     [<ffffffff816aa9f9>] ip_local_out+0x39/0x70
     [<ffffffff816abf89>] ip_send_skb+0x19/0x40
     [<ffffffff816abfe3>] ip_push_pending_frames+0x33/0x40
     [<ffffffff816d55d3>] raw_sendmsg+0x7d3/0xc30
     [<ffffffff810b732b>] ? __lock_acquire+0x3db/0x1b90
     [<ffffffff816e7557>] ? inet_sendmsg+0xc7/0x1d0
     [<ffffffff810b63c4>] ? __lock_is_held+0x54/0x70
     [<ffffffff816e759a>] inet_sendmsg+0x10a/0x1d0
     [<ffffffff816e7495>] ? inet_sendmsg+0x5/0x1d0
     [<ffffffff8163e398>] sock_sendmsg+0x38/0x50
     [<ffffffff8163ec5f>] ___sys_sendmsg+0x25f/0x270
     [<ffffffff811aadad>] ? handle_mm_fault+0x8dd/0x1320
     [<ffffffff8178c147>] ? _raw_spin_unlock+0x27/0x40
     [<ffffffff810529b2>] ? __do_page_fault+0x1e2/0x460
     [<ffffffff81204886>] ? __fget_light+0x66/0x90
     [<ffffffff8163f8e2>] __sys_sendmsg+0x42/0x80
     [<ffffffff8163f932>] SyS_sendmsg+0x12/0x20
     [<ffffffff8178cb17>] entry_SYSCALL_64_fastpath+0x12/0x6f
    Code: 00 00 44 89 e0 e9 7c fb ff ff 4c 89 ff e8 e7 e7 ff ff 41 8b 9d 80 00 00 00 2b 5d d4 89 d8 c1 f8 03 0f b7 c0 e9 33 ff ff f
     66 66 66 2e 0f 1f 84 00 00 00 00 00 66 66 66 66 90 55 48
    RIP  [<ffffffff816a9a92>] ip_do_fragment+0x892/0x8a0
     RSP <ffff88006d603170>

    Fixes: 7f8a436eaa2c ("openvswitch: Add conntrack action")
Signed-off-by: Joe Stringer <joe@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: 8282f27449bf ("inet: frag: Always orphan skbs inside ip_defrag()")
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agoMAINTAINERS: convert to .md format.
Russell Bryant [Fri, 29 Jan 2016 21:32:36 +0000 (16:32 -0500)]
MAINTAINERS: convert to .md format.

Most other doc files are in markdown format, so convert this one as
well.  Instead of linking to the web site, just use relative links
to the policy documents in the tree.

This patch also gives me a chance to hide a fix for my failure to
accurately sort names in alphabetical order.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
8 years agorhel: Clarify instructions for RHEL 7.
Russell Bryant [Thu, 28 Jan 2016 16:42:27 +0000 (11:42 -0500)]
rhel: Clarify instructions for RHEL 7.

The rpm build instructions did not clarify what spec files were to be
used for RHEL 7 and its derivatives.  Clarify that you're actually
supposed to use the spec files called "fedora" for RHEL 7 right now.

Update references to Fedora versions to reflect the current release
(23), as neither 16 or 17 are supported releases anymore.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Gurucharan Shetty <guru@ovn.org>
8 years agoDocumentation: Change committer files to ".md" format.
Justin Pettit [Fri, 29 Jan 2016 08:31:41 +0000 (00:31 -0800)]
Documentation: Change committer files to ".md" format.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agoDocumentation: Clarify committer documentation.
Justin Pettit [Fri, 29 Jan 2016 09:07:39 +0000 (01:07 -0800)]
Documentation: Clarify committer documentation.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agoDocumentation: Add information about committer policies.
Justin Pettit [Fri, 29 Jan 2016 08:09:27 +0000 (00:09 -0800)]
Documentation: Add information about committer policies.

These files were only available on the openvswitch.org mailing list.
Move them to the source tree so that they're more visible.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agorhel: Make openvswitch-kmod-fedora.spec build.
Russell Bryant [Thu, 28 Jan 2016 20:23:00 +0000 (15:23 -0500)]
rhel: Make openvswitch-kmod-fedora.spec build.

I tried building this package on Fedora 23 and it failed for a couple of
different reasons.

This package tried to install modules without specifying the rpm build
root as an install prefix.  The result was just attempting to install
the modules on the system, which luckily failed since I wasn't running
rpmbuild as root.

The package also then tried to manually install the modules into the rpm
build root, which is unnecessary once modules_install is pointed to the
right place.

Finally, the package build failed with a completely unhelpful error
which turned out to be because it didn't know how to generate
a debuginfo pacakge.  I turned off the debug package for now.  At least
it builds now, which is an improvement.

Signed-off-by: Russell Bryant <russell@ovn.org>
Suggested-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Gurucharan Shetty <guru@ovn.org>
8 years agodatapath: Fix IPv6 fragment expiry crash.
Joe Stringer [Wed, 27 Jan 2016 00:49:36 +0000 (00:49 +0000)]
datapath: Fix IPv6 fragment expiry crash.

Prior to a series of commits in 3.17 like the following, the model
used to manage and expire fragments was different. We already backport
several of these functions (See datapath/compat/inet_fragment.c) to do
things like allocate/evict/destroy frags and frag queues. In the IPv4
code, we use these. In most of the IPv6 cases, we already reuse these
also. However, for timed frag expiration we instead call the upstream
version of the function, which proceeds to use the upstream versions
of the functions we backport in inet_fragment.c. There can be some
discrepancy between the offsets used in these upstream versions vs. the
backport versions, so if you mix/match them then it leads to invalid
dereferences.

b13d3cbfb8e8 ("inet: frag: move eviction of queues to work queue")
ab1c724f6330 ("inet: frag: use seqlock for hash rebuild")

Fixes the following kernel oops on kernels < 3.17 when IPv6 fragments
are expired without reassembling the frame.

BUG: unable to handle kernel paging request at 00000006845d69a8
IP: [<ffffffff8172c09e>] _raw_spin_lock+0xe/0x50
...
Call Trace:
 <IRQ>
 [<ffffffff816a32d3>] inet_frag_kill+0x63/0x100
 [<ffffffff816ead93>] ip6_expire_frag_queue+0x63/0x110
 [<ffffffffa01130e6>] nf_ct_frag6_expire+0x26/0x30 [openvswitch]
 [<ffffffff810744f6>] call_timer_fn+0x36/0x100
 [<ffffffffa01130c0>] ? nf_ct_net_init+0x20/0x20 [openvswitch]
 [<ffffffff8107548f>] run_timer_softirq+0x1ef/0x2f0
 [<ffffffff8106cccc>] __do_softirq+0xec/0x2c0
 [<ffffffff8106d215>] irq_exit+0x105/0x110
 [<ffffffff81737095>] smp_apic_timer_interrupt+0x45/0x60
 [<ffffffff81735a1d>] apic_timer_interrupt+0x6d/0x80
 <EOI>
 [<ffffffff8104f596>] ? native_safe_halt+0x6/0x10
 [<ffffffff8101cb2f>] default_idle+0x1f/0xc0
 [<ffffffff8101d406>] arch_cpu_idle+0x26/0x30
 [<ffffffff810bf3a5>] cpu_startup_entry+0xc5/0x290
 [<ffffffff817122e7>] rest_init+0x77/0x80
 [<ffffffff81d34f70>] start_kernel+0x438/0x443

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agoovn: Remove top ovn directory from PATHs.
Ilya Maximets [Fri, 29 Jan 2016 09:20:13 +0000 (12:20 +0300)]
ovn: Remove top ovn directory from PATHs.

Since 5b5c922b0ca6 ("ovn-nbctl: Move ovn-nbctl to utilities directory.")
there is no more executables in top ovn directory.

Removing of this directory from PATHs helps to avoid problems when
old executable ./ovn/ovn-nbctl used instead of ./ovn/utilities/ovn-nbctl.

This may happen if source directory was updated to commit 5b5c922b0ca6
without calling 'make clean'.

Fixes: 5b5c922b0ca6 ("ovn-nbctl: Move ovn-nbctl to utilities directory.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
8 years agoMAINTAINERS: Add Simon Horman.
Justin Pettit [Fri, 29 Jan 2016 10:16:01 +0000 (02:16 -0800)]
MAINTAINERS: Add Simon Horman.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agodatapath: test for netlink_set_err returning void
Simon Horman [Fri, 27 Nov 2015 06:07:23 +0000 (22:07 -0800)]
datapath: test for netlink_set_err returning void

In v2.6.33 netlink_set_err returns void. However, 1a50307ba182 ("netlink:
fix NETLINK_RECV_NO_ENOBUFS in netlink_set_err()") was backported and
included in v2.6.33.2 and in that and subsequent v2.6.33 stable releases
netlink_set_err returns an int.

It seems plausible that there are other backports floating around. So check
for netlink_set_err returning void rather than including compatibility code
based on the version of the kernel.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agovtep: make vtep-ctl support L3 tables.
Wenyu Zhang [Tue, 26 Jan 2016 10:34:59 +0000 (02:34 -0800)]
vtep: make vtep-ctl support L3 tables.

Add supporting for tables necessary for L3 usage:
Logical_Router
Arp_Sources_Local
Arp_Sources_Remote

Signed-off-by: Wenyu Zhang <wenyuz@vmware.com>
Acked-by: Shuangmin Zhang <tsingzsm@gmail.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
8 years agonetdev-dpdk: Add vhost-user multiqueue support
Flavio Leitner [Tue, 26 Jan 2016 18:58:14 +0000 (16:58 -0200)]
netdev-dpdk: Add vhost-user multiqueue support

Most of the network cards today supports multiple receive
and transmit queues (MQ).  The core idea is that on packet
reception, a NIC can send different packets to different
queues to distribute processing among CPUs running in parallel.
The packet distribution is based on a result of a filter applied
on each packet headers. The filter should keep all packets from
the same flow on the same queue to avoid re-ordering while
distributing different flows among all available queues.

This is how the packet moves in a typical vhost-user use-case:

NIC             OVS
DPDK port ==== bridge --- vhost-user ==== qemu ==== virtio eth0

The DPDK ports, OVS bridges, virtio network driver and
recently QEMU (vhost-user) supports MQ.  This patch adds MQ
support to OVS that leverages DPDK vhost library to implement
vhost-user interfaces.

Signed-off-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Kevin Traynor <kevin.traynor@intel.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agoofp-actions: Add more detail when formatting unroll_xlate pseudo-action.
Ben Pfaff [Sat, 23 Jan 2016 00:40:28 +0000 (16:40 -0800)]
ofp-actions: Add more detail when formatting unroll_xlate pseudo-action.

This is helpful for debugging recirculation.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agotests: Avoid useless use of cat.
Ben Pfaff [Thu, 28 Jan 2016 21:22:03 +0000 (13:22 -0800)]
tests: Avoid useless use of cat.

Commands like "cat file | a" can be rewritten more cheaply as "a < file".

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agotests: Fix race in "ofproto-dpif - ofproto-dpif-monitor 1" test.
Ben Pfaff [Thu, 28 Jan 2016 21:25:50 +0000 (13:25 -0800)]
tests: Fix race in "ofproto-dpif - ofproto-dpif-monitor 1" test.

This test contained two commands that both read and overwrote
ovs-vswitchd.log, and then expected the running ovs-vswitchd to carry on
appending to it.   Depending on the shell implementation and the speed of
execution, and the libc implementation, this might not have the desired
effect.  This commit replaces this by a multi-step process that avoids
in-place replacement.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agotests: Convert dpif-netdev macros to shell functions.
Ben Pfaff [Fri, 22 Jan 2016 21:42:10 +0000 (13:42 -0800)]
tests: Convert dpif-netdev macros to shell functions.

There's no need for these to be macros; shell functions are conceptually
cleaner and make the generated testsuite smaller.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofproto-macros: Remove STRIP_DURATION macro.
Ben Pfaff [Fri, 22 Jan 2016 20:53:13 +0000 (12:53 -0800)]
ofproto-macros: Remove STRIP_DURATION macro.

It was unused.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofproto-macros: Change STRIP_USED and STRIP_UID to shell functions.
Ben Pfaff [Fri, 22 Jan 2016 21:09:23 +0000 (13:09 -0800)]
ofproto-macros: Change STRIP_USED and STRIP_UID to shell functions.

There's no need for these to be macros; shell functions are conceptually
cleaner and make the generated testsuite smaller.

Also remove conflicting definition of STRIP_USED from rstp.at.  It wasn't
actually used anywhere in that file.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofproto-macros: Change STRIP_XIDS from macro to shell function.
Ben Pfaff [Fri, 22 Jan 2016 20:52:26 +0000 (12:52 -0800)]
ofproto-macros: Change STRIP_XIDS from macro to shell function.

There's no need for this to be a macro; shell functions are conceptually
cleaner and make the generated testsuite smaller.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agotests: Change ADD_OF_PORTS from macro to shell function.
Ben Pfaff [Wed, 27 Jan 2016 00:23:30 +0000 (16:23 -0800)]
tests: Change ADD_OF_PORTS from macro to shell function.

This reduces the size of the generated testsuite and makes it possible
to pass arguments that vary at runtime instead of at the time of
translation from .at to shell script.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoAdd MAINTAINERS file.
Russell Bryant [Wed, 27 Jan 2016 20:10:08 +0000 (15:10 -0500)]
Add MAINTAINERS file.

Previously, the list of committers was not written down publicly.  There
was no reason for this other than it not being trivial to expose the
commiter group membership via github.  This MAINTAINERS file lists the
members of the OVS committers group.

There's some outdated email addresses in here, but I just copied what
was currently in AUTHORS.  This can be fixed when AUTHORS gets fixed,
too.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agodpif-netdev: Reduce code duplication
Andy Zhou [Tue, 26 Jan 2016 02:51:11 +0000 (18:51 -0800)]
dpif-netdev: Reduce code duplication

Code clean up to reduce code duplication.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agodpif-netdev: drop swapping
Andy Zhou [Tue, 26 Jan 2016 02:48:19 +0000 (18:48 -0800)]
dpif-netdev: drop swapping

emc_processing() moves all the missed packets towards the beginning of
packet array; matched packets are queued up into flow queues. Since the
remaining of the packet array is not used anymore, don't bother swap
packet pointers to save cycles and simplify logic.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agodpif-netdev: properly maintain exact match cache hit counter
Andy Zhou [Tue, 26 Jan 2016 02:43:47 +0000 (18:43 -0800)]
dpif-netdev: properly maintain exact match cache hit counter

Current logic counts dropped packet as cache hit which is not
correct. This patch removes dropped packet to improve accuracy.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agoofproto-dpif-xlate: Do not execute resubmit again after recirculation.
Ben Pfaff [Wed, 27 Jan 2016 17:14:18 +0000 (09:14 -0800)]
ofproto-dpif-xlate: Do not execute resubmit again after recirculation.

Consider the following flow table:

    table=0 actions=resubmit(,1),2
    table=1 actions=debug_recirc

When debug_recirc triggers recirculation and we later resume processing,
only the output to port 2 should be executed, because the effects of
"resubmit" have already taken place.  However, until now, the "resubmit"
was added to the actions to execute post-recirculation, resulting in an
infinite loop.

Now consider this flow table (as seen in the "MPLS handling" test in
ofproto-dpif.at):

    table=0 actions=pop_mpls(0x0806),resubmit(,1)
    table=1 ip,nw_dst=1.2.3.4 actions=controller

Here, we do want to add the "resubmit" to the actions to execute
post-recirculation, since the "resubmit" cannot be processed until after
recirculation makes the nw_dst field available.

This commit fixes the problem in both cases.

Found when testing a feature based on recirculation.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoREADME.ovs-vtep.md: Fix incorrect spacing.
Kyle Mestery [Wed, 27 Jan 2016 23:55:28 +0000 (17:55 -0600)]
README.ovs-vtep.md: Fix incorrect spacing.

This fixes a simple formatting issue with this file I noticed while reviewing
the example of experimenting with the OVS HW-VTEP simulator.

Signed-off-by: Kyle Mestery <mestery@mestery.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoNEWS: DPDK 2.2 is now required.
Flavio Leitner [Wed, 27 Jan 2016 16:18:09 +0000 (14:18 -0200)]
NEWS: DPDK 2.2 is now required.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agotests: Fix unbalanced parentheses that caused build break in testcase.
William Tu [Wed, 27 Jan 2016 06:21:15 +0000 (22:21 -0800)]
tests: Fix unbalanced parentheses that caused build break in testcase.

The current build fails at this test case:
/usr/bin/m4:tests/ovs-vswitchd.at:171: recursion limit of 1024 exceeded,
use -L<N> to change it
autom4te: /usr/bin/m4 failed with exit status: 1

Observed on Centos 6.5 with m4 version 1.4.13.

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agodpif-netdev: Unique and sequential tx_qids.
Ilya Maximets [Tue, 26 Jan 2016 06:12:34 +0000 (09:12 +0300)]
dpif-netdev: Unique and sequential tx_qids.

Currently tx_qid is equal to pmd->core_id. This leads to unexpected
behavior if pmd-cpu-mask different from '/(0*)(1|3|7)?(f*)/',
e.g. if core_ids are not sequential, or doesn't start from 0, or both.

Example:
starting 2 pmd threads with 1 port, 2 rxqs per port,
pmd-cpu-mask = 00000014 and let dev->real_n_txq = 2

It that case pmd_1->tx_qid = 2, pmd_2->tx_qid = 4 and
txq_needs_locking = true (if device hasn't ovs_numa_get_n_cores()+1
queues).

In that case, after truncating in netdev_dpdk_send__():
'qid = qid % dev->real_n_txq;'
pmd_1: qid = 2 % 2 = 0
pmd_2: qid = 4 % 2 = 0

So, both threads will call dpdk_queue_pkts() with same qid = 0.
This is unexpected behavior if there is 2 tx queues in device.
Queue #1 will not be used and both threads will lock queue #0
on each send.

Fix that by using sequential tx_qids.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agodpif-netdev: Rework of rx queue management.
Ilya Maximets [Tue, 26 Jan 2016 06:12:33 +0000 (09:12 +0300)]
dpif-netdev: Rework of rx queue management.

Current rx queue management model is buggy and will not work properly
without additional barriers and other syncronization between PMD
threads and main thread.

Known BUGS of current model:
* While reloading, two PMD threads, one already reloaded and
  one not yet reloaded, can poll same queue of the same port.
  This behavior may lead to dpdk driver failure, because they
  are not thread-safe.
* Same bug as fixed in commit e4e74c3a2b
  ("dpif-netdev: Purge all ukeys when reconfigure pmd.") but
  reproduced while only reconfiguring of pmd threads without
  restarting, because addition may change the sequence of
  other ports, which is important in time of reconfiguration.

Introducing the new model, where distribution of queues made by main
thread with minimal synchronizations and without data races between
pmd threads. Also, this model should work faster, because only
needed threads will be interrupted for reconfiguraition and total
computational complexity of reconfiguration is less.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agoUpdate relevant artifacts to add support for DPDK v2.2.0.
mweglicx [Wed, 23 Dec 2015 10:20:22 +0000 (10:20 +0000)]
Update relevant artifacts to add support for DPDK v2.2.0.

Following changes have been applied:
 - INSTALL.DPDK.md: change DPDK version number,
 - build.sh: change DPDK version number.

Signed-off-by: Michal Weglicki <michalx.weglicki@intel.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agoFAQ: Explain hash function for select groups.
Ben Pfaff [Mon, 25 Jan 2016 16:40:39 +0000 (08:40 -0800)]
FAQ: Explain hash function for select groups.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agosystem-traffic: use appropriate nc options for installed version
Lance Richardson [Fri, 22 Jan 2016 15:12:29 +0000 (10:12 -0500)]
system-traffic: use appropriate nc options for installed version

Test cases using netcat ("ICMP related" and "ICMP related with NAT")
currently fail on systems using the nmap version of nc because this
version does not support the -q command-line option.

Fix this by detecting which version of netcat is is in use and
using the "--send-only" command-line option when the nmap flavor
is detected, and using "-q 1" otherwise (openbsd and traditional
versions).

Tested via "make check-kernel" on RHEL7 (nmap version of nc),
Debian 8.2 (openbsd version of nc), and Ubuntu 14.04 ("traditional" nc).

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
8 years agoRevert "system-traffic: Remove netcat from ICMP test."
Lance Richardson [Fri, 22 Jan 2016 15:12:28 +0000 (10:12 -0500)]
Revert "system-traffic: Remove netcat from ICMP test."

Revert previous workaround for netcat portability issue.

This reverts commit dc55e9465511dee6c12dbf0edb4ce2d9af57cb15.

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
8 years agoofproto-dpif-xlate: Fix recirculation for resubmit to current table.
Ben Pfaff [Fri, 22 Jan 2016 23:58:55 +0000 (15:58 -0800)]
ofproto-dpif-xlate: Fix recirculation for resubmit to current table.

When recirculation defers actions for processing later, it decides
based on the actions being saved whether it needs to record the table
and cookie from which they originated.  Until now, it was thought that
this was only important for actions that send packets to the controller
(because those actions send the table ID and cookie).  This overlooked
a special case of the "resubmit" action which also depends on the
current table ID, which meant that this special case malfunctioned if
it came after recirculation.  This commit fixes the problem, and adds
a test.

Found while testing another feature under development.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoovs-rcu: Improve comments on ovsrcu_postpone().
Ben Pfaff [Sun, 24 Jan 2016 01:17:19 +0000 (17:17 -0800)]
ovs-rcu: Improve comments on ovsrcu_postpone().

Suggested-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agopython: Remove old style classes.
Russell Bryant [Wed, 6 Jan 2016 20:23:08 +0000 (15:23 -0500)]
python: Remove old style classes.

Python 3 removed support for "old-style classes".  Classes should always
inherit from object to get consistent behavior between Python 2 and 3.

Enable a flake8 warning to help prevent regressions in the future.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agopython: Convert dict iterators.
Russell Bryant [Mon, 14 Dec 2015 20:13:20 +0000 (15:13 -0500)]
python: Convert dict iterators.

In Python 2, dict.items(), dict.keys(), and dict.values() returned a
list.  dict.iteritems(), dict.iterkeys(), and dict.itervalues() returned
an iterator.

As of Python 3, dict.iteritems(), dict.itervalues(), and dict.iterkeys()
are gone.  items(), keys(), and values() now return an iterator.

In the case where we want an iterator, we now use the six.iter*()
helpers.  If we want a list, we explicitly create a list from the
iterator.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agogitignore: Ignore flake8-check.
Ben Pfaff [Thu, 21 Jan 2016 23:32:36 +0000 (15:32 -0800)]
gitignore: Ignore flake8-check.

This is generated at build time and should not be part of the repo.

Fixes: 115d8719dbfda (python: Run flake8 at build time.)
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agoofproto-dpif-xlate: Put recirc_state, not recirc_id_node, in xlate_in.
Ben Pfaff [Thu, 21 Jan 2016 00:53:01 +0000 (16:53 -0800)]
ofproto-dpif-xlate: Put recirc_state, not recirc_id_node, in xlate_in.

This will make it possible, in an upcoming commit, to construct a
recirc_state locally on the stack to pass to xlate_actions().  It would
also be possible to construct and pass a recirc_id_node on the stack, but
the translation process only uses the recirc_state anyway.  The alternative
here of having upcall_xlate() know that it can recover the recirc_id_node
from the recirc_state isn't great either; it's debatable which is the
better approach.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agotravis: Install six Python library.
Russell Bryant [Thu, 21 Jan 2016 19:07:50 +0000 (14:07 -0500)]
travis: Install six Python library.

The travis-ci build is broken because the Python six library is not
installed.

Signed-off-by: Russell Bryant <russell@ovn.org>
Tested-by: Joe Stringer <joe@ovn.org>
Acked-by: Joe Stringer <joe@ovn.org>
8 years agodatapath: compat: Add NULL check for tun-dst.
Pravin B Shelar [Thu, 21 Jan 2016 05:17:45 +0000 (21:17 -0800)]
datapath: compat: Add NULL check for tun-dst.

tun-dst could be NULL in case of incorrect action list
where set tunnel action is missing but packet is sent
to tunnel vport.

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Joe Stringer <joe@ovn.org>
8 years agoovn-controller: Update check for parent port.
Russell Bryant [Wed, 20 Jan 2016 16:17:58 +0000 (11:17 -0500)]
ovn-controller: Update check for parent port.

There were a couple of checks that checked for a parent port as the
field being non-NULL.  We should treat an empty string the same as NULL
for this field.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agoovn-nbctl: Update show format for addresses.
Russell Bryant [Thu, 14 Jan 2016 16:00:52 +0000 (11:00 -0500)]
ovn-nbctl: Update show format for addresses.

This patch updates the formatting for the Logical_Port addresses column
in the show command output.  Previously, output would look like:

  addresses: 00:00:00:00:00:01 192.168.1.1 00:00:00:00:00:01 192.168.1.2

Now it looks like:

  addresses: ["00:00:00:00:00:01 192.168.1.1", "00:00:00:00:00:01 192.168.1.2"]

The grouping of addresses is important, so it should be reflected in the
output.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agoovn-nbctl: Help catch lport-set-addresses mistakes.
Russell Bryant [Thu, 14 Jan 2016 15:47:18 +0000 (10:47 -0500)]
ovn-nbctl: Help catch lport-set-addresses mistakes.

While debugging a broken OVN environment yesterday, the problem turned
out to be invalid entries in the logical port addresses column.  In
particular, the following command had been used:

  $ ovn-nbctl lport-set-addresses lp0 MAC IP

instead of:

  $ ovn-nbctl lport-set-addresses lp0 "MAC IP"

This is really easy to mess up, so add some simple validation to the
lport-set-addresses command.  If the beginning of an argument is ever
an IP address, it's wrong.

In passing, also add a note to the ovn-nb db documentation to note that
the order of "MAC IP" is required, as "IP MAC" is not valid.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agoofp-util: Make decoding switch features harder to misuse (and fix leak).
Ben Pfaff [Thu, 21 Jan 2016 00:33:13 +0000 (16:33 -0800)]
ofp-util: Make decoding switch features harder to misuse (and fix leak).

Until now, ofputil_decode_switch_features() has put the ports from the
switch features message into a separate ofpbuf supplied as an argument.
The natural desire for a caller is to just reuse an ofpbuf that it already
has, and that's what one of the callers did.  This however has the
nonobvious effect of leaking the memory that the ofpbuf previously owned,
since it gets replaced by an OFPBUF_CONST-type ofpbuf.

This commit avoids the problem by changing the interface to pull the
header from an ofpbuf that the caller already has.

This fixes a leak in testcase 909 "ofproto-dpif - patch ports".

Found by valgrind.

Reported-by: William Tu <u9012063@gmail.com>
Reported-at: http://openvswitch.org/pipermail/dev/2016-January/064771.html
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
8 years agoappveyor.yml: Install python "six" module.
Ben Pfaff [Thu, 21 Jan 2016 01:15:16 +0000 (17:15 -0800)]
appveyor.yml: Install python "six" module.

It is now required for the build.

Thanks to Alin Gabriel Serdean for helping figure out the correct
solution here.

This adds --diable-pip-version-check because upgrading pip (as
suggested by the error that this option suppresses) causes pip
to fail, which is in turn a bug in pip that manifests only on
Windows: https://github.com/pypa/pip/issues/3383.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
8 years agonx-match: Add functions for raw decoding and encoding of OXM.
Ben Pfaff [Mon, 18 Jan 2016 22:55:30 +0000 (14:55 -0800)]
nx-match: Add functions for raw decoding and encoding of OXM.

The existing functions either assumed that we were working with NXM
(instead of OXM), or they added or parsed a header before OXM headers.
These aren't needed when OXM is encapsulated inside a property, as will be
the case in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofproto-dpif-rid: Use UUID, not pointer, to identify ofprotos for recirc.
Ben Pfaff [Mon, 18 Jan 2016 22:47:40 +0000 (14:47 -0800)]
ofproto-dpif-rid: Use UUID, not pointer, to identify ofprotos for recirc.

An upcoming commit will make it possible to essentially serialize the
recirculation state into an OpenFlow message.  For that purpose, we can't
sensibly pass a "struct ofproto *", but a randomly generated UUID works
just as well.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofproto-dpif-rid: Fix names of recirc_metadata_{hash,equal}().
Ben Pfaff [Fri, 15 Jan 2016 22:00:50 +0000 (14:00 -0800)]
ofproto-dpif-rid: Fix names of recirc_metadata_{hash,equal}().

These functions actually hash or compare recirc_state structs, so they
should be named that way; recirc_metadata is only a small subset of
recirc_state.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofproto-dpif-rid: Don't carry actset_output explicitly in metadata.
Ben Pfaff [Fri, 15 Jan 2016 21:56:34 +0000 (13:56 -0800)]
ofproto-dpif-rid: Don't carry actset_output explicitly in metadata.

Instead reconstruct it using the action set, since we already have the
logic to do that.

This seems a little nicer because we don't have to "trust" the metadata
as much.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofproto-dpif-rid: Use separate pointers for actions and action set.
Ben Pfaff [Mon, 18 Jan 2016 22:43:01 +0000 (14:43 -0800)]
ofproto-dpif-rid: Use separate pointers for actions and action set.

During translation it makes some sense to concatenate these in a single
array, but in my opinion it's conceptually better to separate them for
the recirc_state; they are not naturally the same thing.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofproto-dpif-rid: Use array instead of ofpbuf for recirc_state stack.
Ben Pfaff [Thu, 21 Jan 2016 00:47:14 +0000 (16:47 -0800)]
ofproto-dpif-rid: Use array instead of ofpbuf for recirc_state stack.

In my opinion, this makes better sense for the stack, because it's not
a packet or a collection of bytes, it's an array of struct mf_subvalue.
(I left it as an ofpbuf for accumulating stack entries during
translation, because the automatic reallocation and especially the stub
support there is helpful.)

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agodatapath: Fix panic sending IP frags over tunnels.
Joe Stringer [Wed, 20 Jan 2016 23:26:49 +0000 (15:26 -0800)]
datapath: Fix panic sending IP frags over tunnels.

The entire OVS_GSO_CB was not preserved when handling IP fragments,
leading to the following NULL pointer dereference in ovs_stt_xmit(). Fix
this in the fragmentation handling code by preserving the whole CB.

BUG: unable to handle kernel NULL pointer dereference at 000000000000001c
IP: [<ffffffffa0cfc5b1>] ovs_stt_xmit+0x61/0x260 [openvswitch]
Call Trace:
 [<ffffffff815f682e>] ? __alloc_skb+0x7e/0x2b0
 [<ffffffffa0cf1134>] ovs_vport_send+0x44/0xb0 [openvswitch]
 [<ffffffffa0ce241f>] ovs_vport_output+0x10f/0x190 [openvswitch]
 [<ffffffff8163fe98>] ip_fragment+0x238/0x870
 [<ffffffffa0ce2310>] ? do_output.isra.35+0x120/0x120 [openvswitch]
 [<ffffffffa0d02093>] ovs_fragment+0x283/0x292 [openvswitch]
 [<ffffffff81073ff7>] ? mod_timer_pending+0x67/0x1b0
 [<ffffffff8160e2d0>] ? dst_ifdown+0x90/0x90
 [<ffffffff8160e2d0>] ? dst_ifdown+0x90/0x90
 [<ffffffffa0b30165>] ? nfnetlink_has_listeners+0x15/0x20 [nfnetlink]
 [<ffffffffa0cdb164>] ? ctnetlink_conntrack_event+0x74/0x7ee [nf_conntrack_netlink]
 [<ffffffffa0b873cd>] ? nf_ct_deliver_cached_events+0xad/0xf0 [nf_conntrack]
 [<ffffffff81360331>] ? csum_partial+0x11/0x20
 [<ffffffffa0ce2747>] ? execute_masked_set_action+0x2a7/0xa60 [openvswitch]
 [<ffffffffa0ce22a8>] do_output.isra.35+0xb8/0x120 [openvswitch]
 [<ffffffffa0ce2ff4>] do_execute_actions+0xf4/0x7f0 [openvswitch]
 [<ffffffffa0ce3730>] ovs_execute_actions+0x40/0x130 [openvswitch]
 [<ffffffffa0ce7c69>] ovs_packet_cmd_execute+0x2b9/0x2e0 [openvswitch]
 [<ffffffff81634fad>] genl_family_rcv_msg+0x18d/0x370
 [<ffffffff81635190>] ? genl_family_rcv_msg+0x370/0x370
 [<ffffffff81635221>] genl_rcv_msg+0x91/0xd0
 [<ffffffff816332c9>] netlink_rcv_skb+0xa9/0xc0
 [<ffffffff816337c8>] genl_rcv+0x28/0x40
 [<ffffffff816329b5>] netlink_unicast+0xd5/0x1b0
 [<ffffffff81632d9e>] netlink_sendmsg+0x30e/0x680
 [<ffffffff8162fc84>] ? netlink_rcv_wake+0x44/0x60
 [<ffffffff81630d12>] ? netlink_recvmsg+0x1a2/0x3a0
 [<ffffffff815ed7fb>] sock_sendmsg+0x8b/0xc0
 [<ffffffff8114d06d>] ? __alloc_pages_nodemask+0x16d/0xac0
 [<ffffffff8101c4b9>] ? sched_clock+0x9/0x10
 [<ffffffff815edbc9>] ___sys_sendmsg+0x349/0x360
 [<ffffffff811f8a39>] ? ep_scan_ready_list.isra.7+0x199/0x1c0
 [<ffffffff8110705c>] ? acct_account_cputime+0x1c/0x20
 [<ffffffff811cd90f>] ? fget_light+0x8f/0xf0
 [<ffffffff815ee922>] __sys_sendmsg+0x42/0x80
 [<ffffffff815ee972>] SyS_sendmsg+0x12/0x20
 [<ffffffff8170f22f>] tracesys+0xe1/0xe6

VMware-BZ: #1587324
Fixes: a94ebc39996b ("datapath: Add conntrack action")
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agotest-sflow: Fix LACP typo.
William Tu [Wed, 20 Jan 2016 23:52:08 +0000 (15:52 -0800)]
test-sflow: Fix LACP typo.

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoovs-vsctl: Add parent process name and ID.
William Tu [Tue, 12 Jan 2016 22:24:53 +0000 (14:24 -0800)]
ovs-vsctl: Add parent process name and ID.

This patch forces appending "parent_process_name(PID)" when invoking
ovs-vsctl, in order to assist debugging. The patch is for Linux only.
For example:
    User adds br0 by "ovs-vsctl add-br0", the log shows:
    "ovs-vsctl (invoked by base(1528)): ovs-vsctl add-br br0"

Signed-off-by: William Tu <u9012063@gmail.com>
[blp@ovn.org made stylistic changes]
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agotests: Set enable-dummy=system for ovn-controller-vtep tests.
Russell Bryant [Thu, 14 Jan 2016 20:07:59 +0000 (15:07 -0500)]
tests: Set enable-dummy=system for ovn-controller-vtep tests.

All of the ovn-controller-vtep tests were failing on my laptop due to an
unexpected message in the ovs-vswitchd log related to my VPN.  This
setting resolves it and makes all tests pass.

Fixes: 0c1e8a7d637e ("ovn-controller-vtep: Add gateway module.")
Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agopython: Fix octal compatibility.
Russell Bryant [Wed, 6 Jan 2016 20:16:10 +0000 (15:16 -0500)]
python: Fix octal compatibility.

Octal constants must be written as 0o077 instead of 0077 to be
compatible with both Python 2 and 3.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agopython: Stop using xrange().
Russell Bryant [Mon, 14 Dec 2015 19:33:52 +0000 (14:33 -0500)]
python: Stop using xrange().

Python 2 had range() and xrange().  xrange() is more efficient, but
behaves differently so range() was retained for compatibility.  Python 3
only has range() and it behaves like Python 2's xrange().

Remove explicit use of xrange() and use six.moves.range() to
make sure we're using xrange() from Python 2 or range() from Python 3.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agopython: Fix xmlrpclib imports.
Russell Bryant [Mon, 14 Dec 2015 19:03:14 +0000 (14:03 -0500)]
python: Fix xmlrpclib imports.

Fix imports of xmlrpclib to be compatible with Python 3.  Python 2 had
xmlrpclib (client) and SimpleXMLRPCServer (server).  In Python 3, these
have been renamed to xmlrpc.client and xmlrpc.server.

The solution implemented here is to use the six library.  It may seem
excessive for this particular issue, but the six library provides
helpers for Python 2 and 3 compatibility for many different issues.
This is just the first of many uses of the six library.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agohash: New helper functions hash_bytes32() and hash_bytes64().
Ben Pfaff [Tue, 19 Jan 2016 06:52:48 +0000 (22:52 -0800)]
hash: New helper functions hash_bytes32() and hash_bytes64().

All of the callers of hash_words() and hash_words64() actually find it
easier to pass in the number of bytes instead of the number of 32-bit
or 64-bit words.  These new functions allow the callers to be a little
simpler.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoconnmgr: Generalize ofproto_packet_in to ofproto_async_msg.
Ben Pfaff [Tue, 19 Jan 2016 04:12:30 +0000 (20:12 -0800)]
connmgr: Generalize ofproto_packet_in to ofproto_async_msg.

An upcoming commit will add another kind of asynchronous message that
should be handled in the same way as packet-ins.

Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoopenflow: Better abstract handling of packet-in messages.
Ben Pfaff [Wed, 20 Jan 2016 17:57:16 +0000 (09:57 -0800)]
openflow: Better abstract handling of packet-in messages.

Packet-in messages have been a bit of a mess.  First, their abstraction
in the form of struct ofputil_packet_in has some fields that are used
in a clear way for incoming and outgoing packet-ins, and others
(packet_len, total_len, buffer_id) have have confusing meanings or
usage pattern depending on their direction.

Second, it's very confusing how a packet-in has both a reason (OFPR_*)
and a miss type (OFPROTO_PACKET_IN_*) and how those add up to the
actual reason that is used "on the wire" for each OpenFlow version (and
even whether the packet-in is sent at all!).

Finally, there's all kind of low-level detail randomly scattered between
connmgr, ofproto-dpif-xlate, and ofp-util.

This commit attempts to clear up some of the confusion.  It simplifies
the struct ofputil_packet_in abstraction by removing the members that
didn't have a clear and consistent meaning between incoming and outgoing
packet-ins.  It gets rid of OFPROTO_PACKET_IN_*, instead adding a couple
of nonstandard OFPR_* reasons that add up to what OFPROTO_PACKET_IN_*
was meant to say (in what I hope is a clearer way).  And it consolidates
the tricky parts into ofp-util, where I hope it will be easier to
understand all in one place.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agopktbuf: Move from 'ofproto' to 'lib'.
Ben Pfaff [Fri, 15 Jan 2016 04:08:07 +0000 (20:08 -0800)]
pktbuf: Move from 'ofproto' to 'lib'.

An upcoming commit will use this library from ofp-util instead of ofproto.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agofail-open: Drop some of the weirder special cases.
Ben Pfaff [Fri, 15 Jan 2016 04:10:43 +0000 (20:10 -0800)]
fail-open: Drop some of the weirder special cases.

I don't have any real evidence that these special cases make a difference
in real-world cases.  The messages for the commits that add them are not
clear about the reasons for them.  I seem to recall that they were only
tested with the dummy controller inside OVS, which isn't very good evidence
for real controllers.  Finally, they cut across layers in nasty ways and
make it hard to better abstract packet-ins and packet buffering.

If these solve real problems then we can reconsider after some reports
come in.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoopenflow: Get rid of struct ofp13_packet_in.
Ben Pfaff [Fri, 15 Jan 2016 01:00:57 +0000 (17:00 -0800)]
openflow: Get rid of struct ofp13_packet_in.

It's actually harder to parse OF1.2/OF1.3 "packet-in" messages when
ofp13_packet_in is involved than when the code just realizes that
ofp13_packet_in = ofp12_packet_in + cookie.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofp-print: Decode and print all async config messages the same way.
Ben Pfaff [Fri, 15 Jan 2016 06:16:34 +0000 (22:16 -0800)]
ofp-print: Decode and print all async config messages the same way.

We have a single function to decode all of these messages, so there's no
reason to do it two different ways for printing.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofp-util: Add function to encode OFPT_SET_ASYNC messages.
Ben Pfaff [Fri, 8 Jan 2016 22:49:32 +0000 (14:49 -0800)]
ofp-util: Add function to encode OFPT_SET_ASYNC messages.

This isn't used yet but it will be in future commits.

This also looks forward to supporting Open vSwitch extensions to OAM_*,
which will be coming up soon.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofp-util: Fix OF1.4+ version of ofputil_decode_set_async_config().
Ben Pfaff [Tue, 19 Jan 2016 00:00:34 +0000 (16:00 -0800)]
ofp-util: Fix OF1.4+ version of ofputil_decode_set_async_config().

The OF1.0 through OF1.3 "set async config" set the whole configuration,
OF1.4+ only update parts of it piecemeal, but the decoding function always
set the whole configuration.  This commit fixes the problem by changing the
interface to require the caller to provide an initial state.  (It would
be possible to simply make it mutate existing state in-place, but that
interface seems a little more error-prone.)

Found by inspection.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofp-util: Rewrite async config encoding and decoding to be table-driven.
Ben Pfaff [Wed, 20 Jan 2016 17:46:09 +0000 (09:46 -0800)]
ofp-util: Rewrite async config encoding and decoding to be table-driven.

The encoding and decoding of the OpenFlow and Open vSwitch async config
messages was, until now, a collection of disjoint code that had a lot of
redundancy.  This commit changes it all to be driven using a single central
table.

This rewrite fixes a bug in the OF1.4+ version of the code, which until
now assumed that every TLV in an OF1.4+ asynchronous configuration message
was exactly 8 bytes long, and reported an error if any was a different
length.  This invariant is true of all the standard TLVs already defined,
but it won't be true of any experimenter TLVs (and won't necessarily be
true of any new standard TLVs), so this commit changes it to be more
tolerant.

The OFPACPT_* constants are no longer useful (they are encoded directly
in the table and do not need to be anywhere else), so this removes them.

This commit also adds support for experimenter async config messages.
We don't have any yet but an upcoming commit will add one.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofp-util: Define struct ofputil_async_cfg to hold async message config.
Ben Pfaff [Fri, 15 Jan 2016 05:03:23 +0000 (21:03 -0800)]
ofp-util: Define struct ofputil_async_cfg to hold async message config.

This seems a little better than a pair of bare arrays.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofp-util: New function ofputil_async_msg_type_to_string().
Ben Pfaff [Thu, 7 Jan 2016 20:04:56 +0000 (12:04 -0800)]
ofp-util: New function ofputil_async_msg_type_to_string().

An upcoming commit will add another user.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoopenflow: Implement OF1.4+ OFPMP_QUEUE_DESC multipart message.
Ben Pfaff [Tue, 19 Jan 2016 00:00:05 +0000 (16:00 -0800)]
openflow: Implement OF1.4+ OFPMP_QUEUE_DESC multipart message.

OpenFlow 1.0 through 1.3 have a message OFPT_QUEUE_GET_CONFIG_REQUEST and
its corresponding reply, for fetching a description of the queues
configured on a given port.  OpenFlow 1.4 changes this message to a
multipart message OFPMP_QUEUE_DESC, which Open vSwitch has not until now
implemented.  This commit adds an implemntation of that message.  Because
the message is a replacement for the former one, this commit implements it
using the same ofp-util functions as the former message, so that the client
code doesn't have to distinguish a difference between versions.

The ovs-ofctl command queue-get-config was previously undocumented (due
only to an oversight).  This commit corrects that and documents the new
feature available with OpenFlow 1.4.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoopenflow: Remove unused (and not useful) property headers.
Ben Pfaff [Wed, 20 Jan 2016 17:23:57 +0000 (09:23 -0800)]
openflow: Remove unused (and not useful) property headers.

These are all just copies of the otherwise generic ofp_prop_header or
ofp_prop_experimenter.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofp-prop: New function ofpprop_put_zeros().
Ben Pfaff [Wed, 20 Jan 2016 17:20:08 +0000 (09:20 -0800)]
ofp-prop: New function ofpprop_put_zeros().

This will have additional users in later commits.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofp-prop: Add helpers for u8, be64/u64, flag, and UUID properties.
Ben Pfaff [Wed, 20 Jan 2016 17:13:59 +0000 (09:13 -0800)]
ofp-prop: Add helpers for u8, be64/u64, flag, and UUID properties.

These will have users in upcoming commits.  Unlike the previously
added helpers, there isn't any existing code that can immediately
use them.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofp-prop: Add generic functions for working with 16- and 32-bit properties.
Ben Pfaff [Wed, 20 Jan 2016 17:05:15 +0000 (09:05 -0800)]
ofp-prop: Add generic functions for working with 16- and 32-bit properties.

These will see increasing use in upcoming commits.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofp-prop: Add support for experimenter properties.
Ben Pfaff [Wed, 20 Jan 2016 16:56:13 +0000 (08:56 -0800)]
ofp-prop: Add support for experimenter properties.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofp-prop: New module for working with OpenFlow 1.3+ properties.
Ben Pfaff [Tue, 29 Dec 2015 14:44:16 +0000 (06:44 -0800)]
ofp-prop: New module for working with OpenFlow 1.3+ properties.

Several OpenFlow 1.3+ messages use TLV-based properties that take a
common form.  Until now, ofp-util has had some static functions for
dealing with properties.  Because properties will start to be needed
outside of ofp-util, this commit breaks them out into a new library,
renaming them to begin with ofpprop_.

The following commit will add a few new interfaces that add new
functionality.

Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoofp-errors: Add extension error codes for OF1.3+ property errors.
Ben Pfaff [Mon, 18 Jan 2016 23:06:54 +0000 (15:06 -0800)]
ofp-errors: Add extension error codes for OF1.3+ property errors.

Upcoming commits will introduce uses of the "property" message formats,
which are used in OF1.3 and especially in OF1.4+, in Nicira extension
messages for earlier versions of OpenFlow.  Thus, it's best to also
support the appropriate error codes in those versions of OpenFlow, so that
errors can be reported in a useful way.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofp-util: Improve function to emit a bitmap property.
Ben Pfaff [Wed, 20 Jan 2016 16:22:43 +0000 (08:22 -0800)]
ofp-util: Improve function to emit a bitmap property.

The callers had some common code that could be reasonably encapsulated, so
this commit does so.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofp-actions: Append in ofpacts_pull_openflow_actions(), instead of replace.
Ben Pfaff [Mon, 18 Jan 2016 22:13:16 +0000 (14:13 -0800)]
ofp-actions: Append in ofpacts_pull_openflow_actions(), instead of replace.

An upcoming commit will have a need to parse actions incrementally, so this
change makes that easier to do.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoovs-ofctl: Merge dump_stats_transaction() into dump_transaction().
Ben Pfaff [Thu, 24 Dec 2015 23:44:31 +0000 (15:44 -0800)]
ovs-ofctl: Merge dump_stats_transaction() into dump_transaction().

The callers call dump_stats_transaction() for OFPST_* messages and
dump_transaction() for other messages, but the callee can easily
distinguish the two types, so this commit eliminates the difference for the
callers to simplify use.

This will be more valuable in an upcoming commit in which a single
ofputil_encode_*() function can produce an OFPT_* request for some
OpenFlow versions and an OFPST_* request for others.  (Specifically, OF1.4
changes OFPT_QUEUE_GET_CONFIG_REQUEST into OFPST_QUEUE_DESC.)

Also merges dump_trivial_stats_transaction() into
dump_trivial_transaction() for the same reason.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agonetdev-dummy: Add a dummy queue.
Ben Pfaff [Wed, 20 Jan 2016 16:16:09 +0000 (08:16 -0800)]
netdev-dummy: Add a dummy queue.

Until now it's been pretty hard to properly test any of the queue support,
because the dummy network device doesn't have any queues.  By adding one
queue to the dummy network device (queue 0), we can get slightly higher
confidence that OVS queue support works correctly.  I suppose we could do
even better if we made the dummy network device support modifying the
queues, but that's a job for another day.

Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoopenflow: Rename OF0.1-1.3 queue property constants.
Ben Pfaff [Wed, 20 Jan 2016 16:05:20 +0000 (08:05 -0800)]
openflow: Rename OF0.1-1.3 queue property constants.

At first glance, OF1.4 queue properties look a lot like those for OF1.0
to OF1.3, but in fact their different padding makes them incompatible.  In
addition, OF1.4 switches from using regular OpenFlow messages to request
queue properties, to using multipart messages.  Thus, we really need to
use separate code to deal with OF1.4 queues.

OF1.0, OF1.1, and OF1.2 all have slightly different queue config reply
messages, but only OF1.0 and OF1.2 had tests, so this adds tests.  (There
is no test for OF1.3 because it's the same as OF1.2.)

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofp-print: Improve formatting of queue stat requests and port_mods.
Ben Pfaff [Thu, 24 Dec 2015 23:29:26 +0000 (15:29 -0800)]
ofp-print: Improve formatting of queue stat requests and port_mods.

Without this, OFPST_QUEUE requests are formatted as:
    OFPST_QUEUE request:port=LOCAL queue=5
With this commit, OFPST_QUEUE requests are formatted as:
    OFPST_QUEUE request: port=LOCAL queue=5
which looks better.

Similarly for OFPT_PORT_MOD.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agopinsched: Remove obsolete ofpbuf_trim().
Ben Pfaff [Tue, 5 Jan 2016 19:42:51 +0000 (11:42 -0800)]
pinsched: Remove obsolete ofpbuf_trim().

This call to ofpbuf_trim() comes from a time when the packets passed to
pinsched came directly from a dpif.  For some time now that's no longer
true--now they are messages generated by ofputil_encode_packet_in(), which
generally are well sized and do not benefit from trimming.

This is not a bug fix--the code is equally correct either way, it's only
the rationale for trimming that's obsolete.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoopenflow-1.2: Remove unused struct definition.
Ben Pfaff [Wed, 6 Jan 2016 21:56:29 +0000 (13:56 -0800)]
openflow-1.2: Remove unused struct definition.

Experimenter stats are handled by code in ofp-msgs, and this struct isn't
good for anything.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofp-util: Improve formatting of comment.
Ben Pfaff [Thu, 7 Jan 2016 20:03:28 +0000 (12:03 -0800)]
ofp-util: Improve formatting of comment.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofp-msgs: Fix comments.
Ben Pfaff [Thu, 24 Dec 2015 23:47:56 +0000 (15:47 -0800)]
ofp-msgs: Fix comments.

ofpbuf used to have members named 'frame' and 'l3' but now they're 'header'
and 'msg'.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofp-msgs: Fix definitions of OF1.4 OFPT_GET_ASYNC_REPLY and OFPT_SET_ASYNC.
Ben Pfaff [Wed, 6 Jan 2016 21:38:20 +0000 (13:38 -0800)]
ofp-msgs: Fix definitions of OF1.4 OFPT_GET_ASYNC_REPLY and OFPT_SET_ASYNC.

The structures declared in ofp-msgs.h for messages definitions should not
include an OpenFlow header (its presence is implied), but the definition of
these messages did.  This commit fixes the definitions.

The visible bug was really minor here: messages of these kinds without any
TLVs would be rejected by the OpenFlow parser.  But OVS never sends these
messages without TLVs, so probably no one ever noticed this.  (Also, the
OVS support for OF1.4 is still incomplete and experimental.)

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agolearning-switch: Use "if"s instead of "switch" to reduce maintenance.
Ben Pfaff [Mon, 18 Jan 2016 22:49:47 +0000 (14:49 -0800)]
learning-switch: Use "if"s instead of "switch" to reduce maintenance.

This code only cares about a very few kinds of OpenFlow messages, and it's
unlikely that it will care about new ones, so replace the "switch" by "if"
statements so that GCC won't complain about every new message.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofproto: Fix memory leak and memory exhaustion bugs in group_mod.
Ben Pfaff [Thu, 14 Jan 2016 06:15:09 +0000 (22:15 -0800)]
ofproto: Fix memory leak and memory exhaustion bugs in group_mod.

In handle_group_mod() cases where adding a group failed, nothing freed the
list of buckets, causing a leak.  The same was true in every case of
modifying a group.  This commit fixes the problem by changing add_group()
to never steal or free the buckets (modify_group() already acted this way)
and then making handle_group_mod() always free the buckets when it's done.

This approach might at first raise objections, because it makes add_group()
copy the buckets instead of just take the existing ones.  But it actually
fixes a worse problem too: when OF1.4+ REQUESTFORWARD is enabled, the
group_mod is reused for the request forwarding.  Until now, for a group_mod
that adds a new group and that has some buckets, the previous stealing of
buckets in add_group() meant that the group_mod's buckets were no longer
valid; in practice, the list of buckets became linked in a way that
iteration never terminated, which caused memory to be exhausted while
composing the requestforward message.  By making add_group() no longer
modify the group_mod, we also fix this problem.

The requestforward test in the testsuite did not find the latter problem
because it only added a group without any buckets.  This commit also
updates the testsuite to include a bucket in its group_mod, which would
have found the problem.

Found by pain and suffering.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofproto: Wildcard TTL on IP tunnels
Haggai Eran [Thu, 14 Jan 2016 11:29:08 +0000 (13:29 +0200)]
ofproto: Wildcard TTL on IP tunnels

There is no need to set the mask on the outer header IP TTL [1]. The only requirement
is that the TTL will be non-zero. Clear the mask in tnl_wc_init().

[1] OVS VXLAN decap rule has full match on TTL for the outer headers?
    http://www.spinics.net/lists/netdev/msg351961.html

Cc: Jesse Gross <jesse@kernel.org>
Cc: Joe Stringer <joe@ovn.org>
Signed-off-by: Haggai Eran <haggaie@mellanox.com>
Signed-off-by: Jesse Gross <jesse@kernel.org>
8 years agoodp-util: Accept fields with zero mask
Haggai Eran [Thu, 14 Jan 2016 11:29:07 +0000 (13:29 +0200)]
odp-util: Accept fields with zero mask

It is possible to pass some fields to the kernel with a zero mask, but
ovs-dpctl doesn't currently allow it. Change the code to allow it to
mimic what vswitchd is allowed to do.

Signed-off-by: Haggai Eran <haggaie@mellanox.com>
Signed-off-by: Jesse Gross <jesse@kernel.org>