question about incrementing stats counters in network drivers

Abraham vd Merwe (abraham@2d3d.co.za)
Mon, 29 Jul 2002 14:36:42 +0200


--T4sUOijqQbZv57TR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi!

If an error occur that falls into the "detailed errors" category, e.g. a
fifo overrun, are we supposed to increment both the total error count and
the detailed error count or just the detailed error count?

=46rom isa-skeleton.c it seems that I'm supposed to increment both, but the=
n I
spotted things like this in there as well:

------------< snip <------< snip <------< snip <------------
} else {
/* Malloc up new buffer. */
struct sk_buff *skb;

lp->stats.rx_bytes+=3Dpkt_len;

skb =3D dev_alloc_skb(pkt_len);
if (skb =3D=3D NULL) {
printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n",
dev->name);
lp->stats.rx_dropped++;
break;
}
skb->dev =3D dev;

/* 'skb->data' points to the start of sk_buff data area. */
memcpy(skb_put(skb,pkt_len), (void*)dev->rmem_start,
pkt_len);
/* or */
insw(ioaddr, skb->data, (pkt_len + 1) >> 1);

netif_rx(skb);
dev->last_rx =3D jiffies;
lp->stats.rx_packets++;
lp->stats.rx_bytes +=3D pkt_len;
}
------------< snip <------< snip <------< snip <------------

Notice that rx_bytes gets incremented twice.

Also it doesn't make sense to increment both since the total count can be
derived from rx_errors+other rx errors or tx_errors+other tx errors, so I'm
not sure what to do.

--=20

Regards
Abraham

QOTD:
I love your outfit, does it come in your size?

__________________________________________________________
Abraham vd Merwe - 2d3D, Inc.

Device Driver Development, Outsourcing, Embedded Systems

Cell: +27 82 565 4451 Snailmail:
Tel: +27 21 761 7549 Block C, Aintree Park
Fax: +27 21 761 7648 Doncaster Road
Email: abraham@2d3d.co.za Kenilworth, 7700
Http: http://www.2d3d.com South Africa

--T4sUOijqQbZv57TR
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9RTbazNXhP0RCUqMRAugNAJ45JKTq0432LhbjVhPggnInVNFDMwCfZwVR
HBpTMln5PzBlYTwbZETN4e0=
=MrvC
-----END PGP SIGNATURE-----

--T4sUOijqQbZv57TR--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/