tests: Fix dependencies on hash function in ofproto-dpif tests.

These tests relied on luck to ensure that OpenFlow ports received the
expected OpenFlow port numbers.  With a different hash function, or (I
expect) on a big-endian architecture, the port numbers were assigned
differently and the tests failed.

This commit fixes the problem by requesting the specific expected port
numbers explicitly.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
hash: Correct implementation of mhash_finish().

With rotates instead of shifts, the upper and lower 16 bits of the returned
hash are always the same.

I noticed this while working on replacing Jenkins hash by murmurhash,
because some of the database unit tests started failing, e.g. "row
hashing (scalars)".

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
hash: Change mhash_finish() data measurement from words to bytes.

murmurhash includes an xor with the number of bytes hashed in its finishing
step.  Until now, we've only had murmurhash for full words, but an upcoming
commit adds murmurhash for bytes, so the finishing function will need to
take a count of bytes instead.

Signed-off-by: Ben Pfaff <blp@nicira.com>
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>
ofproto-dpif: Fix minor memory leak when creating dpif_backers.

Found by inspection.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Merge branch 'master' into bsd-port-threaded