From: Jiri Pirko <jiri@resnulli.us>
To: Keiya Nobuta <nobuta.keiya@fujitsu.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org
Subject: Re: [PATCH] net: sched: Add sysfs_notify for /sys/class/net/*/carrier
Date: Thu, 13 Feb 2020 09:40:05 +0100 [thread overview]
Message-ID: <20200213084005.GF22610@nanopsycho> (raw)
In-Reply-To: <20200213052111.19595-1-nobuta.keiya@fujitsu.com>
Thu, Feb 13, 2020 at 06:21:11AM CET, nobuta.keiya@fujitsu.com wrote:
>This patch makes /sys/class/<iface>/carrier pollable and allows
>application to monitor current physical link state changes.
>
>Signed-off-by: Keiya Nobuta <nobuta.keiya@fujitsu.com>
>---
> net/sched/sch_generic.c | 2 ++
> 1 file changed, 2 insertions(+)
>
>diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
>index 6c9595f..67e4190 100644
>--- a/net/sched/sch_generic.c
>+++ b/net/sched/sch_generic.c
>@@ -493,6 +493,7 @@ void netif_carrier_on(struct net_device *dev)
> linkwatch_fire_event(dev);
> if (netif_running(dev))
> __netdev_watchdog_up(dev);
>+ sysfs_notify(&dev->dev.kobj, NULL, "carrier");
This would be the only use of sysfs notify in net. I wonder, what makes
the carrier different comparing to other attributes that might change
during runtime?
Also, in net, we have RTNETLINK that app can listen to and react.
Carrier change is propagated through that as well.
> }
> }
> EXPORT_SYMBOL(netif_carrier_on);
>@@ -510,6 +511,7 @@ void netif_carrier_off(struct net_device *dev)
> return;
> atomic_inc(&dev->carrier_down_count);
> linkwatch_fire_event(dev);
>+ sysfs_notify(&dev->dev.kobj, NULL, "carrier");
> }
> }
> EXPORT_SYMBOL(netif_carrier_off);
>--
>2.7.4
>
prev parent reply other threads:[~2020-02-13 8:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-13 5:21 [PATCH] net: sched: Add sysfs_notify for /sys/class/net/*/carrier Keiya Nobuta
2020-02-13 8:40 ` Jiri Pirko [this message]
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=20200213084005.GF22610@nanopsycho \
--to=jiri@resnulli.us \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nobuta.keiya@fujitsu.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;
as well as URLs for NNTP newsgroup(s).