[ovs-dev] [tos 2/3] ofproto-dpif: Simplify commit logic.

Ben Pfaff blp at nicira.com
Wed Nov 23 17:32:50 UTC 2011


On Tue, Nov 22, 2011 at 04:29:35PM -0800, Ethan Jackson wrote:
> 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__().

It's a good cleanup.

We could now shorten ofproto.c a bit by moving commit_odp_actions()
and all of its helpers to odp-util.c.

Thanks,

Ben.



More information about the dev mailing list