cascardo/ovs.git
8 years agotests: Better tolerate file system restriction on file name length.
Ben Pfaff [Tue, 16 Feb 2016 19:13:35 +0000 (11:13 -0800)]
tests: Better tolerate file system restriction on file name length.

ecryptfs on Linux restricts file names to 143 bytes, but these two tests
used a 150-byte name.  This commit fixes the specific problem on ecryptfs
by reducing the name it test to 143 bytes.  It also fixes the more general
problem of name length restrictions by skipping the test, rather than
failing it, if a directory with the 143-byte name cannot be created, since
the most likely problem is that the name is too long for the file system.

Reported-by: Zoltán Balogh <zoltan.balogh@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agohmap: Add extra build-time iteration checks for types derived from hmap.
Ben Pfaff [Tue, 9 Feb 2016 00:52:45 +0000 (16:52 -0800)]
hmap: Add extra build-time iteration checks for types derived from hmap.

Some of our data structures derived from hmap use the same member names.
This means it's possible to confuse them in iteration, e.g. to iterate a
shash with SIMAP_FOR_EACH.  Of course this will crash at runtime, but it
seems even better to catch it at compile time.

An alternative would be to use unique member names, e.g. shash_map and
simap_map instead of just map.  I like short names, though.

It's kind of nasty that we need support from the hmap code to do this.
An alternative would be to insert the build assertions as statements before
the for loop.  But that would cause nasty surprises if someone forgets the
{} around a block of statements; even though the OVS coding style requires
them in all cases, I suspect that programmers doing debugging, etc. tend
to omit them sometimes.

It's not actually necessary to have multiple variants of these macros,
e.g. one can write a C99-compliant HMAP_FOR_EACH that accepts 3 or 4 or
more arguments.  But such a macro is harder to read, so I don't know
whether this is a good tradeoff.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
8 years agoofp-actions: Introduce macro for padding struct members.
Ben Pfaff [Thu, 18 Feb 2016 18:12:04 +0000 (10:12 -0800)]
ofp-actions: Introduce macro for padding struct members.

An upcoming commit will add another case where it's desirable to ensure
that a variable-length array is aligned on an 8-byte boundary.  This macro
makes that a little easier.

Signed-off-by: Ben Pfaff <blp@ovn.org>
CC: Joe Stringer <joe@ovn.org>
Acked-by: Joe Stringer <joe@ovn.org>
8 years agopinctrl: Fix header guard.
Ben Pfaff [Thu, 18 Feb 2016 16:10:42 +0000 (08:10 -0800)]
pinctrl: Fix header guard.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoImplement serializing the state of packet traversal in "continuations".
Ben Pfaff [Sat, 20 Feb 2016 00:10:06 +0000 (16:10 -0800)]
Implement serializing the state of packet traversal in "continuations".

One purpose of OpenFlow packet-in messages is to allow a controller to
interpose on the path of a packet through the flow tables.  If, for
example, the controller needs to modify a packet in some way that the
switch doesn't directly support, the controller should be able to
program the switch to send it the packet, then modify the packet and
send it back to the switch to continue through the flow table.

That's the theory.  In practice, this doesn't work with any but the
simplest flow tables.  Packet-in messages simply don't include enough
context to allow the flow table traversal to continue.  For example:

    * Via "resubmit" actions, an Open vSwitch packet can have an
      effective "call stack", but a packet-in can't describe it, and
      so it would be lost.

    * A packet-in can't preserve the stack used by NXAST_PUSH and
      NXAST_POP actions.

    * A packet-in can't preserve the OpenFlow 1.1+ action set.

    * A packet-in can't preserve the state of Open vSwitch mirroring
      or connection tracking.

This commit introduces a solution called "continuations".  A continuation
is the state of a packet's traversal through OpenFlow flow tables.  A
"controller" action with the "pause" flag, which is newly implemented in
this commit, generates a continuation and sends it to the OpenFlow
controller in a packet-in asynchronous message (only NXT_PACKET_IN2
supports continuations, so the controller must configure them with
NXT_SET_PACKET_IN_FORMAT).  The controller processes the packet-in,
possibly modifying some of its data, and sends it back to the switch with
an NXT_RESUME request, which causes flow table traversal to continue.  In
principle, a single packet can be paused and resumed multiple times.

Another way to look at it is:

    - "pause" is an extension of the existing OFPAT_CONTROLLER
      action.  It sends the packet to the controller, with full
      pipeline context (some of which is switch implementation
      dependent, and may thus vary from switch to switch).

    - A continuation is an extension of OFPT_PACKET_IN, allowing for
      implementation dependent metadata.

    - NXT_RESUME is an extension of OFPT_PACKET_OUT, with the
      semantics that the pipeline processing is continued with the
      original translation context from where it was left at the time
      it was paused.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofp-prop: Add support for putting and parsing nested properties.
Ben Pfaff [Fri, 19 Feb 2016 23:56:52 +0000 (15:56 -0800)]
ofp-prop: Add support for putting and parsing nested properties.

It hadn't occurred to me before that any special support was actually
necessary or useful for nested properties, but the functions introduced in
this commit are nice wrappers to deal with the extra 4-byte padding that
ensures that the nested properties begin on 8-byte boundaries just like
the outer properties.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoSupport userdata in NXT_PACKET_IN2.
Ben Pfaff [Fri, 19 Feb 2016 23:53:26 +0000 (15:53 -0800)]
Support userdata in NXT_PACKET_IN2.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofp-util: Rename struct ofputil_packet_in member 'len' to 'packet_len'.
Ben Pfaff [Wed, 17 Feb 2016 08:31:11 +0000 (00:31 -0800)]
ofp-util: Rename struct ofputil_packet_in member 'len' to 'packet_len'.

An upcoming commit will introduce another member that has a length, and
it seems weird that bare 'len' would be one or the other.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoImplement new packet-in format NXT_PACKET_IN2.
Ben Pfaff [Fri, 19 Feb 2016 23:31:37 +0000 (15:31 -0800)]
Implement new packet-in format NXT_PACKET_IN2.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofp-util: Remove 'const' from struct ofputil_packet_in's 'packet' member.
Ben Pfaff [Wed, 17 Feb 2016 21:14:26 +0000 (13:14 -0800)]
ofp-util: Remove 'const' from struct ofputil_packet_in's 'packet' member.

