From b53d1713ad7ce865c47e3fb8421f27c6a0dcbb9c Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 4 Sep 2013 13:37:56 -0700 Subject: [PATCH] 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 --- ofproto/ofproto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; } -- 2.20.1