[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200213084005.GF22610@nanopsycho>
Date: Thu, 13 Feb 2020 09:40:05 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: Keiya Nobuta <nobuta.keiya@...itsu.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org
Subject: Re: [PATCH] net: sched: Add sysfs_notify for /sys/class/net/*/carrier
Thu, Feb 13, 2020 at 06:21:11AM CET, nobuta.keiya@...itsu.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@...itsu.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
>
Powered by blists - more mailing lists