tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Move if_opackets++ to where if_obytes are



ozaki.ryota%gmail.com@localhost (Ryota Ozaki) writes:

>  - Users normally expect the counter is incremented in the
>    same manner between device drivers

Drivers only count packets, because that's what the hardware (originally)
provides and that's what the driver API supports. The counts resemble
what is actually on the wire. For hardware that doesn't provide statistic
counters this is usually done in software by counting interrupts or
processed DMA buffers in the driver.
The other counters (e.g. errors, collision, etc..) are also all
provided or derived by the hardware.

The network interface layer that assembles and disects packets
counts bytes. That's bytes queued for sending or retrieved from
the queue. It's also information that the hardware or the driver
usually don't have and the ibytes/obytes values were added later
to the code to make that information available.

It's easily possible to have multiple packet counts for the same
chunk of bytes if something went wrong with the transmission
in either direction. So packet and byte counters aren't necessarily
in sync.

I'm not sure if users would expect a changed behaviour.

So instead of dropping the hardware information and pretending its
all data from the network layer, maybe the opposite is better.
Provide byte counts by the driver so that it stays "in-sync" with
the packet counts and add a new API to get per-interface statistics
from the network layer.

-- 
-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index