This patch adds a new configuration option, "max-idle" to the
Open_vSwitch "other-config" column. This sets how long datapath flows
are cached in the datapath before ovs-vswitchd thread expire them.
This commit is a backport of commit
72310b04 (upcall: Configure
datapath max-idle through ovs-vsctl.).
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
long long int now;
int i;
+ /* If ofproto_max_idle is specified, uses it instead of doing the
+ * calculation. */
+ if (ofproto_max_idle) {
+ return ofproto_max_idle;
+ }
+
total = hmap_count(&backer->subfacets);
if (total <= flow_eviction_threshold) {
return N_BUCKETS * BUCKET_WIDTH;
* ofproto-dpif implementation */
extern unsigned flow_eviction_threshold;
+/* Maximum idle time (in ms) for flows to be cached in the datapath.
+ * This option should only be used for testing. Each ofproto-class
+ * implementation should have its own algorithm of calculating the
+ * idle time. */
+extern unsigned ofproto_max_idle;
+
/* Number of upcall handler threads. Only affects the ofproto-dpif
* implementation. */
extern unsigned n_handler_threads;
unsigned flow_eviction_threshold = OFPROTO_FLOW_EVICTION_THRESHOLD_DEFAULT;
unsigned n_handler_threads;
enum ofproto_flow_miss_model flow_miss_model = OFPROTO_HANDLE_MISS_AUTO;
+unsigned ofproto_max_idle;
/* Map from datapath name to struct ofproto, for use by unixctl commands. */
static struct hmap all_ofprotos = HMAP_INITIALIZER(&all_ofprotos);
flow_miss_model = model;
}
+/* Sets the maximum idle time for flows in the datapath before they are
+ * expired. */
+void
+ofproto_set_max_idle(unsigned max_idle)
+{
+ ofproto_max_idle = max_idle;
+}
+
/* If forward_bpdu is true, the NORMAL action will forward frames with
* reserved (e.g. STP) destination Ethernet addresses. if forward_bpdu is false,
* the NORMAL action will drop these frames. */
void ofproto_set_in_band_queue(struct ofproto *, int queue_id);
void ofproto_set_flow_eviction_threshold(unsigned threshold);
void ofproto_set_flow_miss_model(unsigned model);
+void ofproto_set_max_idle(unsigned max_idle);
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);
ofproto_set_flow_eviction_threshold(
smap_get_int(&ovs_cfg->other_config, "flow-eviction-threshold",
OFPROTO_FLOW_EVICTION_THRESHOLD_DEFAULT));
+ ofproto_set_max_idle(smap_get_int(&ovs_cfg->other_config, "max-idle", 0));
ofproto_set_n_handler_threads(
smap_get_int(&ovs_cfg->other_config, "n-handler-threads", 0));