Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1028369ybb; Wed, 8 Apr 2020 15:00:35 -0700 (PDT) X-Google-Smtp-Source: APiQypL1/O5Nv0SYpwmGe1gGJoqQj2sEf5pwpmKOY7bVPHDDBZSuIIT/XqVouzu/URBu355F/Occ X-Received: by 2002:aca:4cd8:: with SMTP id z207mr4003534oia.155.1586383235020; Wed, 08 Apr 2020 15:00:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586383235; cv=none; d=google.com; s=arc-20160816; b=hF2yWHTaYXhpav+o/08N8X5hScvZQOVJled4D2fsvEZ4QPx0kZ7KqLojTP3xO7L+kI r097yNUel0bJTZs5F753KfrZT6XG2jB7Molpc9PgLN3U/7HZ2/0/GeE2b3VV88f9xfHK i1dCIrpQX51iYwmnxddpDfI6I6ckbmstWM8+zDuDkhM7aZsny1aZGzoeZECxJI+Bh81U 2D8Rgb/QhRdwYVepdbOHZkHeV8nKo8kcBlfHm2/et3PXSRSke4gRH2CxQpPL3y8FQoWq fu9TpW2jv7bx8WndJbp/40A15guZZKXfBZC1zxusiUOLBHmBjxpVDnwY6KqyHdcaJO+T 30GA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=/Xfxr6bQ0YUHTVcrSQ5u+QRzIamIw5VqJzOKJ0VgNNU=; b=IYI2gF5cwLMKSRNr3L397o8dyISeA2vvPbSNnMPJJvMNkajeRzeZEEkyaKKctH+2TC xqZCsPLTaAwhgvf2HiO6SroAqd8WIUIPn8gV4oITRkvOEoIjKD9YyiCsC4ggRhZ5WpZ9 itmS7hs9vV3yXfJEOl5hcSOa8uO4RSP74KYU4PCvEycbrRhBptxs/g4wrBaKAhZ6Ce2C S4OQOCcU+MzupMezOQLHu5nTvR0rzx+TaSMvxJQlCEhsSlRDQVXlj0+Kt1rnzFJO/PEw 9gdo2opHEHPX2nVx+u/Xfb/aE9cuULFN+Jd51756NOzx0pg1MlQQjMmEXBliH7TuQcnA F8wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pqgruber.com header.s=mail header.b="k/0qDYpo"; 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=pqgruber.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f21si3142611oou.47.2020.04.08.15.00.22; Wed, 08 Apr 2020 15:00:34 -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=@pqgruber.com header.s=mail header.b="k/0qDYpo"; 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=pqgruber.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729289AbgDHVpa (ORCPT + 99 others); Wed, 8 Apr 2020 17:45:30 -0400 Received: from mail.pqgruber.com ([52.59.78.55]:44858 "EHLO mail.pqgruber.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726754AbgDHVpa (ORCPT ); Wed, 8 Apr 2020 17:45:30 -0400 Received: from workstation.tuxnet (213-47-165-233.cable.dynamic.surfer.at [213.47.165.233]) by mail.pqgruber.com (Postfix) with ESMTPSA id D4D19C72B3E; Wed, 8 Apr 2020 23:45:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqgruber.com; s=mail; t=1586382328; bh=/Xfxr6bQ0YUHTVcrSQ5u+QRzIamIw5VqJzOKJ0VgNNU=; h=From:To:Cc:Subject:Date:From; b=k/0qDYpotiovTl+xpRajQ9esKeqgReP0BjkNmbwAasfOY0GzIsXwv2wMkoEvZcZIa fZYXBZIE8zZ3x/IXsPy8WBeXz/dCz4QwPnP25vbnvde5ETHg3UbR0YdlVXhdSZP8qJ nqkHJu02YexlKmteRSlFpgB0nnWW8YFhuMcQ0q5I= From: Clemens Gruber To: netdev@vger.kernel.org Cc: Russell King , Andrew Lunn , Florian Fainelli , Heiner Kallweit , "David S . Miller" , linux-kernel@vger.kernel.org, Clemens Gruber , stable@vger.kernel.org Subject: [PATCH] net: phy: marvell: Fix pause frame negotiation Date: Wed, 8 Apr 2020 23:43:26 +0200 Message-Id: <20200408214326.934440-1-clemens.gruber@pqgruber.com> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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+ 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 (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; } -- 2.26.0