From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jarek Poplawski Subject: Re: net_sched 07/07: add classful multiqueue dummy scheduler Date: Wed, 9 Sep 2009 21:52:38 +0200 Message-ID: <20090909195238.GA3043@ami.dom.local> References: <20090906200409.GB8833@ami.dom.local> <4AA50A49.7010905@trash.net> <20090907192429.GC4451@ami.dom.local> <4AA563B4.1060003@gmail.com> <4AA7D1B3.7010708@trash.net> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Eric Dumazet , netdev@vger.kernel.org To: Patrick McHardy Return-path: Received: from fg-out-1718.google.com ([72.14.220.154]:23782 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752824AbZIITw6 (ORCPT ); Wed, 9 Sep 2009 15:52:58 -0400 Received: by fg-out-1718.google.com with SMTP id 22so1411279fge.1 for ; Wed, 09 Sep 2009 12:53:00 -0700 (PDT) Content-Disposition: inline In-Reply-To: <4AA7D1B3.7010708@trash.net> Sender: netdev-owner@vger.kernel.org List-ID: On Wed, Sep 09, 2009 at 06:02:59PM +0200, Patrick McHardy wrote: > Eric Dumazet wrote: > > Jarek Poplawski a =E9crit : > >> On Mon, Sep 07, 2009 at 03:27:37PM +0200, Patrick McHardy wrote: > >>> Jarek Poplawski wrote: > >> ... > >>>>> +static int mq_dump(struct Qdisc *sch, struct sk_buff *skb) > >>>>> +{ > >>>>> + struct net_device *dev =3D qdisc_dev(sch); > >>>>> + struct Qdisc *qdisc; > >>>>> + unsigned int ntx; > >>>>> + > >>>>> + sch->q.qlen =3D 0; > >>>>> + memset(&sch->bstats, 0, sizeof(sch->bstats)); > >>>>> + memset(&sch->qstats, 0, sizeof(sch->qstats)); > >>>>> + > >>>>> + for (ntx =3D 0; ntx < dev->num_tx_queues; ntx++) { > >>>>> + qdisc =3D netdev_get_tx_queue(dev, ntx)->qdisc_sleeping; > >>>>> + spin_lock_bh(qdisc_lock(qdisc)); > >>>>> + sch->q.qlen +=3D qdisc->q.qlen; > >>>>> + sch->bstats.bytes +=3D qdisc->bstats.bytes; > >>>>> + sch->bstats.packets +=3D qdisc->bstats.packets; > >>>>> + sch->qstats.qlen +=3D qdisc->qstats.qlen; > >>>> Like in Christoph's case, we should probably use q.qlen instead. > >>> Its done a few lines above. This simply sums up all members of qs= tats. > >> AFAICS these members are updated only in tc_fill_qdisc, starting f= rom > >> the root, so they might be not up-to-date at the moment, unless I = miss > >> something. > > > > Yes, we might need an q->ops->update_stats(struct Qdisc *sch) metho= d, and > > to recursively call it from mq_update_stats() >=20 > Unless I'm missing something, that shouldn't be necessary since > sch->q.qlen contains the correct sum of all child qdiscs and > this is used by tc_fill_qdisc to update qstats.qlen. You're perfectly right! (And the code is perfectly misleading.;-) Thanks, Jarek P.