From 1006cda6d4c36f4e10cab9714d4d625e141a4cad Mon Sep 17 00:00:00 2001
From: Ben Pfaff <blp@nicira.com>
Date: Thu, 26 May 2011 16:23:21 -0700
Subject: [PATCH] flow: Give flow_wildcards_hash() a 'basis' parameter.

An upcoming commit will add more interesting uses.
---
 lib/classifier.c | 4 ++--
 lib/flow.c       | 4 ++--
 lib/flow.h       | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/classifier.c b/lib/classifier.c
index e89a6c8fb..185195b1e 100644
--- a/lib/classifier.c
+++ b/lib/classifier.c
@@ -969,7 +969,7 @@ find_table(const struct classifier *cls, const struct flow_wildcards *wc)
 {
     struct cls_table *table;
 
-    HMAP_FOR_EACH_IN_BUCKET (table, hmap_node, flow_wildcards_hash(wc),
+    HMAP_FOR_EACH_IN_BUCKET (table, hmap_node, flow_wildcards_hash(wc, 0),
                              &cls->tables) {
         if (flow_wildcards_equal(wc, &table->wc)) {
             return table;
@@ -986,7 +986,7 @@ insert_table(struct classifier *cls, const struct flow_wildcards *wc)
     table = xzalloc(sizeof *table);
     hmap_init(&table->rules);
     table->wc = *wc;
-    hmap_insert(&cls->tables, &table->hmap_node, flow_wildcards_hash(wc));
+    hmap_insert(&cls->tables, &table->hmap_node, flow_wildcards_hash(wc, 0));
 
     return table;
 }
diff --git a/lib/flow.c b/lib/flow.c
index 85d7bfef0..e6607bf15 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -591,13 +591,13 @@ flow_wildcards_combine(struct flow_wildcards *dst,
 
 /* Returns a hash of the wildcards in 'wc'. */
 uint32_t
-flow_wildcards_hash(const struct flow_wildcards *wc)
+flow_wildcards_hash(const struct flow_wildcards *wc, uint32_t basis)
 {
     /* If you change struct flow_wildcards and thereby trigger this
      * assertion, please check that the new struct flow_wildcards has no holes
      * in it before you update the assertion. */
     BUILD_ASSERT_DECL(sizeof *wc == 56 + FLOW_N_REGS * 4);
-    return hash_bytes(wc, sizeof *wc, 0);
+    return hash_bytes(wc, sizeof *wc, basis);
 }
 
 /* Returns true if 'a' and 'b' represent the same wildcards, false if they are
diff --git a/lib/flow.h b/lib/flow.h
index 2e617b09f..f7a0c23bd 100644
--- a/lib/flow.h
+++ b/lib/flow.h
@@ -162,7 +162,7 @@ void flow_wildcards_combine(struct flow_wildcards *dst,
 bool flow_wildcards_has_extra(const struct flow_wildcards *,
                               const struct flow_wildcards *);
 
-uint32_t flow_wildcards_hash(const struct flow_wildcards *);
+uint32_t flow_wildcards_hash(const struct flow_wildcards *, uint32_t basis);
 bool flow_wildcards_equal(const struct flow_wildcards *,
                           const struct flow_wildcards *);
 uint32_t flow_hash_symmetric_l4(const struct flow *flow, uint32_t basis);
-- 
2.47.0