Bug fix: Restore 64-bit struct alignment
Commit 238c5065 (Vlan pcp match: Reorder VLAN priority field...) changed ofp_match from 36B to 40B, breaking the 8B alignment of a number of structs. This commit modifies those structs to at least pass the assertion tests and regression tests.
This commit is contained in:
1 parent
fcb27f377b
commit
623e899a93
4 files changed
+7
-13
No files matched your search
+1
-3
@@ -1122,8 +1122,6 @@ dp_send_flow_end(struct datapath *dp, struct sw_flow *flow,
|
||||
|
||||
nfe->idle_timeout = htons(flow->idle_timeout);
|
||||
|
||||
memset(nfe->pad, 0, sizeof nfe->pad);
|
||||
|
||||
nfe->init_time = cpu_to_be64(jiffies_64_to_msecs(flow->created));
|
||||
nfe->used_time = cpu_to_be64(jiffies_64_to_msecs(flow->used));
|
||||
nfe->end_time = cpu_to_be64(jiffies_64_to_msecs(get_jiffies_64()));
|
||||
@@ -1526,7 +1524,7 @@ static int flow_stats_dump_callback(struct sw_flow *flow, void *private)
|
||||
ofs->priority = htons(flow->priority);
|
||||
ofs->idle_timeout = htons(flow->idle_timeout);
|
||||
ofs->hard_timeout = htons(flow->hard_timeout);
|
||||
memset(ofs->pad2, 0, sizeof ofs->pad2);
|
||||
memset(&ofs->pad2, 0, sizeof ofs->pad2);
|
||||
ofs->packet_count = cpu_to_be64(flow->packet_count);
|
||||
ofs->byte_count = cpu_to_be64(flow->byte_count);
|
||||
memcpy(ofs->actions, sf_acts->actions, sf_acts->actions_len);
|
||||
|
||||
@@ -182,8 +182,6 @@ struct nx_flow_end {
|
||||
|
||||
uint16_t idle_timeout; /* Idle time before discarding (seconds). */
|
||||
|
||||
uint8_t pad[4]; /* Align to 64-bits. */
|
||||
|
||||
uint64_t init_time; /* Time flow started in milliseconds. */
|
||||
uint64_t used_time; /* Time entry was last used in milliseconds. */
|
||||
uint64_t end_time; /* Time flow ended in milliseconds. */
|
||||
@@ -191,6 +189,6 @@ struct nx_flow_end {
|
||||
uint64_t packet_count;
|
||||
uint64_t byte_count;
|
||||
};
|
||||
OFP_ASSERT(sizeof(struct nx_flow_end) == 108);
|
||||
OFP_ASSERT(sizeof(struct nx_flow_end) == 104);
|
||||
|
||||
#endif /* openflow/nicira-ext.h */
|
||||
@@ -584,11 +584,11 @@ struct ofp_flow_removed {
|
||||
|
||||
uint32_t duration; /* Time flow was alive in seconds. */
|
||||
uint16_t idle_timeout; /* Idle timeout from original flow mod. */
|
||||
uint8_t pad2[2]; /* Align to 64-bits. */
|
||||
uint8_t pad2[6]; /* Align to 64-bits. */
|
||||
uint64_t packet_count;
|
||||
uint64_t byte_count;
|
||||
};
|
||||
OFP_ASSERT(sizeof(struct ofp_flow_removed) == 76);
|
||||
OFP_ASSERT(sizeof(struct ofp_flow_removed) == 80);
|
||||
|
||||
/* Values for 'type' in ofp_error_message. These values are immutable: they
|
||||
* will not change in future versions of the protocol (although new values may
|
||||
@@ -741,12 +741,12 @@ struct ofp_flow_stats {
|
||||
when this is not an exact-match entry. */
|
||||
uint16_t idle_timeout; /* Number of seconds idle before expiration. */
|
||||
uint16_t hard_timeout; /* Number of seconds before expiration. */
|
||||
uint16_t pad2[3]; /* Pad to 64 bits. */
|
||||
uint16_t pad2; /* Pad to 64 bits. */
|
||||
uint64_t packet_count; /* Number of packets in flow. */
|
||||
uint64_t byte_count; /* Number of bytes in flow. */
|
||||
struct ofp_action_header actions[0]; /* Actions. */
|
||||
};
|
||||
OFP_ASSERT(sizeof(struct ofp_flow_stats) == 76);
|
||||
OFP_ASSERT(sizeof(struct ofp_flow_stats) == 72);
|
||||
|
||||
/* Body for ofp_stats_request of type OFPST_AGGREGATE. */
|
||||
struct ofp_aggregate_stats_request {
|
||||
|
||||
@@ -762,8 +762,6 @@ dp_send_flow_end(struct datapath *dp, struct sw_flow *flow,
|
||||
|
||||
nfe->idle_timeout = htons(flow->idle_timeout);
|
||||
|
||||
memset(nfe->pad, 0, sizeof nfe->pad);
|
||||
|
||||
nfe->init_time = htonll(flow->created);
|
||||
nfe->used_time = htonll(flow->used);
|
||||
nfe->end_time = htonll(time_msec());
|
||||
@@ -813,7 +811,7 @@ fill_flow_stats(struct ofpbuf *buffer, struct sw_flow *flow,
|
||||
ofs->priority = htons(flow->priority);
|
||||
ofs->idle_timeout = htons(flow->idle_timeout);
|
||||
ofs->hard_timeout = htons(flow->hard_timeout);
|
||||
memset(ofs->pad2, 0, sizeof ofs->pad2);
|
||||
memset(&ofs->pad2, 0, sizeof ofs->pad2);
|
||||
ofs->packet_count = htonll(flow->packet_count);
|
||||
ofs->byte_count = htonll(flow->byte_count);
|
||||
memcpy(ofs->actions, flow->sf_acts->actions, flow->sf_acts->actions_len);
|
||||
|
||||
Reference in new issue
Block a user