Skip to contentSkip to conversation

question about incrementing stats counters in network drivers

DISCUSSION Abraham vd Merwe 1 participant 1 message Jul 29, 2002

lore
Share & tools
lore
#0 lore raw

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.

Signature · 16 lines
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: [email protected]         Kenilworth, 7700
  Http: http://www.2d3d.com        South Africa