Subject: Re: [PATCH RFC russell-king 3/4] net: phy: marvell10g: change MACTYPE according to phydev->interface

From: Russell King - ARM Linux admin <[email-masked]>
Date: Wed, 12 Aug 2020 17:01:31 +0100

On Wed, Aug 12, 2020 at 05:37:16PM +0200, Marek Behún wrote:
> On Wed, 12 Aug 2020 16:00:54 +0100
> Russell King - ARM Linux admin <[email-masked]> wrote:
> 
> > On Wed, Aug 12, 2020 at 04:44:31PM +0200, Marek Behún wrote:
> > > There is another problem though: I think the PHY driver, when
> > > deciding whether to set MACTYPE from the XFI with rate matching
> > > mode to the 10GBASE-R/5GBASE-R/2500BASE-X/SGMII with AN mode,
> > > should check which modes the underlying MAC support.  
> > 
> > I'm aware of that problem.  I have some experimental patches which add
> > PHY interface mode bitmaps to the MAC, PHY, and SFP module parsing
> > functions.  I have stumbled on some problems though - it's going to be
> > another API change (and people are already whinging about the phylink
> > API changing "too quickly", were too quickly seems to be defined as
> > once in three years), and in some cases, DSA, it's extremely hard to
> > work out how to properly set such a bitmap due to DSA's layered
> > approach.
> > 
> 
> If by your experimental patches you mean
>   net: mvneta: fill in phy interface mode bitmap
>   net: mvpp2: fill in phy interface mode bitmap
> found here
>   http://git.arm.linux.org.uk/cgit/linux-arm.git/log/?h=clearfog
> I am currently working on top of them.

That's fine, because you also have the patches further down in
net-queue.  So, what you list above are basically not all the patches.

net: mvpp2: fill in phy interface mode bitmap
net: mvneta: fill in phy interface mode bitmap
net: phylink: use phy interface mode bitmaps
net: sfp: add interface bitmap
net: phy: add supported_interfaces to marvell10g PHYs
net: phy: add supported_interfaces to marvell PHYs
net: phy: add supported_interfaces to bcm84881
net: phy: add supported_interfaces to phylib

Now, I think there's going to be a problem - if you look at the phylink
code for this, we assume that the supported_interfaces we get from
phylib is what the PHY will be doing.  However, if we then go and change
the interface mode, what then...

I guess if we rework it along the lines that I've mentioned - phylib
is passed the MAC supported interfaces, and phylib/phy drivers choose
which interface to use, then I guess we no longer need to specify to
phylib what interface mode should be used (what do we then do with
the DT phy-mode property?) and we don't need some of the logic in
"net: phylink: use phy interface mode bitmaps".

Please note that it's been a number of months since I last looked at
this, so I may be rusty - it's also rediculously sweltering hot over
here in the UK right now, so I may not be thinking straight... (which
is probably why I forgot to reply to your above point.)

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!