[ovs-dev] [cleanups 02/13] ofproto: Disable timeouts for flows added by ofproto_add_flow().

Ethan Jackson ethan at nicira.com
Thu Nov 11 03:17:09 UTC 2010


Looks good

On Fri, Oct 29, 2010 at 4:37 PM, Ben Pfaff <blp at nicira.com> wrote:
> 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 ba6dbcf..cd1db94 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 f7fd4e9..d3e11aa 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 0f9973d..a689188 100644
> --- a/ofproto/ofproto.c
> +++ b/ofproto/ofproto.c
> @@ -1299,15 +1299,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 a0a00f8..a3cc825 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 7ef4c00..54b4fd9 100644
> --- a/vswitchd/bridge.c
> +++ b/vswitchd/bridge.c
> @@ -1778,7 +1778,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);
>     }
>  }
>
> --
> 1.7.1
>
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org
>




More information about the dev mailing list