Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp8032876rwr; Wed, 10 May 2023 16:56:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5jpbsp58Qgv/c5fd4eWzeDtJGof30sLDfZhDbw6wu1u3RUE47ijXbOOzqvBqfjdc6+GPm4 X-Received: by 2002:a17:90a:d3d1:b0:24e:3752:194f with SMTP id d17-20020a17090ad3d100b0024e3752194fmr28092896pjw.21.1683763011474; Wed, 10 May 2023 16:56:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683763011; cv=none; d=google.com; s=arc-20160816; b=wHZ9nIk0EJeZ2ocIymYuQ08dk9t6UpL/WQjXEHI1lQuBCG6PMeQg3D8gKPnoaiaAo+ McVLjWq0L/wDSrRSfWhVmQiYnj2nlXbR4f++xM2LMXsjbBq7tByZXTbv7kloRcsdii5H 6C1/xOIhyin2MYGAnyvvioZMZHCHwrlRz+eDErHW1KzLdI6GRuYGqySzYWQd42ncq8Ji jKWhFzEOY4+xx2Fv2O9eAPE9E+0tCrnRKSlZ9zqixjqVMYdKmmvxmPmiiTzA2cTzgwfV B+fNsVcLxHkzF9ha/aGkrmXJvbzmpxKnGMiK6NdFNcm+Wd/ENVLguDnUppXY5ExQb/6C 6n6g== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 8-20020a17090a018800b0023fb875a929si19085312pjc.106.2023.05.10.16.56.39; Wed, 10 May 2023 16:56:51 -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 S236708AbjEJXBw (ORCPT + 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 ); 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 ) id 1pwsoW-0004Vu-2l; Wed, 10 May 2023 23:01:41 +0000 Date: Thu, 11 May 2023 00:59:46 +0200 From: Daniel Golle To: netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , AngeloGioacchino Del Regno 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: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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); } -- 2.40.0