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>
datapath: ipfrag: reassemble fragmens

This series of patches handles IPv4 fragmentation and reassembly,
preserving the maximum fragment size of all fragments across
inbound and outbound physical vports so that Path MTU Discovery
works properly traversing an OVS network.

This patch introduces reassembly of IPv4 fragments and allows flow
matching L4 fields using fully reassembled, entire packets.
An attribute flag, OVS_VPORT_ATTR_IPV4_REASM is added to vport to
enable/disable reassembly. Disabled by default. Note that the flag
works only on NETDEV or INTERNAL vports with this patch. For others,
it's going to be covered by later patches.

The burden of handling reassembling is largely tossed to the kernel
networking infrastructure, ip_defrag in net/ipv4/ip_fragment.c,
which saves the maximum fragment size in IPCB which is non-zero if
at least one fragment had DF (Don't Fragment) set.

Signed-off-by: Takayuki Usui <takayuki@midokura.com>
datapath: ipfrag: reassemble fragmens (tunnel vport)

The patch allows reassembly of IPv4 fragments on tunnel vports;
update mac and network headers pointing to the inner frame, then
call ip_defrag as physical vports.

Signed-off-by: Takayuki Usui <takayuki@midokura.com>
datapath: ipfrag: fragment packets

This patch fragments packets outgoing from NETDEV or INTERNAL
vports. MTU is extracted from the corresponding physical device.

Signed-off-by: Takayuki Usui <takayuki@midokura.com>
datapath: ipfrag: fragment packets (802.1Q)

This patch handles fragmentation of packets outgoing to VLAN
interface; Untag 802.1Q frames just being sent, build fragments
preserving 802.1Q stuff in skb and send them executing the same
path as non-VLAN ethernet frames.

Signed-off-by: Takayuki Usui <takayuki@midokura.com>
datapath: ipfrag: extend flow key with maximum fragment size

This patch extends flow key with the maximum fragment size which is
non-zero if at least one fragment had DF set. It's a metadata, since
it doesn't occupy IP header. The maximum fragment size is used when
a packet is fragmented in order to preserve the maximum fragment size
of the packet across inbound and outbound physical vports.

Because the maximum fragment size is stored in OVS_CB as part of
a flow key, it's always available at outgoing vports.

Signed-off-by: Takayuki Usui <takayuki@midokura.com>