From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S970335AbdAISGp (ORCPT ); Mon, 9 Jan 2017 13:06:45 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:33010 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751704AbdAISGl (ORCPT ); Mon, 9 Jan 2017 13:06:41 -0500 Subject: Re: [PATCH net-next v2] net: dsa: make "label" property optional for dsa2 To: Jiri Pirko References: <20170108231552.26995-1-vivien.didelot@savoirfairelinux.com> <20170109073236.GA1862@nanopsycho> <877f6446lp.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me> <20170109151131.GC1862@nanopsycho> <87y3yk2q5e.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me> <20170109160632.GD1862@nanopsycho> <89492624-84f2-ca73-75dd-7fa10819ad09@gmail.com> <20170109175842.GH1862@nanopsycho> Cc: Vivien Didelot , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com, "David S. Miller" , Andrew Lunn , =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , Andrey Smirnov From: Florian Fainelli Message-ID: <3897e83d-83a6-7bb1-311d-ae228390f757@gmail.com> Date: Mon, 9 Jan 2017 10:06:39 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20170109175842.GH1862@nanopsycho> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/09/2017 09:58 AM, Jiri Pirko wrote: > Mon, Jan 09, 2017 at 06:42:07PM CET, f.fainelli@gmail.com wrote: >> On 01/09/2017 08:06 AM, Jiri Pirko wrote: >>> Mon, Jan 09, 2017 at 04:45:33PM CET, vivien.didelot@savoirfairelinux.com wrote: >>>> Hi Jiri, >>>> >>>> Jiri Pirko writes: >>>> >>>>>> Extra question: shouldn't phys_port_{id,name} be switchdev attributes in >>>>> >>>>> Again, phys_port_id has nothing to do with switches. Should be removed >>>>> from dsa because its use there is incorrect. >>>> >>>> Florian, since 3a543ef just got in, can it be reverted? >>> >>> Yes, please revert it. It is only in net-next. >> >> Maybe the use case can be understood before reverting the change. How do >> we actually the physical port number of an Ethernet switch per-port >> network device? The name is not enough, because there are plenty of >> cases where we need to manipulate a physical port number (be it just for >> informational purposes). > > Like what? Specifying the physical port number (and derive a queue number eventually) for some ethtool (e.g: rxnfc)/tc (queue mapping) operations where there is an action/queue/port destination argument that gets programmed into the hardware. You already have the originating port number from the interface you call the method against, but you also need the destination port number since that is what the HW understands. Aside from that, it is useful for allowing interface naming in user space if you don't want to use labels. > > Why the name is not enough? This is something propagated to userspace > and never used internally in kernel. Because the name is not reflective of the port number in some switches. In my case for instance, we have 5 ports that are named after the entities they connect to (an integrated Gigabit PHY, two RGMII pads, one MoCA interface, and the CPU) 0 -> gphy 1 -> rgmii_1 2 -> rgmii_2 7 -> moca 8 -> cpu > > Btw, ndo_get_phys_port_id does not give you number, but arbitrary binary. It's not entirely arbitrary for DSA switches since the port number is stored in an u8 whose value is the port number in hexadecimal (as shown by sysfs at least). -- Florian