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: "Russell King (Oracle)" <linux@armlinux.org.uk>,
	"Nicolò Veronese" <nicveronese@gmail.com>,
	netdev@vger.kernel.org, simonebortolin@hack-gpon.org,
	nanomad@hack-gpon.org, "Federico Cappon" <dududede371@gmail.com>,
	daniel@makrotopia.org, lorenzo@kernel.org, ftp21@ftp21.eu,
	pierto88@hack-gpon.org, hitech95@hack-gpon.org,
	davem@davemloft.net, edumazet@google.com, hkallweit1@gmail.com,
	kuba@kernel.org, pabeni@redhat.com, nbd@nbd.name,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>
Subject: Re: [RFC] RJ45 to SFP auto-sensing and switching in mux-ed single-mac devices (XOR RJ/SFP)
Date: Mon, 4 Sep 2023 08:06:43 +0200	[thread overview]
Message-ID: <20230904080643.77678736@pc-7.home> (raw)
In-Reply-To: <dcb34edd-a7ca-429a-896d-0f056ce02056@lunn.ch>

Hello everyone,

On Mon, 4 Sep 2023 00:51:05 +0200
Andrew Lunn <andrew@lunn.ch> wrote:

> > To solve that sanely, every PHY-based ethtool probably needs a way
> > to specify which PHY the command is intended for, but then there's
> > the question of how userspace users react to that - because it's
> > likely more than just modifying the ethtool utility, ethtool
> > commands are probably used from many programs.  
> 
> This idea of extending ethtool with a PHY ID has discussed last
> year. It helps solve some of the problems discussed here. You can then
> enumerate all the PHYs connected to a MAC, and operate on each PHY
> independently.
> 
> https://lore.kernel.org/netdev/20221017105100.0cb33490@pc-8.home/

Indeed and I'm actively working on this right now, I have an RFC series
that'll be sent during the week, I'll make sure to CC everyone.

As stated this isn't an easy problem, my course of action is the
following to address this : 

 - First allow addressing individual PHYs attached to the same netdev,
without taking the mux into consideration for now. There are already
cases where several PHYs are attached to one MAC, which is when we have
a PHY between the MAC and SFP port, and a PHY in the SFP module.

As Russell said, there are some ethtool operations today that target
PHYs (cable testing, plca, but more importantly maybe timestamping).
With PHY addressing, we could imagine using the SFP's PHY for
timestamping.

The RFC will be strictly about that, adding the ability to list PHYs
(including th ones in SFP modules), get information on them, but the
main part really is about that id, that we can use in subsequent
commands. I'm also adding a netlink notification upon PHY
hotplugging/removal.

For the actual muxing my current idea is to better model the PHY port,
and allow userspace to pick which port to use (or auto-switch). The
reasonning is that there are a lot of topologies that lead to this
situation : 

 - Your case, with a real mux, switchign between 1 PHY and 1 SFP port :

                 /-- PHY -- RJ45 (8P8C)
   MAC --- mux --|
                 \-- SFP ( -- PHY ) -- RJ45/Fiber

 - PHYs that have an internal mux (the 88x3310 for example, or some
ports of the 88e6390X switch) :

                /-- RJ45
   MAC -- PHY --|
                \-- SFP -- RJ45/Fiber


 - Finally we have products in the wild using a pure-software mux :

        /-- PHY -- RJ45
  MAC --|
        \-- PHY -- RJ45

(muxing is done by putting one of the 2 PHYs in isolate mode).

I think for userspace, it would be better to directly configure which
front-facing port they want to see being used, and the current
representation of PORT_TP/PORT_FIBRE/etc. doesn't give enough details
about that. So I would add the phy_port enumeration (using the PHY id
previously introduced, each PHY would report the ports they have), then
muxing capability. I think we would have a pretty good overview
of the real topology at that point.

This is challenging, and will probably take quite some iterations to
get it right, as there are lots of things to consider, but hopefully 
as this subject is gaining traction (there are already a few people
interested in supporting such a thing) we can make it work.

Thanks,

Maxime


> 	Andrew
> 


      reply	other threads:[~2023-09-04  6:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-29 15:12 [RFC] RJ45 to SFP auto-sensing and switching in mux-ed single-mac devices (XOR RJ/SFP) Nicolò Veronese
2023-08-29 15:38 ` Russell King (Oracle)
2023-08-29 17:37   ` Daniel Golle
2023-08-29 18:04     ` Russell King (Oracle)
2023-08-31  1:04   ` Jakub Kicinski
2023-09-03 22:51   ` Andrew Lunn
2023-09-04  6:06     ` Maxime Chevallier [this message]

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=20230904080643.77678736@pc-7.home \
    --to=maxime.chevallier@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=dududede371@gmail.com \
    --cc=edumazet@google.com \
    --cc=ftp21@ftp21.eu \
    --cc=hitech95@hack-gpon.org \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lorenzo@kernel.org \
    --cc=nanomad@hack-gpon.org \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=nicveronese@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=pierto88@hack-gpon.org \
    --cc=simonebortolin@hack-gpon.org \
    --cc=thomas.petazzoni@bootlin.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).