summaryrefslogtreecommitdiff
path: root/lib/classifier.c
diff options
context:
space:
mode:
authorJarno Rajahalme <jrajahalme@nicira.com>2014-07-18 02:24:27 -0700
committerJarno Rajahalme <jrajahalme@nicira.com>2014-07-18 02:24:27 -0700
commit1817dceab16d33406abf17a4696b2584a38fe5fd (patch)
treea839c7855475e55566083257ca53c8348aeec806 /lib/classifier.c
parentc0bfb6502c2ac085717ec381f77a30c6ebaa9157 (diff)
downloadopenvswitch-1817dceab16d33406abf17a4696b2584a38fe5fd.tar.gz
lib/classifier: Clarify subtable skipping.
Clarify comments for trie-based subtable skipping. Perform the cheaper check first. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com> Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Diffstat (limited to 'lib/classifier.c')
-rw-r--r--lib/classifier.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/lib/classifier.c b/lib/classifier.c
index b8d4c3e05..332e05af5 100644
--- a/lib/classifier.c
+++ b/lib/classifier.c
@@ -1445,27 +1445,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;
}
}