netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Maxime Chevallier <maxime.chevallier@bootlin.com>
Cc: davem@davemloft.net,
	Pantelis Antoniou <pantelis.antoniou@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>, Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Russell King <linux@armlinux.org.uk>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	thomas.petazzoni@bootlin.com,
	Herve Codina <herve.codina@bootlin.com>,
	Simon Horman <horms@kernel.org>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH net-next v2 7/7] net: ethernet: fs_enet: phylink conversion
Date: Mon, 2 Sep 2024 18:55:43 -0700	[thread overview]
Message-ID: <20240902185543.48d91e87@kernel.org> (raw)
In-Reply-To: <20240829161531.610874-8-maxime.chevallier@bootlin.com>

On Thu, 29 Aug 2024 18:15:30 +0200 Maxime Chevallier wrote:
> @@ -582,15 +591,12 @@ static void fs_timeout_work(struct work_struct *work)
>  
>  	dev->stats.tx_errors++;
>  
> -	spin_lock_irqsave(&fep->lock, flags);
> -
> -	if (dev->flags & IFF_UP) {
> -		phy_stop(dev->phydev);
> -		(*fep->ops->stop)(dev);
> -		(*fep->ops->restart)(dev);
> -	}
> +	rtnl_lock();

so we take rtnl_lock here..

> +	phylink_stop(fep->phylink);
> +	phylink_start(fep->phylink);
> +	rtnl_unlock();
>  
> -	phy_start(dev->phydev);
> +	spin_lock_irqsave(&fep->lock, flags);
>  	wake = fep->tx_free >= MAX_SKB_FRAGS &&
>  	       !(CBDR_SC(fep->cur_tx) & BD_ENET_TX_READY);
>  	spin_unlock_irqrestore(&fep->lock, flags);

> @@ -717,19 +686,18 @@ static int fs_enet_close(struct net_device *dev)
>  	unsigned long flags;
>  
>  	netif_stop_queue(dev);
> -	netif_carrier_off(dev);
>  	napi_disable(&fep->napi);
>  	cancel_work_sync(&fep->timeout_work);

..and cancel_work_sync() under rtnl_lock here?

IDK if removing the the "dev->flags & IFF_UP" check counts as
meaningfully making it worse, but we're going in the wrong direction.
The _sync() has to go, and the timeout work needs to check if device
has been closed under rtnl_lock ?


> -	phy_stop(dev->phydev);
> +	phylink_stop(fep->phylink);
>  
>  	spin_lock_irqsave(&fep->lock, flags);
>  	spin_lock(&fep->tx_lock);
>  	(*fep->ops->stop)(dev);
>  	spin_unlock(&fep->tx_lock);
>  	spin_unlock_irqrestore(&fep->lock, flags);
> +	phylink_disconnect_phy(fep->phylink);
>  
>  	/* release any irqs */
> -	phy_disconnect(dev->phydev);
>  	free_irq(fep->interrupt, dev);
>  
>  	return 0;

  reply	other threads:[~2024-09-03  1:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-29 16:15 [PATCH net-next v2 0/7] net: ethernet: fs_enet: Cleanup and phylink conversion Maxime Chevallier
2024-08-29 16:15 ` [PATCH net-next v2 1/7] net: ethernet: fs_enet: convert to SPDX Maxime Chevallier
2024-08-30 20:56   ` Andrew Lunn
2024-08-29 16:15 ` [PATCH net-next v2 2/7] net: ethernet: fs_enet: cosmetic cleanups Maxime Chevallier
2024-08-30 21:00   ` Andrew Lunn
2024-08-29 16:15 ` [PATCH net-next v2 3/7] net: ethernet: fs_enet: drop the .adjust_link custom fs_ops Maxime Chevallier
2024-08-30 21:06   ` Andrew Lunn
2024-09-04  8:27     ` Maxime Chevallier
2024-09-04 12:36       ` Andrew Lunn
2024-09-04 15:50         ` Maxime Chevallier
2024-08-29 16:15 ` [PATCH net-next v2 4/7] net: ethernet: fs_enet: drop unused phy_info and mii_if_info Maxime Chevallier
2024-08-30 21:06   ` Andrew Lunn
2024-08-30 21:07   ` Andrew Lunn
2024-09-04  8:52     ` Maxime Chevallier
2024-08-29 16:15 ` [PATCH net-next v2 5/7] net: ethernet: fs_enet: fcc: use macros for speed and duplex values Maxime Chevallier
2024-08-30 21:08   ` Andrew Lunn
2024-08-29 16:15 ` [PATCH net-next v2 6/7] net: ethernet: fs_enet: simplify clock handling with devm accessors Maxime Chevallier
2024-08-30 21:09   ` Andrew Lunn
2024-08-29 16:15 ` [PATCH net-next v2 7/7] net: ethernet: fs_enet: phylink conversion Maxime Chevallier
2024-09-03  1:55   ` Jakub Kicinski [this message]
2024-09-04 10:49     ` Maxime Chevallier

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=20240902185543.48d91e87@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=christophe.leroy@csgroup.eu \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=herve.codina@bootlin.com \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pantelis.antoniou@gmail.com \
    --cc=thomas.petazzoni@bootlin.com \
    /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;
as well as URLs for NNTP newsgroup(s).