diff options
author | Sorin Vinturis <svinturis@cloudbasesolutions.com> | 2016-06-01 15:50:27 +0000 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2016-06-14 10:02:28 -0700 |
commit | 9d36ca82f29ed21fec1d693c37308d0fa01d302a (patch) | |
tree | f3df9b4d8e26a564c2b53015d578093126091d25 /datapath-windows/ovsext/Util.h | |
parent | d1b97f99a7f350420439e44c0fa78e8da1757a63 (diff) | |
download | openvswitch-9d36ca82f29ed21fec1d693c37308d0fa01d302a.tar.gz |
datapath-windows: Sample action support.
This patch adds support for sampling to the OVS extension.
The following flow was used for generating sample actions:
ovs-ofctl add-flow tcp:127.0.0.1:9999 "actions=sample(
probability=12345,collector_set_id=23456,obs_domain_id=34567,
obs_point_id=45678)"
Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'datapath-windows/ovsext/Util.h')
-rw-r--r-- | datapath-windows/ovsext/Util.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/datapath-windows/ovsext/Util.h b/datapath-windows/ovsext/Util.h index 4bcde3b23..bcd38ddc0 100644 --- a/datapath-windows/ovsext/Util.h +++ b/datapath-windows/ovsext/Util.h @@ -113,4 +113,31 @@ OvsPerCpuDataInit(); VOID OvsPerCpuDataCleanup(); +static LARGE_INTEGER seed; + +/* + *---------------------------------------------------------------------------- + * SRand -- + * This function sets the starting seed value for the pseudorandom number + * generator. + *---------------------------------------------------------------------------- + */ +static __inline +VOID SRand() +{ + KeQuerySystemTime(&seed); +} + +/* + *---------------------------------------------------------------------------- + * Rand -- + * This function generates a pseudorandom number between 0 to UINT_MAX. + *---------------------------------------------------------------------------- + */ +static __inline +UINT32 Rand() +{ + return seed.LowPart *= 0x8088405 + 1; +} + #endif /* __UTIL_H_ */ |