mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Romain Gantois <romain.gantois@bootlin.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 5/6] net: phy: dp83869: Support SGMII SFP modules
Date: Tue, 2 Jul 2024 16:56:28 +0200	[thread overview]
Message-ID: <20240702165628.273d7f11@fedora-5.home> (raw)
In-Reply-To: <b3ff54a1-5242-46d7-8d9d-d469c06a7f7b@lunn.ch>

Hello Andrew,

On Tue, 2 Jul 2024 15:21:09 +0200
Andrew Lunn <andrew@lunn.ch> wrote:

> On Tue, Jul 02, 2024 at 10:11:07AM +0200, Romain Gantois wrote:
> > Hello Andrew, thanks for the review!
> > 
> > I think this particular patch warrants that I explain myself a bit more.
> > 
> > Some SGMII SFP modules will work fine once they're inserted and the appropriate 
> > probe() function has been called by the SFP PHY driver. However, this is not 
> > necessarily the case, as some SFP PHYs require further configuration before the 
> > link can be brought up (e.g. calling phy_init_hw() on them which will 
> > eventually call things like config_init()).
> > 
> > This configuration usually doesn't happen before the PHY device is attached to 
> > a network device. In this case, the DP83869 PHY is placed between the MAC and 
> > the SFP PHY. Thus, the DP83869 is attached to a network device while the SFP 
> > PHY is not. This means that the DP83869 driver basically takes on the role of 
> > the MAC driver in some aspects.
> > 
> > In this patch, I used the connect_phy() callback as a way to get a handle to 
> > the downstream SFP PHY. This callback is only implemented by phylink so far.
> > 
> > I used the module_start() callback to initialize the SFP PHY hardware and 
> > start it's state machine.  
> 
> The SFP PHY is however a PHY which phylib is managing. And you have
> phylink on top of that, which knows about both PHYs. Architecturally,
> i really think phylink should be dealing with all this
> configuration.
> 
> The MAC driver has told phylink its pause capabilities.
> phylink_bringup_phy() will tell phylib these capabilities by calling
> phy_support_asym_pause(). Why does this not work for the SFP PHY?
> 
> phylink knows when the SFP PHY is plugged in, and knows if the link is
> admin up. It should be starting the state machine, not the PHY.

When the SFP upstream is a PHY, phylink isn't involved in managing the
SFP PHY, only the sfp-bus.c code will, using the SFP upstream ops, for
which phylink is one possible provider. When phylink is the SFP
upstream, it does all the mod_phy handling, so other upstream_ops
providers should also do the same.

But I do agree with you in that this logic should not belong to any
specific PHY driver, and be made generic. phylink is one place to
implement that indeed, but so far phylink can't manage both PHYs on the
link (if I'm not mistaken). I don't know how this all fits in phylink
itself, or if this should rather be some phylib / sfp-bus helpers and
extra plumbing to ease writing phy drivers that do SFP and want to
better manage the module PHY.

If I'm not mistaken, Romain's setup uses a MAC that doesn't even use
phylink yet (but the porting guide was updated recently fortunately ;) )

> 
> Do you have access to a macchiatobin? I suggest you play with one, see
> how the marvell PHY driver works when you plug in a copper SFP module.

On my side I have access to one, but it's hard to tell as the 3310 only
really supports 10G copper SFPs so far and I only have one. However from
testing on other boards, it looks like when a PHY is acting as
upstream, copper SFP will work when their default behaviour is to start
autoneg, link establishment and so on automatically when inserted.

The behaviour is currently not consistent between systems that have
phylink as the SFP upstream (no media converter) and systems that have
a media converter.

I think Romain has tested the platform he's using for this series with
multiple copper SFPs, some will work fine, and some just don't. Same
copper SFP work just fine when used on systems that have a straight
MAC <-> SFP link managed by phylink.

Maxime

  reply	other threads:[~2024-07-02 14:56 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-01  8:51 [PATCH net-next 0/6] net: phy: dp83869: Add support for downstream SFP cages Romain Gantois
2024-07-01  8:51 ` [PATCH net-next 1/6] net: phy: dp83869: Disable autonegotiation in RGMII/1000Base-X mode Romain Gantois
2024-07-01 16:40   ` Andrew Lunn
2024-07-02  8:44     ` Romain Gantois
2024-07-02  9:24       ` Russell King (Oracle)
2024-07-02  9:42         ` Romain Gantois
2024-07-02 10:15           ` Russell King (Oracle)
2024-07-02 13:01             ` Romain Gantois
2024-07-01  8:51 ` [PATCH net-next 2/6] net: phy: dp83869: Perform software restart after configuring op mode Romain Gantois
2024-07-01 16:44   ` Andrew Lunn
2024-07-02  8:45     ` Romain Gantois
2024-07-01  8:51 ` [PATCH net-next 3/6] net: phy: dp83869: Ensure that the FORCE_LINK_GOOD bit is cleared Romain Gantois
2024-07-01  8:51 ` [PATCH net-next 4/6] net: phy: dp83869: Support 1000Base-X and 100Base-FX SFP modules Romain Gantois
2024-07-01 16:49   ` Andrew Lunn
2024-07-01  8:51 ` [PATCH net-next 5/6] net: phy: dp83869: Support SGMII " Romain Gantois
2024-07-01 17:00   ` Andrew Lunn
2024-07-02  8:11     ` Romain Gantois
2024-07-02 13:21       ` Andrew Lunn
2024-07-02 14:56         ` Maxime Chevallier [this message]
2024-07-02 18:13           ` Russell King (Oracle)
2024-07-02 19:55             ` Andrew Lunn
2024-07-02 15:18         ` Russell King (Oracle)
2024-07-01  8:51 ` [PATCH net-next 6/6] net: phy: dp83869: Fix link up reporting in SGMII bridge mode Romain Gantois
2024-07-01 17:09   ` Andrew Lunn
2024-07-02  9:04     ` Romain Gantois
2024-07-02  9:28       ` Russell King (Oracle)

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=20240702165628.273d7f11@fedora-5.home \
    --to=maxime.chevallier@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=romain.gantois@bootlin.com \
    --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

all inboxes | Powered by JetHome®