On 11.06.2019 19:55, Ben Pfaff wrote: > Until now, the rconn timers have been precise only to the nearest second. > This increases them to millisecond precision, which seems cleaner these > days. > > Signed-off-by: Ben Pfaff <[email protected]> > --- > include/openvswitch/rconn.h | 7 +- > lib/rconn.c | 138 ++++++++++++++++++------------------ > ofproto/connmgr.c | 16 ++--- > 3 files changed, 80 insertions(+), 81 deletions(-) > > diff --git a/include/openvswitch/rconn.h b/include/openvswitch/rconn.h > index fd60a6ce1dea..25c18f97e405 100644 > --- a/include/openvswitch/rconn.h > +++ b/include/openvswitch/rconn.h > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2015 Nicira, Inc. > + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2015, 2019 Nicira, Inc. > * > * Licensed under the Apache License, Version 2.0 (the "License"); > * you may not use this file except in compliance with the License. > @@ -19,7 +19,6 @@ > > #include <stdbool.h> > #include <stdint.h> > -#include <time.h> > #include "openvswitch/types.h" > > /* A wrapper around vconn that provides queuing and optionally reliability. > @@ -88,8 +87,8 @@ int rconn_failure_duration(const struct rconn *); > int rconn_get_version(const struct rconn *); > > const char *rconn_get_state(const struct rconn *); > -time_t rconn_get_last_connection(const struct rconn *); > -time_t rconn_get_last_disconnect(const struct rconn *); > +long long int rconn_get_last_connection(const struct rconn *); > +long long int rconn_get_last_disconnect(const struct rconn *); > unsigned int rconn_get_connection_seqno(const struct rconn *); > int rconn_get_last_error(const struct rconn *); > unsigned int rconn_count_txqlen(const struct rconn *); > diff --git a/lib/rconn.c b/lib/rconn.c > index ba95bb3a1a61..9fab33e2e59a 100644 > --- a/lib/rconn.c > +++ b/lib/rconn.c > @@ -84,13 +84,16 @@ state_name(enum state state) > } > > /* A reliable connection to an OpenFlow switch or controller. > + * > + * Members of type 'long long int' are times in milliseconds on the monotonic > + * clock, as returned by time_msec(). Other times are durations in seconds. > * > * See the large comment in rconn.h for more information. */ > struct rconn { > struct ovs_mutex mutex; > > enum state state; > - time_t state_entered; > + long long int state_entered; > > struct vconn *vconn; > char *name; /* Human-readable descriptive name. */ > @@ -99,11 +102,11 @@ struct rconn { > > struct ovs_list txq; /* Contains "struct ofpbuf"s. */ > > - int backoff; > - int max_backoff; > - time_t backoff_deadline; > - time_t last_connected; > - time_t last_disconnected; > + int backoff; /* Current backoff, in seconds. */ > + int max_backoff; /* Limit for backoff, In seconds. */
Change looks good in general, but I have a question: why you decided to not change the type of 'backoff' and 'max_backoff' preferring to call llsat_mul each time? Best regards, Ilya Maximets. _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
