From 30ea0da7c1e6c574aae8639c938849f657a81331 Mon Sep 17 00:00:00 2001 From: Gurucharan Shetty Date: Wed, 22 Jan 2014 13:26:33 -0800 Subject: [PATCH] ofproto: Handle negative number of threads. As of now, setting other_config:n-handler-threads to a negative value causes ovs-vswitchd to crash. Signed-off-by: Gurucharan Shetty Acked-by: Ethan Jackson --- ofproto/ofproto.c | 6 +++--- ofproto/ofproto.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index b2cdb1084..f2a88bbef 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -734,12 +734,12 @@ ofproto_set_mac_table_config(struct ofproto *ofproto, unsigned idle_time, } void -ofproto_set_threads(size_t n_handlers_, size_t n_revalidators_) +ofproto_set_threads(int n_handlers_, int n_revalidators_) { int threads = MAX(count_cpu_cores(), 2); - n_revalidators = n_revalidators_; - n_handlers = n_handlers_; + n_revalidators = MAX(n_revalidators_, 0); + n_handlers = MAX(n_handlers_, 0); if (!n_revalidators) { n_revalidators = n_handlers diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h index 3034d32b3..0ac44541a 100644 --- a/ofproto/ofproto.h +++ b/ofproto/ofproto.h @@ -247,7 +247,7 @@ void ofproto_set_flow_miss_model(unsigned model); void ofproto_set_forward_bpdu(struct ofproto *, bool forward_bpdu); void ofproto_set_mac_table_config(struct ofproto *, unsigned idle_time, size_t max_entries); -void ofproto_set_threads(size_t n_handlers, size_t n_revalidators); +void ofproto_set_threads(int n_handlers, int n_revalidators); void ofproto_set_dp_desc(struct ofproto *, const char *dp_desc); int ofproto_set_snoops(struct ofproto *, const struct sset *snoops); int ofproto_set_netflow(struct ofproto *, -- 2.47.0