mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicolai Buchwitz <nb@tipi-net.de>
To: javen <javen_xu@realsil.com.cn>
Cc: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, freddy_gu@realsil.com.cn,
	maxime.chevallier@bootlin.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, daniel@makrotopia.org,
	vladimir.oltean@nxp.com
Subject: Re: [PATCH net-next v2] net: phy: realtek: improve firmware write speed
Date: Fri, 11 Sep 2026 12:05:34 +0200	[thread overview]
Message-ID: <9a85b0151eb87df26c69c507bdccbae7@tipi-net.de> (raw)
In-Reply-To: <20260911094527.1928-1-javen_xu@realsil.com.cn>

On 11.9.2026 11:45, javen wrote:
> From: Javen Xu <javen_xu@realsil.com.cn>
> 
> Firmware execution routine unconditionally uses phy_modify_mmd() for
> all OP_WRITE entries which introduces an unnecessary read transaction
> when updating an entire 16-bit register. So we optimize this by
> checking bitmask boundaries. Use phy_write_mmd() directly to speed up
> firmware loading process.
> 
> Benchmark number from tracing MDC/MDIO hardware transactions during
> firmware loading process:
>  - Unpatched: about 28,000 MDIO transactions
>  - Patched: about 9,600 MDIO transactions
> This results in an approx 65% reduction in MDIO traffic.
> 
> Signed-off-by: Javen Xu <javen_xu@realsil.com.cn>
> ---
>  drivers/net/phy/realtek/realtek_main.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/phy/realtek/realtek_main.c 
> b/drivers/net/phy/realtek/realtek_main.c
> index 27e31a799e2c..97b0b67b9900 100644
> --- a/drivers/net/phy/realtek/realtek_main.c
> +++ b/drivers/net/phy/realtek/realtek_main.c
> @@ -548,8 +548,12 @@ static int rtl8261x_fw_execute_entry(struct 
> phy_device *phydev,
> 
>  	switch (entry->type) {
>  	case OP_WRITE:
> -		ret = phy_modify_mmd(phydev, dev, addr,
> -				     GENMASK(msb, lsb), (value << lsb) & GENMASK(msb, lsb));
> +		if (msb != 15 || lsb != 0)
> +			ret = phy_modify_mmd(phydev, dev, addr, GENMASK(msb, lsb),
> +					     (value << lsb) & GENMASK(msb, lsb));
> +		else
> +			ret = phy_write_mmd(phydev, dev, addr, value);
> +
>  		if (ret)
>  			return ret;
>  		break;

Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>

Thanks,
Nicolai

  reply	other threads:[~2026-09-11 10:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-11  9:45 javen
2026-09-11 10:05 ` Nicolai Buchwitz [this message]
2026-09-14 17:18 ` Andrew Lunn
2026-09-16  0:10 ` patchwork-bot+netdevbpf

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=9a85b0151eb87df26c69c507bdccbae7@tipi-net.de \
    --to=nb@tipi-net.de \
    --cc=andrew@lunn.ch \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=freddy_gu@realsil.com.cn \
    --cc=hkallweit1@gmail.com \
    --cc=javen_xu@realsil.com.cn \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vladimir.oltean@nxp.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®