From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C50AC2D0E0 for ; Wed, 9 Sep 2020 22:11:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D385A20C09 for ; Wed, 9 Sep 2020 22:11:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728971AbgIIWLz convert rfc822-to-8bit (ORCPT ); Wed, 9 Sep 2020 18:11:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726426AbgIIWLy (ORCPT ); Wed, 9 Sep 2020 18:11:54 -0400 Received: from mail.nic.cz (mail.nic.cz [IPv6:2001:1488:800:400::400]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67598C061573; Wed, 9 Sep 2020 15:11:54 -0700 (PDT) Received: from localhost (unknown [IPv6:2a0e:b107:ae1:0:3e97:eff:fe61:c680]) by mail.nic.cz (Postfix) with ESMTPSA id 97B13140A5E; Thu, 10 Sep 2020 00:11:52 +0200 (CEST) Date: Thu, 10 Sep 2020 00:11:52 +0200 From: Marek Behun To: Andrew Lunn Cc: netdev@vger.kernel.org, linux-leds@vger.kernel.org, Pavel Machek , Dan Murphy , =?UTF-8?B?T25kxZllag==?= Jirman , Russell King , linux-kernel@vger.kernel.org, Matthias Schiffer , "David S. Miller" Subject: Re: [PATCH net-next + leds v2 0/7] PLEASE REVIEW: Add support for LEDs on Marvell PHYs Message-ID: <20200910001152.34de9a2d@nic.cz> In-Reply-To: <20200909214259.GL3290129@lunn.ch> References: <20200909162552.11032-1-marek.behun@nic.cz> <20200909214259.GL3290129@lunn.ch> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Virus-Scanned: clamav-milter 0.102.2 at mail X-Virus-Status: Clean Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 9 Sep 2020 23:42:59 +0200 Andrew Lunn wrote: > On Wed, Sep 09, 2020 at 06:25:45PM +0200, Marek BehĂșn wrote: > > Hello Andrew and Pavel, > > > > please review these patches adding support for HW controlled LEDs. > > The main difference from previous version is that the API is now generalized > > and lives in drivers/leds, so that part needs to be reviewed (and maybe even > > applied) by Pavel. > > > > As discussed previously between you two, I made it so that the devicename > > part of the LED is now in the form `ethernet-phy%i` when the LED is probed > > for an ethernet PHY. Userspace utility wanting to control LEDs for a specific > > network interface can access them via /sys/class/net/eth0/phydev/leds: > > > > mox ~ # ls /sys/class/net/eth0/phydev/leds > > It is nice they are directly in /sys/class/net/eth0/phydev. Do they > also appear in /sys/class/led? They are in /sys/class/net/eth0/phydev/leds by default, because they are children of the PHY device and are of `leds` class, and the PHY subsystem creates a symlink `phydev` when PHY is attached to the interface. They are in /sys/class/leds/ as symlinks, because AFAIK everything in /sys/class// is a symlink... > Have you played with network namespaces? What happens with > > ip netns add ns1 > > ip link set eth0 netns ns1 > > Andrew If you move eth0 to other network namespace, naturally the /sys/class/net/eth0 symlink will disappear, as will the directory it pointed to. The symlink phydev does will disappear from /sys/class/net/eth0/ directory after eth0 is moved to ns1, and is lost. It does not return even if eth0 is moved back to root namespace. The LED will of course stay in ns1 and also in root namespace, as will the phydev the LED is a child to. But they are no longer accessible via /sys/class/net/eth0, instead you can access the LEDs either via /sys/class/leds or /sys/class/mdio_bus///leds, or without symlinks via /sys/devices/ tree. Marek