ofproto: Disable timeouts for flows added by ofproto_add_flow().
authorBen Pfaff <blp@nicira.com>
Fri, 29 Oct 2010 18:38:39 +0000 (11:38 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 11 Nov 2010 19:04:12 +0000 (11:04 -0800)
None of the existing callers of ofproto_add_flow() want an idle timeout,
but ofproto_add_flow() was giving them a 5-second timeout anyway.  I don't
know how this worked properly--in-band will patiently add the flow back
every few seconds anyway, but the bridge doesn't do that.

Also add an explanatory comment to ofproto_add_flow().

ofproto/fail-open.c
ofproto/in-band.c
ofproto/ofproto.c
ofproto/ofproto.h
vswitchd/bridge.c

index ba6dbcf..cd1db94 100644 (file)
@@ -294,7 +294,7 @@ fail_open_flushed(struct fail_open *fo)
         action.output.port = htons(OFPP_NORMAL);
 
         cls_rule_init_catchall(&rule, FAIL_OPEN_PRIORITY);
-        ofproto_add_flow(fo->ofproto, &rule, &action, 1, 0);
+        ofproto_add_flow(fo->ofproto, &rule, &action, 1);
     }
 }
 
index 722c1f9..9605b50 100644 (file)
@@ -591,7 +591,7 @@ add_rule(struct in_band *ib, const struct cls_rule *rule)
     action.output.len = htons(sizeof action);
     action.output.port = htons(OFPP_NORMAL);
     action.output.max_len = htons(0);
-    ofproto_add_flow(ib->ofproto, rule, &action, 1, 0);
+    ofproto_add_flow(ib->ofproto, rule, &action, 1);
 }
 
 /* Inserts flows into the flow table for the current state of 'ib'. */
index 8348868..9cb3f91 100644 (file)
@@ -1298,15 +1298,21 @@ ofproto_send_packet(struct ofproto *p, const struct flow *flow,
     return 0;
 }
 
+/* Adds a flow to the OpenFlow flow table in 'p' that matches 'cls_rule' and
+ * performs the 'n_actions' actions in 'actions'.  The new flow will not
+ * timeout.
+ *
+ * If cls_rule->priority is in the range of priorities supported by OpenFlow
+ * (0...65535, inclusive) then the flow will be visible to OpenFlow
+ * controllers; otherwise, it will be hidden.
+ *
+ * The caller retains ownership of 'cls_rule' and 'actions'. */
 void
 ofproto_add_flow(struct ofproto *p, const struct cls_rule *cls_rule,
-                 const union ofp_action *actions, size_t n_actions,
-                 int idle_timeout)
+                 const union ofp_action *actions, size_t n_actions)
 {
     struct rule *rule;
-    rule = rule_create(p, NULL, actions, n_actions,
-                       idle_timeout >= 0 ? idle_timeout : 5 /* XXX */,
-                       0, 0, false);
+    rule = rule_create(p, NULL, actions, n_actions, 0, 0, 0, false);
     rule->cr = *cls_rule;
     rule_insert(p, rule, NULL, 0);
 }
index a0a00f8..a3cc825 100644 (file)
@@ -128,8 +128,7 @@ int ofproto_send_packet(struct ofproto *, const struct flow *,
                         const union ofp_action *, size_t n_actions,
                         const struct ofpbuf *);
 void ofproto_add_flow(struct ofproto *, const struct cls_rule *,
-                      const union ofp_action *, size_t n_actions,
-                      int idle_timeout);
+                      const union ofp_action *, size_t n_actions);
 void ofproto_delete_flow(struct ofproto *, const struct cls_rule *);
 void ofproto_flush_flows(struct ofproto *);
 
index 808fc58..9ddafe1 100644 (file)
@@ -1800,7 +1800,7 @@ bridge_reconfigure_remotes(struct bridge *br,
         action.output.len = htons(sizeof action);
         action.output.port = htons(OFPP_NORMAL);
         cls_rule_init_catchall(&rule, 0);
-        ofproto_add_flow(br->ofproto, &rule, &action, 1, 0);
+        ofproto_add_flow(br->ofproto, &rule, &action, 1);
     }
 }