summaryrefslogtreecommitdiff
path: root/ofproto/ofproto-dpif-rid.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2016-01-18 14:47:40 -0800
committerBen Pfaff <blp@ovn.org>2016-01-20 16:51:21 -0800
commit290835f9648c9669fb17f3191906026affde8f2b (patch)
tree8f0e5681973d3f038222afd616e3d0bda171da47 /ofproto/ofproto-dpif-rid.c
parentb597af0fb00dc6925c9ef3a466e9848e95b16280 (diff)
downloadopenvswitch-290835f9648c9669fb17f3191906026affde8f2b.tar.gz
ofproto-dpif-rid: Use UUID, not pointer, to identify ofprotos for recirc.
An upcoming commit will make it possible to essentially serialize the recirculation state into an OpenFlow message. For that purpose, we can't sensibly pass a "struct ofproto *", but a randomly generated UUID works just as well. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
Diffstat (limited to 'ofproto/ofproto-dpif-rid.c')
-rw-r--r--ofproto/ofproto-dpif-rid.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ofproto/ofproto-dpif-rid.c b/ofproto/ofproto-dpif-rid.c
index eb80410a1..046419a4c 100644
--- a/ofproto/ofproto-dpif-rid.c
+++ b/ofproto/ofproto-dpif-rid.c
@@ -130,7 +130,7 @@ recirc_state_hash(const struct recirc_state *state)
{
uint32_t hash;
- hash = hash_pointer(state->ofproto, 0);
+ hash = uuid_hash(&state->ofproto_uuid);
hash = hash_int(state->table_id, hash);
if (flow_tnl_dst_is_set(state->metadata.tunnel)) {
/* We may leave remainder bytes unhashed, but that is unlikely as
@@ -164,7 +164,7 @@ recirc_state_equal(const struct recirc_state *a,
const struct recirc_state *b)
{
return (a->table_id == b->table_id
- && a->ofproto == b->ofproto
+ && uuid_equals(&a->ofproto_uuid, &b->ofproto_uuid)
&& flow_tnl_equal(a->metadata.tunnel, b->metadata.tunnel)
&& !memcmp(&a->metadata.metadata, &b->metadata.metadata,
sizeof a->metadata - sizeof a->metadata.tunnel)
@@ -304,7 +304,7 @@ recirc_alloc_id(struct ofproto_dpif *ofproto)
tunnel.ipv6_dst = in6addr_any;
struct recirc_state state = {
.table_id = TBL_INTERNAL,
- .ofproto = ofproto,
+ .ofproto_uuid = *ofproto_dpif_get_uuid(ofproto),
.metadata = { .tunnel = &tunnel, .in_port = OFPP_NONE },
};
return recirc_alloc_id__(&state, recirc_state_hash(&state))->id;
@@ -357,8 +357,9 @@ recirc_free_ofproto(struct ofproto_dpif *ofproto, const char *ofproto_name)
{
struct recirc_id_node *n;
+ const struct uuid *ofproto_uuid = ofproto_dpif_get_uuid(ofproto);
CMAP_FOR_EACH (n, metadata_node, &metadata_map) {
- if (n->state.ofproto == ofproto) {
+ if (uuid_equals(&n->state.ofproto_uuid, ofproto_uuid)) {
VLOG_ERR("recirc_id %"PRIu32
" left allocated when ofproto (%s)"
" is destructed", n->id, ofproto_name);