OSDN Git Service

leds: trigger: netdev: add additional specific link duplex mode
authorChristian Marangi <ansuelsmth@gmail.com>
Mon, 19 Jun 2023 20:46:59 +0000 (22:46 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 21 Jun 2023 21:30:46 +0000 (14:30 -0700)
commitf22f95b9ff1551c9bab13104131929f33d51f23f
treebcca25ec6d8db7e8dbc1f82657e2323f94bf491e
parentd5e01266e7f5fa12400d4c8aa4e86fe89dcc61e9
leds: trigger: netdev: add additional specific link duplex mode

Add additional modes for specific link duplex. Use ethtool APIs to get the
current link duplex and enable the LED accordingly. Under netdev event
handler the rtnl lock is already held and is not needed to be set to
access ethtool APIs.

This is especially useful for PHY and Switch that supports LEDs hw
control for specific link duplex.

Add additional modes:
- half_duplex: Turn on LED when link is half duplex
- full_duplex: Turn on LED when link is full duplex

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Lee Jones <lee@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/leds/trigger/ledtrig-netdev.c
include/linux/leds.h