From patchwork Thu Nov 14 09:01:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yingliang X-Patchwork-Id: 291148 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 291672C009D for ; Thu, 14 Nov 2013 20:02:39 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752851Ab3KNJCe (ORCPT ); Thu, 14 Nov 2013 04:02:34 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:27542 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752801Ab3KNJC2 (ORCPT ); Thu, 14 Nov 2013 04:02:28 -0500 Received: from 172.24.2.119 (EHLO szxeml210-edg.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BLF86784; Thu, 14 Nov 2013 17:02:25 +0800 (CST) Received: from SZXEML454-HUB.china.huawei.com (10.82.67.197) by szxeml210-edg.china.huawei.com (172.24.2.183) with Microsoft SMTP Server (TLS) id 14.3.158.1; Thu, 14 Nov 2013 17:01:56 +0800 Received: from localhost (10.135.68.218) by SZXEML454-HUB.china.huawei.com (10.82.67.197) with Microsoft SMTP Server id 14.3.158.1; Thu, 14 Nov 2013 17:01:57 +0800 From: Yang Yingliang To: , CC: Subject: [PATCH 2/3] net: sched: htb: fix condition of failure when rate is 0 Date: Thu, 14 Nov 2013 17:01:53 +0800 Message-ID: <1384419714-24364-3-git-send-email-yangyingliang@huawei.com> X-Mailer: git-send-email 1.8.1.msysgit.1 In-Reply-To: <1384419714-24364-1-git-send-email-yangyingliang@huawei.com> References: <1384419714-24364-1-git-send-email-yangyingliang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.135.68.218] X-CFilter-Loop: Reflected Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When rate32 is 0, it doesn't means wrong. Because htb support 64bit rates now, it could use rate64. So change the condition, when rate32 and rate64 are both 0, it goes to failure. Signed-off-by: Yang Yingliang --- net/sched/sch_htb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 0e1e38b..f983803 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c @@ -1357,7 +1357,8 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, parent = parentid == TC_H_ROOT ? NULL : htb_find(parentid, sch); hopt = nla_data(tb[TCA_HTB_PARMS]); - if (!hopt->rate.rate || !hopt->ceil.rate) + if ((!hopt->rate.rate && !tb[TCA_HTB_RATE64]) || + (!hopt->ceil.rate && !tb[TCA_HTB_CEIL64])) goto failure; /* Keeping backward compatible with rate_table based iproute2 tc */