ofproto-dpif: Simplify commit logic.
authorEthan Jackson <ethan@nicira.com>
Tue, 22 Nov 2011 03:25:19 +0000 (19:25 -0800)
committerEthan Jackson <ethan@nicira.com>
Wed, 23 Nov 2011 01:04:20 +0000 (17:04 -0800)
commit81b1afb19dcb4570efe1899ef99bffd2683321ed
tree738e8e6aeec9101e3f64131ee043441c02c46926
parentbe51a44695b8e2a3efd729524b2c08d32ed572db
ofproto-dpif: Simplify commit logic.

Before executing an output action, ofproto-dpif must commit the
changes it's made to the flow so they are reflected in the
packet.  This code has been unnecessarily complex.  This patch
attempts to simplify the code in the following ways.

- Commit in fewer places.
In an attempt to provide some optimization, the ofproto-dpif code
separated the commit and output composition steps so things like
flood actions could avoid redundant commits.  This is a case of
premature optimization that makes the code significantly more
difficult to reason about.  With this patch, commits happen only
when really necessary.

- Only perform full commits.
In an attempt to provide some optimization, the ofproto-dpif code
would allow callers to only commit the part of the flow that they
had modified by directly calling the relevant subroutine.  This
practice made the code difficult to reason about and is thus
discontinued.

- Perform all output logic in one function.
All of the logic surrounding the datapath output action has been
placed in the compose_output_action__() function.  Most callers
will use the compose_output_action() function which simply passes
reasonable defaults through to compose_output_action__().
ofproto/ofproto-dpif.c