Message ID | 20230620-feature-c45-over-c22-v2-6-def0ab9ccee2@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5689736vqr; Fri, 23 Jun 2023 04:12:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7REi89xdjbDtX570jcLrhKGkfdZU1so8ByY91XTNOwEVcV+A64wR7HSNFqiWLCNJL1R29T X-Received: by 2002:a05:6a20:8f0b:b0:107:1805:feea with SMTP id b11-20020a056a208f0b00b001071805feeamr28004356pzk.37.1687518726697; Fri, 23 Jun 2023 04:12:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687518726; cv=none; d=google.com; s=arc-20160816; b=0MpeyamzbVWncpVboBs/oCpFr0ydKE8r/NHLLpyv64LBSq02XTO9D0NgwYDrDUUrv7 a2Gv81zbS0dlfqvjq9LcgVyFBi0dUlvtnaGsYfSlpIMzhxkdl6jJ5Wdn+PP2blsUOKR+ NZ25jMeWY40IL80iMT1i5JlKdIzL3xbVnXsasIwt9c/4wq705x/a/K9uNrp4lsjmvCcx uY0rUj0WUqkkq4nbpDdbfNQ0fLmpU6hLZrSByA5aMStJs8y1wjf7UTpZ8+Jfhek4TWkJ YbEayFwpJogKMEcpiFiQPnOCRNR2hNhm3ttWTtHsGNtB+g+iWP+ZeUv7MlbFz1MW3OWc qtjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=aKdR3QPmyq7+6EljlQ451QSp3/scHw5pWGCh06IzL+Q=; b=I8sGbjrP2+Snxt/IgZHhPQx0u2xsca0HdT55Q4dLV66VEJ6tRiwVPp3sNKZKxjCz8o Fp1Fi2poWuSM8kzxMbCdNSDGsjKNwmDvQRXoqX8JkluEWftD6tP3I6HjySW8kxpQWHJo RPrgwoUHu4nA8lKG6GoWo+p9DodgUzsi4bl1Bpf0hlb0Dx0TAIGn5KSUP+F/k7LYF74J q/IZvH3nsDx9BUIeVGxGLx52Ue1TTR8KZM6pZrIzOq6rG7vWqK86hvvA5bSepe71R3kS poJOhloL4camq+Xgh9wL1ZJhlVvoWHGrJ7rvzWjJbJ88pCdpWr5ULYvjfH8/exOFNAJe 1gaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Fg6wduN5; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 17-20020a630011000000b0053eef60f940si8360409pga.765.2023.06.23.04.11.45; Fri, 23 Jun 2023 04:12:06 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Fg6wduN5; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232266AbjFWKaX (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Fri, 23 Jun 2023 06:30:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232276AbjFWK34 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 23 Jun 2023 06:29:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E7BF1BCA for <linux-kernel@vger.kernel.org>; Fri, 23 Jun 2023 03:29:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1351F61A18 for <linux-kernel@vger.kernel.org>; Fri, 23 Jun 2023 10:29:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46DF5C433CC; Fri, 23 Jun 2023 10:29:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687516182; bh=1muRLOb59+kQ7ZeXLBMZWXmkOisk9F6Bf+D/rqGDwuY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Fg6wduN550kCKQZAgcUK+qaSxIyBJvy3NpfG7LFBjHOeAxveVY2qfyTrz2SYTMYok V9yn8w0v64hHHiyJx+/fThXbsPsHutp/n8hsSi5SMYEIjOGK7w/qZFfzbMtzBX1iTE 29nL8rlcN2obNqdLHbi5OzZRLRIie1wjFJqC7qN6U6kVIaOy/hCRiEk6wu2b0fePP7 D/kwRdTlPoDZ+t4LzMymI/5K5LWgCcR0jpt/8U5pI7RJI2Y89s57LurgxGWmq0bYYx G/weE/QDJSfjzcCEDCxb815JI2ABvpdqcRO+qIXgrxyLIBUbxw8rXN2aqyO4nBjcnF WHOJX1er4qZUg== From: Michael Walle <mwalle@kernel.org> Date: Fri, 23 Jun 2023 12:29:15 +0200 Subject: [PATCH net-next v2 06/10] net: phy: print an info if a broken C45 bus is found MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230620-feature-c45-over-c22-v2-6-def0ab9ccee2@kernel.org> References: <20230620-feature-c45-over-c22-v2-0-def0ab9ccee2@kernel.org> In-Reply-To: <20230620-feature-c45-over-c22-v2-0-def0ab9ccee2@kernel.org> To: 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>, Yisen Zhuang <yisen.zhuang@huawei.com>, Salil Mehta <salil.mehta@huawei.com>, Florian Fainelli <florian.fainelli@broadcom.com>, Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>, =?utf-8?q?Marek_Beh=C3=BAn?= <kabel@kernel.org>, Xu Liang <lxu@maxlinear.com> Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Walle <mwalle@kernel.org> X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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?1769491636843657104?= X-GMAIL-MSGID: =?utf-8?q?1769491636843657104?= |
Series |
net: phy: C45-over-C22 access
|
|
Commit Message
Michael Walle
June 23, 2023, 10:29 a.m. UTC
If there is an PHY which gets confused by C45 transactions on the MDIO
bus, print an info together with the PHY identifier of the offending
one.
Signed-off-by: Michael Walle <mwalle@kernel.org>
---
I wasn't sure if this should be phydev_dbg() or phydev_info(). I mainly
see this as an info to a user why some PHYs might not be probed (or
c45-over-c22 is used later).
---
drivers/net/phy/mdio_bus.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
Comments
On Fri, Jun 23, 2023 at 12:29:15PM +0200, Michael Walle wrote: > If there is an PHY which gets confused by C45 transactions on the MDIO > bus, print an info together with the PHY identifier of the offending > one. > > Signed-off-by: Michael Walle <mwalle@kernel.org> > > --- > I wasn't sure if this should be phydev_dbg() or phydev_info(). I mainly > see this as an info to a user why some PHYs might not be probed (or > c45-over-c22 is used later). The information is useful to the DT writer, not the 'user'. I would assume the DT writer has a bit more kernel knowledge and can debug prints on. So i would suggest phydev_dbg(). > @@ -617,10 +617,10 @@ static int mdiobus_scan_bus_c45(struct mii_bus *bus) > */ > void mdiobus_scan_for_broken_c45_access(struct mii_bus *bus) > { > + struct phy_device *phydev; > int i; > > for (i = 0; i < PHY_MAX_ADDR; i++) { > - struct phy_device *phydev; > u32 oui; It is not clear why you changed the scope of phydev. I guess another version used phydev_info(), where as now you have dev_info()? Andrew > > phydev = mdiobus_get_phy(bus, i); > @@ -633,6 +633,11 @@ void mdiobus_scan_for_broken_c45_access(struct mii_bus *bus) > break; > } > } > + > + if (bus->prevent_c45_access) > + dev_info(&bus->dev, > + "Detected broken PHY (ID %08lx). Disabling C45 bus transactions.\n", > + (unsigned long)phydev->phy_id); > } > > /** > > -- > 2.39.2 >
On Fri, Jun 23, 2023 at 07:42:08PM +0200, Andrew Lunn wrote: > On Fri, Jun 23, 2023 at 12:29:15PM +0200, Michael Walle wrote: > > If there is an PHY which gets confused by C45 transactions on the MDIO > > bus, print an info together with the PHY identifier of the offending > > one. > > > > Signed-off-by: Michael Walle <mwalle@kernel.org> > > > > --- > > I wasn't sure if this should be phydev_dbg() or phydev_info(). I mainly > > see this as an info to a user why some PHYs might not be probed (or > > c45-over-c22 is used later). > > The information is useful to the DT writer, not the 'user'. I would > assume the DT writer has a bit more kernel knowledge and can debug > prints on. So i would suggest phydev_dbg(). > > > @@ -617,10 +617,10 @@ static int mdiobus_scan_bus_c45(struct mii_bus *bus) > > */ > > void mdiobus_scan_for_broken_c45_access(struct mii_bus *bus) > > { > > + struct phy_device *phydev; > > int i; > > > > for (i = 0; i < PHY_MAX_ADDR; i++) { > > - struct phy_device *phydev; > > u32 oui; > > It is not clear why you changed the scope of phydev. I guess another > version used phydev_info(), where as now you have dev_info()? I think it is so it can be used in the dev_info() call below. However Smatch has it's doubts that it is always initialised there. .../mdio_bus.c:638 mdiobus_scan_for_broken_c45_access() error: we previously assumed 'phydev' could be null (see line 627) > > phydev = mdiobus_get_phy(bus, i); Line 627 immediately follows the line above, like this: if (!phydev) continue; > > @@ -633,6 +633,11 @@ void mdiobus_scan_for_broken_c45_access(struct mii_bus *bus) > > break; > > } > > } > > + > > + if (bus->prevent_c45_access) > > + dev_info(&bus->dev, > > + "Detected broken PHY (ID %08lx). Disabling C45 bus transactions.\n", > > + (unsigned long)phydev->phy_id); > > } > > > > /** > > > > -- > > 2.39.2 > > >
Am 2023-06-23 22:35, schrieb Simon Horman: > On Fri, Jun 23, 2023 at 07:42:08PM +0200, Andrew Lunn wrote: >> On Fri, Jun 23, 2023 at 12:29:15PM +0200, Michael Walle wrote: >> > If there is an PHY which gets confused by C45 transactions on the MDIO >> > bus, print an info together with the PHY identifier of the offending >> > one. >> > >> > Signed-off-by: Michael Walle <mwalle@kernel.org> >> > >> > --- >> > I wasn't sure if this should be phydev_dbg() or phydev_info(). I mainly >> > see this as an info to a user why some PHYs might not be probed (or >> > c45-over-c22 is used later). >> >> The information is useful to the DT writer, not the 'user'. I would >> assume the DT writer has a bit more kernel knowledge and can debug >> prints on. So i would suggest phydev_dbg(). Why the DT writer? There could be no DT at all, right? But yeah, fair enough, I thought of our hardware engineers as a user, which might be surprised to find no C45 transactions at all for a C45 PHY. That said, I don't have a strong opinion. I'm fine to switch that to dev_dbg() to make the kernel output less noisy. >> > @@ -617,10 +617,10 @@ static int mdiobus_scan_bus_c45(struct mii_bus *bus) >> > */ >> > void mdiobus_scan_for_broken_c45_access(struct mii_bus *bus) >> > { >> > + struct phy_device *phydev; >> > int i; >> > >> > for (i = 0; i < PHY_MAX_ADDR; i++) { >> > - struct phy_device *phydev; >> > u32 oui; >> >> It is not clear why you changed the scope of phydev. I guess another >> version used phydev_info(), where as now you have dev_info()? > > I think it is so it can be used in the dev_info() call below. Yes, to print the PHY ID of the offending one. > However Smatch has it's doubts that it is always initialised there. > > .../mdio_bus.c:638 mdiobus_scan_for_broken_c45_access() error: we > previously assumed 'phydev' could be null (see line 627) > >> > phydev = mdiobus_get_phy(bus, i); > > Line 627 immediately follows the line above, like this: > > if (!phydev) > continue; Mhh, I see. bus->prevent_c45_access could (theoretically) set before calling this function. I could set it to false at the beginning of this function or I could use a new flag to indicate when to print the warning. Any suggestions? -michael
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 00b25f6803bc..38529add6420 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -617,10 +617,10 @@ static int mdiobus_scan_bus_c45(struct mii_bus *bus) */ void mdiobus_scan_for_broken_c45_access(struct mii_bus *bus) { + struct phy_device *phydev; int i; for (i = 0; i < PHY_MAX_ADDR; i++) { - struct phy_device *phydev; u32 oui; phydev = mdiobus_get_phy(bus, i); @@ -633,6 +633,11 @@ void mdiobus_scan_for_broken_c45_access(struct mii_bus *bus) break; } } + + if (bus->prevent_c45_access) + dev_info(&bus->dev, + "Detected broken PHY (ID %08lx). Disabling C45 bus transactions.\n", + (unsigned long)phydev->phy_id); } /**