From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Maxime Chevallier <maxime.chevallier@bootlin.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
davem@davemloft.net, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, alexis.lothore@bootlin.com,
thomas.petazzoni@bootlin.com, Andrew Lunn <andrew@lunn.ch>,
Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
Vladimir Oltean <vladimir.oltean@nxp.com>,
Ioana Ciornei <ioana.ciornei@nxp.com>,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Jose Abreu <joabreu@synopsys.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Giuseppe Cavallaro <peppe.cavallaro@st.com>,
Simon Horman <simon.horman@corigine.com>
Subject: Re: [PATCH net-next 1/2] net: stmmac: Add PCS_LYNX as a dependency for the whole driver
Date: Tue, 6 Jun 2023 11:34:44 +0100 [thread overview]
Message-ID: <ZH8LxGIvHd+B1eNm@shell.armlinux.org.uk> (raw)
In-Reply-To: <ZH8JxF+TNuX0C1vC@shell.armlinux.org.uk>
On Tue, Jun 06, 2023 at 11:26:12AM +0100, Russell King (Oracle) wrote:
> On Tue, Jun 06, 2023 at 12:13:11PM +0200, Maxime Chevallier wrote:
> > Hello Geert, Russell,
> >
> > On Tue, 6 Jun 2023 10:30:32 +0100
> > "Russell King (Oracle)" <linux@armlinux.org.uk> wrote:
> >
> > > On Tue, Jun 06, 2023 at 10:29:20AM +0200, Geert Uytterhoeven wrote:
> > > > Hi Maxime,
> > > >
> > > > On Tue, 6 Jun 2023, Maxime Chevallier wrote:
> > > > > Although pcs_lynx is only used on dwmac_socfpga for now, the cleanup
> > > > > path is in the generic driver, and triggers build issues for other
> > > > > stmmac variants. Make sure we build pcs_lynx in all cases too, as for
> > > > > XPCS.
> > > >
> > > > That seems suboptimal to me, as it needlesly increases kernel size for
> > > > people who do not use dwmac_socfpga. Hence I made an alternative patch:
> > > > https://lore.kernel/org/7b36ac43778b41831debd5c30b5b37d268512195.1686039915.git.geert+renesas@glider.be
> > >
> > > A better solution would be to re-architect the removal code so that
> > > whatever creates the PCS is also responsible for removing it.
> > >
> > > Also, dwmac_socfpga nees to be reorganised anyway, because it calls
> > > stmmac_dvr_probe() which then goes on to call register_netdev(),
> > > publishing the network device, and then after stmmac_dvr_probe(),
> > > further device setup is done. As the basic driver probe flow should
> > > be setup and then publish, the existing code structure violates that.
> > >
> >
> > I agree that this solution is definitely suboptimal, I wanted mostly to get it
> > fixed quickly as this breaks other stmmac variants.
> >
> > Do we still go on with the current patch (as Geert's has issues) and then
> > consider reworking dwmac_socfpga ?
>
> As Geert himself mentioned, passed on from Arnd:
> As pointed out by Arnd, this doesn't work when PCS_LYNX is a loadable
> module and STMMAC is built-in:
> https://lore.kernel.org/r/11bd37e9-c62e-46ba-9456-8e3b353df28f@app.fastmail.com
>
> So Geert's solution will just get rid of the build error, but leave the
> Lynx PCS undestroyed. I take Geert's comment as a self-nack on his
> proposed patch.
>
> The changes are only in net-next at the moment, and we're at -rc5.
> There's probably about 2.5 weeks to get this sorted before the merge
> window opens.
>
> So, we currently have your suggestion. Here's mine as an immediate
> fix. This doesn't address all the points I've raised, but should
> resolve the immediate issue.
>
> Untested since I don't have the hardware... (the test build is
> running):
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> index e399fccbafe5..239c7e9ed41d 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> @@ -494,6 +494,17 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
> return ret;
> }
>
> +static void socfpga_dwmac_remove(struct platform_device *pdev)
> +{
> + struct net_device *ndev = platform_get_drvdata(pdev);
> + struct stmmac_priv *priv = netdev_priv(ndev);
> + struct phylink_pcs *pcs = priv->hw->lynx_pcs;
> +
> + stmmac_pltfr_remove(pdev);
> +
> + lynx_pcs_destroy(pcs);
> +}
> +
> #ifdef CONFIG_PM_SLEEP
> static int socfpga_dwmac_resume(struct device *dev)
> {
> @@ -565,7 +576,7 @@ MODULE_DEVICE_TABLE(of, socfpga_dwmac_match);
>
> static struct platform_driver socfpga_dwmac_driver = {
> .probe = socfpga_dwmac_probe,
> - .remove_new = stmmac_pltfr_remove,
> + .remove_new = socfpga_dwmac_remove,
> .driver = {
> .name = "socfpga-dwmac",
> .pm = &socfpga_dwmac_pm_ops,
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index fa07b0d50b46..1801f8cc8413 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -940,9 +940,6 @@ static struct phylink_pcs *stmmac_mac_select_pcs(struct phylink_config *config,
> if (priv->hw->xpcs)
> return &priv->hw->xpcs->pcs;
>
> - if (priv->hw->lynx_pcs)
> - return priv->hw->lynx_pcs;
> -
This hunk is completely wrong... but I guess you spotted that anyway.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2023-06-06 10:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-06 6:49 [PATCH net-next 0/2] Followup fixes for the dwmac and altera lynx conversion Maxime Chevallier
2023-06-06 6:49 ` [PATCH net-next 1/2] net: stmmac: Add PCS_LYNX as a dependency for the whole driver Maxime Chevallier
2023-06-06 8:29 ` Geert Uytterhoeven
2023-06-06 9:30 ` Russell King (Oracle)
2023-06-06 10:13 ` Maxime Chevallier
2023-06-06 10:26 ` Russell King (Oracle)
2023-06-06 10:34 ` Russell King (Oracle) [this message]
2023-06-06 10:40 ` Russell King (Oracle)
2023-06-06 10:35 ` Geert Uytterhoeven
2023-06-06 10:44 ` Russell King (Oracle)
2023-06-06 12:50 ` Maxime Chevallier
2023-06-06 6:49 ` [PATCH net-next 2/2] net: altera-tse: Initialize the regmap_config struct before using it 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=ZH8LxGIvHd+B1eNm@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=alexandre.torgue@foss.st.com \
--cc=alexis.lothore@bootlin.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=geert@linux-m68k.org \
--cc=hkallweit1@gmail.com \
--cc=ioana.ciornei@nxp.com \
--cc=joabreu@synopsys.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=maxime.chevallier@bootlin.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peppe.cavallaro@st.com \
--cc=simon.horman@corigine.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=vladimir.oltean@nxp.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).