ofproto: Add function to set OpenFlow state and update controller.
authorJustin Pettit <jpettit@nicira.com>
Fri, 14 Oct 2011 22:45:14 +0000 (15:45 -0700)
committerJustin Pettit <jpettit@nicira.com>
Sat, 22 Oct 2011 23:16:08 +0000 (16:16 -0700)
This will be used in an upcoming commit.

ofproto/ofproto-provider.h
ofproto/ofproto.c

index 4abe92a..7f1b110 100644 (file)
@@ -96,6 +96,8 @@ struct ofport {
     int mtu;
 };
 
+void ofproto_port_set_state(struct ofport *, ovs_be32 state);
+
 /* An OpenFlow flow within a "struct ofproto".
  *
  * With few exceptions, ofproto implementations may look at these fields but
index 988e33d..f692380 100644 (file)
@@ -1278,6 +1278,17 @@ ofport_modified(struct ofport *port, struct ofp_phy_port *opp)
     connmgr_send_port_status(port->ofproto->connmgr, &port->opp, OFPPR_MODIFY);
 }
 
+/* Update OpenFlow 'state' in 'port' and notify controller. */
+void
+ofproto_port_set_state(struct ofport *port, ovs_be32 state)
+{
+    if (port->opp.state != state) {
+        port->opp.state = state;
+        connmgr_send_port_status(port->ofproto->connmgr, &port->opp,
+                                 OFPPR_MODIFY);
+    }
+}
+
 void
 ofproto_port_unregister(struct ofproto *ofproto, uint16_t ofp_port)
 {