X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=vswitchd%2Fbridge.c;h=9fcc97098129b026a7a9f240c3872c490b69127f;hb=d02a5f8ea4e1da19ccc4f903026b77649472b236;hp=27d40a87519f252d3ac4f5525bf94195f9af77b8;hpb=8087f5ff825cae3a699e5a60ca6dd0deb10fc8e5;p=openvswitch diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 27d40a87..9fcc9709 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -996,16 +996,11 @@ port_configure_stp(const struct ofproto *ofproto, struct port *port, port_s->path_cost = strtoul(config_str, NULL, 10); } else { enum netdev_features current; + unsigned int mbps; - if (netdev_get_features(iface->netdev, ¤t, NULL, NULL, NULL)) { - /* Couldn't get speed, so assume 100Mb/s. */ - port_s->path_cost = 19; - } else { - unsigned int mbps; - - mbps = netdev_features_to_bps(current) / 1000000; - port_s->path_cost = stp_convert_speed_to_cost(mbps); - } + netdev_get_features(iface->netdev, ¤t, NULL, NULL, NULL); + mbps = netdev_features_to_bps(current, 100 * 1000 * 1000) / 1000000; + port_s->path_cost = stp_convert_speed_to_cost(mbps); } config_str = smap_get(&port->cfg->other_config, "stp-port-priority"); @@ -1701,12 +1696,11 @@ iface_refresh_status(struct iface *iface) smap_destroy(&smap); error = netdev_get_features(iface->netdev, ¤t, NULL, NULL, NULL); - if (!error) { + bps = !error ? netdev_features_to_bps(current, 0) : 0; + if (bps) { ovsrec_interface_set_duplex(iface->cfg, netdev_features_is_full_duplex(current) ? "full" : "half"); - /* warning: uint64_t -> int64_t conversion */ - bps = netdev_features_to_bps(current); ovsrec_interface_set_link_speed(iface->cfg, &bps, 1); } else {