Pushed with the proposed change, thanks for the review!

  Jarno

On Jul 18, 2014, at 11:49 PM, Ben Pfaff <b...@nicira.com> wrote:

> On Fri, Jul 18, 2014 at 09:05:51PM -0700, Jarno Rajahalme wrote:
>> The check for the need of default values was in the wrong place,
>> causing no prefix tracking to be used when database had no
>> configuration for a flow table.  Missing configuration means that
>> defaults should be used.
>> 
>> To limit clutter on the log, we now log the prefix tracking
>> configuration when it is explicitly set in the database.
>> 
>> Signed-off-by: Jarno Rajahalme <jrajaha...@nicira.com>
> 
> Acked-by: Ben Pfaff <b...@nicira.com>
> 
> I often find negative variable names confusing, e.g. "if (!no_prefixes)"
> takes a little bit of thinking, so one could get rid of that by applying
> something like this incrementally:
> 
> diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
> index 34d205d..6dcc2b8 100644
> --- a/vswitchd/bridge.c
> +++ b/vswitchd/bridge.c
> @@ -3134,7 +3134,7 @@ bridge_configure_tables(struct bridge *br)
>     j = 0;
>     for (i = 0; i < n_tables; i++) {
>         struct ofproto_table_settings s;
> -        bool no_prefixes = false;
> +        bool use_default_prefixes = true;
> 
>         s.name = NULL;
>         s.max_flows = UINT_MAX;
> @@ -3179,7 +3179,7 @@ bridge_configure_tables(struct bridge *br)
>                 const struct mf_field *mf;
> 
>                 if (strcmp(name, "none") == 0) {
> -                    no_prefixes = true;
> +                    use_default_prefixes = false;
>                     s.n_prefix_fields = 0;
>                     break;
>                 }
> @@ -3199,10 +3199,11 @@ bridge_configure_tables(struct bridge *br)
>                               "field not used: %s", br->name, name);
>                     continue;
>                 }
> +                use_default_prefixes = false;
>                 s.prefix_fields[s.n_prefix_fields++] = mf->id;
>             }
>         }
> -        if (s.n_prefix_fields == 0 && !no_prefixes) {
> +        if (use_default_prefixes) {
>             /* Use default values. */
>             s.n_prefix_fields = ARRAY_SIZE(default_prefix_fields);
>             memcpy(s.prefix_fields, default_prefix_fields,

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to