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 4abe92a137642ba66219faa26b6d2804cb19a959..7f1b110fad1f924dd9c2fdccc97d3e807bc59882 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 988e33d23da1a92c12a6bc408c1ffcc06c206619..f6923805ad1996fc5bab03f10bd1046e6c027bdc 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)
 {