ofproto: connmgr_send_packet_in() doesn't need buffer_id and total_len.
authorBen Pfaff <blp@nicira.com>
Mon, 12 Mar 2012 21:35:35 +0000 (14:35 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 15 Mar 2012 17:23:04 +0000 (10:23 -0700)
Trying to add a new caller for connmgr_send_packet_in(), I wasn't sure
what to put in these members.  Investigating, I saw that the function
didn't really need them, so this commit clears that up.

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

index 43436221725aa542de240cb388d1935f1b676f77..1f5fbed90bc2c0f30736db0e4fb8ad75f4f184ba 100644 (file)
@@ -1278,7 +1278,9 @@ connmgr_send_flow_removed(struct connmgr *mgr,
 }
 
 /* Given 'pin', sends an OFPT_PACKET_IN message to each OpenFlow controller as
- * necessary according to their individual configurations. */
+ * necessary according to their individual configurations.
+ *
+ * The caller doesn't need to fill in pin->buffer_id or pin->total_len. */
 void
 connmgr_send_packet_in(struct connmgr *mgr,
                        const struct ofputil_packet_in *pin)
@@ -1310,6 +1312,8 @@ schedule_packet_in(struct ofconn *ofconn, struct ofputil_packet_in pin)
 {
     struct connmgr *mgr = ofconn->connmgr;
 
+    pin.total_len = pin.packet_len;
+
     /* Get OpenFlow buffer_id. */
     if (pin.reason == OFPR_ACTION) {
         pin.buffer_id = UINT32_MAX;
index d4c7fd877dc7b016a90e8ce29694ec0309b72c81..642e3b0f8d71f27908282dc82450d65ffeceec58 100644 (file)
@@ -2471,14 +2471,12 @@ send_packet_in_miss(struct ofproto_dpif *ofproto, const struct ofpbuf *packet,
 
     pin.packet = packet->data;
     pin.packet_len = packet->size;
-    pin.total_len = packet->size;
     pin.reason = OFPR_NO_MATCH;
     pin.controller_id = 0;
 
     pin.table_id = 0;
     pin.cookie = 0;
 
-    pin.buffer_id = 0;          /* not yet known */
     pin.send_len = 0;           /* not used for flow table misses */
 
     flow_get_metadata(flow, &pin.fmd);
@@ -4535,9 +4533,7 @@ execute_controller_action(struct action_xlate_ctx *ctx, int len,
     pin.table_id = ctx->table_id;
     pin.cookie = ctx->rule ? ctx->rule->up.flow_cookie : 0;
 
-    pin.buffer_id = 0;
     pin.send_len = len;
-    pin.total_len = packet->size;
     flow_get_metadata(&ctx->flow, &pin.fmd);
 
     connmgr_send_packet_in(ctx->ofproto->up.connmgr, &pin);