From: Ben Pfaff <blp@nicira.com>
Date: Wed, 19 Oct 2011 23:03:31 +0000 (-0700)
Subject: ofproto: Check for overlapping flows only in the target table.
X-Git-Tag: v1.3.0~39
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=63adcc7d3fa1e136685f44edb03887222ea74bd8;p=sliver-openvswitch.git

ofproto: Check for overlapping flows only in the target table.

There's no reason to check for overlapping flows in table A if the flow
is going to be inserted into table B.

(I doubt anyone actually uses OFPFF_CHECK_OVERLAP though.)
---

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 0d80e1318..7543e1140 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -2356,17 +2356,6 @@ add_flow(struct ofproto *ofproto, struct ofconn *ofconn,
     struct rule *rule;
     int error;
 
-    /* Check for overlap, if requested. */
-    if (fm->flags & OFPFF_CHECK_OVERLAP) {
-        struct classifier *cls;
-
-        FOR_EACH_MATCHING_TABLE (cls, fm->table_id, ofproto) {
-            if (classifier_rule_overlaps(cls, &fm->cr)) {
-                return ofp_mkerr(OFPET_FLOW_MOD_FAILED, OFPFMFC_OVERLAP);
-            }
-        }
-    }
-
     /* Pick table. */
     if (fm->table_id == 0xff) {
         uint8_t table_id;
@@ -2387,6 +2376,12 @@ add_flow(struct ofproto *ofproto, struct ofconn *ofconn,
         return ofp_mkerr_nicira(OFPET_FLOW_MOD_FAILED, NXFMFC_BAD_TABLE_ID);
     }
 
+    /* Check for overlap, if requested. */
+    if (fm->flags & OFPFF_CHECK_OVERLAP
+        && classifier_rule_overlaps(table, &fm->cr)) {
+        return ofp_mkerr(OFPET_FLOW_MOD_FAILED, OFPFMFC_OVERLAP);
+    }
+
     /* Serialize against pending deletion. */
     if (is_flow_deletion_pending(ofproto, &fm->cr, table - ofproto->tables)) {
         return OFPROTO_POSTPONE;