[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABoNC83U2k=-6-BkJEyWBXfSnEbb-+K8CD1ffqhjA613Tk04tQ@mail.gmail.com>
Date: Thu, 17 Nov 2011 18:59:57 +0800
From: Junchang Wang <junchangwang@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: Stephen Hemminger <stephen.hemminger@...tta.com>,
netdev@...r.kernel.org, romieu@...zoreil.com,
nic swsd <nic_swsd@...ltek.com>
Subject: Re: [PATCH net-next] r8169: Add 64bit statistics
> 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);
>
Thanks, Eric.
I'm still confused about why we need two sync entries. Please correct
me if I'm wrong.
Take r8169 for example, All statistic entries are updated in
rtl8169_rx_interrupt() or rtl8169_tx_interrupt(). Those two functions
are called in rtl8169_poll().
As far as I know, rtl8169_poll() is protected by NAPI_STATE_SCHED bit
to run on a single core at one moment. So there is not compulsory to
use two sync entries.
One benefit from two sync is that readers can avoid many retries.
Thanks.
--
--Junchang
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists