dpif-netdev: Translate Geneve options per-flow, not per-packet.
authorJesse Gross <jesse@nicira.com>
Tue, 30 Jun 2015 01:01:59 +0000 (18:01 -0700)
committerJesse Gross <jesse@nicira.com>
Thu, 6 Aug 2015 03:26:48 +0000 (20:26 -0700)
commit6728d578f64e124d9905f1d48899226405cb85ae
treee0714cbbe9de12a53157f7a43e70cad4e7f486e7
parent9f861c9182ea420e54e7030387533e78e7e02728
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>
16 files changed:
lib/automake.mk
lib/dpif-netdev.c
lib/flow.c
lib/flow.h
lib/geneve.h [new file with mode: 0644]
lib/meta-flow.c
lib/netdev-vport.c
lib/odp-execute.c
lib/odp-util.c
lib/odp-util.h
lib/packets.h
lib/tun-metadata.c
lib/tun-metadata.h
ofproto/ofproto-dpif-sflow.c
ofproto/ofproto-dpif-upcall.c
tests/tunnel-push-pop.at