[ovs-dev] [PATCH 20/26] ofproto-dpif-xlate: Move initialization of 'in_port' closer to first use.

Ben Pfaff blp at nicira.com
Thu Jul 30 06:42:40 UTC 2015


This seems to be a little clearer to me.

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 ofproto/ofproto-dpif-xlate.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 2c9092d..be0fd13 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -4793,13 +4793,8 @@ xlate_actions(struct xlate_in *xin, struct xlate_out *xout)
         xlate_wc_init(&ctx);
     }
 
-    struct xport *in_port;
-
     COVERAGE_INC(xlate_actions);
 
-    /* The in_port of the original packet before recirculation. */
-    in_port = get_ofp_port(xbridge, flow->in_port.ofp_port);
-
     if (xin->recirc) {
         const struct recirc_id_node *recirc = xin->recirc;
 
@@ -4902,6 +4897,11 @@ xlate_actions(struct xlate_in *xin, struct xlate_out *xout)
         orig_flow = *flow;
     }
 
+    /* Get the proximate input port of the packet.  (If xin->recirc,
+     * flow->in_port is the ultimate input port of the packet.) */
+    struct xport *in_port = get_ofp_port(xbridge,
+                                         ctx.base_flow.in_port.ofp_port);
+
     /* Tunnel stats only for non-recirculated packets. */
     if (!xin->recirc && in_port && in_port->is_tunnel) {
         if (ctx.xin->resubmit_stats) {
-- 
2.1.3




More information about the dev mailing list