Commit Graph

266 Commits

Author SHA1 Message Date
Izabela Bakollari 499f17e9c6 net: phylink: Add phylink_set_fixed_link() to configure fixed link state in phylink
JIRA: https://issues.redhat.com/browse/RHEL-57766

commit 4b3fc475c61fa8733a9acc9d743f6cc9ca4915f5
Author: Russell King <linux@armlinux.org.uk>
Date:   Fri Sep 6 16:05:07 2024 +0530

    net: phylink: Add phylink_set_fixed_link() to configure fixed link state in phylink

    The function allows for the configuration of a fixed link state for a given
    phylink instance. This addition is particularly useful for network devices that
    operate with a fixed link configuration, where the link parameters do not change
    dynamically. By using `phylink_set_fixed_link()`, drivers can easily set up
    the fixed link state during initialization or configuration changes.

    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: Russell King <linux@armlinux.org.uk>
    Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-12-10 13:40:58 +01:00
Izabela Bakollari 7cc6a650d4 net: phy: introduce core support for phy-mode = "10g-qxgmii"
JIRA: https://issues.redhat.com/browse/RHEL-57766

commit 777b8afb8179155353ec14b1d8153122410aba29
Author: Vladimir Oltean <vladimir.oltean@nxp.com>
Date:   Sat Jun 15 20:00:27 2024 +0800

    net: phy: introduce core support for phy-mode = "10g-qxgmii"

    10G-QXGMII is a MAC-to-PHY interface defined by the USXGMII multiport
    specification. It uses the same signaling as USXGMII, but it multiplexes
    4 ports over the link, resulting in a maximum speed of 2.5G per port.

    Some in-tree SoCs like the NXP LS1028A use "usxgmii" when they mean
    either the single-port USXGMII or the quad-port 10G-QXGMII variant, and
    they could get away just fine with that thus far. But there is a need to
    distinguish between the 2 as far as SerDes drivers are concerned.

    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: Luo Jie <quic_luoj@quicinc.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-12-10 13:40:54 +01:00
Izabela Bakollari 81dd788326 net: phylink: rename ovr_an_inband to default_an_inband
JIRA: https://issues.redhat.com/browse/RHEL-57766

Conflicts: fman driver changes not applied

commit 02d00dc73d8d0613f82063ed53d67912a422c21e
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Wed May 29 14:29:29 2024 +0100

    net: phylink: rename ovr_an_inband to default_an_inband

    Since ovr_an_inband no longer overrides every MLO_AN_xxx mode, rename
    it to reflect what it now does - it changes the default mode from
    MLO_AN_PHY to MLO_AN_INBAND. Fix up the two users of this.

    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
    Link: https://lore.kernel.org/r/E1sCJMv-00Ecr1-Sk@rmk-PC.armlinux.org.uk
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-12-10 13:40:51 +01:00
Izabela Bakollari 6bce172cdc net: phylink: move test for ovr_an_inband
JIRA: https://issues.redhat.com/browse/RHEL-57766

commit fea49f065c1cff71a86e7629094f912531edf035
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Wed May 29 14:29:24 2024 +0100

    net: phylink: move test for ovr_an_inband

    Of the two users of phylink_config->ovr_an_inband, both manually check
    for a fixed link before setting this flag (or clearing it if they find
    a fixed link.) This is unnecessary complication.

    Test ovr_an_inband before checking for the fixed-link properties, which
    will allow ovr_an_inband to be overriden by a fixed link specification.

    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
    Link: https://lore.kernel.org/r/E1sCJMq-00Ecqv-P8@rmk-PC.armlinux.org.uk
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-12-10 13:40:51 +01:00
Izabela Bakollari 99662aad3c net: phylink: rearrange phylink_parse_mode()
JIRA: https://issues.redhat.com/browse/RHEL-57766

commit 75518b0dc9d602bdd0e0ee4e04806dff53cb761a
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Wed May 29 14:29:19 2024 +0100

    net: phylink: rearrange phylink_parse_mode()

    Of the two users of phylink_config->ovr_an_inband, both manually check
    for a fixed link before setting this flag (or clearing it if they find
    a fixed link.) This is unnecessary complication.

    Rearrange phylink_parse_mode() a little so we can change how
    phylink_config->ovr_an_inband works. This will allow the flag to be
    tested before checking for the fixed link properties in the next patch.

    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
    Link: https://lore.kernel.org/r/E1sCJMl-00Ecqp-K0@rmk-PC.armlinux.org.uk
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-12-10 13:40:50 +01:00
Izabela Bakollari 64fc5b3304 net: phylink: add debug print for empty posssible_interfaces
JIRA: https://issues.redhat.com/browse/RHEL-57766

commit 0041cd3799e76704a66f0ddd1a374fb77ec94e7f
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Sun Apr 28 15:51:02 2024 +0100

    net: phylink: add debug print for empty posssible_interfaces

    Add a debugging print in phylink_validate_phy() when we detect that the
    PHY has not supplied a possible_interfaces bitmap.

    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Reviewed-by: Daniel Machon <daniel.machon@microchip.com>
    Link: https://lore.kernel.org/r/E1s15rq-00AHye-22@rmk-PC.armlinux.org.uk
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-12-10 13:40:49 +01:00
Izabela Bakollari 13dc6916e3 net: phylink: add rxc_always_on flag to phylink_pcs
JIRA: https://issues.redhat.com/browse/RHEL-57766

