datapath: Add GSO/Tunnel links to gitignore

Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Jesse Gross <jesse@nicira.com>
ofpacts_check: Remove unnecessary flow copying.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
acinclude: Improve detection of not-understood compiler options with clang.

By default, clang warns about but does not fail on unknown -W options.
This made configure add the option to WARNING_FLAGS, which caused the
warning about not-understood warnings to be emitted for every file
compiled.

In combination with -Werror, clang does fail on unknown -W options.  This
commit adds -Werror during configure's warning tests, which should cause
the not-understood warnings to be detected that way.

Reported-by: Ed Maste <emaste@freebsd.org>
Tested-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath: Do not clear key in ovs_match_init()

When executing packets sent from userspace, the majority of the
flow information is extracted from the packet itself and a small
amount of metadata supplied by userspace is added. However, when
adding this metadata, the extracted flow information is currently
being cleared.

This manifests in a problem when executing actions as elements of key are
used when verifying some actions. For example a dec_ttl action verifies the
proto of the flow. An example of a flow that fails as a result of this
problem is:

        ovs-ofctl add-flow br0 "ip actions=dec_ttl,normal"

This is a regression added by "datapath: Mega flow implementation",
a1c564be1e2ffc31f8da09ab654c8ed987907fe5.

CC: Andy Zhou <azhou@nicira.com>
Reported-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Jesse Gross <jesse@nicira.com>
ofp-util: New function ofputil_port_to_string().

This function is more convenient than ofputil_format_port() when a "struct
ds" is not already in use.  This commit converts one caller for which this
was already true, and the following commit will add another.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif: Make "fdb/show" report OpenFlow port numbers.

Users are more likely to be able to reasonably interpret OpenFlow port
numbers than datapath port numbers.

This issue has existed since at least 2011 but only recently has it been
possible for OpenFlow and datapath port numbers to differ (except for the
"local" port).

Reported-by: Christopher Paggen <cpaggen@cisco.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif-ipfix: Use XXX instead of TODO.

XXX is preferred over TODO according to the style guide.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif: Minor need_revalidate tweaks.

This patch makes some minor tweaks to need_revalidate sets in
ofproto-dpif.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
flow: New function hash_ofp_port() and hash_ofp_port().

These functions are used so often, that having an easy to read
helper is worth it.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lacp: Remove unused lacp_slave_get_port_id().

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ofp-util: Support for OpenFlow 1.3 meters.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-errors: Implement OpenFlow 1.2+ experimenter error codes.

OpenFlow 1.2 standardized experimenter error codes in a way different from
the Nicira extension.  This commit implements the OpenFlow 1.2+ version.

This commit also makes it easy to add error codes for new experimenter IDs
by adding new *_VENDOR_ID definitions to openflow-common.h.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-errors: New error code ONFBIC_DUP_INSTRUCTION.

This is a prototype of OpenFlow enhancement proposal EXT-260 "Add error
code for duplicate instruction."  It uses the error code proposed there.

Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath: Make OVS_ACTION_ATTR_USERSPACE action to send packet key

OVS_ACTION_ATTR_USERSPACE action was sending the key from the matching
flow. This works for exact match flows because flow keys are the
same as packet keys. However, it does not work with wildcarded flows as
the packet keys may be different than the flow keys. This patch uses
the packet keys carried in OVS_CB(skb) when calling output_userspace().

Bug #18163

Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
build-aux/extract-ofp-errors: Delete trailing whitespaces

Delete trailing whitespaces.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Add VLAN splinters unit test.

CC: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ovs-thread: New module, initially just with pthreads wrapper functions.

The only tricky part here is that I'm throwing in annotations to allow
"sparse" to report unbalanced locking.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
ovs-thread: Add per-thread data support.

POSIX defines a portable pthread_key_t API for per-thread data.  GCC and
C11 have two different forms of per-thread data that are generally faster
than the POSIX API, where they are available.  This commit adds a
macro-based wrapper, DEFINE_PER_THREAD_DATA, that takes advantage of these
features where they are available and falls back to the POSIX API
otherwise.

The Clang compiler implements C11 thread_local in its <threads.h>.

This commit also adds a convenience wrapper for the POSIX API, via the
DEFINE_PER_THREAD_MALLOCED_DATA macro.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
ofp-parse: Fix parsing of out_port.

Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath: Do not clear key in ovs_match_init()

It appears that in the case where vs_match_init() is called from
ovs_flow_metadata_from_nlattrs() it is undesirable to set the flow key as
some of its values are set earlier on in ovs_flow_metadata_from_nlattrs().
Furthermore in the case where ovs_flow_metadata_from_nlattrs() is called
from ovs_packet_cmd_execute() key has been partially initialised by
ovs_flow_extract().

This manifests in a problem when executing actions as elements of key are
used when verifying some actions. For example a dec_ttl action verifies the
proto of the flow. An example of a flow that fails as a result of this
problem is:

	ovs-ofctl add-flow br0 "ip actions=dec_ttl,normal"

This patch resolves this problem by not clearing key in ovs_match_init()
and instead clearing it before calling ovs_match_init() when it is called
other than by ovs_flow_metadata_from_nlattrs().

This appears to be a regression added by "datapath: Mega flow
implementation", a1c564be1e2ffc31f8da09ab654c8ed987907fe5.

Cc: Andy Zhou <azhou@nicira.com>
Signed-off-by: Simon Horman <horms@verge.net.au>

---

I am unsure of the exact intention of clearing the key and thus the
correctness of this patch. However, it does appear to resolve
the problem that I describe above.