Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4005624pxu; Mon, 12 Oct 2020 07:10:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzs6O/FO5XT0CjE7tpAThYgDEjtiFRc7VAW6E6MnuDP7RFrHvnar7jopJhUZZKZjsAsoq8H X-Received: by 2002:a17:906:783:: with SMTP id l3mr29182846ejc.253.1602511832324; Mon, 12 Oct 2020 07:10:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602511832; cv=none; d=google.com; s=arc-20160816; b=TFwwbmBMvvH9c+sUDAppeDn1ShizKQCNXTtyyKppv5vCzZbzj1cMRvFGznX1l+iJbV Uq3JjsypiJrALqAWNWAybfJpV4heLBompUreZv7z+HkthPS+hKh1GJ7hULTRTiZzasf3 4OVhzW0uk9387HKN7WG9vY6CFd+cYcnXtbkgji7cIPsyG7amZvWau1kQFxD9OCTQw6Jn q/JGrLL5XH8+JvG5sFhKSzunfr9HpM4dgaB4E9V+nkhKblZ6JUpMwiSC02AioqxHkaN5 OJnFBd5DI7Zltkbcbj/qub6WcgwpYF2x4L4gINyWD2Kn10PQEvcYNwPAQIuOqlr8FT71 tf5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=P2iqFZIZ0Q9Bq2LBsiB2y37qw/uDrEcMvvbOHNjD2UM=; b=bJZGQZ/26L/mV9cSfKAd032LxGSvFZhgoPmxpMhvC3fs96VcJH9LCFGEBHAWHogi75 6eEtVVtsUBDTkuP5Lk330HLHTOjn4YXkql6eG5BPZoD0wSLUfugD9OgscEJiiUsB/RGk qA3HGKOSSuzKrrdoZ28rU5r7QPYoNBWYsnP33e6g1sRwcWogiy6ikBrHp5ETTA3Mf46J +wpMjfNS3FSgDgRlDfvd37BgmsTRnf0JxF+XW2bHAhoy/4uwFjxlaQrUQWypz9xVFord DCuo4sGC1HRkqsJewrTrhTrqSWI7jKcEn/dDC3RTnWfzZZCVaE8k+08sAdVaXZqKizpC TeUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=F5JEm1CY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e8si12082798ejj.575.2020.10.12.07.10.08; Mon, 12 Oct 2020 07:10:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=F5JEm1CY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391079AbgJLOGE (ORCPT + 99 others); Mon, 12 Oct 2020 10:06:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:36738 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727298AbgJLNey (ORCPT ); Mon, 12 Oct 2020 09:34:54 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 40AF7204EA; Mon, 12 Oct 2020 13:34:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602509693; bh=WaRSNmjJ0P7LxVJcmFnrIUckbJpl6ghTVNCjNVUK/6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F5JEm1CYdIkf0GaWLbrSbHCZb4iWoQEcfGbhEtD8gXFS1dTL+gDnXsvAfy4OGsNRV eMO+TegwyMXE2ncpmrNDpctFBC05kqfF5V0fDbwmnvzgVO+V7bVHZS39wBC4y0D3sY dt8n7VlYxxa8v0E7DkntcSHDQMNYdZZIAKTRUTy4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Voon Weifeng , Mark Gross , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 44/54] net: stmmac: removed enabling eee in EEE set callback Date: Mon, 12 Oct 2020 15:27:06 +0200 Message-Id: <20201012132631.604985413@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201012132629.585664421@linuxfoundation.org> References: <20201012132629.585664421@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Voon Weifeng [ Upstream commit 7241c5a697479c7d0c5a96595822cdab750d41ae ] EEE should be only be enabled during stmmac_mac_link_up() when the link are up and being set up properly. set_eee should only do settings configuration and disabling the eee. Without this fix, turning on EEE using ethtool will return "Operation not supported". This is due to the driver is in a dead loop waiting for eee to be advertised in the for eee to be activated but the driver will only configure the EEE advertisement after the eee is activated. Ethtool should only return "Operation not supported" if there is no EEE capbility in the MAC controller. Fixes: 8a7493e58ad6 ("net: stmmac: Fix a race in EEE enable callback") Signed-off-by: Voon Weifeng Acked-by: Mark Gross Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index 3519a8a589dda..c8673e231a880 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c @@ -678,23 +678,16 @@ static int stmmac_ethtool_op_set_eee(struct net_device *dev, struct stmmac_priv *priv = netdev_priv(dev); int ret; - if (!edata->eee_enabled) { + if (!priv->dma_cap.eee) + return -EOPNOTSUPP; + + if (!edata->eee_enabled) stmmac_disable_eee_mode(priv); - } else { - /* We are asking for enabling the EEE but it is safe - * to verify all by invoking the eee_init function. - * In case of failure it will return an error. - */ - edata->eee_enabled = stmmac_eee_init(priv); - if (!edata->eee_enabled) - return -EOPNOTSUPP; - } ret = phy_ethtool_set_eee(dev->phydev, edata); if (ret) return ret; - priv->eee_enabled = edata->eee_enabled; priv->tx_lpi_timer = edata->tx_lpi_timer; return 0; } -- 2.25.1