From: Eric Dumazet <eric.dumazet@gmail.com>
To: Junchang Wang <junchangwang@gmail.com>
Cc: Stephen Hemminger <stephen.hemminger@vyatta.com>,
netdev@vger.kernel.org, romieu@fr.zoreil.com,
nic swsd <nic_swsd@realtek.com>
Subject: Re: [PATCH net-next] r8169: Add 64bit statistics
Date: Thu, 17 Nov 2011 09:11:56 +0100 [thread overview]
Message-ID: <1321517516.3274.40.camel@edumazet-laptop> (raw)
In-Reply-To: <CABoNC82RO2uvn9TfToAygEspUZnNrefXgO6SGpZoSAayCp3QiA@mail.gmail.com>
Le jeudi 17 novembre 2011 à 15:46 +0800, Junchang Wang a écrit :
> > You dont need per-cpu since Tx is locked by dev->xmit_lock and
> > rx is implicitly single threaded by NAPI.
>
> Thanks.
>
> >You do need to have
> > two u64_stat_sync entries (one for Tx and one for Rx).
>
> You mean Rx and Tx will perform on different cores at one moment.
> So I need a sync for Tx to protect tx_xxx, and another for Rx to
> protect rx_xxx. Is that right?
>
Yes, look at sky2.c for a template
drivers/net/ethernet/marvell/sky2.c contains code like that
(different syncp for rx/tx)
TX path:
u64_stats_update_begin(&sky2->tx_stats.syncp);
++sky2->tx_stats.packets;
sky2->tx_stats.bytes += skb->len;
u64_stats_update_end(&sky2->tx_stats.syncp);
RX path:
u64_stats_update_begin(&sky2->rx_stats.syncp);
sky2->rx_stats.packets += packets;
sky2->rx_stats.bytes += bytes;
u64_stats_update_end(&sky2->rx_stats.syncp);
next prev parent reply other threads:[~2011-11-17 8:12 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-17 6:48 [PATCH net-next] r8169: Add 64bit statistics Junchang Wang
2011-11-17 7:03 ` Stephen Hemminger
2011-11-17 7:46 ` Junchang Wang
2011-11-17 8:11 ` Eric Dumazet [this message]
2011-11-17 10:59 ` Junchang Wang
2011-11-17 11:13 ` David Laight
2011-11-17 12:58 ` Eric Dumazet
2011-11-17 14:01 ` David Laight
2011-11-17 14:27 ` Eric Dumazet
2011-11-17 13:02 ` Eric Dumazet
2011-11-17 7:21 ` Eric Dumazet
2011-11-17 7:39 ` Junchang Wang
2011-11-17 9:36 ` Francois Romieu
2011-11-17 10:51 ` Eric Dumazet
2011-11-18 2:24 ` Junchang Wang
2011-11-18 9:18 ` Francois Romieu
-- strict thread matches above, loose matches on Subject: below --
2012-03-04 9:37 Junchang Wang
2012-03-04 15:44 ` Eric Dumazet
2012-03-04 23:24 ` Francois Romieu
2012-03-04 23:32 ` Eric Dumazet
2012-03-05 1:03 ` Junchang Wang
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=1321517516.3274.40.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=junchangwang@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nic_swsd@realtek.com \
--cc=romieu@fr.zoreil.com \
--cc=stephen.hemminger@vyatta.com \
/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