From: "Łukasz Majewski" <lukasz.majewski@mailbox.org>
To: Jakub Kicinski <kuba@kernel.org>
Cc: festevam@gmail.com, linux-arm-kernel@lists.infradead.org,
s.hauer@pengutronix.de, kernel@pengutronix.de, horms@kernel.org,
shawnguo@kernel.org, imx@lists.linux.dev,
linux-kernel@vger.kernel.org, conor+dt@kernel.org,
devicetree@vger.kernel.org, wahrenst@gmx.net, pabeni@redhat.com,
davem@davemloft.net, netdev@vger.kernel.org,
richardcochran@gmail.com, edumazet@google.com,
andrew+netdev@lunn.ch, robh@kernel.org, krzk+dt@kernel.org,
andrew@lunn.ch
Subject: Re: [net-next,v20,7/7] net: mtip: Extend the L2 switch driver for imx287 with bridge operations
Date: Wed, 28 Jan 2026 23:58:59 +0100 [thread overview]
Message-ID: <20260128235859.634422f1@wsk> (raw)
In-Reply-To: <20260128022600.4151612-1-kuba@kernel.org>
Hi Jakub,
> This is an AI-generated review of your patch. The human sending this
> email has considered the AI review valid, or at least plausible.
>
> For local reproduction steps see
> https://netdev-ai.bots.linux.dev/ai-local.html ---
> net: mtip: Extend the L2 switch driver for imx287 with bridge
> operations
>
> This patch adds bridge operations support to the MTIP L2 switch
> driver, enabling hardware offloading for packet switching when a
> bridge is created on the switch interfaces.
>
> > diff --git a/drivers/net/ethernet/freescale/mtipsw/mtipl2sw_br.c
> > b/drivers/net/ethernet/freescale/mtipsw/mtipl2sw_br.c new file mode
> > 100644 index 000000000000..f961b9cc4e6a
> > --- /dev/null
> > +++ b/drivers/net/ethernet/freescale/mtipsw/mtipl2sw_br.c
>
> [ ... ]
>
> > +static int mtip_ndev_port_link(struct net_device *ndev,
> > + struct net_device *br_ndev,
> > + struct netlink_ext_ack *extack)
> > +{
> > + struct mtip_ndev_priv *priv = netdev_priv(ndev),
> > *other_priv;
> > + struct switch_enet_private *fep = priv->fep;
> > + struct net_device *other_ndev;
> > + int err;
> > +
> > + /* Check if one port of MTIP switch is already bridged */
> > + if (fep->br_members && !fep->br_offload) {
> > + /* Get the second bridge ndev */
> > + other_ndev = fep->ndev[fep->br_members - 1];
> > + other_priv = netdev_priv(other_ndev);
> > + if (other_priv->master_dev != br_ndev) {
> > + NL_SET_ERR_MSG_MOD(extack,
> > + "L2 offloading only
> > possible for the same bridge!");
> > + return notifier_from_errno(-EOPNOTSUPP);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Should this return -EOPNOTSUPP instead of
> notifier_from_errno(-EOPNOTSUPP)? The caller mtip_netdevice_event()
> already wraps the return value with notifier_from_errno(ret), so
> double-wrapping corrupts the return value.
>
> Looking at similar drivers like cpsw_new.c (cpsw_netdevice_port_link),
> the pattern is to return raw errno values here and let the event
> handler do the conversion.
>
Yes, the call to notifier_from_errno() can be removed.
I will fix it with v21.
> > + }
> > +
> > + fep->br_offload = 1;
> > + mtip_switch_dis_port_separation(fep);
> > + mtip_clear_atable(fep);
> > + }
> > +
> > + if (!priv->master_dev)
> > + priv->master_dev = br_ndev;
> > +
> > + fep->br_members |= BIT(priv->portnum - 1);
> > +
> > + err = switchdev_bridge_port_offload(ndev, ndev, NULL,
> > NULL, NULL,
> > + false, extack);
> > + if (err) {
> > + dev_err(&ndev->dev, "can't offload bridge port %s
> > [err: %d]\n",
> > + ndev->name, err);
> > + return err;
> > + }
>
> If switchdev_bridge_port_offload() fails, the state changes made
> earlier in the function (br_offload, br_members, master_dev, and the
> hardware configuration via mtip_switch_dis_port_separation and
> mtip_clear_atable) are not rolled back.
>
> Looking at cpsw_new.c for reference, it modifies br_members after the
> switchdev call succeeds, avoiding the need for rollback. Could the
> state updates here be reordered to happen after
> switchdev_bridge_port_offload() returns successfully?
>
I will add to v21:
fep->br_members &= ~BIT(priv->portnum - 1);
priv->master_dev = NULL;
before I return err.
(This "rollback" code was missing).
> [ ... ]
>
> > +static int mtip_netdevice_event(struct notifier_block *unused,
> > + unsigned long event, void *ptr)
> > +{
>
> [ ... ]
>
> > + return notifier_from_errno(ret);
> > +}
>
> [ ... ]
--
Best regards,
Łukasz Majewski
prev parent reply other threads:[~2026-01-28 22:59 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-26 10:33 [net-next v20 0/7] net: mtip: Add support for MTIP imx287 L2 switch driver Lukasz Majewski
2026-01-26 10:33 ` [net-next v20 1/7] dt-bindings: net: Add MTIP L2 switch description Lukasz Majewski
2026-01-26 10:33 ` [net-next v20 2/7] net: mtip: The L2 switch driver for imx287 Lukasz Majewski
2026-01-28 2:25 ` [net-next,v20,2/7] " Jakub Kicinski
2026-01-28 21:41 ` Łukasz Majewski
2026-01-28 22:00 ` Andrew Lunn
2026-01-28 22:47 ` Łukasz Majewski
2026-01-26 10:33 ` [net-next v20 3/7] net: mtip: Add buffers management functions to the L2 switch driver Lukasz Majewski
2026-01-28 2:25 ` [net-next,v20,3/7] " Jakub Kicinski
2026-01-28 21:48 ` Łukasz Majewski
2026-01-26 10:33 ` [net-next v20 4/7] net: mtip: Add net_device_ops " Lukasz Majewski
2026-01-28 2:25 ` [net-next,v20,4/7] " Jakub Kicinski
2026-01-28 21:55 ` Łukasz Majewski
2026-01-29 2:05 ` Jakub Kicinski
2026-01-26 10:33 ` [net-next v20 5/7] net: mtip: Add mtip_switch_{rx|tx} " Lukasz Majewski
2026-01-26 10:33 ` [net-next v20 6/7] net: mtip: Extend the L2 switch driver with management operations Lukasz Majewski
2026-01-26 10:34 ` [net-next v20 7/7] net: mtip: Extend the L2 switch driver for imx287 with bridge operations Lukasz Majewski
2026-01-28 2:26 ` [net-next,v20,7/7] " Jakub Kicinski
2026-01-28 22:58 ` Łukasz Majewski [this message]
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=20260128235859.634422f1@wsk \
--to=lukasz.majewski@mailbox.org \
--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