Linux Documentation
 help / color / mirror / Atom feed
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
Subject: Re: [PATCH net-next v23 15/15] net: airoha: add phylink support
Date: Mon, 30 Nov 2026 23:48:01 +0000	[thread overview]
Message-ID: <179608248143.3146.12006385619749340136@kernel.org> (raw)
In-Reply-To: <20261129230558.612526-16-ansuelsmth@gmail.com>

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

  reply	other threads:[~2026-11-30 23:48 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 23:05 [PATCH net-next v23 00/15] net: pcs: Introduce support for fwnode PCS Christian Marangi
2026-11-29 23:05 ` [PATCH net-next v23 01/15] net: phylink: make PCS phylink instance access RCU protected Christian Marangi
2026-11-30 23:47   ` netdev-bot+sashiko
2026-11-29 23:05 ` [PATCH net-next v23 02/15] net: phylink: keep and use MAC supported_interfaces in phylink struct Christian Marangi
2026-11-29 23:05 ` [PATCH net-next v23 03/15] net: phylink: introduce internal phylink PCS handling Christian Marangi
2026-11-30 23:47   ` netdev-bot+sashiko
2026-11-29 23:05 ` [PATCH net-next v23 04/15] net: pcs: implement Firmware node support for PCS driver Christian Marangi
2026-11-30 23:47   ` netdev-bot+sashiko
2026-11-29 23:05 ` [PATCH net-next v23 05/15] net: phylink: make phylink_validate state locked Christian Marangi
2026-11-30 23:47   ` netdev-bot+sashiko
2026-11-29 23:05 ` [PATCH net-next v23 06/15] net: phylink: add capabilities helpers and track modified advertising Christian Marangi
2026-11-30 23:47   ` netdev-bot+sashiko
2026-11-29 23:05 ` [PATCH net-next v23 07/15] net: sfp: support deferred module insertion Christian Marangi
2026-11-30 23:47   ` netdev-bot+sashiko
2026-11-29 23:05 ` [PATCH net-next v23 08/15] net: phylink: support PCS provider release Christian Marangi
2026-11-30 23:47   ` netdev-bot+sashiko
2026-11-29 23:05 ` [PATCH net-next v23 09/15] net: phylink: support late PCS provider attach Christian Marangi
2026-11-30 23:47   ` netdev-bot+sashiko
2026-11-29 23:05 ` [PATCH net-next v23 10/15] net: Document PCS subsystem Christian Marangi
2026-11-30 23:47   ` netdev-bot+sashiko
2026-11-29 23:05 ` [PATCH net-next v23 11/15] MAINTAINERS: add myself as PCS subsystem maintainer Christian Marangi
2026-11-29 23:05 ` [PATCH net-next v23 12/15] net: phylink: add .pcs_link_down PCS OP Christian Marangi
2026-11-30 23:47   ` netdev-bot+sashiko
2026-11-29 23:05 ` [PATCH net-next v23 13/15] dt-bindings: net: pcs: Document support for Airoha Ethernet PCS Christian Marangi
2026-11-30 23:47   ` netdev-bot+sashiko
2026-11-29 23:05 ` [PATCH net-next v23 14/15] net: pcs: airoha: add PCS driver for Airoha AN7581 SoC Christian Marangi
2026-11-30 23:47   ` netdev-bot+sashiko
2026-11-29 23:05 ` [PATCH net-next v23 15/15] net: airoha: add phylink support Christian Marangi
2026-11-30 23:48   ` netdev-bot+sashiko [this message]
2026-11-29 23:09 ` [PATCH net-next v23 00/15] net: pcs: Introduce support for fwnode PCS netdev-bot+sinfo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179608248143.3146.12006385619749340136@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=ansuelsmth@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=justinstitt@google.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=llvm@lists.linux.dev \
    --cc=lorenzo@kernel.org \
    --cc=maxime.chevallier@bootlin.com \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=robh@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=willemb@google.com \
    --cc=zhengping.zhang@airoha.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox