From patchwork Sat May 15 00:38:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: stephen hemminger X-Patchwork-Id: 52694 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 6E23DB7E0C for ; Sat, 15 May 2010 10:39:16 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755365Ab0EOAjI (ORCPT ); Fri, 14 May 2010 20:39:08 -0400 Received: from mail.vyatta.com ([76.74.103.46]:40177 "EHLO mail.vyatta.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754222Ab0EOAjG (ORCPT ); Fri, 14 May 2010 20:39:06 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.vyatta.com (Postfix) with ESMTP id 85B1A182913A; Fri, 14 May 2010 17:38:30 -0700 (PDT) X-Virus-Scanned: amavisd-new at tahiti.vyatta.com Received: from mail.vyatta.com ([127.0.0.1]) by localhost (mail.vyatta.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PovizTc30Mwn; Fri, 14 May 2010 17:38:28 -0700 (PDT) Received: from nehalam (pool-74-107-135-205.ptldor.fios.verizon.net [74.107.135.205]) by mail.vyatta.com (Postfix) with ESMTP id 80E231829136; Fri, 14 May 2010 17:38:28 -0700 (PDT) Date: Fri, 14 May 2010 17:38:59 -0700 From: Stephen Hemminger To: Patrick McHardy Cc: David Miller , netdev@vger.kernel.org Subject: [PATCH] tbf: stop wanton destruction of children (v2) Message-ID: <20100514173859.30a85875@nehalam> In-Reply-To: <4BEC2936.2060800@trash.net> References: <20100513091717.78bd7f1f@nehalam> <4BEC2760.7080704@trash.net> <20100513092728.766ee059@nehalam> <4BEC2936.2060800@trash.net> Organization: Vyatta X-Mailer: Claws Mail 3.7.5 (GTK+ 2.20.0; x86_64-pc-linux-gnu) Mime-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Several netem users use TBF for rate control. But every time the parameters of TBF are changed it destroys the child qdisc, requiring reconfigation. Better to just keep child qdisc and just notify it of changed limit. Signed-off-by: Stephen Hemminger --- 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 --- a/net/sched/sch_tbf.c 2010-05-14 15:04:56.297095729 -0700 +++ b/net/sched/sch_tbf.c 2010-05-14 15:09:57.296733332 -0700 @@ -273,7 +273,11 @@ static int tbf_change(struct Qdisc* sch, if (max_size < 0) goto done; - if (qopt->limit > 0) { + if (q->qdisc != &noop_qdisc) { + err = fifo_set_limit(q->qdisc, qopt->limit); + if (err) + goto done; + } else if (qopt->limit > 0) { child = fifo_create_dflt(sch, &bfifo_qdisc_ops, qopt->limit); if (IS_ERR(child)) { err = PTR_ERR(child);