[ovs-dev] [packet-in 2/8] connmgr: Move controller_id from ofputil_packet_in to ofproto_packet_in.

Ben Pfaff blp at nicira.com
Wed Oct 23 05:05:14 UTC 2013


controller_id isn't part of the OpenFlow message, so it shouldn't be in
ofputil_packet_in.

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 lib/ofp-util.h                |    1 -
 ofproto/connmgr.c             |    2 +-
 ofproto/connmgr.h             |    1 +
 ofproto/ofproto-dpif-upcall.c |    2 +-
 ofproto/ofproto-dpif-xlate.c  |    2 +-
 5 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/ofp-util.h b/lib/ofp-util.h
index 2de6e769..9dff763 100644
--- a/lib/ofp-util.h
+++ b/lib/ofp-util.h
@@ -380,7 +380,6 @@ struct ofputil_packet_in {
     size_t packet_len;
 
     enum ofp_packet_in_reason reason;    /* One of OFPR_*. */
-    uint16_t controller_id;              /* Controller ID to send to. */
     uint8_t table_id;
     ovs_be64 cookie;
 
diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c
index 2c32525..bd6e934 100644
--- a/ofproto/connmgr.c
+++ b/ofproto/connmgr.c
@@ -1494,7 +1494,7 @@ connmgr_send_packet_in(struct connmgr *mgr,
 
     LIST_FOR_EACH (ofconn, node, &mgr->all_conns) {
         if (ofconn_receives_async_msg(ofconn, OAM_PACKET_IN, pin->up.reason)
-            && ofconn->controller_id == pin->up.controller_id) {
+            && ofconn->controller_id == pin->controller_id) {
             schedule_packet_in(ofconn, *pin);
         }
     }
diff --git a/ofproto/connmgr.h b/ofproto/connmgr.h
index 4846da9..6cbbf17 100644
--- a/ofproto/connmgr.h
+++ b/ofproto/connmgr.h
@@ -66,6 +66,7 @@ enum ofconn_async_msg_type {
 struct ofproto_packet_in {
     struct ofputil_packet_in up;
     struct list list_node;      /* For queuing. */
+    uint16_t controller_id;     /* Controller ID to send to. */
 };
 
 /* Basics. */
diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
index 41d8ee4..ec4fc5c 100644
--- a/ofproto/ofproto-dpif-upcall.c
+++ b/ofproto/ofproto-dpif-upcall.c
@@ -845,11 +845,11 @@ handle_upcalls(struct udpif *udpif, struct list *upcalls)
             pin->up.packet = xmemdup(packet->data, packet->size);
             pin->up.packet_len = packet->size;
             pin->up.reason = OFPR_NO_MATCH;
-            pin->up.controller_id = 0;
             pin->up.table_id = 0;
             pin->up.cookie = 0;
             pin->up.send_len = 0; /* Not used for flow table misses. */
             flow_get_metadata(&miss->flow, &pin->up.fmd);
+            pin->controller_id = 0;
             ofproto_dpif_send_packet_in(miss->ofproto, pin);
         }
     }
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index a7026ba..004a105 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -1847,13 +1847,13 @@ execute_controller_action(struct xlate_ctx *ctx, int len,
     pin->up.packet_len = packet->size;
     pin->up.packet = ofpbuf_steal_data(packet);
     pin->up.reason = reason;
-    pin->up.controller_id = controller_id;
     pin->up.table_id = ctx->table_id;
     pin->up.cookie = ctx->rule ? rule_dpif_get_flow_cookie(ctx->rule) : 0;
 
     pin->up.send_len = len;
     flow_get_metadata(&ctx->xin->flow, &pin->up.fmd);
 
+    pin->controller_id = controller_id;
     ofproto_dpif_send_packet_in(ctx->xbridge->ofproto, pin);
     ofpbuf_delete(packet);
 }
-- 
1.7.10.4




More information about the dev mailing list