[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240709101407.00005199@gmail.com>
Date: Tue, 9 Jul 2024 10:14:07 +0800
From: Furong Xu <0x1207@...il.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: "David S. Miller" <davem@...emloft.net>, Alexandre Torgue
<alexandre.torgue@...s.st.com>, Jose Abreu <joabreu@...opsys.com>, Eric
Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo
Abeni <pabeni@...hat.com>, Maxime Coquelin <mcoquelin.stm32@...il.com>,
Joao Pinto <jpinto@...opsys.com>, netdev@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
xfr@...look.com, rock.xu@....com
Subject: Re: [PATCH net-next v1] net: stmmac: Refactor Frame Preemption(FPE)
implementation
On Mon, 8 Jul 2024 20:44:31 +0200
Andrew Lunn <andrew@...n.ch> wrote:
> > +static void fpe_configure(struct stmmac_priv *priv, struct stmmac_fpe_cfg *cfg,
> > + u32 num_txq, u32 num_rxq, bool enable)
> > +{
> > + u32 value;
> > +
> > + if (enable) {
> > + cfg->fpe_csr = FPE_CTRL_STS_EFPE;
> > + if (priv->plat->has_xgmac) {
> > + value = readl(priv->ioaddr + XGMAC_RXQ_CTRL1);
> > + value &= ~XGMAC_FPRQ;
> > + value |= (num_rxq - 1) << XGMAC_FPRQ_SHIFT;
> > + writel(value, priv->ioaddr + XGMAC_RXQ_CTRL1);
> > + } else if (priv->plat->has_gmac4) {
> > + value = readl(priv->ioaddr + GMAC_RXQ_CTRL1);
> > + value &= ~GMAC_RXQCTRL_FPRQ;
> > + value |= (num_rxq - 1) << GMAC_RXQCTRL_FPRQ_SHIFT;
> > + writel(value, priv->ioaddr + GMAC_RXQ_CTRL1);
> > + }
>
> Since you are using a structure of function pointers, it would seem
> more logical to have a fpe_xgmac_configure() and a
> fpe_gmac4_configure(), and then xgmac_fpe_ops and gmac4_fpe_ops.
>
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > @@ -974,8 +974,7 @@ static void stmmac_fpe_link_state_handle(struct stmmac_priv *priv, bool is_up)
> > bool *hs_enable = &fpe_cfg->hs_enable;
> >
> > if (is_up && *hs_enable) {
> > - stmmac_fpe_send_mpacket(priv, priv->ioaddr, fpe_cfg,
> > - MPACKET_VERIFY);
> > + stmmac_fpe_send_mpacket(priv, priv, fpe_cfg, MPACKET_VERIFY);
>
> passing priv twice looks very odd! It makes me think the API is
> designed wrong. This could be because of the refactoring changes you
> made? Maybe add another patch cleaning this up?
Hi Andrew
Thanks for your comments.
This patch is almost a clone of "net: stmmac: Refactor EST implementation"
https://github.com/torvalds/linux/commit/c3f3b97238f6fd87b9d90b9a995ee5e69f751a74
Many decisions were made based on that patch.
I will submit a new patchset with splited patches and make function callbacks more logical.
Powered by blists - more mailing lists