[ovs-dev] [PATCH V4 09/10] cfm: Add cfm_wake_time() function.

Ethan Jackson ethan at nicira.com
Tue Oct 15 01:12:03 UTC 2013


Acked-by: Ethan Jackson <ethan at nicira.com>


On Fri, Oct 11, 2013 at 5:16 PM, Alex Wang <alexw at nicira.com> wrote:
> This commit adds a new function "cfm_wake_time()" that returns the
> next wakeup time associated with the "struct cfm".
>
> Signed-off-by: Alex Wang <alexw at nicira.com>
>
> ---
>
> v3 -> v4:
> - rebase to master.
>
> v2 -> v3:
> - fix the code duplication.
>
> v1 -> v2:
> - rebase to master.
>
> ---
>  lib/cfm.c |   19 +++++++++++++++++--
>  lib/cfm.h |    1 +
>  2 files changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/lib/cfm.c b/lib/cfm.c
> index e8f86dc..730a00f 100644
> --- a/lib/cfm.c
> +++ b/lib/cfm.c
> @@ -580,12 +580,27 @@ cfm_compose_ccm(struct cfm *cfm, struct ofpbuf *packet,
>  void
>  cfm_wait(struct cfm *cfm) OVS_EXCLUDED(mutex)
>  {
> +    poll_timer_wait_until(cfm_wake_time(cfm));
> +}
> +
> +
> +/* Returns the next cfm wakeup time. */
> +long long int
> +cfm_wake_time(struct cfm *cfm) OVS_EXCLUDED(mutex)
> +{
> +    long long int retval;
> +
> +    if (!cfm) {
> +        return LLONG_MAX;
> +    }
> +
>      ovs_mutex_lock(&mutex);
> -    timer_wait(&cfm->tx_timer);
> -    timer_wait(&cfm->fault_timer);
> +    retval = MIN(cfm->tx_timer.t, cfm->fault_timer.t);
>      ovs_mutex_unlock(&mutex);
> +    return retval;
>  }
>
> +
>  /* Configures 'cfm' with settings from 's'. */
>  bool
>  cfm_configure(struct cfm *cfm, const struct cfm_settings *s)
> diff --git a/lib/cfm.h b/lib/cfm.h
> index cff713f..9d1ea4c 100644
> --- a/lib/cfm.h
> +++ b/lib/cfm.h
> @@ -82,4 +82,5 @@ int cfm_get_opup(const struct cfm *);
>  void cfm_get_remote_mpids(const struct cfm *, uint64_t **rmps, size_t *n_rmps);
>  const char *cfm_fault_reason_to_str(int fault);
>
> +long long int cfm_wake_time(struct cfm*);
>  #endif /* cfm.h */
> --
> 1.7.9.5
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list