From: Ben Pfaff Date: Wed, 29 Apr 2009 22:42:59 +0000 (-0700) Subject: secchan: Optimize no-change case in modify_flow(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3301e79cd308291f1bea4a9855d12192c1f55a50;p=openvswitch secchan: Optimize no-change case in modify_flow(). --- diff --git a/secchan/ofproto.c b/secchan/ofproto.c index 5b7e169f..8b194986 100644 --- a/secchan/ofproto.c +++ b/secchan/ofproto.c @@ -2497,9 +2497,16 @@ modify_flow(struct ofproto *p, const struct ofp_flow_mod *ofm, if (command == OFPFC_DELETE) { rule_remove(p, rule); } else { + size_t actions_len = n_actions * sizeof *rule->actions; + + if (n_actions == rule->n_actions + && !memcmp(ofm->actions, rule->actions, actions_len)) + { + return 0; + } + free(rule->actions); - rule->actions = xmemdup(ofm->actions, - n_actions * sizeof *rule->actions); + rule->actions = xmemdup(ofm->actions, actions_len); rule->n_actions = n_actions; if (rule->cr.wc.wildcards) {