lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 27 Feb 2024 10:39:41 +0100
From: Bastien Curutchet <bastien.curutchet@...tlin.com>
To: "David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	Rob Herring <robh+dt@...nel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Pavel Machek <pavel@....cz>,
	Lee Jones <lee@...nel.org>,
	Richard Cochran <richardcochran@...il.com>,
	Andrew Lunn <andrew@...n.ch>,
	Heiner Kallweit <hkallweit1@...il.com>,
	Russell King <linux@...linux.org.uk>,
	Bastien Curutchet <bastien.curutchet@...tlin.com>
Cc: linux-kernel@...r.kernel.org,
	netdev@...r.kernel.org,
	devicetree@...r.kernel.org,
	linux-leds@...r.kernel.org,
	Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
	herve.codina@...tlin.com,
	maxime.chevallier@...tlin.com,
	christophercordahi@...ometrics.ca
Subject: [PATCH v2 2/6] leds: trigger: Create a new LED netdev trigger for collision

Collisions on link does not fit into one of the existing netdev triggers.

Add TRIGGER_NETDEV_COLLISION in the enum led_trigger_netdev_modes.
Add its definition in Documentation.
Add its handling in ledtrig-netdev, it can only be supported by hardware
so no software fallback is implemented.

Signed-off-by: Bastien Curutchet <bastien.curutchet@...tlin.com>
---
 .../ABI/testing/sysfs-class-led-trigger-netdev        | 11 +++++++++++
 drivers/leds/trigger/ledtrig-netdev.c                 |  4 ++++
 include/linux/leds.h                                  |  1 +
 3 files changed, 16 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-class-led-trigger-netdev b/Documentation/ABI/testing/sysfs-class-led-trigger-netdev
index a6c307c4befa..fbb2bc1d6108 100644
--- a/Documentation/ABI/testing/sysfs-class-led-trigger-netdev
+++ b/Documentation/ABI/testing/sysfs-class-led-trigger-netdev
@@ -178,3 +178,14 @@ Description:
 		If set to 1, the LED's normal state reflects the link full
 		duplex state of the named network device.
 		Setting this value also immediately changes the LED state.
+
+What:		/sys/class/leds/<led>/collision
+Date:		Feb 2024
+KernelVersion:	6.8
+Contact:	linux-leds@...r.kernel.org
+Description:
+		Signal collision of the named network device.
+
+		If set to 0 (default), the LED's normal state is off.
+
+		If set to 1, the LED's normal state reflects collisions.
diff --git a/drivers/leds/trigger/ledtrig-netdev.c b/drivers/leds/trigger/ledtrig-netdev.c
index 8e5475819590..5c17b8e27d5c 100644
--- a/drivers/leds/trigger/ledtrig-netdev.c
+++ b/drivers/leds/trigger/ledtrig-netdev.c
@@ -318,6 +318,7 @@ static ssize_t netdev_led_attr_show(struct device *dev, char *buf,
 	case TRIGGER_NETDEV_FULL_DUPLEX:
 	case TRIGGER_NETDEV_TX:
 	case TRIGGER_NETDEV_RX:
+	case TRIGGER_NETDEV_COLLISION:
 		bit = attr;
 		break;
 	default:
@@ -352,6 +353,7 @@ static ssize_t netdev_led_attr_store(struct device *dev, const char *buf,
 	case TRIGGER_NETDEV_FULL_DUPLEX:
 	case TRIGGER_NETDEV_TX:
 	case TRIGGER_NETDEV_RX:
+	case TRIGGER_NETDEV_COLLISION:
 		bit = attr;
 		break;
 	default:
@@ -410,6 +412,7 @@ DEFINE_NETDEV_TRIGGER(half_duplex, TRIGGER_NETDEV_HALF_DUPLEX);
 DEFINE_NETDEV_TRIGGER(full_duplex, TRIGGER_NETDEV_FULL_DUPLEX);
 DEFINE_NETDEV_TRIGGER(tx, TRIGGER_NETDEV_TX);
 DEFINE_NETDEV_TRIGGER(rx, TRIGGER_NETDEV_RX);
+DEFINE_NETDEV_TRIGGER(collision, TRIGGER_NETDEV_COLLISION);
 
 static ssize_t interval_show(struct device *dev,
 			     struct device_attribute *attr, char *buf)
@@ -473,6 +476,7 @@ static struct attribute *netdev_trig_attrs[] = {
 	&dev_attr_tx.attr,
 	&dev_attr_interval.attr,
 	&dev_attr_offloaded.attr,
+	&dev_attr_collision.attr,
 	NULL
 };
 ATTRIBUTE_GROUPS(netdev_trig);
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 4754b02d3a2c..8864d6ce8185 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -578,6 +578,7 @@ enum led_trigger_netdev_modes {
 	TRIGGER_NETDEV_FULL_DUPLEX,
 	TRIGGER_NETDEV_TX,
 	TRIGGER_NETDEV_RX,
+	TRIGGER_NETDEV_COLLISION,
 
 	/* Keep last */
 	__TRIGGER_NETDEV_MAX,
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