* Re: [net-next,v22,7/7] net: mtip: Extend the L2 switch driver for imx287 with bridge operations
[not found] <20260131233459.1625279-8-lukasz.majewski@mailbox.org>
@ 2026-02-03 1:44 ` Jakub Kicinski
0 siblings, 0 replies; only message in thread
From: Jakub Kicinski @ 2026-02-03 1:44 UTC (permalink / raw)
To: lukasz.majewski
Cc: Jakub Kicinski, andrew, shawnguo, krzk+dt, linux-kernel, edumazet,
netdev, pabeni, andrew+netdev, davem, conor+dt, horms,
richardcochran, robh, imx, linux-arm-kernel, devicetree, wahrenst,
s.hauer, kernel, festevam
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 commit adds bridge offloading support to the MTIP L2 switch driver,
allowing the switch to offload packet switching when a bridge is
created on its interfaces.
> diff --git a/drivers/net/ethernet/freescale/mtipsw/mtipl2sw_br.c b/drivers/net/ethernet/freescale/mtipsw/mtipl2sw_br.c
> --- /dev/null
> +++ b/drivers/net/ethernet/freescale/mtipsw/mtipl2sw_br.c
> @@ -0,0 +1,132 @@
[ ... ]
> +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 -EOPNOTSUPP;
> + }
> +
> + fep->br_offload = 1;
> + mtip_switch_dis_port_separation(fep);
> + mtip_clear_atable(fep);
> + }
> +
> + 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;
> + }
When switchdev_bridge_port_offload() fails after the second port joins the
same bridge, should the error path also revert br_offload and port
separation state?
In mtip_ndev_port_link() when the second port joins, the code sets
fep->br_offload = 1 and calls mtip_switch_dis_port_separation() before
attempting switchdev_bridge_port_offload(). If that call fails, the error
returns without reverting these changes.
This could leave the hardware with port separation disabled and br_offload
set to 1, even though only one port is actually bridged.
This concern was raised by Jakub Kicinski:
https://lore.kernel.org/netdev/20260131015440.972531-1-kuba@kernel.org/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-02-03 1:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260131233459.1625279-8-lukasz.majewski@mailbox.org>
2026-02-03 1:44 ` [net-next,v22,7/7] net: mtip: Extend the L2 switch driver for imx287 with bridge operations Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox