Article View: linux.kernel.netdev
Article #21640Re: [PATCH net v2 2/2] net: ibm: emac: read the fixed-link status before adjusting the link
From: netdev-bot+sashiko
Date: Tue, 24 Nov 2026 09:34
Date: Tue, 24 Nov 2026 09:34
114 lines
11986 bytes
11986 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 ยท High: 1 ยท Medium: 0 ยท Low: 0
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).
- [High] The fix does not cover 10 Mbit/s full-duplex fixed links.
--
net: ibm: emac: read the fixed-link status before adjusting the link
For a fixed link, emac_init_phy() never starts the PHY state machine, so
after d99b408ed8e5 emac_adjust_link() copied SPEED_UNKNOWN/DUPLEX_UNKNOWN
into dev->phy. This patch calls phy_read_status() once after
of_phy_connect(), so the emulated swphy registers fill in speed, duplex
and pause. It also disconnects the PHY if the read fails.
> diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c
> index ba02cf878a124..8b9ffbcd2ff42 100644
> --- a/drivers/net/ethernet/ibm/emac/core.c
> +++ b/drivers/net/ethernet/ibm/emac/core.c
> @@ -2677,9 +2677,16 @@ static int emac_init_phy(struct emac_instance *dev)
> return res;
>
> if (!of_phy_connect(ndev, np, &emac_adjust_link, 0,
> - dev->phy_mode)) {
> + dev->phy_mode))
> + res = -EINVAL;
> + else
> + res = phy_read_status(ndev->phydev);
[Severity: High]
Does this resolve a 10 Mbit/s full duplex fixed link? The commit message
says:
The PHY is emulated, so genphy_read_status() resolves speed, duplex
and pause from the registers swphy generates out of the device tree
status.
For 10 Mbit the swphy tables in drivers/net/phy/swphy.c never set the
10 Mbit BMSR ability bits. Only the LPA register gets them:
static const struct swmii_regs speed[] = {
[SWMII_SPEED_10] = {
.lpa = LPA_10FULL | LPA_10HALF,
},
...
static const struct swmii_regs duplex[] = {
[SWMII_DUPLEX_HALF] = {
.bmsr = BMSR_ESTATEN | BMSR_100HALF,
...
[SWMII_DUPLEX_FULL] = {
.bmsr = BMSR_ESTATEN | BMSR_100FULL,
...
genphy_read_abilities() builds phydev->supported from BMSR only, so no
10baseT mode ends up in supported or advertising. Then, in
phy_read_status()->genphy_read_status():
genphy_read_lpa()
lp_advertising gets 10baseT_Full plus the pause bits
phy_resolve_aneg_linkmode()
lp_advertising & advertising has no speed mode, so
phy_caps_lookup_by_linkmode() returns NULL and speed/duplex
stay SPEED_UNKNOWN/DUPLEX_UNKNOWN
phy_resolve_aneg_pause()
only runs for DUPLEX_FULL, so pause stays 0
phy_read_status() still returns 0, so the error path is skipped, and
emac_adjust_link() copies DUPLEX_UNKNOWN and pause = 0 into dev->phy.
emac_configure() only sets full duplex and flow control when duplex is
DUPLEX_FULL:
else if (dev->phy.duplex == DUPLEX_FULL)
mr1 |= EMAC_MR1_FDE | EMAC_MR1_MWSW_001;
...
if (!emac_has_feature(dev, EMAC_FTR_NO_FLOW_CONTROL_40x) &&
dev->phy.duplex == DUPLEX_FULL) {
if (dev->phy.pause)
mr1 |= EMAC_MR1_EIFC | EMAC_MR1_APP;
So for a fixed-link node with speed 10 and full-duplex, wouldn't the MAC
still be programmed half duplex with flow control off? That is the
symptom the commit message describes, and it worked before d99b408ed8e5.
100 and 1000 Mbit links resolve correctly. 10 Mbit half duplex only comes
out right because the unknown values fall back to 10/half.
Could swphy report the 10 Mbit abilities in BMSR? Alternatively, could
the PHY-less path take speed, duplex and pause directly from the
fixed-link status, or at least check that phydev->speed and
phydev->duplex were resolved before using them?
> +
> + if (res) {
> + if (ndev->phydev)
> + phy_disconnect(ndev->phydev);
> of_phy_deregister_fixed_link(np);
> - return -EINVAL;
> + return res;
> }
>
> emac_adjust_link(ndev);
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261123093201.770552-1-xiaolinkui%40126.com
Technical Details
Message-ID:
<179551284212.3135.10573123366533276098@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370160-linux-kernel-netdev=dewy.ruReferences:
<20261123093201.770552-3-xiaolinkui@126.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370160-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v2 2/2] net: ibm: emac: read the fixed-link status before adjusting the link Date: Tue, 24 Nov 2026 09:34:02 +0000 Organization: Usenet Network Message-ID: <179551284212.3135.10573123366533276098@kernel.org> References: <20261123093201.770552-3-xiaolinkui@126.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="4101327"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:3XBiTQV+Aa+nH0/nZIR2SI78QBM= sha256:I8Ip9fQ4UF+qXb+n7BHDKrgCP6rd3lCpaFwcygmi728= sha1:gMADi9Gyjj2cBARRapA/prUYMcc= sha256:7SMAyHVdZkf286nJhjbbGBWiNvEVAnKhHXX1oWdtHCQ= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 2574C125DE9; Tue, 24 Nov 2026 12:34:31 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YOW_lhPttOWC; Tue, 24 Nov 2026 12:34:27 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-370160-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id BAA89125DEA; Tue, 24 Nov 2026 12:34:17 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id D073C350D9; Tue, 24 Nov 2026 09:34:13 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795512850; b=uEqZNmamCgH5X+YUuBEk/gXbIPfkucvJCrrhPyXnqQgVLoxd+7GmH5LxkKXECcG+67OH Ov13Anf70MR8DQts+GB+3HXXKFLpJwq9zpY88gmsdHzxuTfYWb1/MrB3XCemcH589ltz3 QJNAHyxHyL/K2JjWt+wBOzLfDvax/N5wPPkUP3mOhy+1eQTTUCKL3woE9UTuf+oaFdYXu o9NY82triKjuh2JTEAjtyMN0bIpU/c+DlITpZbeafDnWZpmz+A9zLC2z3CbH7Zw/CAEEP 6st7L62NV2RfmaQCvFzCfY8wDob2aHaMpIXYdEBbcHjkhEZm/s3b7qgC6uG+DWxEFkg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795512850; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=JmZNKyGNzoJnbzxEBlYVfscQifvkDBMRaWGqmZLCDec=; b=D4Vm9zggaBdN9JAdcVvNHnlBAPH7XoboXF0CAxUTzCQXZFTvP9Sb0Z64NoI5ing2VJ3y 35EpLNSgCB5F8h+YC+GgjgdiY6iSmLg31/2Oh33UvCIVm8JMsgzcXzVKnCtkvrtAoNURL 2KuJZM7RNm/7KtyBwNkITrXsWBXh5CscH5fGuuP62AYn7U2j2Sx4Hw+Fuqr7SnCFA7Hwa b3vZSDp2cJmAxRfxzJSQ72C/xVIHlQG7sioNq5G3d9OySEGru7ahrwLavqMgQzkRkMhlQ 0nLDa04AiWV5ul6Pl3eaWVxc2ZJYAcRu4sTxDd8GBYYBgK2LQMCideV7UBo/MgBTHJg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=AqZxKgDg; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 34211606A681; Tue, 24 Nov 2026 09:34:10 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=AqZxKgDg X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795512844; b=deLV5qXflpT8Ob0I+cRe5EBSox1JVlq5MITM958svMgOFwXeOUE414JmaXLM2zfpLFHw w+LJ1eNa5BkTrWxM/d1idpm8pS5DT2eWThPycguFxWjaeAjVUQn7N7Mj0tWGUAAcILcDo Y0mh9RpS3MG7bvz8tEQIrQunoetSwDGzQ+knZx8dT1s494JQS14XYEW9wqychgRgbeyBK ZOTdYLFUuITn/63mZJC4WlOEMlMa6SHSU4QcF77mZF6GziM9DmwA+Zflogr4HqjYd219S 5Wbvm61aeYKKJjV3JZumHBI+R+GeSx6yK6xhmTnD6f1eUabnl1MwitrKGT1cOH1qjHw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795512844; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=JmZNKyGNzoJnbzxEBlYVfscQifvkDBMRaWGqmZLCDec=; b=Yv6ukjNzX+JDmgErLBQxpm3Csasna58nDy8kWl7tJ5msaprkf37iMLJmGqqBbA/W+njo AF0wnQZPyeHCKvf5LV5zjYUlbHnyx3Vqf4QvKRrc4/0raA31pY/BjbzwSY59MJwdg7ziU ++/Hv4aFxuauyX68u0vmEU9qCSEggHjtAuq6DRIRC9xbGAkmKKLhChpshmaVJro3SArI/ jUfm7js7mdep0D9CRie9TnmQKTPgsuYYwDeaNfAWCINaRzodcIq6miJ4ooRKoGM9p4+Fy SRnSAJuk07u5lEN5TGICEUEYuShi4Z6Tu4IuWsFWk2B5CaeaD3qK3UwvdaETRfNMvDw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=AqZxKgDg; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53BF2606A68E; Tue, 24 Nov 2026 09:34:04 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DDA31F000E6; Tue, 24 Nov 2026 09:34:02 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795512843; bh=JmZNKyGNzoJnbzxEBlYVfscQifvkDBMRaWGqmZLCDec=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=AqZxKgDgJNdsFBu4VJkX+2UmaSNWbhKaQpYn8aM9KrMOqmiF3X7E+XlFta/RpUXs5 J89yL9ORqBl2lZjYigehLi/3Ifj823RSDcd5FeGTBL67SKheEdD8QXtdqC05Psb7Pa GhWeTMKyhWrrdX9cwjizzhNv/R3g1uwEyfMMzpPtppFXjBhlPXd5lBlY/62QK5poJ4 pk3efWed2JcTsMExdjBc8UQ/3g6kfGcqTwD2ohBDVhG3ep3qWV4aJMF0FpXxxhNfsG SUoJITkbrkuwI1tCRbrcga83Clv5jmMWyWATXBMOkCm0ewXiCauxuKCocZzPAHV3C8 3E60pkTgK/haA== X-Cc: andrew@lunn.ch, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, rosenp@gmail.com, jacob.e.keller@intel.com, daniel.machon@microchip.com, chunkeey@gmail.com, kees+treewide@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, xiaolinkui@kylinos.cn X-In-Reply-To: <20261123093201.770552-3-xiaolinkui@126.com> X-sashiko-severity: High X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list