Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Shlomo Pongartz <shlomop@mellanox.com>
Cc: netdev@vger.kernel.org
Subject: Re: ndo_get_stats and rtnl_netlink
Date: Mon, 10 Sep 2012 11:09:49 +0200	[thread overview]
Message-ID: <1347268189.1234.1301.camel@edumazet-glaptop> (raw)
In-Reply-To: <504CB464.6010207@mellanox.com>

On Sun, 2012-09-09 at 18:23 +0300, Shlomo Pongartz wrote:
> Hi,
> 
> Just realized that dev_get_stats which calls into a netdevice 
> ndo_get_stats64/ndo_get_stats can be
> called with or without RTNL lock protection. If called from 
> rtnl_fill_ifinfo e.g as of invocation of
> "ip link show <interface>, there IS locking, however if called from 
> dev_seq_printf_stats e.g as of
> invocation of reading the /sys/class/net/<interface>/statistics/ 
> entries, etc more cases -- no locking.
> 
> This turned to be problematic when implementing the ethtool 
> "set_channels" directive which
> changes the number of **rings**, since we stepped on a bug where the 
> rings data structure was
> changed by the ethtool flow in the same time a statistics call was done 
> into the driver, etc.
> 
> What would be the way to continue here, per driver lock sounds non 
> generic...

RTNL locking is not needed to fetch stats, and would be overkill.

Each driver has its own way to protect/gather its stats.

  reply	other threads:[~2012-09-10  9:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-09 15:23 ndo_get_stats and rtnl_netlink Shlomo Pongartz
2012-09-10  9:09 ` Eric Dumazet [this message]
2012-09-10 19:10   ` Or Gerlitz
2012-09-10 19:15     ` Eric Dumazet

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=1347268189.1234.1301.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=shlomop@mellanox.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