From: Andy Zhou <azhou@nicira.com>
To: davem@davemloft.net
Cc: dev@openvswitch.org, netdev@vger.kernel.org,
Andy Zhou <azhou@nicira.com>
Subject: [PATCH] openvswitch: fix sw_flow_key alignment
Date: Fri, 30 Aug 2013 10:32:20 -0700 [thread overview]
Message-ID: <1377883940-8995-1-git-send-email-azhou@nicira.com> (raw)
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@intel.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
---
net/openvswitch/flow.c | 4 +---
net/openvswitch/flow.h | 2 +-
2 files changed, 2 insertions(+), 4 deletions(-)
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
@@ -1009,9 +1009,6 @@ static u32 ovs_flow_hash(const struct sw_flow_key *key, int key_start,
u32 *hash_key = (u32 *)((u8 *)key + key_start);
int hash_u32s = (key_end - key_start) >> 2;
- /* Make sure number of hash bytes are multiple of u32. */
- BUILD_BUG_ON(sizeof(long) % sizeof(u32));
-
return jhash2(hash_key, hash_u32s, 0);
}
@@ -1982,6 +1979,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/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));
struct sw_flow {
struct rcu_head rcu;
--
1.7.9.5
next reply other threads:[~2013-08-30 17:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-30 17:32 Andy Zhou [this message]
2013-08-30 18:22 ` [PATCH] openvswitch: fix sw_flow_key alignment Jesse Gross
2013-08-30 18:42 ` David Miller
2013-08-30 23:20 ` Jesse Gross
2013-08-31 4:16 ` David Miller
2013-09-03 22:06 ` Jesse Gross
2013-09-05 17:37 ` Jesse Gross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1377883940-8995-1-git-send-email-azhou@nicira.com \
--to=azhou@nicira.com \
--cc=davem@davemloft.net \
--cc=dev@openvswitch.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).