From 5a2dfd473a65a041356971771c99e4a9d04b3f9c Mon Sep 17 00:00:00 2001 From: Justin Pettit Date: Fri, 14 Oct 2011 15:45:14 -0700 Subject: [PATCH] ofproto: Add function to set OpenFlow state and update controller. This will be used in an upcoming commit. --- ofproto/ofproto-provider.h | 2 ++ ofproto/ofproto.c | 11 +++++++++++ 2 files changed, 13 insertions(+) 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) { -- 2.30.2