From 5e73c322580c2ea1604d55c5318943135564e896 Mon Sep 17 00:00:00 2001 From: Joe Stringer Date: Tue, 1 Jul 2014 09:54:18 +0000 Subject: [PATCH] revalidator: Simplify push_dump_ops__(). Commit acaa8dac49 (revalidator: Eliminate duplicate flow handling.) ensured that a ukey will always exist for a given flow, even if it is about to be deleted. This means that push_dump_ops__() no longer needs to handle the case where there is no ukey. This commit removes the redundant code. Signed-off-by: Joe Stringer Acked-by: Ben Pfaff --- ofproto/ofproto-dpif-upcall.c | 39 ++++++++++++++++------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c index 62ea48ad21c..2e58d94e3a1 100644 --- a/ofproto/ofproto-dpif-upcall.c +++ b/ofproto/ofproto-dpif-upcall.c @@ -1288,38 +1288,35 @@ push_dump_ops__(struct udpif *udpif, struct dump_op *ops, size_t n_ops) struct dpif_flow_stats *push, *stats, push_buf; stats = op->op.u.flow_del.stats; - if (op->ukey) { - push = &push_buf; - ovs_mutex_lock(&op->ukey->mutex); - push->used = MAX(stats->used, op->ukey->stats.used); - push->tcp_flags = stats->tcp_flags | op->ukey->stats.tcp_flags; - push->n_packets = stats->n_packets - op->ukey->stats.n_packets; - push->n_bytes = stats->n_bytes - op->ukey->stats.n_bytes; - ovs_mutex_unlock(&op->ukey->mutex); - } else { - push = stats; - } + push = &push_buf; + + ovs_mutex_lock(&op->ukey->mutex); + push->used = MAX(stats->used, op->ukey->stats.used); + push->tcp_flags = stats->tcp_flags | op->ukey->stats.tcp_flags; + push->n_packets = stats->n_packets - op->ukey->stats.n_packets; + push->n_bytes = stats->n_bytes - op->ukey->stats.n_bytes; + ovs_mutex_unlock(&op->ukey->mutex); if (push->n_packets || netflow_exists()) { struct ofproto_dpif *ofproto; struct netflow *netflow; struct flow flow; bool may_learn; + int error; may_learn = push->n_packets > 0; - if (op->ukey) { - ovs_mutex_lock(&op->ukey->mutex); - if (op->ukey->xcache) { - xlate_push_stats(op->ukey->xcache, may_learn, push); - ovs_mutex_unlock(&op->ukey->mutex); - continue; - } + ovs_mutex_lock(&op->ukey->mutex); + if (op->ukey->xcache) { + xlate_push_stats(op->ukey->xcache, may_learn, push); ovs_mutex_unlock(&op->ukey->mutex); + continue; } + ovs_mutex_unlock(&op->ukey->mutex); - if (!xlate_receive(udpif->backer, NULL, op->op.u.flow_del.key, - op->op.u.flow_del.key_len, &flow, &ofproto, - NULL, NULL, &netflow, NULL)) { + error = xlate_receive(udpif->backer, NULL, op->op.u.flow_del.key, + op->op.u.flow_del.key_len, &flow, &ofproto, + NULL, NULL, &netflow, NULL); + if (!error) { struct xlate_in xin; xlate_in_init(&xin, ofproto, &flow, NULL, push->tcp_flags,