[ovs-dev] [branch-2.0] ofproto-dpif: Configure datapath max-idle through ovs-vsctl.
Joe Stringer
joestringer at nicira.com
Sat Jun 21 02:42:25 UTC 2014
LGTM (branches 1.10-.2.0)
Acked-by: Joe Stringer <joestringer at nicira.com>
On 20 June 2014 16:22, Alex Wang <alexw at nicira.com> wrote:
> 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 at nicira.com>
> ---
> ofproto/ofproto-dpif.c | 6 ++++++
> ofproto/ofproto-provider.h | 6 ++++++
> ofproto/ofproto.c | 9 +++++++++
> ofproto/ofproto.h | 1 +
> vswitchd/bridge.c | 1 +
> 5 files changed, 23 insertions(+)
>
> diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
> index ede7533..d9fe469 100644
> --- a/ofproto/ofproto-dpif.c
> +++ b/ofproto/ofproto-dpif.c
> @@ -3804,6 +3804,12 @@ subfacet_max_idle(const struct dpif_backer *backer)
> 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;
> diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h
> index 8a6e960..588d6f0 100644
> --- a/ofproto/ofproto-provider.h
> +++ b/ofproto/ofproto-provider.h
> @@ -435,6 +435,12 @@ void rule_collection_destroy(struct rule_collection
> *);
> * 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;
> diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
> index 29becbc..6cc3405 100644
> --- a/ofproto/ofproto.c
> +++ b/ofproto/ofproto.c
> @@ -283,6 +283,7 @@ struct ovs_mutex ofproto_mutex = OVS_MUTEX_INITIALIZER;
> 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);
> @@ -656,6 +657,14 @@ ofproto_set_flow_miss_model(unsigned model)
> 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. */
> diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h
> index 9adda2c..f015c17 100644
> --- a/ofproto/ofproto.h
> +++ b/ofproto/ofproto.h
> @@ -248,6 +248,7 @@ void ofproto_set_extra_in_band_remotes(struct ofproto
> *,
> 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);
> diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
> index e3c565f..63be309 100644
> --- a/vswitchd/bridge.c
> +++ b/vswitchd/bridge.c
> @@ -501,6 +501,7 @@ bridge_reconfigure(const struct ovsrec_open_vswitch
> *ovs_cfg)
> 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));
> --
> 1.7.9.5
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20140621/4eb8b851/attachment-0005.html>
More information about the dev
mailing list