From: Justin Pettit Date: Fri, 14 Oct 2011 22:45:14 +0000 (-0700) Subject: ofproto: Add function to set OpenFlow state and update controller. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a2dfd473a65a041356971771c99e4a9d04b3f9c;p=openvswitch ofproto: Add function to set OpenFlow state and update controller. This will be used in an upcoming commit. --- diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h index 4abe92a1..7f1b110f 100644 --- a/ofproto/ofproto-provider.h +++ b/ofproto/ofproto-provider.h @@ -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 diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 988e33d2..f6923805 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -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) {