[ovs-dev] same wildcard entries exist

Jesse Gross jesse at nicira.com
Fri Mar 19 20:15:15 UTC 2010


On Fri, Mar 19, 2010 at 7:45 AM, Tetsuo NAKAGAWA <nakagawa at mxc.nes.nec.co.jp
> wrote:

> Hi.
>
> I'm using Open vSwitch with master and openflow-1.0 branch
> on XenServer 5.5.0.
>
> When same wildcard entries are added continuously twice,
> a same wildcard entry is overwritten, so just same wildcard
> entries are not left as follows.
>

Thanks for pointing this out.  However, I think the following patch retains
the goal of the original code and is slightly more efficient since it does
not keep on searching the list after we run out of equal priority rules:

commit 4b2db3840cd8e10fa3bd51c5c1d0e7e39efc21d3
Author: Jesse Gross <jesse at nicira.com>
Date:   Fri Mar 19 12:08:16 2010 -0400

    classifier: Check all rules of equal priority when inserting.

    When adding a new classifier rule we check if there is a rule
    of the same priority first and overwrite it before inserting a
    new rule.  Previously we would stop looking if we found one rule
    in the correct bucket with the same priority, even if it didn't
    match.  This keeps going until we either find a matching rule or
    we run out of equal priority rules.

    Reported-by: Tetsuo NAKAGAWA <nakagawa at mxc.nes.nec.co.jp>

diff --git a/lib/classifier.c b/lib/classifier.c
index cdad9c9..ee78dad 100644
--- a/lib/classifier.c
+++ b/lib/classifier.c
@@ -640,14 +640,14 @@ bucket_insert(struct cls_bucket *bucket, struct
cls_rule *
 {
     struct cls_rule *pos;
     LIST_FOR_EACH (pos, struct cls_rule, node.list, &bucket->rules) {
-        if (pos->priority <= rule->priority) {
-            if (pos->priority == rule->priority
-                && pos->wc.wildcards == rule->wc.wildcards
+        if (pos->priority == rule->priority) {
+            if (pos->wc.wildcards == rule->wc.wildcards
                 && rules_match_1wild(pos, rule, rule->table_idx))
             {
                 list_replace(&rule->node.list, &pos->node.list);
                 return pos;
             }
+        } else if (pos->priority < rule->priority) {
             break;
         }
     }


I pushed this to master and openflow-1.0.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20100319/aa9288b0/attachment-0003.html>


More information about the dev mailing list