netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [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

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).