X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fodp-util.h;h=dd320aca523b5f8b63aee6e3edfe5c35584d5106;hb=a9a2da38941ea4d312559543a3fb813d8fe7fd4e;hp=4020660b43998854214d289f8d66e1feed73ae75;hpb=18c43631587c68bcd8ce82fcdd6b27ed3d998071;p=openvswitch diff --git a/lib/odp-util.h b/lib/odp-util.h index 4020660b..dd320aca 100644 --- a/lib/odp-util.h +++ b/lib/odp-util.h @@ -86,13 +86,15 @@ void format_odp_actions(struct ds *, const struct nlattr *odp_actions, * key types are added. */ BUILD_ASSERT_DECL(__ODP_KEY_ATTR_MAX == 14); -/* We allocate temporary on-stack buffers for flow keys as arrays of uint32_t - * to ensure proper 32-bit alignment for Netlink attributes. (An array of - * "struct nlattr" might not, in theory, be sufficiently aligned because it - * only contains 16-bit types.) */ -#define ODPUTIL_FLOW_KEY_U32S DIV_ROUND_UP(ODPUTIL_FLOW_KEY_BYTES, 4) +/* A buffer with sufficient size and alignment to hold an nlattr-formatted flow + * key. An array of "struct nlattr" might not, in theory, be sufficiently + * aligned because it only contains 16-bit types. */ +struct odputil_keybuf { + uint32_t keybuf[DIV_ROUND_UP(ODPUTIL_FLOW_KEY_BYTES, 4)]; +}; void odp_flow_key_format(const struct nlattr *, size_t, struct ds *); +int odp_flow_key_from_string(const char *s, struct ofpbuf *); void odp_flow_key_from_flow(struct ofpbuf *, const struct flow *); int odp_flow_key_to_flow(const struct nlattr *, size_t, struct flow *);