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:
@@ -156,7 +156,11 @@ enum {
|
|||||||
* originate from OpenFlow, then setting 'raw' to zero should be fine:
|
* originate from OpenFlow, then setting 'raw' to zero should be fine:
|
||||||
* code to translate the ofpact to OpenFlow must tolerate this case.)
|
* 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
|
/* We want the space advantage of an 8-bit type here on every
|
||||||
* implementation, without giving up the advantage of having a useful type
|
* implementation, without giving up the advantage of having a useful type
|
||||||
* on implementations that support packed enums. */
|
* on implementations that support packed enums. */
|
||||||
@@ -170,11 +174,7 @@ struct ofpact {
|
|||||||
uint16_t len; /* Length of the action, in bytes, including
|
uint16_t len; /* Length of the action, in bytes, including
|
||||||
* struct ofpact, excluding padding. */
|
* struct ofpact, excluding padding. */
|
||||||
};
|
};
|
||||||
BUILD_ASSERT_DECL(sizeof(struct ofpact) == 4);
|
BUILD_ASSERT_DECL(sizeof(struct ofpact) == OFPACT_ALIGNTO);
|
||||||
|
|
||||||
/* Alignment. */
|
|
||||||
#define OFPACT_ALIGNTO 8
|
|
||||||
#define OFPACT_ALIGN(SIZE) ROUND_UP(SIZE, OFPACT_ALIGNTO)
|
|
||||||
|
|
||||||
static inline struct ofpact *
|
static inline struct ofpact *
|
||||||
ofpact_next(const struct ofpact *ofpact)
|
ofpact_next(const struct ofpact *ofpact)
|
||||||
|
|||||||
Reference in New Issue
Block a user