Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp245699pxk; Wed, 23 Sep 2020 01:57:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5JA+lx+rfhuc5/U/YGO2ZSLMeYqBoyDt+qtusEGpCdl5qzDul5nJSqf+MqZ1WJU2gIlmQ X-Received: by 2002:a05:6402:14d4:: with SMTP id f20mr8353944edx.291.1600851459630; Wed, 23 Sep 2020 01:57:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600851459; cv=none; d=google.com; s=arc-20160816; b=OVhl3riJtn4AS4GPNiay4AsLBCPOEK1gRI2DUpTFfhmBY3IBwCIP6/iLo+YilUG6eM iV+DibIAb6PnO82IwrE8g5ipffKnw7QOyNhNhiqxdirPFtkzxSVtgnq9BhYoN+N+L0I4 /amEwViXuWKh5xWhu8DoCQkdo8DqzEL8qByxTxSD01gq1ql1Zkzu6DmfwashABvS/en3 /83C3iRxlSGYNIk8y9Bd4N6XmFYUSxfrlodiqFPfi38HONEtZU9gksIAK8hOAnMaYH2f 3TwBYG6vb+i/2aOuxVwLTloCCJGbIdOxPYYwAzcQ24qxTDlfjlwdgw6qzehmZ2HDkw/r C1YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:ironport-sdr :ironport-sdr; bh=dTU1SZwOPW1wEjXjYC7lSPL/XCOvlxgHPZ6rnYkb7GU=; b=GihoyGIz4OPehz0guI8/HuJSHbdqwjGQ5SFhLLXXiA/86TYAfGZJv2igD2M+PJfy8H DUntkY3pQJTMbml0LPLIXY492YD0cLR3hTooyly6ALYZU9zP3+h4RfzS0t1PjzBJD+3E qEByLoqMqSdFvVZP5NibmgZWkoTV4oiS/9nxp0y6gg5ehIL2B7zN+GyZvwO5UN8Aq9cK FA/IkdqKpGGhjjsjsk08EaYph5KSxHu75UwzBWWxjg5DZynm5e51CGMVulRIk3BFB4b6 wxtF1H6vDLUvM4YFueo6SufDVpmel4vOPHIjdOpiqOh8aWJ74Y/iQu58N+07a9r6bdcs tOVg== ARC-Authentication-Results: i=1; mx.google.com; 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v11si12709773ede.8.2020.09.23.01.57.14; Wed, 23 Sep 2020 01:57:39 -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; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726786AbgIWI4S (ORCPT + 99 others); Wed, 23 Sep 2020 04:56:18 -0400 Received: from mga02.intel.com ([134.134.136.20]:30055 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726244AbgIWI4S (ORCPT ); Wed, 23 Sep 2020 04:56:18 -0400 IronPort-SDR: OhDDZKWBhmGrz4R4FECwCEvhn5fQa8NxHeyDJ+rvlZ5M4HUFQF/T1HKtndPljmD4dPbXwSpwGK nLMSQ2DtGWRg== X-IronPort-AV: E=McAfee;i="6000,8403,9752"; a="148492030" X-IronPort-AV: E=Sophos;i="5.77,293,1596524400"; d="scan'208";a="148492030" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2020 01:56:17 -0700 IronPort-SDR: ANRFrIrOS1XqWbh5ONAWDEfN8VLGno0Z8I0+1k51QtiGq4RV1eWTMpCc570TtrxINW/3wFG4AF pw0IL5CEMvFA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,293,1596524400"; d="scan'208";a="338590656" Received: from unknown (HELO climb.png.intel.com) ([10.221.118.165]) by orsmga008.jf.intel.com with ESMTP; 23 Sep 2020 01:56:15 -0700 From: Voon Weifeng To: "David S . Miller" , Maxime Coquelin Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jose Abreu , Giuseppe Cavallaro , Andrew Lunn , Alexandre Torgue , Ong Boon Leong , Voon Weifeng , Seow Chen Yong , Mark Gross Subject: [PATCH v1 net] net: stmmac: removed enabling eee in EEE set callback Date: Wed, 23 Sep 2020 16:56:14 +0800 Message-Id: <20200923085614.8147-1-weifeng.voon@intel.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- .../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 ac5e8cc5fb9f..430a4b32ec1e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c @@ -675,23 +675,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 = phylink_ethtool_set_eee(priv->phylink, edata); if (ret) return ret; - priv->eee_enabled = edata->eee_enabled; priv->tx_lpi_timer = edata->tx_lpi_timer; return 0; } -- 2.17.1