This patch is not valid,

I and Ethan discussed offline that there is more modification to do.

I'll remove this patch from patchwork as well.

The PATCH 1/2 of this series is still valid.


On Wed, Oct 16, 2013 at 5:32 PM, Alex Wang <al...@nicira.com> wrote:

> This commit makes the ofproto/dpif command show the "Relevant fields"
> of each resubmit.
>
> Signed-off-by: Alex Wang <al...@nicira.com>
> ---
>  ofproto/ofproto-dpif.c |   22 ++++++++++++++++------
>  tests/ofproto-dpif.at  |   35 +++++++++++++++++++++++++++++++++++
>  2 files changed, 51 insertions(+), 6 deletions(-)
>
> diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
> index 8a7f47c..4ba273b 100644
> --- a/ofproto/ofproto-dpif.c
> +++ b/ofproto/ofproto-dpif.c
> @@ -5104,6 +5104,19 @@ trace_format_odp(struct ds *result, int level,
> const char *title,
>  }
>
>  static void
> +trace_format_relevant_fields(struct ds *result, int level, const char
> *title,
> +                             struct trace_ctx *trace)
> +{
> +    struct match match;
> +
> +    ds_put_char_multiple(result, '\t', level);
> +    ds_put_format(result, "%s: ", title);
> +    match_init(&match, &trace->flow, &trace->xout.wc);
> +    match_format(&match, result, OFP_DEFAULT_PRIORITY);
> +    ds_put_char(result, '\n');
> +}
> +
> +static void
>  trace_resubmit(struct xlate_in *xin, struct rule_dpif *rule, int recurse)
>  {
>      struct trace_ctx *trace = CONTAINER_OF(xin, struct trace_ctx, xin);
> @@ -5113,6 +5126,8 @@ trace_resubmit(struct xlate_in *xin, struct
> rule_dpif *rule, int recurse)
>      trace_format_flow(result, recurse + 1, "Resubmitted flow", trace);
>      trace_format_regs(result, recurse + 1, "Resubmitted regs", trace);
>      trace_format_odp(result,  recurse + 1, "Resubmitted  odp", trace);
> +    trace_format_relevant_fields(result, recurse + 1, "Resubmitted
> relevant "
> +                                 "fields", trace);
>      trace_format_rule(result, recurse + 1, rule);
>  }
>
> @@ -5282,7 +5297,6 @@ ofproto_trace(struct ofproto_dpif *ofproto, const
> struct flow *flow,
>          uint64_t odp_actions_stub[1024 / 8];
>          struct ofpbuf odp_actions;
>          struct trace_ctx trace;
> -        struct match match;
>          uint8_t tcp_flags;
>
>          tcp_flags = packet ? packet_get_tcp_flags(packet, flow) : 0;
> @@ -5299,11 +5313,7 @@ ofproto_trace(struct ofproto_dpif *ofproto, const
> struct flow *flow,
>
>          ds_put_char(ds, '\n');
>          trace_format_flow(ds, 0, "Final flow", &trace);
> -
> -        match_init(&match, &trace.flow, &trace.xout.wc);
> -        ds_put_cstr(ds, "Relevant fields: ");
> -        match_format(&match, ds, OFP_DEFAULT_PRIORITY);
> -        ds_put_char(ds, '\n');
> +        trace_format_relevant_fields(ds, 0, "Relevant fields", &trace);
>
>          ds_put_cstr(ds, "Datapath actions: ");
>          format_odp_actions(ds, trace.xout.odp_actions.data,
> diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
> index 3630cda..be100cb 100644
> --- a/tests/ofproto-dpif.at
> +++ b/tests/ofproto-dpif.at
> @@ -1506,6 +1506,41 @@ ovs-appctl: ovs-vswitchd: server returned an error
>  OVS_VSWITCHD_STOP
>  AT_CLEANUP
>
> +# The third test tests the resubmit and relevant fields
> +AT_SETUP([ofproto-dpif - ofproto/trace command 3])
> +OVS_VSWITCHD_START
> +ADD_OF_PORTS([br0], 1, 2, 3)
> +
> +ovs-ofctl add-flow br0 "table=0, priority=0, actions=resubmit(,1)"
> +
> +ovs-ofctl add-flow br0 "table=1, priority=99, in_port=2, vlan_tci=0,
> actions=mod_vlan_vid:20, resubmit(,2)"
> +
> +AT_CHECK([ovs-appctl ofproto/trace br0 in_port=2], [0], [dnl
> +Flow:
> metadata=0,in_port=2,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=00:00:00:00:00:00,dl_type=0x0000
> +Rule: table=0 cookie=0 priority=0
> +OpenFlow actions=resubmit(,1)
> +
> +       Resubmitted flow: unchanged
> +       Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0
> reg5=0x0 reg6=0x0 reg7=0x0
> +       Resubmitted  odp: drop
> +       Resubmitted relevant fields:
> skb_priority=0,in_port=2,vlan_tci=0x0000,dl_type=0x0000,nw_frag=no
> +       Rule: table=1 cookie=0 priority=99,in_port=2,vlan_tci=0x0000
> +       OpenFlow actions=mod_vlan_vid:20,resubmit(,2)
> +
> +               Resubmitted flow:
> metadata=0,in_port=2,dl_vlan=20,dl_vlan_pcp=0,dl_src=00:00:00:00:00:00,dl_dst=00:00:00:00:00:00,dl_type=0x0000
> +               Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0
> reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
> +               Resubmitted  odp: drop
> +               Resubmitted relevant fields:
> skb_priority=0,in_port=2,dl_vlan=20,dl_vlan_pcp=0,dl_type=0x0000,nw_frag=no
> +               No match
> +
> +Final flow: unchanged
> +Relevant fields:
> skb_priority=0,in_port=2,dl_vlan=20,dl_vlan_pcp=0,dl_type=0x0000,nw_frag=no
> +Datapath actions: drop
> +])
> +
> +OVS_VSWITCHD_STOP
> +AT_CLEANUP
> +
>  m4_define([OFPROTO_TRACE],
>    [flow="$2"
>     AT_CHECK([ovs-appctl ofproto/trace $1 "$flow" $3], [0], [stdout])
> --
> 1.7.9.5
>
>
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to