It's not const in all cases so it doesn't entirely make sense to mark
it const here.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofpbuf: New function ofpbuf_const_initializer().
Ben Pfaff [Thu, 18 Feb 2016 23:13:09 +0000 (15:13 -0800)]
ofpbuf: New function ofpbuf_const_initializer().

A number of times I've looked at code and thought that it would be easier
to understand if I could write an initializer instead of
ofpbuf_use_const().  This commit adds a function for that purpose and
adapts a lot of code to use it, in the places where I thought it made
the code better.

In theory this could improve code generation since the new function can
be inlined whereas ofpbuf_use_const() isn't.  But I guess that's probably
insignificant; the intent of this change is code readability.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoINSTALL.DPDK.md: Correct mergeable buffers parameter.
Ian Stokes [Wed, 10 Feb 2016 10:50:54 +0000 (10:50 +0000)]
INSTALL.DPDK.md: Correct mergeable buffers parameter.

Update the mergeable buffers paramaters in performance tuning
to the correct parameter mrg_rxbuf.

Signed-off-by: Ian Stokes <ian.stokes@intel.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agoINSTALL.DPDK: Update details of XL710 restrictions for DPDK 2.2.
Ian Stokes [Tue, 9 Feb 2016 14:48:47 +0000 (14:48 +0000)]
INSTALL.DPDK: Update details of XL710 restrictions for DPDK 2.2.

DPDK 2.2 removes restrictions related to maximum number of TX
queues for XL710 devices. Update documentation to reflect these
changes.

Signed-off-by: Ian Stokes <ian.stokes@intel.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agotypes: Fix defined but not used warning.
William Tu [Fri, 19 Feb 2016 21:35:55 +0000 (13:35 -0800)]
types: Fix defined but not used warning.

warning: ‘OVS_BE128_MAX’ defined but not used [-Wunused-const-variable]
Found using CentOS 6.6 with gcc 6.0.0.

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agotests: Add mirror-related keywords to all the mirroring tests.
Ben Pfaff [Fri, 5 Feb 2016 23:30:26 +0000 (15:30 -0800)]
tests: Add mirror-related keywords to all the mirroring tests.

Autotest isn't too smart, so if you try to use "mirroring" as a keyword
before this commit it doesn't select most of the tests due to the comma in
the test names.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofproto-dpif-xlate: Don't consider mirrors used when excluded by VLAN.
Ben Pfaff [Sat, 6 Feb 2016 03:16:01 +0000 (19:16 -0800)]
ofproto-dpif-xlate: Don't consider mirrors used when excluded by VLAN.

Mirrors can be configured to select packets for mirroring on the basis
of multiple criteria: input ports, output ports, and VLANs.  A packet P
is to be mirrored if there exists a mirror M such that either:

    - P ingresses on an input port selected by M, or

    - P egresses on an output port selected by M

AND P is in a VLAN selected by M.

In addition, every mirror has a destination, which can be an output port
or an output VLAN.  Either way, if a packet is mirrored to a particular
destination, it is done only once, even if different mirrors both select
a packet and have the same destination.

Since commit efbc3b7c4006c (ofproto-dpif-xlate: Rewrite mirroring to better
fit flow translation.), these requirements have been implemented
incorrectly: if a packet satisfies one of the bulleted requirements
above for mirror M1, but not the VLAN selection requirement for M1,
then it was not sent to M's destination, but it was still considered
as having been sent to M1's destination for the purpose of avoid output
duplication.  Thus, if P satisfied *all* of the requirements for a
second mirror M2, if M1 and M2 had the same destination, the packet was
still not mirrored.  This commit fixes that problem.

(The issue only occurred if M1 happened to have a smaller index than
M2 in OVS's internal data structures.  That's just a matter of luck.)

Reported-by: Huanle Han <hanxueluo@gmail.com>
Reported-at: http://openvswitch.org/pipermail/dev/2016-January/064531.html
Fixes: 7efbc3b7c4006c (ofproto-dpif-xlate: Rewrite mirroring to better fit flow translation.)
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofp-msgs: Move most OpenFlow header definitions here.
Ben Pfaff [Wed, 27 Jan 2016 23:50:00 +0000 (15:50 -0800)]
ofp-msgs: Move most OpenFlow header definitions here.

This code was the only user for OpenFlow header definitions other than
struct ofp_header itself.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofp-msgs: Add support for ONF extension messages.
Ben Pfaff [Wed, 27 Jan 2016 23:46:41 +0000 (15:46 -0800)]
ofp-msgs: Add support for ONF extension messages.

ONF introduced a number of "standard extensions" that use its own
vendor (experimenter) ID.  This commit adds support for such extensions to
ofp-msgs.

These extensions were already half-supported, so there's barely any change
to build-aux/extract-ofp-msgs.

This isn't fully tested, since nothing adds support for such a message yet.

Requested-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agodatapath: lisp: Relax MTU constraints.
Joe Stringer [Sat, 13 Feb 2016 12:47:13 +0000 (04:47 -0800)]
datapath: lisp: Relax MTU constraints.

Currently, even if the entire path supports jumbo frames, the LISP netdev
limits the path MTU to 1500 bytes, and cannot be configured otherwise.
Relax the constraints on modifying the device MTU, and set it to the
maximum by default.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
8 years agodatapath: stt: Relax MTU constraints.
Joe Stringer [Sat, 13 Feb 2016 12:32:36 +0000 (04:32 -0800)]
datapath: stt: Relax MTU constraints.

Currently, even if the entire path supports jumbo frames, the STT netdev
limits the path MTU to 1500 bytes, and cannot be configured otherwise.
Relax the constraints on modifying the device MTU, and set it to the
maximum by default.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
8 years agodatapath: geneve: Refine MTU limit.
David Wragg [Thu, 18 Feb 2016 17:43:29 +0000 (17:43 +0000)]
datapath: geneve: Refine MTU limit.

