netdev
[Top] [All Lists]

Re: How to count tx and rx bytes?

To: "David S. Miller" <davem@xxxxxxxxxx>
Subject: Re: How to count tx and rx bytes?
From: Ben Greear <greearb@xxxxxxxxxxxxxxx>
Date: Mon, 15 Dec 2003 14:46:59 -0800
Cc: netdev@xxxxxxxxxxx
In-reply-to: <20031215141729.15387fc1.davem@redhat.com>
Organization: Candela Technologies
References: <3FDE13AE.3050402@candelatech.com> <20031215141729.15387fc1.davem@redhat.com>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007
David S. Miller wrote:
On Mon, 15 Dec 2003 12:03:58 -0800
Ben Greear <greearb@xxxxxxxxxxxxxxx> wrote:


Is there an agreed upon standard for exactly what ethernet drivers
should be counting for rx-bytes and tx-bytes?  For example, should the
counters include the 4-byte FCS?  Should they include the ethernet header?


Good question.

It should be that all drivers use what skb->len ends up with at
rx/tx time.

A more noticeable problem is what I found in e100: It was adding skb->len after doing eth_type_trans, which yanks off the ethernet header... I moved it before the eth_type_trans and I am getting much better numbers. It does appear that the e1000 is counting the FCS in transmitted bytes, however, and unless we tell the e100 to receive the FCS, it will not count those on receive.

However, it is often faster to just let the hardware keep track
of these statistics (tg3 is one example of a chip that can do
this).  And sometimes these mechanisms take the FCS or whatever
into account and this as you note makes the numbers different.

Maybe the stats-polling code in the driver could do the necessary subtraction to remove the FCS from the results (ie, subtract (packets-since-last-sample * 4) bytes.

Thanks,
Ben

--
Ben Greear <greearb@xxxxxxxxxxxxxxx>
Candela Technologies Inc  http://www.candelatech.com



<Prev in Thread] Current Thread [Next in Thread>