public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Junchang Wang <junchangwang@gmail.com>
Cc: sonic zhang <sonic.adi@gmail.com>,
	David Miller <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	uclinux-dist-devel <uclinux-dist-devel@blackfin.uclinux.org>
Subject: Re: [PATCH v2] netdev:bfin_mac: reclaim and free tx skb as soon as possible after transfer
Date: Thu, 03 Jun 2010 11:19:09 +0200	[thread overview]
Message-ID: <1275556749.2456.24.camel@edumazet-laptop> (raw)
In-Reply-To: <AANLkTinrW2w9x6dbzTAzSrElqUueFOC6tJaPNsVcnLBv@mail.gmail.com>

Le jeudi 03 juin 2010 à 16:57 +0800, Junchang Wang a écrit :
> Hi Eric,
> 
> On Thu, Jun 3, 2010 at 12:05 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > Not related to your patch, but reviewing it I see this driver still do
> > the "dev->stats.tx_packets++; dev->stats.tx_bytes += (skb->len);"
> >
> > This is not necessary and expensive, since we update txq stats in core
> > network stack.
> >
> >        rc = ops->ndo_start_xmit(skb, dev);
> >        if (rc == NETDEV_TX_OK)
> >                txq_trans_update(txq);  << here >>
> >
> 
> Good suggestion for drivers. But I wonder whether there are stats for
> received packets in core network stack.
> 

No its not there.

> I.e., can I replace "dev->stats.rx_packets++" and "dev->stats.rx_bytes
> += (skb->len);" with something already maintained by core stack? I
> failed to find them.
> 

As I said, core network takes care of three counters only, because it
was 'free', as they share a cache line with a spinlock we must hold when
calling xmit function.

In receive path, we dont dirty a cache line in core network, so updating
counters would add a cost. (modern NICs handle stats in firmware)




  reply	other threads:[~2010-06-03  9:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-03  3:48 [PATCH v2] netdev:bfin_mac: reclaim and free tx skb as soon as possible after transfer sonic zhang
2010-06-03  4:05 ` Eric Dumazet
2010-06-03  8:57   ` Junchang Wang
2010-06-03  9:19     ` Eric Dumazet [this message]
2010-06-03 10:54       ` Junchang Wang
2010-06-04  3:29 ` Sonic Zhang
2010-06-04  4:05   ` Eric Dumazet
2010-06-04  4:44     ` Sonic Zhang
2010-06-07  9:58       ` Eric Dumazet
2010-06-07 10:26         ` Sonic Zhang

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=1275556749.2456.24.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=junchangwang@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=sonic.adi@gmail.com \
    --cc=uclinux-dist-devel@blackfin.uclinux.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