2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-25 15:07:05 +00:00

ofp-actions: Align struct ofpact to OFPACT_ALIGNTO.

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@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Jarno Rajahalme
2015-03-13 13:27:19 -07:00
parent 657ac953c9
commit 18287cd35e

View File

@@ -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)