[ovs-dev] [PATCH] datapath: fix sw_flow_key alignment

Andy Zhou azhou at nicira.com
Thu Aug 29 20:38:58 UTC 2013


sw_flow_key alignment was declared as " __aligned(__alignof__(long))"
However, this breaks on m68k architecture where long is 32 bit in size
but 16 bit aligned by default. Use __aligned(sizeof(long) instead.

Reported by: Fengguang Wu <fengguan.wu at intel.com>

Signed-off-by: Andy Zhou <azhou at nicira.com>
---
 datapath/flow.c |    1 +
 datapath/flow.h |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/datapath/flow.c b/datapath/flow.c
index 7a697a4..fe83b78 100644
--- a/datapath/flow.c
+++ b/datapath/flow.c
@@ -1996,6 +1996,7 @@ nla_put_failure:
 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));
 
 	flow_cache = kmem_cache_create("sw_flow", sizeof(struct sw_flow), 0,
 					0, NULL);
diff --git a/datapath/flow.h b/datapath/flow.h
index eda74f3..2d854fc 100644
--- a/datapath/flow.h
+++ b/datapath/flow.h
@@ -127,7 +127,7 @@ struct sw_flow_key {
 			} nd;
 		} ipv6;
 	};
-} __aligned(__alignof__(long));
+} __aligned(sizeof(long));
 
 struct sw_flow {
 	struct rcu_head rcu;
-- 
1.7.9.5




More information about the dev mailing list