2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-27 15:18:06 +00:00

flow: Take advantage of zero-padding in struct flow and flow_wildcards.

Since we know these bytes are always 0 in both structures, we can use
faster functions that only work with full words.

Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Ben Pfaff
2012-06-18 15:12:57 -07:00
parent 51c14ddd8d
commit 16c6d0c384
2 changed files with 8 additions and 18 deletions

View File

@@ -756,11 +756,7 @@ flow_wildcards_combine(struct flow_wildcards *dst,
uint32_t
flow_wildcards_hash(const struct flow_wildcards *wc, uint32_t basis)
{
/* If you change struct flow_wildcards and thereby trigger this
* assertion, please check that the new struct flow_wildcards has no holes
* in it before you update the assertion. */
BUILD_ASSERT_DECL(sizeof *wc == 120 + FLOW_N_REGS * 4);
return hash_bytes(wc, sizeof *wc, basis);
return hash_words((const uint32_t *) wc, sizeof *wc / 4, basis);
}
/* Returns true if 'a' and 'b' represent the same wildcards, false if they are