connmgr: Drop 'flow' parameter from connmgr_send_packet_in().
[sliver-openvswitch.git] / ofproto / connmgr.c
index b01a471..4343622 100644 (file)
@@ -1230,27 +1230,26 @@ ofconn_send(const struct ofconn *ofconn, struct ofpbuf *msg,
 \f
 /* 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'. */
 void
-connmgr_send_port_status(struct connmgr *mgr, const struct ofp_phy_port *opp,
-                         uint8_t reason)
+connmgr_send_port_status(struct connmgr *mgr,
+                         const struct ofputil_phy_port *pp, uint8_t reason)
 {
     /* XXX Should limit the number of queued port status change messages. */
+    struct ofputil_port_status ps;
     struct ofconn *ofconn;
 
+    ps.reason = reason;
+    ps.desc = *pp;
     LIST_FOR_EACH (ofconn, node, &mgr->all_conns) {
         if (ofconn_receives_async_msg(ofconn, OAM_PORT_STATUS, reason)) {
-            struct ofp_port_status *ops;
-            struct ofpbuf *b;
+            struct ofpbuf *msg;
 
-            ops = make_openflow_xid(sizeof *ops, OFPT_PORT_STATUS, 0, &b);
-            ops->reason = reason;
-            ops->desc = *opp;
-            ofconn_send(ofconn, b, NULL);
+            msg = ofputil_encode_port_status(&ps, ofconn->protocol);
+            ofconn_send(ofconn, msg, NULL);
         }
     }
 }
@@ -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);
 }
@@ -1560,7 +1556,7 @@ connmgr_flushed(struct connmgr *mgr)
         struct cls_rule rule;
 
         memset(&action, 0, sizeof action);
-        action.type = htons(OFPAT_OUTPUT);
+        action.type = htons(OFPAT10_OUTPUT);
         action.output.len = htons(sizeof action);
         action.output.port = htons(OFPP_NORMAL);
         cls_rule_init_catchall(&rule, 0);