{"id":833189,"url":"http://patchwork.ozlabs.org/api/1.2/patches/833189/?format=json","web_url":"http://patchwork.ozlabs.org/project/openvswitch/patch/1509592022-5320-1-git-send-email-fukaige@huawei.com/","project":{"id":47,"url":"http://patchwork.ozlabs.org/api/1.2/projects/47/?format=json","name":"Open vSwitch","link_name":"openvswitch","list_id":"ovs-dev.openvswitch.org","list_email":"ovs-dev@openvswitch.org","web_url":"http://openvswitch.org/","scm_url":"git@github.com:openvswitch/ovs.git","webscm_url":"https://github.com/openvswitch/ovs","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1509592022-5320-1-git-send-email-fukaige@huawei.com>","list_archive_url":null,"date":"2017-11-02T03:07:02","name":"[ovs-dev] netdev-linux: Fix wrong ceil rate when max-rate less than 8bit.","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"926a264cf554816105468a519cc4894dc6d90bde","submitter":{"id":71712,"url":"http://patchwork.ozlabs.org/api/1.2/people/71712/?format=json","name":"fukaige","email":"fukaige@huawei.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/openvswitch/patch/1509592022-5320-1-git-send-email-fukaige@huawei.com/mbox/","series":[{"id":11429,"url":"http://patchwork.ozlabs.org/api/1.2/series/11429/?format=json","web_url":"http://patchwork.ozlabs.org/project/openvswitch/list/?series=11429","date":"2017-11-02T03:07:02","name":"[ovs-dev] netdev-linux: Fix wrong ceil rate when max-rate less than 8bit.","version":1,"mbox":"http://patchwork.ozlabs.org/series/11429/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/833189/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/833189/checks/","tags":{},"related":[],"headers":{"Return-Path":"<ovs-dev-bounces@openvswitch.org>","X-Original-To":["incoming@patchwork.ozlabs.org","dev@openvswitch.org"],"Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","ovs-dev@mail.linuxfoundation.org"],"Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=openvswitch.org\n\t(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;\n\tenvelope-from=ovs-dev-bounces@openvswitch.org;\n\treceiver=<UNKNOWN>)","Received":["from mail.linuxfoundation.org (mail.linuxfoundation.org\n\t[140.211.169.12])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yS98Z55Nhz9sNc\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  2 Nov 2017 14:11:10 +1100 (AEDT)","from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id 74480BC7;\n\tThu,  2 Nov 2017 03:11:07 +0000 (UTC)","from smtp1.linuxfoundation.org (smtp1.linux-foundation.org\n\t[172.17.192.35])\n\tby mail.linuxfoundation.org (Postfix) with ESMTPS id 654739B9\n\tfor <dev@openvswitch.org>; Thu,  2 Nov 2017 03:11:06 +0000 (UTC)","from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190])\n\tby smtp1.linuxfoundation.org (Postfix) with ESMTPS id CCDD41DF\n\tfor <dev@openvswitch.org>; Thu,  2 Nov 2017 03:11:04 +0000 (UTC)","from 172.30.72.58 (EHLO DGGEMS402-HUB.china.huawei.com)\n\t([172.30.72.58])\n\tby dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued)\n\twith ESMTP id DKD56243; Thu, 02 Nov 2017 11:10:56 +0800 (CST)","from localhost (10.177.245.74) by DGGEMS402-HUB.china.huawei.com\n\t(10.3.19.202) with Microsoft SMTP Server id 14.3.361.1;\n\tThu, 2 Nov 2017 11:10:05 +0800"],"X-Greylist":"domain auto-whitelisted by SQLgrey-1.7.6","From":"fukaige <fukaige@huawei.com>","To":"<dev@openvswitch.org>","Date":"Thu, 2 Nov 2017 11:07:02 +0800","Message-ID":"<1509592022-5320-1-git-send-email-fukaige@huawei.com>","X-Mailer":"git-send-email 1.9.0.msysgit.0","MIME-Version":"1.0","X-Originating-IP":"[10.177.245.74]","X-CFilter-Loop":"Reflected","X-Mirapoint-Virus-RAPID-Raw":"score=unknown(0),\n\trefid=str=0001.0A0B0208.59FA8CC1.0092, ss=1, re=0.000, recu=0.000,\n\treip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0,\n\tso=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32","X-Mirapoint-Loop-Id":"58264bffc6c18e78f79d5db8e0e12018","X-Spam-Status":"No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,\n\tRP_MATCHES_RCVD autolearn=disabled version=3.3.1","X-Spam-Checker-Version":"SpamAssassin 3.3.1 (2010-03-16) on\n\tsmtp1.linux-foundation.org","Subject":"[ovs-dev] [PATCH] netdev-linux: Fix wrong ceil rate when max-rate\n\tless than 8bit.","X-BeenThere":"ovs-dev@openvswitch.org","X-Mailman-Version":"2.1.12","Precedence":"list","List-Id":"<ovs-dev.openvswitch.org>","List-Unsubscribe":"<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>","List-Archive":"<http://mail.openvswitch.org/pipermail/ovs-dev/>","List-Post":"<mailto:ovs-dev@openvswitch.org>","List-Help":"<mailto:ovs-dev-request@openvswitch.org?subject=help>","List-Subscribe":"<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"ovs-dev-bounces@openvswitch.org","Errors-To":"ovs-dev-bounces@openvswitch.org"},"content":"From: Kaige Fu <fukaige@huawei.com>\n\nWhen max-rate is less than 8bit, the hc->max_rate will be set\nas htb->max_rate mistakenly instead of mtu of netdev.\n\nFixes: 13c1637 (\"smap: New function smap_get_ullong().\")\n\nSigned-off-by: Kaige Fu <fukaige@huawei.com>\n---\n lib/netdev-linux.c | 9 +++++----\n 1 file changed, 5 insertions(+), 4 deletions(-)","diff":"diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c\nindex 2ff3e2b..66ca5fe 100644\n--- a/lib/netdev-linux.c\n+++ b/lib/netdev-linux.c\n@@ -3762,6 +3762,7 @@ htb_parse_class_details__(struct netdev *netdev,\n {\n     const struct htb *htb = htb_get__(netdev);\n     int mtu, error;\n+    unsigned long long int max_rate_bit;\n \n     error = netdev_linux_get_mtu__(netdev_linux_cast(netdev), &mtu);\n     if (error) {\n@@ -3777,10 +3778,10 @@ htb_parse_class_details__(struct netdev *netdev,\n     hc->min_rate = MIN(hc->min_rate, htb->max_rate);\n \n     /* max-rate */\n-    hc->max_rate = smap_get_ullong(details, \"max-rate\", 0) / 8;\n-    if (!hc->max_rate) {\n-        hc->max_rate = htb->max_rate;\n-    }\n+    max_rate_bit = smap_get_ullong(details, \"max-rate\", 0);\n+    hc->max_rate = (max_rate_bit\n+                    ? max_rate_bit / 8\n+                    : htb->max_rate); \n     hc->max_rate = MAX(hc->max_rate, hc->min_rate);\n     hc->max_rate = MIN(hc->max_rate, htb->max_rate);\n \n","prefixes":["ovs-dev"]}