This marginally simplifies the code, and removes a reference to
dpif_backer from ofproto-dpif-xlate.

Signed-off-by: Ethan Jackson <et...@nicira.com>
---
 ofproto/ofproto-dpif-xlate.c |    7 -------
 ofproto/ofproto-dpif.c       |    8 +++++++-
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index e53eaad..500712b 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -817,7 +817,6 @@ compose_output_action__(struct xlate_ctx *ctx, uint16_t 
ofp_port,
     if (netdev_vport_is_patch(ofport->up.netdev)) {
         struct ofport_dpif *peer = ofport_get_peer(ofport);
         struct flow old_flow = ctx->xin->flow;
-        const struct ofproto_dpif *peer_ofproto;
         enum slow_path_reason special;
         struct ofport_dpif *in_port;
 
@@ -826,12 +825,6 @@ compose_output_action__(struct xlate_ctx *ctx, uint16_t 
ofp_port,
             return;
         }
 
-        peer_ofproto = ofproto_dpif_cast(peer->up.ofproto);
-        if (peer_ofproto->backer != ctx->ofproto->backer) {
-            xlate_report(ctx, "Patch port peer on a different datapath");
-            return;
-        }
-
         ctx->ofproto = ofproto_dpif_cast(peer->up.ofproto);
         ctx->xin->flow.in_port = peer->up.ofp_port;
         ctx->xin->flow.metadata = htonll(0);
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 3033aac..a51b60d 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -2737,6 +2737,7 @@ struct ofport_dpif *
 ofport_get_peer(const struct ofport_dpif *ofport_dpif)
 {
     const struct ofproto_dpif *ofproto;
+    const struct dpif_backer *backer;
     const char *peer;
 
     peer = netdev_vport_patch_peer(ofport_dpif->up.netdev);
@@ -2744,11 +2745,16 @@ ofport_get_peer(const struct ofport_dpif *ofport_dpif)
         return NULL;
     }
 
+    backer = ofproto_dpif_cast(ofport_dpif->up.ofproto)->backer;
     HMAP_FOR_EACH (ofproto, all_ofproto_dpifs_node, &all_ofproto_dpifs) {
         struct ofport *ofport;
 
+        if (ofproto->backer != backer) {
+            continue;
+        }
+
         ofport = shash_find_data(&ofproto->up.port_by_name, peer);
-        if (ofport && ofport->ofproto->ofproto_class == &ofproto_dpif_class) {
+        if (ofport) {
             return ofport_dpif_cast(ofport);
         }
     }
-- 
1.7.9.5

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to