[ovs-dev] [DPDK Upcalls 05/11] classifier: classifier_lookup_miniflow_batch() indicate failures.

Ethan Jackson ethan at nicira.com
Sat Aug 2 01:39:16 UTC 2014


This patch causes classifier_lookup_miniflow_batch() to return a
boolean indicating whether any rules could not be successfully looked
up.  Used in future patches.

Signed-off-by: Ethan Jackson <ethan at nicira.com>
---
 lib/classifier.c | 10 +++++++---
 lib/classifier.h |  2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/classifier.c b/lib/classifier.c
index a6a582c..ae03251 100644
--- a/lib/classifier.c
+++ b/lib/classifier.c
@@ -1004,8 +1004,10 @@ find_match_miniflow(const struct cls_subtable *subtable,
  * This function is optimized for use in the userspace datapath and therefore
  * does not implement a lot of features available in the standard
  * classifier_lookup() function.  Specifically, it does not implement
- * priorities, instead returning any rule which matches the flow. */
-void
+ * priorities, instead returning any rule which matches the flow.
+ *
+ * Returns true if all flows found a corresponding rule. */
+bool
 classifier_lookup_miniflow_batch(const struct classifier *cls,
                                  const struct miniflow **flows,
                                  struct cls_rule **rules, size_t len)
@@ -1034,9 +1036,11 @@ classifier_lookup_miniflow_batch(const struct classifier *cls,
             begin++;
         }
         if (begin >= len) {
-            break;
+            return true;
         }
     }
+
+    return false;
 }
 
 /* Finds and returns a rule in 'cls' with exactly the same priority and
diff --git a/lib/classifier.h b/lib/classifier.h
index 4203eb8..b394724 100644
--- a/lib/classifier.h
+++ b/lib/classifier.h
@@ -295,7 +295,7 @@ void classifier_remove(struct classifier *, struct cls_rule *);
 struct cls_rule *classifier_lookup(const struct classifier *,
                                    const struct flow *,
                                    struct flow_wildcards *);
-void classifier_lookup_miniflow_batch(const struct classifier *cls,
+bool classifier_lookup_miniflow_batch(const struct classifier *cls,
                                       const struct miniflow **flows,
                                       struct cls_rule **rules, size_t len);
 bool classifier_rule_overlaps(const struct classifier *,
-- 
1.8.1.2




More information about the dev mailing list