ofproto-dpif: Reduce number of get_ofp_port() calls during flow xlate.
authorBen Pfaff <blp@nicira.com>
Tue, 12 Feb 2013 23:56:10 +0000 (15:56 -0800)
committerBen Pfaff <blp@nicira.com>
Tue, 12 Feb 2013 23:56:10 +0000 (15:56 -0800)
commitffaef958e473be1788a108bce85729fea9347ecf
tree5235fff9903f22b287aa31ee4201f37debd0a491
parentc0bf00b922eeace65846cc1309a71adb69fe0eda
ofproto-dpif: Reduce number of get_ofp_port() calls during flow xlate.

Until now the flow translation code has done one get_ofp_port() call
initially to check for special processing, then one for each level of
action processing.  Only one call is actually necessary, though, because
the in_port of a flow doesn't change in ordinary circumstances, and so this
commit eliminates the unnecessary calls.

The one case where the in_port can change is when a packet passes through
a patch port.  The implementation here was buggy anyway: when the patch
port's peer had forwarding disabled by STP, then the code would drop all
ODP actions, even those that were executed before the packet crossed the
patch port.  This commit fixes that case.

With a complicated flow table involving multiple levels of resubmit, this
increases flow setup performance by 2-3%.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
ofproto/ofproto-dpif.c