[ovs-dev] [PATCH] ofproto: Check for overlapping flows only in the target table.

Ben Pfaff blp at nicira.com
Wed Oct 19 23:03:38 UTC 2011


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 |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 1cc1e4e..4a492ce 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -2276,17 +2276,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;
@@ -2307,6 +2296,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;
-- 
1.7.4.4




More information about the dev mailing list