Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1110295ybb; Fri, 10 Apr 2020 17:44:31 -0700 (PDT) X-Google-Smtp-Source: APiQypLiJlcJvgHRizufkli8MPBLKvnBBBe57HKGUb82hdh69QOsy2zg7UX6gG2Dh7vfNPYZo+zp X-Received: by 2002:a0c:b446:: with SMTP id e6mr4970280qvf.229.1586565870947; Fri, 10 Apr 2020 17:44:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586565870; cv=none; d=google.com; s=arc-20160816; b=kLPMSLNQvEUcjcYKWG/4EGEWkgKxadx3sE9sMmz4XZ7mYcNUQN1jMJ3tr6kzdgTVgT xQPBNqNNB5NObi7eqktqRCMZh9VDImI/OnX5AlXdQDgJv6QdvPKySPoybZ1Y33yfq7rT Y0yy9t+oeyGGlqY/xf24nNrHGlF2qU57PC7zozYoT207nplm/UDAyWOaGW73FjqQokER qGGNI2jibCvd3XPoo1f/HAK5gcpMgkzNdBU03HzVQye1ifNDVFEqHGXgR2stF4DYasGx Kmro/ibx147OFFZai/g6mLBcPPX6rZrTLimRayE9+SPqkoLUZwbRn3ZFA13iRd/N5sw/ eULg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=6UTUtAy9ngVYGirsDobJVjKnTcJdh5MEsSYR3qJnu+A=; b=EeRplnctgYRPdkrnunf1UGps4hkx4NuEVfTFbNkeraBQ24MOy1aaHAm5xQF9BBGzXd OXTtH+/On9gUmoHUV6KrhPLNJ+xp0Gt96AiZ5q6SwlK7dGraPZEZhxraxb1aip5F3vEF QqQjepqfQ9l6JrLm0PA6UvTP1lI/AiYFlcGXnzd7Sw6tcay4QJvJd/ZJSsAoqd0fLbuN OQ0fn9ERZepQCdiolJQ0amObNxA1a/dUpAMyJfGFG1rQgWShINB1mJ7a2OGEi9C/Tj41 9v8+LOrwqCQtgW9KL+z20fASUUjkpA+9hxmQ8WMjyFqF6K8pkxkNGf/D2cgAHZjlLAC/ 2quA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ark+FA4q; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p9si1459812qkh.125.2020.04.10.17.44.14; Fri, 10 Apr 2020 17:44:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ark+FA4q; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726736AbgDKAnH (ORCPT + 99 others); Fri, 10 Apr 2020 20:43:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:34136 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726641AbgDKAnH (ORCPT ); Fri, 10 Apr 2020 20:43:07 -0400 Received: from kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com (unknown [163.114.132.1]) (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 B3E7F20769; Sat, 11 Apr 2020 00:43:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586565787; bh=pK/hEpQ3ocfQm9eoETGX0U+EnLUpz3/wOy/mYdwDFc0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ark+FA4qSe+dBCUDQE6KWvZRp747L8gQHoQGY6teQyw/rZoyAa1rlcpY8pLka54qm 68ehq6CJkDxflniVmqHwuxHtfuFqDc85IjBkgUDFjjFzm3JU46phmvCdZMvLntQCt9 T3Y8Rf/V4eWAeCArmzfHbAz6MejiwufZluIVsMLs= Date: Fri, 10 Apr 2020 17:43:04 -0700 From: Jakub Kicinski To: Clemens Gruber Cc: netdev@vger.kernel.org, Russell King , Andrew Lunn , Florian Fainelli , Heiner Kallweit , "David S . Miller" , linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] net: phy: marvell: Fix pause frame negotiation Message-ID: <20200410174304.22f812fd@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20200408214326.934440-1-clemens.gruber@pqgruber.com> References: <20200408214326.934440-1-clemens.gruber@pqgruber.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 8 Apr 2020 23:43:26 +0200 Clemens Gruber wrote: > The negotiation of flow control / pause frame modes was broken since > commit fcf1f59afc67 ("net: phy: marvell: rearrange to use > genphy_read_lpa()") moved the setting of phydev->duplex below the > phy_resolve_aneg_pause call. Due to a check of DUPLEX_FULL in that > function, phydev->pause was no longer set. > > Fix it by moving the parsing of the status variable before the blocks > dealing with the pause frames. > > Fixes: fcf1f59afc67 ("net: phy: marvell: rearrange to use genphy_read_lpa()") > Cc: stable@vger.kernel.org # v5.6+ nit: please don't CC stable on networking patches > Signed-off-by: Clemens Gruber > --- > drivers/net/phy/marvell.c | 44 +++++++++++++++++++-------------------- > 1 file changed, 22 insertions(+), 22 deletions(-) > > diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c > index 4714ca0e0d4b..02cde4c0668c 100644 > --- a/drivers/net/phy/marvell.c > +++ b/drivers/net/phy/marvell.c > @@ -1263,6 +1263,28 @@ static int marvell_read_status_page_an(struct phy_device *phydev, > int lpa; > int err; > > + if (!(status & MII_M1011_PHY_STATUS_RESOLVED)) > + return 0; If we return early here won't we miss updating the advertising bits? We will no longer call e.g. fiber_lpa_mod_linkmode_lpa_t(). Perhaps extracting info from status should be moved to a helper so we can return early without affecting the rest of the flow? Is my understanding correct? Russell? > + if (status & MII_M1011_PHY_STATUS_FULLDUPLEX) > + phydev->duplex = DUPLEX_FULL; > + else > + phydev->duplex = DUPLEX_HALF; > + > + switch (status & MII_M1011_PHY_STATUS_SPD_MASK) { > + case MII_M1011_PHY_STATUS_1000: > + phydev->speed = SPEED_1000; > + break; > + > + case MII_M1011_PHY_STATUS_100: > + phydev->speed = SPEED_100; > + break; > + > + default: > + phydev->speed = SPEED_10; > + break; > + } > + > if (!fiber) { > err = genphy_read_lpa(phydev); > if (err < 0) > @@ -1291,28 +1313,6 @@ static int marvell_read_status_page_an(struct phy_device *phydev, > } > } > > - if (!(status & MII_M1011_PHY_STATUS_RESOLVED)) > - return 0; > - > - if (status & MII_M1011_PHY_STATUS_FULLDUPLEX) > - phydev->duplex = DUPLEX_FULL; > - else > - phydev->duplex = DUPLEX_HALF; > - > - switch (status & MII_M1011_PHY_STATUS_SPD_MASK) { > - case MII_M1011_PHY_STATUS_1000: > - phydev->speed = SPEED_1000; > - break; > - > - case MII_M1011_PHY_STATUS_100: > - phydev->speed = SPEED_100; > - break; > - > - default: > - phydev->speed = SPEED_10; > - break; > - } > - > return 0; > } >