Re: [ovs-dev] [PATCH] netdev-linux: Fix wrong ceil rate when max-rate less than 8bit.

2017-11-02 Thread Ben Pfaff
On Thu, Nov 02, 2017 at 11:07:02AM +0800, fukaige wrote:
> From: Kaige Fu 
> 
> When max-rate is less than 8bit, the hc->max_rate will be set
> as htb->max_rate mistakenly instead of mtu of netdev.
> 
> Fixes: 13c1637 ("smap: New function smap_get_ullong().")
> 
> Signed-off-by: Kaige Fu 

Thanks, I applied this to master and backported as far as 2.6.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] netdev-linux: Fix wrong ceil rate when max-rate less than 8bit.

2017-11-01 Thread fukaige
From: Kaige Fu 

When max-rate is less than 8bit, the hc->max_rate will be set
as htb->max_rate mistakenly instead of mtu of netdev.

Fixes: 13c1637 ("smap: New function smap_get_ullong().")

Signed-off-by: Kaige Fu 
---
 lib/netdev-linux.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 2ff3e2b..66ca5fe 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -3762,6 +3762,7 @@ htb_parse_class_details__(struct netdev *netdev,
 {
 const struct htb *htb = htb_get__(netdev);
 int mtu, error;
+unsigned long long int max_rate_bit;
 
 error = netdev_linux_get_mtu__(netdev_linux_cast(netdev), );
 if (error) {
@@ -3777,10 +3778,10 @@ htb_parse_class_details__(struct netdev *netdev,
 hc->min_rate = MIN(hc->min_rate, htb->max_rate);
 
 /* max-rate */
-hc->max_rate = smap_get_ullong(details, "max-rate", 0) / 8;
-if (!hc->max_rate) {
-hc->max_rate = htb->max_rate;
-}
+max_rate_bit = smap_get_ullong(details, "max-rate", 0);
+hc->max_rate = (max_rate_bit
+? max_rate_bit / 8
+: htb->max_rate); 
 hc->max_rate = MAX(hc->max_rate, hc->min_rate);
 hc->max_rate = MIN(hc->max_rate, htb->max_rate);
 
-- 
1.8.3.1


___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev