mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* question about incrementing stats counters in network drivers
@ 2002-07-29 12:36 Abraham vd Merwe
  0 siblings, 0 replies; only message in thread
From: Abraham vd Merwe @ 2002-07-29 12:36 UTC (permalink / raw)
  To: Linux Kernel Development

[-- Attachment #1: Type: text/plain, Size: 2037 bytes --]

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?

From isa-skeleton.c it seems that I'm supposed to increment both, but then 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+=pkt_len;

            skb = dev_alloc_skb(pkt_len);
            if (skb == NULL) {
                printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n",
                       dev->name);
                lp->stats.rx_dropped++;
                break;
            }
            skb->dev = 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 = jiffies;
            lp->stats.rx_packets++;
            lp->stats.rx_bytes += 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.

-- 

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


[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-07-29 12:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-29 12:36 question about incrementing stats counters in network drivers Abraham vd Merwe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®