mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Zxyan Zhu <zxyan0222@gmail.com>
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com,
	alexandre.torgue@foss.st.com, linux@armlinux.org.uk,
	hkallweit1@gmail.com, rmk+kernel@armlinux.org.uk,
	maxime.chevallier@bootlin.com, netdev@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, bjorn@kernel.org
Subject: Re: [PATCH net-next v2] net: phylink: add phylink_pcs_loopback() method for PCS loopback support
Date: Mon, 27 Jul 2026 21:46:16 +0200	[thread overview]
Message-ID: <73726b44-42d8-4539-b910-eeeb1650f180@lunn.ch> (raw)
In-Reply-To: <20260727093835.1708262-1-zxyan0222@gmail.com>

>  static int stmmac_test_phy_loopback(struct stmmac_priv *priv)
>  {
>  	struct stmmac_packet_attrs attr = { };
> +	struct phylink_pcs *pcs;
>  	int ret;
>  
> -	if (!priv->dev->phydev)
> -		return -EOPNOTSUPP;
> +	if (priv->dev->phydev) {
> +		ret = phy_loopback(priv->dev->phydev, true, 0);
> +		if (ret)
> +			return ret;
>  
> -	ret = phy_loopback(priv->dev->phydev, true, 0);
> -	if (ret)
> +		attr.dst = priv->dev->dev_addr;
> +		ret = __stmmac_test_loopback(priv, &attr);
> +
> +		phy_loopback(priv->dev->phydev, false, 0);
>  		return ret;
> +	}
>  
> -	attr.dst = priv->dev->dev_addr;
> -	ret = __stmmac_test_loopback(priv, &attr);
> +	/* Use PCS loopback for interfaces without an external PHY. */

It should not be an either/or. You can have a PCS and an external PHY.
You might actually want to test both.

So i think you want stmmac_test_phy_loopback() and
stmmac_test_pcs_loopback() with the shared code in a helper.

    Andrew

---
pw-bot: cr

  reply	other threads:[~2026-07-27 19:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24  8:52 [PATCH net-next] " Zxyan Zhu
2026-07-24  9:25 ` Maxime Chevallier
2026-07-24 13:05   ` Andrew Lunn
2026-07-27  9:38 ` [PATCH net-next v2] " Zxyan Zhu
2026-07-27 19:46   ` Andrew Lunn [this message]
2026-07-27 12:07 Zxyan Zhu
2026-07-28  8:41 ` Maxime Chevallier
2026-07-28 13:02   ` Oleksij Rempel
2026-07-28 13:22   ` Zxyan Zhu

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=73726b44-42d8-4539-b910-eeeb1650f180@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bjorn@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux@armlinux.org.uk \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=zxyan0222@gmail.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

all inboxes | Powered by JetHome®