Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp117833pxk; Sat, 29 Aug 2020 18:51:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztV9bIZsQs2ufzKng1YmOoJzTZt10qEdkwmF8ckI/ZsvB1I9X1IETe5gfinomCagrYq9ZF X-Received: by 2002:a17:907:42cc:: with SMTP id nz20mr5830250ejb.429.1598752313923; Sat, 29 Aug 2020 18:51:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598752313; cv=none; d=google.com; s=arc-20160816; b=Q6CQzRAr4/Xt1ZimTgvu0Q7PpP5PH2ahrQLW5IIvw0iNmKVxLMYbCJAtoBvv+4dQrz 1HWE6lbuKTTM6TaZISBt7trgxDxqx/iyNQuj/d6Ldh/QgVHf5yoxowKvWYlyZXX845+H U5jXdVfzfMf5vpLj+nVY5BTx/Hx5z7OdxftpcgGNaWHQXdtyi4RjcYc1OEWnfchDhOce 4OKdD/OltWCkncPCl+//xu+bVBgaFlWqJKY/FY1GLCHVfSZJUfy7T0332Bcw0qc3LW4y XbgMll2YYIA7BJWmFYDdwtzHftZkHm6//inP3YrL5gCvgfKa4y6GaE/i6Epj1Er5Cz/L oi0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=v2MxTBDVl81p7PMpnpf79qSiVUubyjsQLlybUpRl3wU=; b=O72kvfxzFQovXUuDvbPUc8W9dzQYqXsmmKVVQKSR/Am4CUeZQCTgsodcsp3eSeoayx VVhBKRhifym7ycXp+LqYUl544SQpchUGseFseBeeMMB6W1t9dfuhiZhVGUdTFPX2WAKp IcF85QVg7Q+6/KLVwAJv/GltShxZCqJzVb7e/f7urnQLEnrVDo0Q7l+5ck/Gm0u47cEs /iaMaJVcguq0Klpdy5LZQlBr4vmlJ0PadkF2Emt63n5rdlqfE0sDAeDu7BSEAMSYlFTq zUtTxd3QRUzPal3lSqfqOjiubdKI4yjntiehfe+VA45ZIbWLovyZYvVEb+PXGK24dWPP idJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r1si2896396eja.170.2020.08.29.18.51.31; Sat, 29 Aug 2020 18:51:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728633AbgH3BuT (ORCPT + 99 others); Sat, 29 Aug 2020 21:50:19 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:60358 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728439AbgH3BuR (ORCPT ); Sat, 29 Aug 2020 21:50:17 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kCCTt-00CSEg-Qh; Sun, 30 Aug 2020 03:50:05 +0200 Date: Sun, 30 Aug 2020 03:50:05 +0200 From: Andrew Lunn To: Pavel Machek Cc: Marek =?iso-8859-1?Q?Beh=FAn?= , netdev@vger.kernel.org, linux-leds@vger.kernel.org, jacek.anaszewski@gmail.com, Dan Murphy , =?utf-8?Q?Ond=C5=99ej?= Jirman , Russell King , Thomas Petazzoni , Gregory Clement , linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC leds + net-next v4 0/2] Add support for LEDs on Marvell PHYs Message-ID: <20200830015005.GD2966560@lunn.ch> References: <20200728150530.28827-1-marek.behun@nic.cz> <20200807090653.ihnt2arywqtpdzjg@duo.ucw.cz> <20200807132920.GB2028541@lunn.ch> <20200829224351.GA29564@duo.ucw.cz> <20200829233641.GC2966560@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200829233641.GC2966560@lunn.ch> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > You could make a good guess at matching to two together, but it is > > > error prone. Phys are low level things which the user is not really > > > involved in. They interact with interface names. ethtool, ip, etc, all > > > use interface names. In fact, i don't know of any tool which uses > > > phydev names. > > > > So... proposal: > > > > Users should not be dealing with sysfs interface directly, anyway. We > > should have a tool for that. It can live in kernel/tools somewhere, I > > guess. > > We already have one, ethtool(1). > > > > > Would we name leds phy0:... (with simple incrementing number), and > > expose either interface name or phydev name as a attribute? > > > > So user could do > > > > cat /sys/class/leds/phy14:green:foobar/netdev > > lan5@eth1: I forgot about network name spaces. There can be multiple interfaces with the name eth0, each in its own network namespace. For your proposal to work, /sys/class/leds/phy14:green:foobar needs to be in the network namespace, so it is only visible to other processes in the same name space, and lan5@eth1 is then unique to that namespace. > Which is the wrong way around. ethtool will be passed the interface > name and an PHY descriptor of some sort, and it has to go search > through all the LEDs to find the one with this attribute. I would be > much more likely to add a sysfs link from > /sys/class/net/lan5/phy:left:green to > /sys/class/leds/phy14:left:green. I need to test a bit, but i think this works. Everything under /sys/class/net is network namespace aware. You only see /sys/class/net/lan5 if there is a lan5 is in the current name space, and you see the current namespaces version of lan5.. A sysfs symlink out of namespace to /sys/class/led should work, assuming /sys/class/led is namespace unaware, and phy14 is unique across all network name spaces. But you cannot have a link in the opposite direction from /sys/class/led/phy14 to /sys/class/net/lan5, since it has no idea which lan5 to symlink to. Andrew