[ovs-dev] [PATCH] ofproto: Convert units correctly in ofport_open().

Ben Pfaff blp at nicira.com
Fri Aug 30 17:10:44 UTC 2013


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 <benjamin.lunsky at netronome.com>
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 ofproto/ofproto.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 0b054e7..0caaad9 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -1838,8 +1838,8 @@ ofport_open(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, 0);
-    pp->max_speed = netdev_features_to_bps(pp->supported, 0);
+    pp->curr_speed = netdev_features_to_bps(pp->curr, 0) / 1000;
+    pp->max_speed = netdev_features_to_bps(pp->supported, 0) / 1000;
 
     return netdev;
 }
-- 
1.7.10.4




More information about the dev mailing list