ofproto: Make ofproto_rule_is_hidden() public, and rename.
authorBen Pfaff <blp@nicira.com>
Tue, 3 Jun 2014 19:58:34 +0000 (12:58 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 12 Jun 2014 21:23:26 +0000 (14:23 -0700)
I'd like to use this from connmgr.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
ofproto/ofproto-provider.h
ofproto/ofproto.c

index c8cd69d..97e5cdd 100644 (file)
@@ -405,6 +405,7 @@ void ofproto_rule_unref(struct rule *);
 
 static inline const struct rule_actions * rule_get_actions(const struct rule *);
 static inline bool rule_is_table_miss(const struct rule *);
+static inline bool rule_is_hidden(const struct rule *);
 
 /* A set of actions within a "struct rule".
  *
@@ -1743,6 +1744,17 @@ rule_is_table_miss(const struct rule *rule)
     return rule->cr.priority == 0 && cls_rule_is_catchall(&rule->cr);
 }
 
+/* Returns true if 'rule' should be hidden from the controller.
+ *
+ * Rules with priority higher than UINT16_MAX are set up by ofproto itself
+ * (e.g. by in-band control) and are intentionally hidden from the
+ * controller. */
+static inline bool
+rule_is_hidden(const struct rule *rule)
+{
+    return rule->cr.priority > UINT16_MAX;
+}
+
 static inline struct rule *
 rule_from_cls_rule(const struct cls_rule *cls_rule)
 {
index 40aa4e8..fb768db 100644 (file)
@@ -2757,17 +2757,6 @@ destroy_rule_executes(struct ofproto *ofproto)
     }
 }
 
-/* Returns true if 'rule' should be hidden from the controller.
- *
- * Rules with priority higher than UINT16_MAX are set up by ofproto itself
- * (e.g. by in-band control) and are intentionally hidden from the
- * controller. */
-static bool
-ofproto_rule_is_hidden(const struct rule *rule)
-{
-    return (rule->cr.priority > UINT16_MAX);
-}
-
 static bool
 oftable_is_modifiable(const struct oftable *table,
                       enum ofputil_flow_mod_flags flags)
@@ -3421,7 +3410,7 @@ collect_rule(struct rule *rule, const struct rule_criteria *c,
      * rules to be selected.  (This doesn't allow OpenFlow clients to meddle
      * with hidden flows because OpenFlow uses only a 16-bit field to specify
      * priority.) */
-    if (ofproto_rule_is_hidden(rule) && c->cr.priority <= UINT16_MAX) {
+    if (rule_is_hidden(rule) && c->cr.priority <= UINT16_MAX) {
         return 0;
     } else if (rule->pending) {
         return OFPROTO_POSTPONE;
@@ -4396,8 +4385,7 @@ ofproto_rule_send_removed(struct rule *rule, uint8_t reason)
     struct ofputil_flow_removed fr;
     long long int used;
 
-    if (ofproto_rule_is_hidden(rule) ||
-        !(rule->flags & OFPUTIL_FF_SEND_FLOW_REM)) {
+    if (rule_is_hidden(rule) || !(rule->flags & OFPUTIL_FF_SEND_FLOW_REM)) {
         return;
     }
 
@@ -4823,7 +4811,7 @@ ofproto_collect_ofmonitor_refresh_rule(const struct ofmonitor *m,
 {
     enum nx_flow_monitor_flags update;
 
-    if (ofproto_rule_is_hidden(rule)) {
+    if (rule_is_hidden(rule)) {
         return;
     }
 
@@ -6260,7 +6248,7 @@ ofopgroup_complete(struct ofopgroup *group)
 
               - The operation's only effect was to update rule->modified. */
         if (!(op->error
-              || ofproto_rule_is_hidden(rule)
+              || rule_is_hidden(rule)
               || (op->type == OFOPERATION_MODIFY
                   && !op->actions
                   && rule->flow_cookie == op->flow_cookie))) {