summaryrefslogtreecommitdiff
path: root/ofproto
diff options
context:
space:
mode:
authorMehak Mahajan <mmahajan@nicira.com>2012-03-10 15:58:10 -0800
committerMehak Mahajan <mmahajan@nicira.com>2012-03-23 18:13:08 -0700
commitf125905cdd3dc0339ad968c0a70128807884b400 (patch)
treeab389d41b625f2d9e5c820bdac80ec2df825ff8a /ofproto
parent11460e2316b88f0bd0ea0005d94338d800ea16bd (diff)
downloadopenvswitch-f125905cdd3dc0339ad968c0a70128807884b400.tar.gz
Allow configuring DSCP on controller and manager connections.
The changes allow the user to specify a separate dscp value for the controller connection and the manager connection. The value will take effect on resetting the connections. If no value is specified a default value of 192 is chosen for each of the connections. Feature #10074 Requested-by: Rajiv Ramanathan <rramanathan@nicira.com> Signed-off-by: Mehak Mahajan <mmahajan@nicira.com>
Diffstat (limited to 'ofproto')
-rw-r--r--ofproto/collectors.c3
-rw-r--r--ofproto/connmgr.c23
-rw-r--r--ofproto/ofproto.h2
3 files changed, 17 insertions, 11 deletions
diff --git a/ofproto/collectors.c b/ofproto/collectors.c
index bd3e89b19..b41e8e64c 100644
--- a/ofproto/collectors.c
+++ b/ofproto/collectors.c
@@ -63,7 +63,8 @@ collectors_create(const struct sset *targets, uint16_t default_port,
int error;
int fd;
- error = inet_open_active(SOCK_DGRAM, name, default_port, NULL, &fd);
+ error = inet_open_active(SOCK_DGRAM, name, default_port, NULL, &fd,
+ DSCP_INVALID);
if (fd >= 0) {
c->fds[c->n_fds++] = fd;
} else {
diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c
index ed1aac2e9..2e05adb8b 100644
--- a/ofproto/connmgr.c
+++ b/ofproto/connmgr.c
@@ -122,11 +122,12 @@ struct ofservice {
int rate_limit; /* Max packet-in rate in packets per second. */
int burst_limit; /* Limit on accumulating packet credits. */
bool enable_async_msgs; /* Initially enable async messages? */
+ uint8_t dscp; /* DSCP Value for controller connection */
};
static void ofservice_reconfigure(struct ofservice *,
const struct ofproto_controller *);
-static int ofservice_create(struct connmgr *, const char *target);
+static int ofservice_create(struct connmgr *, const char *target, uint8_t dscp);
static void ofservice_destroy(struct connmgr *, struct ofservice *);
static struct ofservice *ofservice_lookup(struct connmgr *,
const char *target);
@@ -280,7 +281,8 @@ connmgr_run(struct connmgr *mgr,
struct rconn *rconn;
char *name;
- rconn = rconn_create(ofservice->probe_interval, 0);
+ /* Passing default value for creation of the rconn */
+ rconn = rconn_create(ofservice->probe_interval, 0, ofservice->dscp);
name = ofconn_make_name(mgr, vconn_get_name(vconn));
rconn_connect_unreliably(rconn, vconn, name);
free(name);
@@ -358,7 +360,7 @@ connmgr_retry(struct connmgr *mgr)
/* OpenFlow configuration. */
-static void add_controller(struct connmgr *, const char *target);
+static void add_controller(struct connmgr *, const char *target, uint8_t dscp);
static struct ofconn *find_controller_by_target(struct connmgr *,
const char *target);
static void update_fail_open(struct connmgr *);
@@ -465,11 +467,11 @@ connmgr_set_controllers(struct connmgr *mgr,
if (!vconn_verify_name(c->target)) {
if (!find_controller_by_target(mgr, c->target)) {
- add_controller(mgr, c->target);
+ add_controller(mgr, c->target, c->dscp);
}
} else if (!pvconn_verify_name(c->target)) {
if (!ofservice_lookup(mgr, c->target)) {
- ofservice_create(mgr, c->target);
+ ofservice_create(mgr, c->target, c->dscp);
}
} else {
VLOG_WARN_RL(&rl, "%s: unsupported controller \"%s\"",
@@ -559,12 +561,12 @@ connmgr_has_snoops(const struct connmgr *mgr)
/* Creates a new controller for 'target' in 'mgr'. update_controller() needs
* to be called later to finish the new ofconn's configuration. */
static void
-add_controller(struct connmgr *mgr, const char *target)
+add_controller(struct connmgr *mgr, const char *target, uint8_t dscp)
{
char *name = ofconn_make_name(mgr, target);
struct ofconn *ofconn;
- ofconn = ofconn_create(mgr, rconn_create(5, 8), OFCONN_PRIMARY, true);
+ ofconn = ofconn_create(mgr, rconn_create(5, 8, dscp), OFCONN_PRIMARY, true);
ofconn->pktbuf = pktbuf_create();
rconn_connect(ofconn->rconn, target, name);
hmap_insert(&mgr->controllers, &ofconn->hmap_node, hash_string(target, 0));
@@ -672,7 +674,7 @@ set_pvconns(struct pvconn ***pvconnsp, size_t *n_pvconnsp,
struct pvconn *pvconn;
int error;
- error = pvconn_open(name, &pvconn);
+ error = pvconn_open(name, &pvconn, DSCP_INVALID);
if (!error) {
pvconns[n_pvconns++] = pvconn;
} else {
@@ -1551,13 +1553,13 @@ connmgr_flushed(struct connmgr *mgr)
* ofservice_reconfigure() must be called to fully configure the new
* ofservice. */
static int
-ofservice_create(struct connmgr *mgr, const char *target)
+ofservice_create(struct connmgr *mgr, const char *target, uint8_t dscp)
{
struct ofservice *ofservice;
struct pvconn *pvconn;
int error;
- error = pvconn_open(target, &pvconn);
+ error = pvconn_open(target, &pvconn, dscp);
if (error) {
return error;
}
@@ -1585,6 +1587,7 @@ ofservice_reconfigure(struct ofservice *ofservice,
ofservice->rate_limit = c->rate_limit;
ofservice->burst_limit = c->burst_limit;
ofservice->enable_async_msgs = c->enable_async_msgs;
+ ofservice->dscp = c->dscp;
}
/* Finds and returns the ofservice within 'mgr' that has the given
diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h
index 538c2c6e0..6172f291f 100644
--- a/ofproto/ofproto.h
+++ b/ofproto/ofproto.h
@@ -127,6 +127,8 @@ struct ofproto_controller {
/* OpenFlow packet-in rate-limiting. */
int rate_limit; /* Max packet-in rate in packets per second. */
int burst_limit; /* Limit on accumulating packet credits. */
+
+ uint8_t dscp; /* DSCP value for controller connection. */
};
#define DEFAULT_MFR_DESC "Nicira Networks, Inc."