cvs commit: src/sys/dev/bge if_bge.c if_bgereg.h
Bruce Evans
bde at zeta.org.au
Tue Dec 12 18:28:11 PST 2006
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
More information about the cvs-src
mailing list