[net-next,7/8] net: phy: realtek: check validity of 10GbE link-partner advertisement
Message ID | 3722c3cf286bdaf89343c6d9e552d3eef79a2557.1683756691.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 b10csp3999640vqo; Wed, 10 May 2023 16:59:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ48pj7V6/2JseqPOpBCjWfCyJtSuCXFuOj4VN+oQFifdAgTw3vfnumA1YvdZNi8NG2/6604 X-Received: by 2002:a17:902:e547:b0:1ac:b03c:a58e with SMTP id n7-20020a170902e54700b001acb03ca58emr5711810plf.25.1683763185873; Wed, 10 May 2023 16:59:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683763185; cv=none; d=google.com; s=arc-20160816; b=H7GAxwC16RKsFeCaKNnWNjfOApTsvcvQMaiAksWyfoo4wVlw06AzNcpvOsYg6WwC2B 3/nzdje+hnmbocWvDPVNUo+rf4Kt3Hr8olRTZS89rl9+X4vcBwCibld3QzUoqTrpVxA/ FcOXjFs0bulsf+0x0QXdvHpDtZdvhQc1ibQwY0Xy4/miDaheDcyyw8nqvD3fX4VdcHqO ++VANYGT41wm99DvhNYw4oaWlBwFay2C50iNdo34w1t3zRnk99MdIb/epvA/hzCBW040 rOTMY4QRLH1GDsnVbLhjZfR4NO9gRylrdAwSXqXTvKJUzL+JI81dwmrjJXhiO0j0B7dM KvEA== 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:to:from:date; bh=h+3FQ3Pb3lJqR+IKZmMEYcEXjSkVddYPT3xYFpZW48U=; b=d4guhVENUwc1ULbHWRgM6KcE4GVZiCB8Vhwmhlg92p/QKuXg7YKg7nXC4rJa2aSX8n eZ/YHg0iTsgR6QScTD42ITrqqb9HMt6UXJNATBJwLUXRRFaLQuxdA6cBBVvrPGFu7g54 JRnUe3e5TcBHfhodtDR+VoyAitIFIC7bSDGCoYOi6SZY4v+mR8T5/xFc4pCC4sEX+GTU jaWH3gfKba/uUsVJ/Vh+jBD87YmXdGmUuY5aWT913ddz3JyBLt7BXyWNz9dFB4kuif8p njBs8nePJgxsPKsChzN5nFnkdDdblKIj5oeDBP15vANrz3KCqDhqNqVPW8eF9NhXHwqJ ofmQ== 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 j4-20020a17090276c400b001a95babe3c0si5038274plt.371.2023.05.10.16.59.29; Wed, 10 May 2023 16:59:45 -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 S236723AbjEJXBw (ORCPT <rfc822;jeantsuru.cumc.mandola@gmail.com> + 99 others); Wed, 10 May 2023 19:01:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236801AbjEJXBr (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 10 May 2023 19:01:47 -0400 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81A1F49D9; Wed, 10 May 2023 16:01:42 -0700 (PDT) Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from <daniel@makrotopia.org>) id 1pwsoW-0004Vu-2l; Wed, 10 May 2023 23:01:41 +0000 Date: Thu, 11 May 2023 00:59:46 +0200 From: Daniel Golle <daniel@makrotopia.org> To: netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.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>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Subject: [PATCH net-next 7/8] net: phy: realtek: check validity of 10GbE link-partner advertisement Message-ID: <3722c3cf286bdaf89343c6d9e552d3eef79a2557.1683756691.git.daniel@makrotopia.org> References: <cover.1683756691.git.daniel@makrotopia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <cover.1683756691.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?1765553666325853389?= X-GMAIL-MSGID: =?utf-8?q?1765553666325853389?= |
Series |
Improvements for RealTek 2.5G Ethernet PHYs
|
|
Commit Message
Daniel Golle
May 10, 2023, 10:59 p.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 cde61a30ac4c..29168f98f451 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -715,6 +715,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); }