Clarify comments for trie-based subtable skipping. Perform the cheaper check first.
Signed-off-by: Jarno Rajahalme <jrajaha...@nicira.com> --- lib/classifier.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/lib/classifier.c b/lib/classifier.c index cd4de54..9a7b9fd 100644 --- a/lib/classifier.c +++ b/lib/classifier.c @@ -1442,27 +1442,25 @@ check_tries(struct trie_ctx trie_ctx[CLS_MAX_TRIES], unsigned int n_tries, /* Possible to skip the rest of the subtable if subtable's * prefix on the field is not included in the lookup result. */ if (!be_get_bit_at(&ctx->match_plens.be32, field_plen[j] - 1)) { - /* RFC: We want the trie lookup to never result in - * unwildcarding any bits that would not be unwildcarded - * otherwise. Since the trie is shared by the whole - * classifier, it is possible that the 'maskbits' contain - * bits that are irrelevant for the partition of the - * classifier relevant for the current flow. */ + /* We want the trie lookup to never result in unwildcarding + * any bits that would not be unwildcarded otherwise. + * Since the trie is shared by the whole classifier, it is + * possible that the 'maskbits' contain bits that are + * irrelevant for the partition relevant for the current + * packet. Hence the checks below. */ - /* Can skip if the field is already unwildcarded. */ - if (mask_prefix_bits_set(wc, be32ofs, ctx->maskbits)) { - return true; - } /* Check that the trie result will not unwildcard more bits - * than this stage will. */ + * than this subtable would otherwise. */ if (ctx->maskbits <= field_plen[j]) { /* Unwildcard the bits and skip the rest. */ mask_set_prefix_bits(wc, be32ofs, ctx->maskbits); /* Note: Prerequisite already unwildcarded, as the only * prerequisite of the supported trie lookup fields is - * the ethertype, which is currently always - * unwildcarded. - */ + * the ethertype, which is always unwildcarded. */ + return true; + } + /* Can skip if the field is already unwildcarded. */ + if (mask_prefix_bits_set(wc, be32ofs, ctx->maskbits)) { return true; } } -- 1.7.10.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev