On Thu, Oct 17, 2013 at 02:28:20PM -0700, Jarno Rajahalme wrote:
> This patch gets rid of the need for having explicit padding in struct
> flow as new fields are being added.  flow_wildcards_init_exact(), which
> used to set bits in both compiler generated and explicit padding, is
> removed.  match_wc_init() is now used instead, which generates the mask
> based on a given flow, setting bits only in fields which make sense.
> 
> Places where random bits were placed in struct flow have been changed to
> only set random bits on fields that are significant in the given context.
> This avoids setting padding bits.
> 
> - lib/flow:
>   - Properly initialize struct flow also in places we used to zero out
>     padding before.
>   - Add flow_random_hash_fields() used for testing.
>   - Remove flow_wildcards_init_exact() to avoid initializing
>      masks where compiler generated padding has bits set.
> - lib/match.c match_wc_init(): Wildcard transport layer fields for later
>   fragments, remove match_init_exact(), which used
>   flow_wildcards_init_exact().
> - tests/test-flows.c: use match_wc_init() instead of match_init_exact()
> - tests/flowgen.pl: generate more accurate packets and flows when
>   fragmenting, mark unavailable fields as wildcarded.
> 
> Signed-off-by: Jarno Rajahalme <jrajaha...@nicira.com>

This is nice, thanks.

One sparse warning:

    ../lib/flow.c:807:23: warning: restricted __be16 degrades to integer
    ../lib/flow.c:807:20: warning: incorrect type in assignment (different base 
types)
    ../lib/flow.c:807:20:    expected restricted __be16 [usertype] vlan_tci
    ../lib/flow.c:807:20:    got int

which I fixed by adding parentheses here:

    flow->vlan_tci = (OVS_FORCE ovs_be16) (random_uint16() & VLAN_VID_MASK);

and applied the result to master.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to