meta-flow: Fix inverted IPv6 flow label masking.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
tests: a comment on OF1.3 table_mod

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif-xlate: Do initial rule lookup for callers.

None of the functions available in ofproto-dpif.h are thread safe
unless holding the xlate_rwlock because one can't know that an ofproto
or ofport used as argument will survive during the function call.  For
this reason, ofproto-dpif-upcall's invocation of rule_dpif_lookup()
is unsafe because the ofproto could be destroyed during the call.

This patch fixes the problem by optionally doing the initial rule
lookup in xlate_actions() so that it can be done while holding the
xlate_rwlock.  This has the nice side benefit of removing a bunch of
boilerplate.

Note that this only partially solves the problem, there's still
vsp_realdev_to_vlandev() and ofproto_dpif_send_packet_in() which
aren't thread safe for the same reason.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
timeval: Call coverage_clear() before coverage_log() in time_poll().

time_poll() calls log_poll_interval(), which in some circumstances calls
coverage_log().  Before this commit, time_poll() also called
coverage_clear() after log_poll_interval().  This made sense before commit
857165b5fd26 (coverage: Make thread-safe.), because coverage_log() would
log the most recent main loop's coverage counters separately and calling
coverage_clear() beforehand would zero out those counters.  However, it
doesn't make sense any longer because the most recent loop's counters are
no longer separately logged and in fact this practice now means that the
most recent loop's counters are omitted from the logged counters.

Therefore, this commit moves the call to coverage_clear() earlier, so that
the most recent loop's counters are included.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif-upcall: Make miss handlers accumulate coverage counters.

The miss handler threads do not call poll_block(), which calls
coverage_clear() indirectly.  This meant that coverage counters incremented
by miss handler threads never got integrated into the global coverage
counters and therefore did not show up in coverage logging or
"ovs-appctl coverage/show" output.  This commit fixes the problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
pcap-file: Improve error logging.

There is no reason to log end of file as an error, but that's what this
code was doing.

Signed-off-by: Ben Pfaff <blp@nicira.com>
pcap-file: Add support for append mode to pcap_open().

Signed-off-by: Ben Pfaff <blp@nicira.com>
netdev-dummy: Add pcap feature.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ovs-ofctl: Add undocumented "parse-pcap" command, for testing.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif: Simplify code using execute_odp_actions().

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif: Factor lots of code out into new function execute_actions().

Signed-off-by: Ben Pfaff <blp@nicira.com>
odp-execute: Refine signatures for odp_execute_actions() callbacks.

Signed-off-by: Ben Pfaff <blp@nicira.com>
odp-util: Make it possible to combine slow path reasons.

It will soon be possible for a single flow to be slow pathed for multiple
reasons.  This commit makes it possible to indicate more than one reason
to slow path a flow.

This commit is logically a revert of commit 98f0520fb2 (odp-util: Make
slow_path_reasons mutually exclusive.) but details have changed.

Signed-off-by: Ben Pfaff <blp@nicira.com>
dpif: Support working around actions that a datapath does not support.

Until now, OVS has expected that the datapath supports all the actions
required by any flow to be installed.  There are at least two reasons why
a datapath might not support a given action:

    - The datapath version is older than the userspace version, and the
      action was introduced after the version of the datapath in use.

    - The action is not considered important enough to implement as part of
      an ABI that must be maintained forever.

This commit adds infrastructure to handle these cases.  It doesn't actually
add any uses; that will come in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Add software switch support for modifying ARP headers in OpenFlow.

This support is added through the userspace slow path, because we don't
judge that this is important enough to require permanent support in the
Linux kernel ABI.

Bug #19259.
CC: Teemu Koponen <koponen@nicira.com>
CC: Pankaj Thakkar <thakkar@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
monitor: Fix improper use of stubs.

Stubs must be uninitialized when used in case they allocate memory.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
rconn: Make rconn_packet_counter thread-safe.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
connmgr: Use 'ofproto_mutex' to protect ofconns from being destroyed.

Code in the ofproto-dpif miss handler threads can currently access
ofconns, sending flow_removed and flow monitor messages due to NXAST_LEARN
actions.  Nothing currently protects those threads from accessing ofconns
that are in the process of being destroyed.  This commit adds protection
'ofproto_mutex', which NXAST_LEARN already takes.

Later patches will address other races that remain.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
connmgr: Formalize 'ofproto_mutex' as protecting ofconn monitor data.

'ofproto_mutex' has effectively protected the monitor-related members of
struct ofconn since its introduction, but this was not written down or
systematically annotated.  This commit makes it more systematic and fixes
a few issues found using the annotations.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
rconn: Make thread-safe.

This should make sending OFPT_FLOW_REMOVED and NXST_FLOW_MONITOR safe from
miss handler threads.

Bug #20271.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>