From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.226 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796426069; b=aWAUNbvcitB/6e0wHlb2pYBY0rHSE9jIh7+HigSrXMoLSV716fn1gaYQs21srFgLWIBU j9S40FjFKEjhNHxb16d+PGBo4V97m/TjbTAdXv/veL6dHOvMLxmsHKSnfLsjY89eGkf/g TeHsGGVaVpYUEqC0StPE2VvwQYHjTJTJxbUxuT/dtKKCxVlW5iPTVRMUZ/eGi3bn0m0Mk rs129z4dxnnuEdsIPTpU4KKhdK9OPn/CnWeTeazYu1fugfKN64J90ps+98eWm8BxmJcwM 0icvCpzWksmdEpQdemM34cEE7ZLP2KWazFowtDsnhlfe/HKY+Wgn5VDMzGrXW7+HISA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796426069; 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=M/MqrooIsFSGtDiRMZzA7SeKv2eAUGquWHIgW3hfPWU=; b=h0QaaroA+TTL5OzKIsBhtaQmZGw1DNmIy/HNhfKCw3LDdO+zDoSonjiUSh4O36zC1/k5 d3udqx4iV6CQTZ/hl2jNLbj9xvu0m6hD1h9Q55/Bp5G0zRmIy7ey482yQ2WT9ObUeGbc4 lUoQVBzCXThWIFvRPvBlNpX9crDx6Rin689mSInYegBhSS6vzw7Wl1woh0AyvNuKsk7zb EdPyAfRBwTR+svSs/r5ADUHGF08ExTtqKe8OA8jg/Y3dq8kPFgmQP5kZJS4D6+yJW5VKp RZKm1HdqEDASwcHnckFWwO+mqqmmJBhYXhYSLCbxApcDCjVtIKwVi1m42EKAnhO2dwQ== 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=HPxgaB27; arc=none smtp.remote-ip=74.125.82.226 Received: from mail-dy1-f226.google.com (mail-dy1-f226.google.com [74.125.82.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 5D8B0606A32C for ; Fri, 4 Dec 2026 23:14:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5D8B0606A32C 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=HPxgaB27 Received: by mail-dy1-f226.google.com with SMTP id 5a478bee46e88-3874cf36e63so2013219eec.0 for ; Fri, 04 Dec 2026 15:14:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796426067; x=1797030867; 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=M/MqrooIsFSGtDiRMZzA7SeKv2eAUGquWHIgW3hfPWU=; b=kS9L6Z+XGKaGdF+4xA7dlTUGD8Tcq8FY1VlJy/PyuZWgi0MUP1LH4FL3ZAJHJCc1FP MkkzNKayK5PXjx0Cpf14i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5583:bf4c with SMTP id 5a478bee46e88-3875216e324mr2914070eec.28.1796426067142; Fri, 04 Dec 2026 15:14:27 -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 5a478bee46e88-38752203400sm478508eec.23.2026.12.04.15.14.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Dec 2026 15:14:27 -0800 (PST) X-Relaying-Domain: broadcom.com X-CFilter-Loop: Reflected Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-cdec55db650so801939a12.0 for ; Fri, 04 Dec 2026 15:14:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1796426065; x=1797030865; 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=M/MqrooIsFSGtDiRMZzA7SeKv2eAUGquWHIgW3hfPWU=; b=HPxgaB27KsoG1WtpREorRUrVqEOlllCxGcDMbZKUBxH63rlGHwJtOnT5SNHgUrPeNY PEyvfRbDRq1CXJnGAvGc7Re+t+XI2kBxMUqzc1H64ucQeGSzHJvhmEZ6Osl8zjj4DnRG 3v+5MjJncOs/0SKOMhKs/w9b/rbOAU8/ChwzQ= X-Received: by 2002:a05:6a20:6a0f:b0:3f5:ef59:3aaa with SMTP id adf61e73a8af0-4156163a53fmr3831963637.16.1796426065261; Fri, 04 Dec 2026 15:14:25 -0800 (PST) X-Received: by 2002:a05:6a20:6a0f:b0:3f5:ef59:3aaa with SMTP id adf61e73a8af0-4156163a53fmr3831940637.16.1796426064724; Fri, 04 Dec 2026 15:14:24 -0800 (PST) Received: from [10.67.48.245] ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-ce123564cc0sm2066467a12.10.2026.12.04.15.14.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Dec 2026 15:14:23 -0800 (PST) Message-ID: <5258365b-144e-4e45-8b2f-430477375384@broadcom.com> Date: Fri, 4 Dec 2026 15:14:20 -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 1/3] net: phy: broadcom: Implement cable test initialization 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-2-florian.fainelli@broadcom.com> <179634776647.3146.2322254136336511605@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 IQQQAQgAywUCZWl41AUJI+Jo+hcKAAG/SMv+fS3xUQWa0NryPuoRGjsA3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fZV41OIYWhXMoc57ssjCand5noZi8bKg0bxw4qsg+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: <179634776647.3146.2322254136336511605@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: 2 · Low: 1 > > 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] _bcm_phy_cable_test_start() in drivers/net/phy/bcm-phy-lib.c > (lines 827-829) now calls __bcm_phy_cable_test_init() every time, for… > - [Medium] The commit message only describes adding an ECD initialization > sequence. > - [Low] In _bcm_phy_load_values() (drivers/net/phy/bcm-phy- > lib.c:665-709), the 0xEF write is commented "Specify the number of E*… > > -- > > net: phy: broadcom: Implement cable test initialization > > This patch adds an ECD initialization sequence to bcm-phy-lib. Before > every cable test starts, the sequence loads a fixed set of vendor values > into the expansion registers. It also moves per-pair result reporting into > bcm_phy_cable_test_report_pair() and adds a new > BCM54XX_ECD_LENGTH_RESULTS_FAILED sentinel. > >> diff --git a/drivers/net/phy/bcm-phy-lib.c b/drivers/net/phy/bcm-phy-lib.c >> index b64beade8dd93..9571928db0291 100644 >> --- a/drivers/net/phy/bcm-phy-lib.c >> +++ b/drivers/net/phy/bcm-phy-lib.c >> @@ -657,6 +657,154 @@ static int __bcm_phy_enable_legacy_access(struct phy_device *phydev) >> BCM54XX_ACCESS_MODE_LEGACY_EN); >> } >> >> +struct __bcm_phy_regs { >> + u16 reg; >> + u16 val; >> +}; >> + >> +/* Load values from an array of registers and then restores those registers back to 0 */ >> +static int _bcm_phy_load_values(struct phy_device *phydev, >> + const struct __bcm_phy_regs *regs, >> + size_t num_regs, >> + u16 page_num) >> +{ >> + unsigned int i; >> + int ret; >> + >> + /* Load the registers into the expansion E* registers */ >> + for (i = 0; i < num_regs; i++) { >> + ret = __bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_SEL_ER + >> + regs[i].reg, regs[i].val); >> + if (ret < 0) >> + return ret; >> + } >> + >> + /* Specify the number of E* registers to write and the page number */ >> + ret = __bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_SEL_ER + 0xef, >> + page_num << 14 | GENMASK(num_regs - 1, 0)); > > [Severity: Low] > This isn't a bug, but the comment says this writes the number of E* > registers. The value written is actually a bitmask built only from > num_regs: > > page_num << 14 | GENMASK(num_regs - 1, 0) > > The regs[i].reg offsets are not used here. That means this is only correct > when regs[] covers 0xe0, 0xe1, ... in order with no gaps. > > Both current callers meet that requirement: page 1 is 0xe0-0xe7 and page 2 > is 0xe0-0xe2. The page0_init_regs table in __bcm_phy_cable_test_init() > does not (0xe0-0xe4, 0xe8-0xea). If that table were passed to this helper, > it would enable E5-E7 instead of E8-EA. > > Could this comment, and the one above _bcm_phy_load_values(), call the > value an enable mask and state the contiguity requirement? > > [ ... ] > >> @@ -676,6 +824,10 @@ static int _bcm_phy_cable_test_start(struct phy_device *phydev, bool is_rdb) >> goto out; >> } >> >> + ret = __bcm_phy_cable_test_init(phydev); >> + if (ret < 0) >> + goto out; > > [Severity: Medium] > This now runs the vendor init sequence every time, for every PHY that uses > the shared ECD helpers. There is no PHY ID, revision or flag check. > > At this point in the series, the only in-tree user is the BCM54140 > (bcm54140_drivers in bcm54140.c, via bcm_phy_cable_test_start_rdb()). Its > cable test already worked without this sequence: > > ethtool --cable-test > phy_start_cable_test() > bcm_phy_cable_test_start_rdb() > _bcm_phy_cable_test_start(phydev, true) > __bcm_phy_cable_test_init() > > The commit message only says "a number of PHYs" and does not name them. > > Were the register tables in __bcm_phy_cable_test_init(), and the new > 0x47ae failed value, validated on the BCM54140? The later patch that wires > up the BCM54210E says it was tested on that PHY (RPi 4B). Nothing seems to > cover the BCM54140, and no later patch in the series gates this init. > > Should this be limited to the PHYs it is known to apply to? If not, could > the commit message say which PHYs it was verified on? > > [ ... ] > >> @@ -722,21 +874,26 @@ static bool bcm_phy_distance_valid(int result) >> return false; >> } >> >> -static int bcm_phy_report_length(struct phy_device *phydev, int pair) >> +static void bcm_phy_cable_test_report_pair(struct phy_device *phydev, u8 pair, >> + int fault) >> { >> - int val; >> + int code = bcm_phy_cable_test_report_trans(fault); >> + int len = -ENODATA; >> >> - val = __bcm_phy_read_exp(phydev, >> - BCM54XX_EXP_ECD_PAIR_A_LENGTH_RESULTS + pair); >> - if (val < 0) >> - return val; >> + if (bcm_phy_distance_valid(fault)) >> + len = __bcm_phy_read_exp(phydev, >> + BCM54XX_EXP_ECD_PAIR_A_LENGTH_RESULTS + >> + pair); >> >> - if (val == BCM54XX_ECD_LENGTH_RESULTS_INVALID) >> - return 0; >> + /* The fault type is not valid either when the engine failed */ >> + if (len == BCM54XX_ECD_LENGTH_RESULTS_FAILED) >> + code = ETHTOOL_A_CABLE_RESULT_CODE_UNSPEC; >> >> - ethnl_cable_test_fault_length(phydev, pair, val); >> + ethnl_cable_test_result(phydev, pair, code); >> >> - return 0; >> + if (len >= 0 && len != BCM54XX_ECD_LENGTH_RESULTS_INVALID && >> + len != BCM54XX_ECD_LENGTH_RESULTS_FAILED) >> + ethnl_cable_test_fault_length(phydev, pair, len); >> } > > [Severity: Medium] > The commit message only describes the new ECD initialization sequence. > This hunk also changes what gets reported to user space. > > When a pair's length register reads 0x47ae, the fault code from the > hardware (OPEN, SAME_SHORT or CROSS_SHORT) is now replaced with > ETHTOOL_A_CABLE_RESULT_CODE_UNSPEC, and no length is reported. > > Before this patch, the translated fault code was always reported. The > length was skipped only for 0xffff, so 0x47ae reached user space as a > fault length of 18350 cm. > > This changes ethtool --cable-test output on hardware that is already > supported, such as the BCM54140. > > Could the commit message describe this change and say where the 0x47ae > value comes from? Would it make sense to split it into its own patch, > possibly with a Fixes: tag? I split the 0x47ae handling into a preliminary patch which was originally Nicolai as a fixup sent separately. It documents the saturated ECD failure value and reports the affected pair as unspecified without a distance. The initialization patch now limits the vendor sequence to BCM54210E, which was tested on a Raspberry Pi 4B. BCM54140 keeps its existing initialization path. I also clarified the enable mask and its requirement for consecutive registers starting at 0xe0. pw-bot: cr -- Florian