From: Jiri Pirko <jiri@resnulli.us>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
netdev@vger.kernel.org, davem@davemloft.net, idosch@mellanox.com,
jakub.kicinski@netronome.com, mlxsw@mellanox.com,
vivien.didelot@savoirfairelinux.com, michael.chan@broadcom.com,
ganeshgr@chelsio.com, saeedm@mellanox.com,
simon.horman@netronome.com, pieter.jansenvanvuuren@netronome.com,
john.hurley@netronome.com, dirk.vandermerwe@netronome.com,
alexander.h.duyck@intel.com, ogerlitz@mellanox.com,
dsahern@gmail.com, vijaya.guvva@cavium.com,
satananda.burla@cavium.com, raghu.vatsavayi@cavium.com,
felix.manlunas@cavium.com, gospo@broadcom.com,
sathya.perla@broadcom.com, vasundhara-v.volam@broadcom.com,
tariqt@mellanox.com, eranbe@mellanox.com,
jeffrey.t.kirsher@intel.com
Subject: Re: [patch net-next RFC 00/12] devlink: introduce port flavours and common phys_port_name generation
Date: Sat, 24 Mar 2018 18:42:48 +0100 [thread overview]
Message-ID: <20180324174248.GH1891@nanopsycho> (raw)
In-Reply-To: <D017986F-35B3-4B33-B2FF-97103AA9964A@gmail.com>
Sat, Mar 24, 2018 at 06:07:27PM CET, f.fainelli@gmail.com wrote:
>On March 24, 2018 9:07:49 AM PDT, Jiri Pirko <jiri@resnulli.us> wrote:
>>Sat, Mar 24, 2018 at 03:35:09PM CET, f.fainelli@gmail.com wrote:
>>>On March 24, 2018 12:45:51 AM PDT, Jiri Pirko <jiri@resnulli.us>
>>wrote:
>>>>Fri, Mar 23, 2018 at 04:24:12PM CET, andrew@lunn.ch wrote:
>>>>>On Fri, Mar 23, 2018 at 03:59:35PM +0100, Jiri Pirko wrote:
>>>>>> Fri, Mar 23, 2018 at 02:43:57PM CET, andrew@lunn.ch wrote:
>>>>>> >> I tested this for mlxsw and nfp. I have no way to test this on
>>>>DSA hw,
>>>>>> >> I would really appretiate DSA guys to test this.
>>>>>> >
>>>>>> >Hi Jiri
>>>>>> >
>>>>>> >With the missing break added, i get:
>>>>>> >
>>>>>> >root@zii-devel-b:~# ./iproute2/devlink/devlink port
>>>>>> >mdio_bus/0.1:00/0: type eth netdev lan0 flavour physical number 0
>>>>>> >mdio_bus/0.1:00/1: type eth netdev lan1 flavour physical number 1
>>>>>> >mdio_bus/0.1:00/2: type eth netdev lan2 flavour physical number 2
>>>>>> >mdio_bus/0.1:00/3: type notset
>>>>>> >mdio_bus/0.1:00/4: type notset
>>>>>> >mdio_bus/0.1:00/5: type notset flavour dsa number 5
>>>>>> >mdio_bus/0.1:00/6: type notset flavour cpu number 6
>>>>>> >mdio_bus/0.2:00/0: type eth netdev lan3 flavour physical number 0
>>>>>> >mdio_bus/0.2:00/1: type eth netdev lan4 flavour physical number 1
>>>>>> >mdio_bus/0.2:00/2: type eth netdev lan5 flavour physical number 2
>>>>>> >mdio_bus/0.2:00/3: type notset
>>>>>> >mdio_bus/0.2:00/4: type notset
>>>>>> >mdio_bus/0.2:00/5: type notset flavour dsa number 5
>>>>>> >mdio_bus/0.2:00/6: type notset flavour dsa number 6
>>>>>> >mdio_bus/0.4:00/0: type eth netdev lan6 flavour physical number 0
>>>>>> >mdio_bus/0.4:00/1: type eth netdev lan7 flavour physical number 1
>>>>>> >mdio_bus/0.4:00/2: type eth netdev lan8 flavour physical number 2
>>>>>> >mdio_bus/0.4:00/3: type eth netdev optical3 flavour physical
>>number
>>>>3
>>>>>> >mdio_bus/0.4:00/4: type eth netdev optical4 flavour physical
>>number
>>>>4
>>>>>> >mdio_bus/0.4:00/5: type notset
>>>>>> >mdio_bus/0.4:00/6: type notset
>>>>>> >mdio_bus/0.4:00/7: type notset
>>>>>> >mdio_bus/0.4:00/8: type notset
>>>>>> >mdio_bus/0.4:00/9: type notset flavour dsa number 9
>>>>>
>>>>>> That is basically front panel number for physical ports.
>>>>>
>>>>>You cannot make that assumption. As you can see here, we have 3
>>ports
>>>>>with the number 0.
>>>>>
>>>>>Look at clearfog, armada-388-clearfog.dts. port 0=lan5, port 1=lan4
>>>>>port 2=lan3, port 3=lan2, port 4=lan1, port 5=cpu, port 6=lan6.
>>>>>
>>>>>The hardware and mechanical engineer is free to wire switch ports to
>>>>>the front panel however they want. That is why we put the netdev
>>name
>>>>>in device tree.
>>>>
>>>>Got it. Hmm, so I think that the port number can be made optional and
>>>>when it is present, it would be used to generate phys_port_name. If
>>>>not, perhaps devlink port index could be used instead.
>>>>
>>>>So iiuc, you don't really need phys_port_name in dsa, as it provides
>>>>misleading names, right? Why is it implemented then?
>>>
>>>We do need phys_port_name because there are switch configuration
>>operations, e.g: ethtool::rxnfc which take a port number and queue
>>number as part of the action to redirect a packet for instance. There
>>is no way to obtain this physical port number other than either knowing
>>it and hard coding it (not great) or scanning the device tree and look
>>for the "reg" property value. phys_port_name gets you that and it is
>>easy for an application to scan /sys/class/net/ on startup to get to
>>know that (and other stuff as well).
>>
>>Hmm. That sounds like misuse of phys_port_name. The original purpose
>>was
>>to provide names as they are actually written on the front panel.
>
>Ok, if we look back at the history of the changes I had implemented ndo_phys_port_id() to return the port number initially, but this was wrong and reverted based on your feedback, and then ndo_phys_port_name() was implemented with your reviewed-by tag:
>
>https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/net/dsa/slave.c?id=3a543ef479868e36c95935de320608a7e41466ca
>https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/net/dsa/slave.c?id=592050b2541407d033da18226d3644644832d082
>https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/net/dsa/slave.c?id=592050b2541407d033da18226d3644644832d082
>
>Now that this is reported through sysfs it unfortunately becomes ABI and we should not be breaking user applications relying on that and there is at least one I know of...
>
>What is an appropriate attribute to use to return the physical port number within a given switch?
I don't think there's one out there. I tried to add it in this patchset.
next prev parent reply other threads:[~2018-03-24 17:42 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-22 10:55 [patch net-next RFC 00/12] devlink: introduce port flavours and common phys_port_name generation Jiri Pirko
2018-03-22 10:55 ` [patch net-next RFC 01/12] devlink: introduce devlink_port_attrs_set Jiri Pirko
2018-03-22 10:55 ` [patch net-next RFC 02/12] devlink: extend attrs_set for setting port flavours Jiri Pirko
2018-03-23 3:36 ` Jakub Kicinski
2018-03-23 6:30 ` Jiri Pirko
2018-03-22 10:55 ` [patch net-next RFC 03/12] devlink: introduce a helper to generate physical port names Jiri Pirko
2018-03-22 10:55 ` [patch net-next RFC 04/12] dsa: set devlink port attrs for dsa ports Jiri Pirko
2018-03-23 13:19 ` Andrew Lunn
2018-03-23 13:30 ` Andrew Lunn
2018-03-23 14:49 ` Jiri Pirko
2018-03-23 17:09 ` Florian Fainelli
2018-03-24 7:28 ` Jiri Pirko
2018-05-17 14:02 ` Jiri Pirko
2018-05-17 14:08 ` Florian Fainelli
2018-05-17 14:30 ` Jiri Pirko
2018-05-17 14:48 ` Andrew Lunn
2018-05-17 16:37 ` Jiri Pirko
2018-05-17 14:51 ` Florian Fainelli
2018-05-17 17:39 ` Jiri Pirko
2018-05-17 19:14 ` Florian Fainelli
2018-05-17 20:28 ` Andrew Lunn
2018-05-17 20:48 ` Jiri Pirko
2018-05-17 21:08 ` Andrew Lunn
2018-05-17 22:06 ` Florian Fainelli
2018-05-17 22:40 ` Andrew Lunn
2018-05-17 22:45 ` Florian Fainelli
2018-05-18 1:41 ` Andrew Lunn
2018-05-18 6:37 ` Jiri Pirko
2018-05-18 13:45 ` Andrew Lunn
2018-05-19 3:11 ` Florian Fainelli
2018-05-18 6:55 ` Jiri Pirko
2018-03-22 10:55 ` [patch net-next RFC 05/12] dsa: use devlink helper to generate physical port name Jiri Pirko
2018-03-22 10:55 ` [patch net-next RFC 06/12] mlxsw: " Jiri Pirko
2018-03-22 10:55 ` [patch net-next RFC 07/12] nfp: flower: fix error path during representor creation Jiri Pirko
2018-03-22 10:55 ` [patch net-next RFC 08/12] nfp: set eth_id for representors to avoid port index conflict Jiri Pirko
2018-03-22 10:55 ` [patch net-next RFC 09/12] nfp: register devlink port for VF/PF representors Jiri Pirko
2018-03-22 10:55 ` [patch net-next RFC 10/12] nfp: flower: create port for flower vnic Jiri Pirko
2018-03-23 3:38 ` Jakub Kicinski
2018-03-23 6:29 ` Jiri Pirko
2018-03-24 3:32 ` Jakub Kicinski
2018-03-24 7:41 ` Jiri Pirko
2018-03-22 10:55 ` [patch net-next RFC 11/12] nfp: use devlink helper to generate physical port name Jiri Pirko
2018-03-22 10:55 ` [patch net-next RFC 12/12] nfp: flower: set sysfs link to device for representors Jiri Pirko
2018-03-22 14:40 ` [patch net-next RFC 00/12] devlink: introduce port flavours and common phys_port_name generation Roopa Prabhu
2018-03-22 14:58 ` Jiri Pirko
2018-03-22 15:34 ` David Ahern
2018-03-22 15:51 ` Roopa Prabhu
2018-03-22 17:49 ` Jiri Pirko
2018-03-22 19:10 ` David Ahern
2018-03-22 19:25 ` Andy Gospodarek
2018-05-17 8:47 ` Jiri Pirko
2018-03-23 6:34 ` Jiri Pirko
2018-03-22 23:35 ` Andrew Lunn
2018-03-23 6:35 ` [patch iproute2 rfc 1/2] devlink: introduce support for showing port flavours Jiri Pirko
2018-03-27 15:28 ` Stephen Hemminger
2018-03-23 6:35 ` [patch iproute2 rfc 2/2] devlink: introduce support for showing port number and split subport number Jiri Pirko
2018-03-23 3:34 ` [patch net-next RFC 00/12] devlink: introduce port flavours and common phys_port_name generation Jakub Kicinski
2018-03-23 6:37 ` Jiri Pirko
2018-03-23 13:43 ` Andrew Lunn
2018-03-23 14:59 ` Jiri Pirko
2018-03-23 15:24 ` Andrew Lunn
2018-03-24 7:45 ` Jiri Pirko
2018-03-24 14:35 ` Florian Fainelli
2018-03-24 16:07 ` Jiri Pirko
2018-03-24 17:07 ` Florian Fainelli
2018-03-24 17:42 ` Jiri Pirko [this message]
2018-03-24 19:00 ` Andrew Lunn
2018-03-24 20:05 ` Florian Fainelli
2018-03-24 14:40 ` Andrew Lunn
2018-03-24 16:04 ` Jiri Pirko
2018-03-28 5:02 ` Stephen Hemminger
2018-03-28 6:17 ` Jiri Pirko
2018-04-17 13:23 ` Or Gerlitz
2018-04-17 23:42 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180324174248.GH1891@nanopsycho \
--to=jiri@resnulli.us \
--cc=alexander.h.duyck@intel.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=dirk.vandermerwe@netronome.com \
--cc=dsahern@gmail.com \
--cc=eranbe@mellanox.com \
--cc=f.fainelli@gmail.com \
--cc=felix.manlunas@cavium.com \
--cc=ganeshgr@chelsio.com \
--cc=gospo@broadcom.com \
--cc=idosch@mellanox.com \
--cc=jakub.kicinski@netronome.com \
--cc=jeffrey.t.kirsher@intel.com \
--cc=john.hurley@netronome.com \
--cc=michael.chan@broadcom.com \
--cc=mlxsw@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
--cc=pieter.jansenvanvuuren@netronome.com \
--cc=raghu.vatsavayi@cavium.com \
--cc=saeedm@mellanox.com \
--cc=satananda.burla@cavium.com \
--cc=sathya.perla@broadcom.com \
--cc=simon.horman@netronome.com \
--cc=tariqt@mellanox.com \
--cc=vasundhara-v.volam@broadcom.com \
--cc=vijaya.guvva@cavium.com \
--cc=vivien.didelot@savoirfairelinux.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox