tunnel: Make tnl_port_receive() parameter 'const'.
authorBen Pfaff <blp@nicira.com>
Wed, 8 May 2013 20:21:11 +0000 (13:21 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 9 May 2013 16:49:33 +0000 (09:49 -0700)
This function no longer has much need to modify its argument, because the
caller can now easily do the modification itself, so this commit makes
that change.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto/ofproto-dpif.c
ofproto/tunnel.c
ofproto/tunnel.h

index 0d17dbf..a42625b 100644 (file)
@@ -3927,6 +3927,7 @@ ofproto_receive(const struct dpif_backer *backer, struct ofpbuf *packet,
             flow->in_port = OFPP_NONE;
             goto exit;
         }
+        flow->in_port = ofport->ofp_port;
         port = ofport_dpif_cast(ofport);
 
         /* XXX: Since the tunnel module is not scoped per backer, it's
index f5bbfb9..31aaf3b 100644 (file)
@@ -159,17 +159,14 @@ tnl_port_del(struct tnl_port *tnl_port)
     }
 }
 
-/* Transforms 'flow' so that it appears to have been received by a tunnel
- * OpenFlow port controlled by this module instead of the datapath port it
- * actually came in on.  Sets 'flow''s in_port to the appropriate OpenFlow port
- * number.  Returns the 'ofport' corresponding to the new in_port.
+/* Looks in the table of tunnels for a tunnel matching the metadata in 'flow'.
+ * Returns the 'ofport' corresponding to the new in_port, or a null pointer if
+ * none is found.
  *
  * Callers should verify that 'flow' needs to be received by calling
- * tnl_port_should_receive() before this function.
- *
- * Leaves 'flow' untouched and returns null if unsuccessful. */
+ * tnl_port_should_receive() before this function. */
 const struct ofport *
-tnl_port_receive(struct flow *flow)
+tnl_port_receive(const struct flow *flow)
 {
     char *pre_flow_str = NULL;
     struct tnl_port *tnl_port;
@@ -196,9 +193,6 @@ tnl_port_receive(struct flow *flow)
         pre_flow_str = flow_to_string(flow);
     }
 
-    flow->in_port = tnl_port->ofport->ofp_port;
-    /* Keep flow->tunnel to allow matching on tunnel metadata */
-
     if (pre_flow_str) {
         char *post_flow_str = flow_to_string(flow);
         char *tnl_str = tnl_port_fmt(tnl_port);
index 1b055ae..34c1133 100644 (file)
@@ -37,7 +37,7 @@ bool tnl_port_reconfigure(const struct ofport *, uint32_t odp_port,
 struct tnl_port *tnl_port_add(const struct ofport *, uint32_t odp_port);
 void tnl_port_del(struct tnl_port *);
 
-const struct ofport *tnl_port_receive(struct flow *);
+const struct ofport *tnl_port_receive(const struct flow *);
 uint32_t tnl_port_send(const struct tnl_port *, struct flow *);
 
 /* Returns true if 'flow' should be submitted to tnl_port_receive(). */