ofproto-dpif: Avoid calling eth_addr_is_reserved().
authorEthan Jackson <ethan@nicira.com>
Wed, 6 Jun 2012 22:06:15 +0000 (15:06 -0700)
committerEthan Jackson <ethan@nicira.com>
Thu, 7 Jun 2012 01:22:56 +0000 (18:22 -0700)
eth_addr_is_reserved() is a bit more expensive than it used to be,
so it makes sense to avoid calling it when convenient as an
optimization.

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

index e171b3cfc42158a307a8ce672289869889870614..962df1579d1e4c85ea95aed2cc4fad8bd8e82800 100644 (file)
@@ -5930,8 +5930,8 @@ add_mirror_actions(struct action_xlate_ctx *ctx, const struct flow *orig_flow)
         ctx->mirrors |= m->dup_mirrors;
         if (m->out) {
             output_normal(ctx, m->out, vlan);
-        } else if (!eth_addr_is_reserved(orig_flow->dl_dst)
-                   && vlan != m->out_vlan) {
+        } else if (vlan != m->out_vlan
+                   && !eth_addr_is_reserved(orig_flow->dl_dst)) {
             struct ofbundle *bundle;
 
             HMAP_FOR_EACH (bundle, hmap_node, &ofproto->bundles) {
@@ -6089,7 +6089,7 @@ is_admissible(struct ofproto_dpif *ofproto, const struct flow *flow,
 
     /* Drop frames for reserved multicast addresses
      * only if forward_bpdu option is absent. */
-    if (eth_addr_is_reserved(flow->dl_dst) && !ofproto->up.forward_bpdu) {
+    if (!ofproto->up.forward_bpdu && eth_addr_is_reserved(flow->dl_dst)) {
         return false;
     }