lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221118000124.2754581-1-vladimir.oltean@nxp.com>
Date:   Fri, 18 Nov 2022 02:01:16 +0200
From:   Vladimir Oltean <vladimir.oltean@....com>
To:     netdev@...r.kernel.org
Cc:     "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Andrew Lunn <andrew@...n.ch>,
        Russell King <linux@...linux.org.uk>,
        Florian Fainelli <f.fainelli@...il.com>,
        UNGLinuxDriver@...rochip.com,
        bcm-kernel-feedback-list@...adcom.com,
        Madalin Bucur <madalin.bucur@....nxp.com>,
        Camelia Groza <camelia.groza@....com>,
        Claudiu Manoil <claudiu.manoil@....com>,
        Ioana Ciornei <ioana.ciornei@....com>,
        Maxim Kochetkov <fido_max@...ox.ru>,
        Sean Anderson <sean.anderson@...o.com>,
        Antoine Tenart <atenart@...nel.org>,
        Michael Walle <michael@...le.cc>,
        Raag Jadav <raagjadav@...il.com>,
        Siddharth Vadapalli <s-vadapalli@...com>,
        Ong Boon Leong <boon.leong.ong@...el.com>,
        Colin Foster <colin.foster@...advantage.com>,
        Marek Behun <marek.behun@....cz>
Subject: [PATCH v4 net-next 0/8] Let phylink manage in-band AN for the PHY

Problem statement
~~~~~~~~~~~~~~~~~

The on-board SERDES link between an NXP (Lynx) PCS and a PHY may not
work, depending on whether U-Boot networking was used on that port or not.

There is no mechanism in Linux (with phylib/phylink, at least) to ensure
that the MAC driver and the PHY driver have synchronized settings for
in-band autoneg. It all depends on the 'managed = "in-band-status"'
device tree property, which does not reflect a stable and unchanging
reality, and furthermore, some (older) device trees may have this
property missing when they shouldn't.

Proposed solution
~~~~~~~~~~~~~~~~~

Extend the phy_device API with 2 new methods:
- phy_validate_an_inband()
- phy_config_an_inband()

Extend phylink with an opt-in bool sync_an_inband which makes sure that
the configured "unsigned int mode" (MLO_AN_PHY/MLO_AN_INBAND) is both
supported by the PHY, and actually applied to the PHY.

Make NXP drivers which use phylink and the Lynx PCS driver opt into the
new behavior. Other drivers can trivially do this as well, by setting
struct phylink_config :: sync_an_inband to true.

Compared to other solutions
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sean Anderson, in commit 5d93cfcf7360 ("net: dpaa: Convert to phylink"),
sets phylink_config :: ovr_an_inband to true. This doesn't quite solve
all problems, because we don't *know* that the PHY is set for in-band
autoneg. For example with the VSC8514, it all depends on what the
bootloader has/has not done. This solution eliminates the bootloader
dependency by actually programming in-band autoneg in the VSC8514 PHY.

Change log
~~~~~~~~~~

Changes in v4:
Make all new behavior opt-in.
Fix bug when Generic PHY driver is used.
Dropped support for PHY_AN_INBAND_OFF in at803x.

Changes in v3:
Added patch for the Atheros PHY family.
v3 at:
https://patchwork.kernel.org/project/netdevbpf/cover/20210922181446.2677089-1-vladimir.oltean@nxp.com/

Changes in v2:
Incorporated feedback from Russell, which was to consider PHYs on SFP
modules too, and unify phylink's detection of PHYs with broken in-band
autoneg with the newly introduced PHY driver methods.
v2 at:
https://patchwork.kernel.org/project/netdevbpf/cover/20210212172341.3489046-1-olteanv@gmail.com/

Vladimir Oltean (8):
  net: phylink: let phylink_sfp_config_phy() determine the MLO_AN_* mode
    to use
  net: phylink: introduce generic method to query PHY in-band autoneg
    capability
  net: phy: bcm84881: move the in-band capability check where it belongs
  net: phylink: add option to sync in-band autoneg setting between PCS
    and PHY
  net: phylink: explicitly configure in-band autoneg for on-board PHYs
  net: phy: mscc: configure in-band auto-negotiation for VSC8514
  net: phy: at803x: validate in-band autoneg for AT8031/AT8033
  net: opt MAC drivers which use Lynx PCS into phylink sync_an_inband

 drivers/net/dsa/ocelot/felix.c                |  2 +
 .../net/ethernet/freescale/dpaa2/dpaa2-mac.c  |  1 +
 .../net/ethernet/freescale/enetc/enetc_pf.c   |  1 +
 .../net/ethernet/freescale/fman/fman_memac.c  | 16 +--
 drivers/net/phy/at803x.c                      | 10 ++
 drivers/net/phy/bcm84881.c                    | 10 ++
 drivers/net/phy/mscc/mscc.h                   |  2 +
 drivers/net/phy/mscc/mscc_main.c              | 21 ++++
 drivers/net/phy/phy.c                         | 51 ++++++++++
 drivers/net/phy/phylink.c                     | 97 +++++++++++++++----
 include/linux/phy.h                           | 27 ++++++
 include/linux/phylink.h                       |  7 ++
 12 files changed, 212 insertions(+), 33 deletions(-)

-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