* [PATCH] net: sched: Add sysfs_notify for /sys/class/net/*/carrier
@ 2020-02-13 5:21 Keiya Nobuta
2020-02-13 8:40 ` Jiri Pirko
0 siblings, 1 reply; 2+ messages in thread
From: Keiya Nobuta @ 2020-02-13 5:21 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski; +Cc: netdev, Keiya Nobuta
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");
}
}
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: sched: Add sysfs_notify for /sys/class/net/*/carrier
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
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Pirko @ 2020-02-13 8:40 UTC (permalink / raw)
To: Keiya Nobuta; +Cc: David S. Miller, Jakub Kicinski, netdev
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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-13 8:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).