ofproto: Check for overlapping flows only in the target table.
authorBen Pfaff <blp@nicira.com>
Wed, 19 Oct 2011 23:03:31 +0000 (16:03 -0700)
committerBen Pfaff <blp@nicira.com>
Mon, 24 Oct 2011 16:31:34 +0000 (09:31 -0700)
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.)

ofproto/ofproto.c

index 0d80e131887572b7efe11d5d50c32e3f674ac0ac..7543e1140bbc1958b06b99407a62fcb14846cfcc 100644 (file)
@@ -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;