diff options
Diffstat (limited to 'ofproto')
-rw-r--r-- | ofproto/ofproto-dpif.c | 6 | ||||
-rw-r--r-- | ofproto/ofproto-provider.h | 1 | ||||
-rw-r--r-- | ofproto/ofproto.c | 8 | ||||
-rw-r--r-- | ofproto/ofproto.h | 1 |
4 files changed, 16 insertions, 0 deletions
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index b0e94435a..a2dc2019b 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -4387,6 +4387,12 @@ subfacet_max_idle(const struct ofproto_dpif *ofproto) long long int now; int i; + /* If 'max_idle' is specified, uses it instead of doing the + * calculation. */ + if (ofproto->up.max_idle) { + return ofproto->up.max_idle; + } + total = hmap_count(&ofproto->subfacets); if (total <= ofproto->up.flow_eviction_threshold) { return N_BUCKETS * BUCKET_WIDTH; diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h index 95bda33a1..18ab362d4 100644 --- a/ofproto/ofproto-provider.h +++ b/ofproto/ofproto-provider.h @@ -50,6 +50,7 @@ struct ofproto { unsigned flow_eviction_threshold; /* Threshold at which to begin flow * table eviction. Only affects the * ofproto-dpif implementation */ + unsigned max_idle; bool forward_bpdu; /* Option to allow forwarding of BPDU frames * when NORMAL action is invoked. */ char *mfr_desc; /* Manufacturer (NULL for default)b. */ diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 448cf1d03..c4d57b6a3 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -570,6 +570,14 @@ ofproto_set_flow_eviction_threshold(struct ofproto *ofproto, unsigned threshold) } } +/* Sets the maximum idle time for flows of 'ofproto' in the datapath before + * they are expired. */ +void +ofproto_set_max_idle(struct ofproto *ofproto, 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. */ diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h index c3f59b252..659cb563d 100644 --- a/ofproto/ofproto.h +++ b/ofproto/ofproto.h @@ -222,6 +222,7 @@ void ofproto_set_extra_in_band_remotes(struct ofproto *, const struct sockaddr_in *, size_t n); void ofproto_set_in_band_queue(struct ofproto *, int queue_id); void ofproto_set_flow_eviction_threshold(struct ofproto *, unsigned threshold); +void ofproto_set_max_idle(struct ofproto *, 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); |