From: Heiner Kallweit Subject: Re: [PATCH net-next v2 07/10] r8169: migrate speed_down function to phylib Date: Tue, 10 Jul 2018 23:26:13 +0200 Message-ID: <33b9c24f-99af-2029-8cd6-3811611af330@gmail.com> References: <84ac1cb7-bafd-5f15-8cda-e8dfd7d0deb3@gmail.com> <0876c52d-1b70-257d-270e-f44ff0f5e17b@gmail.com> <20180710204407.GH892@lunn.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: David Miller , Florian Fainelli , Realtek linux nic maintainers , "netdev@vger.kernel.org" To: Andrew Lunn Return-path: Received: from mail-wr1-f66.google.com ([209.85.221.66]:41062 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732205AbeGJV1U (ORCPT ); Tue, 10 Jul 2018 17:27:20 -0400 Received: by mail-wr1-f66.google.com with SMTP id j5-v6so9522948wrr.8 for ; Tue, 10 Jul 2018 14:26:22 -0700 (PDT) In-Reply-To: <20180710204407.GH892@lunn.ch> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 10.07.2018 22:44, Andrew Lunn wrote: >> static void rtl_speed_down(struct rtl8169_private *tp) >> { >> - u32 adv; >> - int lpa; >> + struct phy_device *phydev = tp->dev->phydev; >> + u32 adv = phydev->lp_advertising & phydev->supported; >> >> - rtl_writephy(tp, 0x1f, 0x0000); >> - lpa = rtl_readphy(tp, MII_LPA); >> + if (adv & BASET10) >> + phydev->advertising &= ~(BASET100 | BASET1000); >> + else if (adv & BASET100) >> + phydev->advertising &= ~BASET1000; > > Please use phy_set_max_speed(). We need MAC drivers to stop directly > accessing phydev members. Otherwise we are going to have problems > supporting 2.5G PHYs. > The issue I see with phy_set_max_speed() is that it also adjusts phydev->supported and I don't think that's what we want. What the chip supports doesn't change, just what we want to advertise. > Andrew >