From: Ethan Jackson Date: Thu, 12 Apr 2012 02:52:46 +0000 (-0700) Subject: lib: Pull dscp bits out of reconnect. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=317f6420764f9024deead76fc98477327a8a180e;p=openvswitch lib: Pull dscp bits out of reconnect. The DSCP bits of a connection have nothing to do with the reconnection state machine. This pulls them up into jsonrpc which needs them to properly establish connections. Signed-off-by: Ethan Jackson --- diff --git a/lib/jsonrpc.c b/lib/jsonrpc.c index e95db8af..fc8a75b0 100644 --- a/lib/jsonrpc.c +++ b/lib/jsonrpc.c @@ -734,6 +734,7 @@ struct jsonrpc_session { struct stream *stream; struct pstream *pstream; unsigned int seqno; + uint8_t dscp; }; /* Creates and returns a jsonrpc_session to 'name', which should be a string @@ -759,6 +760,7 @@ jsonrpc_session_open(const char *name) s->stream = NULL; s->pstream = NULL; s->seqno = 0; + s->dscp = 0; if (!pstream_verify_name(name)) { reconnect_set_passive(s->reconnect, true, time_msec()); @@ -830,14 +832,13 @@ jsonrpc_session_connect(struct jsonrpc_session *s) jsonrpc_session_disconnect(s); if (!reconnect_is_passive(s->reconnect)) { - error = jsonrpc_stream_open(name, &s->stream, - reconnect_get_dscp(s->reconnect)); + error = jsonrpc_stream_open(name, &s->stream, s->dscp); if (!error) { reconnect_connecting(s->reconnect, time_msec()); } } else { error = s->pstream ? 0 : jsonrpc_pstream_open(name, &s->pstream, - reconnect_get_dscp(s->reconnect)); + s->dscp); if (!error) { reconnect_listening(s->reconnect, time_msec()); } @@ -1053,5 +1054,5 @@ void jsonrpc_session_set_dscp(struct jsonrpc_session *s, uint8_t dscp) { - reconnect_set_dscp(s->reconnect, dscp); + s->dscp = dscp; } diff --git a/lib/reconnect.c b/lib/reconnect.c index c7500070..78ebda54 100644 --- a/lib/reconnect.c +++ b/lib/reconnect.c @@ -54,8 +54,6 @@ struct reconnect { bool passive; enum vlog_level info; /* Used for informational messages. */ - uint8_t dscp; - /* State. */ enum state state; long long int state_entered; @@ -188,14 +186,6 @@ reconnect_get_probe_interval(const struct reconnect *fsm) return fsm->probe_interval; } -/* Returns the dscp value used for establishing the connection between the - * manager and the database. */ -uint8_t -reconnect_get_dscp(const struct reconnect *fsm) -{ - return fsm->dscp; -} - /* Limits the maximum number of times that 'fsm' will ask the client to try to * reconnect to 'max_tries'. UINT_MAX (the default) means an unlimited number * of tries. @@ -255,14 +245,6 @@ reconnect_set_probe_interval(struct reconnect *fsm, int probe_interval) fsm->probe_interval = probe_interval ? MAX(1000, probe_interval) : 0; } -/* Sets the dscp value to be used for establishing a connection between the - * manager and the database. */ -void -reconnect_set_dscp(struct reconnect *fsm, uint8_t dscp) -{ - fsm->dscp = dscp; -} - /* Returns true if 'fsm' is in passive mode, false if 'fsm' is in active mode * (the default). */ bool diff --git a/lib/reconnect.h b/lib/reconnect.h index 9dfcfd7d..997a03f2 100644 --- a/lib/reconnect.h +++ b/lib/reconnect.h @@ -31,7 +31,6 @@ * revisited later.) */ #include -#include "openvswitch/types.h" struct reconnect *reconnect_create(long long int now); void reconnect_destroy(struct reconnect *); @@ -49,7 +48,6 @@ void reconnect_set_name(struct reconnect *, const char *name); int reconnect_get_min_backoff(const struct reconnect *); int reconnect_get_max_backoff(const struct reconnect *); int reconnect_get_probe_interval(const struct reconnect *); -uint8_t reconnect_get_dscp(const struct reconnect *); void reconnect_set_max_tries(struct reconnect *, unsigned int max_tries); unsigned int reconnect_get_max_tries(struct reconnect *); @@ -57,7 +55,6 @@ unsigned int reconnect_get_max_tries(struct reconnect *); void reconnect_set_backoff(struct reconnect *, int min_backoff, int max_backoff); void reconnect_set_probe_interval(struct reconnect *, int probe_interval); -void reconnect_set_dscp(struct reconnect *, uint8_t dscp); bool reconnect_is_passive(const struct reconnect *); void reconnect_set_passive(struct reconnect *, bool passive,