Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp787164pxk; Wed, 23 Sep 2020 16:39:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz26PRy5eYGN/D86zNapu6UvLUwResxnoVscu1p1NlXad3grqhXAg/mPO2qpsCOKSAjBIlY X-Received: by 2002:a50:d987:: with SMTP id w7mr1804702edj.113.1600904393735; Wed, 23 Sep 2020 16:39:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600904393; cv=none; d=google.com; s=arc-20160816; b=vy/ZnUVBHzydS9GOfNeWD8jI9j08g/f6kzxLy7r5JkuS/KzIcB8MvYdiwVd5hBcA+e rAarJLoxTAO35CcOlNmbJ7v1ZcjwFMwokT2qwkUhdqbdBPIbztJJXFwCJ3tFe20QHRBl /9TTnuO+SqCoBbkfvxGpPGkVLkmzVw84T50qwHn2KIpbW7WUDZRc6JwQVHiGHWUoXpOG 2JxlJIXP9rOUGl3QiohaT2/FTrotMieVq6O2KLwE2a+EKtd6Te0WK9kUJLXo0BcRGpGU tjfI6rFJT++wXmR66jFwwLbWkMP82iY5GymsO0ipvUt5RbO6vyGYLjNWUw8rkt0eBQV6 sOjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=B05kyjB8HQvj31W6BAbtL0awEk/A1rWszlR6cFJIq7g=; b=ovU3135WSSqUY+AZaS0xGUosvYKXZEVRIp/yDME8bD+brba352PsvMqckidf7p+0gT 71bFHHa6M/ERZPTgWfi3Kh9KKQUEigDU233ZijIqsXWubHtABl9fgBt+V8JynAwl0Miu +EO4Mj7V3va6j7iWzeyml2UeVkFr8IGGm65VaYgs5vVzAazcsxDtlbSxlS9y6zHZfGFe acWkL5IpPsngNlcGRha1LnWRc4tZltVQF6d/M0aSfiXK8Vy925s0Lh4x35r1w2627TDu 97ZaDuI7cgde27n+YGSpkdVgsBAkHlI88sBtdygYX6Gr7w3i7rTjidD9dISZd4qGDr9Q r5jw== 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 y5si924453edt.194.2020.09.23.16.39.30; Wed, 23 Sep 2020 16:39:53 -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 S1726689AbgIWXh5 (ORCPT + 99 others); Wed, 23 Sep 2020 19:37:57 -0400 Received: from mga11.intel.com ([192.55.52.93]:2728 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbgIWXh5 (ORCPT ); Wed, 23 Sep 2020 19:37:57 -0400 IronPort-SDR: 28NqNpMJG/m5adPOJgcPoH/Wi/DWIsjXLrxREvyuBR3LyFsim7blEk7tYL9mR/OAlCoSMQITrz xrr8nVrnRGnw== X-IronPort-AV: E=McAfee;i="6000,8403,9753"; a="158399686" X-IronPort-AV: E=Sophos;i="5.77,295,1596524400"; d="scan'208";a="158399686" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2020 16:37:57 -0700 IronPort-SDR: WdTdzfVzp3Lt4/dSGVRMHwVmN1s8WAVnIUCVfH5cqidBiXhfihNDyd5b8mtVi965r3q1WvMTHU AgQ52VeEmwkg== X-IronPort-AV: E=Sophos;i="5.77,295,1596524400"; d="scan'208";a="511260588" Received: from smtp.ostc.intel.com ([10.54.29.231]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2020 16:37:57 -0700 Received: from localhost (mtg-dev.jf.intel.com [10.54.74.10]) by smtp.ostc.intel.com (Postfix) with ESMTP id 20DE26369; Wed, 23 Sep 2020 16:37:04 -0700 (PDT) Date: Wed, 23 Sep 2020 16:37:04 -0700 From: mark gross To: Voon Weifeng Cc: "David S . Miller" , Maxime Coquelin , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jose Abreu , Giuseppe Cavallaro , Andrew Lunn , Alexandre Torgue , Ong Boon Leong , Seow Chen Yong Subject: Re: [PATCH v1 net] net: stmmac: removed enabling eee in EEE set callback Message-ID: <20200923233704.GE56905@mtg-dev.jf.intel.com> Reply-To: mgross@linux.intel.com References: <20200923085614.8147-1-weifeng.voon@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200923085614.8147-1-weifeng.voon@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Acked-by: Mark Gross On Wed, Sep 23, 2020 at 04:56:14PM +0800, Voon Weifeng wrote: > 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 >