[ovs-dev] [PATCH] ofproto-dpif: xlate_actions() more judiciously.
Ben Pfaff
blp at nicira.com
Thu Jun 2 22:45:57 UTC 2011
[adding Jean]
On Thu, Jun 02, 2011 at 12:58:13PM -0700, Ethan Jackson wrote:
> In order to calculate which facets to push statistics into,
> resubmit children must be calculated by calling xlate_actions() on
> each facet in ofproto-dpif. This patch cuts down the cost of this
> operation by only running xlate_actions() on facets which actually
> have resubmit actions and thus need to push statistics.
It seems reasonable to optimize this but I don't think that this
particular implementation is correct (or optimal). First, it misses
changes to actions in rule_modify_actions(). Second, it makes an
extra pass over the actions when both of those functions already make
one, in validate_actions(). As a third (very minor) point, it expands
struct rule_dpif by 8 bytes even though only one bit is really needed.
I have two suggestions for better ways to do it. See if you like one
of them.
One idea is to make validate_actions() return a flag indicating
whether there was a resubmit action. Only ofproto-dpif.c really uses
that function anyway.
Another is to add a member to action_xlate_ctx indicating whether
there was a resubmit action and then store that in the facet instead
(which has a hole for it).
The former is probably cleaner.
More information about the dev
mailing list