Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jens Emil Schulz Østergaard" <jensemil.schulzostergaard@microchip.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH net-next v8 5/9] net: dsa: lan9645x: add bridge support
Date: Fri, 03 Jul 2026 06:46:38 +0000	[thread overview]
Message-ID: <20260703064638.E8D271F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <20260702-dsa_lan9645x_switch_driver_base-v8-5-90228d8bba58@microchip.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Missing ds->ageing_time_min allows invalid ageing times to be silently rounded up to 2 seconds.
--

commit c7bfc6b4bfe0c0efc661fd970da4660dc2b62c73
Author: Jens Emil Schulz Østergaard <jensemil.schulzostergaard@microchip.com>

net: dsa: lan9645x: add bridge support

This commit adds support for hardware offloading of the bridge on a single
device. It configures basic bridge operations, flooding, and ageing time.

> diff --git a/drivers/net/dsa/microchip/lan9645x/lan9645x_main.c b/drivers/net/dsa/microchip/lan9645x/lan9645x_main.c
> index f95ce9e48a5c2..4dd449d9014bd 100644
> --- a/drivers/net/dsa/microchip/lan9645x/lan9645x_main.c
> +++ b/drivers/net/dsa/microchip/lan9645x/lan9645x_main.c
[ ... ]
> @@ -268,15 +271,35 @@ static int lan9645x_setup(struct dsa_switch *ds)
[ ... ]
>  	ds->mtu_enforcement_ingress = true;
>  	ds->assisted_learning_on_cpu_port = true;
>  	ds->fdb_isolation = true;
>  
> +	/* ANA_AUTOAGE_AGE_PERIOD is a seconds-based field and entries are
> +	 * aged after 2 * AGE_PERIOD, giving (2 * FIELD_MAX) seconds of
> +	 * maximum aging.
> +	 */
> +	ds->ageing_time_max = 2U * MSEC_PER_SEC *
> +			      FIELD_MAX(ANA_AUTOAGE_AGE_PERIOD);
> +

[Severity: Medium]
Should ds->ageing_time_min be configured here as well?

Without a minimum, the DSA core's -ERANGE check is bypassed when
userspace configures a bridge ageing time less than 2 seconds, which
allows unsupported small values to reach the driver.

>  	dev_info(lan9645x->dev,
>  		 "SKU features: max_ports=%d\n",
>  		 lan9645x->num_phys_ports - lan9645x->num_port_dis);
>  
>  	return 0;
[ ... ]
> @@ -285,6 +308,282 @@ static void lan9645x_port_phylink_get_caps(struct dsa_switch *ds, int port,
[ ... ]
> +static int lan9645x_set_ageing_time(struct dsa_switch *ds, unsigned int msecs)
> +{
> +	u32 age_secs = max(1, msecs / MSEC_PER_SEC / 2);

[Severity: Medium]
Could this silently round up unsupported small ageing times?

If msecs is non-zero but less than 2000, max(1, msecs / 2000) evaluates
to 1 hardware unit (2 seconds). Because the driver doesn't return an
error for unsupported values, the hardware is configured with an
ageing time larger than requested by the user, which violates the
switchdev API contract.

> +	struct lan9645x *lan9645x = ds->priv;
> +
> +	/* Entry must suffer two aging scans before it is removed, so it is
> +	 * aged after 2*AGE_PERIOD, and the unit is in seconds.
> +	 * An age period of 0 disables automatic aging.
> +	 */
> +	lan_rmw(ANA_AUTOAGE_AGE_PERIOD_SET(msecs ? age_secs : 0),
> +		ANA_AUTOAGE_AGE_PERIOD,
> +		lan9645x, ANA_AUTOAGE);
> +	return 0;
> +}
[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260702-dsa_lan9645x_switch_driver_base-v8-0-90228d8bba58@microchip.com?part=5

  reply	other threads:[~2026-07-03  6:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-02  6:45 [PATCH net-next v8 0/9] net: dsa: add DSA support for the LAN9645x switch chip family Jens Emil Schulz Østergaard
2026-07-02  6:45 ` [PATCH net-next v8 1/9] net: dsa: add tag driver for LAN9645X Jens Emil Schulz Østergaard
2026-07-03  6:46   ` sashiko-bot
2026-07-02  6:45 ` [PATCH net-next v8 2/9] dt-bindings: net: lan9645x: add LAN9645X switch bindings Jens Emil Schulz Østergaard
2026-07-03  6:46   ` sashiko-bot
2026-07-02  6:45 ` [PATCH net-next v8 3/9] net: dsa: lan9645x: add autogenerated register macros Jens Emil Schulz Østergaard
2026-07-02  6:45 ` [PATCH net-next v8 4/9] net: dsa: lan9645x: add basic dsa driver for LAN9645X Jens Emil Schulz Østergaard
2026-07-03  6:46   ` sashiko-bot
2026-07-02  6:45 ` [PATCH net-next v8 5/9] net: dsa: lan9645x: add bridge support Jens Emil Schulz Østergaard
2026-07-03  6:46   ` sashiko-bot [this message]
2026-07-02  6:45 ` [PATCH net-next v8 6/9] net: dsa: lan9645x: add vlan support Jens Emil Schulz Østergaard
2026-07-02  6:45 ` [PATCH net-next v8 7/9] net: dsa: lan9645x: add mac table integration Jens Emil Schulz Østergaard
2026-07-02  6:45 ` [PATCH net-next v8 8/9] net: dsa: lan9645x: add mdb management Jens Emil Schulz Østergaard
2026-07-02  6:45 ` [PATCH net-next v8 9/9] net: dsa: lan9645x: add port statistics Jens Emil Schulz Østergaard
2026-07-03  6:46   ` sashiko-bot

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=20260703064638.E8D271F00A3E@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jensemil.schulzostergaard@microchip.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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