On Wed, Jul 02, 2014 at 08:14:15PM +1200, Joe Stringer wrote:
> If the datapath doesn't dump a flow for some reason, and the current
> dump is expected to revalidate all flows in the datapath, then perform
> revalidation for those flows by fetching them during the sweep phase.
> 
> Signed-off-by: Joe Stringer <joestrin...@nicira.com>
> ---
> This relies on the mask dumping from the previous patch, but doesn't
> make use of batched flow_get.

I thought that the logic in revalidator_sweep__() was confusing
before, but this patch left me more confused.

Is this a correct transformation?  From:
    HMAP_FOR_EACH_SAFE (ukey, next, hmap_node, revalidator->ukeys) {
        bool missed_reval, delete_flow;

        missed_reval = ukey->last_seen && need_revalidate;
        ukey->last_seen++;
        delete_flow = purge || ukey->last_seen == MAX_UKEY_AGE;
        if (!ukey->flow_exists) {
            ukey_delete(revalidator, ukey);
            continue;
        } else if (!delete_flow && missed_reval) {
            delete_flow = handle_missed_revalidation(revalidator, ukey);
        }

        if (delete_flow) {
            struct dump_op *op = &ops[n_ops++];

            dump_op_init(op, ukey->key, ukey->key_len, ukey);
            if (n_ops == REVALIDATE_MAX_BATCH) {
                push_dump_ops(revalidator, ops, n_ops);
                n_ops = 0;
            }
        }
    }
to:
    HMAP_FOR_EACH_SAFE (ukey, next, hmap_node, revalidator->ukeys) {
        if (ukey->flow_exists) {
            ukey->last_seen++;
            if (purge
                || ukey->last_seen == MAX_UKEY_AGE
                || (ukey->last_seen > 1
                    && need_revalidate
                    && handle_missed_revalidation(revalidator, ukey))) {
                struct dump_op *op = &ops[n_ops++];

                dump_op_init(op, ukey->key, ukey->key_len, ukey);
                if (n_ops == REVALIDATE_MAX_BATCH) {
                    push_dump_ops(revalidator, ops, n_ops);
                    n_ops = 0;
                }
            }
        } else {
            ukey_delete(revalidator, ukey);
        }
    }
I find the latter easier to understand, if it is equivalent.
(I guess that it will change, though, when you revise the series.)
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to