git://git.onelab.eu
/
sliver-openvswitch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tunnel: removed unused function
[sliver-openvswitch.git]
/
ofproto
/
ofproto-dpif-ipfix.c
diff --git
a/ofproto/ofproto-dpif-ipfix.c
b/ofproto/ofproto-dpif-ipfix.c
index
a9cc73e
..
2500efd
100644
(file)
--- a/
ofproto/ofproto-dpif-ipfix.c
+++ b/
ofproto/ofproto-dpif-ipfix.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 2012 Nicira, Inc.
+ * Copyright (c) 2012
, 2013
Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-70,7
+70,7
@@
struct dpif_ipfix_flow_exporter_map_node {
struct dpif_ipfix {
struct dpif_ipfix_bridge_exporter bridge_exporter;
struct hmap flow_exporter_map; /* dpif_ipfix_flow_exporter_map_node. */
struct dpif_ipfix {
struct dpif_ipfix_bridge_exporter bridge_exporter;
struct hmap flow_exporter_map; /* dpif_ipfix_flow_exporter_map_node. */
-
atomic_i
nt ref_cnt;
+
struct ovs_refcou
nt ref_cnt;
};
#define IPFIX_VERSION 0x000a
};
#define IPFIX_VERSION 0x000a
@@
-639,7
+639,7
@@
dpif_ipfix_create(void)
di = xzalloc(sizeof *di);
dpif_ipfix_bridge_exporter_init(&di->bridge_exporter);
hmap_init(&di->flow_exporter_map);
di = xzalloc(sizeof *di);
dpif_ipfix_bridge_exporter_init(&di->bridge_exporter);
hmap_init(&di->flow_exporter_map);
-
atomic_init(&di->ref_cnt, 1
);
+
ovs_refcount_init(&di->ref_cnt
);
return di;
}
return di;
}
@@
-648,9
+648,7
@@
dpif_ipfix_ref(const struct dpif_ipfix *di_)
{
struct dpif_ipfix *di = CONST_CAST(struct dpif_ipfix *, di_);
if (di) {
{
struct dpif_ipfix *di = CONST_CAST(struct dpif_ipfix *, di_);
if (di) {
- int orig;
- atomic_add(&di->ref_cnt, 1, &orig);
- ovs_assert(orig > 0);
+ ovs_refcount_ref(&di->ref_cnt);
}
return di;
}
}
return di;
}
@@
-683,19
+681,12
@@
dpif_ipfix_clear(struct dpif_ipfix *di) OVS_REQUIRES(mutex)
void
dpif_ipfix_unref(struct dpif_ipfix *di) OVS_EXCLUDED(mutex)
{
void
dpif_ipfix_unref(struct dpif_ipfix *di) OVS_EXCLUDED(mutex)
{
- int orig;
-
- if (!di) {
- return;
- }
-
- atomic_sub(&di->ref_cnt, 1, &orig);
- ovs_assert(orig > 0);
- if (orig == 1) {
+ if (di && ovs_refcount_unref(&di->ref_cnt) == 1) {
ovs_mutex_lock(&mutex);
dpif_ipfix_clear(di);
dpif_ipfix_bridge_exporter_destroy(&di->bridge_exporter);
hmap_destroy(&di->flow_exporter_map);
ovs_mutex_lock(&mutex);
dpif_ipfix_clear(di);
dpif_ipfix_bridge_exporter_destroy(&di->bridge_exporter);
hmap_destroy(&di->flow_exporter_map);
+ ovs_refcount_destroy(&di->ref_cnt);
free(di);
ovs_mutex_unlock(&mutex);
}
free(di);
ovs_mutex_unlock(&mutex);
}