commit dceb393a0a8e82ff05b7c1f6c911d0779d856a7a
Author: Romain Gantois <romain.gantois@bootlin.com>
Date:   Tue Mar 26 14:32:08 2024 +0100

    net: phylink: add rxc_always_on flag to phylink_pcs

    Some MAC drivers (e.g. stmmac) require a continuous receive clock signal to
    be generated by a PCS that is handled by a standalone PCS driver.

    Such a PCS driver does not have access to a PHY device, thus cannot check
    the PHY_F_RXC_ALWAYS_ON flag. They cannot check max_requires_rxc in the
    phylink config either, since it is a private member. Therefore, a new flag
    is needed to signal to the PCS that it should keep the RX clock signal up
    at all times.

    Co-developed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://lore.kernel.org/r/20240326-rxc_bugfix-v6-2-24a74e5c761f@bootlin.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-12-10 13:40:45 +01:00
Izabela Bakollari 59b291790a net: phylink: add PHY_F_RXC_ALWAYS_ON to PHY dev flags
JIRA: https://issues.redhat.com/browse/RHEL-57766

commit 21d9ba5bc5516e1d8a90c4a26de90855a1e4fb59
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Tue Mar 26 14:32:07 2024 +0100

    net: phylink: add PHY_F_RXC_ALWAYS_ON to PHY dev flags

    Some MAC controllers (e.g. stmmac) require their connected PHY to
    continuously provide a receive clock signal. This can cause issues in two
    cases:

      1. The clock signal hasn't been started yet by the time the MAC driver
         initializes its hardware. This can make the initialization fail, as in
          the case of the rzn1 GMAC1 driver.
      2. The clock signal is cut during a power saving event. By the time the
         MAC is brought back up, the clock signal is still not active since
         phylink_start hasn't been called yet. This brings us back to case 1.

    If a PHY driver reads this flag, it should ensure that the receive clock
    signal is started as soon as possible, and that it isn't brought down when
    the PHY goes into suspend.

    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    [rgantois: commit log]
    Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://lore.kernel.org/r/20240326-rxc_bugfix-v6-1-24a74e5c761f@bootlin.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-12-10 13:40:45 +01:00
Michal Schmidt 7a4fabad42 net: sfp: pass the phy_device when disconnecting an sfp module's PHY
JIRA: https://issues.redhat.com/browse/RHEL-57751

commit 4d76f115ab9121f4458330da962ae9ef5430e60b
Author: Maxime Chevallier <maxime.chevallier@bootlin.com>
Date:   Wed Aug 21 17:09:56 2024 +0200

    net: sfp: pass the phy_device when disconnecting an sfp module's PHY

    Pass the phy_device as a parameter to the sfp upstream .disconnect_phy
    operation. This is preparatory work to help track phy devices across
    a net_device's link.

    Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
    Tested-by: Christophe Leroy <christophe.leroy@csgroup.eu>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
2024-11-05 11:39:22 +01:00
Michal Schmidt 0dd899a61a net: move ethtool-related netdev state into its own struct
JIRA: https://issues.redhat.com/browse/RHEL-57750

commit 3ebbd9f6de7ec6d538639ebb657246f629ace81e
Author: Edward Cree <ecree.xilinx@gmail.com>
Date:   Thu Jun 27 16:33:46 2024 +0100

    net: move ethtool-related netdev state into its own struct

    net_dev->ethtool is a pointer to new struct ethtool_netdev_state, which
     currently contains only the wol_enabled field.

    Suggested-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
    Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
    Link: https://patch.msgid.link/293a562278371de7534ed1eb17531838ca090633.1719502239.git.ecree.xilinx@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Conflicts:
	drivers/net/ethernet/wangxun/ngbe/ngbe_ethtool.c
	drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
	- The driver is not preset in RHEL 9.

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
2024-10-01 12:19:13 +02:00
Izabela Bakollari f9ea5f5906 net: phylink: move phylink_pcs_neg_mode() into phylink.c
JIRA: https://issues.redhat.com/browse/RHEL-33716

Conflicts: Context change due to missing upstream commit
1a3f6fc430ed2 ("phylink: ReST-ify the phylink_pcs_neg_mode() kdoc")

commit 5e5401d6612ef599ad45785b941eebda7effc90f
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Thu Jan 4 09:47:36 2024 +0000

    net: phylink: move phylink_pcs_neg_mode() into phylink.c

    Move phylink_pcs_neg_mode() from the header file into the .c file since
    nothing should be using it.

    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-08-09 22:56:14 +02:00
Izabela Bakollari cd29974b77 net: phylink: reimplement population of pl->supported for in-band
JIRA: https://issues.redhat.com/browse/RHEL-33716

