Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: daniel.machon@microchip.com
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, pabeni@redhat.com, Steen.Hegelund@microchip.com,
	UNGLinuxDriver@microchip.com, richardcochran@gmail.com,
	linux@armlinux.org.uk, netdev@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, robert.marko@sartura.hr,
	horatiu.vultur@microchip.com,
	jensemil.schulzostergaard@microchip.com, horms@kernel.org
Subject: Re: [PATCH net-next v3 7/9] net: sparx5/lan969x: scale the queue watermarks with the MTU
Date: Mon, 23 Nov 2026 14:58:19 +0000	[thread overview]
Message-ID: <179544589953.3135.16152141389643791611@kernel.org> (raw)
In-Reply-To: <20261120-sparx5-mtu-change-v3-7-55c272fe1acc@microchip.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · 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).

- [Medium] At this commit (and at the next one, "scale the TAS guard band
  with the MTU"), sparx5_port_wm_set() in…
- [Low] This commit adds sparx5_port_wm_update() (sparx5_port.c:717) as a
  non-static function with a prototype in sparx5_port.h:94, but nothing…

--

net: sparx5/lan969x: scale the queue watermarks with the MTU

The commit now computes the QSYS PAUSE_START, PAUSE_STOP and ATOP
watermarks from the port MTU, plus the Ethernet header, FCS and two VLAN
tags, rounded up to whole buffer cells. Before, they were fixed multiples
of a 1518 byte frame. The watermarks are programmed at port init and when
pause is resolved. The commit also adds sparx5_port_wm_update() for MTU
changes and a per-port wm_lock.

> diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_port.c b/drivers/net/ethernet/microchip/sparx5/sparx5_port.c
> index 701d310df0ba6..87aa0b7841359 100644
> --- a/drivers/net/ethernet/microchip/sparx5/sparx5_port.c
> +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_port.c

[ ... ]

> @@ -676,24 +679,53 @@ int sparx5_port_fwd_urg(struct sparx5 *sparx5, u32 speed)

[ ... ]

> +/* Pause start/stop and tail drop at 6/4/20 frames of the port MTU */
> +static void sparx5_port_wm_set(struct sparx5 *sparx5, struct sparx5_port *port,
> +			       u8 pause)
> +{
> +	u32 len = SPX5_HW_MTU(READ_ONCE(port->ndev->mtu)) + 2 * VLAN_HLEN;
> +	u32 cells = DIV_ROUND_UP(len, SPX5_BUFFER_CELL_SZ);

[Severity: Medium]
At this commit, can port->ndev->mtu drift away from the MAC max frame
length?

sparx5_port_init() still programs a fixed max length:

	sparx5_port_max_len_set(sparx5, port, ETH_MAXLEN);

sparx5_port_netdev_ops has no .ndo_change_mtu. With the ether_setup()
defaults (min_mtu 68, max_mtu 1500), the core writes dev->mtu directly
and no hardware gets reconfigured.

Suppose the MTU is lowered to 68 with ip link. The next link-up then runs:

  sparx5_port_config()->sparx5_port_fc_setup()->sparx5_port_wm_set()

That gives len = 94 and cells = 1. PAUSE_START becomes 6 cells,
PAUSE_STOP 4 cells and ATOP 20 cells.

The MAC still accepts 1518-byte frames, which take 9 cells each. With TX
pause enabled, wouldn't one full-size frame go past PAUSE_START, so that
a pause frame is sent for every received frame? ATOP would also drop to
about two full-size frames, which means heavy tail drop. That is the
problem the commit message describes, only triggered by a smaller MTU
instead of a larger one.

The problem is also present at the next patch, "scale the TAS guard band
with the MTU". The final patch of the series, "net: sparx5/lan969x: add
support for changing the MTU", fixes it. It adds
sparx5_port_change_mtu(), which returns -EOPNOTSUPP when FDMA is not in
use. Otherwise it calls sparx5_port_max_len_set() with
SPX5_HW_MTU(new_mtu) and then sparx5_port_wm_update(). So this only
affects the intermediate bisection points.

Could the series be ordered so that the watermarks and the MAC max length
stay in sync at every commit?

> +	u32 pause_stop = 0xFFF - 1; /* FC gen disabled */
> +

[ ... ]

> +}
> +
> +void sparx5_port_wm_update(struct sparx5 *sparx5, struct sparx5_port *port)
> +{
> +	mutex_lock(&port->wm_lock);
> +	sparx5_port_wm_set(sparx5, port, port->wm_pause);
> +	mutex_unlock(&port->wm_lock);
> +}

[Severity: Low]
This isn't a bug, but sparx5_port_wm_update() is non-static and has a
prototype in sparx5_port.h, yet nothing calls it at this commit.
sparx5_port_netdev_ops has no .ndo_change_mtu yet, so the MTU-change part
of this patch is not connected to anything.

This comment in sparx5_port_disable() also refers to an MTU-change path
that does not exist yet:

	/* 5: Disable Flowcontrol, and keep an MTU change from re-enabling it */

The first caller is sparx5_port_change_mtu(), added by the final patch of
the series, "net: sparx5/lan969x: add support for changing the MTU". It
calls sparx5_port_wm_update() after WRITE_ONCE(dev->mtu, new_mtu), so the
READ_ONCE() in sparx5_port_wm_set() picks up the new MTU.

Could the helper be added in the same patch as its caller?

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120-sparx5-mtu-change-v3-0-55c272fe1acc%40microchip.com

  reply	other threads:[~2026-11-23 14:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 11:56 [PATCH net-next v3 0/9] net: sparx5/lan969x: add support for changing the MTU Daniel Machon
2026-11-20 11:56 ` [PATCH net-next v3 1/9] net: sparx5/lan969x: stop the FDMA channels properly Daniel Machon
2026-11-23 14:58   ` netdev-bot+sashiko
2026-11-20 11:56 ` [PATCH net-next v3 2/9] net: sparx5/lan969x: free the FDMA buffers on init errors and deinit Daniel Machon
2026-11-23 14:58   ` netdev-bot+sashiko
2026-11-20 11:57 ` [PATCH net-next v3 3/9] net: sparx5/lan969x: add a helper for setting the MAC max frame length Daniel Machon
2026-11-20 11:57 ` [PATCH net-next v3 4/9] net: sparx5/lan969x: pass the FDMA rings to the init and alloc functions Daniel Machon
2026-11-20 11:57 ` [PATCH net-next v3 5/9] net: sparx5/lan969x: size the FDMA buffers from the port MTUs Daniel Machon
2026-11-23 14:58   ` netdev-bot+sashiko
2026-11-20 11:57 ` [PATCH net-next v3 6/9] net: sparx5/lan969x: add support for resizing the FDMA buffers Daniel Machon
2026-11-23 14:58   ` netdev-bot+sashiko
2026-11-20 11:57 ` [PATCH net-next v3 7/9] net: sparx5/lan969x: scale the queue watermarks with the MTU Daniel Machon
2026-11-23 14:58   ` netdev-bot+sashiko [this message]
2026-11-20 11:57 ` [PATCH net-next v3 8/9] net: sparx5/lan969x: scale the TAS guard band " Daniel Machon
2026-11-23 14:58   ` netdev-bot+sashiko
2026-11-20 11:57 ` [PATCH net-next v3 9/9] net: sparx5/lan969x: add support for changing " Daniel Machon
2026-11-23 14:58   ` netdev-bot+sashiko

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=179544589953.3135.16152141389643791611@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=Steen.Hegelund@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=daniel.machon@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horatiu.vultur@microchip.com \
    --cc=horms@kernel.org \
    --cc=jensemil.schulzostergaard@microchip.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=robert.marko@sartura.hr \
    /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