2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-25 15:07:05 +00:00
Commit Graph

17 Commits

Author SHA1 Message Date
Joe Stringer
bdd7ecf5bf types: Rename and move ovs_u128_equal().
This function doesn't need to be exported in the public OVS headers, and
it had an inconsistent name compared to uuid_equals(). Rename and move.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-06-09 18:20:02 -07:00
Alex Wang
6cc59853b2 test-hash: Improve comments.
This commit tries to simplify and further clarify the test cases
in test-hash.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-03-16 14:11:12 -07:00
Alex Wang
06af0bbfb9 test-hash: Do not exit check_word_hash() when there is a failure.
This commit makes check_word_hash() run to finish even when there
is a failure during the run.  The test will still fail due to the
output check in AT_CHECK.  And developers can benefit from having
all failed hashes instead of only the first one.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-03-04 09:31:28 -08:00
Alex Wang
afb505724c test-hash: Test hash_bytes128() with single 128-bit word.
This commit adds a new test for hash_bytes128() using single 128-bit
word.  The test shows that there is no collision in all 19 consecutive
bits checks, which indicates the hash function is good.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
2015-03-04 09:31:28 -08:00
Alex Wang
2a638b8d22 test-hash: Remove the check_word_hash() for hash_bytes128_cb.
The original test fails on big-endian system due to the hash function
performing not as well when input is uint32_t.  In reality, users should
only use hash_bytes128() to hash words larger than 128 bits (e.g. struct
flow).  Besides, we do check the 1-bit set case for 16 128-bit words in
following test case.  Therefore, the cleanest way to fix the failure
in big-endian system seems to be just removing the check_word_hash()
test for hash_bytes128_cb.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-02-27 09:07:18 -08:00
Alex Wang
135fec5937 test-hash: Refine the check_256byte_hash().
This commit refines the check_256byte_hash() function by moving
some checks to outer loop.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-02-27 08:57:33 -08:00
Alex Wang
59f280f173 test-hash: Make check_256byte_hash() test no 1-bits set case.
The test comment mentions that we will test the no 1-bits set case.
So, this commit makes sure that it is tested.

Signed-off-by: Alex Wang <alexw@nicira.com>

---
PATCH->V2:
- explain why calling set_bit128 with i or j == n_bits is okay.
2015-02-26 21:12:43 -08:00
Joe Stringer
468cdd91c3 hash: Add 128-bit murmurhash.
Add the 128-bit murmurhash by Austin Appleby, r150 from:
http://code.google.com/p/smhasher/source/browse/trunk/MurmurHash3.cpp

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2014-11-25 14:12:24 -08:00
Jarno Rajahalme
3f636c7e22 ovs_assert, tests: Support NDEBUG.
./configure accepts --enable-ndebug option.  Make ovs_assert() honor
it, and make sure all test programs disable it.

The order of include files in test programs is also made uniform:

1. #include <config.h>
2. #undef NDEBUG
3. Include file of the test subject (to make sure it itself has
   sufficient include directives).
4. System includes in alphapetical order.
5. OVS includes in aplhapetical order.

Suggested-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2014-10-30 09:14:46 -07:00
Joe Stringer
a2b59fd5bd tests: Mention binomial coefficient in hash tests.
This just makes it a bit easier for someone coming in fresh to do some
searches and figure out what the description means.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2014-09-30 16:25:14 +13:00
Jarno Rajahalme
ff8eeabd0d lib/hash: Use CRC32 for hashing.
Use CRC32 intrinsics for hash computations when building for
X86_64 with SSE4_2.

Add a new hash_words64() and change hash_words() to be inlined when
'n_words' is a compile-time constant.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2014-07-11 05:57:11 -07:00
Andy Zhou
eadd16449c unit-test: Link 29 test programs into ovstest
Improve link speed by linking 29 test programs into ovstest.

On my machine, running the following command against a fully
built tree:

  $ touch lib/random.c; time make

Improve the overall build time from 7 seconds to 3.5 seconds.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2014-04-03 11:17:17 -07:00
Ben Pfaff
c49d1dd168 hash: Replace primary hash functions by murmurhash.
murmurhash is faster than Jenkins and slightly higher quality, so switch to
it for hashing words.

The best timings I got for hashing for data lengths of the following
numbers of 32-bit words, in seconds per 1,000,000,000 hashes, were:

words     murmurhash      Jenkins hash
-----     ----------      ------------
   1           8.4              10.4
   2          10.3              10.3
   3          11.2              10.7
   4          12.6              18.0
   5          13.9              18.3
   6          15.2              18.7

In other words, murmurhash outperforms Jenkins for all input lengths other
than exactly 3 32-bit words (12 bytes).  (It's understandable that Jenkins
would have a best case at 12 bytes, because Jenkins works in 12-byte
chunks.)  Even in the case where Jenkins is faster, it's only by 5%.  On
average within this data set, murmurhash is 15% faster, and for 4-word
input it is 30% faster.

We retain Jenkins for flow_hash_symmetric_l4() and flow_hash_fields(),
which are cases where the hash value is exposed externally.

This commit appears to improve "ovs-benchmark rate" results slightly by
a few hundred connections per second (under 1%), when used with an NVP
controller.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-01-22 13:40:53 -08:00
Ben Pfaff
9879b94f43 hash: Introduce an implementation of murmurhash.
Murmurhash is generally superior to the Jenkins lookup3 hash according to
the available figures.  Perhaps we should generally replace our current
hashes by murmurhash.

For now, I'm introducing a parallel implementation to allow it to be used
in cases where an incremental one-word-at-a-time hash is desirable.  The
first user will be added in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2012-09-04 12:24:28 -07:00
Raju Subramanian
e0edde6fee Global replace of Nicira Networks.
Replaced all instances of Nicira Networks(, Inc) to Nicira, Inc.

Feature #10593
Signed-off-by: Raju Subramanian <rsubramanian@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-02 17:08:02 -07:00
Ben Pfaff
a14bc59fb8 Update primary code license to Apache 2.0. 2009-06-15 15:11:30 -07:00
Ben Pfaff
064af42167 Import from old repository commit 61ef2b42a9c4ba8e1600f15bb0236765edc2ad45. 2009-07-08 13:19:16 -07:00