summaryrefslogtreecommitdiff
path: root/lib/tnl-ports.c
diff options
context:
space:
mode:
authorJarno Rajahalme <jrajahalme@nicira.com>2015-06-09 17:00:00 -0700
committerJarno Rajahalme <jrajahalme@nicira.com>2015-06-10 16:17:47 -0700
commit2b7b1427c177d28ec63632646ce896eec7f162b6 (patch)
tree97d4fecd8ca81249fbd5ccf9cb8a03a28571460e /lib/tnl-ports.c
parentdb5076eee46e5ad4d67dc02b902c9b4aaeb190a4 (diff)
downloadopenvswitch-2b7b1427c177d28ec63632646ce896eec7f162b6.tar.gz
classifier: Support table versioning
This patch allows classifier rules to become visible and invisible in specific versions. A 'version' is defined as a positive monotonically increasing integer, which never wraps around. The new 'visibility' attribute replaces the prior 'to_be_removed' and 'visible' attributes. When versioning is not used, the 'version' parameter should be passed as 'CLS_MIN_VERSION' when creating rules, and 'CLS_MAX_VERSION' when looking up flows. This feature enables the support for atomic OpenFlow bundles without significant performance penalty on 64-bit systems. There is a performance decrease in 32-bit systems due to 64-bit atomics used. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/tnl-ports.c')
-rw-r--r--lib/tnl-ports.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/tnl-ports.c b/lib/tnl-ports.c
index 759d6ba33..2602db543 100644
--- a/lib/tnl-ports.c
+++ b/lib/tnl-ports.c
@@ -84,7 +84,7 @@ tnl_port_map_insert(odp_port_t port, ovs_be32 ip_dst, ovs_be16 udp_port,
ovs_mutex_lock(&mutex);
do {
- cr = classifier_lookup(&cls, &match.flow, NULL);
+ cr = classifier_lookup(&cls, CLS_MAX_VERSION, &match.flow, NULL);
p = tnl_port_cast(cr);
/* Try again if the rule was released before we get the reference. */
} while (p && !ovs_refcount_try_ref_rcu(&p->ref_cnt));
@@ -99,7 +99,7 @@ tnl_port_map_insert(odp_port_t port, ovs_be32 ip_dst, ovs_be16 udp_port,
match.wc.masks.tp_dst = OVS_BE16_MAX;
match.wc.masks.nw_src = OVS_BE32_MAX;
- cls_rule_init(&p->cr, &match, 0); /* Priority == 0. */
+ cls_rule_init(&p->cr, &match, 0, CLS_MIN_VERSION); /* Priority == 0. */
ovs_refcount_init(&p->ref_cnt);
ovs_strlcpy(p->dev_name, dev_name, sizeof p->dev_name);
@@ -130,7 +130,7 @@ tnl_port_map_delete(ovs_be32 ip_dst, ovs_be16 udp_port)
tnl_port_init_flow(&flow, ip_dst, udp_port);
- cr = classifier_lookup(&cls, &flow, NULL);
+ cr = classifier_lookup(&cls, CLS_MAX_VERSION, &flow, NULL);
tnl_port_unref(cr);
}
@@ -139,7 +139,8 @@ tnl_port_map_delete(ovs_be32 ip_dst, ovs_be16 udp_port)
odp_port_t
tnl_port_map_lookup(struct flow *flow, struct flow_wildcards *wc)
{
- const struct cls_rule *cr = classifier_lookup(&cls, flow, wc);
+ const struct cls_rule *cr = classifier_lookup(&cls, CLS_MAX_VERSION, flow,
+ wc);
return (cr) ? tnl_port_cast(cr)->portno : ODPP_NONE;
}