[ovs-dev] [PATCH 1/2] revalidator: Simplify push_dump_ops__().
Joe Stringer
joestringer at nicira.com
Wed Jun 18 00:14:39 UTC 2014
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 <joestringer at nicira.com>
---
ofproto/ofproto-dpif-upcall.c | 31 +++++++++++++------------------
1 file changed, 13 insertions(+), 18 deletions(-)
diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
index 281955f..bd5c07a 100644
--- a/ofproto/ofproto-dpif-upcall.c
+++ b/ofproto/ofproto-dpif-upcall.c
@@ -1264,17 +1264,14 @@ 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;
@@ -1283,15 +1280,13 @@ push_dump_ops__(struct udpif *udpif, struct dump_op *ops, size_t n_ops)
bool may_learn;
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,
--
1.7.10.4
More information about the dev
mailing list