From fa8b054f50e6f669a1cc4c41ada0f1fdad03e9dd Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 29 Oct 2010 11:38:39 -0700 Subject: [PATCH] ofproto: Disable timeouts for flows added by ofproto_add_flow(). 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 | 2 +- ofproto/in-band.c | 2 +- ofproto/ofproto.c | 16 +++++++++++----- ofproto/ofproto.h | 3 +-- vswitchd/bridge.c | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/ofproto/fail-open.c b/ofproto/fail-open.c index ba6dbcfa8..cd1db94c5 100644 --- a/ofproto/fail-open.c +++ b/ofproto/fail-open.c @@ -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); } } diff --git a/ofproto/in-band.c b/ofproto/in-band.c index 722c1f912..9605b50f3 100644 --- a/ofproto/in-band.c +++ b/ofproto/in-band.c @@ -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'. */ diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 8348868b9..9cb3f9109 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -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); } diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h index a0a00f809..a3cc82556 100644 --- a/ofproto/ofproto.h +++ b/ofproto/ofproto.h @@ -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 *); diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 808fc5867..9ddafe1ef 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -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); } } -- 2.43.0