From patchwork Mon May 18 07:01:34 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarek Poplawski X-Patchwork-Id: 27339 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 D0AB0B7066 for ; Mon, 18 May 2009 17:02:55 +1000 (EST) Received: by ozlabs.org (Postfix) id 584D7DE2D1; Mon, 18 May 2009 17:01: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 B6DD3DE0A2 for ; Mon, 18 May 2009 17:01:47 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755833AbZERHBk (ORCPT ); Mon, 18 May 2009 03:01:40 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755823AbZERHBj (ORCPT ); Mon, 18 May 2009 03:01:39 -0400 Received: from fg-out-1718.google.com ([72.14.220.152]:28093 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755616AbZERHBj (ORCPT ); Mon, 18 May 2009 03:01:39 -0400 Received: by fg-out-1718.google.com with SMTP id d23so549004fga.17 for ; Mon, 18 May 2009 00:01: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=retfcI03G7GNsdOXi2R+oN5VEJhnG2nXX2z5FqHRu3s=; b=bGMd8gcXbef3ylvjSSiIzS5tzQ7zQwBTJP5TfouWzNrVnKsMttMfi0U50SMb6EHMVO yFt2hio/fq4AFFcDa/zce1a8x5cC8uVgDlojm84O3W7dVR072WmNftx/TkCRuyZzcBEv dKiJFmKDCaNQmcTfT5U5kY4AFyzRh5FsaXgeI= 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=HyeNNCbArqROwiw5iqJr0VwMhI3WAkQQIqW1OftcquJCM8ARYvHsy5i/asU/4MRm9B HxfADGYvKUeem5ZyBTbd3upSbjXeQa5MAGm+qITNR4IhBeVjrQEkRISEEpQK/WN6CowC GVnp4tIWyoDnIjBnlbjv9N+rlj5H6Hn65Iph8= Received: by 10.86.86.2 with SMTP id j2mr6401385fgb.74.1242630098348; Mon, 18 May 2009 00:01:38 -0700 (PDT) Received: from ff.dom.local (bv170.internetdsl.tpnet.pl [80.53.205.170]) by mx.google.com with ESMTPS id 3sm836552fge.16.2009.05.18.00.01.37 (version=SSLv3 cipher=RC4-MD5); Mon, 18 May 2009 00:01:37 -0700 (PDT) Date: Mon, 18 May 2009 07:01:34 +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 v2] Re: HTB accuracy for high speed Message-ID: <20090518070134.GB6006@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 -----------> (One misspelling fixed.) 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 leaving 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)