mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Abraham vd Merwe <abraham@2d3d.co.za>
To: Linux Kernel Development <linux-kernel@vger.kernel.org>
Subject: question about incrementing stats counters in network drivers
Date: Mon, 29 Jul 2002 14:36:42 +0200	[thread overview]
Message-ID: <20020729143642.A7130@crystal.2d3d.co.za> (raw)

[-- 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 --]

                 reply	other threads:[~2002-07-29 12:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020729143642.A7130@crystal.2d3d.co.za \
    --to=abraham@2d3d.co.za \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®