From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.215.226 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796426323; b=gWZZhh1ImTvsq1uKnEsXnGS6++ZGbalpOoHCmCJ5yeXkoPX5L1T9jJu8PA0OUUnpWdKT AQvxNwdB8b7WRbe8q6bPLiOTmlZZoLDcc61pGSrR/FmDM2SfOKB/qTQNdVZwuRZqiVkoS B8Uq2MNmpsnerrwgWn5CCYFErp2NGaGD08sTy6nVzRLyKqhDDRM5DsVl9rfZmrb9m1TUw A6cHL1hKg+IvZqvhzwN0pA0Q1r4JRsiZrHRCJthHmvqq6oBKcIl7qlVkAgozGSIVBroQu jeHpx/9C/q8sf7s2PHijhPxSblR12Gu5HJBiAcy6O1lnSxqumveuAf2JJTBg8vxcg9w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796426323; h=DMARC-Filter:Received:X-Google-DKIM-Signature:X-Gm-Message-State: X-Gm-Gg:X-Received:Received:X-Relaying-Domain:X-CFilter-Loop:Received: DKIM-Signature:X-Received:X-Received:Received:Message-ID:Date: MIME-Version:User-Agent:Subject:To:Cc:References:Content-Language: From:Autocrypt:In-Reply-To:Content-Type:Content-Transfer-Encoding: X-DetectorID-Processed; bh=eL+TNw55V6J5cH6s8Hew3x4vYYsHTFfM9w9MrKmZ9NQ=; b=KGZdEZwozbUlj+9KT5nlcYmr8pNjI6fTrQiDN0h1RpE2jSIGkS7bw1lZs0urMhG6xqW/ As4ej4pbeOwShcYhGUgxDodF4s3aEzNJbaTDvPfD+aperjkb2t/WhzA/rt+ndxd0Or3ZB Z+11DKckNJrwIaDmOvcttY34Phx2dCa2f5v5DJzblrZPRvZXG3z60YdlAsBDc49MxPTbJ IfGSy3yCS85tQP0RQJ5QmvalyPv9LzpqpJ1GT4EkZNkuSYLiiAA7GZvZdbbCqsikVCYHf OD+V5U5Tgsk8Ddy/RK3DSfVpvIakPrvaqaAEgfMJS9UZO+WG8vpe4HA+GwEXtgbXP6w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass header.d=broadcom.com header.i=@broadcom.com header.a=rsa-sha256 header.s=google header.b=g2QS1NCy; arc=none smtp.remote-ip=209.85.215.226 Received: from mail-pg1-f226.google.com (mail-pg1-f226.google.com [209.85.215.226]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 55C20606A322 for ; Fri, 4 Dec 2026 23:18:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 55C20606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.a=rsa-sha256 header.s=google header.b=g2QS1NCy Received: by mail-pg1-f226.google.com with SMTP id 41be03b00d2f7-cdece95eca4so710502a12.1 for ; Fri, 04 Dec 2026 15:18:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796426322; x=1797031122; h=content-transfer-encoding:content-type:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=eL+TNw55V6J5cH6s8Hew3x4vYYsHTFfM9w9MrKmZ9NQ=; b=CJuCuBzl95nruZZJuNjHV8vvms9twj8aOkbHNNOVkoEtxvQAOiAlTDRM9rFVxN8vMW hnqW8bjiRSJ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6lUPM X-Received: by 2002:a17:90a:d450:b0:3a0:d265:3647 with SMTP id 98e67ed59e1d1-3b5e053997cmr2515465a91.8.1796426322354; Fri, 04 Dec 2026 15:18:42 -0800 (PST) Received: from smtp-us-east1-p01-i01-si01.dlp.protect.broadcom.com (address-144-49-247-28.dlp.protect.broadcom.com. [144.49.247.28]) by smtp-relay.gmail.com with ESMTPS id 98e67ed59e1d1-3b5c7cdc65asm4573983a91.7.2026.12.04.15.18.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Dec 2026 15:18:42 -0800 (PST) X-Relaying-Domain: broadcom.com X-CFilter-Loop: Reflected Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-55e411381aeso17429141cf.0 for ; Fri, 04 Dec 2026 15:18:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1796426320; x=1797031120; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=eL+TNw55V6J5cH6s8Hew3x4vYYsHTFfM9w9MrKmZ9NQ=; b=g2QS1NCy3AaEOGVqOkNwI7CW6d6Sde6iLmlURUThjB0TKbjl5DzAiTtJswpuswbbP2 jgSSiayI0v7z9LXs0kf6vkff8FQk+sA74YFadQ2jQB2ctlMJDklPD5dd6gAVdYbA7SqA LMUxofGgPMi5gUHJ+Kdjy/xGSP29tzyHJmn8c= X-Received: by 2002:a05:622a:1386:b0:55d:3789:8c8e with SMTP id d75a77b69052e-55e3896cdccmr60569751cf.15.1796426319961; Fri, 04 Dec 2026 15:18:39 -0800 (PST) X-Received: by 2002:a05:622a:1386:b0:55d:3789:8c8e with SMTP id d75a77b69052e-55e3896cdccmr60569301cf.15.1796426319322; Fri, 04 Dec 2026 15:18:39 -0800 (PST) Received: from [10.67.48.245] ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-55e366238bcsm31874061cf.6.2026.12.04.15.18.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Dec 2026 15:18:38 -0800 (PST) Message-ID: <6d971bf4-c728-4af6-8d67-30c9748bcf0a@broadcom.com> Date: Fri, 4 Dec 2026 15:18:36 -0800 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next 3/3] net: phy: broadcom: Time out a stuck cable test To: netdev-bot+sashiko@kernel.org Cc: netdev@vger.kernel.org, nb@tipi-net.de, f.fainelli@gmail.com, bcm-kernel-feedback-list@broadcom.com, andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com References: <20261203004802.85707-4-florian.fainelli@broadcom.com> <179634776897.3146.1850367010981287121@kernel.org> Content-Language: en-US, fr-FR From: Florian Fainelli Autocrypt: addr=florian.fainelli@broadcom.com; keydata= xsBNBFPAG8ABCAC3EO02urEwipgbUNJ1r6oI2Vr/+uE389lSEShN2PmL3MVnzhViSAtrYxeT M0Txqn1tOWoIc4QUl6Ggqf5KP6FoRkCrgMMTnUAINsINYXK+3OLe7HjP10h2jDRX4Ajs4Ghs JrZOBru6rH0YrgAhr6O5gG7NE1jhly+EsOa2MpwOiXO4DE/YKZGuVe6Bh87WqmILs9KvnNrQ PcycQnYKTVpqE95d4M824M5cuRB6D1GrYovCsjA9uxo22kPdOoQRAu5gBBn3AdtALFyQj9DQ KQuc39/i/Kt6XLZ/RsBc6qLs+p+JnEuPJngTSfWvzGjpx0nkwCMi4yBb+xk7Hki4kEslABEB AAHNMEZsb3JpYW4gRmFpbmVsbGkgPGZsb3JpYW4uZmFpbmVsbGlAYnJvYWRjb20uY29tPsLB IQQQAQgAywUCZWl41AU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8PVQ0VCACWk3n+ obFABEp5Rg6Qvspi9kWXcwCcfZV41OIYWhXMoc57ssjCand5noZi8bKg0bxw4qsg+9cNgZ3P N/DFWcNKcAT3Z2/4fTnJqdJS//YcEhlr8uGs+ZWFcqAPbteFCM4dGDRruo69IrHfyyQGx16s CcFlrN8vD066RKevFepb/ml7eYEdN5SRALyEdQMKeCSf3mectdoECEqdF/MWpfWIYQ1hEfdm C2Kztm+h3Nkt9ZQLqc3wsPJZmbD9T0c9Rphfypgw/SfTf2/CHoYVkKqwUIzI59itl5Lze+R5 wDByhWHx2Ud2R7SudmT9XK1e0x7W7a5z11Q6vrzuED5nQvkhAAoJEIExtcQpvGagugcIAJd5 EYe6KM6Y6RvI6TvHp+QgbU5dxvjqSiSvam0Ms3QrLidCtantcGT2Wz/2PlbZqkoJxMQc40rb fXa4xQSvJYj0GWpadrDJUvUu3LEsunDCxdWrmbmwGRKqZraV2oG7YEddmDqOe0Xm/NxeSobc MIlnaE6V0U8f5zNHB7Y46yJjjYT/Ds1TJo3pvwevDWPvv6rdBeV07D9s43frUS6xYd1uFxHC 7dZYWJjZmyUf5evr1W1gCgwLXG0PEi9n3qmz1lelQ8lSocmvxBKtMbX/OKhAfuP/iIwnTsww 95A2SaPiQZA51NywV8OFgsN0ITl2PlZ4Tp9hHERDe6nQCsNI/Us= In-Reply-To: <179634776897.3146.1850367010981287121@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-DetectorID-Processed: b00c1d49-9d2e-4205-b15f-d015386d3d5e On 12/3/26 17:29, netdev-bot+sashiko@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found 3 potential > issue(s) to consider. > > Critical: 0 · High: 0 · Medium: 1 · Low: 2 > > If you believe none of the issues are legitimate, please reply to each > issue of Medium severity or higher and explain why the AI is wrong. > If any of them are legitimate and you plan to respin, please let patchwork > know by including "pw-bot: cr" as a separate line at the end of your reply > (one such reply per series is enough). > > - [Medium] The patch resets the PHY only in the timeout branch of > bcm54xx_cable_test_get_status() (drivers/net/phy/broadcom.c:1523),… > - [Low] The timeout branch in bcm54xx_cable_test_get_status() > (drivers/net/phy/broadcom.c:1523) adds a runtime BMCR_RESET for… > - [Low] When a cable test times out, bcm54xx_cable_test_get_status() > (drivers/net/phy/broadcom.c:1515-1526) resets the PHY with… > > -- > > net: phy: broadcom: Time out a stuck cable test > > This commit adds a 5 second timeout to bcm54xx_cable_test_get_status(). > If the ECD run has not finished by then, the PHY is soft-reset and > -ETIMEDOUT is returned, so phylib aborts the test and reruns > config_init(). > >> diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c >> index 19b97beb8be8d..776a88caae9ba 100644 >> --- a/drivers/net/phy/broadcom.c >> +++ b/drivers/net/phy/broadcom.c > > [ ... ] > >> @@ -1486,21 +1491,40 @@ static int bcm54xx_cable_test_start(struct phy_device *phydev) > > [ ... ] > >> static int bcm54xx_cable_test_get_status(struct phy_device *phydev, >> bool *finished) >> { >> + struct bcm54xx_phy_priv *priv = phydev->priv; >> int ret; >> >> ret = bcm_phy_cable_test_get_status(phydev, finished); >> - if (ret < 0 || !*finished) >> + if (ret < 0) >> return ret; >> >> + if (!*finished) { >> + if (time_before(jiffies, priv->cable_test_timeout)) >> + return 0; >> + >> + /* A stuck ECD run cannot be stopped through ECD_CTRL, only a >> + * reset gets the PHY back. phylib reruns config_init() when >> + * it aborts the test. >> + */ >> + genphy_soft_reset(phydev); > > [Severity: Medium] > Is this the only place that resets the PHY after an ECD run has started? > Only the polling state machine reaches it, and only after the 5 second > timeout expires. > > Two other paths in drivers/net/phy/phy.c leave PHY_CABLETEST. The first > is phy_stop(), for example "ip link set dev X down" while a test is > running: > > if (phydev->state == PHY_CABLETEST) { > phy_abort_cable_test(phydev); > netif_testing_off(dev); > } > > The second is _phy_state_machine(), when cable_test_get_status() takes > the ret < 0 path above: > > err = phydev->drv->cable_test_get_status(phydev, &finished); > if (err) { > phy_abort_cable_test(phydev); > netif_testing_off(dev); > state_work = PHY_STATE_WORK_ANEG; > phydev->state = PHY_UP; > break; > } > > phy_abort_cable_test() only calls ethnl_cable_test_finished() and > phy_init_hw(). The BCM54210E entry in broadcom_drivers[] has no > .soft_reset callback, so phy_init_hw() skips the reset and goes straight > to bcm54xx_config_init(). > > bcm54xx_config_init() then calls bcm54xx_adjust_rxrefclk(). That sets > BCM54XX_SHD_APD_EN again when clk125 is disabled or > PHY_BRCM_AUTO_PWRDWN_ENABLE is set. At that point ECD_CTRL still has RUN > and BREAK_LINK set from _bcm_phy_cable_test_start(). > > The comment in bcm54xx_cable_test_start() says an ECD run never finishes > on a line without energy while auto power-down is enabled. The new > comment here says only a reset clears a stuck run. > > Could aborting a test partway through therefore create the same stuck > state this patch tries to recover from? > > After the abort the state is PHY_UP or PHY_HALTED. Nothing polls > cable_test_get_status() again, so this timeout never fires. > > On the phy_stop() path with WoL enabled, bcm54xx_suspend() returns > before it writes BMCR_PDOWN: > > if (phydev->wol_enabled) > return bcm54xx_set_wakeup_irq(phydev, true); > > bcm54xx_resume() soft-resets only when PHY_BRCM_IDDQ_SUSPEND is set. A > down/up cycle would therefore not clear the stuck run either. The error > path goes straight to PHY_UP without any suspend. > > This depends on two hardware behaviours I could not verify. One is that > the ECD run stays stuck through config_init() with APD re-enabled. The > other is that the later BMCR writes from config_aneg do not clear it. > > Could the reset go somewhere that every abort passes through? One option > is ".soft_reset = genphy_soft_reset" in the BCM54210E entry. Another is > a reset in bcm54xx_config_init() when ECD_CTRL still reads in progress. > > [Severity: Low] > Can this reset wipe state that config_init() does not restore? The > comment says phylib reruns config_init() when it aborts the test. That > is true, through phy_abort_cable_test()->phy_init_hw()-> > bcm54xx_config_init(). But config_init() only restores the settings it > makes itself. > > An earlier commit in this series, "net: phy: broadcom: Implement cable > test initialization", left the soft reset out of the reference ECD > sequence for exactly this reason: > > drivers/net/phy/bcm-phy-lib.c:__bcm_phy_cable_test_init() { > ... > /* Disable ECD to load parameters. Note that the reference sequence > * soft-resets the PHY first, but that is only needed for the Broadcom > * DVT process and would discard the configuration done at > * config_init() time. > */ > ... > } > > Wake-on-LAN, for example, is written directly to hardware by > bcm54xx_phy_set_wol()->bcm_phy_set_wol(), and no copy is kept. > bcm54xx_config_init() only reads and acknowledges > BCM54XX_WOL_INT_STATUS. > > Suppose BMCR_RESET clears the WoL registers on BCM54210E. Would WoL set > with "ethtool -s ethX wol g" then stop working after a timed-out cable > test, with no message, while the kernel still reports it as enabled? > > I could not confirm this on the hardware. bcm54xx_resume() already > soft-resets on PHY_BRCM_IDDQ_SUSPEND platforms without reprogramming > WoL, which may mean the registers survive a reset. > > The commit message also doesn't mention this side effect of the reset. > Could it be added? > >> + >> + return -ETIMEDOUT; >> + } > > [Severity: Low] > Should this timeout branch log something? The return value of > genphy_soft_reset() is ignored, and nothing is printed. > > _phy_state_machine() handles -ETIMEDOUT by calling > phy_abort_cable_test(). That sends the notification created by > ethnl_cable_test_alloc() with ETHTOOL_A_CABLE_TEST_NTF_STATUS_COMPLETED > and no pair results, and phylib then drops the error code. > > As a result, "ethtool --cable-test" reports a completed test with no > results. Nothing in dmesg says the ECD run hung or that the PHY was > reset. > > Would a phydev_warn() here help? The commit message also doesn't say > what the user sees in this case. I moved the reset into the PHY reinitialization path shared by timeout, status-read failure, and interface shutdown during a cable test. The reset runs before APD is restored and preserves the programmed WoL filters and interrupt routing. The driver now logs the timeout and any reset failure. The commit message also describes the completion notification without pair results. pw-bot: cr -- Florian