[ovs-dev] [#8024v2 1/5] Support matching IPv6 flow label.

Jesse Gross jesse at nicira.com
Wed Nov 9 01:12:44 UTC 2011


On Tue, Nov 8, 2011 at 3:57 PM, Justin Pettit <jpettit at nicira.com> wrote:
> Signed-off-by: Justin Pettit <jpettit at nicira.com>

I got some sparse errors:
/home/jesse/openvswitch/datapath/linux/flow.c:205:40: warning:
restricted __be32 degrades to integer
/home/jesse/openvswitch/datapath/linux/flow.c:205:25: warning:
incorrect type in assignment (different base types)
/home/jesse/openvswitch/datapath/linux/flow.c:205:25:    expected
restricted __be32 [usertype] label
/home/jesse/openvswitch/datapath/linux/flow.c:205:25:    got unsigned int

I think it's just an incorrect cast though, not an actual problem.

> diff --git a/datapath/flow.h b/datapath/flow.h
> index 5bd8c8d..ba8c66a 100644
> --- a/datapath/flow.h
> +++ b/datapath/flow.h
> @@ -73,6 +73,7 @@ struct sw_flow_key {
>                                struct in6_addr src;    /* IPv6 source address. */
>                                struct in6_addr dst;    /* IPv6 destination address. */
>                        } addr;
> +                       __be32 label;

Can you add a comment next to this?

> diff --git a/include/linux/openvswitch.h b/include/linux/openvswitch.h
> index 1ce2a1e..c2b4285 100644
> --- a/include/linux/openvswitch.h
> +++ b/include/linux/openvswitch.h
> @@ -322,6 +322,7 @@ struct ovs_key_ipv4 {
>  struct ovs_key_ipv6 {
>        __be32 ipv6_src[4];
>        __be32 ipv6_dst[4];
> +       __be32 ipv6_label;

Can you add a comment as to how the 20 bits are placed?

We also need to update ODPUTIL_FLOW_KEY_BYTES in lib/odp-util.h.

> diff --git a/lib/odp-util.c b/lib/odp-util.c
> index 1e9289a..4562d09 100644
> --- a/lib/odp-util.c
> +++ b/lib/odp-util.c
> @@ -385,10 +385,10 @@ format_odp_key_attr(const struct nlattr *a, struct ds *ds)
>         inet_ntop(AF_INET6, ipv6_key->ipv6_src, src_str, sizeof src_str);
>         inet_ntop(AF_INET6, ipv6_key->ipv6_dst, dst_str, sizeof dst_str);
>
> -        ds_put_format(ds, "ipv6(src=%s,dst=%s,proto=%"PRId8",tos=%"PRIu8","
> -                      "frag=%s)",
> -                      src_str, dst_str, ipv6_key->ipv6_proto,
> -                      ipv6_key->ipv6_tos,
> +        ds_put_format(ds, "ipv6(src=%s,dst=%s,label=0x%"PRIx32",proto=%"PRId8

I think the more canonical form would be to use # instead of 0x explicitly.



More information about the dev mailing list