[ovs-dev] [PATCH 2/2] odp-util: Format recirc action ID in hex.

Andy Zhou azhou at nicira.com
Fri May 22 21:34:22 UTC 2015


On Fri, May 22, 2015 at 2:28 PM, Joe Stringer <joestringer at nicira.com> wrote:
> The match is in hex, this makes it more consistent.
>
> Signed-off-by: Joe Stringer <joestringer at nicira.com>
> ---
>  lib/odp-util.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/odp-util.c b/lib/odp-util.c
> index 962b84b..6e2a39d 100644
> --- a/lib/odp-util.c
> +++ b/lib/odp-util.c
> @@ -495,7 +495,7 @@ format_mpls(struct ds *ds, const struct ovs_key_mpls *mpls_key,
>  static void
>  format_odp_recirc_action(struct ds *ds, uint32_t recirc_id)
>  {
> -    ds_put_format(ds, "recirc(%"PRIu32")", recirc_id);
> +    ds_put_format(ds, "recirc(%"PRIx32")", recirc_id);
>  }
>
It may be better to explicitly display numbers in hex.  Adding leading
'0x' will probably make it less confusing.
Here is my counter proposal:

diff --git a/lib/odp-util.c b/lib/odp-util.c
index 962b84b..4845d28 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -495,7 +495,7 @@ format_mpls(struct ds *ds, const struct
ovs_key_mpls *mpls_key,
 static void
 format_odp_recirc_action(struct ds *ds, uint32_t recirc_id)
 {
-    ds_put_format(ds, "recirc(%"PRIu32")", recirc_id);
+    ds_put_format(ds, "recirc(%#"PRIx32")", recirc_id);
 }

 static void
diff --git a/tests/mpls-xlate.at b/tests/mpls-xlate.at
index 571b8ce..8f286c3 100644
--- a/tests/mpls-xlate.at
+++ b/tests/mpls-xlate.at
@@ -47,12 +47,12 @@ AT_CHECK([tail -1 stdout], [0],
 dnl Double MPLS pop
 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy
'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x8847),mpls(label=60,tc=
 AT_CHECK([tail -1 stdout], [0],
-  [Datapath actions: pop_mpls(eth_type=0x8847),recirc(1)
+  [Datapath actions: pop_mpls(eth_type=0x8847),recirc(0x1)
 ])

 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy
'recirc_id(1),in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x8847),mpls
 AT_CHECK([tail -1 stdout], [0],
-  [Datapath actions: pop_mpls(eth_type=0x800),recirc(2)
+  [Datapath actions: pop_mpls(eth_type=0x800),recirc(0x2)
 ])



>  static void
> --
> 2.1.4
>



More information about the dev mailing list