types: Rename and move ovs_u128_equal().
authorJoe Stringer <joestringer@nicira.com>
Fri, 29 May 2015 23:17:01 +0000 (16:17 -0700)
committerJoe Stringer <joestringer@nicira.com>
Wed, 10 Jun 2015 01:20:02 +0000 (18:20 -0700)
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>
include/openvswitch/types.h
lib/dpif-netdev.c
lib/dpif.c
lib/util.h
ofproto/ofproto-dpif-upcall.c
tests/test-hash.c

index 2afb7b7..629a3e5 100644 (file)
@@ -88,13 +88,6 @@ typedef union {
     } u64;
 } ovs_u128;
 
-/* Returns non-zero if the parameters have equal value. */
-static inline int
-ovs_u128_equal(const ovs_u128 *a, const ovs_u128 *b)
-{
-    return (a->u64.hi == b->u64.hi) && (a->u64.lo == b->u64.lo);
-}
-
 /* A 64-bit value, in network byte order, that is only aligned on a 32-bit
  * boundary. */
 typedef struct {
index 7df9523..5b82c8b 100644 (file)
@@ -1770,7 +1770,7 @@ dp_netdev_pmd_find_flow(const struct dp_netdev_pmd_thread *pmd,
     if (ufidp) {
         CMAP_FOR_EACH_WITH_HASH (netdev_flow, node, dp_netdev_flow_hash(ufidp),
                                  &pmd->flow_table) {
-            if (ovs_u128_equal(&netdev_flow->ufid, ufidp)) {
+            if (ovs_u128_equals(&netdev_flow->ufid, ufidp)) {
                 return netdev_flow;
             }
         }
index 388ca73..783a715 100644 (file)
@@ -901,7 +901,8 @@ dpif_probe_feature(struct dpif *dpif, const char *name,
     error = dpif_flow_get(dpif, key->data, key->size, ufid,
                           PMD_ID_NULL, &reply, &flow);
     if (!error
-        && (!ufid || (flow.ufid_present && ovs_u128_equal(ufid, &flow.ufid)))) {
+        && (!ufid || (flow.ufid_present
+                      && ovs_u128_equals(ufid, &flow.ufid)))) {
         enable_feature = true;
     }
 
index 78abfd3..d1e470a 100644 (file)
@@ -551,6 +551,13 @@ void bitwise_put(uint64_t value,
 uint64_t bitwise_get(const void *src, unsigned int src_len,
                      unsigned int src_ofs, unsigned int n_bits);
 
+/* Returns non-zero if the parameters have equal value. */
+static inline int
+ovs_u128_equals(const ovs_u128 *a, const ovs_u128 *b)
+{
+    return (a->u64.hi == b->u64.hi) && (a->u64.lo == b->u64.lo);
+}
+
 void xsleep(unsigned int seconds);
 
 #ifdef _WIN32
index 6c5770a..c39b571 100644 (file)
@@ -1302,7 +1302,7 @@ ukey_lookup(struct udpif *udpif, const ovs_u128 *ufid)
     struct cmap *cmap = &udpif->ukeys[idx].cmap;
 
     CMAP_FOR_EACH_WITH_HASH (ukey, cmap_node, get_ufid_hash(ufid), cmap) {
-        if (ovs_u128_equal(&ukey->ufid, ufid)) {
+        if (ovs_u128_equals(&ukey->ufid, ufid)) {
             return ukey;
         }
     }
index 8352156..67a1f6c 100644 (file)
@@ -162,7 +162,7 @@ check_hash_bytes128(void (*hash)(const void *, size_t, uint32_t, ovs_u128 *),
         set_bit128(&in1, i, n_bits);
         hash(in0, sizeof(ovs_u128), 0, &out0);
         hash(&in1, sizeof(ovs_u128), 0, &out1);
-        if (!ovs_u128_equal(&out0, &out1)) {
+        if (!ovs_u128_equals(&out0, &out1)) {
             printf("%s hash not the same for non-64 aligned data "
                    "%016"PRIx64"%016"PRIx64" != %016"PRIx64"%016"PRIx64"\n",
                    name, out0.u64.lo, out0.u64.hi, out1.u64.lo, out1.u64.hi);
@@ -214,7 +214,7 @@ check_256byte_hash(void (*hash)(const void *, size_t, uint32_t, ovs_u128 *),
         set_bit128(in1, i, n_bits);
         hash(in0, sizeof(ovs_u128) * 16, 0, &out0);
         hash(in1, sizeof(ovs_u128) * 16, 0, &out1);
-        if (!ovs_u128_equal(&out0, &out1)) {
+        if (!ovs_u128_equals(&out0, &out1)) {
             printf("%s hash not the same for non-64 aligned data "
                    "%016"PRIx64"%016"PRIx64" != %016"PRIx64"%016"PRIx64"\n",
                    name, out0.u64.lo, out0.u64.hi, out1.u64.lo, out1.u64.hi);