2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

pkt-metadata: Avoid introducing overhead for userspace tunnels.

The addition of Geneve metadata requires a large amount of additional
space to handle the maximum set of options. In most cases, this is
not a big deal since it is only temporary storage on the stack or
can be automatically stripped out for miniflows. However, userspace
tunnels need to deal with this on a per-packet basis, so we should
avoid introducing additional overhead if possible. Two small changes
are aimed at this:

 * Move struct flow_tnl to the end of the packet metadata. Since
   the Geneve metadata is already at the end of flow_tnl and pkt_metadata
   is at the end of struct dp_packet, this avoids putting a large
   amount metadata (which might be empty) in hot cache lines.

 * Only push the new metadata into a miniflow if any options are present
   during miniflow_extract(). This does not necessarily provide the
   most fine-grained flow generation but it is a quick check and
   the userspace implementation of Geneve does not currently support
   options anyways.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Jesse Gross
2015-06-12 12:49:23 -07:00
parent 9558d2a548
commit 9ad11dbe4c
2 changed files with 7 additions and 2 deletions

View File

@@ -438,7 +438,12 @@ miniflow_extract(struct dp_packet *packet, struct miniflow *dst)
/* Metadata. */
if (md->tunnel.ip_dst) {
miniflow_push_words(mf, tunnel, &md->tunnel,
sizeof md->tunnel / sizeof(uint64_t));
offsetof(struct flow_tnl, metadata) /
sizeof(uint64_t));
if (md->tunnel.metadata.opt_map) {
miniflow_push_words(mf, tunnel.metadata, &md->tunnel.metadata,
sizeof md->tunnel.metadata / sizeof(uint64_t));
}
}
if (md->skb_priority || md->pkt_mark) {
miniflow_push_uint32(mf, skb_priority, md->skb_priority);