From: Ben Pfaff Date: Wed, 4 Sep 2013 20:37:56 +0000 (-0700) Subject: ofproto: Convert units correctly in ofport_open(). X-Git-Tag: v1.9.3~1 X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=b53d1713ad7ce865c47e3fb8421f27c6a0dcbb9c ofproto: Convert units correctly in ofport_open(). netdev_features_to_bps() returns a speed in bps, but struct ofputil_phy_port's curr_speed and max_speed are in kbps, so a conversion is necessary. This commit fixes the problem. Reported-by: Benjamin Lunsky Tested-by: Benjamin Lunsky Signed-off-by: Ben Pfaff --- diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 203d58202..69fef329d 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -1549,8 +1549,8 @@ ofport_open(const struct ofproto *ofproto, pp->state = netdev_get_carrier(netdev) ? 0 : OFPUTIL_PS_LINK_DOWN; netdev_get_features(netdev, &pp->curr, &pp->advertised, &pp->supported, &pp->peer); - pp->curr_speed = netdev_features_to_bps(pp->curr); - pp->max_speed = netdev_features_to_bps(pp->supported); + pp->curr_speed = netdev_features_to_bps(pp->curr) / 1000; + pp->max_speed = netdev_features_to_bps(pp->supported) / 1000; return netdev; }