summaryrefslogtreecommitdiff
path: root/ofproto/ofproto.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2018-08-22 14:59:24 -0700
committerBen Pfaff <blp@ovn.org>2018-10-18 08:15:15 -0700
commit042b8f42c6d20347916c70a058615d8b7470a319 (patch)
tree8a723fddb0953ddb67c189faa84d2c16432d8a03 /ofproto/ofproto.c
parent229486c2dfa9341cbdd4bb8be4f630429717ecb7 (diff)
downloadopenvswitch-042b8f42c6d20347916c70a058615d8b7470a319.tar.gz
connmgr: Suppress duplicate port status notifications.
When the status of a port changes, ofproto calls into connmgr to notify controllers. Sometimes, particular changes are only visible to controllers running specific versions of OpenFlow. Until now, OVS would send those controllers duplicate port status notifications. This is unnecessary and somewhat confusing. This commit eliminates it. This commit updates one of the tests not to expect duplicate notifications. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Numan Siddique <nusididq@redhat.com>
Diffstat (limited to 'ofproto/ofproto.c')
-rw-r--r--ofproto/ofproto.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 0f8d74747..fdd917e62 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -2417,7 +2417,7 @@ ofport_install(struct ofproto *p,
if (error) {
goto error;
}
- connmgr_send_port_status(p->connmgr, NULL, pp, OFPPR_ADD);
+ connmgr_send_port_status(p->connmgr, NULL, NULL, pp, OFPPR_ADD);
return 0;
error:
@@ -2438,7 +2438,7 @@ ofport_remove(struct ofport *ofport)
struct ofproto *p = ofport->ofproto;
bool is_mtu_overridden = ofport_is_mtu_overridden(p, ofport);
- connmgr_send_port_status(ofport->ofproto->connmgr, NULL, &ofport->pp,
+ connmgr_send_port_status(ofport->ofproto->connmgr, NULL, NULL, &ofport->pp,
OFPPR_DELETE);
ofport_destroy(ofport, true);
if (!is_mtu_overridden) {
@@ -2483,8 +2483,9 @@ void
ofproto_port_set_state(struct ofport *port, enum ofputil_port_state state)
{
if (port->pp.state != state) {
+ struct ofputil_phy_port old_pp = port->pp;
port->pp.state = state;
- connmgr_send_port_status(port->ofproto->connmgr, NULL,
+ connmgr_send_port_status(port->ofproto->connmgr, NULL, &old_pp,
&port->pp, OFPPR_MODIFY);
}
}
@@ -2630,6 +2631,7 @@ update_port(struct ofproto *ofproto, const char *name)
port = ofproto_get_port(ofproto, ofproto_port.ofp_port);
if (port && !strcmp(netdev_get_name(port->netdev), name)) {
struct netdev *old_netdev = port->netdev;
+ struct ofputil_phy_port old_pp = port->pp;
/* 'name' hasn't changed location. Any properties changed? */
bool port_changed = !ofport_equal(&port->pp, &pp);
@@ -2652,7 +2654,7 @@ update_port(struct ofproto *ofproto, const char *name)
/* Send status update, if any port property changed */
if (port_changed) {
connmgr_send_port_status(port->ofproto->connmgr, NULL,
- &port->pp, OFPPR_MODIFY);
+ &old_pp, &port->pp, OFPPR_MODIFY);
}
netdev_close(old_netdev);
@@ -3648,11 +3650,11 @@ update_port_config(struct ofconn *ofconn, struct ofport *port,
}
if (toggle) {
- enum ofputil_port_config old_config = port->pp.config;
+ struct ofputil_phy_port old_pp = port->pp;
port->pp.config ^= toggle;
- port->ofproto->ofproto_class->port_reconfigured(port, old_config);
- connmgr_send_port_status(port->ofproto->connmgr, ofconn, &port->pp,
- OFPPR_MODIFY);
+ port->ofproto->ofproto_class->port_reconfigured(port, old_pp.config);
+ connmgr_send_port_status(port->ofproto->connmgr, ofconn, &old_pp,
+ &port->pp, OFPPR_MODIFY);
}
}