ofproto: Remove dummy 'in_port' variable.
authorBen Pfaff <blp@nicira.com>
Thu, 8 Sep 2011 18:21:45 +0000 (11:21 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 15 Sep 2011 18:10:36 +0000 (11:10 -0700)
Seems like a very small cleanup.

ofproto/ofproto.c
ofproto/pktbuf.c

index 979335543ed793983d43c20b71fa85ce9bb289d4..7748ef1b8278144f22385fedbdff74b355d3ee36 100644 (file)
@@ -1590,7 +1590,6 @@ handle_packet_out(struct ofconn *ofconn, const struct ofp_header *oh)
     struct ofpbuf request;
     struct flow flow;
     size_t n_ofp_actions;
-    uint16_t in_port;
     int error;
 
     COVERAGE_INC(ofproto_packet_out);
@@ -1614,7 +1613,7 @@ handle_packet_out(struct ofconn *ofconn, const struct ofp_header *oh)
     /* Get payload. */
     if (opo->buffer_id != htonl(UINT32_MAX)) {
         error = ofconn_pktbuf_retrieve(ofconn, ntohl(opo->buffer_id),
-                                       &buffer, &in_port);
+                                       &buffer, NULL);
         if (error || !buffer) {
             return error;
         }
index 02c590cf61375861a5d49481db87fac515eb3d9d..fc4c66ca102e48e2dad99c71ac32d83ac4665a09 100644 (file)
@@ -161,6 +161,8 @@ pktbuf_get_null(void)
  * identifies a "null" packet buffer (created with pktbuf_get_null()), stores
  * NULL in '*bufferp' and UINT16_max in '*in_port'.
  *
+ * 'in_port' may be NULL if the input port is not of interest.
+ *
  * A returned packet will have at least sizeof(struct ofp_packet_in) bytes of
  * headroom.
  *
@@ -189,7 +191,9 @@ pktbuf_retrieve(struct pktbuf *pb, uint32_t id, struct ofpbuf **bufferp,
         struct ofpbuf *buffer = p->buffer;
         if (buffer) {
             *bufferp = buffer;
-            *in_port = p->in_port;
+            if (in_port) {
+                *in_port = p->in_port;
+            }
             p->buffer = NULL;
             COVERAGE_INC(pktbuf_retrieved);
             return 0;
@@ -211,7 +215,9 @@ pktbuf_retrieve(struct pktbuf *pb, uint32_t id, struct ofpbuf **bufferp,
     }
 error:
     *bufferp = NULL;
-    *in_port = UINT16_MAX;
+    if (in_port) {
+        *in_port = UINT16_MAX;
+    }
     return error;
 }