mirror of
https://github.com/openvswitch/ovs
synced 2025-10-25 15:07:05 +00:00
miniflow: Use 64-bit data.
So far the compressed flow data in struct miniflow has been in 32-bit words with a 63-bit map, allowing for a maximum size of struct flow of 252 bytes. With the forthcoming Geneve options this is not sufficient any more. This patch solves the problem by changing the miniflow data to 64-bit words, doubling the flow max size to 504 bytes. Since the word size is doubled, there is some loss in compression efficiency. To counter this some of the flow fields have been reordered to keep related fields together (e.g., the source and destination IP addresses share the same 64-bit word). This change should speed up flow data processing on 64-bit CPUs, which may help counterbalance the impact of making the struct flow bigger in the future. Classifier lookup stage boundaries are also changed to 64-bit alignment, as the current algorithm depends on each miniflow word to not be split between ranges. This has resulted in new padding (part of the 'mpls_lse' field). The 'dp_hash' field is also moved to packet metadata to eliminate otherwise needed padding there. This allows the L4 to fit into one 64-bit word, and also makes matches on 'dp_hash' more efficient as misses can be found already on stage 1. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
10
lib/match.c
10
lib/match.c
@@ -870,7 +870,7 @@ match_format(const struct match *match, struct ds *s, int priority)
|
||||
|
||||
int i;
|
||||
|
||||
BUILD_ASSERT_DECL(FLOW_WC_SEQ == 28);
|
||||
BUILD_ASSERT_DECL(FLOW_WC_SEQ == 29);
|
||||
|
||||
if (priority != OFP_DEFAULT_PRIORITY) {
|
||||
ds_put_format(s, "priority=%d,", priority);
|
||||
@@ -1200,13 +1200,13 @@ bool
|
||||
minimatch_matches_flow(const struct minimatch *match,
|
||||
const struct flow *target)
|
||||
{
|
||||
const uint32_t *target_u32 = (const uint32_t *) target;
|
||||
const uint32_t *flowp = miniflow_get_u32_values(&match->flow);
|
||||
const uint32_t *maskp = miniflow_get_u32_values(&match->mask.masks);
|
||||
const uint64_t *target_u64 = (const uint64_t *) target;
|
||||
const uint64_t *flowp = miniflow_get_values(&match->flow);
|
||||
const uint64_t *maskp = miniflow_get_values(&match->mask.masks);
|
||||
int idx;
|
||||
|
||||
MAP_FOR_EACH_INDEX(idx, match->flow.map) {
|
||||
if ((*flowp++ ^ target_u32[idx]) & *maskp++) {
|
||||
if ((*flowp++ ^ target_u64[idx]) & *maskp++) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user