diff options
author | Jarno Rajahalme <jarno@ovn.org> | 2016-07-29 11:04:49 -0700 |
---|---|---|
committer | Jarno Rajahalme <jarno@ovn.org> | 2016-07-29 11:12:08 -0700 |
commit | 8bdfe1313894047d44349fa4cf4402970865950f (patch) | |
tree | 5e9ee8d467a9bba7f4a285a6d70d4df543667c99 /lib/classifier.c | |
parent | 93f25605e49e106c1b05babd21923d5ad6bb551b (diff) | |
download | openvswitch-8bdfe1313894047d44349fa4cf4402970865950f.tar.gz |
pvector: Expose non-concurrent priority vector.
PMD threads use pvectors but do not need the overhead of the
concurrent version. Expose the non-concurrent version for
that use.
Note that struct pvector is renamed as struct cpvector (for concurrent
priority vector), and the former struct pvector_impl is now struct
pvector.
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'lib/classifier.c')
-rw-r--r-- | lib/classifier.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/classifier.c b/lib/classifier.c index 54941ed04..8af1cb632 100644 --- a/lib/classifier.c +++ b/lib/classifier.c @@ -326,7 +326,7 @@ classifier_init(struct classifier *cls, const uint8_t *flow_segments) { cls->n_rules = 0; cmap_init(&cls->subtables_map); - pvector_init(&cls->subtables); + cpvector_init(&cls->subtables); cls->n_flow_segments = 0; if (flow_segments) { while (cls->n_flow_segments < CLS_MAX_INDICES @@ -360,7 +360,7 @@ classifier_destroy(struct classifier *cls) } cmap_destroy(&cls->subtables_map); - pvector_destroy(&cls->subtables); + cpvector_destroy(&cls->subtables); } } @@ -659,20 +659,20 @@ classifier_replace(struct classifier *cls, const struct cls_rule *rule, if (n_rules == 1) { subtable->max_priority = rule->priority; subtable->max_count = 1; - pvector_insert(&cls->subtables, subtable, rule->priority); + cpvector_insert(&cls->subtables, subtable, rule->priority); } else if (rule->priority == subtable->max_priority) { ++subtable->max_count; } else if (rule->priority > subtable->max_priority) { subtable->max_priority = rule->priority; subtable->max_count = 1; - pvector_change_priority(&cls->subtables, subtable, rule->priority); + cpvector_change_priority(&cls->subtables, subtable, rule->priority); } /* Nothing was replaced. */ cls->n_rules++; if (cls->publish) { - pvector_publish(&cls->subtables); + cpvector_publish(&cls->subtables); } return NULL; @@ -804,12 +804,12 @@ check_priority: } } subtable->max_priority = max_priority; - pvector_change_priority(&cls->subtables, subtable, max_priority); + cpvector_change_priority(&cls->subtables, subtable, max_priority); } } if (cls->publish) { - pvector_publish(&cls->subtables); + cpvector_publish(&cls->subtables); } /* free the rule. */ @@ -960,8 +960,8 @@ classifier_lookup__(const struct classifier *cls, cls_version_t version, /* Main loop. */ struct cls_subtable *subtable; - PVECTOR_FOR_EACH_PRIORITY (subtable, hard_pri + 1, 2, sizeof *subtable, - &cls->subtables) { + CPVECTOR_FOR_EACH_PRIORITY (subtable, hard_pri + 1, 2, sizeof *subtable, + &cls->subtables) { struct cls_conjunction_set *conj_set; /* Skip subtables with no match, or where the match is lower-priority @@ -1232,8 +1232,8 @@ classifier_rule_overlaps(const struct classifier *cls, struct cls_subtable *subtable; /* Iterate subtables in the descending max priority order. */ - PVECTOR_FOR_EACH_PRIORITY (subtable, target->priority, 2, - sizeof(struct cls_subtable), &cls->subtables) { + CPVECTOR_FOR_EACH_PRIORITY (subtable, target->priority, 2, + sizeof(struct cls_subtable), &cls->subtables) { struct { struct minimask mask; uint64_t storage[FLOW_U64S]; @@ -1351,8 +1351,8 @@ cls_cursor_start(const struct classifier *cls, const struct cls_rule *target, cursor.rule = NULL; /* Find first rule. */ - PVECTOR_CURSOR_FOR_EACH (subtable, &cursor.subtables, - &cursor.cls->subtables) { + CPVECTOR_CURSOR_FOR_EACH (subtable, &cursor.subtables, + &cursor.cls->subtables) { const struct cls_rule *rule = search_subtable(subtable, &cursor); if (rule) { @@ -1379,7 +1379,7 @@ cls_cursor_next(struct cls_cursor *cursor) } } - PVECTOR_CURSOR_FOR_EACH_CONTINUE (subtable, &cursor->subtables) { + CPVECTOR_CURSOR_FOR_EACH_CONTINUE (subtable, &cursor->subtables) { rule = search_subtable(subtable, cursor); if (rule) { cursor->subtable = subtable; @@ -1511,7 +1511,7 @@ destroy_subtable(struct classifier *cls, struct cls_subtable *subtable) { int i; - pvector_remove(&cls->subtables, subtable); + cpvector_remove(&cls->subtables, subtable); cmap_remove(&cls->subtables_map, &subtable->cmap_node, minimask_hash(&subtable->mask, 0)); |