On Thu, Jun 02, 2011 at 04:06:41PM -0700, Ben Pfaff wrote: > > OK. Ethan, let's drop it for now, with an eye to reviving it later if > need be.
Hi guys, Just for curiosity, I've implemented the patch along the line of Ben suggestions, see below. I'm wondering if the compiler is smart enough to pack bools, if not, I may use bitfields... I've just checked that the patch works, I'll evaluate the performance later on. One disapointement is that, while it did cut the number of calls to xlate_actions(), there remains still a large number of them. My guess is that the remaining calls to xlate_actions() are coming from facet_revalidate() and that's probably a harder job to tackle. Regards, Jean
diff -u -p -r -x '*~' -x '*.cmd' -x '*.order' -x '*.mod' openvswitch-1.1.0-jean3/ofproto/ofproto.c openvswitch-1.1.0-jean4/ofproto/ofproto.c --- openvswitch-1.1.0-jean3/ofproto/ofproto.c 2011-06-06 17:10:06.000000000 -0700 +++ openvswitch-1.1.0-jean4/ofproto/ofproto.c 2011-06-06 18:05:02.000000000 -0700 @@ -151,6 +151,7 @@ struct action_xlate_ctx { tag_type tags; /* Tags associated with OFPP_NORMAL actions. */ bool may_set_up_flow; /* True ordinarily; false if the actions must * be reassessed for every packet. */ + bool resubmit; /* Rule contains resubmit action. */ uint16_t nf_output_iface; /* Output interface index for NetFlow. */ /* xlate_actions() initializes and uses these members, but the client has no @@ -194,6 +195,7 @@ struct rule { long ms_idle_timeout; /* In milliseconds from time of last use. */ long ms_hard_timeout; /* In milliseconds from time of creation. */ bool send_flow_removed; /* Send a flow removed message? */ + bool resubmit; /* Rule contains resubmit action. */ int n_actions; /* Number of elements in actions[]. */ union ofp_action *actions; /* OpenFlow actions. */ struct list facets; /* List of "struct facet"s. */ @@ -1702,7 +1704,7 @@ static void facet_make_actions(struct ofproto *p, struct facet *facet, const struct ofpbuf *packet) { - const struct rule *rule = facet->rule; + struct rule *rule = facet->rule; struct ofpbuf *odp_actions; struct action_xlate_ctx ctx; @@ -1711,6 +1713,7 @@ facet_make_actions(struct ofproto *p, st facet->tags = ctx.tags; facet->may_install = ctx.may_set_up_flow; facet->nf_flow.output_iface = ctx.nf_output_iface; + rule->resubmit = ctx.resubmit; if (facet->actions_len != odp_actions->size || memcmp(facet->actions, odp_actions->data, odp_actions->size)) { @@ -1953,6 +1956,7 @@ facet_revalidate(struct ofproto *ofproto facet->tags = ctx.tags; facet->nf_flow.output_iface = ctx.nf_output_iface; facet->may_install = ctx.may_set_up_flow; + new_rule->resubmit = ctx.resubmit; if (actions_changed) { free(facet->actions); facet->actions_len = odp_actions->size; @@ -2355,6 +2359,7 @@ xlate_nicira_action(struct action_xlate_ case NXAST_RESUBMIT: nar = (const struct nx_action_resubmit *) nah; xlate_table_action(ctx, ofp_port_to_odp_port(ntohs(nar->in_port))); + ctx->resubmit = true; break; case NXAST_SET_TUNNEL: @@ -2535,6 +2540,7 @@ action_xlate_ctx_init(struct action_xlat ctx->packet = packet; ctx->resubmit_hook = NULL; ctx->check_special = true; + ctx->resubmit = false; } static void @@ -3372,6 +3378,10 @@ flow_push_stats(struct ofproto *ofproto, { struct ofproto_push push; + if (!rule->resubmit) { + return; + } + push.packets = packets; push.bytes = bytes; push.used = used;
_______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev