Thanks, I've pushed this. Ethan
On Wed, Jan 11, 2012 at 11:28, Ben Pfaff <b...@nicira.com> wrote: > Thanks, I'm happy with this. > > On Wed, Jan 11, 2012 at 11:27:00AM -0800, Ethan Jackson wrote: >> I agree this is a bit subtle. Here's an updated version of the patch. >> >> --- >> A "packet out" ordinarily isn't accounted to any OpenFlow rule, >> because its actions come directly from the controller instead of >> from an OpenFlow rule. However, any "resubmit" actions or output >> to OFPP_TABLE within the set of actions do bring in actions from a >> rule, and the "packet out" should be accounted to the rule in that >> case. This commit implements that behavior. >> >> Reported-by: Jesse Gross <je...@nicira.com> >> Signed-off-by: Ethan Jackson <et...@nicira.com> >> --- >> ofproto/ofproto-dpif.c | 15 ++++++++++++--- >> 1 files changed, 12 insertions(+), 3 deletions(-) >> >> diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c >> index f5280ff..e206f43 100644 >> --- a/ofproto/ofproto-dpif.c >> +++ b/ofproto/ofproto-dpif.c >> @@ -5534,15 +5534,24 @@ packet_out(struct ofproto *ofproto_, struct ofpbuf >> *packet, >> ofproto->max_ports); >> if (!error) { >> struct odputil_keybuf keybuf; >> - struct action_xlate_ctx ctx; >> struct ofpbuf *odp_actions; >> + struct ofproto_push push; >> struct ofpbuf key; >> >> ofpbuf_use_stack(&key, &keybuf, sizeof keybuf); >> odp_flow_key_from_flow(&key, flow); >> >> - action_xlate_ctx_init(&ctx, ofproto, flow, flow->vlan_tci, 0, >> packet); >> - odp_actions = xlate_actions(&ctx, ofp_actions, n_ofp_actions); >> + action_xlate_ctx_init(&push.ctx, ofproto, flow, flow->vlan_tci, 0, >> + packet); >> + >> + /* Ensure that resubmits in 'ofp_actions' get accounted to their >> + * matching rules. */ >> + push.packets = 1; >> + push.bytes = packet->size; >> + push.used = time_msec(); >> + push.ctx.resubmit_hook = push_resubmit; >> + >> + odp_actions = xlate_actions(&push.ctx, ofp_actions, n_ofp_actions); >> dpif_execute(ofproto->dpif, key.data, key.size, >> odp_actions->data, odp_actions->size, packet); >> ofpbuf_delete(odp_actions); >> -- >> 1.7.7.1 >> >> _______________________________________________ >> dev mailing list >> dev@openvswitch.org >> http://openvswitch.org/mailman/listinfo/dev _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev