diff options
author | Ben Pfaff <blp@nicira.com> | 2012-11-03 18:00:39 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2012-11-03 18:00:39 -0700 |
commit | d02a5f8ea4e1da19ccc4f903026b77649472b236 (patch) | |
tree | 103e396780d581af6e7f062400dfde59aa455ec6 /lib/netdev.c | |
parent | 8087f5ff825cae3a699e5a60ca6dd0deb10fc8e5 (diff) |
ofproto: Report 0 Mbps when speed not available instead of 100 Mbps.
When a link is down, or when a link has no speed because it is not a
physical interface, Open vSwitch previously reported that its rate is 100
Mbps as a default. This is counterintuitive, however, so this commit
changes Open vSwitch behavior to report 0 Mbps when a link is down or its
speed is otherwise unavailable.
Bug #13388.
Reported-by: Hiroshi Tanaka <htanaka@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/netdev.c')
-rw-r--r-- | lib/netdev.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/netdev.c b/lib/netdev.c index c135c6f2..1921ac0d 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -620,9 +620,10 @@ netdev_get_features(const struct netdev *netdev, /* Returns the maximum speed of a network connection that has the NETDEV_F_* * bits in 'features', in bits per second. If no bits that indicate a speed - * are set in 'features', assumes 100Mbps. */ + * are set in 'features', returns 'default_bps'. */ uint64_t -netdev_features_to_bps(enum netdev_features features) +netdev_features_to_bps(enum netdev_features features, + uint64_t default_bps) { enum { F_1000000MB = NETDEV_F_1TB_FD, @@ -641,7 +642,7 @@ netdev_features_to_bps(enum netdev_features features) : features & F_1000MB ? UINT64_C(1000000000) : features & F_100MB ? UINT64_C(100000000) : features & F_10MB ? UINT64_C(10000000) - : UINT64_C(100000000)); + : default_bps); } /* Returns true if any of the NETDEV_F_* bits that indicate a full-duplex link |