Re: /proc/net/dev

Russell Coker - mailing lists account (
Mon, 16 Jun 97 21:21:07 +1100

>> Is the count the number of bytes transferred over the media or the size
>> of the IP packet? It appears to be the size of the IP packet.

>Should be the size of the raw frame that gets passed to the Ethernet


>> On transmission the Tulip driver increases the byte counter before the
>> packet is sent and doesn't appear to decrease it on failure to send. Is
>> this a bug or is the byte count defined as the number of bytes that we
>> attempt to send?

>It's probably easiest to define it like that - the Tulip driver isn't
>alone, and it can sometimes be sticky to work out how many bytes were sent
>after the event. Also, I think the transmitted packet count measures the
>number of packets that were queued for transmission, not the number that
>made it onto the wire.

As far as being alone goes, my opinion is that if all drivers are broken
then we should fix them all. But what you say about the potential
difficulty of determining whether the data actually got out there makes

Below is a little patch I've written for the Tulip and PPP drivers to
make them return all byte counts. The output from the Tulip driver seems
good in this regard, however the byte counts from the PPP driver seem a bit
low. I'm still working on this.

On the topic of networking, does anyone know why the EQL driver only
supports a single device? I've started work on implementing support for
eql0 to eql255...

Russell Coker

diff -ru linux/drivers/net/ppp.c linux-count/drivers/net/ppp.c ---
linux/drivers/net/ppp.c Tue May 13 03:35:41 1997
+++ linux-count/drivers/net/ppp.c Mon Jun 16 18:45:06 1997
@@ -6,7 +6,7 @@
* Dynamic PPP devices by Jim Freeman <>.
* ppp_tty_receive ``noisy-raise-bug'' fixed by Ove Ewerlid
- * ==FILEVERSION 970126==
+ * ==FILEVERSION 970616==
* If you modify this file at all, please set the number above to the
@@ -3088,6 +3088,7 @@
struct ppp *ppp = dev2ppp (dev);
static struct net_device_stats ppp_stats;

+ ppp_stats.rx_bytes = ppp->stats.ppp_ibytes;
ppp_stats.rx_packets = ppp->stats.ppp_ipackets;
ppp_stats.rx_errors = ppp->stats.ppp_ierrors;
ppp_stats.rx_dropped = ppp->stats.ppp_ierrors;
@@ -3096,6 +3097,7 @@
ppp_stats.rx_over_errors = 0;
ppp_stats.rx_crc_errors = 0;
ppp_stats.rx_frame_errors = 0;
+ ppp_stats.tx_bytes = ppp->stats.ppp_obytes;
ppp_stats.tx_packets = ppp->stats.ppp_opackets;
ppp_stats.tx_errors = ppp->stats.ppp_oerrors;
ppp_stats.tx_dropped = 0;
diff -ru linux/drivers/net/tulip.c linux-count/drivers/net/tulip.c ---
linux/drivers/net/tulip.c Mon Jun 16 19:52:07 1997
+++ linux-count/drivers/net/tulip.c Mon Jun 16 20:05:15 1997
@@ -1078,6 +1078,7 @@
skb->protocol = eth_type_trans(skb,dev);
+ lp->stats.rx_bytes+=skb->len;

lp->rx_ring[entry].status = TRING_OWN;