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] [day] [month] [year] [list]
Message-ID: <20231211105329.598473b9@dellmb>
Date: Mon, 11 Dec 2023 10:53:29 +0100
From: Marek BehĂșn <kabel@...nel.org>
To: Heiner Kallweit <hkallweit1@...il.com>
Cc: Realtek linux nic maintainers <nic_swsd@...ltek.com>, Paolo Abeni
 <pabeni@...hat.com>, Jakub Kicinski <kuba@...nel.org>, David Miller
 <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH v2 net-next] r8169: add support for LED's on
 RTL8168/RTL8101

Hello Heiner,

On Fri, 8 Dec 2023 18:48:27 +0100
Heiner Kallweit <hkallweit1@...il.com> wrote:

> +static void rtl8168_setup_ldev(struct r8169_led_classdev *ldev,
> +			       struct net_device *ndev, int index)
> +{
> +	struct rtl8169_private *tp = netdev_priv(ndev);
> +	struct led_classdev *led_cdev = &ldev->led;
> +	char led_name[LED_MAX_NAME_SIZE];
> +
> +	ldev->ndev = ndev;
> +	ldev->index = index;
> +
> +	r8169_get_led_name(tp, index, led_name, LED_MAX_NAME_SIZE);
> +	led_cdev->name = led_name;
> +	led_cdev->default_trigger = "netdev";
> +	led_cdev->hw_control_trigger = "netdev";
> +	led_cdev->flags |= LED_RETAIN_AT_SHUTDOWN;
> +	led_cdev->hw_control_is_supported = rtl8168_led_hw_control_is_supported;
> +	led_cdev->hw_control_set = rtl8168_led_hw_control_set;
> +	led_cdev->hw_control_get = rtl8168_led_hw_control_get;
> +	led_cdev->hw_control_get_device = r8169_led_hw_control_get_device;
> +
> +	/* ignore errors */
> +	devm_led_classdev_register(&ndev->dev, led_cdev);
> +}

...

> +void r8169_get_led_name(struct rtl8169_private *tp, int idx,
> +			char *buf, int buf_len)
> +{
> +	snprintf(buf, buf_len, "r8169-%x%x-led%d",
> +		 pci_domain_nr(tp->pci_dev->bus),
> +		 pci_dev_id(tp->pci_dev), idx);
> +}

Please look at Documentation/leds/leds-class.rst:
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/leds/leds-class.rst?h=v6.7-rc5

LED devices should have name in the format
  "devicename:color:function"
Where color is one from the led_colors array from
drivers/leds/led-core.c (or omitted if you cannot know) and function is
one from the LED_FUNCTION_ macros from
include/dt-bindings/leds/common.h.

When skipping color, you should keep the colon sign, i.e.
  usbnet0::lan

Regarding the devicename part: originally it was thought to be
something like eth0 (like the LED for mmc0 has devicename mmc0),
but since network interfaces can be renamed and their names are not
guaranteeed to be persisnet across boots, maybe you can reuse the
Predictable Network Interface Names scheme for USB devices
  https://www.freedesktop.org/software/systemd/man/latest/systemd.net-naming-scheme.html

Please don't put the driver name (r8169) there.

Marek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