From patchwork Tue May 12 19:45:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 219397 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D90CCA90AF for ; Tue, 12 May 2020 19:46:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1F769206DD for ; Tue, 12 May 2020 19:46:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Q/o7siEs" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731106AbgELTp7 (ORCPT ); Tue, 12 May 2020 15:45:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725987AbgELTp6 (ORCPT ); Tue, 12 May 2020 15:45:58 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E049C061A0C for ; Tue, 12 May 2020 12:45:58 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id y24so25155852wma.4 for ; Tue, 12 May 2020 12:45:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=KLCscuQOlnUBSAz+f+ceaW+MwPSkA0Ia974a4ZvZor8=; b=Q/o7siEsfyDG7JjYBJ65KNME7Dc+vOpHURhp0Dgz9itOdNAy36nWGoOBafd/PQjtAF S8B1/a2PtEUAK1v1dfniKe3t035tcaFxR9mwPq9tTgTB95xy+b2gbnxzZ1Rd9ENdPVM9 d/cVnfPGxZLP96t8HpqiPM+nYGihrAnpFLDyoRiSVPK2UZt3+siNypjD7Q1lt0Ee3m5x NsAH7lZSZRXN/EhOFhRekoH3zOcBMms/o2laS8BN2KPZFnz7Z1mvn7DRsavnCRSvR8f9 Tx3GnJBcal9qYmRQ7eSaxjYA5Ed6crgBu6hvlLF72tHx0cX1xPp3FSXHO5GnuuajYrjr bq2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=KLCscuQOlnUBSAz+f+ceaW+MwPSkA0Ia974a4ZvZor8=; b=MYxN5FCViSydMSFKX6aEHy6QTXWbZbx9TOdViUNoZuLMtMttwDQfVszPIthx3WMfO4 7rUx/c/sbXW47rNHalZE7R5dW5kvZWkjQ7wyeWWyWzT9RIFx6xbK+8ZuzdPqhfLJqjsS 1SXi62AsasKieGFElfgMX4lvBzB9IldF4/gqZ6DUM6KZnYERMf8hGykIzBPfHWx09e3w lAJM4NNGnfEuluTkecXb5VXfOkWQRWvG2UsoWhitVlGXBH6iIbtvq/KY5kfUolHQr0K6 vb3TwFzD7M8z8gc3CekneibJVI0WEHcTSOc/VWkgvTqhE8S0ix/YFjXj8Xm5U3WEpefP ApQw== X-Gm-Message-State: AGi0PuYOpDLKoFHAKIaxJ9Dm3P8g31OPWxymRSxtFwz6Ke5wJumBVgo8 Z4G95bI4t3Bf5GBaTnDaNTRWHbL5 X-Google-Smtp-Source: APiQypLloRoh4SW+ERgv9Vm55d19OSNpnpMAhInAdxDLxmvr9i70B3PRSjkNPRhBm/DCZuWPkp4t4g== X-Received: by 2002:a1c:1b4d:: with SMTP id b74mr10691534wmb.123.1589312756852; Tue, 12 May 2020 12:45:56 -0700 (PDT) Received: from ?IPv6:2003:ea:8f28:5200:d932:d3d0:91da:45c2? (p200300EA8F285200D932D3D091DA45C2.dip0.t-ipconnect.de. [2003:ea:8f28:5200:d932:d3d0:91da:45c2]) by smtp.googlemail.com with ESMTPSA id t22sm3155761wmj.37.2020.05.12.12.45.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 May 2020 12:45:56 -0700 (PDT) To: Andrew Lunn , Florian Fainelli , Russell King - ARM Linux , David Miller Cc: "netdev@vger.kernel.org" From: Heiner Kallweit Subject: [PATCH net] net: phy: fix aneg restart in phy_ethtool_set_eee Message-ID: <2a8c3ca7-4ef3-3dd7-6276-759f66ab8b5e@gmail.com> Date: Tue, 12 May 2020 21:45:53 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 Content-Language: en-US Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org phy_restart_aneg() enables aneg in the PHY. That's not what we want if phydev->autoneg is disabled. In this case still update EEE advertisement register, but don't enable aneg and don't trigger an aneg restart. Fixes: f75abeb8338e ("net: phy: restart phy autonegotiation after EEE advertisment change") Signed-off-by: Heiner Kallweit --- drivers/net/phy/phy.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 9bdc924ee..d4bbf79da 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1240,9 +1240,11 @@ int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data) /* Restart autonegotiation so the new modes get sent to the * link partner. */ - ret = phy_restart_aneg(phydev); - if (ret < 0) - return ret; + if (phydev->autoneg == AUTONEG_ENABLE) { + ret = phy_restart_aneg(phydev); + if (ret < 0) + return ret; + } } return 0;