On Fri, May 19, 2017 at 12:20:43AM -0700, nickcooper-zhangtonghao wrote: > When bridge stp enabled, we can enable the stp ports > despite ports are down. When initializing, this patch checks > link-state of ports and enable or disable them according > to their link-state. This patch also allow user to enable > and disable a port when bridge stp is running. If a stp > port is in disable state, it can forward packets. If its > link is down and this patch sets it to disable, there is > no L2 loop. > > Signed-off-by: nickcooper-zhangtonghao <n...@opencloud.tech>
This seems reasonable. Thank you! I applied it to master, folding in the following changes. --8<--------------------------cut here-------------------------->8-- diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 2dd7c2a1d287..6ad9551f90b3 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -2580,19 +2580,16 @@ update_stp_port_state(struct ofport_dpif *ofport) static void stp_check_and_update_link_state(struct ofproto_dpif *ofproto) { - struct ofport *ofport_; struct ofport_dpif *ofport; - bool up; - HMAP_FOR_EACH (ofport_, hmap_node, &ofproto->up.ports) { - ofport = ofport_dpif_cast(ofport_); - up = netdev_get_carrier(ofport_->netdev); + HMAP_FOR_EACH (ofport, up.hmap_node, &ofproto->up.ports) { + bool up = netdev_get_carrier(ofport->up.netdev); if (ofport->stp_port && up != (stp_port_get_state(ofport->stp_port) != STP_DISABLED)) { - VLOG_DBG("bridge: %s, port: %s is %s, %s it", ofproto->up.name, - netdev_get_name(ofport->up.netdev), + VLOG_DBG("bridge %s, port %s is %s, %s it.", + ofproto->up.name, netdev_get_name(ofport->up.netdev), up ? "up" : "down", up ? "enabling" : "disabling"); _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev