diff mbox

[ovs-dev,1/4] classifier: Remove redundant index.

Message ID 1460599606-121620-1-git-send-email-jarno@ovn.org
State Superseded
Headers show

Commit Message

Jarno Rajahalme April 14, 2016, 2:06 a.m. UTC
The test for figuring out if the last index had the same fields as the
actual rules map as broken, resulting into keeping an unnecessary
index around.

Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
---
 lib/classifier.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Ben Pfaff April 21, 2016, 6:55 p.m. UTC | #1
On Wed, Apr 13, 2016 at 07:06:43PM -0700, Jarno Rajahalme wrote:
> The test for figuring out if the last index had the same fields as the
> actual rules map as broken, resulting into keeping an unnecessary
> index around.
> 
> Signed-off-by: Jarno Rajahalme <jarno@ovn.org>

Acked-by: Ben Pfaff <blp@ovn.org>
diff mbox

Patch

diff --git a/lib/classifier.c b/lib/classifier.c
index 8bc6353..4861672 100644
--- a/lib/classifier.c
+++ b/lib/classifier.c
@@ -1490,11 +1490,11 @@  insert_subtable(struct classifier *cls, const struct minimask *mask)
     /* Map for the final stage. */
     *CONST_CAST(struct flowmap *, &subtable->index_maps[index])
         = miniflow_get_map_in_range(&mask->masks, prev, FLOW_U64S);
-    /* Check if the final stage adds any bits,
-     * and remove the last index if it doesn't. */
+    /* Check if the final stage adds any bits. */
     if (index > 0) {
-        if (flowmap_equal(subtable->index_maps[index],
-                          subtable->index_maps[index - 1])) {
+        if (flowmap_is_empty(subtable->index_maps[index])) {
+            /* Remove the last index, as it has the same fields as the rules
+             * map. */
             --index;
             cmap_destroy(&subtable->indices[index]);
         }