[RFC,net-next,7/8] net: phy: realtek: check validity of 10GbE link-partner advertisement
Message ID | 0c3e0e665945ecc5f248438f3231ed48f92764df.1682163424.git.daniel@makrotopia.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1653631vqo; Sat, 22 Apr 2023 04:56:30 -0700 (PDT) X-Google-Smtp-Source: AKy350bqIz0fpalakMP3ePYGLKbdcecbien6VCkYiZSQSYAai4RrHH70CH5RYpSOLy12C6OLjXQn X-Received: by 2002:a05:6a00:248e:b0:63f:185a:6db2 with SMTP id c14-20020a056a00248e00b0063f185a6db2mr7958028pfv.18.1682164590440; Sat, 22 Apr 2023 04:56:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682164590; cv=none; d=google.com; s=arc-20160816; b=yovStLV/M6WEn9jUUYdTS2xvd/bczPTGy5NKAqLXqzV1XExA2ocTXywQYEDBxO/z0X NI24a/SO0hCzZTg7pSt4Z/GlCWAAJET/YcB3/hri7Ahy8DpNZZVZoGfnFGT1ZipZGyJh Alm5Sj6XP1QrZTLLbNBrMTk/nNh7vBP1Xj01DIN2h3tom7226xrkPWDrPLHmV9E7LN5+ rpyTvJnyEnX+/8/sW3EZTmW3nIqu8PHXPSAARiOja2Ty4NG4EBH/QtyRs1Fih8HEm4/D iBUJNtX2OJ4Yz3bBR/5qtmozp2xlWsLWu/ylGyF+ZeVD4fbmpC9iOnF2Ic35zWaN6JhM Pmhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=8duXBOr5nLfeKW89wCehrCNfii4pOEpbIxD70HKnG3o=; b=dEB4kWI17lyGfXnNHtyMPo/d9pa4YFG+jF3xSmQU/OYdMvUP6QgGxFvhdIldkEqEhI EhqVDQjcwjfa2C0RgZoAiDZj+qTO2+KmxYme1ySVovAHjyo+gHYE5XuglfzeTnF8SIfi 5TzpJMOYMJ26zyYlDIkwz7qirB100ru0SclfeG2fDLVNClf9Fo0AQSwJ+3lL1TKuUiAV mz9ctssPI4RprwcyauB4/uNAVs2xEPxT0mCIHhqnYrsix4FyOFBGM1yGBEvQ0Uj7Gx2s Bj0LxJ9PmL1H7m/NJ2tMty5QblCVnlP+9aM5/jzSvgRkgt4uvVlU2iw1L4vucqOXbwfR qi/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h5-20020a625305000000b0063d35b6d9ebsi6588197pfb.368.2023.04.22.04.56.17; Sat, 22 Apr 2023 04:56:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229479AbjDVLuB (ORCPT <rfc822;cjcooper78@gmail.com> + 99 others); Sat, 22 Apr 2023 07:50:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229661AbjDVLt7 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 22 Apr 2023 07:49:59 -0400 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9775272D; Sat, 22 Apr 2023 04:49:36 -0700 (PDT) Received: from local by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from <daniel@makrotopia.org>) id 1pqBkE-00086c-2R; Sat, 22 Apr 2023 13:49:34 +0200 Date: Sat, 22 Apr 2023 12:49:30 +0100 From: Daniel Golle <daniel@makrotopia.org> To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>, Russell King <linux@armlinux.org.uk>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com> Cc: Chen Minqiang <ptpt52@gmail.com>, Chukun Pan <amadeus@jmu.edu.cn>, Yevhen Kolomeiko <jarvis2709@gmail.com>, Alexander Couzens <lynxis@fe80.eu> Subject: [RFC PATCH net-next 7/8] net: phy: realtek: check validity of 10GbE link-partner advertisement Message-ID: <0c3e0e665945ecc5f248438f3231ed48f92764df.1682163424.git.daniel@makrotopia.org> References: <cover.1682163424.git.daniel@makrotopia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <cover.1682163424.git.daniel@makrotopia.org> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763877417744357293?= X-GMAIL-MSGID: =?utf-8?q?1763877417744357293?= |
Series |
Improvements for RealTek 2.5G Ethernet PHYs
|
|
Commit Message
Daniel Golle
April 22, 2023, 11:49 a.m. UTC
Only use link-partner advertisement bits for 10GbE modes if they are
actually valid. Check LOCALOK and REMOTEOK bits and clear 10GbE modes
unless both of them are set.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
drivers/net/phy/realtek.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 078f45447ddad..de73049037891 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -706,6 +706,10 @@ static int rtl822x_read_status(struct phy_device *phydev) if (lpadv < 0) return lpadv; + if (!(lpadv & MDIO_AN_10GBT_STAT_REMOK) || + !(lpadv & MDIO_AN_10GBT_STAT_LOCOK)) + lpadv = 0; + mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, lpadv); }