[ovs-discuss] Configure sampling rate
Ben Pfaff
blp at nicira.com
Wed Jan 21 17:29:33 UTC 2015
On Wed, Jan 21, 2015 at 11:50:10PM +0800, K 華 wrote:
> I tried to change sampling rate in sflow table by sending JSON to OVSDB.
> I found that sampling rate would be configured after sending JSON to OVSDB,
> but it did not work immediately and did work after no packet passing.
>
> How to make sampling rate work after sending JSON to OVSDB with no
> delay?Or what is the time period while the change go into effect?
It should take effect immediately, but I think I see a bug.
Can you try this patch?
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index bf15d04..0776478 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -1894,6 +1894,7 @@ set_sflow(struct ofproto *ofproto_,
struct dpif_sflow *ds = ofproto->sflow;
if (sflow_options) {
+ uint32_t old_probability = ds ? dpif_sflow_get_probability(ds) : 0;
if (!ds) {
struct ofport_dpif *ofport;
@@ -1901,9 +1902,11 @@ set_sflow(struct ofproto *ofproto_,
HMAP_FOR_EACH (ofport, up.hmap_node, &ofproto->up.ports) {
dpif_sflow_add_port(ds, &ofport->up, ofport->odp_port);
}
- ofproto->backer->need_revalidate = REV_RECONFIGURE;
}
dpif_sflow_set_options(ds, sflow_options);
+ if (dpif_sflow_get_probability(ds) != old_probability) {
+ ofproto->backer->need_revalidate = REV_RECONFIGURE;
+ }
} else {
if (ds) {
dpif_sflow_unref(ds);
More information about the discuss
mailing list