{
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
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)
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;
{
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);
/*
- * Copyright (c) 2014, 2015 Nicira, Inc.
+ * Copyright (c) 2014, 2015, 2016 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "ofp-actions.h"
#include "ofproto-dpif-mirror.h"
#include "ovs-thread.h"
+#include "uuid.h"
struct ofproto_dpif;
struct rule;
uint8_t table_id;
/* Pipeline context for post-recirculation processing. */
- struct ofproto_dpif *ofproto; /* Post-recirculation bridge. */
+ struct uuid ofproto_uuid; /* Post-recirculation bridge. */
struct recirc_metadata metadata; /* Flow metadata. */
union mf_subvalue *stack; /* Stack if any. */
size_t n_stack;
static struct xbridge *xbridge_lookup(struct xlate_cfg *,
const struct ofproto_dpif *);
+static struct xbridge *xbridge_lookup_by_uuid(struct xlate_cfg *,
+ const struct uuid *);
static struct xbundle *xbundle_lookup(struct xlate_cfg *,
const struct ofbundle *);
static struct xport *xport_lookup(struct xlate_cfg *,
return NULL;
}
+static struct xbridge *
+xbridge_lookup_by_uuid(struct xlate_cfg *xcfg, const struct uuid *uuid)
+{
+ struct xbridge *xbridge;
+
+ HMAP_FOR_EACH (xbridge, hmap_node, &xcfg->xbridges) {
+ if (uuid_equals(ofproto_dpif_get_uuid(xbridge->ofproto), uuid)) {
+ return xbridge;
+ }
+ }
+ return NULL;
+}
+
static struct xbundle *
xbundle_lookup(struct xlate_cfg *xcfg, const struct ofbundle *ofbundle)
{
struct recirc_state state = {
.table_id = table,
- .ofproto = ctx->xbridge->ofproto,
+ .ofproto_uuid = *ofproto_dpif_get_uuid(ctx->xbridge->ofproto),
.metadata = md,
.stack = ctx->stack.data,
.n_stack = ctx->stack.size / sizeof(union mf_subvalue),
}
/* Set the bridge for post-recirculation processing if needed. */
- if (ctx.xbridge->ofproto != state->ofproto) {
+ if (!uuid_equals(ofproto_dpif_get_uuid(ctx.xbridge->ofproto),
+ &state->ofproto_uuid)) {
struct xlate_cfg *xcfg = ovsrcu_get(struct xlate_cfg *, &xcfgp);
const struct xbridge *new_bridge
- = xbridge_lookup(xcfg, state->ofproto);
+ = xbridge_lookup_by_uuid(xcfg, &state->ofproto_uuid);
if (OVS_UNLIKELY(!new_bridge)) {
/* Drop the packet if the bridge cannot be found. */
struct ofproto up;
struct dpif_backer *backer;
+ /* Unique identifier for this instantiation of this bridge in this running
+ * process. */
+ struct uuid uuid;
+
ATOMIC(cls_version_t) tables_version; /* For classifier lookups. */
uint64_t dump_seq; /* Last read of udpif_dump_seq(). */
return error;
}
+ uuid_generate(&ofproto->uuid);
atomic_init(&ofproto->tables_version, CLS_MIN_VERSION);
ofproto->netflow = NULL;
ofproto->sflow = NULL;
return 0;
}
+const struct uuid *
+ofproto_dpif_get_uuid(const struct ofproto_dpif *ofproto)
+{
+ return &ofproto->uuid;
+}
+
const struct ofproto_class ofproto_dpif_class = {
init,
enumerate_types,
-/* Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
+/* Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
struct rule **rulep);
int ofproto_dpif_delete_internal_flow(struct ofproto_dpif *, struct match *,
int priority);
+
+const struct uuid *ofproto_dpif_get_uuid(const struct ofproto_dpif *);
\f
/* struct rule_dpif has struct rule as it's first member. */
#define RULE_CAST(RULE) ((struct rule *)RULE)