[ovs-dev] [bug9964 2/5] connmgr: Drop 'flow' parameter from connmgr_send_packet_in().

Ben Pfaff blp at nicira.com
Mon Mar 12 21:38:23 UTC 2012


Only 'flow->in_port' was used, which was redundant with pin->fmd.in_port.

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 ofproto/connmgr.c      |   20 ++++++++------------
 ofproto/connmgr.h      |    4 ++--
 ofproto/ofproto-dpif.c |    4 ++--
 3 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c
index 55b0306..4343622 100644
--- a/ofproto/connmgr.c
+++ b/ofproto/connmgr.c
@@ -1230,8 +1230,7 @@ ofconn_send(const struct ofconn *ofconn, struct ofpbuf *msg,
 
 /* Sending asynchronous messages. */
 
-static void schedule_packet_in(struct ofconn *, struct ofputil_packet_in,
-                               const struct flow *);
+static void schedule_packet_in(struct ofconn *, struct ofputil_packet_in);
 
 /* Sends an OFPT_PORT_STATUS message with 'opp' and 'reason' to appropriate
  * controllers managed by 'mgr'. */
@@ -1282,15 +1281,14 @@ connmgr_send_flow_removed(struct connmgr *mgr,
  * necessary according to their individual configurations. */
 void
 connmgr_send_packet_in(struct connmgr *mgr,
-                       const struct ofputil_packet_in *pin,
-                       const struct flow *flow)
+                       const struct ofputil_packet_in *pin)
 {
     struct ofconn *ofconn;
 
     LIST_FOR_EACH (ofconn, node, &mgr->all_conns) {
         if (ofconn_receives_async_msg(ofconn, OAM_PACKET_IN, pin->reason)
             && ofconn->controller_id == pin->controller_id) {
-            schedule_packet_in(ofconn, *pin, flow);
+            schedule_packet_in(ofconn, *pin);
         }
     }
 }
@@ -1305,12 +1303,10 @@ do_send_packet_in(struct ofpbuf *ofp_packet_in, void *ofconn_)
                           ofconn->packet_in_counter, 100);
 }
 
-/* Takes 'pin', whose packet has the flow specified by 'flow', composes an
- * OpenFlow packet-in message from it, and passes it to 'ofconn''s packet
- * scheduler for sending. */
+/* Takes 'pin', composes an OpenFlow packet-in message from it, and passes it
+ * to 'ofconn''s packet scheduler for sending. */
 static void
-schedule_packet_in(struct ofconn *ofconn, struct ofputil_packet_in pin,
-                   const struct flow *flow)
+schedule_packet_in(struct ofconn *ofconn, struct ofputil_packet_in pin)
 {
     struct connmgr *mgr = ofconn->connmgr;
 
@@ -1323,7 +1319,7 @@ schedule_packet_in(struct ofconn *ofconn, struct ofputil_packet_in pin,
         pin.buffer_id = UINT32_MAX;
     } else {
         pin.buffer_id = pktbuf_save(ofconn->pktbuf, pin.packet, pin.packet_len,
-                                    flow->in_port);
+                                    pin.fmd.in_port);
     }
 
     /* Figure out how much of the packet to send. */
@@ -1341,7 +1337,7 @@ schedule_packet_in(struct ofconn *ofconn, struct ofputil_packet_in pin,
      * immediately call into do_send_packet_in() or it might buffer it for a
      * while (until a later call to pinsched_run()). */
     pinsched_send(ofconn->schedulers[pin.reason == OFPR_NO_MATCH ? 0 : 1],
-                  flow->in_port,
+                  pin.fmd.in_port,
                   ofputil_encode_packet_in(&pin, ofconn->packet_in_format),
                   do_send_packet_in, ofconn);
 }
diff --git a/ofproto/connmgr.h b/ofproto/connmgr.h
index 2869ba7..6d404cf 100644
--- a/ofproto/connmgr.h
+++ b/ofproto/connmgr.h
@@ -128,8 +128,8 @@ void connmgr_send_port_status(struct connmgr *,
                               const struct ofputil_phy_port *, uint8_t reason);
 void connmgr_send_flow_removed(struct connmgr *,
                                const struct ofputil_flow_removed *);
-void connmgr_send_packet_in(struct connmgr *, const struct ofputil_packet_in *,
-                            const struct flow *);
+void connmgr_send_packet_in(struct connmgr *,
+                            const struct ofputil_packet_in *);
 
 /* Fail-open settings. */
 enum ofproto_fail_mode connmgr_get_fail_mode(const struct connmgr *);
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 7ad6569..983fbd0 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -2486,7 +2486,7 @@ send_packet_in_miss(struct ofproto_dpif *ofproto, const struct ofpbuf *packet,
     /* Registers aren't meaningful on a miss. */
     memset(pin.fmd.reg_masks, 0, sizeof pin.fmd.reg_masks);
 
-    connmgr_send_packet_in(ofproto->up.connmgr, &pin, flow);
+    connmgr_send_packet_in(ofproto->up.connmgr, &pin);
 }
 
 static bool
@@ -4540,7 +4540,7 @@ execute_controller_action(struct action_xlate_ctx *ctx, int len,
     pin.total_len = packet->size;
     flow_get_metadata(&ctx->flow, &pin.fmd);
 
-    connmgr_send_packet_in(ctx->ofproto->up.connmgr, &pin, &ctx->flow);
+    connmgr_send_packet_in(ctx->ofproto->up.connmgr, &pin);
     ofpbuf_delete(packet);
 }
 
-- 
1.7.2.5




More information about the dev mailing list