Skip to content

Commit

Permalink
revalidator: Simplify push_dump_ops__().
Browse files Browse the repository at this point in the history
Commit acaa8da (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 <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
  • Loading branch information
joestringer committed Jul 3, 2014
1 parent a473df5 commit 5e73c32
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions ofproto/ofproto-dpif-upcall.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 5e73c32

Please sign in to comment.