From: Furong Xu <0x1207@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "David S. Miller" <davem@davemloft.net>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Jose Abreu <joabreu@synopsys.com>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Joao Pinto <jpinto@synopsys.com>,
netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, xfr@outlook.com, rock.xu@nio.com
Subject: Re: [PATCH net-next v1] net: stmmac: Refactor Frame Preemption(FPE) implementation
Date: Tue, 9 Jul 2024 10:14:07 +0800 [thread overview]
Message-ID: <20240709101407.00005199@gmail.com> (raw)
In-Reply-To: <7cde7743-2a8c-4d12-aecb-d1e50d5099ea@lunn.ch>
On Mon, 8 Jul 2024 20:44:31 +0200
Andrew Lunn <andrew@lunn.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.
prev parent reply other threads:[~2024-07-09 2:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-08 8:22 [PATCH net-next v1] net: stmmac: Refactor Frame Preemption(FPE) implementation Furong Xu
2024-07-08 18:44 ` Andrew Lunn
2024-07-09 2:14 ` Furong Xu [this message]
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=20240709101407.00005199@gmail.com \
--to=0x1207@gmail.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=joabreu@synopsys.com \
--cc=jpinto@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=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rock.xu@nio.com \
--cc=xfr@outlook.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).