Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4408032pxu; Mon, 12 Oct 2020 19:19:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+5fH5Oextn6B7uoIPasdBLbbZ7ILGdnoHArxZNlVlnBg94YMehhLVhMXlh8XT9N+Oc3/K X-Received: by 2002:a17:906:783:: with SMTP id l3mr31991147ejc.253.1602555582889; Mon, 12 Oct 2020 19:19:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602555582; cv=none; d=google.com; s=arc-20160816; b=p3qk1/IeBkzc/hK/qw85A6XuEGWQ0wxlzGsuuILIjzT/LvjMnOczFf3flZsT1vHuUV NOarWNo08wnzJKCgwF9tplXYKVYOk2Z6HIbdh63wKuk8jTAsiWVzOgGWFYRig7SjjuV8 9Muf4dmYjB1pwnSRO5JOCBo5iVltzctHCyPk3I+/9Ql6c9gJClTggDUVTQ2wmFUutiSy 51IniDgvA5HvbKdiolcpPTDzYZ8a0l3Y7F9cZuIGwpTmLZ/nW6XIoD/Q1SYCoCghIxfE chzYw3pAdqaUgerNw3TTKWxsos/wgyjZfMoKJ07s/xIy1wahb8xZWKmKqDUEFqC5w1gl SHwQ== 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=WCZDzEsBHLfJMP9kdV0rJOQpEYDOnaZgx+r4CAhJ2tU=; b=WFGihUc331mJ4YvihOv6fFe56mWnExGv6MUV8nz6w7RfrG0kZ6fyDg/l0g7O+d+MvU iUjqfYMr55kLJ/Fn4mIXZ4Ba3FygzQevCzC8ThYQaYXSsozsLs66/Ht+fPx5dHlj0Yz7 anYAbNpfwLXTsyCzc6WPWunoYAZa96CJC3MRa3JsG05QBt0keY+25o6sTd4RLj/Bvh2P VOL2xHf+7S792rcaUsy/xXJmc36gQSml6ONWc7Ch00SgdtkhX/CIxD64dsmiSUFVuNei eOIMK2vI2mgFgK5rXHm0NCzXujSUkgF3oIZfUMoMTt/4SlH47S1inFCjakQ+Wx5FAOZW lvGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XeTDDUXr; 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 u22si12469568ejg.300.2020.10.12.19.19.20; Mon, 12 Oct 2020 19:19:42 -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=XeTDDUXr; 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 S1731294AbgJLOBH (ORCPT + 99 others); Mon, 12 Oct 2020 10:01:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:40706 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731236AbgJLNin (ORCPT ); Mon, 12 Oct 2020 09:38:43 -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 30135221FE; Mon, 12 Oct 2020 13:38:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602509900; bh=6wAB02IwfsC7DHvdEzt8a2/LnQp5Sy5OvIscxeAHml4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XeTDDUXrFR2j4kZLmypwQCj905ARsif6klfpkM/dl8VsaWSKS5YN/ispSmccVMK4Y zj3alrARUNnSWtZ/Op5W4WqzMpv1otyaoPpl1dsJREJDES/W1JCRNrdWSIoN1SGbN6 0e3OaCm2knf4ehbx8l9zgprb6M1VyxE1H+J7x2YM= 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.14 57/70] net: stmmac: removed enabling eee in EEE set callback Date: Mon, 12 Oct 2020 15:27:13 +0200 Message-Id: <20201012132632.927620045@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201012132630.201442517@linuxfoundation.org> References: <20201012132630.201442517@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 8c71090081852..5105e1f724fb7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c @@ -677,23 +677,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