Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1957366ybb; Sat, 11 Apr 2020 16:29:58 -0700 (PDT) X-Google-Smtp-Source: APiQypKnccd4SdhwQrXoyMfs/9Ex/9zhYQvkSxY3W9It0pQxh7a7XvkJlL75WqPId9xfe0Q0pLdk X-Received: by 2002:ad4:5184:: with SMTP id b4mr11123479qvp.221.1586647798441; Sat, 11 Apr 2020 16:29:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586647798; cv=none; d=google.com; s=arc-20160816; b=QhcHinRhefm3X0W933ZhqZPzsEHG1M5mahnngh9Dif33/v1woUSvX5XZWuqF85dsmO dLbzCusoOPDykZVKxsFpIF3flBgjBIbhoC3nI4AxFYdYhY8zz5e8841SKrrUj+H1RFff ltL7cadHDOBytpUiXRNfwktlyiMjF+1ZzX2V5jt7qhYtxQ4Wjyi7Zq7AEiMNYRpjyPq3 p4KkVrNKt5PT1L/JzDk//CWTeGZq1TUeYAA3Wm2T+qlkTgCdqELTv+JWSgpvn1b0V08h PCs33Ub1o1M7YW4N0yMz+BtkjtqFIMXlhZhtwE4yL/SjJHQGN0Op9fGjl+VIMPiN5Awz 4BUA== 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=scgbREVZpoqakno2oEqin9PL0twRs9LRp9xBXWccSYA=; b=SnP4llzeK1U0ZzaKBuY/NsVxTmv5UuDTsTljsXxH88gJxps6aJf3WYpTg7gylHZHiD +O2wC+PRcRo9S03mNqNd3Wd4ATbpkSlaQdRz0nnx1ZP97m1nj/qICETZo6IBzrnxaDrF UZ/uzYQO1w2vj+w4+qlCzwt7cHyEpKpo19voeRTuIcrfy2+uRheeVOte/UaGrAjSc9d+ MmqmApodhr7tMFLP9FUNt9uktIV1ggOUT1dc0P0HHUwyg+eMmIqdVR+AOrj74LTDK0cb mMsyFcor1fTHS8kVUAZTdOZPNhIUN6M0bejWpqWMnBnPJFO8QZwKRWWcaGht5Magsfmj TOCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BNMeb6gh; 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 g14si3637660qki.334.2020.04.11.16.29.44; Sat, 11 Apr 2020 16:29:58 -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=BNMeb6gh; 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 S1730568AbgDKX2a (ORCPT + 99 others); Sat, 11 Apr 2020 19:28:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:40494 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728821AbgDKX21 (ORCPT ); Sat, 11 Apr 2020 19:28:27 -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 9276720787; Sat, 11 Apr 2020 23:28:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586647706; bh=VJVMs1ty4aklYcknxXSyG4+HJQ94axF1UzhRTrFSIW4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=BNMeb6gh6oZRFmHIvDKwnglHNapVVyGPi3dcxR0Swnshxs6nODmwJMN02UuRHnVZL EJtXrd+uaB/rM7humfEMsBIefc4aJGdzX6/BdcdUNLsWJqxWWdn2T0IK/Ke379Xlp4 7xouNBvYkutFYjAFMx/MbiTswjpVdlyUlo2Z+e2U= Date: Sat, 11 Apr 2020 16:28:24 -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 Subject: Re: [PATCH v2] net: phy: marvell: Fix pause frame negotiation Message-ID: <20200411162824.59791b84@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20200411165125.1091-1-clemens.gruber@pqgruber.com> References: <20200411165125.1091-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 Sat, 11 Apr 2020 18:51:25 +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. > > As the Marvell 88E1510 datasheet does not specify the timing between the > link status and the "Speed and Duplex Resolved" bit, we have to force > the link down as long as the resolved bit is not set, to avoid reporting > link up before we even have valid Speed/Duplex. > > Tested with a Marvell 88E1510 (RGMII to Copper/1000Base-T) > > Fixes: fcf1f59afc67 ("net: phy: marvell: rearrange to use genphy_read_lpa()") > Signed-off-by: Clemens Gruber > --- > Changes since v1: > - Force link to 0 if resolved bit is not set as suggested by Russell King > > drivers/net/phy/marvell.c | 46 ++++++++++++++++++++------------------- > 1 file changed, 24 insertions(+), 22 deletions(-) > > diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c > index 9a8badafea8a..561df5e33f65 100644 > --- a/drivers/net/phy/marvell.c > +++ b/drivers/net/phy/marvell.c > @@ -1278,6 +1278,30 @@ static int marvell_read_status_page_an(struct phy_device *phydev, > int lpa; > int err; > > + if (!(status & MII_M1011_PHY_STATUS_RESOLVED)) { > + phydev->link = 0; > + return 0; > + } This doesn't address my comment, so was I wrong? What I was trying to say is that the function updates the established link info as well as autoneg advertising info. If the link is not resolved we can't read the link info, but we should still report the advertising modes. No?