Upstream commit:
    Calculate the maximum MTU taking into account the size of headers
    involved in GENEVE encapsulation, as for other tunnel types.

    Changes in v3:
    - Correct comment style
    Changes in v2:
    - Conform more closely to ip_tunnel_change_mtu
    - Exclude GENEVE options from max MTU calculation

Signed-off-by: David Wragg <david@weave.works>
Acked-by: Jesse Gross <jesse@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: aeee0e66c6b4 ("geneve: Refine MTU limit")
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
8 years agodatapath: Set a large MTU on tunnel devices.
David Wragg [Wed, 10 Feb 2016 00:05:58 +0000 (00:05 +0000)]
datapath: Set a large MTU on tunnel devices.

Upstream commit:
    Prior to 4.3, openvswitch tunnel vports (vxlan, gre and geneve) could
    transmit vxlan packets of any size, constrained only by the ability to
    send out the resulting packets.  4.3 introduced netdevs corresponding
    to tunnel vports.  These netdevs have an MTU, which limits the size of
    a packet that can be successfully encapsulated.  The default MTU
    values are low (1500 or less), which is awkwardly small in the context
    of physical networks supporting jumbo frames, and leads to a
    conspicuous change in behaviour for userspace.

    Instead, set the MTU on openvswitch-created netdevs to be the relevant
    maximum (i.e. the maximum IP packet size minus any relevant overhead),
    effectively restoring the behaviour prior to 4.3.

