NXM/OXM headers as represented in this file are 64-bit long and the low
bits are essentially constant (almost always 0) so using hash_int(),
which takes an uint32_t, is going to be a useless hash function.  This
commit fixes the problem.

Found by inspection.

CC: Jesse Gross <je...@nicira.com>
Signed-off-by: Ben Pfaff <b...@nicira.com>
---
 lib/nx-match.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/nx-match.c b/lib/nx-match.c
index 21f291c..0560370 100644
--- a/lib/nx-match.c
+++ b/lib/nx-match.c
@@ -1893,7 +1893,7 @@ nxm_init(void)
         for (struct nxm_field_index *nfi = all_nxm_fields;
              nfi < &all_nxm_fields[ARRAY_SIZE(all_nxm_fields)]; nfi++) {
             hmap_insert(&nxm_header_map, &nfi->header_node,
-                        hash_int(nfi->nf.header, 0));
+                        hash_uint64(nfi->nf.header));
             hmap_insert(&nxm_name_map, &nfi->name_node,
                         hash_string(nfi->nf.name, 0));
             list_push_back(&nxm_mf_map[nfi->nf.id], &nfi->mf_node);
@@ -1912,7 +1912,7 @@ nxm_field_by_header(uint64_t header)
         header = nxm_make_exact_header(header);
     }
 
-    HMAP_FOR_EACH_IN_BUCKET (nfi, header_node, hash_int(header, 0),
+    HMAP_FOR_EACH_IN_BUCKET (nfi, header_node, hash_uint64(header),
                              &nxm_header_map) {
         if (header == nfi->nf.header) {
             return &nfi->nf;
-- 
2.1.3

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to