From patchwork Mon May 12 04:18:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yingliang X-Patchwork-Id: 347885 X-Patchwork-Delegate: shemminger@vyatta.com 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 901B7140087 for ; Mon, 12 May 2014 14:18:56 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751725AbaELESu (ORCPT ); Mon, 12 May 2014 00:18:50 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:60320 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751677AbaELESt (ORCPT ); Mon, 12 May 2014 00:18:49 -0400 Received: from 172.24.2.119 (EHLO szxeml205-edg.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id AON76558; Mon, 12 May 2014 12:18:43 +0800 (CST) Received: from SZXEML452-HUB.china.huawei.com (10.82.67.195) by szxeml205-edg.china.huawei.com (172.24.2.58) with Microsoft SMTP Server (TLS) id 14.3.158.1; Mon, 12 May 2014 12:18:42 +0800 Received: from localhost (10.177.18.231) by szxeml452-hub.china.huawei.com (10.82.67.195) with Microsoft SMTP Server id 14.3.158.1; Mon, 12 May 2014 12:18:39 +0800 From: Yang Yingliang To: CC: , Subject: [PATCH iproute2] fq: don't allow set options to zero Date: Mon, 12 May 2014 12:18:39 +0800 Message-ID: <1399868319-2184-1-git-send-email-yangyingliang@huawei.com> X-Mailer: git-send-email 1.8.1.msysgit.1 MIME-Version: 1.0 X-Originating-IP: [10.177.18.231] X-CFilter-Loop: Reflected Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Now options of fair queue can be zero but cannot be (~0U). Zero is useless, so don't allow set the options to zero. Also, maxrate cannot be reset to unlimited because it cannot be (~0U). Cc: Eric Dumazet Signed-off-by: Yang Yingliang --- tc/q_fq.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tc/q_fq.c b/tc/q_fq.c index c1f658e..c529842 100644 --- a/tc/q_fq.c +++ b/tc/q_fq.c @@ -71,13 +71,13 @@ static unsigned int ilog2(unsigned int val) static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) { - unsigned int plimit = ~0U; - unsigned int flow_plimit = ~0U; - unsigned int quantum = ~0U; - unsigned int initial_quantum = ~0U; + unsigned int plimit = 0; + unsigned int flow_plimit = 0; + unsigned int quantum = 0; + unsigned int initial_quantum = 0; unsigned int buckets = 0; - unsigned int maxrate = ~0U; - unsigned int defrate = ~0U; + unsigned int maxrate = 0; + unsigned int defrate = 0; int pacing = -1; struct rtattr *tail; @@ -147,24 +147,24 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv, addattr_l(n, 1024, TCA_FQ_BUCKETS_LOG, &log, sizeof(log)); } - if (plimit != ~0U) + if (plimit) addattr_l(n, 1024, TCA_FQ_PLIMIT, &plimit, sizeof(plimit)); - if (flow_plimit != ~0U) + if (flow_plimit) addattr_l(n, 1024, TCA_FQ_FLOW_PLIMIT, &flow_plimit, sizeof(flow_plimit)); - if (quantum != ~0U) + if (quantum) addattr_l(n, 1024, TCA_FQ_QUANTUM, &quantum, sizeof(quantum)); - if (initial_quantum != ~0U) + if (initial_quantum) addattr_l(n, 1024, TCA_FQ_INITIAL_QUANTUM, &initial_quantum, sizeof(initial_quantum)); if (pacing != -1) addattr_l(n, 1024, TCA_FQ_RATE_ENABLE, &pacing, sizeof(pacing)); - if (maxrate != ~0U) + if (maxrate) addattr_l(n, 1024, TCA_FQ_FLOW_MAX_RATE, &maxrate, sizeof(maxrate)); - if (defrate != ~0U) + if (defrate) addattr_l(n, 1024, TCA_FQ_FLOW_DEFAULT_RATE, &defrate, sizeof(defrate)); tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;