From patchwork Mon May 18 06:56:29 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarek Poplawski X-Patchwork-Id: 27335 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 13DB3B7066 for ; Mon, 18 May 2009 16:56:49 +1000 (EST) Received: by ozlabs.org (Postfix) id F3F91DE046; Mon, 18 May 2009 16:56:48 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 61EBADE03B for ; Mon, 18 May 2009 16:56:48 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755324AbZERG4k (ORCPT ); Mon, 18 May 2009 02:56:40 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754970AbZERG4k (ORCPT ); Mon, 18 May 2009 02:56:40 -0400 Received: from yw-out-2324.google.com ([74.125.46.29]:58409 "EHLO yw-out-2324.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754044AbZERG4j (ORCPT ); Mon, 18 May 2009 02:56:39 -0400 Received: by yw-out-2324.google.com with SMTP id 5so1871078ywb.1 for ; Sun, 17 May 2009 23:56:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition :in-reply-to:x-mutt-fcc:user-agent; bh=5ZghCjLiF8szAfEmWL6PODZjJhBFcz9M7cGWkXbSzbU=; b=J1aNONMA04Uxq9hISXZCFVwyUOcDAoYCS/FD6I7JCgRyXXgYGS0lH6KOhCP21AR80f blSDE8rjg9rU1iSi8NCQv3uxw2+OEoOWhO8PjFCCM1Bza3j25B3oE7Fa3hjRo1/+l6xP SMMW86G/Z275u+bnJ50qOFMYZ9DKFaaq7JMSo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:in-reply-to:x-mutt-fcc:user-agent; b=RCZucQXETnHxWCzVHmiDFAzEWokHmIR+M7uQ93MsQCt5OCRhNVdnWzUAVa9xj3z5iK lUx5Un/gZCXbLENkfc2aVAfvc7HMmryrWoLP/RU1V8o7p04TEHtEqwpn9qSAg/+YaTEO BbsKqwoJSMG1FscNlNHcmw3nq0bew2Q88w1Uk= Received: by 10.100.126.15 with SMTP id y15mr8105637anc.71.1242629797986; Sun, 17 May 2009 23:56:37 -0700 (PDT) Received: from ff.dom.local (bv170.internetdsl.tpnet.pl [80.53.205.170]) by mx.google.com with ESMTPS id 34sm12891584yxl.15.2009.05.17.23.56.34 (version=SSLv3 cipher=RC4-MD5); Sun, 17 May 2009 23:56:36 -0700 (PDT) Date: Mon, 18 May 2009 06:56:29 +0000 From: Jarek Poplawski To: Stephen Hemminger Cc: Antonio Almeida , netdev@vger.kernel.org, kaber@trash.net, davem@davemloft.net, devik@cdi.cz Subject: [PATCH iproute2] Re: HTB accuracy for high speed Message-ID: <20090518065629.GA6006@ff.dom.local> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20090517201528.GA8552@ami.dom.local> X-Mutt-Fcc: =outbox User-Agent: Mutt/1.5.18 (2008-05-17) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Return non-zero tc_calc_xmittime() for rate tables While looking at the problem of HTB accuracy for high speed (~500Mbit rates) I've found that rate tables have cells filled with zeros for the smallest sizes. It means such packets aren't accounted at all. Apart from the correctness of such configs, let's make it safe with rather overaccounting than living it unlimited. Reported-by: Antonio Almeida Signed-off-by: Jarek Poplawski --- tc/tc_core.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/tc/tc_core.c b/tc/tc_core.c index 9a0ff39..14f25bc 100644 --- a/tc/tc_core.c +++ b/tc/tc_core.c @@ -58,7 +58,9 @@ unsigned tc_core_ktime2time(unsigned ktime) unsigned tc_calc_xmittime(unsigned rate, unsigned size) { - return tc_core_time2tick(TIME_UNITS_PER_SEC*((double)size/rate)); + unsigned t; + t = tc_core_time2tick(TIME_UNITS_PER_SEC*((double)size/rate)); + return t ? : 1; } unsigned tc_calc_xmitsize(unsigned rate, unsigned ticks)