From owner-cvs-src@FreeBSD.ORG Wed Dec 13 02:28:11 2006 Return-Path: X-Original-To: cvs-src@freebsd.org Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C888016A40F; Wed, 13 Dec 2006 02:28:11 +0000 (UTC) (envelope-from bde@zeta.org.au) Received: from mailout2.pacific.net.au (mailout2-3.pacific.net.au [61.8.2.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id 471B143CA7; Wed, 13 Dec 2006 02:26:45 +0000 (GMT) (envelope-from bde@zeta.org.au) Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.2.162]) by mailout2.pacific.net.au (Postfix) with ESMTP id 77D576E08C; Wed, 13 Dec 2006 13:28:07 +1100 (EST) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailproxy1.pacific.net.au (Postfix) with ESMTP id 591CB8C0B; Wed, 13 Dec 2006 13:28:07 +1100 (EST) Date: Wed, 13 Dec 2006 13:28:06 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Oleg Bulyzhin In-Reply-To: <20061212234424.GG91560@lath.rinet.ru> Message-ID: <20061213131442.O833@delplex.bde.org> References: <200612010108.kB118qxY020349@repoman.freebsd.org> <20061212220557.GC91560@lath.rinet.ru> <200612121809.19564.jkim@FreeBSD.org> <20061212234424.GG91560@lath.rinet.ru> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org, Jung-uk Kim Subject: Re: cvs commit: src/sys/dev/bge if_bge.c if_bgereg.h X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Dec 2006 02:28:11 -0000 On Wed, 13 Dec 2006, Oleg Bulyzhin wrote: > On Tue, Dec 12, 2006 at 06:09:17PM -0500, Jung-uk Kim wrote: >> On Tuesday 12 December 2006 05:05 pm, Oleg Bulyzhin wrote: >>> I would say you have simplified it too much. With your change you >>> will get wrong numbers after ifconfig down/up (since it implies >>> hardware counters reset while sc->bge_* counters are not cleared). >> >> I did clear sc->bge_* counter: >> >> @@ -3368,6 +3357,9 @@ bge_init_locked(struct bge_softc *sc) >> >> /* Init our RX return ring index. */ >> sc->bge_rx_saved_considx = 0; >> + >> + /* Init our RX/TX stat counters. */ >> + sc->bge_rx_discards = sc->bge_tx_discards = sc->bge_tx_collisions = 0; >> >> /* Init TX ring. */ >> bge_init_tx_ring(sc); >> >> While ifconfig down/up, bge_init_locked() should be called. >> Did I miss something? > > Oh, i didnt noticed that, but this makes your change even worse: > you will loose statistic counters on every interface reset. These counters only record the previous value, for taking differences later. They must be reset to whatever the the harware resets them to. I think this is 0. To be completely correct, the differences should be added on init/reset (just before resetting the hardware). This might be easy to do by calling the stats update function at the start of reset. I think a near equivalent of this happens accidentally for watchdog resets (only), since watchdog timeouts are now synced with bge_tick() and bge_tick() will have updated the stats just before calling the watchdog. Then after resetting the hardware, it's better to depend on the hardware resetting the counters to 0 and not initialize them to the hardware values here, to avoid any losing differences on finishing reset. Bruce