aboutsummaryrefslogtreecommitdiff
path: root/lib/odp-util.h
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2012-05-04 14:56:40 -0700
committerBen Pfaff <blp@nicira.com>2012-05-09 13:28:37 -0700
commit05a5c1310c4850eeb5422c5b93f7f7483981f2d6 (patch)
tree987b59a2e20922c26619cf41678d6bdfcb2dd2b9 /lib/odp-util.h
parentabeea3938034a1b13da315e7de3e4519d01822f8 (diff)
odp-util: Change user_action_cookie from struct to union.
An upcoming commit will introduce a new type and a new use for the additional members. It seems cleanest to use a union, rather that using the existing members multiple ways. Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/odp-util.h')
-rw-r--r--lib/odp-util.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/odp-util.h b/lib/odp-util.h
index cdafbe46..c52e4709 100644
--- a/lib/odp-util.h
+++ b/lib/odp-util.h
@@ -123,18 +123,20 @@ enum user_action_cookie_type {
/* user_action_cookie is passed as argument to OVS_ACTION_ATTR_USERSPACE.
* Since it is passed to kernel as u64, its size has to be 8 bytes. */
-struct user_action_cookie {
+union user_action_cookie {
uint16_t type; /* enum user_action_cookie_type. */
- /* The following members are used only by USER_ACTION_COOKIE_SFLOW. */
- ovs_be16 vlan_tci; /* Destination VLAN TCI. */
- uint32_t output; /* SFL_FLOW_SAMPLE_TYPE 'output' value. */
+ struct {
+ uint16_t type; /* USER_ACTION_COOKIE_SFLOW. */
+ ovs_be16 vlan_tci; /* Destination VLAN TCI. */
+ uint32_t output; /* SFL_FLOW_SAMPLE_TYPE 'output' value. */
+ } sflow;
};
-BUILD_ASSERT_DECL(sizeof(struct user_action_cookie) == 8);
+BUILD_ASSERT_DECL(sizeof(union user_action_cookie) == 8);
size_t odp_put_userspace_action(uint32_t pid,
- const struct user_action_cookie *,
+ const union user_action_cookie *,
struct ofpbuf *odp_actions);
void commit_odp_actions(const struct flow *, struct flow *base,