[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEP_g=9y-HeG0vHS2v-dk7eDp=T0denddykDO3TJtk4UJ062Mg@mail.gmail.com>
Date: Fri, 30 Aug 2013 11:22:11 -0700
From: Jesse Gross <jesse@...ira.com>
To: Andy Zhou <azhou@...ira.com>
Cc: David Miller <davem@...emloft.net>,
"dev@...nvswitch.org" <dev@...nvswitch.org>,
netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH] openvswitch: fix sw_flow_key alignment
On Fri, Aug 30, 2013 at 10:32 AM, Andy Zhou <azhou@...ira.com> wrote:
> diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
> index ad1aeeb..fe7524c4 100644
> --- a/net/openvswitch/flow.c
> +++ b/net/openvswitch/flow.c
> int ovs_flow_init(void)
> {
> BUILD_BUG_ON(sizeof(struct sw_flow_key) % sizeof(long));
> + BUILD_BUG_ON(sizeof(struct sw_flow_key) % __alignof__(long));
Should this be checking alignof struct sw_flow_key instead of the size?
> flow_cache = kmem_cache_create("sw_flow", sizeof(struct sw_flow), 0,
> 0, NULL);
> diff --git a/net/openvswitch/flow.h b/net/openvswitch/flow.h
> index b65f885..202c4c4 100644
> --- a/net/openvswitch/flow.h
> +++ b/net/openvswitch/flow.h
> @@ -125,7 +125,7 @@ struct sw_flow_key {
> } nd;
> } ipv6;
> };
> -} __aligned(__alignof__(long));
> +} __aligned(sizeof(long));
This is going to result in the alignment issue discussed yesterday
where on 32-bit machines the 64 bit members potentially become
misaligned. The suggestion that Geert made was to just drop this
entirely and rely on the natural alignment from these values.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists