Re: [RFC net-next 6/8] net: phylink: Configure MAC/PCS when link is up without PHY

Russell King - ARM Linux admin
2020-01-27T11:21:13Z

On Mon, Jan 27, 2020 at 12:09:11PM +0100, Jose Abreu wrote:
> When we don't have any real PHY driver connected and we get link up from
> PCS we shall configure MAC and PCS for the desired speed and also
> resolve the flow control settings from MAC side.

This is certainly the wrong place for it. Please hold off on this patch
for the time being. Thanks.

>
> Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
>
> ---
> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> Cc: Alexandre Torgue <alexandre.torgue@st.com>
> Cc: Jose Abreu <joabreu@synopsys.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: Heiner Kallweit <hkallweit1@gmail.com>
> Cc: netdev@vger.kernel.org
> Cc: linux-stm32@st-md-mailman.stormreply.com
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> ---
> drivers/net/phy/phylink.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index 4174d874b1f7..75dbaf80d7a5 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -533,10 +533,20 @@ static void phylink_resolve(struct work_struct *w)
>
> if (link_changed) {
> pl->old_link_state = link_state.link;
> - if (!link_state.link)
> + if (!link_state.link) {
> phylink_mac_link_down(pl);
> - else
> + } else {
> + /* If no PHY is connected, we still need to configure
> + * MAC/PCS for flow control and speed.
> + */
> + if (!pl->phydev) {
> + phylink_resolve_flow(pl, &link_state);
> + phylink_mac_config(pl, &link_state);
> + }
> +
> phylink_mac_link_up(pl, link_state);
> + }
> +
> }
> if (!link_state.link && pl->mac_link_dropped) {
> pl->mac_link_dropped = false;
> --
> 2.7.4
>
>

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up