summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Stringer <joestringer@nicira.com>2015-05-29 16:17:01 -0700
committerJoe Stringer <joestringer@nicira.com>2015-06-09 18:20:02 -0700
commitbdd7ecf5bfc4a255872aa60057b3b96f72b47d8a (patch)
treeda3d6322f8941e95ef6b88ac390b562d08cbe75f
parent10e92b4f7a1db4bd88452cdc3aaec5fd46c4f7fe (diff)
downloadopenvswitch-bdd7ecf5bfc4a255872aa60057b3b96f72b47d8a.tar.gz
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>
-rw-r--r--include/openvswitch/types.h7
-rw-r--r--lib/dpif-netdev.c2
-rw-r--r--lib/dpif.c3
-rw-r--r--lib/util.h7
-rw-r--r--ofproto/ofproto-dpif-upcall.c2
-rw-r--r--tests/test-hash.c4
6 files changed, 13 insertions, 12 deletions
diff --git a/include/openvswitch/types.h b/include/openvswitch/types.h
index 2afb7b71f..629a3e5c6 100644
--- a/include/openvswitch/types.h
+++ b/include/openvswitch/types.h
@@ -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 {
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 7df95239d..5b82c8b63 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -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;
}
}
diff --git a/lib/dpif.c b/lib/dpif.c
index 388ca734a..783a715fb 100644
--- a/lib/dpif.c
+++ b/lib/dpif.c
@@ -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;
}
diff --git a/lib/util.h b/lib/util.h
index 78abfd388..d1e470a41 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -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
diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
index 6c5770ad2..c39b5712e 100644
--- a/ofproto/ofproto-dpif-upcall.c
+++ b/ofproto/ofproto-dpif-upcall.c
@@ -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;
}
}
diff --git a/tests/test-hash.c b/tests/test-hash.c
index 83521567b..67a1f6c89 100644
--- a/tests/test-hash.c
+++ b/tests/test-hash.c
@@ -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);