cascardo/ovs.git
8 years agoovs-ofctl: Document missing shorthand notations.
Justin Pettit [Mon, 24 Aug 2015 22:22:12 +0000 (15:22 -0700)]
ovs-ofctl: Document missing shorthand notations.

Some new shorthands were added to ovs-ofctl, but not documented in the
man page.  This adds most of them.  A couple were left out that would
print differently than they would be input.  For example, we accept
"ip6" and "ipv6", but we would output it as "ipv6", so "ip6" is not
documented.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn: Fix example in comment in expr.c.
Justin Pettit [Sat, 22 Aug 2015 20:02:02 +0000 (13:02 -0700)]
ovn: Fix example in comment in expr.c.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agodatapath: Make 100 percents packets sampled when sampling rate is 1.
Wenyu Zhang [Tue, 25 Aug 2015 03:56:44 +0000 (20:56 -0700)]
datapath: Make 100 percents packets sampled when sampling rate is 1.

When sampling rate is 1, the sampling probability is UINT32_MAX. The packet
should be sampled even the prandom32() generate the number of UINT32_MAX.
And none packet need be sampled when the probability is 0.

Signed-off-by: Wenyu Zhang <wenyuz@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: e05176a3283 ("openvswitch: Make 100 percents packets
sampled when sampling rate is 1.")

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
8 years agoofp-print: Fix redundant expression.
Joe Stringer [Wed, 5 Aug 2015 20:31:25 +0000 (13:31 -0700)]
ofp-print: Fix redundant expression.

'features' is always a valid pointer to something on the stack, so
checking (!features || ...) is the same as checking (false || ...).
Simplify the expression.

Found by MIT STACK undefined behaviour checker.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoSet release dates for 2.4.0.
Justin Pettit [Fri, 21 Aug 2015 00:23:56 +0000 (17:23 -0700)]
Set release dates for 2.4.0.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agodocs: Fix typo in README-native-tunneling.md
Wei li [Mon, 24 Aug 2015 00:30:27 +0000 (08:30 +0800)]
docs: Fix typo in README-native-tunneling.md

Signed-off-by: Wei li <liw@dtdream.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoovn-controller-vtep.at: Remove all 'Broken pipe' warning logs from
Alex Wang [Sat, 22 Aug 2015 16:26:54 +0000 (09:26 -0700)]
ovn-controller-vtep.at: Remove all 'Broken pipe' warning logs from
ovsdb-server.log.

This commit makes the OVN_CONTROLLER_VTEP_STOP remove all 'Broken pipe'
warning logs from ovsdb-server.log before running 'check_log'.  This is in
that *ctl command (e.g. ovn-nbctl) exits right after committing the change
to database;  however, in reaction, some daemon (e.g. ovn-controller-vtep)
may immediately update the database;  this later update may cause database
sending update back to *ctl command if *ctl has not proceeded to exit yet;
and if *ctl command exits before database calling send, the send will fail
with 'Broken pipe' error.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoofp-util: For OF1.0, don't wildcard PCP field when 802.1Q header absent.
Ben Pfaff [Fri, 21 Aug 2015 00:07:40 +0000 (17:07 -0700)]
ofp-util: For OF1.0, don't wildcard PCP field when 802.1Q header absent.

OpenFlow 1.0.1 says:

    The dl_vlan_pcp field must be ignored when the OFPFW_DL_VLAN wildcard
    bit is set or when the dl_vlan value is set to OFP_VLAN_NONE.  Fields
    that are ignored don’t need to be wildcarded and should be set to 0.

Previously, OVS wildcarded the PCP field when dl_vlan was OFP_VLAN_NONE,
but this commit changes the behavior to that suggested above: the PCP
field should not be wildcarded (and should be set to 0, but the code
already did that).

This commit only changes the translation from OVS's internal flow format
to the OpenFlow 1.0 wire format.  Translation in the other direction and
to other formats is unaffected.

Found by OFTest.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agoovn: Add bootstrap options for OVN controllers.
Gurucharan Shetty [Wed, 19 Aug 2015 22:55:21 +0000 (15:55 -0700)]
ovn: Add bootstrap options for OVN controllers.

This lets the central controller to push
its certificate to the OVN controllers.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoovsdb-server: Add the ability to push peer-cert.
Gurucharan Shetty [Wed, 19 Aug 2015 22:42:07 +0000 (15:42 -0700)]
ovsdb-server: Add the ability to push peer-cert.

In OVN, ovsdb-server is the daemon that manages the databases
and can be called as the central controller. So it would be
nice for ovsdb-server to be able to push its self-signed
certificate to all the other nodes where ovn-controller runs.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoovs-sandbox: Add support for ovn-controller-vtep.
Russell Bryant [Fri, 21 Aug 2015 17:42:18 +0000 (13:42 -0400)]
ovs-sandbox: Add support for ovn-controller-vtep.

When ovs-sandbox is run with ovn enabled, create the vtep database and
run ovn-controller-vtep.  This lets you do some basic testing with
ovn-controller-vtep.  For example:

    $ make sandbox SANDBOXFLAGS="--ovn"
    $ vtep-ctl add-ps ps0

After those commands, you can see that ovn-controller-vtep added a
Chassis row to OVN_Southbound for the physical switch.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoovs-vsctl: Add the missing ssl bootstrapping option parsing.
Gurucharan Shetty [Wed, 19 Aug 2015 16:21:04 +0000 (09:21 -0700)]
ovs-vsctl: Add the missing ssl bootstrapping option parsing.

'man ovs-vsctl' mentions that ovs-vsctl can bootstrap itself
by getting the certificate from the server. But the option
was never parsed in the code.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agotun-metadata: Always set option present when copying data.
Jesse Gross [Wed, 12 Aug 2015 01:46:14 +0000 (18:46 -0700)]
tun-metadata: Always set option present when copying data.

Whenever we write into a tunnel option field, we also need to mark
it as significant. If we don't, then the data will later be ignored.

We currently do this in every case except for flow metadata. This causes
us to not correctly serialize the tunnel metadata for Packet Ins to the
controller.

Rather than separately writing the data and marking the options as present,
it is better to combine the two steps to ensure that one can never be
done without the other.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agohmap: Ensure iterator is NULL after iteration.
Russell Bryant [Tue, 18 Aug 2015 18:43:18 +0000 (11:43 -0700)]
hmap: Ensure iterator is NULL after iteration.

The HMAP_FOR_EACH_()* macros had a usability issue where the iterator
was only NULL at the completion of iteration if the hmap_node was the
first struct member.  This change ensures that the iterator is set to
NULL when iteration ends normally without a 'break'.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agotest-classifier: Add benchmark.
Jarno Rajahalme [Fri, 21 Aug 2015 19:49:46 +0000 (12:49 -0700)]
test-classifier: Add benchmark.

Add a benchmark command for classifier lookup performance testing.

Running the test-classifier without arguments of with "--help" will
print the following usage:

usage: ovstest test-classifier benchmark <n_rules> <n_priorities> <n_subtables> <n_threads> <n_lookups>

where:

<n_rules>      - The number of rules to install for lookups.  More rules
                 makes misses less likely.
<n_priorities> - How many different priorities to use.  Using only 1
                 priority will force lookups to continue through all
                 subtables.
<n_subtables>  - Number of subtables to use.  Normally a classifier has
                 rules with different kinds of masks, resulting in
                 multiple subtables (one per mask).  However, in some
                 special cases a table may consist of only one kind of
                 rules, so there will be only one subtable.
<n_threads>    - How many lookup threads to use.  Using one thread should
                 give less variance accross runs, but classifier
                 scaling can be tested with multiple threads.
<n_lookups>    - How many lookups each thread should perform.

For testing the classifier is filled with <n_rules> rules using
<n_subtables> different mask patterns and <n_priorities> different
priorities.  A random set of lookup flows are created, and <n_threads>
lookup threads are spawned to perform <n_lookups> lookups each.  The
count of hits and misses, as well as the overall execution time is
reported.

Example run:

$ tests/ovstest test-classifier benchmark 1000 1 30 1 3800000

Benchmarking with:
1000 rules with 1 priorities in 30 tables, 1 threads doing 3800000 lookups each

Without wildcards:

hits: 461520, misses: 3338480
classifier lookups:    386 ms, 9844559 lookups/sec

With wildcards:

hits: 461520, misses: 3338480
classifier lookups:    866 ms, 4387990 lookups/sec

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agorhel: Define rundir for older distros.
Flavio Leitner [Thu, 13 Aug 2015 18:39:33 +0000 (15:39 -0300)]
rhel: Define rundir for older distros.

Some older distros might not define _rundir yet so in this case the RPM
build breaks.  This patch defines it to Fedora's default.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoovs-ctl: do not attempt to restore flows when called with --delete-bridges
Simon Horman [Thu, 20 Aug 2015 23:45:34 +0000 (16:45 -0700)]
ovs-ctl: do not attempt to restore flows when called with --delete-bridges

When called with --delete-bridges saved flows cannot be restored as the
bridges to which they belong no longer exist. This results in the following
error messages on restart.

ovs-ofctl: br0 is not a bridge or a socket
Restoring saved flows ... failed!

Although there is no effect of this error other than the message
it seems worth avoiding. This patch does so by skipping saving of flows
when --delete-bridges is in effect.

As flows are no longer saved when --delete-bridges is in effect
a side-effect of this change is that restart may be faster when
there are many flows.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agometa-flow: Fix ip_frag handling in mf_set_wild().
Jarno Rajahalme [Thu, 20 Aug 2015 20:10:07 +0000 (13:10 -0700)]
meta-flow: Fix ip_frag handling in mf_set_wild().

The wildcard bits were set when they should have been cleared.

Found by inspection.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoodp-util: Fix put_nd_key().
Jarno Rajahalme [Thu, 20 Aug 2015 20:10:07 +0000 (13:10 -0700)]
odp-util: Fix put_nd_key().

Actually copy the 'nd_target' from the key.

Found by inspection.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agotunneling: Remove gre64 tunnel support.
Pravin B Shelar [Tue, 18 Aug 2015 19:18:47 +0000 (12:18 -0700)]
tunneling: Remove gre64 tunnel support.

GRE64 was introduced to extend gre key from 32-bit to 64-bit using
gre-key and sequence number field. But GRE64 is not standard
protocol. There are not many users of this protocol. Therefore we
have decided to remove it.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
8 years agoovn-controller-vtep.at: Check the successful exit of ovn-controller-vtep.
Alex Wang [Wed, 19 Aug 2015 00:44:07 +0000 (17:44 -0700)]
ovn-controller-vtep.at: Check the successful exit of ovn-controller-vtep.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
8 years agoofp-util: Use correct error for indirect group with more than one bucket.
Ben Pfaff [Mon, 25 May 2015 22:35:53 +0000 (15:35 -0700)]
ofp-util: Use correct error for indirect group with more than one bucket.

OpenFlow 1.5 says:

    If the group-mod request specifies more than one bucket for a group of
    type Indirect, the switch must refuse to add the group entry and must
    send an ofp_error_msg with OFPET_GROUP_MOD_FAILED type and
    OFPGMFC_INVALID_GROUP code.

Older versions don't specify a particular error for this case, so we might
as well use it for older OpenFlow also.

Found by OFTest.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agoovn: Add comments to encourage syncing MFF_LOG_* with documentation.
Ben Pfaff [Wed, 19 Aug 2015 18:53:04 +0000 (11:53 -0700)]
ovn: Add comments to encourage syncing MFF_LOG_* with documentation.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-sbctl: Avoid cast in lflow_cmp().
Ben Pfaff [Wed, 19 Aug 2015 19:11:38 +0000 (12:11 -0700)]
ovn-sbctl: Avoid cast in lflow_cmp().

Using casts, IMO, makes it harder to spot what's actually going on.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agosystem-traffic: Add basic vxlan tunnel sanity test.
Joe Stringer [Wed, 12 Aug 2015 21:01:30 +0000 (14:01 -0700)]
system-traffic: Add basic vxlan tunnel sanity test.

This test is skipped if the 'ip' command cannot interpret the vxlan 'dstport'
option; this is used as a proxy for detecting native kernel support for this
tunnel type.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agosystem-macros: Don't explicitly remove bridge.
Joe Stringer [Wed, 12 Aug 2015 21:01:29 +0000 (14:01 -0700)]
system-macros: Don't explicitly remove bridge.

Depending on the kernel in use, manually removing a bridge during
OVS_VSWITCHD_STOP can cause the kernel to send a route update that
refers to the bridge device which is being deleted. OVS can't make sense
of these messages, resulting in logs like the following:

route_table|DBG|Could not find interface name[702]: No such device or
address
netlink_notifier|WARN|received bad netlink message

One such example kernel is the Ubuntu 3.16.0-33-generic linux package.

The bridge doesn't need to be explicitly removed, as the OVSDB
configuration for each test will be cleared before executing the next.
Drop this extra step.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agosystem-macros: Create ADD_BR variant.
Joe Stringer [Wed, 12 Aug 2015 21:01:28 +0000 (14:01 -0700)]
system-macros: Create ADD_BR variant.

This patch splits ADD_BR into two commands, so they can be used from
different contexts:

ADD_BR(...) is a standalone command to add a bridge to OVS, and allows
additional ovs-vsctl arguments to be passed. It uses _ADD_BR().
_ADD_BR(...) is the implementation-specific ovs-vsctl arguments to
set up the correct datapath type for userspace or kmod tests.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agosystem-traffic: Check ping-by-ping output.
Joe Stringer [Wed, 12 Aug 2015 21:01:27 +0000 (14:01 -0700)]
system-traffic: Check ping-by-ping output.

Rather than saving all of the ping output to a file then checking at the
end, check each ping and fail as soon as there is a connectivity
failure.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agosystem-common-macros: Allow quotes in NS_EXEC().
Joe Stringer [Wed, 12 Aug 2015 21:01:26 +0000 (14:01 -0700)]
system-common-macros: Allow quotes in NS_EXEC().

This allows arbitrary commands to be passed into the NS_EXEC macro to be
executed within a namespace, including commands that have quotes and
commands chained together.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agoovn: Free default db befor exit.
Russell Bryant [Tue, 18 Aug 2015 18:26:21 +0000 (11:26 -0700)]
ovn: Free default db befor exit.

The static result of default_db() was malloc'd but not freed before
exit.  Make the static result global and free it before exit.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Acked-by: Alex Wang <alexw@nicira.com>
8 years agoovn-controller-vtep: Make 'ovnsb_remote' and 'vtep_remote' free-able.
Alex Wang [Tue, 18 Aug 2015 06:12:55 +0000 (23:12 -0700)]
ovn-controller-vtep: Make 'ovnsb_remote' and 'vtep_remote' free-able.

Found by inspection.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-controller-vtep: Call binding_cleanup() before gateway_cleanup().
Alex Wang [Tue, 18 Aug 2015 06:09:57 +0000 (23:09 -0700)]
ovn-controller-vtep: Call binding_cleanup() before gateway_cleanup().

Otherwise, binding_cleanup() will be a no-op since all related chassis
entries are deleted in gateway_cleanup().

Found by inspection.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-controller-vtep: Fix dereference of NULL pointer.
Alex Wang [Tue, 18 Aug 2015 06:02:14 +0000 (23:02 -0700)]
ovn-controller-vtep: Fix dereference of NULL pointer.

Found by inspection.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-northd: Ability to detach on Windows.
Gurucharan Shetty [Mon, 17 Aug 2015 21:54:16 +0000 (14:54 -0700)]
ovn-northd: Ability to detach on Windows.

A unit test for ovn-northd was hanging because ovn-northd
running on Windows failed to detach. The detach function
for Windows is implemented inside "service_start()".

Also handle Windows services.

Reported-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
8 years agodatapath: Fix L4 checksum handling when dealing with IP fragments
Glenn Griffin [Mon, 17 Aug 2015 14:50:51 +0000 (07:50 -0700)]
datapath: Fix L4 checksum handling when dealing with IP fragments

openvswitch modifies the L4 checksum of a packet when modifying
the ip address. When an IP packet is fragmented only the first
fragment contains an L4 header and checksum. Prior to this change
openvswitch would modify all fragments, modifying application data
in non-first fragments, causing checksum failures in the
reassembled packet.

Signed-off-by: Glenn Griffin <ggriffin.kernel@gmail.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: 3576fd794b3 ("openvswitch: Fix L4 checksum handling when
dealing with IP fragments").

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
8 years agodatapath: allocate nr_node_ids flow_stats instead of num_possible_nodes
Chris J Arges [Mon, 17 Aug 2015 14:40:43 +0000 (07:40 -0700)]
datapath: allocate nr_node_ids flow_stats instead of num_possible_nodes

Some architectures like POWER can have a NUMA node_possible_map that
contains sparse entries. This causes memory corruption with openvswitch
since it allocates flow_cache with a multiple of num_possible_nodes() and
assumes the node variable returned by for_each_node will index into
flow->stats[node].

Use nr_node_ids to allocate a maximal sparse array instead of
num_possible_nodes().

The crash was noticed after 3af229f2 was applied as it changed the
node_possible_map to match node_online_map on boot.
Fixes: 3af229f2071f5b5cb31664be6109561fbe19c861

Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: bac541e4631 ("openvswitch: allocate nr_node_ids flow_stats
instead of num_possible_nodes")

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
8 years agodatapath: disable LRO
Jiri Benc [Mon, 17 Aug 2015 14:38:01 +0000 (07:38 -0700)]
datapath: disable LRO

Currently, openvswitch tries to disable LRO from the user space. This does
not work correctly when the device added is a vlan interface, though.
Instead of dealing with possibly complex stacked cross name space relations
in the user space, do the same as bridging does and call dev_disable_lro in
the kernel.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Upstream: 640b2b107c ("openvswitch: disable LRO").

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
8 years agoovn-controller-vtep.at: Skip test when using Windows setup.
Alex Wang [Mon, 17 Aug 2015 22:04:50 +0000 (15:04 -0700)]
ovn-controller-vtep.at: Skip test when using Windows setup.

The 'ovs-vtep' simulator is not ported to Windows.  So, for now,
just skip all tests in ovn-controller-vtep.at when running in
Windows.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Gurucharan Shetty <gshetty@nicira.com>
8 years agoovn-controller-vtep: Add binding module.
Alex Wang [Sat, 4 Jul 2015 05:55:24 +0000 (22:55 -0700)]
ovn-controller-vtep: Add binding module.

This commit adds the binding module to ovn-controller-vtep.  The
module will scan through the Port_Binding table in ovnsb.  If there is
a port binding entry for a logical switch on the vtep gateway chassis's
"vtep_logical_switches", sets the port binding's chassis column to the
vtep gateway chassis.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-controller-vtep.at: Fix intermittent test failure.
Alex Wang [Sun, 16 Aug 2015 07:06:24 +0000 (00:06 -0700)]
ovn-controller-vtep.at: Fix intermittent test failure.

When testing the recreation of 'chassis' table entry by 'ovn-controller-
vtep'.  The removal of 'chassis' table entry by the 'ovn-sbctl' could
cause 'Broken pipe' warning in ovsdb-server.log.  This is due to the
race between 'ovn-sbctl' exiting and 'ovn-controller-vtep' adding
the chassis back.  So, if the 'ovn-sbctl' exits right when the
ovsdb-server tries to send update of readd of the deleted 'chassis',
the sending will fail with 'Broken pipe' error.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-sbctl: Make 'chassis-del' delete all encaps.
Alex Wang [Sun, 16 Aug 2015 06:52:42 +0000 (23:52 -0700)]
ovn-sbctl: Make 'chassis-del' delete all encaps.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-controller-vtep.at: Fix intermittent test failure.
Alex Wang [Sun, 16 Aug 2015 06:44:45 +0000 (23:44 -0700)]
ovn-controller-vtep.at: Fix intermittent test failure.

The test waits until grep no vlan '200' from the VTEP 'vlan_binding'
column.  However, string '200' could also appear in other 'vlan_binding'
entry's uuid value.  Instead, we should grep for '200='.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agorhel: add installed but not packaged OVN tools
Flavio Leitner [Thu, 13 Aug 2015 19:06:29 +0000 (16:06 -0300)]
rhel: add installed but not packaged OVN tools

This patch adds the following to OVN %files:
   /usr/bin/ovn-controller-vtep
   /usr/bin/ovn-sbctl
   /usr/share/man/man8/ovn-controller-vtep.8.gz
   /usr/share/man/man8/ovn-sbctl.8.gz

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoflow: Ignore invalid ICMPv6 fields when parsing packets
Simon Horman [Thu, 13 Aug 2015 07:55:32 +0000 (16:55 +0900)]
flow: Ignore invalid ICMPv6 fields when parsing packets

There is a miss-match between the handling of invalid ICMPv6 fields in the
implementations of parse_icmpv6() in user-space and in the kernel datapath.

This patch addresses that by modifying the user-space implementation to
match that of the kernel datapath; processing is terminated without
rather than with an error and partial information is cleared.

With these changes the user-space implementation of parse_icmpv6()
never returns an error. Accordingly the return type and caller have been
updated.

The original motivation for this is to allow matching the ICMPv6 type and
code of packets with invalid neighbour discovery options although only the
change around the '(!opt_len || opt_len > *sizep)' conditional is necessary
to achieve that goal.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
8 years agoofproto: Allow in-place modifications of datapath flows.
Ethan Jackson [Tue, 4 Aug 2015 01:43:53 +0000 (18:43 -0700)]
ofproto: Allow in-place modifications of datapath flows.

There are certain use cases (such as bond rebalancing) where a
datapath flow's actions may change, while it's wildcard pattern
remains the same.  Before this patch, revalidators would note the
change, delete the flow, and wait for the handlers to install an
updated version.  This is inefficient, as many packets could get
punted to userspace before the new flow is finally installed.

To improve the situation, this patch implements in place modification
of datapath flows.  If the revalidators detect the only change to a
given ukey is its actions, instead of deleting it, it does a put with
the MODIFY flag set.

Signed-off-by: Ethan J. Jackson <ethan@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agoofproto-dpif-upcall: Make ukey actions modifiable with RCU.
Ethan Jackson [Wed, 12 Aug 2015 21:50:54 +0000 (14:50 -0700)]
ofproto-dpif-upcall: Make ukey actions modifiable with RCU.

Future patches will need to modify ukey actions in some instances.
This patch makes this possible by protecting them with RCU.  It also
adds thread safety checks to enforce the new protection mechanism.

Signed-off-by: Ethan J. Jackson <ethan@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agodb-ctl-base: Allow print rows that weak reference to table in
Alex Wang [Thu, 13 Aug 2015 04:29:06 +0000 (21:29 -0700)]
db-ctl-base: Allow print rows that weak reference to table in
'cmd_show_table'.

Sometimes, it is desirable to print the table with weak reference to
the table specified in 'struct cmd_show_table'.  For example the
Port_Binding table rows in OVN_Southbound database that refer to the
same Chassis table row can be printed under the same chassis entry
in 'ovn-sbctl show' output.

To achieve it, this commit adds a new struct in 'struct cmd_show_table'
that allows users to print a table with weak reference to 'table'
specified in 'struct cmd_show_table'.  The 'ovn-sbctl' which now prints
the Port_Binding entries with Chassis table, is the first user of this
new feature.

Requested-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
8 years agoovn-sbctl: Print stage name in addition to table number.
Justin Pettit [Thu, 13 Aug 2015 00:42:14 +0000 (17:42 -0700)]
ovn-sbctl: Print stage name in addition to table number.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
8 years agoovn-northd: Store name of the logical flow stage in external-ids.
Justin Pettit [Wed, 12 Aug 2015 23:40:59 +0000 (16:40 -0700)]
ovn-northd: Store name of the logical flow stage in external-ids.

This will be useful in a future commit.

It also introduces #define's for logical stages instead of in-place
constants.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
8 years agoclassifier: Do not use mf_value.
Jarno Rajahalme [Thu, 13 Aug 2015 00:03:07 +0000 (17:03 -0700)]
classifier: Do not use mf_value.

mf_value has grown bigger than needed for storing the biggest
supported prefix (IPv6 address length).  Define a new type to be used
instead of mf_value.

This makes classifier lookups a bit faster.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
8 years agoovn: Add lflow-list to ovn-sbctl.
Russell Bryant [Wed, 12 Aug 2015 23:53:09 +0000 (16:53 -0700)]
ovn: Add lflow-list to ovn-sbctl.

I frequently view the contents of the Logical_Flow table while working
on OVN.  Add a command that can output the contents of this table in a
sorted way that makes it easier to read through.  It's sorted by
logical datapath, pipeline, table id, priority, and match.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Acked-by: Alex Wang <alexw@nicira.com>
8 years agoclassifier: Simplify minimask_hash().
Jarno Rajahalme [Wed, 12 Aug 2015 23:00:49 +0000 (16:00 -0700)]
classifier: Simplify minimask_hash().

minimask_hash() can be simplified as each value is known to be non-zero.

Move miniflow_hash() into test-classifier.c as miniflow_hash__() as it
is no longer needed elsewhere.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
8 years agoclassifier: Remove unused hash functions.
Jarno Rajahalme [Wed, 12 Aug 2015 23:00:49 +0000 (16:00 -0700)]
classifier: Remove unused hash functions.

Remove unused cls_rule_hash() and minimatch_hash() functions.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
8 years agoflow: Avoid compile errors.
Jarno Rajahalme [Wed, 12 Aug 2015 23:00:48 +0000 (16:00 -0700)]
flow: Avoid compile errors.

GCC (4.7) sees too wide shifts when there are none, refactor to
circumvent the false error.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
8 years agoclassifier: Fix comment.
Jarno Rajahalme [Wed, 12 Aug 2015 23:00:48 +0000 (16:00 -0700)]
classifier: Fix comment.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
8 years agosystem-kmod-macros: Fix VSWITCHD_STOP.
Joe Stringer [Fri, 7 Aug 2015 21:00:20 +0000 (14:00 -0700)]
system-kmod-macros: Fix VSWITCHD_STOP.

This was renamed. Surprisingly, the tests still pass without this,
however the extra checks that this command performs were not executed.
Fix the macro definition.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agoofproto-dpif-upcall: Add VLOG_WARN_RL logs for upcall_cb() error.
Alex Wang [Tue, 11 Aug 2015 02:42:20 +0000 (19:42 -0700)]
ofproto-dpif-upcall: Add VLOG_WARN_RL logs for upcall_cb() error.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agoovn-controller-vtep: Add gateway module.
Alex Wang [Sun, 9 Aug 2015 07:02:47 +0000 (00:02 -0700)]
ovn-controller-vtep: Add gateway module.

This commit adds the gateway module to ovn-controller-vtep.  The
module will register the physical switches to ovnsb as chassis and
constantly update the "vtep_logical_switches" column in Chassis table.

Limitation (Recorded in TODO file):

- Do not support reading multiple tunnel ips of physical switch.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovsdb-idl: Move get_initial_snapshot() to ovsdb-idl.
Alex Wang [Tue, 4 Aug 2015 21:49:11 +0000 (14:49 -0700)]
ovsdb-idl: Move get_initial_snapshot() to ovsdb-idl.

The same function is defined in both ovn-controller.c and
ovn-controller-vtep.c, so worth librarizing.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn: Add controller for VTEP gateway.
Alex Wang [Sat, 4 Jul 2015 04:46:51 +0000 (21:46 -0700)]
ovn: Add controller for VTEP gateway.

This commit lays down the foundation for a new controller in OVN, the
ovn-controller-vtep, for controlling the vtep enabled gateways.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-architecture: Document the registers used for logical ports.
Justin Pettit [Fri, 7 Aug 2015 23:05:35 +0000 (16:05 -0700)]
ovn-architecture: Document the registers used for logical ports.

When reviewing the OpenFlow flows generated by ovn-controller, it's nice
to have this information.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoidl-loop: Move idl-loop into ovsdb-idl library.
Alex Wang [Tue, 4 Aug 2015 16:52:26 +0000 (09:52 -0700)]
idl-loop: Move idl-loop into ovsdb-idl library.

idl-loop is needed in implementing other controller (i.e., vtep controller).
So, this commit moves the logic into ovsdb-idl library module.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-northd: Pass logical port type and options to ovn-sb database.
Alex Wang [Tue, 4 Aug 2015 20:41:28 +0000 (13:41 -0700)]
ovn-northd: Pass logical port type and options to ovn-sb database.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-sbctl: Add ovn-sbctl.
Alex Wang [Tue, 9 Jun 2015 17:13:34 +0000 (10:13 -0700)]
ovn-sbctl: Add ovn-sbctl.

This commit adds ovn-sbctl to ovn family by using the db-ctl-base
library.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-nbctl: Move ovn-nbctl to utilities directory.
Alex Wang [Tue, 4 Aug 2015 18:31:22 +0000 (11:31 -0700)]
ovn-nbctl: Move ovn-nbctl to utilities directory.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-sb: Remove the "Gateway" table from the ovn-sb schema.
Alex Wang [Fri, 7 Aug 2015 22:55:32 +0000 (15:55 -0700)]
ovn-sb: Remove the "Gateway" table from the ovn-sb schema.

In a gateway like the VTEP L2 gateway, physical vlans belonging to
the same logical network form a "logical switch".  Each logical switch
has a dedicated tunnel key and will keep records of all MACs learned
from the owned vlans.  So user can just send packet to a "logical
switch" and the gateway will figure out the output port and vlan tag
automatically.

Therefore, it is really not necessary to keep record of the vlan map
for each gateway physical port in the OVN_Southbound database using
"gateway_ports" and to map each vlan to a unique ovn logical port.
Instead, we should simply map each logical switch to a ovn logical
port.

Thusly, this commit removes the "Gateway" table from the OVN_Southbound
database.  In the "Chassis" table, the "gateway_ports" column is replaced
by "vtep_logical_switches" column which stores all vtep logical switch
names.  The use of this column will be documented in later commit.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovn-controller: Fix flows between two local ports.
Justin Pettit [Fri, 7 Aug 2015 22:03:19 +0000 (15:03 -0700)]
ovn-controller: Fix flows between two local ports.

A flow was missing from the remote output table that causes local
packets to be resubmitted to the local ouptut table.

Reported-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoVagrantfile: Add test_ovs_system_userspace provision.
Daniele Di Proietto [Fri, 7 Aug 2015 18:40:37 +0000 (19:40 +0100)]
Vagrantfile: Add test_ovs_system_userspace provision.

Add 'test_ovs_system_userspace' provision.  Command:
        # vagrant provision --provision-with=test_ovs_system_userspace

will run "make check-system-userspace" in the vagrant launched VM.

It may be more convenient to run this tests inside a vm rather than in
the host, because they interact with system networking.

Suggested-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
8 years agotests: Add system-userspace-testsuite.
Daniele Di Proietto [Fri, 7 Aug 2015 18:40:36 +0000 (19:40 +0100)]
tests: Add system-userspace-testsuite.

The new system-userspace-testsuite, which can be launched via
`make check-system-userspace`, reuses the kmod tests on the userspace
datapath.

The userspace datapath is already tested by the main testsuite (and
that's not going to change), but having also the
system-userspace-testsuite has the following advantages:

* More complicated tests are possible: real client and server
  applications can be used.
* The same tests run on both kernel and userspace datapath: this gives
  us an easy way to make sure that the behaviour is consistent (e.g.
  with the upcoming connection tracker integration)

The userspace datapath is able to use system network interfaces via an
AF_PACKET socket.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
8 years agotests: Introduce NS_EXEC and NS_CHECK_EXEC for system tests.
Daniele Di Proietto [Fri, 7 Aug 2015 18:40:35 +0000 (19:40 +0100)]
tests: Introduce NS_EXEC and NS_CHECK_EXEC for system tests.

Instead of repeating every time "ip netns exec ..." it is better to
introduce some macros.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
8 years agotests: Rename kmod-testsuite to system-kmod-testsuite.
Daniele Di Proietto [Fri, 7 Aug 2015 18:40:34 +0000 (19:40 +0100)]
tests: Rename kmod-testsuite to system-kmod-testsuite.

The name makes more sense, especially with the addition of a userspace
system testsuite.  No functional change in this commit.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
8 years agokmod-macros: Don't unload kmod in VSWITCHD_STOP.
Joe Stringer [Wed, 29 Jul 2015 23:28:59 +0000 (16:28 -0700)]
kmod-macros: Don't unload kmod in VSWITCHD_STOP.

We already queue the removal of the kernel module in OVS_VSWITCHD_START,
via an ON_EXIT() call. That command is executed in both the success and
failure cases, so it is unnecessary to unload the kernel module in
OVS_VSWITCHD_STOP.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agokmod-macros: Move some code to traffic-common-macros.
Daniele Di Proietto [Tue, 4 Aug 2015 18:00:16 +0000 (19:00 +0100)]
kmod-macros: Move some code to traffic-common-macros.

These macros will also be used by userspace datapath testing in
following commits. No functional change in this commit.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
8 years agotests: Rename kmod-traffic.at to traffic.at.
Daniele Di Proietto [Fri, 7 Aug 2015 18:08:56 +0000 (11:08 -0700)]
tests: Rename kmod-traffic.at to traffic.at.

The file will be part of two different testsuites: one for the kernel
datapath and another for the userspace datapath.  No functional change
in this commit.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
8 years agoINSTALL.DPDK.md: Add details of XL710 restrictions for DPDK
Ian Stokes [Thu, 6 Aug 2015 15:58:47 +0000 (16:58 +0100)]
INSTALL.DPDK.md: Add details of XL710 restrictions for DPDK

Currently there are restrictions regarding the use of the XL710 network
interface with OVS and DPDK. This patch details those restrictions in
INSTALL.DPDK.md.

Signed-off-by: Ian Stokes <ian.stokes@intel.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
8 years agonetdev-dpdk: Retry tx/rx queue setup until we don't get any failure.
Daniele Di Proietto [Thu, 16 Jul 2015 18:48:24 +0000 (19:48 +0100)]
netdev-dpdk: Retry tx/rx queue setup until we don't get any failure.

It has been observed that some DPDK device (e.g intel xl710) report an
high number of queues but make some of them available only for special
functions (SRIOV).  Therefore the queues will be counted in
rte_eth_dev_info_get(), but rte_eth_tx_queue_setup() will fail.

This commit works around the issue by retrying the device initialization
with a smaller number of queues, if a queue fails to setup.

Reported-by: Ian Stokes <ian.stokes@intel.com>
Tested-by: Ian Stokes <ian.stokes@intel.com>
Acked-by: Kevin Traynor <kevin.traynor@intel.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
8 years agodpif-netdev: Translate Geneve options per-flow, not per-packet.
Jesse Gross [Tue, 30 Jun 2015 01:01:59 +0000 (18:01 -0700)]
dpif-netdev: Translate Geneve options per-flow, not per-packet.

The kernel implementation of Geneve options stores the TLV option
data in the flow exactly as received, without any further parsing.
This is then translated to known options for the purposes of matching
on flow setup (which will then install a datapath flow in the form
the kernel is expecting).

The userspace implementation behaves a little bit differently - it
looks up known options as each packet is received. The reason for this
is there is a much tighter coupling between datapath and flow translation
and the representation is generally expected to be the same. This works
but it incurs work on a per-packet basis that could be done per-flow
instead.

This introduces a small translation step for Geneve packets between
datapath and flow lookup for the userspace datapath in order to
allow the same kind of processing that the kernel does. A side effect
of this is that unknown options are now shown when flows dumped via
ovs-appctl dpif/dump-flows, similar to the kernel.

There is a second benefit to this as well: for some operations it is
preferable to keep the options exactly as they were received on the wire,
which this enables. One example is that for packets that are executed from
ofproto-dpif-upcall to the datapath, this avoids the translation of
Geneve metadata. Since this conversion is potentially lossy (for unknown
options), keeping everything in the same format removes the possibility
of dropping options if the packet comes back up to userspace and the
Geneve option translation table has changed. To help with these types of
operations, most functions can understand both formats of data and seamlessly
do the right thing.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agodpif-netdev: Don't use metaflow to operate on userspace datapath fields.
Jesse Gross [Thu, 16 Jul 2015 16:05:33 +0000 (09:05 -0700)]
dpif-netdev: Don't use metaflow to operate on userspace datapath fields.

If ofproto-dpif installs a flow into the userspace datapath that doesn't
include a mask, we need to synthesize an exact match one. This is currently
done using the metaflow infrastructure, iterating over each field and
setting it to all ones.

There is a conceptual mismatch here because metaflow is operating on
OpenFlow fields, not datapath ones. Even though they are generally very
similar, there are subtle differences, which is why it is necessary to
fix up the input port mask.

With Geneve options, the mapping is much more complicated and so the
situation is worse. The first issue is that the metaflow to flow
mapping can change over time, so we would need to do more revalidation
to track this. In addition, an upcoming patch will completely disconnect
the option format between ofproto-dpif and dpif-netdev, so the values
written by metaflow don't make sense at all.

When megaflows are turned off, ofproto-dpif internally generates masks
using flow_wildcards_init_for_packet(). Since that's the same as what
we want to do here, we can just use that instead of metaflow.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agodatapath: Revert "datapath: Constify netlink structs."
Pravin B Shelar [Wed, 5 Aug 2015 01:07:27 +0000 (18:07 -0700)]
datapath: Revert "datapath: Constify netlink structs."

This reverts commit 2023bdcfc44c149a8e3b38dcde8f04f2ec3f8501.
This commit is causing segfaults when genl compat code is in use.

Compat code update genl_multicast_group and genl_family type objects.
Therefore these can not be const.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
8 years agodpif-netdev: fix race for queues between pmd threads.
Ilya Maximets [Tue, 4 Aug 2015 19:36:37 +0000 (12:36 -0700)]
dpif-netdev: fix race for queues between pmd threads.

Currently pmd threads select queues in pmd_load_queues() according to
get_n_pmd_threads_on_numa(). This behavior leads to race between pmds,
beacause dp_netdev_set_pmds_on_numa() starts them one by one and
current number of threads changes incrementally.

As a result we may have the following situation with 2 pmd threads:

* dp_netdev_set_pmds_on_numa()
* pmd12 thread started. Currently only 1 pmd thread exists.
dpif_netdev(pmd12)|INFO|Core 1 processing port 'port_1'
dpif_netdev(pmd12)|INFO|Core 1 processing port 'port_2'
* pmd14 thread started. 2 pmd threads exists.
dpif_netdev|INFO|Created 2 pmd threads on numa node 0
dpif_netdev(pmd14)|INFO|Core 2 processing port 'port_2'

We have:
core 1 --> port 1, port 2
core 2 --> port 2

Fix this by starting pmd threads only after all of them have
been configured.

Cc: Daniele Di Proietto <diproiettod at vmware.com>
Cc: Dyasly Sergey <s.dyasly at samsung.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
8 years agokmod-traffic: Expand sanity tests.
Joe Stringer [Wed, 29 Jul 2015 19:56:06 +0000 (12:56 -0700)]
kmod-traffic: Expand sanity tests.

The initial sanity test only checked IPv4 without IP fragments. This patch
adds additional tests using IPv6 and VLANs with IP fragments and expands
the existing test to be more strict.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
8 years agotreewide: Fix doubled "the".
Ben Pfaff [Mon, 3 Aug 2015 22:30:02 +0000 (15:30 -0700)]
treewide: Fix doubled "the".

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
8 years agoovs-ofctl: Refine documentation of Geneve option mapping.
Ben Pfaff [Mon, 3 Aug 2015 21:11:12 +0000 (14:11 -0700)]
ovs-ofctl: Refine documentation of Geneve option mapping.

The text didn't say how to actually match on them.  I took the liberty of
massaging the text a little further, too.

Suggested-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
8 years agoofproto-dpif: Use a regular ref instead of try_ref for rule translation.
Ben Pfaff [Sun, 2 Aug 2015 18:51:32 +0000 (11:51 -0700)]
ofproto-dpif: Use a regular ref instead of try_ref for rule translation.

Until now, flow translation has had to use try_ref to take a reference on
a rule, because a competing thread might have released the last reference
and done an RCU-postponed deletion.  Since classifier versioning was
introduced, however, the release of the last reference is itself
RCU-postponed, which means that it is always safe to take the reference
directly.

Changing try_ref to ref means that taking a reference can't fail, which
allows the caller to take a reference in cases where the need to take a
reference was previously passed along a call chain, which simplifies some
code.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
8 years agoovn: Change strategy for tunnel keys.
Ben Pfaff [Mon, 3 Aug 2015 23:38:12 +0000 (16:38 -0700)]
ovn: Change strategy for tunnel keys.

Until now, OVN has used "flat" tunnel keys, in which the STT tunnel key or
Geneve VNI contains a logical port number.  Logical port numbers are unique
within an OVN deployment.

Flat tunnel keys have the advantage of simplicity.  However, for packets
that are destined to logical ports on multiple hypervisors, they require
sending one packet per destination logical port rather than one packet per
hypervisor.  They also make it hard to integrate with VXLAN-based hardware
switches, which use VNIs to designate logical networks instead of logical
ports.

This commit switches OVN to a different scheme.  In this scheme, in Geneve
the VNI designates a logical network and a Geneve option specifies the
logical input and output ports, which are now scoped within the logical
network rather than globally unique.  In STT, all three identifiers are
encoded in the tunnel key.

To allow for the reduced amount of traffic for packets destined to logical
ports on multiple hypervisors, this commit also introduces the concept
of a logical multicast group.  The membership of these groups can be set
using a new Multicast_Group table in the southbound database (and
ovn-northd does use it starting in this commit).

With multicast groups alone, it would be difficult to implement ACLs,
because an ACL might disallow only some of the packets being sent to
a remote hypervisor.  Thus, this commit also splits the OVN logical
pipeline into two pipelines: the "ingress" pipeline, which makes the
decision about the logical destination of a packet as a set of logical
ports or multicast groups, and the "egress" pipeline, which runs on the
destination hypervisor with the multicast group destination exploded into
individual ports and makes a final decision on whether to deliver the
packet.  The "egress" pipeline can efficiently apply ACLs.

Until now, the OVN logical and physical pipeline implementation was not
adequately documented.  This commit adds extensive documentation to
the OVN manpages to cover these issues.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
8 years agoofctrl: Negotiate OVN Geneve option.
Ben Pfaff [Mon, 3 Aug 2015 20:50:19 +0000 (13:50 -0700)]
ofctrl: Negotiate OVN Geneve option.

This won't really get used until the next commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
8 years agorule: Introduce MFF_LOG_DATAPATH macro for consistency.
Ben Pfaff [Sun, 19 Jul 2015 19:14:45 +0000 (12:14 -0700)]
rule: Introduce MFF_LOG_DATAPATH macro for consistency.

The other logical fields have their own macros, so the logical datapath
field might as well have one.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
8 years agoactions: Allow caller to specify output table.
Ben Pfaff [Sun, 19 Jul 2015 01:29:18 +0000 (18:29 -0700)]
actions: Allow caller to specify output table.

When an upcoming commit divides the pipeline up into ingress and egress
pipeline, it will become necessary to resubmit to different tables from
each of those pipelines to implement output.  This commit makes that
possible.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
8 years agoovn: Rename Pipeline table to Logical_Flow table.
Ben Pfaff [Mon, 3 Aug 2015 18:10:43 +0000 (11:10 -0700)]
ovn: Rename Pipeline table to Logical_Flow table.

The OVN pipeline is being split into two phases, which are most naturally
called "pipelines".  I kept getting very confused trying to call them
anything else, and in the end it seems to make more sense to just rename
the Pipeline table.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
8 years agoovn: Rename Binding table to Port_Binding.
Ben Pfaff [Thu, 30 Jul 2015 17:41:08 +0000 (10:41 -0700)]
ovn: Rename Binding table to Port_Binding.

An upcoming patch will add a Datapath_Binding table, so clarifying the
name seems useful.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
8 years agonroff: Add support for 'diagram' XML element for protocol headers.
Ben Pfaff [Wed, 29 Jul 2015 16:04:35 +0000 (09:04 -0700)]
nroff: Add support for 'diagram' XML element for protocol headers.

This will be used in documentation for an upcoming change, to document
how Geneve OVN options are encoded.

The code in this change is from a series (not yet submitted) that makes
much more extensive use of it for documenting protocol headers.

Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agosmap: New function smap_get_uuid().
Ben Pfaff [Sat, 18 Jul 2015 23:59:08 +0000 (16:59 -0700)]
smap: New function smap_get_uuid().

To be used in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
8 years agoovn-controller: Use controller_ctx just to pass around data.
Ben Pfaff [Sun, 19 Jul 2015 17:58:29 +0000 (10:58 -0700)]
ovn-controller: Use controller_ctx just to pass around data.

Until now, controller_ctx has been a store of common state (although
the amount of data stored in it has declined to just database state).
I think it's clearer if we just use it as a way to pass data to
functions.  This commit makes that change.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
8 years agoovn-controller: Slightly adjust pipeline init and destroy for consistency.
Ben Pfaff [Sun, 19 Jul 2015 17:33:26 +0000 (10:33 -0700)]
ovn-controller: Slightly adjust pipeline init and destroy for consistency.

This drops an unused parameter and groups the calls to these functions
with ofctrl_destroy() in each case.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
8 years agobridge: Reconfigure when system interfaces change.
Thadeu Lima de Souza Cascardo [Fri, 31 Jul 2015 17:35:02 +0000 (14:35 -0300)]
bridge: Reconfigure when system interfaces change.

Whenever system interfaces are removed, added or change state, reconfigure
bridge. This allows late interfaces to be added to the datapath when they are
added to the system after ovs-vswitchd is started.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agortbsd: support RTM_IFANNOUNCE messages
Thadeu Lima de Souza Cascardo [Fri, 31 Jul 2015 17:35:01 +0000 (14:35 -0300)]
rtbsd: support RTM_IFANNOUNCE messages

When devices are created, they are announced using RTM_IFANNOUNCE messages using
PF_ROUTE.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agodatapath: Fix STT protocol field for sampling packet.
Pravin B Shelar [Fri, 31 Jul 2015 03:51:15 +0000 (20:51 -0700)]
datapath: Fix STT protocol field for sampling packet.

Fixes typo in STT sampling code.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
8 years agoovn: Get/set lport type and options in ovn-nbctl.
Russell Bryant [Fri, 31 Jul 2015 17:14:43 +0000 (13:14 -0400)]
ovn: Get/set lport type and options in ovn-nbctl.

A recent patch added "type" and "options" columns to the Logical_Port
table in OVN_Northbound.  This patch allows you to get and set those
columns with ovn-nbctl.

ovn-nbctl should eventually get converted to use the common db-ctl
code that was recently added.  When that happens, these commands can
just be removed.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agoovn: Add type and options to logical port.
Russell Bryant [Fri, 31 Jul 2015 17:14:42 +0000 (13:14 -0400)]
ovn: Add type and options to logical port.

We have started discussing the use of the logical port abstraction in
OVN to represent special types of connections into an OVN logical
switch.  This patch proposes some schema updates to reflect these
special types of logical ports.  A logical port can have a "type" and
a set of options specific to that type.

Some examples of logical port types would be "vtep" for connectivity
to a VTEP gateway or "localnet" for a connection to a locally
accessible network via an ovs bridge.  Actualy support for these (or
other) types will come in later patches.

Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
8 years agosmap: Add smap_equal().
Russell Bryant [Fri, 31 Jul 2015 17:14:40 +0000 (13:14 -0400)]
smap: Add smap_equal().

Add a method to determine of two smaps are equal (have the exact same
set of key-value pairs).

Suggested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Russell Bryant <rbryant@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>