From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796082484; b=bSlUvc5JLIxnl3DBYqpNgEBgl8EcuFt0XZ/b4WDJdqHwwryP8L/dai6Ywre4wrXrkotP xEL3Szgp7b/8XUrh0w7cYETI6xzuv06bElKh6EJLWqxpj4/5TECG27sEj65rBcwr37LTD 9wPxgvsAclZIhkBe34vlcHHr+cTFEfn62hnYf9oNi82BOZVPSi/OCOTsjHQJbqmBkqtbP VhFt4GDkpbgshNtynXWFHbImW1LaeAL/GNUllUvTSqKk69miEp/x0LRt/b+UhLuj0F9xq PmO/wfbnm0WcO5TU8a/Kl0InSYG7Zp+GsykmC2kHys+XOILgPatNA79TO8XNu+gKJ2w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796082484; 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=bIajpiT0Hvtql4Hp/JHI8Hh0uDoKgsh2uvil89ddgfE=; b=WxMvAHBCfgpZgqVTzlipAQgwZMx96GqiuzmWCX8uF4sm2zNdKjkvwXLg/BLhsNj/9wkM +6Gnc79IFcIGouI+hj45rmuF5dbSTBXSy/2rLoeACGWBq9uvxokgpORdLwKDKWhekqLp1 U0OjT39WVWMdanhS9q2m3WXXRbZd506Bz9k1ueLm7QT8IOu+z23hwpPbiOPJUHiYvn1IC sp1apfbkwbALp4CagSXwi5zpBRJNt1dpS7fBppbvSaZGCa+JQGAnlU7hNn7wuALwap/FG ZmnEmkKCkBSQQazG8NXEoFs2147Ahg8wEsiZz8bntRBVB+JS99WNseXiQrCOxf1r6YA== 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=f9LJiQHe; arc=none smtp.remote-ip=100.103.45.18 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 41BF5606A325; Mon, 30 Nov 2026 23:48:04 +0000 (UTC) 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=f9LJiQHe Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC7D51F000C1; Mon, 30 Nov 2026 23:48:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796082483; bh=bIajpiT0Hvtql4Hp/JHI8Hh0uDoKgsh2uvil89ddgfE=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=f9LJiQHezgBO50aCcfFMZdFfNgqmv/jpVvfrSC8I96ZEwY75+ELtzu8pVou4FfE3F j0lsRhe07fFL6Wg0FvV7lwgUhztHG7/iXgAMWpnL3vhpfpiHN5fBGEDLoX7QvjayDX 887q15AQcLiTAhrg5np4OcbBDsERLP6PXSugUEk6Wi7CcC8fB4sF+QlF66pOyalxJc 7WyrxPZNjKt7yleZy+4iglG8CXbtlr/bdNRGak5G8fE9YP2v+Mx+Ps9kFIEVwp7kUw g8kz9YN0HJl9NivzhR7axCCkR5rvOSJvZutr3ZIOLkth5c5doAU0FBslJDj1Oi1XVt jwaGRtEYbP7pA== Subject: Re: [PATCH net-next v23 15/15] net: airoha: add phylink support From: netdev-bot+sashiko@kernel.org To: ansuelsmth@gmail.com Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, willemb@google.com, horms@kernel.org, corbet@lwn.net, skhan@linuxfoundation.org, rdunlap@infradead.org, lorenzo@kernel.org, hkallweit1@gmail.com, linux@armlinux.org.uk, maxime.chevallier@bootlin.com, p.zabel@pengutronix.de, nathan@kernel.org, ndesaulniers@google.com, morbo@google.com, justinstitt@google.com, rmk+kernel@armlinux.org.uk, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, llvm@lists.linux.dev, zhengping.zhang@airoha.com Date: Mon, 30 Nov 2026 23:48:01 +0000 Message-ID: <179608248143.3146.12006385619749340136@kernel.org> In-Reply-To: <20261129230558.612526-16-ansuelsmth@gmail.com> References: <20261129230558.612526-16-ansuelsmth@gmail.com> X-sashiko-severity: High Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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 Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider. Critical: 0 · High: 1 · 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). - [High] This patch turns three device-tree properties into hard requirements without updating the DT binding or saying so in the… - [Medium] The hardware flow-control state does not follow the pause result that phylink negotiates and reports. - [Medium] For GDM2/3/4, airoha_setup_phylink() sets mac_capabilities to include MAC_10 | MAC_100 | MAC_1000. - [Low] The commit message does not fully describe what the patch does. -- net: airoha: add phylink support This adds phylink support to every GDM port of the airoha ethernet driver. GDM1 uses the internal interface. GDM2/3/4 look up PCS instances through pcs-handle. Phylink is connected and started in ndo_open, stopped in ndo_stop, GDM4 MBI fragment sizes are programmed on link up, and get/set_link_ksettings now go through phylink. > Add phylink support for each GDM port. For GDM1 add the internal interface > mode as the only supported mode. For GDM2/3/4 add the required > configuration of the PCS to make the external PHY or attached SFP cage > work. [Severity: Low] This isn't a bug, but is this description accurate for this patch? The MAC driver change does not touch any PCS registers. It only fills pcs_interfaces, num_possible_pcs and fill_available_pcs in phylink_config so PCS instances can be looked up through pcs-handle. The PCS programming itself is in the separate "net: pcs: airoha: add PCS driver for Airoha AN7581 SoC" commit. The message also leaves out the one MAC-side hardware change. On link up, GDM4 now writes speed-dependent TX/RX fragment sizes into the SGMII0 or SGMII1 field of the new REG_FE_GDM4_TMBI_FRAG and REG_FE_GDM4_RMBI_FRAG registers, protected by a new per-port link_lock mutex. The "Nothing to do in MAC, everything is handled in PCS" comments on airoha_mac_config() and airoha_mac_link_down() are also misleading, because airoha_mac_link_up() does program FE state for GDM4. > diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c > index 044ad0302ef35..e41dfad58b258 100644 > --- a/drivers/net/ethernet/airoha/airoha_eth.c > +++ b/drivers/net/ethernet/airoha/airoha_eth.c [ ... ] > @@ -3752,6 +3790,155 @@ bool airoha_is_valid_gdm_dev(struct airoha_eth *eth, > return false; > } > > +/* Nothing to do in MAC, everything is handled in PCS */ > +static void airoha_mac_config(struct phylink_config *config, unsigned int mode, > + const struct phylink_link_state *state) > +{ > +} > + > +static void airoha_mac_link_up(struct phylink_config *config, struct phy_device *phy, > + unsigned int mode, phy_interface_t interface, > + int speed, int duplex, bool tx_pause, bool rx_pause) > +{ > + struct airoha_gdm_dev *dev = container_of(config, struct airoha_gdm_dev, > + phylink_config); > + struct airoha_gdm_port *port = dev->port; > + struct airoha_eth *eth = dev->eth; > + u32 frag_size_tx, frag_size_rx; > + > + /* TX/RX frag is configured only for GDM4 */ > + if (port->id != AIROHA_GDM4_IDX) > + return; [Severity: Medium] Should tx_pause and rx_pause be applied to the hardware somewhere? airoha_setup_phylink() advertises MAC_SYM_PAUSE | MAC_ASYM_PAUSE on every GDM port. Phylink will negotiate pause and pass the result here, but airoha_mac_link_up() never uses it, and airoha_mac_config() and airoha_mac_link_down() are empty. GDM_INGRESS_FC_EN_MASK in REG_GDM_INGRESS_CFG is never written by the driver either. The only flow-control programming is in the PCS driver: drivers/net/pcs/airoha/pcs-airoha-common.c:airoha_pcs_config() { ... regmap_update_bits(maps->pcs_mac, AIROHA_PCS_XFI_MAC_XFI_GIB_CFG, AIROHA_PCS_XFI_TX_FC_EN | AIROHA_PCS_XFI_RX_FC_EN, permit_pause_to_mac ? AIROHA_PCS_XFI_TX_FC_EN | AIROHA_PCS_XFI_RX_FC_EN : 0); ... } permit_pause_to_mac comes from link_config.pause & MLO_PAUSE_AN, and phylink_create() defaults link_config.pause to MLO_PAUSE_AN. No .get_pauseparam or .set_pauseparam is routed to phylink, so the user cannot change this. If the link partner advertises no pause, or only asymmetric pause, would the XFI MAC still send and honour PAUSE frames in both directions? ethtool would then report a different pause state from the one the hardware is actually using. [ ... ] > +static int airoha_setup_phylink(struct net_device *netdev) > +{ [ ... ] > + err = of_get_phy_mode(np, &phy_mode); > + if (err) { > + dev_err(&netdev->dev, "incorrect phy-mode\n"); > + return err; > + } [ ... ] > + if (port->id == AIROHA_GDM1_IDX) { > + config->mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | > + MAC_10000FD; > + > + __set_bit(PHY_INTERFACE_MODE_INTERNAL, > + config->supported_interfaces); > + } else { > + config->mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | > + MAC_10 | MAC_100 | MAC_1000 | > + MAC_2500FD | MAC_5000FD | MAC_10000FD; [Severity: Medium] Can the hardware actually do half duplex here? MAC_10, MAC_100 and MAC_1000 include the HD variants, so phylink lets an attached SGMII PHY advertise and resolve half duplex. Nothing seems to program duplex, though: - airoha_mac_link_up() ignores its duplex argument - airoha_mac_config() is empty - airoha_pcs_link_up() in the PCS driver also ignores duplex - AIROHA_PCS_HSGMII_AN_DUPLEX_FORCE_MODE is defined but never used - the PCS get_state helpers hard-code state->duplex = DUPLEX_FULL Suppose an external SGMII PHY resolves 10/100/1000 half duplex, for example to a hub. Would that leave phylink reporting half duplex while the MAC/PCS still runs full duplex, giving a duplex mismatch? If the datapath is full duplex only, MAC_10FD | MAC_100FD | MAC_1000FD may be the right capabilities. > + > + config->num_possible_pcs = fwnode_phylink_pcs_count(dev_fwnode(config->dev)); > + config->fill_available_pcs = airoha_fill_available_pcs; > + [ ... ] > + phy_interface_copy(config->pcs_interfaces, > + config->supported_interfaces); > + } > + > + phylink = phylink_create(config, of_fwnode_handle(np), > + phy_mode, &airoha_phylink_ops); > + if (IS_ERR(phylink)) > + return PTR_ERR(phylink); [Severity: High] Does this break probe for device trees that follow the current binding? phy-mode is now mandatory on every GDM node, because a failing of_get_phy_mode() returns an error. For GDM2/3/4, pcs_interfaces and fill_available_pcs are always set. num_possible_pcs comes from fwnode_phylink_pcs_count(), which returns 0 when there is no pcs-handle or no #pcs-cells. phylink_create() then rejects the config: drivers/net/phy/phylink.c:phylink_create() { ... if (has_pcs_interfaces != has_pcs_callback || has_pcs_interfaces != has_pcs_count) { dev_err(config->dev, "phylink: error: pcs_interfaces, num_possible_pcs and fill_available_pcs must be set together\n"); return ERR_PTR(-EINVAL); } ... } Errors from fwnode_pcs_get() other than -ENOENT/-ENODEV are also passed back up. airoha_alloc_gdm_device() now ends with "return airoha_setup_phylink(netdev)", so the failure travels up this path: airoha_probe()->airoha_alloc_gdm_port()->airoha_alloc_gdm_device()-> airoha_setup_phylink() airoha_probe() then jumps to error_napi_stop and tears down every port, including the GDM1 DSA conduit. Documentation/devicetree/bindings/net/airoha,en7581-eth.yaml still requires only reg and compatible for the ethernet@ nodes. Its own example (ethernet@1, and ethernet@4 with eth-port children) has no phy-mode, pcs-handle or fixed-link. The binding also does not say whether pcs-handle goes on the GDM node or on the airoha,eth-port child. The new PCS provider only matches airoha,an7581-pcs-* compatibles, but this MAC driver also binds airoha,an7583-eth. Would AN7583 GDM2/3/4 nodes, which probed before this patch, now fail probe for the whole controller? For GDM1, if phy-mode is "internal" but there is no fixed-link or phy-handle, phylink stays in MLO_AN_PHY. phylink_of_phy_connect() in airoha_dev_open() then returns -ENODEV, so the conduit can no longer be opened. Is fixed-link now required on GDM1 as well? The in-tree en7581.dtsi gdm1 node already has phy-mode = "internal" and fixed-link, so in-tree boards look unaffected. The commit message only says: These needs to be defined in the GDM port node using the pcs-handle property. It does not say that a missing pcs-handle fails the whole controller, and it does not mention the phy-mode or fixed-link requirements. Could these cases fail only the affected netdev, for example by setting the PCS fields only when num_possible_pcs is non-zero? Could the binding and commit message also document the new requirements? -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261129230558.612526-1-ansuelsmth%40gmail.com