summaryrefslogtreecommitdiff
path: root/ofproto
diff options
context:
space:
mode:
authorJoe Stringer <joe@ovn.org>2016-09-20 14:58:00 -0700
committerJoe Stringer <joe@ovn.org>2016-09-28 17:03:04 -0700
commite2b0b03df0ba4eff706e6aa000fadc9b0ec705bc (patch)
tree7d6433b2779a08a67bc15aa268a0185e6ca679bf /ofproto
parentfbf803b65064b6f31330791f232c805b7ae50930 (diff)
downloadopenvswitch-e2b0b03df0ba4eff706e6aa000fadc9b0ec705bc.tar.gz
revalidator: Simplify full-revalidation code.
Simplify the remaining bits of the original revalidation codepath to only handle the "full-revalidation" case. Make the 'ukey' parameter purely const by pushing the only piece that gets changed into a separate argument. Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
Diffstat (limited to 'ofproto')
-rw-r--r--ofproto/ofproto-dpif-upcall.c49
1 files changed, 18 insertions, 31 deletions
diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
index b30716c78..84f1de273 100644
--- a/ofproto/ofproto-dpif-upcall.c
+++ b/ofproto/ofproto-dpif-upcall.c
@@ -1922,12 +1922,10 @@ populate_xcache(struct udpif *udpif, struct udpif_key *ukey,
}
static enum reval_result
-revalidate_ukey__(struct udpif *udpif, struct udpif_key *ukey,
+revalidate_ukey__(struct udpif *udpif, const struct udpif_key *ukey,
uint16_t tcp_flags, struct ofpbuf *odp_actions,
- uint64_t reval_seq, struct recirc_refs *recircs)
- OVS_REQUIRES(ukey->mutex)
+ struct recirc_refs *recircs, struct xlate_cache *xcache)
{
- bool need_revalidate = (ukey->reval_seq != reval_seq);
struct xlate_out *xoutp;
struct netflow *netflow;
struct flow_wildcards dp_mask, wc;
@@ -1935,30 +1933,19 @@ revalidate_ukey__(struct udpif *udpif, struct udpif_key *ukey,
struct reval_context ctx = {
.odp_actions = odp_actions,
.netflow = &netflow,
- .wc = need_revalidate ? &wc : NULL,
+ .xcache = xcache,
+ .wc = &wc,
};
result = UKEY_DELETE;
xoutp = NULL;
netflow = NULL;
- if (need_revalidate) {
- xlate_cache_clear(ukey->xcache);
- }
- if (!ukey->xcache) {
- ukey->xcache = xlate_cache_new();
- }
- ctx.xcache = ukey->xcache;
if (xlate_ukey(udpif, ukey, tcp_flags, &ctx)) {
goto exit;
}
xoutp = &ctx.xout;
- if (!need_revalidate) {
- result = UKEY_KEEP;
- goto exit;
- }
-
if (xoutp->slow) {
ofpbuf_clear(odp_actions);
compose_slow_path(udpif, xoutp, &ctx.flow, ctx.flow.in_port.odp_port,
@@ -2039,28 +2026,28 @@ revalidate_ukey(struct udpif *udpif, struct udpif_key *ukey,
? stats->n_bytes - ukey->stats.n_bytes
: 0);
- if (need_revalidate
- && !should_revalidate(udpif, push.n_packets, ukey->stats.used)) {
- goto exit;
- }
-
- if (!need_revalidate) {
- if (!push.n_packets || ukey->xcache
- || !populate_xcache(udpif, ukey, push.tcp_flags)) {
- result = UKEY_KEEP;
- goto exit;
- }
+ if (need_revalidate) {
+ if (should_revalidate(udpif, push.n_packets, ukey->stats.used)) {
+ if (!ukey->xcache) {
+ ukey->xcache = xlate_cache_new();
+ } else {
+ xlate_cache_clear(ukey->xcache);
+ }
+ result = revalidate_ukey__(udpif, ukey, push.tcp_flags,
+ odp_actions, recircs, ukey->xcache);
+ } /* else delete; too expensive to revalidate */
+ } else if (!push.n_packets || ukey->xcache
+ || !populate_xcache(udpif, ukey, push.tcp_flags)) {
+ result = UKEY_KEEP;
}
- result = revalidate_ukey__(udpif, ukey, push.tcp_flags, odp_actions,
- reval_seq, recircs);
-exit:
/* Stats for deleted flows will be attributed upon flow deletion. Skip. */
if (result != UKEY_DELETE) {
xlate_push_stats(ukey->xcache, &push);
ukey->stats = *stats;
ukey->reval_seq = reval_seq;
}
+
return result;
}