> + /* For phylink ops */ > + struct mutex cfg_lock;
phylink does its own locking. What is this actually protecting.
> +static int umac_alloc_rings(struct net_device *ndev) > +{ > + struct umac_priv *umac = netdev_priv(ndev); > + struct platform_device *pdev = umac->pdev; > + int err; > + > + err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); > + if (err) { > + dev_warn(&pdev->dev, "No suitable DMA available\n");
Is this a warning, or is it a fatal error? dev_err()?
> +static void umac_drop_tx(struct umac_priv *umac) > +{ > + int ret; > + > + umac_wait_idle(umac, UMAC_STS2_IDLE_MASK); > + > + /* > + * Disabling MAC when a transfer is in progress can leave it in a > + * state where the first frame after re-enabling is lost. Thus reset > + * here. > + */ > + mutex_lock(&umac->reset_lock); > + ret = reset_control_assert(umac->rst); > + if (!ret) { > + usleep_range(10000, 20000); > + ret = reset_control_deassert(umac->rst); > + } > + mutex_unlock(&umac->reset_lock); > + > + if (ret) > + netdev_err(umac->ndev, "MAC reset failed: %d\n", ret); > + > + umac_free_tx_skbs(umac);
If you cannot get the device out of reset, isn't it dead? Not returning an error here seems odd.
> +static int umac_init_hw(struct net_device *ndev) > +{ > + struct umac_priv *umac = netdev_priv(ndev); > + unsigned long flags; > + unsigned int value; > + > + umac_channel_disable(umac); > + if (umac_wait_idle(umac, UMAC_STS2_IDLE_MASK)) { > + netdev_warn(ndev, "MAC failed to stop\n"); > + return -EBUSY; > + }
umac_wait_idle() returns ETIMEDOUT. You should not replace one error with another, it makes it harder to work backwards to the source. Also, if you cannot stop the make, is that a fatal error? netdev_err()? Please check all your warnings and see if they should actually be errors.
> +static void umac_mac_link_up(struct phylink_config *config, > + struct phy_device *phy, unsigned int mode, > + phy_interface_t interface, int speed, int duplex, > + bool tx_pause, bool rx_pause) > +{ > + struct net_device *ndev = to_net_dev(config->dev); > + struct umac_priv *umac = netdev_priv(ndev); > + int err; > + > + mutex_lock(&umac->cfg_lock); > + umac->speed = speed; > + umac->duplex = duplex; > + umac->link = true;
Does the MAC support flow control. rx_pause and tx_pause are ignored here. Andrew