[PATCH net-next 0/15] Add and use helper for PCS negotiation modes

Vladimir Oltean olteanv at gmail.com
Fri Jun 16 08:00:55 PDT 2023


On Fri, Jun 16, 2023 at 01:05:52PM +0100, Russell King (Oracle) wrote:
> Hi,
> 
> Earlier this month, I proposed a helper for deciding whether a PCS
> should use inband negotiation modes or not. There was some discussion
> around this topic, and I believe there was no disagreement about
> providing the helper.
> 
> The initial discussion can be found at:
> 
> https://lore.kernel.org/r/ZGIkGmyL8yL1q1zp@shell.armlinux.org.uk
> 
> Subsequently, I posted a RFC series back in May:
> 
> https://lore.kernel.org/r/ZGzhvePzPjJ0v2En@shell.armlinux.org.uk
> 
> that added a helper, phylink_pcs_neg_mode() which PCS drivers could use
> to parse the state, and updated a bunch of drivers to use it. I got
> a couple of bits of feedback to it, including some ACKs.
> 
> However, I've decided to take this slightly further and change the
> "mode" parameter to both the pcs_config() and pcs_link_up() methods
> when a PCS driver opts in to this (by setting "neg_mode" in the
> phylink_pcs structure.) If this is not set, we default to the old
> behaviour. That said, this series converts all the PCS implementations
> I can find currently in net-next.
> 
> Doing this has the added benefit that the negotiation mode parameter
> is also available to the pcs_link_up() function, which can now know
> whether inband negotiation was in fact enabled or not at pcs_config()
> time.
> 
> It has been posted as RFC at:
> 
> https://lore.kernel.org/r/ZIh/CLQ3z89g0Ua0@shell.armlinux.org.uk
> 
> and received one reply, thanks Elad, which is a similar amount of
> interest to previous postings. Let's post it as non-RFC and see
> whether we get more reaction.

Sorry, I was in the process of reviewing the RFC, but I'm not sure I
know what to ask to make sure that I understand the motivation :-/
Here's a question that might or might not result in a code change.

In the single-patch RFC at:
https://lore.kernel.org/all/ZGIkGmyL8yL1q1zp@shell.armlinux.org.uk/
you bring sparx5 and lan966x as a motivation for introducing
PHYLINK_PCS_NEG_OUTBAND as separate from PHYLINK_PCS_NEG_INBAND_DISABLED,
with both meaning that in-band autoneg isn't used, but in the former
case it's not enabled at all, while in the latter it's disabled through
ethtool (if I get that right?).

I've opened the Sparx5 documentation at:
https://ww1.microchip.com/downloads/en/DeviceDoc/SparX-5_Family_L2L3_Enterprise_10G_Ethernet_Switches_Datasheet_00003822B.pdf
and also cross-checked with the PCS1G documentation from VSC7514
(Ocelot: https://ww1.microchip.com/downloads/en/DeviceDoc/VMDS-10491.pdf,
there's another embedded PDF with registers at page 283), trying to find
exactly what the PCS1G_MODE_CFG.SGMII_MODE_ENA field does (which is
controlled in sparx5 and lan966x based on the presence or absence of the
managed = "in-band-status" property).

Do you know for sure what this bit does and whether it makes sense for
drivers to even distinguish between OUTBAND and INBAND_DISABLED in the
way that this series is proposing?

It's hard to know for sure, not having the hardware, but I believe that
the bit selects between the SGMII and the 1000Base-X control word
format (so, even though there's a dedicated and fully programmable
PCS1G_ANEG_CFG.ADV_ABILITY register, the link partner ability is still
decoded as per the programmed expected format). The documents talk about
using the PCS in "SGMII mode" vs "1000BASE-X SERDES mode".

If that's the case, then it is selecting between those 2 based on
phylink_autoneg_inband(mode) and irrespective of the phy-mode, i.e.:

- enabling the SGMII control word format for phy-mode = "1000base-x" and
  no managed = "in-band-status", or
- enabling the 1000Base-X control word format for phy-mode = "sgmii" and
  managed = "in-band-status"

...is that a model to follow?



More information about the linux-arm-kernel mailing list