From: Eric Dumazet <eric.dumazet@gmail.com>
To: sonic zhang <sonic.adi@gmail.com>
Cc: 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 06:05:19 +0200 [thread overview]
Message-ID: <1275537919.29413.55.camel@edumazet-laptop> (raw)
In-Reply-To: <1275536881.18536.5.camel@eight.analog.com>
Le jeudi 03 juin 2010 à 11:48 +0800, sonic zhang a écrit :
> bfin_tx_hwtstamp(dev, skb);
>
> current_tx_ptr = current_tx_ptr->next;
> dev->stats.tx_packets++;
> dev->stats.tx_bytes += (skb->len);
> +
> + tx_reclaim_skb(lp);
> +
> return NETDEV_TX_OK;
> }
>
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 >>
Doing these changes in a network driver dirties yet another cache line
in a hot path.
I suspect many drivers could be changed to avoid this double accounting.
A driver providing a ndo_get_stats() method can use the
dev_txq_stats_fold() helper.
driver not provinding a ndo_get_stats() method has nothing special to
do, dev_get_stats() automatically calls dev_txq_stats_fold() to update
dev->stats.{tx_packets|tx_bytes|tx_dropped} using txq stats.
next prev parent reply other threads:[~2010-06-03 4:10 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 [this message]
2010-06-03 8:57 ` Junchang Wang
2010-06-03 9:19 ` Eric Dumazet
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=1275537919.29413.55.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--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