Signed-off-by: David Wragg <david@weave.works>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: 7e059158d57b ("vxlan, gre, geneve: Set a large MTU on ovs-created
tunnel devices")
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
8 years agodatapath: geneve: Relax MTU constraints.
David Wragg [Wed, 10 Feb 2016 00:05:57 +0000 (00:05 +0000)]
datapath: geneve: Relax MTU constraints.

Upstream commit:
    Allow the MTU of geneve devices to be set to large values, in order to
    exploit underlying networks with larger frame sizes.

    GENEVE does not have a fixed encapsulation overhead (an openvswitch
    rule can add variable length options), so there is no relevant maximum
    MTU to enforce.  A maximum of IP_MAX_MTU is used instead.
    Encapsulated packets that are too big for the underlying network will
    get dropped on the floor.

Signed-off-by: David Wragg <david@weave.works>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: 55e5bfb53cff ("geneve: Relax MTU constraints")
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
8 years agodatapath: vxlan: Relax MTU constraints.
David Wragg [Wed, 10 Feb 2016 00:05:55 +0000 (00:05 +0000)]
datapath: vxlan: Relax MTU constraints.

Upstream commit:
    Allow the MTU of vxlan devices without an underlying device to be set
    to larger values (up to a maximum based on IP packet limits and vxlan
    overhead).

    Previously, their MTUs could not be set to higher than the
    conventional ethernet value of 1500.  This is a very arbitrary value
    in the context of vxlan, and prevented vxlan devices from being able
    to take advantage of jumbo frames etc.

    The default MTU remains 1500, for compatibility.

Signed-off-by: David Wragg <david@weave.works>
Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: 72564b59ffc4 ("vxlan: Relax MTU constraints")
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
8 years agoovn: Reorganize action parsing test.
Ben Pfaff [Fri, 4 Dec 2015 22:26:47 +0000 (14:26 -0800)]
ovn: Reorganize action parsing test.

It seems easier to understand if all of the tests for a given action
are grouped together.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
8 years agoexpr: Generalize wording of error message in expand_symbol().
Ben Pfaff [Fri, 4 Dec 2015 22:12:05 +0000 (14:12 -0800)]
expr: Generalize wording of error message in expand_symbol().

The existing wording was very specific to the actual operation being
performed.  While this is nice for users, it becomes difficult to maintain
as more and more operations are added.  This commit makes the wording less
specific, because a third operation will start using this function in an
upcoming commit.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
8 years agoofproto-dpif-xlate: Distinguish "freezing" from "recirculation".
Ben Pfaff [Tue, 16 Feb 2016 18:51:58 +0000 (10:51 -0800)]
ofproto-dpif-xlate: Distinguish "freezing" from "recirculation".

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofproto-dpif-xlate: Break recirculation actions out from action_set.
Ben Pfaff [Fri, 29 Jan 2016 01:11:19 +0000 (17:11 -0800)]
ofproto-dpif-xlate: Break recirculation actions out from action_set.

In my opinion, this is less confusing in multiple ways.  I now understand
the code better myself.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofproto-dpif-xlate: New helper function ctx_cancel_recirculation().
Ben Pfaff [Fri, 29 Jan 2016 00:35:11 +0000 (16:35 -0800)]
ofproto-dpif-xlate: New helper function ctx_cancel_recirculation().

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofproto-dpif-xlate: Improve recirc_unroll_actions() interface.
Ben Pfaff [Fri, 29 Jan 2016 00:27:32 +0000 (16:27 -0800)]
ofproto-dpif-xlate: Improve recirc_unroll_actions() interface.

This interface is still straightforward and easier for the client.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoofpbuf: Make ofpbuf_put_hex() accept period between hex bytes also.
Ben Pfaff [Wed, 10 Feb 2016 23:54:43 +0000 (15:54 -0800)]
ofpbuf: Make ofpbuf_put_hex() accept period between hex bytes also.

This makes it accept the same syntax as parse_NOTE(), so that that function
can be simplified.  In an upcoming commit a second action will also be
able to take advantage of the same feature.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agodynamic-string: Make ds_chomp() return true if it removed a character.
Ben Pfaff [Wed, 10 Feb 2016 04:54:03 +0000 (20:54 -0800)]
dynamic-string: Make ds_chomp() return true if it removed a character.

This will be used in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agotunneling: Disable IPv6 tunnel
Pravin B Shelar [Thu, 11 Feb 2016 09:05:16 +0000 (01:05 -0800)]
tunneling: Disable IPv6 tunnel

There are multiple issues in IPv6 userspace tunnel
implementation. Even the kernel module that ships with
2.5 does not support IPv6 tunneling. There is not
enough time to get all fixes in branch-2.5. So it make
sense to disable the support on 2.5.

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Acked-by: Jesse Gross <jesse@kernel.org>
8 years agoopenflow-common: Describe length and padding rules for OpenFlow properties.
Ben Pfaff [Tue, 16 Feb 2016 23:33:42 +0000 (15:33 -0800)]
openflow-common: Describe length and padding rules for OpenFlow properties.

I keep having to rediscover these from the code.  This is easier.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Joe Stringer <joe@ovn.org>
8 years agodatapath-windows: Enable multiprocessor compilation on solution
Alin Serdean [Thu, 11 Feb 2016 02:30:32 +0000 (02:30 +0000)]
datapath-windows: Enable multiprocessor compilation on solution

Visual Studio defines by default the maximum number of concurrent jobs.

This patch allows the parallel built of the solution.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agosystem-traffic: Add IPv6-over-vxlan-over-IPv4 tests.
Joe Stringer [Fri, 29 Jan 2016 19:37:54 +0000 (11:37 -0800)]
system-traffic: Add IPv6-over-vxlan-over-IPv4 tests.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agosystem-traffic: Add IP fragmentation expiry tests.
Joe Stringer [Fri, 29 Jan 2016 19:37:53 +0000 (11:37 -0800)]
system-traffic: Add IP fragmentation expiry tests.

These tests indirectly trigger the kernel IP fragment expiry code by
ensuring that not all fragments are assembled.

This reproduces the bug that was fixed in the following commit:
bf1f0d35ceb9 datapath: Fix IPv6 fragment expiry crash.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agosystem-traffic: Make vxlan frag test more reliable.
Joe Stringer [Fri, 29 Jan 2016 19:37:52 +0000 (11:37 -0800)]
system-traffic: Make vxlan frag test more reliable.

Depending on the kernel version in use, the nf_conntrack module may
register hooks for each namespace and execute conntrack prior to passing
packets to OVS (or not). In cases where this happens, the previous flow
table in this test would trust the local stack's connection tracking and
use it rather than sending packets through conntrack itself (and
therefore handling IP defragmentation/fragmentation).

This patch revealed two fatal datapath bugs, fixed by these commits:
86c2eb45fd82 datapath: Fix panic sending IP frags over tunnels.
792e5ed750ce datapath: inet: frag: Always orphan skbs inside ip_defrag().

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agosystem-traffic: Fix typo in IPv6 tests.
Joe Stringer [Fri, 29 Jan 2016 19:37:51 +0000 (11:37 -0800)]
system-traffic: Fix typo in IPv6 tests.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agonetdev-linux: Fix warning message.
Thadeu Lima de Souza Cascardo [Mon, 15 Feb 2016 17:14:21 +0000 (15:14 -0200)]
netdev-linux: Fix warning message.

Instead of reading

"error receiving Ethernet packet on Permission denied: ens3",

it should read

"error receiving Ethernet packet on ens3: Permission denied".

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agonetlink-socket: return correct error code when connect fails
Thadeu Lima de Souza Cascardo [Mon, 15 Feb 2016 17:13:30 +0000 (15:13 -0200)]
netlink-socket: return correct error code when connect fails

When connect and other calls fail after get_socket_rcvbuf, the return code would
be the rcvbuf size, not errno from the last call.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
8 years agolib: Remove unused function prototypes
Andy Zhou [Fri, 12 Feb 2016 18:36:51 +0000 (10:36 -0800)]
lib: Remove unused function prototypes

Found by inspection.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agobuild windows: Update OpenSSL download link
Alin Serdean [Thu, 11 Feb 2016 01:12:46 +0000 (01:12 +0000)]
build windows: Update OpenSSL download link

This patch updates the appveyor dowload link for OpenSSL prebuilt binaries.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
8 years agoexpr: Fix memory leak reported by valgrind.
William Tu [Thu, 11 Feb 2016 17:45:08 +0000 (09:45 -0800)]
expr: Fix memory leak reported by valgrind.

Testcase 1728: ovn -- 5-term mixed expression normalization.
    expr_clone_cmp (expr.c:1259)
    expr_clone (expr.c:1284)
    expr_clone_andor (expr.c:1271)
    expr_clone (expr.c:1288)
    expr_normalize_and (expr.c:2137)
    test_tree_shape_exhaustively (test-ovn.c:926)

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Co-authored-by: Daniele Di Proietto <diproiettod@vmware.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
8 years agoexpr: Fix memory leak reported by valgrind.
William Tu [Thu, 11 Feb 2016 17:45:07 +0000 (09:45 -0800)]
expr: Fix memory leak reported by valgrind.

Testcase 1728: ovn -- 5-term mixed expression normalization
Call stack:
    sset_add__ (sset.c:53)
    crush_and_string (expr.c:1725)
    crush_cmps (expr.c:1998)
    expr_sort (expr.c:2050)
    expr_normalize_and (expr.c:2085)

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Co-authored-by: Daniele Di Proietto <diproiettod@vmware.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
8 years agodatapath-windows: Refactor sofware offloads and mss
Alin Serdean [Thu, 11 Feb 2016 01:38:54 +0000 (01:38 +0000)]
datapath-windows: Refactor sofware offloads and mss

The purpose of this patch is to refactor the software offloads found in
the VXLAN and GRE code and also to refactor how the maximmum segment
size for a given NBL is obtained.

This patch introduces two functions OvsApplySWChecksumOnNB and OVSGetTcpMSS.

OVSGetTcpMSS - will return the mss found in a given NBL.

OvsApplySWChecksumOnNB - will compute and set software offloads for a given
                         NBL.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Sorin Vinturis <svinturis at cloudbasesolutions.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agocompiler: Don't require constructor names to be globally unique in MSVC.
Ben Pfaff [Wed, 10 Feb 2016 23:43:22 +0000 (15:43 -0800)]
compiler: Don't require constructor names to be globally unique in MSVC.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agocompiler: Document OVS_CONSTRUCTOR.
Ben Pfaff [Wed, 10 Feb 2016 23:43:21 +0000 (15:43 -0800)]
compiler: Document OVS_CONSTRUCTOR.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agodatapath-windows: Fix small bug in MPLS
Alin Serdean [Thu, 11 Feb 2016 00:14:32 +0000 (00:14 +0000)]
datapath-windows: Fix small bug in MPLS

The keylen is not properly updated in the case of MPLS, directly causing the
hash to be calculated improperly.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoovsdb-server: Eliminating max session limit
andy zhou [Wed, 10 Feb 2016 22:33:45 +0000 (14:33 -0800)]
ovsdb-server: Eliminating max session limit

This patch removes limits on number of concurrent sessions
allowed by ovsdb-server. Historically, it was not an design
goal for OVSDB server to support very high number of sessions.
The imposed limit reflects those design choices.

Work is now underway to improve OVSDB scalability since supporting
large of number of sessions is important for OVN, Removing
this limit makes scalability testing possible.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Han Zhou <zhouhan@gmail.com>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agovlog: Fix windows build.
Russell Bryant [Wed, 10 Feb 2016 22:03:32 +0000 (17:03 -0500)]
vlog: Fix windows build.

A recent change changed this constructor to "init_this_module".  This
breaks the build on windows according to AppVeyor.  Include the module
name in the constructor name to work around the issue.

Fixes: 922fed065e65 ("vlog: Make the most common module reference more direct.")
Signed-off-by: Russell Bryant <russell@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agovlog: Use log_file_mutex to more consistently protect vlog_modules.
Ben Pfaff [Wed, 3 Feb 2016 21:47:25 +0000 (13:47 -0800)]
vlog: Use log_file_mutex to more consistently protect vlog_modules.

This could be beneficial if we ever insert a new module at runtime
(currently we only insert them at startup) and it should have negligible
cost.

Suggested-by: Russell Bryant <russell@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agovlog: Add vlog/close command.
Ben Pfaff [Wed, 3 Feb 2016 21:41:34 +0000 (13:41 -0800)]
vlog: Add vlog/close command.

Requested-by: P R Dinesh
Requested-at: https://github.com/openvswitch/ovs/pull/94
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agovlog: Make the most common module reference more direct.
Ben Pfaff [Wed, 3 Feb 2016 21:21:10 +0000 (13:21 -0800)]
vlog: Make the most common module reference more direct.

Most vlog calls are for the log module owned by the translation unit being
compiled, but this module was referenced indirectly through a pointer
variable.  That seems silly, so this commit changes the code so that the
local vlog module is referred to directly, as &this_module.

We could get rid of the global variables for vlog modules entirely, but
I like getting linker errors when there's a duplicate module name.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agopinctrl: Fix byte order of numeric constant.
Ben Pfaff [Wed, 10 Feb 2016 21:16:47 +0000 (13:16 -0800)]
pinctrl: Fix byte order of numeric constant.

Found by sparse.

Fixes: commit 660f5a61286 ("ovn-controller: Use ofputil_encode_set_config to set the switch config")
Reported-by: Russell Bryant <russell@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agoovn-controller: Use ofputil_encode_set_config to set the switch config
Numan Siddique [Wed, 10 Feb 2016 20:18:58 +0000 (12:18 -0800)]
ovn-controller: Use ofputil_encode_set_config to set the switch config

This is cleaner.

Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agopinctrl: Fix decoding of OFPT_GET_CONFIG_REPLY messages.
Ben Pfaff [Wed, 10 Feb 2016 20:18:46 +0000 (12:18 -0800)]
pinctrl: Fix decoding of OFPT_GET_CONFIG_REPLY messages.

Fixes: ad99e2ed49 (Better abstract OFPT_SET_CONFIG and OFPT_GET_CONFIG_REPLY, make stricter.)
Reported-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoovsdb-client: Fix memory leak reported by valgind.
William Tu [Tue, 9 Feb 2016 22:31:16 +0000 (14:31 -0800)]
ovsdb-client: Fix memory leak reported by valgind.

Testcase 1429: ovsdb-server/add-db and remove-db.
    xmemdup0 (util.c:142)
    main (ovsdb-client.c:133)

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agotest-ovsdb: Fix memory leak reported by valgrind.
William Tu [Tue, 9 Feb 2016 22:15:13 +0000 (14:15 -0800)]
test-ovsdb: Fix memory leak reported by valgrind.

Testcase 1314: UUID-distinct queries on scalars.
Call stacks:
    allocate_row (row.c:37)
    ovsdb_row_clone (row.c:67)
    do_query_distinct (test-ovsdb.c:1232)
    ovs_cmdl_run_command (command-line.c:121)
    main (test-ovsdb.c:72)

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoovn: Support ingress policing settings for VIFs.
Ben Pfaff [Wed, 10 Feb 2016 19:09:12 +0000 (11:09 -0800)]
ovn: Support ingress policing settings for VIFs.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Co-authored-by: Babu Shanmugam <bschanmu@redhat.com>
Signed-off-by: Babu Shanmugam <bschanmu@redhat.com>
8 years agotest-ovn: Add help output for parse-actions command.
Ben Pfaff [Wed, 10 Feb 2016 05:08:13 +0000 (21:08 -0800)]
test-ovn: Add help output for parse-actions command.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agodist-docs: Convert tabs to spaces.
Russell Bryant [Tue, 9 Feb 2016 17:53:42 +0000 (12:53 -0500)]
dist-docs: Convert tabs to spaces.

This file used mixed indentation.  Convert the tabs to spaces for
consistency.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agodist-docs: Fix relative links.
Russell Bryant [Tue, 9 Feb 2016 17:46:46 +0000 (12:46 -0500)]
dist-docs: Fix relative links.

There are some relative links designed to work on github.  These links
are broken within dist-docs.  Adding a symbolic link from the original
filename to the plain text version makes these links work within
dist-docs.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agodist-docs: Install plaintext files properly.
Ben Pfaff [Tue, 9 Feb 2016 04:18:35 +0000 (20:18 -0800)]
dist-docs: Install plaintext files properly.

We shouldn't try to treat every file as Markdown.

Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agodist-docs: Make GNU make aware of sub-make.
Ben Pfaff [Tue, 9 Feb 2016 04:18:34 +0000 (20:18 -0800)]
dist-docs: Make GNU make aware of sub-make.

When GNU make sees that a command to be executed contains the string
$(MAKE), it makes the jobserver that limits parallelism available to
the command.  Otherwise, any sub-make that executes sees that
parallelism is enabled but does not have access to the jobserver, so
it prints a warning and turns off parallel job execution.

This also makes the dist-docs process run the same "make" that is
executed at the top level, in case that's different from the default
"make" found in $PATH.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agodist-docs: Include Documentation/ in dist-docs.
Russell Bryant [Mon, 8 Feb 2016 17:12:41 +0000 (12:12 -0500)]
dist-docs: Include Documentation/ in dist-docs.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agosset: Make sset iteration check the type of the nodes it's iterating.
Ben Pfaff [Tue, 9 Feb 2016 00:52:44 +0000 (16:52 -0800)]
sset: Make sset iteration check the type of the nodes it's iterating.

Without this additional check, SSET_FOR_EACH is happy to iterate over any
type that has a struct hmap member named 'map'.  We have a number of these:
hmapx, shash, simap, and smap, in addition to sset.

I guess another approach would be give each of these a unique member name,
but the short name 'map' is nice too.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agoutil: New macro BUILD_ASSERT_TYPE.
Ben Pfaff [Tue, 9 Feb 2016 00:52:43 +0000 (16:52 -0800)]
util: New macro BUILD_ASSERT_TYPE.

I intend to make further use of this in upcoming commits.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
8 years agonetdev: Free packets in netdev_send() for devices that don't support send.
Ben Pfaff [Tue, 9 Feb 2016 06:42:50 +0000 (22:42 -0800)]
netdev: Free packets in netdev_send() for devices that don't support send.

This manifested as a memory leak in test 898 "ofproto-dpif - sFlow packet
sampling - tunnel set", which included an output to a tunnel vport that
doesn't have an implementation of netdev_send().

Reported-by: William Tu <u9012063@gmail.com>
Reported-at: http://openvswitch.org/pipermail/dev/2016-February/065873.html
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agomanpages.mk: Remove ovs-benchmark.
Ilya Maximets [Mon, 8 Feb 2016 07:31:48 +0000 (10:31 +0300)]
manpages.mk: Remove ovs-benchmark.

Fixes: e75291417990 ("ovs-benchmark: Remove.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agovtep: Support per-tunnel tunnel key in schema.
Ofer Ben Yacov [Fri, 5 Feb 2016 20:54:57 +0000 (12:54 -0800)]
vtep: Support per-tunnel tunnel key in schema.

Currently the scenario of single logical bridge that use multiple locators
with different tunnel key on each of the locators is not supported.
In order to support much more flexibility in the tunnel settings, we need
to add tunnel key column to the Physical_Locator table.

This patch is needed to support the usage of neutron L2GW as an inter-cloud
gateway. The tunnel key that is set in the logical bridge will be used
'internally' to connect the L2GW to the compute hosts and the key that
is set in the physical locator will be used to connect the L2GW to a
remote L2GW to form a tunnel between 2 clouds. In this case, the
'external' connection will use single 'dst_ip' on all the locators with
different tunnel key for each L2 domain.

The Neutron spec is available here:
https://review.openstack.org/#/c/270786/
The new code depend on the ability to use different keys in multiple
tunnels in the same logical switch.

Signed-off-by: Ofer Ben-Yacov <ofer.benyacov@gmail.com>
[blp@ovn.org added and clarified documentation]
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agonetdev-dpdk: Fix dpdk_watchdog failure to quiesce.
Kevin Traynor [Fri, 5 Feb 2016 17:07:16 +0000 (17:07 +0000)]
netdev-dpdk: Fix dpdk_watchdog failure to quiesce.

Fix issue whereby vhost_thread is waiting for dpdk_watchdog
thread to quiesce and at the same time dpdk_watchdog thread
is waiting for vhost_thread to give up dpdk_mutex.

Reported-by: Patrik Andersson R <patrik.r.andersson@ericsson.com>
Signed-off-by: Patrik Andersson R <patrik.r.andersson@ericsson.com>
Signed-off-by: Kevin Traynor <kevin.traynor@intel.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agoovs-benchmark: Remove.
Ben Pfaff [Sat, 6 Feb 2016 00:00:49 +0000 (16:00 -0800)]
ovs-benchmark: Remove.

This utility was completely broken and no one noticed for the time of a
full release, so I think that's a safe sign that we should remove it.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
8 years agoovsdb-idl: log error in client when db schema does not exist on server
Lance Richardson [Thu, 28 Jan 2016 14:26:55 +0000 (09:26 -0500)]
ovsdb-idl: log error in client when db schema does not exist on server

A common error scenario with OVN is to attempt to use ovn-nbctl when
the OVN databases have not been created in ovsdb-server:
   1. ovn-nbctl sends "get_schema" request for OVN db to ovsdb-server.
   2. ovsdb-server fails to find requested db, sends error response
      to ovn-nbctl.
   3. ovn-nbctl receives the error response in ovsdb_idl_run(), but
      takes no specific action.
   4. ovn-nbctl hangs forever in IDL_S_SCHEMA_REQUESTED state (assuming
      a timeout wasn't requested on the command line).

Add a log message to inform the user of this situation.

Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agorhel: Add '--with dpdk' spec option to build DPDK-enabled packages
Panu Matilainen [Thu, 28 Jan 2016 12:23:52 +0000 (14:23 +0200)]
rhel: Add '--with dpdk' spec option to build DPDK-enabled packages

Requires DPDK >= 2.2 as that is the first version to have a standard
install layout which we can discover without help from user.
Additionally document the option in INSTALL.Fedora.md.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoovs-numa: Fix cpu discovering if CONFIG_NUMA disabled.
Ilya Maximets [Mon, 25 Jan 2016 14:37:19 +0000 (17:37 +0300)]
ovs-numa: Fix cpu discovering if CONFIG_NUMA disabled.

If CONFIG_NUMA disabled in the system, PMD threads can't
be created:

|ovs_numa|INFO|Discovered 0 NUMA nodes and 0 CPU cores

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoovn-controller: Fix typo in comment.
Ben Pfaff [Fri, 5 Feb 2016 22:18:27 +0000 (14:18 -0800)]
ovn-controller: Fix typo in comment.

Too much asss.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Kyle Mestery <mestery@mestery.com>
8 years agoovsdb: Fix typo in libovsdb's pkg-config.
Ansari, Shad [Fri, 22 Jan 2016 20:06:28 +0000 (20:06 +0000)]
ovsdb: Fix typo in libovsdb's pkg-config.

Fix typo in the library name of pkg-config of libovsdb.

Reported-by: Javier Albornz <javier.albornoz@hpe.com>
Signed-off-by: Shad Ansari <shad.ansari@hpe.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agotest-ovsdb: Fix memory leak reported by valgrind.
William Tu [Fri, 22 Jan 2016 21:04:50 +0000 (13:04 -0800)]
test-ovsdb: Fix memory leak reported by valgrind.

Testcase 1311, 1312: Boolean-distinct queries on scalars, reports leak
below:
    xmalloc (util.c:112)
    do_query_distinct (test-ovsdb.c:1208)
    ovs_cmdl_run_command (command-line.c:121)
    main (test-ovsdb.c:72)

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoofproto-macros: Fix definition of add_of_ports.
Ben Pfaff [Fri, 5 Feb 2016 23:30:24 +0000 (15:30 -0800)]
ofproto-macros: Fix definition of add_of_ports.

This definition just didn't work, and caused lots of tests to inadvertently
be effectively skipped.

Fixes: ca5792f0d80ffd (tests: Change ADD_OF_PORTS from macro to shell function.)
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoovs-benchmark: Fix return value of do_poll.
William Tu [Thu, 21 Jan 2016 18:16:23 +0000 (10:16 -0800)]
ovs-benchmark: Fix return value of do_poll.

A positive number is returned when do_poll successes.

Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoofproto-dpif-mirror: Fix bug that flag "need_revalidate" is never reset.
Huanle Han [Fri, 5 Feb 2016 23:43:25 +0000 (15:43 -0800)]
ofproto-dpif-mirror: Fix bug that flag "need_revalidate" is never reset.

Flag "need_revalidate" on mbridge is set to true when an ofbundle
destroy. And it's never reset. It causes the backer revalidate and
the mac learning flush every time 'ofproto_run' is called.

Signed-off-by: Huanle Han <hanxueluo@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoofproto-dpif-xlate: Fix clash between macro argument and struct member name.
Huanle Han [Fri, 15 Jan 2016 15:24:59 +0000 (23:24 +0800)]
ofproto-dpif-xlate: Fix clash between macro argument and struct member name.

Argument name "entries" is same as the member "entries" of xcache.
It will lead to compile error if we pass an argument whose name is
not "entries".

Signed-off-by: Huanle Han <hanxueluo@gmail.com>
8 years agoovsdb-server: fix monitor counters reported by memory/show
Andy Zhou [Thu, 4 Feb 2016 04:57:32 +0000 (20:57 -0800)]
ovsdb-server: fix monitor counters reported by memory/show

Commit 4c2809787cdbc774 (ovsdb-monitor: add json cache) introduced
an optimization that allows jsonrpc session to share monitors.
However, the memory/show implementation was not updated to match the
implementation; it still assumes that each jsonrpc session uses its
own monitor, thus are likely to over reporting the number.

This patch fix the bug and reports the actual number of monitor used
by the ovsdb-server.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agoovs-vswitchd: Preserve datapath ports across graceful shutdown.
Ben Pfaff [Thu, 4 Feb 2016 17:48:54 +0000 (09:48 -0800)]
ovs-vswitchd: Preserve datapath ports across graceful shutdown.

Until now, asking ovs-vswitchd to shut down gracefully, e.g. with
"ovs-appctl exit", would cause it to first remove all the ports from
kernel-based datapaths.  This has the unfortunate side effect that IP
addresses on any removed "internal" ports are lost, even if the ports are
added again when ovs-vswitchd is restarted.  This is long-standing
behavior, but it only became important when the OVS control scripts were
changed to try to do graceful shutdown first instead of using a signal.

This commit changes graceful shutdown so that it leaves ports in the
datapath, fixing the problem.

Fixes: 9b5422a98f8 (ovs-lib: Try to call exit before killing.)
Reported-by: Edgar Cantu <eocantu@us.ibm.com>
Reported-at: http://openvswitch.org/pipermail/discuss/2016-January/020024.html
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Gurucharan Shetty <guru@ovn.org>
8 years agolib/ovs-thread: Ensure that thread stacks are always at least 512 kB.
Alexandru Ardelean [Thu, 4 Feb 2016 07:20:34 +0000 (09:20 +0200)]
lib/ovs-thread: Ensure that thread stacks are always at least 512 kB.

This makes a difference for libc implementations (such as musl libc) that
have a really small default pthread stack size.

Will reference this discussion:
http://patchwork.ozlabs.org/patch/572340/

Reported-by: Robert McKay <robert@mckay.com>
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
[blp@ovn.org made style changes]
Signed-off-by: Ben Pfaff <blp@ovn.org>
8 years agoovn-northd: Revert "ovn-northd: Only run idl loop if something changed"
Numan Siddique [Thu, 4 Feb 2016 14:41:31 +0000 (20:11 +0530)]
ovn-northd: Revert "ovn-northd: Only run idl loop if something changed"

This reverts f20396e051ea4fd623bfc022cc78d9bd52a850e5

f20396e.. was required to fix the failing ovn-sbctl testsuites.
commit fb496f92ca1eeead8760b5cdfd857165f64deadf addresses these failing
test cases in a proper way.

With commit f20396e.. its possible that commit to the southbound db is
delayed. When ovnnb_db_run is called, and if ctx->ovnsb_txn is NULL,
ovnnb_db_run returns immediately without generating the logical flows.
ovnnb_db_run is not called again until the northbound db seqno changes.

Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
8 years agodpif-netdev: Allow different numbers of rx queues for different ports.
Ilya Maximets [Thu, 21 Jan 2016 14:15:18 +0000 (17:15 +0300)]
dpif-netdev: Allow different numbers of rx queues for different ports.

Currently, all of the PMD netdevs can only have the same number of
rx queues, which is specified in other_config:n-dpdk-rxqs.

Fix that by introducing of new option for PMD interfaces: 'n_rxq', which
specifies the maximum number of rx queues to be created for this
interface.

Example:
ovs-vsctl set Interface dpdk0 options:n_rxq=8

Old 'other_config:n-dpdk-rxqs' deleted.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Ben Pfaff <blp@ovn.org>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agotravis: Update kernel matrix.
Joe Stringer [Thu, 24 Dec 2015 19:46:42 +0000 (11:46 -0800)]
travis: Update kernel matrix.

Remove v4.2 as it is EOL; Add v4.3 as we support this version in
OVS-2.5. Update other versions to the latest listed on kernel.org.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agodatapath: Re-designate OVS_FRAGMENT_BACKPORT.
Joe Stringer [Thu, 24 Dec 2015 21:09:38 +0000 (13:09 -0800)]
datapath: Re-designate OVS_FRAGMENT_BACKPORT.

Typically the way that we include backported code is by testing for
existence of the feature in the upstream codebase via header checks,
then attempt to use the upstream code as much as possible. However, for
the IP fragmentation handling backport we have an additional constraint
which is that we cannot support kernels older than Linux-3.10.

To date, OVS_FRAGMENT_BACKPORT has been defined to include the backport
of the IP fragmentation code for all kernels from 3.10 to 4.2, rather
than attempting to use the upstream code as much as possible. This patch
relaxes OVS_FRAGMENT_BACKPORT to only check the lower bound so that the
upstream code may be used in more circumstances.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agocompat: Detect and use upstream ip_fragment().
Joe Stringer [Tue, 2 Feb 2016 23:19:02 +0000 (15:19 -0800)]
compat: Detect and use upstream ip_fragment().

Previously a version check was used to determine whether the upstream
ip_fragment() should be used or the backported version. The actual test
is for whether upstream commit d6b915e29f4a ("ip_fragment: don't forward
defragmented DF packet") is present, so test for that instead.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agocompat: Detect and use inet_frag_queue->list_evictor.
Joe Stringer [Thu, 24 Dec 2015 18:41:35 +0000 (10:41 -0800)]
compat: Detect and use inet_frag_queue->list_evictor.

Kernels 3.17 to 4.2 have a work queue to evict old fragments, but do not
track these fragments in an eviction list. On these kernels, we detect
the absence of the list_evictor and provide one. This commit fixes the
reliance on kernel versions in the case that this functionality is
backported.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agocompat: Rename OVS frag caches.
Joe Stringer [Tue, 2 Feb 2016 23:19:00 +0000 (15:19 -0800)]
compat: Rename OVS frag caches.

These should not have the same name as the upstream ones, to reduce
confusion when they are created. Rename them.

Suggested-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agodatapath: Fix kernel-4.3 build.
Joe Stringer [Tue, 2 Feb 2016 23:18:59 +0000 (15:18 -0800)]
datapath: Fix kernel-4.3 build.

Commit 792e5ed750ce ("datapath: inet: frag: Always orphan skbs inside
ip_defrag().") broke the build for OVS backport against kernel-4.3. Fix
the build.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
8 years agocmap: Explain corner case in CMAP_FOR_EACH comment.
Daniele Di Proietto [Wed, 3 Feb 2016 04:55:48 +0000 (20:55 -0800)]
cmap: Explain corner case in CMAP_FOR_EACH comment.

Commit d916785ce98c("dpif-netdev: Fix improper use of CMAP_FOR_EACH.")
fixes a problem that's worth documenting.

Requested-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agobridge: Do not add bridges with '/' in name.
Daniele Di Proietto [Tue, 2 Feb 2016 21:28:11 +0000 (13:28 -0800)]
bridge: Do not add bridges with '/' in name.

This effectively stops vswitchd from creating bridges with '/' in the
name. OVS used to print a warning but the bridge was created anyway.

This restriction is implemented because the bridge name is part of a
filesystem path.

This check is no substitute for Mandatory Access Control, but it
certainly helps to catch the error early.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
[blp@ovn.org added a test]
Acked-by: Ben Pfaff <blp@ovn.org>
8 years agodpif: Allow adding ukeys for same flow by different pmds.
Ilya Maximets [Wed, 3 Feb 2016 11:31:43 +0000 (14:31 +0300)]
dpif: Allow adding ukeys for same flow by different pmds.

In multiqueue mode several pmd threads may process one port, but
different queues. Flow may not depend on queue. It's true at least for
vhost-user ports.

When multiple pmd threads attempt to process upcalls for a particular
flow key, only the first will succeed. Any subsequent threads will
receive error = ENOSPC when attempting to insert a new udpif_key into
the umaps. This causes the latter threads to never insert a flow into
the datapath to handle the traffic, and as a result they will
consistently execute those flows through the slow path.

Fix that by mixing pmd_id with the bits from the ufid for ukey->hash
calculation. So, for a given flow key/UFID, each pmd thread will create
an independent udpif_key.

This also opens the possibility to reassign queues among pmd threads
without restarting them and deleting the megaflow cache.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
8 years agovlog: Stop using explicit references to external log modules.
Ben Pfaff [Wed, 3 Feb 2016 21:15:48 +0000 (13:15 -0800)]
vlog: Stop using explicit references to external log modules.

It's always risky to write "extern" declarations outside a header file,
since there's no way to ensure the type of what's being referenced is
correct.  In these cases, we can easily avoid the extern reference, so do
so.

There is a little tradeoff here, in that referring to the log modules
through strings means that we catch an incorrect module name at runtime
instead of at link time, but I think that the risk here is minimal because
the mistake will be found by every test in "make check" that runs any of
the utilities, since they make these calls as one of their first tasks
during initialization.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agovlog: Simplify module definition.
Ben Pfaff [Wed, 3 Feb 2016 23:18:33 +0000 (15:18 -0800)]
vlog: Simplify module definition.

Until now, vlog had a macro VLOG_DEFINE_THIS_MODULE, which expanded using
VLOG_DEFINE_MODULE, which expanded using VLOG_DEFINE_MODULE__, and the
latter macros didn't have any other users.  This commit combines them for
clarity.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
8 years agovlog: Make 'vlog_modules' private to vlog.c.
Ben Pfaff [Wed, 3 Feb 2016 20:23:36 +0000 (12:23 -0800)]
vlog: Make 'vlog_modules' private to vlog.c.

I think we once used this variable from an inline function in vlog.h, so
that we had to make it "extern", but these days it's only used from vlog.c,
so it can be static now.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>