[ovs-dev] [wdp 1/4] mac-learning: Simplify mac_learning_run() interface.

Justin Pettit jpettit at nicira.com
Sat Jul 3 00:58:21 UTC 2010


Looks good.

--Justin


On Jul 2, 2010, at 5:14 PM, Ben Pfaff wrote:

> It's harder to pass around a tag_set than a single tag.  This simplifies
> the upcoming commits that begin to restore full ovs-vswitchd functionality
> on the "wdp" branch.
> ---
> lib/learning-switch.c |    2 +-
> lib/mac-learning.c    |   11 ++++++-----
> lib/mac-learning.h    |    2 +-
> 3 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/learning-switch.c b/lib/learning-switch.c
> index 7eb9e1c..1cb2fb1 100644
> --- a/lib/learning-switch.c
> +++ b/lib/learning-switch.c
> @@ -151,7 +151,7 @@ lswitch_run(struct lswitch *sw, struct rconn *rconn)
>     long long int now = time_msec();
> 
>     if (sw->ml) {
> -        mac_learning_run(sw->ml, NULL);
> +        mac_learning_run(sw->ml);
>     }
> 
>     /* If we're waiting for more replies, keeping waiting for up to 10 s. */
> diff --git a/lib/mac-learning.c b/lib/mac-learning.c
> index 5d64f54..83596bc 100644
> --- a/lib/mac-learning.c
> +++ b/lib/mac-learning.c
> @@ -296,17 +296,18 @@ mac_learning_flush(struct mac_learning *ml)
>     }
> }
> 
> -void
> -mac_learning_run(struct mac_learning *ml, struct tag_set *set)
> +tag_type
> +mac_learning_run(struct mac_learning *ml)
> {
>     struct mac_entry *e;
> +    tag_type tags = 0;
> +
>     while (get_lru(ml, &e) && time_now() >= e->expires) {
>         COVERAGE_INC(mac_learning_expired);
> -        if (set) {
> -            tag_set_add(set, e->tag);
> -        }
> +        tags |= e->tag;
>         free_mac_entry(ml, e);
>     }
> +    return tags;
> }
> 
> void
> diff --git a/lib/mac-learning.h b/lib/mac-learning.h
> index 89a4e90..31dd3ae 100644
> --- a/lib/mac-learning.h
> +++ b/lib/mac-learning.h
> @@ -82,7 +82,7 @@ int mac_learning_lookup_tag(const struct mac_learning *,
>                             uint16_t vlan, tag_type *tag,
>                             bool *is_grat_arp_locked);
> void mac_learning_flush(struct mac_learning *);
> -void mac_learning_run(struct mac_learning *, struct tag_set *);
> +tag_type mac_learning_run(struct mac_learning *);
> void mac_learning_wait(struct mac_learning *);
> 
> #endif /* mac-learning.h */
> -- 
> 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