Why no stats.tx_bytes / stats.rx_bytes

Donald Becker becker@cesdis1.gsfc.nasa.gov
Wed Nov 4 18:03:36 1998


On Wed, 4 Nov 1998, Eric S. Johnson wrote:

> Subject: Re: Why no stats.tx_bytes / stats.rx_bytes 
> Did I get this right? I am not 100% positive that tx_buf_size0 is the right
> thing. But it looked like it might be....
> + #if LINUX_VERSION_CODE > 0x20127
> +                                       sp->stats.tx_bytes += sp->
> tx_ring[entry]
> .tx_buf_size0 & 0x7ff;
> + #endif
...
> + #if LINUX_VERSION_CODE > 0x20127
> +                       sp->stats.rx_bytes += pkt_len;
> + #endif

Yes, this is correct.

Well, mostly correct: we haven't defined what the tx_bytes/rx_bytes fields
should count.

We always omit the 4 CRC bytes that are added and stripped by the hardware. 

You could make an argument that the 12 address bytes, or the 14
address+length/protocol bytes should similarly be omitted.

Or perhaps that the 12 bytes address bytes should be omitted, and the 2
bytes should only be omitted when they contain the packet length, but not
when they contain the protocol.  (Correct by one viewpoint, but ugly and
painful.)

And should we count pad bytes for too-short packets?
(We don't, thus the Rx count might be higher than the link partner's Tx
count.)

IMNSHO, the above values are reasonable.

Donald Becker					  becker@cesdis.gsfc.nasa.gov
USRA-CESDIS, Center of Excellence in Space Data and Information Sciences.
Code 930.5, Goddard Space Flight Center,  Greenbelt, MD.  20771
301-286-0882	     http://cesdis.gsfc.nasa.gov/people/becker/whoiam.html