2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 22:35:15 +00:00

Revert "pvector: Expose non-concurrent priority vector."

This reverts commit 8bdfe13138.

I failed to see that lib/dpif-netdev.c actually needs the concurrency
provided by pvector prior to this change.  More specifically, when a
subtable is removed, concurrent lookups may skip over another subtable
swapped in to the place of the removed subtable in the vector.

Since this was the only use of the non-concurrent pvector, it is
cleaner to revert the whole patch.

Reported-by: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
This commit is contained in:
Jarno Rajahalme
2016-08-10 14:58:51 -07:00
parent fa44a4a3ff
commit da9cfca6e2
6 changed files with 184 additions and 259 deletions

View File

@@ -163,7 +163,7 @@ struct emc_cache {
struct dpcls {
struct cmap subtables_map;
struct pvector *subtables;
struct pvector subtables;
};
/* A rule to be inserted to the classifier. */
@@ -4770,13 +4770,13 @@ static void
dpcls_init(struct dpcls *cls)
{
cmap_init(&cls->subtables_map);
cls->subtables = pvector_alloc(4);
pvector_init(&cls->subtables);
}
static void
dpcls_destroy_subtable(struct dpcls *cls, struct dpcls_subtable *subtable)
{
pvector_remove(cls->subtables, subtable);
pvector_remove(&cls->subtables, subtable);
cmap_remove(&cls->subtables_map, &subtable->cmap_node,
subtable->mask.hash);
cmap_destroy(&subtable->rules);
@@ -4797,7 +4797,7 @@ dpcls_destroy(struct dpcls *cls)
dpcls_destroy_subtable(cls, subtable);
}
cmap_destroy(&cls->subtables_map);
free(cls->subtables);
pvector_destroy(&cls->subtables);
}
}
@@ -4812,7 +4812,8 @@ dpcls_create_subtable(struct dpcls *cls, const struct netdev_flow_key *mask)
cmap_init(&subtable->rules);
netdev_flow_key_clone(&subtable->mask, mask);
cmap_insert(&cls->subtables_map, &subtable->cmap_node, mask->hash);
pvector_push_back(&cls->subtables, subtable, 0);
pvector_insert(&cls->subtables, subtable, 0);
pvector_publish(&cls->subtables);
return subtable;
}
@@ -4855,6 +4856,7 @@ dpcls_remove(struct dpcls *cls, struct dpcls_rule *rule)
if (cmap_remove(&subtable->rules, &rule->cmap_node, rule->flow.hash)
== 0) {
dpcls_destroy_subtable(cls, subtable);
pvector_publish(&cls->subtables);
}
}
@@ -4918,7 +4920,7 @@ dpcls_lookup(const struct dpcls *cls, const struct netdev_flow_key keys[],
* search-key against each subtable, but when a match is found for a
* search-key, the search for that key can stop because the rules are
* non-overlapping. */
PVECTOR_FOR_EACH (subtable, cls->subtables) {
PVECTOR_FOR_EACH (subtable, &cls->subtables) {
const struct netdev_flow_key *mkeys = keys;
struct dpcls_rule **mrules = rules;
map_type remains = 0;