netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, "Jakub Kicinski" <kuba@kernel.org>,
	"Eric Dumazet" <edumazet@google.com>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Heiner Kallweit" <hkallweit1@gmail.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"Vladimir Oltean" <vladimir.oltean@nxp.com>,
	"Oleksij Rempel" <linux@rempel-privat.de>,
	"Nicolò Veronese" <nicveronese@gmail.com>,
	thomas.petazzoni@bootlin.com,
	"Christophe Leroy" <christophe.leroy@csgroup.eu>
Subject: Re: [RFC PATCH net-next 1/7] net: phy: introduce phy numbering and phy namespaces
Date: Tue, 12 Sep 2023 19:01:29 +0200	[thread overview]
Message-ID: <20230912190129.21e65690@fedora> (raw)
In-Reply-To: <63bd3a9c-dacd-47e3-a34c-6e2e6a304d6c@lunn.ch>

Hello Andrew,

On Tue, 12 Sep 2023 18:15:52 +0200
Andrew Lunn <andrew@lunn.ch> wrote:

> On Thu, Sep 07, 2023 at 11:23:59AM +0200, Maxime Chevallier wrote:
> > Link topologies containing multiple network PHYs attached to the same
> > net_device can be found when using a PHY as a media converter for use
> > with an SFP connector, on which an SFP transceiver containing a PHY can
> > be used.
> > 
> > With the current model, the transceiver's PHY can't be used for
> > operations such as cable testing, timestamping, macsec offload, etc.
> > 
> > The reason being that most of the logic for these configuration, coming
> > from either ethtool netlink or ioctls tend to use netdev->phydev, which
> > in multi-phy systems will reference the PHY closest to the MAC.
> > 
> > Introduce a numbering scheme allowing to enumerate PHY devices that
> > belong to any netdev, which can in turn allow userspace to take more
> > precise decisions with regard to each PHY's configuration.  
> 
> I think we need more than a number. Topology needs to be a core
> concept here, otherwise how is the user supposed to know which PHY to
> use cable test on, etc.
> 
> However, it is not a simple problem. An SFP PHY should be the last in
> a chain. So you can infer something from that. When we start adding
> MII muxes, they will need to be part of the modal.

You raise a good point, we need to set a cursor on the level of detail
we want to have to describe the topology indeed.

I do have a patch that adds a notion of topology by keeping track of
the upstream device of each link component (either the ethernet
controller, another PHY, a mux, and SFP cage), but I got carried away
trying to find the correct granularity.

For example, say we have a PCS with a dedicated driver in the chain,
should it be part of the topology ? or do we stick to MAC, PHY, MUX,
SFP ?

To address the topology and more specifically cable-testing, I relied
on adding support for a phy_port, that would represent front-facing
ports, each PHY would have zero, one or more phy_ports, and from
userspace perspective, we would let user pick which port to use, then
have kernel-side logic to either deal with PHYs that have 2 ports, or
an actual mii mux with two single-port PHYs.

All in all for cable-testing, this solves the problem, as we could
include a way for users to know which PHY is attached to a port, and
therefore users could know which PHY is the outermost one.

However, it's not sufficient for things like timestamping. I think you
mentionned in another thread that there can be up to 7 devices that
could do the timestamping, and here it could be interesting to know
which is where, so that user can for example pick a PHY that has a
precise timestamping unit but that is also close-enough to the physical
port.

In that case, I will include what I have for topology description in
the next RFC.

Thanks for the insightful feedback,

Maxime

>     Andrew


  reply	other threads:[~2023-09-12 17:01 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-07  9:23 [RFC PATCH net-next 0/7] net: phy: introduce phy numbering Maxime Chevallier
2023-09-07  9:23 ` [RFC PATCH net-next 1/7] net: phy: introduce phy numbering and phy namespaces Maxime Chevallier
2023-09-07  9:32   ` Russell King (Oracle)
2023-09-07 10:14   ` Russell King (Oracle)
2023-09-07 12:19     ` Maxime Chevallier
2023-09-08 15:36       ` Jakub Kicinski
2023-09-11 13:05         ` Maxime Chevallier
2023-09-12 15:41   ` Andrew Lunn
2023-09-12 16:10     ` Maxime Chevallier
2023-09-12 17:08       ` Florian Fainelli
2023-09-12 16:15   ` Andrew Lunn
2023-09-12 17:01     ` Maxime Chevallier [this message]
2023-09-07  9:24 ` [RFC PATCH net-next 2/7] net: sfp: pass the phy_device when disconnecting an sfp module's PHY Maxime Chevallier
2023-09-07  9:24 ` [RFC PATCH net-next 3/7] net: phy: add helpers to handle sfp phy connect/disconnect Maxime Chevallier
2023-09-07  9:24 ` [RFC PATCH net-next 4/7] net: ethtool: add a netlink command to list PHYs Maxime Chevallier
2023-09-07 10:00   ` Russell King (Oracle)
2023-09-07 12:16     ` Maxime Chevallier
2023-09-12 16:01       ` Andrew Lunn
2023-09-12 16:29   ` Andrew Lunn
2023-09-07  9:24 ` [RFC PATCH net-next 5/7] netlink: specs: add phy_list command Maxime Chevallier
2023-09-07  9:24 ` [RFC PATCH net-next 6/7] net: ethtool: add a netlink command to get PHY information Maxime Chevallier
2023-09-07 10:04   ` Russell King (Oracle)
2023-09-07 12:20     ` Maxime Chevallier
2023-09-08 15:42   ` Jakub Kicinski
2023-09-08 15:46   ` Jakub Kicinski
2023-09-14  9:36     ` Maxime Chevallier
2023-10-03 13:55       ` Jakub Kicinski
2023-10-03 18:26         ` Andrew Lunn
2023-09-07  9:24 ` [RFC PATCH net-next 7/7] netlink: specs: add command to show individual phy information Maxime Chevallier
2023-09-08 15:41 ` [RFC PATCH net-next 0/7] net: phy: introduce phy numbering Jakub Kicinski
2023-09-11 13:09   ` Maxime Chevallier
2023-09-12 15:36 ` Andrew Lunn
2023-09-12 15:51   ` Maxime Chevallier
2023-09-14 10:06 ` Christophe Leroy
2023-09-14 12:47   ` Andrew Lunn

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=20230912190129.21e65690@fedora \
    --to=maxime.chevallier@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=christophe.leroy@csgroup.eu \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=linux@rempel-privat.de \
    --cc=netdev@vger.kernel.org \
    --cc=nicveronese@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vladimir.oltean@nxp.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;
as well as URLs for NNTP newsgroup(s).