From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: "Nicolò Veronese" <nicveronese@gmail.com>
Cc: 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, andrew@lunn.ch, edumazet@google.com,
hkallweit1@gmail.com, kuba@kernel.org, pabeni@redhat.com,
nbd@nbd.name
Subject: Re: [RFC] RJ45 to SFP auto-sensing and switching in mux-ed single-mac devices (XOR RJ/SFP)
Date: Tue, 29 Aug 2023 16:38:42 +0100 [thread overview]
Message-ID: <ZO4RAtaoNX6d66mb@shell.armlinux.org.uk> (raw)
In-Reply-To: <CAC8rN+AQUKH1pUHe=bZh+bw-Wxznx+Lvom9iTruGQktGb=FFyw@mail.gmail.com>
On Tue, Aug 29, 2023 at 05:12:48PM +0200, Nicolò Veronese wrote:
> Hi,
>
> I and some folks in CC are working to properly port all the
> functions of a Zyxel ex5601-t0 to OpenWrt.
>
> The manufacturer decided to use a single SerDes connected
> to both an SPF cage and an RJ45 phy. A simple GPIO is
> used to control a 2 Channel 2:1 MUX to switch the two SGMII pairs
> between the RJ45 and the SFP.
>
> ┌─────┐ ┌──────┐ ┌─────────┐
> │ │ │ │ │ │
> │ │ │ ├───┤ SFP │
> │ │ │ │ └─────────┘
> │ │ │ │
> │ MAC ├──┤ MUX │ ┌─────────┐
> │ │ │ │ │ │
> │ │ │ │ │ RJ45 │
> │ │ │ ├───┤ 2.5G PHY│
> │ │ │ │ │ │
> └─────┘ └───▲──┘ └─────────┘
> │
> MUX-GPIO ────┘
This is do-able in software, but is far from a good idea.
Yes, it would be possible to "disconnect" the RJ45 PHY from the netdev,
and switch to the SFP and back again. It would be relatively easy for
phylink to do that. What phylink would need to do is to keep track of
the SFP PHY and netdev-native PHY independently, and multiplex between
the two. It would also have to manage the netdev->phydev pointer.
Any changes to this must be done under the rtnl lock.
So technically it's possible. However, there is no notification to
userspace when such a change may occur. There's also the issue that
userspace may be in the process of issuing ethtool commands that are
affecting one of the PHYs. While holding the rtnl lock will block
those calls, a change between the PHY and e.g. a PHY on the SFP
would cause the ethtool command to target a different PHY from what
was the original target.
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.
IMHO, it needs a bit of thought beyond "what can we do to support a
mux".
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2023-08-29 15:38 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) [this message]
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
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=ZO4RAtaoNX6d66mb@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--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=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 \
/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).