commit 37a8997fc5a5a6ffc60b197d048a9351d1043efd
Author: Vladimir Oltean <vladimir.oltean@nxp.com>
Date:   Wed Dec 13 17:51:42 2023 +0200

    net: phylink: reimplement population of pl->supported for in-band

    phylink_parse_mode() populates all possible supported link modes for a
    given phy_interface_t, for the case where a phylib phy may be absent and
    we can't retrieve the supported link modes from that.

    Russell points out that since the introduction of the generic validation
    helpers phylink_get_capabilities() and phylink_caps_to_linkmodes(), we
    can rewrite this procedure to populate the pl->supported mask, so that
    instead of spelling out the link modes, we derive an intermediary
    mac_capabilities bit field, and we convert that to the equivalent link
    modes.

    Suggested-by: Russell King (Oracle) <linux@armlinux.org.uk>
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-08-09 22:56:12 +02:00
Izabela Bakollari 1f4eee4f2e net: phylink: use the PHY's possible_interfaces if populated
JIRA: https://issues.redhat.com/browse/RHEL-33716

commit 7a1f9a17ee99a3c27577465ce0f6c5f56cf1aacf
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Fri Nov 24 12:28:39 2023 +0000

    net: phylink: use the PHY's possible_interfaces if populated

    Some PHYs such as Aquantia, Broadcom 84881, and Marvell 88X33x0 can
    switch between a set of interface types depending on the negotiated
    media speed, or can use rate adaption for some or all of these
    interface types.

    We currently assume that these are Clause 45 PHYs that are configured
    not to use a specific set of interface modes, which has worked so far,
    but is just a work-around. In this workaround, we validate using all
    interfaces that the MAC supports, which can lead to extra modes being
    advertised that can not be supported.

    To properly address this, switch to using the newly introduced PHY
    possible_interfaces bitmap which indicates which interface modes will
    be used by the PHY as configured. We calculate the union of the PHY's
    possible interfaces and MACs supported interfaces, checking that is
    non-empty. If the PHY is on a SFP, we further reduce the set by those
    which can be used on a SFP module, again checking that is non-empty.
    Finally, we validate the subset of interfaces, taking account of
    whether rate matching will be used for each individual interface mode.

    This becomes independent of whether the PHY is clause 22 or clause 45.

    It is encouraged that all PHYs that switch interface modes or use
    rate matching should populate phydev->possible_interfaces.

    Tested-by: Luo Jie <quic_luoj@quicinc.com>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://lore.kernel.org/r/E1r6VIV-00DDMF-Pi@rmk-PC.armlinux.org.uk
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-08-09 22:56:09 +02:00
Izabela Bakollari 4192a70fc9 net: phylink: split out PHY validation from phylink_bringup_phy()
JIRA: https://issues.redhat.com/browse/RHEL-33716

commit 2c62ff83ee14da698bf52e723b704304b59455bb
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Fri Nov 24 12:28:34 2023 +0000

    net: phylink: split out PHY validation from phylink_bringup_phy()

    When bringing up a PHY, we need to work out which ethtool link modes it
    should support and advertise. Clause 22 PHYs operate in a single
    interface mode, which can be easily dealt with. However, clause 45 PHYs
    tend to switch interface mode depending on the media. We need more
    flexible validation at this point, so this patch splits out that code
    in preparation to changing it.

    Tested-by: Luo Jie <quic_luoj@quicinc.com>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://lore.kernel.org/r/E1r6VIQ-00DDM9-LK@rmk-PC.armlinux.org.uk
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-08-09 22:56:09 +02:00
Izabela Bakollari 7d07e104f5 net: phylink: pass PHY into phylink_validate_mask()
JIRA: https://issues.redhat.com/browse/RHEL-33716

commit b7014f9ece5075755105bafbeeb2c17ed0dace11
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Fri Nov 24 12:28:29 2023 +0000

    net: phylink: pass PHY into phylink_validate_mask()

    Pass the phy (if any) into phylink_validate_mask() so that we can
    validate each interface with its rate matching setting.

    Tested-by: Luo Jie <quic_luoj@quicinc.com>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://lore.kernel.org/r/E1r6VIL-00DDM3-HJ@rmk-PC.armlinux.org.uk
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-08-09 22:56:08 +02:00
Izabela Bakollari 31daa0ea9b net: phylink: pass PHY into phylink_validate_one()
JIRA: https://issues.redhat.com/browse/RHEL-33716

commit 385e72b4003482bfe17c17a9f4005d2850b5e8e0
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Fri Nov 24 12:28:24 2023 +0000

    net: phylink: pass PHY into phylink_validate_one()

    Pass the phy (if any) into phylink_validate_one() so that we can
    validate each interface with its rate matching setting.

    Tested-by: Luo Jie <quic_luoj@quicinc.com>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://lore.kernel.org/r/E1r6VIG-00DDLx-Cb@rmk-PC.armlinux.org.uk
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-08-09 22:56:08 +02:00
Izabela Bakollari 548b206523 net: phylink: split out per-interface validation
JIRA: https://issues.redhat.com/browse/RHEL-33716

commit 5f492a04506e5d93d5462238f7f899836ba3d421
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Fri Nov 24 12:28:19 2023 +0000

    net: phylink: split out per-interface validation

    Split out the internals of phylink_validate_mask() to make the code
    easier to read.

    Tested-by: Luo Jie <quic_luoj@quicinc.com>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://lore.kernel.org/r/E1r6VIB-00DDLr-7g@rmk-PC.armlinux.org.uk
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-08-09 22:56:08 +02:00
Izabela Bakollari 39908de3d1 net: phylink: use for_each_set_bit()
JIRA: https://issues.redhat.com/browse/RHEL-33716

commit 335662889f5a5f4d5668ed6c8b5fd58913d91d15
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Sun Nov 19 21:07:43 2023 +0000

    net: phylink: use for_each_set_bit()

    Use for_each_set_bit() rather than open coding the for() test_bit()
    loop.

    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
    Link: https://lore.kernel.org/r/E1r4p15-00Cpxe-C7@rmk-PC.armlinux.org.uk
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-08-09 22:56:07 +02:00
Izabela Bakollari 016b0bf908 net: phylink: use linkmode_fill()
JIRA: https://issues.redhat.com/browse/RHEL-33716

commit ba50a8d40258081325db15f5a86cbb301867a3ba
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Wed Nov 15 11:39:23 2023 +0000

    net: phylink: use linkmode_fill()

    Use linkmode_fill() rather than open coding the bitmap operation.

    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-08-09 22:56:06 +02:00
Izabela Bakollari a152f251e3 net: phylink: initialize carrier state at creation
JIRA: https://issues.redhat.com/browse/RHEL-33716

commit 02d5fdbf4f2b8c406f7a4c98fa52aa181a11d733
Author: Klaus Kudielka <klaus.kudielka@gmail.com>
Date:   Tue Nov 7 18:44:02 2023 +0100

    net: phylink: initialize carrier state at creation

    Background: Turris Omnia (Armada 385); eth2 (mvneta) connected to SFP bus;
    SFP module is present, but no fiber connected, so definitely no carrier.

    After booting, eth2 is down, but netdev LED trigger surprisingly reports
    link active. Then, after "ip link set eth2 up", the link indicator goes
    away - as I would have expected it from the beginning.

    It turns out, that the default carrier state after netdev creation is
    "carrier ok". Some ethernet drivers explicitly call netif_carrier_off
    during probing, others (like mvneta) don't - which explains the current
    behaviour: only when the device is brought up, phylink_start calls
    netif_carrier_off.

    Fix this for all drivers using phylink, by calling netif_carrier_off in
    phylink_create.

    Fixes: 089381b27a ("leds: initial support for Turris Omnia LEDs")
    Cc: stable@vger.kernel.org
    Suggested-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: Klaus Kudielka <klaus.kudielka@gmail.com>
    Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-08-09 22:56:06 +02:00
Izabela Bakollari d1b19c7a35 net: phy: fill in missing MODULE_DESCRIPTION()s
JIRA: https://issues.redhat.com/browse/RHEL-33716

commit dd9d75fcf0f427ddcde4bde736908684ee05c353
Author: Andrew Lunn <andrew@lunn.ch>
Date:   Sat Oct 28 20:44:57 2023 +0200

    net: phy: fill in missing MODULE_DESCRIPTION()s

    W=1 builds now warn if a module is built without a
    MODULE_DESCRIPTION(). Fill them in based on the Kconfig text, or
    similar.

    Signed-off-by: Andrew Lunn <andrew@lunn.ch>
    Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Acked-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Link: https://lore.kernel.org/r/20231028184458.99448-2-andrew@lunn.ch
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-08-09 22:55:59 +02:00
Ivan Vecera fa738d292c ethtool: replace struct ethtool_eee with a new struct ethtool_keee on kernel side
JIRA: https://issues.redhat.com/browse/RHEL-32101

Conflicts:
- hunks for missing files were omitted
- conversion for qca was done in drivers/net/dsa/qca/qca8k.c due to
  missing commits in qca driver
- net/dsa changes were done in net/dsa/slave.c due to missing commits
  in DSA subsystem

commit d80a52335374e484a4ff2afdc9af843e73273945
Author: Heiner Kallweit <hkallweit1@gmail.com>
Date:   Sat Jan 27 14:25:09 2024 +0100

    ethtool: replace struct ethtool_eee with a new struct ethtool_keee on kernel side

    In order to pass EEE link modes beyond bit 32 to userspace we have to
    complement the 32 bit bitmaps in struct ethtool_eee with linkmode
    bitmaps. Therefore, similar to ethtool_link_settings and
    ethtool_link_ksettings, add a struct ethtool_keee. In a first step
    it's an identical copy of ethtool_eee. This patch simply does a
    s/ethtool_eee/ethtool_keee/g for all users.
    No functional change intended.

    Suggested-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
2024-04-29 12:11:22 +02:00
Izabela Bakollari cc97e29347 net: phylink: add phylink_limit_mac_speed()
JIRA: https://issues.redhat.com/browse/RHEL-946

commit 70934c7c99ad01778eef83e898df4c624e52492f
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Thu Aug 24 14:37:53 2023 +0100

    net: phylink: add phylink_limit_mac_speed()

    Add a function which can be used to limit the phylink MAC capabilities
    to an upper speed limit.

    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Link: https://lore.kernel.org/r/E1qZAX3-005pTi-K1@rmk-PC.armlinux.org.uk
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-01-09 12:02:24 +01:00
Izabela Bakollari 81cc0672cb net: phy: Introduce PSGMII PHY interface mode
JIRA: https://issues.redhat.com/browse/RHEL-946

