[ovs-dev] [PATCH v2 2/6] ofp-actions: Align struct ofpact to OFPACT_ALIGNTO.
Jarno Rajahalme
jrajahalme at nicira.com
Tue Mar 10 22:43:22 UTC 2015
We already assume this alignment, let the compiler know it, too.
As a side-effect the sizeof(struct ofpact) also changes to
OFPACT_ALIGNTO, which should be fine.
Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
---
lib/ofp-actions.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/ofp-actions.h b/lib/ofp-actions.h
index a1a5bb1..c232513 100644
--- a/lib/ofp-actions.h
+++ b/lib/ofp-actions.h
@@ -156,7 +156,11 @@ enum {
* originate from OpenFlow, then setting 'raw' to zero should be fine:
* code to translate the ofpact to OpenFlow must tolerate this case.)
*/
-struct ofpact {
+/* Alignment. */
+#define OFPACT_ALIGNTO 8
+#define OFPACT_ALIGN(SIZE) ROUND_UP(SIZE, OFPACT_ALIGNTO)
+
+OVS_ALIGNED_STRUCT(OFPACT_ALIGNTO, ofpact) {
/* We want the space advantage of an 8-bit type here on every
* implementation, without giving up the advantage of having a useful type
* on implementations that support packed enums. */
@@ -170,11 +174,7 @@ struct ofpact {
uint16_t len; /* Length of the action, in bytes, including
* struct ofpact, excluding padding. */
};
-BUILD_ASSERT_DECL(sizeof(struct ofpact) == 4);
-
-/* Alignment. */
-#define OFPACT_ALIGNTO 8
-#define OFPACT_ALIGN(SIZE) ROUND_UP(SIZE, OFPACT_ALIGNTO)
+BUILD_ASSERT_DECL(sizeof(struct ofpact) == OFPACT_ALIGNTO);
static inline struct ofpact *
ofpact_next(const struct ofpact *ofpact)
--
1.7.10.4
More information about the dev
mailing list