From: Lukasz Majewski <lukma@denx.de>
To: Paolo Abeni <pabeni@redhat.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
davem@davemloft.net, Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Richard Cochran <richardcochran@gmail.com>,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
Stefan Wahren <wahrenst@gmx.net>, Simon Horman <horms@kernel.org>,
Andrew Lunn <andrew@lunn.ch>
Subject: Re: [net-next v14 04/12] net: mtip: The L2 switch driver for imx287
Date: Thu, 10 Jul 2025 23:04:13 +0200 [thread overview]
Message-ID: <20250710230413.3b6798f7@wsk> (raw)
In-Reply-To: <20250709131651.391e11c5@wsk>
[-- Attachment #1: Type: text/plain, Size: 3612 bytes --]
Hi Paolo,
> Hi Paolo,
>
> > On 7/1/25 1:49 PM, Lukasz Majewski wrote:
> > > Changes for v14:
> > > - Increase the maximal received frame size to 1536 (for VLAN)
> > > - Use spin_{un}lock_irq{save|restore} when altering dynamic table
> > > of the switch and mtip_adjust_link() as both cannot be done when
> > > switch IRQ is potentially enabled
> >
> > Why?
> >
> > (the previous one alters entries in switching table
> > > the latter one may reset the whole IP block)
> >
> > What really matters is the scope (process/atomic, bh, hardirq) of
> > the relevant callers (the functions that do acquire the given
> > locks).
>
> Maybe I will explain the problem here case (function) by case:
> - mtip_adjust_link()
> This function is called when link change is detected (speed, duplex,
> up/down link).
>
> The problem here is that:
> 1. It is called for both MTIP ports (as both are managed by
> this driver)
>
> 2. NXP's "legacy" driver advises reset of the whole IP block
> when such change is detected.
>
> Considering the above - interrupts shall be disabled as we may
> end up in undefined state of the IP block - especially that
> re-configuration of switch requires interrupts initialization.
>
>
> - mtip_atable_dynamicms_learn_migration() - update of the switching
> table
>
> Can be called from:
> 1. function triggered when timer fires (once per 100ms)
>
> 2. mtip_switch_rx() which is called from mtip_rx_napi()
> callback (which is protected by net core).
>
> It looks like the _irqsave/_irqrestore is an overkill here.
> Both above contexts seems to not require IRQs disabled. I can
> confirm that use of plain spin_{un}lock() functions works.
>
> >
> > > +/* dynamicms MAC address table learn and migration */
> > > +static void
> > > +mtip_atable_dynamicms_learn_migration(struct switch_enet_private
> > > *fep,
> > > + int curr_time, unsigned
> > > char *mac,
> > > + u8 *rx_port)
> > > +{
> > > + u8 port = MTIP_PORT_FORWARDING_INIT;
> > > + struct mtip_port_info *port_info;
> > > + u32 rx_mac_lo = 0, rx_mac_hi = 0;
> > > + unsigned long flags;
> > > + int index;
> > > +
> > > + spin_lock_irqsave(&fep->learn_lock, flags);
> >
> > If the _irqsave() part is needed (and I don't see why??!) than all
> > the other `learn_lock` users should also use such variant, unless
> > already in hardirq scope.
> >
> > [...]
> > > +static void mtip_adjust_link(struct net_device *dev)
> > > +{
> > > + struct mtip_ndev_priv *priv = netdev_priv(dev);
> > > + struct switch_enet_private *fep = priv->fep;
> > > + struct phy_device *phy_dev;
> > > + int status_change = 0, idx;
> > > + unsigned long flags;
> > > +
> > > + spin_lock_irqsave(&fep->hw_lock, flags);
> >
> > Same here.
>
> Please see the explanation above.
>
Is the explanation enough (and from other e-mails), so I can proceed
with next version of this patch set?
> >
> > /P
> >
>
>
>
>
> Best regards,
>
> Lukasz Majewski
>
> --
>
> DENX Software Engineering GmbH, Managing Director: Johanna Denk,
> Tabea Lutz HRB 165235 Munich, Office: Kirchenstr.5, D-82194
> Groebenzell, Germany
> Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> lukma@denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Johanna Denk,
Tabea Lutz HRB 165235 Munich, Office: Kirchenstr.5, D-82194
Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2025-07-10 21:04 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-01 11:49 [net-next v14 00/12] net: mtip: Add support for MTIP imx287 L2 switch driver Lukasz Majewski
2025-07-01 11:49 ` [net-next v14 01/12] dt-bindings: net: Add MTIP L2 switch description Lukasz Majewski
2025-07-01 11:49 ` [net-next v14 02/12] ARM: dts: nxp: mxs: Adjust the imx28.dtsi " Lukasz Majewski
2025-07-01 11:49 ` [net-next v14 03/12] ARM: dts: nxp: mxs: Adjust XEA board's DTS to support L2 switch Lukasz Majewski
2025-07-01 11:49 ` [net-next v14 04/12] net: mtip: The L2 switch driver for imx287 Lukasz Majewski
2025-07-08 10:06 ` Paolo Abeni
2025-07-09 10:14 ` Lukasz Majewski
2025-07-08 11:10 ` Paolo Abeni
2025-07-09 11:16 ` Lukasz Majewski
2025-07-10 21:04 ` Lukasz Majewski [this message]
2025-07-01 11:49 ` [net-next v14 05/12] net: mtip: Add buffers management functions to the L2 switch driver Lukasz Majewski
2025-07-01 11:49 ` [net-next v14 06/12] net: mtip: Add net_device_ops " Lukasz Majewski
2025-07-08 10:03 ` Paolo Abeni
2025-07-09 10:08 ` Lukasz Majewski
2025-07-01 11:49 ` [net-next v14 07/12] net: mtip: Add mtip_switch_{rx|tx} " Lukasz Majewski
2025-07-08 9:52 ` Paolo Abeni
2025-07-09 9:18 ` Lukasz Majewski
2025-07-01 11:49 ` [net-next v14 08/12] net: mtip: Extend the L2 switch driver with management operations Lukasz Majewski
2025-07-01 11:49 ` [net-next v14 09/12] net: mtip: Extend the L2 switch driver for imx287 with bridge operations Lukasz Majewski
2025-07-01 11:49 ` [net-next v14 10/12] ARM: mxs_defconfig: Enable CONFIG_NFS_FSCACHE Lukasz Majewski
2025-07-01 11:49 ` [net-next v14 11/12] ARM: mxs_defconfig: Update mxs_defconfig to 6.16-rc1 Lukasz Majewski
2025-07-01 11:49 ` [net-next v14 12/12] ARM: mxs_defconfig: Enable CONFIG_FEC_MTIP_L2SW to support MTIP L2 switch Lukasz Majewski
2025-07-08 6:30 ` [net-next v14 00/12] net: mtip: Add support for MTIP imx287 L2 switch driver Lukasz Majewski
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=20250710230413.3b6798f7@wsk \
--to=lukma@denx.de \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=festevam@gmail.com \
--cc=horms@kernel.org \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=wahrenst@gmx.net \
/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;
as well as URLs for NNTP newsgroup(s).