commit 83b5f0253b1ef352f4333c4fb2d24eff23045f6b
Author: Gabor Juhos <j4g8y7@gmail.com>
Date:   Fri Aug 11 13:10:07 2023 +0200

    net: phy: Introduce PSGMII PHY interface mode

    The PSGMII interface is similar to QSGMII. The main difference
    is that the PSGMII interface combines five SGMII lines into a
    single link while in QSGMII only four lines are combined.

    Similarly to the QSGMII, this interface mode might also needs
    special handling within the MAC driver.

    It is commonly used by Qualcomm with their QCA807x PHY series and
    modern WiSoC-s.

    Add definitions for the PHY layer to allow to express this type
    of connection between the MAC and PHY.

    Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
    Signed-off-by: Robert Marko <robert.marko@sartura.hr>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-01-09 12:02:23 +01:00
Izabela Bakollari 2a074442e6 net: phylink: explicitly invalidate link_state members in mac_config
JIRA: https://issues.redhat.com/browse/RHEL-946

commit c5714f68a76bcad3d2dbaafc5a7e98096f3b4c75
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Sat Jul 22 21:33:05 2023 +0100

    net: phylink: explicitly invalidate link_state members in mac_config

    Explicitly invalidate the phylink_link_state structure members in
    mac_config that do not contain reliable information for this function,
    thereby preventing their future incorrect use.

    Reviewed-by: Daniel Golle <daniel@makrotopia.org>
    Tested-by: Daniel Golle <daniel@makrotopia.org>
    Tested-by: Frank Wunderlich <frank-w@public-files.de>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-01-09 11:58:38 +01:00
Izabela Bakollari bc732c2d1d net: phylink: strip out pre-March 2020 legacy code
JIRA: https://issues.redhat.com/browse/RHEL-946

commit 4d72c3bb60dd9d5ea180f157bac72b4458112282
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Sat Jul 22 21:32:59 2023 +0100

    net: phylink: strip out pre-March 2020 legacy code

    Strip out all the pre-March 2020 legacy code from phylink now that the
    last user of it is gone.

    Reviewed-by: Daniel Golle <daniel@makrotopia.org>
    Tested-by: Daniel Golle <daniel@makrotopia.org>
    Tested-by: Frank Wunderlich <frank-w@public-files.de>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-01-09 11:58:38 +01:00
Izabela Bakollari c3c80309c9 net: phylink: remove legacy mac_an_restart() method
JIRA: https://issues.redhat.com/browse/RHEL-946

commit 76226787e137962750241bb29a9572dfc10d9eb1
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Fri Jul 14 10:12:17 2023 +0100

    net: phylink: remove legacy mac_an_restart() method

    The mac_an_restart() method is now completely unused, and has been
    superseded by phylink_pcs support. Remove this method.

    Since phylink_pcs_mac_an_restart() now only deals with the PCS, rename
    the function to remove the _mac infix.

    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-01-09 11:58:37 +01:00
Izabela Bakollari 8325590ac9 net: phylink: add support for PCS link change notifications
JIRA: https://issues.redhat.com/browse/RHEL-946

Add a function, phylink_pcs_change() which can be used by PCs drivers
to notify phylink about changes to the PCS link state.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 24699cc1ff3e633d7c3a0d3ef394243db11757ec)
Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-01-09 10:42:01 +01:00
Izabela Bakollari 0c2041dedb net: phylink: add pcs_pre_config()/pcs_post_config() methods
JIRA: https://issues.redhat.com/browse/RHEL-946

Add hooks that are called before and after the mac_config() call,
which will be needed to deal with errata workarounds for the
Marvell 88e639x DSA switches.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit aee6098822ed8a298ad817da8339ba4c7ea381fe)
Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-01-09 10:42:01 +01:00
Izabela Bakollari e30ae2c763 net: phylink: add pcs_enable()/pcs_disable() methods
JIRA: https://issues.redhat.com/browse/RHEL-946

Add phylink PCS enable/disable callbacks that will allow us to place
IEEE 802.3 register compliant PCS in power-down mode while not being
used.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 90ef0a7b0622c62758b2638604927867775479ea)
Signed-off-by: Izabela Bakollari <ibakolla@redhat.com>
2024-01-09 10:42:01 +01:00
Adrien Thierry 09fa429675 net: phylink: pass neg_mode into phylink_mii_c22_pcs_config()
JIRA: https://issues.redhat.com/browse/RHEL-2799

Conflicts: dropped hunks for fman_dtsec.c, xilinx_axienet_main.c,
pcs-lynx.c (unsupported by RHEL)

commit febf2aaf05641f3258cc30e072aff65cffc7c82c
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Fri Jun 16 13:06:32 2023 +0100

    net: phylink: pass neg_mode into phylink_mii_c22_pcs_config()

    Convert fman_dtsec, xilinx_axienet and pcs-lynx to pass the neg_mode
    into phylink_mii_c22_pcs_config(). Where appropriate, drivers are
    updated to have neg_mode passed into their pcs_config() and
    pcs_link_up() functions. For other drivers, we just hoist the call
    to phylink_pcs_neg_mode() to their pcs_config() method out of
    phylink_mii_c22_pcs_config().

    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Link: https://lore.kernel.org/r/E1qA8Do-00EaFM-Ra@rmk-PC.armlinux.org.uk
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-09-19 14:25:29 -04:00
Adrien Thierry 7b446b7d1e net: phylink: convert phylink_mii_c22_pcs_config() to neg_mode
JIRA: https://issues.redhat.com/browse/RHEL-2799

commit cdb08aa0473730315dbc088d5394e59622314034
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Fri Jun 16 13:06:27 2023 +0100

    net: phylink: convert phylink_mii_c22_pcs_config() to neg_mode

    Use phylink_pcs_neg_mode() for phylink_mii_c22_pcs_config(). This
    results in no functional change.

    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Link: https://lore.kernel.org/r/E1qA8Dj-00EaFG-Mt@rmk-PC.armlinux.org.uk
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-09-19 14:25:28 -04:00
Adrien Thierry cc682b3949 net: phylink: add PCS negotiation mode
JIRA: https://issues.redhat.com/browse/RHEL-2799

commit f99d471afa03f770149f1cc60a288b9a08285903
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Fri Jun 16 13:06:22 2023 +0100

    net: phylink: add PCS negotiation mode

    PCS have to work out whether they should enable PCS negotiation by
    looking at the "mode" and "interface" arguments, and the Autoneg bit
    in the advertising mask.

    This leads to some complex logic, so lets pull that out into phylink
    and instead pass a "neg_mode" argument to the PCS configuration and
    link up methods, instead of the "mode" argument.

    In order to transition drivers, add a "neg_mode" flag to the phylink
    PCS structure to PCS can indicate whether they want to be passed the
    neg_mode or the old mode argument.

    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Link: https://lore.kernel.org/r/E1qA8De-00EaFA-Ht@rmk-PC.armlinux.org.uk
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-09-19 14:25:24 -04:00
Adrien Thierry ac140ceca9 net: phylink: use a dedicated helper to parse usgmii control word
JIRA: https://issues.redhat.com/browse/RHEL-2799

commit 923454c0368b8092e9d05c020f50abca577e7290
Author: Maxime Chevallier <maxime.chevallier@bootlin.com>
Date:   Fri Jun 9 10:03:05 2023 +0200

    net: phylink: use a dedicated helper to parse usgmii control word

    Q-USGMII is a derivative of USGMII, that uses a specific formatting for
    the control word. The layout is close to the USXGMII control word, but
    doesn't support speeds over 1Gbps. Use a dedicated decoding logic for
    the USGMII control word, re-using USXGMII definitions but only considering
    10/100/1000Mbps speeds

    Fixes: 5e61fe157a27 ("net: phy: Introduce QUSGMII PHY mode")
    Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-09-19 14:18:21 -04:00
Adrien Thierry f3e1592f22 net: phylink: report correct max speed for QUSGMII
JIRA: https://issues.redhat.com/browse/RHEL-2799

commit b9dc1046edfeb7d9dbc2272c8d9ad5a8c47f3199
Author: Maxime Chevallier <maxime.chevallier@bootlin.com>
Date:   Fri Jun 9 10:03:04 2023 +0200

    net: phylink: report correct max speed for QUSGMII

    Q-USGMII is the quad port version of USGMII, and supports a max speed of
    1Gbps on each line. Make so that phylink_interface_max_speed() reports
    this information correctly.

    Fixes: ae0e4bb2a0e0 ("net: phylink: Adjust link settings based on rate matching")
    Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-09-19 14:18:21 -04:00
Adrien Thierry 60821f03bb net: phylink: actually fix ksettings_set() ethtool call
JIRA: https://issues.redhat.com/browse/RHEL-2799

commit 03c44a21d0333a2f469680bc9caaf96a9bfaea87
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Thu Jun 1 10:12:06 2023 +0100

    net: phylink: actually fix ksettings_set() ethtool call

    Raju Lakkaraju reported that the below commit caused a regression
    with Lan743x drivers and a 2.5G SFP. Sadly, this is because the commit
    was utterly wrong. Let's fix this properly by not moving the
    linkmode_and(), but instead copying the link ksettings and then
    modifying the advertising mask before passing the modified link
    ksettings to phylib.

    Fixes: df0acdc59b09 ("net: phylink: fix ksettings_set() ethtool call")
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Link: https://lore.kernel.org/r/E1q4eLm-00Ayxk-GZ@rmk-PC.armlinux.org.uk
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-09-19 14:18:20 -04:00
Adrien Thierry 8b1945ea4c net: phylink: provide phylink_pcs_config() and phylink_pcs_link_up()
JIRA: https://issues.redhat.com/browse/RHEL-2799

commit ae4899bb486f73e6d3d55a82b40482b2c5529a98
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Tue May 23 16:31:50 2023 +0100

    net: phylink: provide phylink_pcs_config() and phylink_pcs_link_up()

    Add two helper functions for calling PCS methods. phylink_pcs_config()
    allows us to handle PCS configuration specifics in one location, rather
    than the two call sites. phylink_pcs_link_up() gives us consistency.

    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Link: https://lore.kernel.org/r/E1q1TzK-007Exd-Rs@rmk-PC.armlinux.org.uk
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-09-19 14:18:19 -04:00
Adrien Thierry 9502294f25 net: phylink: add function to resolve clause 73 negotiation
JIRA: https://issues.redhat.com/browse/RHEL-2799

