LGTM,

  Jarno

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

> On May 18, 2015, at 6:26 PM, Andy Zhou <az...@nicira.com> wrote:
> 
> The output of 'ovs-ofctl dump-flows' command prints recirc_id in decimal
> in action parts of the output, while prints that in hex in matching
> parts of the same output.
> 
> This patch fixes the inconsistency by always printing recirc_id
> values in decimal.
> 
> Reported-by: Justin Pettit <jpet...@nicira.com>
> Signed-off-by: Andy Zhou <az...@nicira.com>
> ---
> lib/match.c           | 24 +++++++++++++++++++-----
> tests/ofproto-dpif.at |  4 ++--
> 2 files changed, 21 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/match.c b/lib/match.c
> index 7d0b409..b155084 100644
> --- a/lib/match.c
> +++ b/lib/match.c
> @@ -843,16 +843,30 @@ format_be32_masked(struct ds *s, const char *name,
> }
> 
> static void
> -format_uint32_masked(struct ds *s, const char *name,
> -                   uint32_t value, uint32_t mask)
> +format_uint32_masked__(struct ds *s, const char *name,
> +                       uint32_t value, uint32_t mask, const char *format)
> {
>     if (mask) {
> -        ds_put_format(s, "%s=%#"PRIx32, name, value);
> +        ds_put_format(s, format, name, value);
>         if (mask != UINT32_MAX) {
>             ds_put_format(s, "/%#"PRIx32, mask);
>         }
>         ds_put_char(s, ',');
>     }
> +
> +}
> +static void
> +format_uint32_masked(struct ds *s, const char *name,
> +                   uint32_t value, uint32_t mask)
> +{
> +    format_uint32_masked__(s, name, value, mask, "%s=%#"PRIx32);
> +}
> +
> +static void
> +format_decimal_uint32_masked(struct ds *s, const char *name,
> +                             uint32_t value, uint32_t mask)
> +{
> +    format_uint32_masked__(s, name, value, mask, "%s=%"PRIu32);
> }
> 
> static void
> @@ -921,8 +935,8 @@ match_format(const struct match *match, struct ds *s, int 
> priority)
>     format_uint32_masked(s, "pkt_mark", f->pkt_mark, wc->masks.pkt_mark);
> 
>     if (wc->masks.recirc_id) {
> -        format_uint32_masked(s, "recirc_id", f->recirc_id,
> -                             wc->masks.recirc_id);
> +        format_decimal_uint32_masked(s, "recirc_id", f->recirc_id,
> +                                     wc->masks.recirc_id);
>     }
> 
>     if (wc->masks.dp_hash) {
> diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
> index 139dfdd..3361dc2 100644
> --- a/tests/ofproto-dpif.at
> +++ b/tests/ofproto-dpif.at
> @@ -186,7 +186,7 @@ table=0 priority=2 in_port=5 dl_vlan=1 actions=drop
> AT_CHECK([ovs-ofctl add-flows br-int flows.txt])
> 
> # Sends a packet to trigger recirculation.
> -# Should generate recirc_id(0x2),dp_hash(0xc1261ba2/0xff).
> +# Should generate recirc_id(2),dp_hash(0xc1261ba2/0xff).
> AT_CHECK([ovs-appctl netdev-dummy/receive p5 
> "in_port(5),eth(src=50:54:00:00:00:05,dst=50:54:00:00:01:00),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1)"])
> 
> # Collects flow stats.
> @@ -195,7 +195,7 @@ AT_CHECK([ovs-appctl revalidator/purge], [0])
> # Checks the flow stats in br1, should only be one flow with non-zero
> # 'n_packets' from internal table.
> AT_CHECK([ovs-appctl bridge/dump-flows br1 | ofctl_strip | grep -- 
> "n_packets" | grep -- "table_id" | sed -e 
> 's/dp_hash=0x[[0-9a-f]][[0-9a-f]]*/dp_hash=0x0/' -e 
> 's/output:[[0-9]][[0-9]]*/output/'], [0], [dnl
> -table_id=254, n_packets=1, n_bytes=64, 
> priority=20,recirc_id=0x2,dp_hash=0x0/0xff,actions=output
> +table_id=254, n_packets=1, n_bytes=64, 
> priority=20,recirc_id=2,dp_hash=0x0/0xff,actions=output
> ])
> 
> # Checks the flow stats in br-int, should be only one match.
> -- 
> 1.9.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

Reply via email to