From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=194.13.80.246 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795899255; b=2tLzt3j8pwjLnYDGAaRW4F7sSHeiN4WxqJQAutyuZXyl6AvwNtVwc17pbd8g8p6+xsiB L9dUaNUpEq+6/d/Cfl9TG30UminF4UMUbQiI+SfCYnqWWlKSdDC6a0nx+V5Ynkl3FMF0I FXnG/pmOhbRg6yPyJhHO+D67PpYu9hG4wQcR/MJmrR7j9yVuI49TCONmnHhRwXVf3N5lG Z3R1TkUxj7v22bDvCemsOPEOMMq5WBNt7cUB8vFH1UXosJdwTSZgoLHZKMhdK4ZacPck7 TsIRSRrX9cR6dzgP4kJFeu2Z+D6oRwPAmmC7WAbbXZwtP2vdDmV+Xebi29iAh4k5wyg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795899255; h=DMARC-Filter:Received:DKIM-Signature:MIME-Version:Date:From:To:Cc: Subject:In-Reply-To:References:Message-ID:X-Sender:Content-Type: Content-Transfer-Encoding:X-Last-TLS-Session-Version; bh=SJdDCTzV2nTT0JJCmMjblSPwDYHE8IRno2FLETU6rrk=; b=Se6MHoXtqIJ1X7ba/vXJMPSYfjtqO1BfNQJ2mxeK9OUSgX5xBQV1+P1f+krNEVfJwIr8 pnf43Px7GideEik48+2ywnUts0b7iHU8SILVuyQj+5oO3lbeMlyvzo4RbIgsDefoN1ZSy +c75FDaz42dgSAm4eXTcQ545ssy8wKEmSn1Wa1opOLbDivJRSHn+MPkfiyXrMmwRT8fj8 TVdUMDjmVwV0jymbYim1BdGdWN5FzwYq/dEChaUslJG0b7tIJJRLr3bW0sexKpskWmOGo TRsFv3/764T37qh/Rq8UcORvt53SPq89srDpVCyZKUumrfygT2kEpWs4+MYQgspKiKw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; dkim=pass header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b="JLI1Jr/K"; arc=none smtp.remote-ip=194.13.80.246 Received: from mail.tipi-net.de (mail.tipi-net.de [194.13.80.246]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68771606A31C; Sat, 28 Nov 2026 20:54:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 68771606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=JLI1Jr/K Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 21A23A03F0; Sat, 28 Nov 2026 21:54:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim; t=1795899251; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=SJdDCTzV2nTT0JJCmMjblSPwDYHE8IRno2FLETU6rrk=; b=JLI1Jr/KMnVwKi5RsODfnAxMmDRZ1CX8s3SnOsC5NVfi7sZuWoBtDzjfjpjF7zss3+W/tb YX6m8Tty5yi6v3AxgrFZBXr0Fauw5Zt3vRXe34k1lVkUtWGC5rbzMVGLUb4z12q6lzmOM3 Pd7ZWxzH9ovs+9nFT+eJoRjma80KIpSyGHxNuDnmAZpUepfxFjB+CAeRXA7DyTIUdOx4qS xangomFF40aQiUgGt5lwUPBc15RgKt1uHXxtRvbxnNvIMi45N9/v3N8+ya3a91UhQG6F/1 0wVQR+vAt8WGhtmx189enL+yKTzdzhyB1wqz+WIb/F/0L51zjN2Q5pRE557eeQ== X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Date: Sat, 28 Nov 2026 21:54:08 +0100 From: Nicolai Buchwitz To: Florian Fainelli Cc: netdev@vger.kernel.org, Doug Berger , Broadcom internal kernel review list , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, Mlody12 mlody12 Subject: Re: [PATCH net-next v7 1/4] net: phy: Map C45 probe read errors to -ENODEV during bus scan In-Reply-To: <20261124185820.3954716-2-florian.fainelli@broadcom.com> References: <20261124185820.3954716-1-florian.fainelli@broadcom.com> <20261124185820.3954716-2-florian.fainelli@broadcom.com> Message-ID: X-Sender: nb@tipi-net.de Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Last-TLS-Session-Version: TLSv1.3 On 24.11.2026 19:58, Florian Fainelli wrote: > get_phy_c22_id() maps a bus read error of -EIO or -ENODEV to -ENODEV, > so > that mdiobus_scan_bus_c22() carries on with the next address when > nothing > answers. get_phy_c45_ids() only does so for phy_c45_probe_present(); a > failed read of the devices in package registers is turned into -EIO, > which > mdiobus_scan_bus_c45() treats as fatal and which makes the whole > __mdiobus_register() fail. > > MDIO controllers that report a read from an empty address as a bus > error > (e.g. MDIO_READ_FAIL on the UniMAC MDIO block) and that provide > read_c45() > with unmasked addresses therefore cannot be registered: the C45 scan > fails > on the first empty address. mdio-bcm-unimac does not provide read_c45() > yet, this is enabled by "net: mdio: mdio-bcm-unimac: Add Clause 45 > support" later in this series. > > Make get_phy_c45_devs_in_pkg() apply the same mapping as > get_phy_c22_id() > to its first read (MDIO_DEVS2): a failure with -EIO or -ENODEV there > means > that nothing answered and is reported as -ENODEV. A failure of the > second > read (MDIO_DEVS1) happens once the first one succeeded, i.e. once the > MMD > has answered, and is still reported as -EIO so that the PHY is not > silently > skipped. > > get_phy_c45_ids() then handles -ENODEV in the two places that look for > a > device at an address: the loop over the MMDs and the MMD 0 fallback. In > the > loop, an MMD that does not answer is handled like one that reads as all > Fs, > except that the remaining MMDs are not probed: the scan goes straight > to > MMD 0, and -ENODEV is only returned if that does not answer either, so > PHYs > that only respond on MMD 0 are still found while an empty address costs > a > bounded number of bus reads. Carrying on with the remaining MMDs is not > an > option: the vendor MMD presence check done on the way fails with the > same > bus error on such a controller and ends the scan before MMD 0 is > reached. > > This patch does not change how the other errors are reported: the > vendor > MMD presence check done while reading the identifiers and the reads of > the > per-MMD identifiers themselves only happen once a device has answered, > and > their error is returned as is. The kernel-doc therefore documents "a > negative error code" rather than -EIO as the only alternative. > > This is not limited to mdiobus_scan_bus_c45(): get_phy_c45_ids() is > reached > through get_phy_device(bus, addr, true) and phy_get_c45_ids() by every > C45 > caller. For those, a failed devices in package read is now reported as > -ENODEV instead of -EIO, which is what C22 callers already get: > > - fwnode_mdiobus_register_phy() for "ethernet-phy-ieee802.3-c45" nodes: > __of_mdiobus_parse_phys() logs that the device is missing and > registers > the bus without it, instead of failing the registration. > - sfp_sm_probe_phy(): the mdio-i2c buses report a PHY that does not > answer as a read of all Fs, so nothing changes for an absent PHY. The > only error that can reach this code is an I2C transport error (-EIO) > on > a RollBall module: it is now handled like the -ENODEV that C22 > modules > already get, i.e. retried and, if it persists, reported as "no PHY > detected" instead of "mdiobus scan returned -EIO" and SFP_S_FAIL. > - gpy_probe() through phy_get_c45_ids(): the driver core treats -ENODEV > as > a silent match rejection rather than a probe failure. > > Fixes: 17b447539408 ("net: phy: c45 scanning: Don't consider -ENODEV > fatal") > Signed-off-by: Florian Fainelli Reviewed-by: Nicolai Buchwitz > [...] Thanks, Nicolai