[PATCH net-next v9 3/7] net: stmmac: refactor FPE verification process
Vladimir Oltean
olteanv at gmail.com
Fri Sep 6 05:49:24 PDT 2024
On Fri, Sep 06, 2024 at 03:41:09PM +0300, Vladimir Oltean wrote:
> On Fri, Sep 06, 2024 at 12:55:58PM +0800, Furong Xu wrote:
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > @@ -969,17 +969,30 @@ static void stmmac_mac_config(struct phylink_config *config, unsigned int mode,
> > static void stmmac_fpe_link_state_handle(struct stmmac_priv *priv, bool is_up)
> > {
> > struct stmmac_fpe_cfg *fpe_cfg = &priv->fpe_cfg;
> > - enum stmmac_fpe_state *lo_state = &fpe_cfg->lo_fpe_state;
> > - enum stmmac_fpe_state *lp_state = &fpe_cfg->lp_fpe_state;
> > - bool *hs_enable = &fpe_cfg->hs_enable;
> > + unsigned long flags;
> >
> > - if (is_up && *hs_enable) {
> > - stmmac_fpe_send_mpacket(priv, priv->ioaddr, fpe_cfg,
> > - MPACKET_VERIFY);
> > + timer_shutdown_sync(&fpe_cfg->verify_timer);
> > }
> >
> > static void stmmac_mac_link_down(struct phylink_config *config,
> > @@ -4091,10 +4068,10 @@ static int stmmac_release(struct net_device *dev)
> >
> > stmmac_release_ptp(priv);
> >
> > - pm_runtime_put(priv->device);
> > -
> > if (priv->dma_cap.fpesel)
> > - stmmac_fpe_stop_wq(priv);
> > + timer_shutdown_sync(&priv->fpe_cfg.verify_timer);
> > +
> > + pm_runtime_put(priv->device);
> >
> > return 0;
> > }
> > @@ -7372,53 +7334,88 @@ int stmmac_reinit_ringparam(struct net_device *dev, u32 rx_size, u32 tx_size)
> > +static void stmmac_fpe_verify_timer_arm(struct stmmac_fpe_cfg *fpe_cfg)
> > +{
> > + if (fpe_cfg->pmac_enabled && fpe_cfg->tx_enabled &&
> > + fpe_cfg->verify_enabled &&
> > + fpe_cfg->status != ETHTOOL_MM_VERIFY_STATUS_FAILED &&
> > + fpe_cfg->status != ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED) {
> > + timer_setup(&fpe_cfg->verify_timer, stmmac_fpe_verify_timer, 0);
> > + mod_timer(&fpe_cfg->verify_timer, jiffies);
> > + }
> > +}
> > @@ -7875,15 +7874,8 @@ int stmmac_suspend(struct device *dev)
> > }
> > rtnl_unlock();
> >
> > - if (priv->dma_cap.fpesel) {
> > - /* Disable FPE */
> > - stmmac_fpe_configure(priv, priv->ioaddr,
> > - &priv->fpe_cfg,
> > - priv->plat->tx_queues_to_use,
> > - priv->plat->rx_queues_to_use, false);
> > -
> > - stmmac_fpe_stop_wq(priv);
> > - }
> > + if (priv->dma_cap.fpesel)
> > + timer_shutdown_sync(&priv->fpe_cfg.verify_timer);
> >
> > priv->speed = SPEED_UNKNOWN;
> > return 0;
>
> Calling timer_setup() after timer_shutdown_sync() is a bit unconventional,
> but I don't see why it shouldn't work.
>
> Reviewed-by: Vladimir Oltean <olteanv at gmail.com>
Actually, I'm really wondering. Is lockdep okay if you run timer_shutdown_sync()
on a timer on which you've never called timer_setup()?
More information about the linux-arm-kernel
mailing list