From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: Daniel Golle <daniel@makrotopia.org>,
netdev@vger.kernel.org, linux-mediatek@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Lorenzo Bianconi <lorenzo@kernel.org>,
Mark Lee <Mark-MC.Lee@mediatek.com>,
Sean Wang <sean.wang@mediatek.com>,
John Crispin <john@phrozen.org>, Felix Fietkau <nbd@nbd.name>,
Conor Dooley <conor+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Rob Herring <robh+dt@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>,
Sam Shih <Sam.Shih@mediatek.com>
Subject: Re: [PATCH net-next 5/8] net: ethernet: mtk_eth_soc: add MTK_NETSYS_V3 capability bit
Date: Tue, 13 Jun 2023 00:16:30 +0200 [thread overview]
Message-ID: <ZIeZPqFJqdf928f4@lore-desk> (raw)
In-Reply-To: <ZIb/WKKNlzjTIu2h@shell.armlinux.org.uk>
[-- Attachment #1: Type: text/plain, Size: 2697 bytes --]
> On Sun, Jun 11, 2023 at 01:38:23AM +0100, Daniel Golle wrote:
> > @@ -1333,8 +1354,13 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,
> > mtk_tx_set_dma_desc(dev, itxd, &txd_info);
> >
> > itx_buf->flags |= MTK_TX_FLAGS_SINGLE0;
> > - itx_buf->flags |= (!mac->id) ? MTK_TX_FLAGS_FPORT0 :
> > - MTK_TX_FLAGS_FPORT1;
> > + if (mac->id == MTK_GMAC1_ID)
> > + itx_buf->flags |= MTK_TX_FLAGS_FPORT0;
> > + else if (mac->id == MTK_GMAC2_ID)
> > + itx_buf->flags |= MTK_TX_FLAGS_FPORT1;
> > + else
> > + itx_buf->flags |= MTK_TX_FLAGS_FPORT2;
>
> There appears to be two places that this code structure appears, and
> this is in the path for packet transmission. I wonder if it would be
> more efficient to instead do:
>
> itx_buf->flags |= MTK_TX_FLAGS_SINGLE0 | mac->tx_flags;
>
> with mac->tx_flags appropriately initialised?
>
> > @@ -2170,7 +2214,9 @@ static int mtk_poll_tx_qdma(struct mtk_eth *eth, int budget,
> > tx_buf = mtk_desc_to_tx_buf(ring, desc,
> > eth->soc->txrx.txd_size);
> > if (tx_buf->flags & MTK_TX_FLAGS_FPORT1)
> > - mac = 1;
> > + mac = MTK_GMAC2_ID;
> > + else if (tx_buf->flags & MTK_TX_FLAGS_FPORT2)
> > + mac = MTK_GMAC3_ID;
>
> This has me wondering whether the flags are used for hardware or just
> for the driver's purposes. If it's the latter, can we instead store the
> MAC index in tx_buf, rather than having to decode a bitfield?
>
> I suspect these are just for the driver given that the addition of
> MTK_TX_FLAGS_FPORT2 changes all subsequent bit numbers in this struct
> member.
ack, I agree. I will rework it.
Regards,
Lorenzo
>
> >
> > if (!tx_buf->data)
> > break;
> > @@ -3783,7 +3829,26 @@ static int mtk_hw_init(struct mtk_eth *eth, bool reset)
> > mtk_w32(eth, eth->soc->txrx.rx_irq_done_mask, reg_map->qdma.int_grp + 4);
> > mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP);
> >
> > - if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) {
> > + if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) {
> > + /* PSE should not drop port1, port8 and port9 packets */
> > + mtk_w32(eth, 0x00000302, PSE_DROP_CFG);
> > +
> > + /* GDM and CDM Threshold */
> > + mtk_w32(eth, 0x00000707, MTK_CDMW0_THRES);
> > + mtk_w32(eth, 0x00000077, MTK_CDMW1_THRES);
> > +
> > + /* Disable GDM1 RX CRC stripping */
> > + val = mtk_r32(eth, MTK_GDMA_FWD_CFG(0));
> > + val &= ~MTK_GDMA_STRP_CRC;
> > + mtk_w32(eth, val, MTK_GDMA_FWD_CFG(0));
>
> mtk_m32() ?
>
> Thanks!
>
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
prev parent reply other threads:[~2023-06-12 22:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-11 0:38 [PATCH net-next 5/8] net: ethernet: mtk_eth_soc: add MTK_NETSYS_V3 capability bit Daniel Golle
2023-06-12 11:19 ` Russell King (Oracle)
2023-06-12 22:16 ` Lorenzo Bianconi [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=ZIeZPqFJqdf928f4@lore-desk \
--to=lorenzo.bianconi@redhat.com \
--cc=Mark-MC.Lee@mediatek.com \
--cc=Sam.Shih@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=conor+dt@kernel.org \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=john@phrozen.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=lorenzo@kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=nbd@nbd.name \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh+dt@kernel.org \
--cc=sean.wang@mediatek.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).