Subject: Re: russell's net-queue question

From: Russell King - ARM Linux admin <[email-masked]>
Date: Tue, 20 Oct 2020 16:45:15 +0100

On Tue, Oct 20, 2020 at 05:15:39PM +0200, Marek Behún wrote:
> Russell,
> 
> I think the following commits in your net-queue should be still made better:
> 
> 7f79709b7a15 ("net: phy: pass supported PHY interface types to phylib")
> eba49a289d09 ("net: phy: marvell10g: select host interface configuration")
> 
> http://git.arm.linux.org.uk/cgit/linux-arm.git/commit/?h=net-queue&id=eba49a289d0959eab3dfbc0320334eb5a855ca68
> http://git.arm.linux.org.uk/cgit/linux-arm.git/commit/?h=net-queue&id=eba49a289d0959eab3dfbc0320334eb5a855ca68
> 
> The first one adds filling of the phydev->host_interfaces bitmap into
> the phylink_sfp_connect_phy function. It should also fill this bitmap
> in functions phylink_connect_phy and phylink_of_phy_connect (direct
> copy of pl->config->supported_interfaces).

First, the whole way interfaces are handled is really not good, even
with the addition of the interfaces bitmap. However, it tries to solve
at least some of the issues.

Secondly, what should we fill this in with?

Do we fill it with the firmware specified phy-mode setting? Or all the
capabilities of the network driver's interface? What if the network
driver supports RGMII/SGMII/10GBASE-R/etc but not all of these are
wired?

We really don't want the PHY changing what was configured via hardware
when it's "built in", because it's ambiguous in a very many situations
which mode should be selected. If we take the view that the firmware
specified phy-mode should only be specified, then the 88X3310 will
switch to MACTYPE=6 instead of 4 on the Macchiatobin, which is the rate
adaption mode - and this will lead to lost packets (it's a plain
88X3310 without the MACSEC, so the PHY is not capable of generating
flow control packets to pace the host.)

> The reason is that phy devices may want to know what interfaces are
> supported by host even if no SFP is used (Marvell 88X3310 is an exmaple
> of this).

If a SFP is not being used, then the connectivity is described via DT
and the hardware configuration of the PHY (which we rely on for the
88X3310.) I don't see much of a solution to that for the 88X3310.
If DT describes the interface mode as 10gbase-r, then that ambiguously
could refer to MACTYPE=4,5,6 - the driver can't know.

So, I don't think there is a simple answer here.

> The second patch (adding mactype selection to marvell10g) can get rid
> of the rate matching code, and also
> should update the mv3310_update_interface code accordignly.
> 
> Should I sent you these patches updated or should I create new patches
> on top of yours?

These are experimental, and for the reasons I mention above, they
need careful thought.

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