Instead of relying on feature bits, use the speed value directly as
maximum rate for htb and hfsc classes.

There is still a limitation with the maximum rate that we can express
with a 32-bit number in bytes/s (~ 34.3Gbps), but using the actual link speed
instead of the feature bits, we can at least use an accurate maximum for
some link speeds (such as 25Gbps) which are not supported by netdev's feature
bits.

Signed-off-by: Adrian Moreno <[email protected]>
---
 lib/netdev-linux.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 576adbf3f..6d5cf8114 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -4744,11 +4744,10 @@ htb_parse_qdisc_details__(struct netdev *netdev_,
 
     hc->max_rate = smap_get_ullong(details, "max-rate", 0) / 8;
     if (!hc->max_rate) {
-        enum netdev_features current;
-
         netdev_linux_read_features(netdev);
-        current = !netdev->get_features_error ? netdev->current : 0;
-        hc->max_rate = netdev_features_to_bps(current, NETDEV_DEFAULT_BPS) / 8;
+        hc->max_rate = !netdev->get_features_error
+            ? (uint64_t) netdev->speed / 8 * 1000000
+            : NETDEV_DEFAULT_BPS / 8;
     }
     hc->min_rate = hc->max_rate;
     hc->burst = 0;
@@ -5216,11 +5215,10 @@ hfsc_parse_qdisc_details__(struct netdev *netdev_, 
const struct smap *details,
 
     uint32_t max_rate = smap_get_ullong(details, "max-rate", 0) / 8;
     if (!max_rate) {
-        enum netdev_features current;
-
         netdev_linux_read_features(netdev);
-        current = !netdev->get_features_error ? netdev->current : 0;
-        max_rate = netdev_features_to_bps(current, NETDEV_DEFAULT_BPS) / 8;
+        max_rate = !netdev->get_features_error
+            ? (uint64_t) netdev->speed / 8 * 1000000
+            : NETDEV_DEFAULT_BPS / 8;
     }
 
     class->min_rate = max_rate;
-- 
2.39.2

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to