[ovs-dev] [PATCH v2] ofp-util: Convert flow_metadata to match structure.

Ben Pfaff blp at nicira.com
Mon Jun 1 21:55:31 UTC 2015


On Mon, Jun 01, 2015 at 01:49:30PM -0700, Jesse Gross wrote:
> We have a special flow_metadata structure to represent the parts
> of a packet that aren't carried in the payload itself. This is
> used in the case where we need to send the packet as a Packet In
> to an OpenFlow controller. This is a subset of the more general
> struct flow.
> 
> In practice, almost all operations we do on this structure involve
> converting it to or from a match or have code that is the same as
> a match. Serialization to NXM and back is done as a match. There
> is special flow_metadata formatting code that is almost identical
> to match formatting.
> 
> The uses for struct flow_metadata aren't performance critical
> when it comes to memory, so we can save quite a bit of code by
> just using a match structure directly instead. In addition, as
> metadata increases and becomes more complex (Geneve options require
> some special handling beyond just additional fields), using the
> match structure means we only have to do this work in one place.
> 
> Signed-off-by: Jesse Gross <jesse at nicira.com>

Most of this rationale makes sense to me, except that I'm surprised
that struct flow_metadata (which doesn't have masks) gets converted to
struct match (which does).  Maybe I should just dig into the code, but
is there some big reason why this is the case?



More information about the dev mailing list