[net-next v14 04/12] net: mtip: The L2 switch driver for imx287
Paolo Abeni
pabeni at redhat.com
Tue Jul 8 04:10:53 PDT 2025
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).
> +/* 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.
/P
More information about the linux-arm-kernel
mailing list