From: Andrei Vagin <avagin@virtuozzo.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
netdev@vger.kernel.org, edumazet@google.com, cphealy@gmail.com,
David Decotigny <decot@googlers.com>,
"David S. Miller" <davem@davemloft.net>,
Jamal Hadi Salim <jhs@mojatatu.com>,
Cong Wang <xiyou.wangcong@gmail.com>,
Jiri Pirko <jiri@resnulli.us>,
Daniel Borkmann <daniel@iogearbox.net>,
Nikolay Aleksandrov <nikolay@cumulusnetworks.com>,
Alexei Starovoitov <ast@fb.com>,
Roopa Prabhu <roopa@cumulusnetworks.com>,
Mahesh Bandewar <maheshb@google.com>,
Vlad Yasevich <vyasevich@gmail.com>,
Jakub Kicinski <jakub.kicinski@netronome.com>,
Jonas Bonn <jonas@southpole.se>,
stephen hemminger <stephen@networkplumber.org>,
Hans Liljestrand <ishkamiel@gmail.com>,
"Reshetova, Elena" <elena.reshetova@intel.com>,
Kirill Tkhai <ktkhai@virtuozzo.com>,
Andrey Vagin <avagin@openvz.org>, Florian Westphal <fw@strlen.de>,
David Ahern <dsahern@gmail.com>, Xin Long <lucien.xin@gmail.com>,
Matthias Schiffer <mschiffer@universe-factory.net>,
Jiri Benc <jbenc@redhat.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next] net: core: Expose number of link up/down transitions
Date: Wed, 17 Jan 2018 16:23:09 -0800 [thread overview]
Message-ID: <20180118002308.GA21605@outlook.office365.com> (raw)
In-Reply-To: <20180118000652.GD32299@lunn.ch>
On Thu, Jan 18, 2018 at 01:06:52AM +0100, Andrew Lunn wrote:
> > What is the idea to have two separate counters? Can a delta between them
> > be a bigger than 1?
>
> Yes, it can.
>
> These counters are incremented in netif_carrier_on() /
> netif_carrier_off(). They are not always called in pairs and they can
> be called multiple times for the same event. The phylib will call them
> when it notices the PHY saying the link is down/up, and the MAC driver
> sometimes also calls them.
We check the __LINK_STATE_NOCARRIER bit before changing these counters,
so if we call netif_carrier_on() twice, the counter will be incrimented
only by one, will it not?
void netif_carrier_on(struct net_device *dev)
if (test_and_clear_bit(__LINK_STATE_NOCARRIER, &dev->state)) {
atomic_inc(&dev->carrier_changes);
...
void netif_carrier_off(struct net_device *dev)
if (!test_and_set_bit(__LINK_STATE_NOCARRIER, &dev->state)) {
atomic_inc(&dev->carrier_changes);
>
> Andrew
next prev parent reply other threads:[~2018-01-18 0:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-17 23:06 Florian Fainelli
2018-01-17 23:17 ` Jakub Kicinski
2018-01-17 23:49 ` Andrei Vagin
2018-01-18 0:06 ` Andrew Lunn
2018-01-18 0:23 ` Andrei Vagin [this message]
2018-01-17 23:52 ` Jiri Pirko
2018-01-18 0:17 ` David Ahern
2018-01-18 0:28 ` David Ahern
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=20180118002308.GA21605@outlook.office365.com \
--to=avagin@virtuozzo.com \
--cc=andrew@lunn.ch \
--cc=ast@fb.com \
--cc=avagin@openvz.org \
--cc=cphealy@gmail.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=decot@googlers.com \
--cc=dsahern@gmail.com \
--cc=edumazet@google.com \
--cc=elena.reshetova@intel.com \
--cc=f.fainelli@gmail.com \
--cc=fw@strlen.de \
--cc=ishkamiel@gmail.com \
--cc=jakub.kicinski@netronome.com \
--cc=jbenc@redhat.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=jonas@southpole.se \
--cc=ktkhai@virtuozzo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lucien.xin@gmail.com \
--cc=maheshb@google.com \
--cc=mschiffer@universe-factory.net \
--cc=netdev@vger.kernel.org \
--cc=nikolay@cumulusnetworks.com \
--cc=roopa@cumulusnetworks.com \
--cc=stephen@networkplumber.org \
--cc=vyasevich@gmail.com \
--cc=xiyou.wangcong@gmail.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
all inboxes | Powered by JetHome®