commit dad987484eaaa7cd7f7f7459f4aee1470d8ec8ef
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Tue May 23 11:15:58 2023 +0100

    net: phylink: add function to resolve clause 73 negotiation

    Add a function to resolve clause 73 negotiation according to the
    priority resolution function described in clause 73.3.6.

    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-09-19 14:18:19 -04:00
Adrien Thierry 27c193a12c net: phylink: remove duplicated linkmode pause resolution
JIRA: https://issues.redhat.com/browse/RHEL-2799

commit dc7a51411ec5381a567d02bee683c99713c411d9
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Tue May 23 11:15:53 2023 +0100

    net: phylink: remove duplicated linkmode pause resolution

    Phylink had two chunks of code virtually the same for resolving the
    negotiated pause modes. Factor this down to one function.

    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-09-19 14:18:19 -04:00
Adrien Thierry 072f4e75f2 net: phylink: require supported_interfaces to be filled
JIRA: https://issues.redhat.com/browse/RHEL-2799

Omitted-fix: 35b1b1fd9638
Merge commit

commit de5c9bf40c4582729f64f66d9cf4920d50beb897
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Sat May 20 11:41:42 2023 +0100

    net: phylink: require supported_interfaces to be filled

    We have been requiring the supported_interfaces bitmap to be filled in
    by MAC drivers that have a mac_select_pcs() method. Now that all MAC
    drivers fill in the supported_interfaces bitmap, it is time to enforce
    this. We have already required supported_interfaces to be set in order
    for optical SFPs to be configured in commit f81fa96d8a6c ("net: phylink:
    use phy_interface_t bitmaps for optical modules").

    Refuse phylink creation if supported_interfaces is empty, and remove
    code to deal with cases where this mask is empty.

    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://lore.kernel.org/r/E1q0K1u-006EIP-ET@rmk-PC.armlinux.org.uk
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-09-19 14:18:18 -04:00
Adrien Thierry 44f461ca37 net: phy: add helpers for comparing phy IDs
JIRA: https://issues.redhat.com/browse/RHEL-2799

commit 4b159f5048b90844679dad08afb3240c1957aba1
Author: Russell King <rmk+kernel@armlinux.org.uk>
Date:   Fri May 19 14:03:59 2023 +0100

    net: phy: add helpers for comparing phy IDs

    There are several places which open code comparing PHY IDs. Provide a
    couple of helpers to assist with this, using a slightly simpler test
    than the original:

    - phy_id_compare() compares two arbitary PHY IDs and a mask of the
      significant bits in the ID.
    - phydev_id_compare() compares the bound phydev with the specified
      PHY ID, using the bound driver's mask.

    Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
    Reviewed-by: Simon Horman <simon.horman@corigine.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-09-19 14:18:18 -04:00
Adrien Thierry 6fa202aa2c net: sfp: add support for setting signalling rate
JIRA: https://issues.redhat.com/browse/RHEL-2799

commit dc18582211b34bce8250ddf3cac2a2230e192120
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Wed May 17 11:38:12 2023 +0100

    net: sfp: add support for setting signalling rate

    Add support to the SFP layer to allow phylink to set the signalling
    rate for a SFP module. The rate given will be in units of kilo-baud
    (1000 baud).

    Reviewed-by: Simon Horman <simon.horman@corigine.com>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-09-19 14:18:18 -04:00
Adrien Thierry 32d68e4e39 net: phylink: fix ksettings_set() ethtool call
JIRA: https://issues.redhat.com/browse/RHEL-2799

commit df0acdc59b094cdaef19b1c8d83c9721082bab7b
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Sat May 13 22:03:45 2023 +0100

    net: phylink: fix ksettings_set() ethtool call

    While testing a Fiberstore SFP-10G-T module (which uses 10GBASE-R with
    rate adaption) in a Clearfog platform (which can't do that) it was
    found that the PHYs advertisement was not limited according to the
    hosts capabilities when using ethtool to change it.

    Fix this by ensuring that we mask the advertisement with the computed
    support mask as the very first thing we do.

    Fixes: cbc1bb1e46 ("net: phylink: simplify phy case for ksettings_set method")
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-09-19 14:18:17 -04:00
Adrien Thierry d2f402ac91 net: phylink: constify fwnode arguments
JIRA: https://issues.redhat.com/browse/RHEL-2799

commit a0b7955310a445fc0d45a0ac576bad8720cd6057
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Fri May 12 17:58:37 2023 +0100

    net: phylink: constify fwnode arguments

    Both phylink_create() and phylink_fwnode_phy_connect() do not modify
    the fwnode argument that they are passed, so lets constify these.

    Reviewed-by: Simon Horman <simon.horman@corigine.com>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-09-19 14:18:17 -04:00
Adrien Thierry 1db953eb9b net: phylink: add phylink_expects_phy() method
JIRA: https://issues.redhat.com/browse/RHEL-2799

commit 653a180957a85c3fc30320cc7e84f5dc913a64f8
Author: Michael Sit Wei Hong <michael.wei.hong.sit@intel.com>
Date:   Thu Mar 30 17:14:02 2023 +0800

    net: phylink: add phylink_expects_phy() method

    Provide phylink_expects_phy() to allow MAC drivers to check if it
    is expecting a PHY to attach to. Since fixed-linked setups do not
    need to attach to a PHY.

    Provides a boolean value as to if the MAC should expect a PHY.
    Returns true if a PHY is expected.

    Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Michael Sit Wei Hong <michael.wei.hong.sit@intel.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-09-19 14:18:13 -04:00
Adrien Thierry fe08d662b3 net: phylink: remove an_enabled
JIRA: https://issues.redhat.com/browse/RHEL-2799

commit 4ee9b0dcf09f426fbad7ed132d73ea2ba379d8ee
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Tue Mar 21 15:58:54 2023 +0000

    net: phylink: remove an_enabled

    The Autoneg bit in the advertising bitmap and state->an_enabled are
    always identical. state->an_enabled is now no longer used by any
    drivers, so lets kill this duplication.

    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Reviewed-by: Simon Horman <simon.horman@corigine.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-09-19 14:18:12 -04:00
Adrien Thierry 3e3e41b76f net: phylink: support validated pause and autoneg in fixed-link
JIRA: https://issues.redhat.com/browse/RHEL-2799

commit 894341ad3ad7dfbced8556efe92a9ebfd5924bd6
Author: Ivan Bornyakov <i.bornyakov@metrotek.ru>
Date:   Fri Feb 10 18:46:27 2023 +0300

    net: phylink: support validated pause and autoneg in fixed-link

    In fixed-link setup phylink_parse_fixedlink() unconditionally sets
    Pause, Asym_Pause and Autoneg bits to "supported" bitmap, while MAC may
    not support these.

    This leads to ethtool reporting:

     > Supported pause frame use: Symmetric Receive-only
     > Supports auto-negotiation: Yes

    regardless of what is actually supported.

    Instead of unconditionally set Pause, Asym_Pause and Autoneg it is
    sensible to set them according to validated "supported" bitmap, i.e. the
    result of phylink_validate().

    Signed-off-by: Ivan Bornyakov <i.bornyakov@metrotek.ru>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-09-19 14:18:08 -04:00
Adrien Thierry 630a2a1ed8 net: phylink: move phy_device_free() to correctly release phy device
JIRA: https://issues.redhat.com/browse/RHEL-2799

commit ce93fdb5f2ca5c9e2a9668411cc39091507f8dc9
Author: Clément Léger <clement.leger@bootlin.com>
Date:   Tue Jan 31 11:02:42 2023 +0100

    net: phylink: move phy_device_free() to correctly release phy device

    After calling fwnode_phy_find_device(), the phy device refcount is
    incremented. Then, when the phy device is attached to a netdev with
    phy_attach_direct(), the refcount is also incremented but only
    decremented in the caller if phy_attach_direct() fails. Move
    phy_device_free() before the "if" to always release it correctly.
    Indeed, either phy_attach_direct() failed and we don't want to keep a
    reference to the phydev or it succeeded and a reference has been taken
    internally.

    Fixes: 25396f680d ("net: phylink: introduce phylink_fwnode_phy_connect()")
    Signed-off-by: Clément Léger <clement.leger@bootlin.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-09-19 14:18:07 -04:00
Adrien Thierry fff4f1a70c drivers/net/phy: add the link modes for the 10BASE-T1S Ethernet PHY
JIRA: https://issues.redhat.com/browse/RHEL-2799

commit 16178c8ef53dc9734302c4c07633696454579ee3
Author: Piergiorgio Beruto <piergiorgio.beruto@gmail.com>
Date:   Mon Jan 9 17:59:58 2023 +0100

    drivers/net/phy: add the link modes for the 10BASE-T1S Ethernet PHY

    This patch adds the link modes for the IEEE 802.3cg Clause 147 10BASE-T1S
    Ethernet PHY. According to the specifications, the 10BASE-T1S supports
    Point-To-Point Full-Duplex, Point-To-Point Half-Duplex and/or
    Point-To-Multipoint (AKA Multi-Drop) Half-Duplex operations.

    Signed-off-by: Piergiorgio Beruto <piergiorgio.beruto@gmail.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-09-19 14:18:05 -04:00
Adrien Thierry aec06e70c5 net: phylink: fix PHY validation with rate adaption
JIRA: https://issues.redhat.com/browse/RHEL-2799

commit 7642cc28fd37a15feacff0ccf0e5a8466630df5d
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Thu Nov 24 09:06:48 2022 +0000

    net: phylink: fix PHY validation with rate adaption

    Tim Harvey reports that link modes which he does not expect to be
    supported are being advertised, and this is because of the workaround
    we have for PHYs that switch interface modes.

    Fix this up by checking whether rate matching will be used for the
    requested interface mode, and if rate matching will be used, perform
    validation only with the requested interface mode, rather than invoking
    this workaround.

    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-09-19 14:18:02 -04:00