Acked-by: Jarno Rajahalme <jrajaha...@nicira.com>

> On Jul 29, 2015, at 11:42 PM, Ben Pfaff <b...@nicira.com> wrote:
> 
> This makes it possible to understand what happens recirculation-wise in
> translation.
> 
> Signed-off-by: Ben Pfaff <b...@nicira.com>
> ---
> ofproto/ofproto-dpif-xlate.c | 29 +++++++++++++++++++++++++----
> 1 file changed, 25 insertions(+), 4 deletions(-)
> 
> diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
> index 68f4b37..dc16a39 100644
> --- a/ofproto/ofproto-dpif-xlate.c
> +++ b/ofproto/ofproto-dpif-xlate.c
> @@ -530,6 +530,18 @@ xlate_report(struct xlate_ctx *ctx, const char *format, 
> ...)
>     }
> }
> 
> +static inline void
> +xlate_report_actions(struct xlate_ctx *ctx, const char *title,
> +                     const struct ofpact *ofpacts, size_t ofpacts_len)
> +{
> +    if (OVS_UNLIKELY(ctx->xin->report_hook)) {
> +        struct ds s = DS_EMPTY_INITIALIZER;
> +        ofpacts_format(ofpacts, ofpacts_len, &s);
> +        xlate_report(ctx, "%s: %s", title, ds_cstr(&s));
> +        ds_destroy(&s);
> +    }
> +}
> +
> static void
> xlate_xbridge_init(struct xlate_cfg *xcfg, struct xbridge *xbridge)
> {
> @@ -4814,13 +4826,14 @@ xlate_actions(struct xlate_in *xin, struct xlate_out 
> *xout)
>     if (xin->recirc) {
>         const struct recirc_state *state = &xin->recirc->state;
> 
> +        xlate_report(&ctx, "Restoring state post-recirculation:");
> +
>         if (xin->ofpacts_len > 0 || ctx.rule) {
>             static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
> +            const char *conflict = xin->ofpacts_len ? "actions" : "rule";
> 
> -            VLOG_WARN_RL(&rl, "Recirculation conflict (%s)!",
> -                         xin->ofpacts_len > 0
> -                         ? "actions"
> -                         : "rule");
> +            VLOG_WARN_RL(&rl, "Recirculation conflict (%s)!", conflict);
> +            xlate_report(&ctx, "- Recirculation conflict (%s)!", conflict);
>             goto exit;
>         }
> 
> @@ -4834,6 +4847,7 @@ xlate_actions(struct xlate_in *xin, struct xlate_out 
> *xout)
>                 /* Drop the packet if the bridge cannot be found. */
>                 static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
>                 VLOG_WARN_RL(&rl, "Recirculation bridge no longer exists.");
> +                xlate_report(&ctx, "- Recirculation bridge no longer 
> exists.");
>                 goto exit;
>             }
>             ctx.xbridge = new_bridge;
> @@ -4842,6 +4856,7 @@ xlate_actions(struct xlate_in *xin, struct xlate_out 
> *xout)
>         /* Set the post-recirculation table id.  Note: A table lookup is done
>          * only if there are no post-recirculation actions. */
>         ctx.table_id = state->table_id;
> +        xlate_report(&ctx, "- Resuming from table %"PRIu8, ctx.table_id);
> 
>         /* Restore pipeline metadata. May change flow's in_port and other
>          * metadata to the values that existed when recirculation was
> @@ -4857,6 +4872,9 @@ xlate_actions(struct xlate_in *xin, struct xlate_out 
> *xout)
>         if (state->action_set_len) {
>             const struct ofpact *a;
> 
> +            xlate_report_actions(&ctx, "- Restoring action set",
> +                                 state->ofpacts, state->action_set_len);
> +
>             ofpbuf_put(&ctx.action_set, state->ofpacts, 
> state->action_set_len);
> 
>             OFPACT_FOR_EACH(a, state->ofpacts, state->action_set_len) {
> @@ -4873,6 +4891,9 @@ xlate_actions(struct xlate_in *xin, struct xlate_out 
> *xout)
>             xin->ofpacts_len = state->ofpacts_len - state->action_set_len;
>             xin->ofpacts = state->ofpacts +
>                 state->action_set_len / sizeof *state->ofpacts;
> +
> +            xlate_report_actions(&ctx, "- Restoring actions",
> +                                 xin->ofpacts, xin->ofpacts_len);
>         }
>     } else if (OVS_UNLIKELY(flow->recirc_id)) {
>         static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
> -- 
> 2.1.3
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to