X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ofproto%2Fofproto.c;h=f40f99590acad5deb690379d1784d06cdbfc4003;hb=c71c6043a7617e6e6c2b8748550014f54476faa7;hp=201488de47a8b4500cc9a491dfe7a2a2c6ef501d;hpb=5bee6e2638989aff14429c5a85fa7cef196f2106;p=openvswitch diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 201488de..f40f9959 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -320,6 +320,8 @@ ofproto_create(const char *datapath_name, const char *datapath_type, hmap_insert(&all_ofprotos, &ofproto->hmap_node, hash_string(ofproto->name, 0)); ofproto->datapath_id = 0; + ofproto_set_flow_eviction_threshold(ofproto, + OFPROTO_FLOW_EVICTON_THRESHOLD_DEFAULT); ofproto->fallback_dpid = pick_fallback_dpid(); ofproto->mfr_desc = xstrdup(DEFAULT_MFR_DESC); ofproto->hw_desc = xstrdup(DEFAULT_HW_DESC); @@ -407,6 +409,18 @@ ofproto_set_in_band_queue(struct ofproto *ofproto, int queue_id) connmgr_set_in_band_queue(ofproto->connmgr, queue_id); } +/* Sets the number of flows at which eviction from the kernel flow table + * will occur. */ +void +ofproto_set_flow_eviction_threshold(struct ofproto *ofproto, unsigned threshold) +{ + if (threshold < OFPROTO_FLOW_EVICTION_THRESHOLD_MIN) { + ofproto->flow_eviction_threshold = OFPROTO_FLOW_EVICTION_THRESHOLD_MIN; + } else { + ofproto->flow_eviction_threshold = threshold; + } +} + void ofproto_set_desc(struct ofproto *p, const char *mfr_desc, const char *hw_desc,