The number of masks in the datapath should not be large. But saving memory
is a good thing at any time. The change looks good to me.

Acked-by: Andy Zhou <az...@nicira.com>



On Wed, Nov 13, 2013 at 9:54 AM, Ben Pfaff <b...@nicira.com> wrote:

> We won't normally have a ton of flow masks but using a size_t to store
> values no bigger than sizeof(struct sw_flow_key) seems excessive.
>
> This reduces sw_flow_key_range and sw_flow_mask by 4 bytes on 32-bit
> systems.  On 64-bit systems it shrinks sw_flow_key_range by 12 bytes but
> sw_flow_mask only by 8 bytes due to padding.
>
> Compile tested only.
>
> Signed-off-by: Ben Pfaff <b...@nicira.com>
> ---
>  datapath/flow.h |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/datapath/flow.h b/datapath/flow.h
> index fdc309f..6b68cf1 100644
> --- a/datapath/flow.h
> +++ b/datapath/flow.h
> @@ -125,8 +125,8 @@ struct sw_flow_key {
>  } __aligned(BITS_PER_LONG/8); /* Ensure that we can do comparisons as
> longs. */
>
>  struct sw_flow_key_range {
> -       size_t start;
> -       size_t end;
> +       unsigned short int start;
> +       unsigned short int end;
>  };
>
>  struct sw_flow_mask {
> --
> 1.7.10.4
>
> _______________________________________________
> 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