From: Yanteng Si <siyanteng@loongson.cn>
To: Serge Semin <fancer.lancer@gmail.com>
Cc: andrew@lunn.ch, hkallweit1@gmail.com, peppe.cavallaro@st.com,
alexandre.torgue@foss.st.com, joabreu@synopsys.com,
Jose.Abreu@synopsys.com, chenhuacai@kernel.org,
linux@armlinux.org.uk, guyinggang@loongson.cn,
netdev@vger.kernel.org, chris.chenfeiyang@gmail.com,
siyanteng01@gmail.com
Subject: Re: [PATCH net-next v12 02/15] net: stmmac: Add multi-channel support
Date: Mon, 13 May 2024 17:49:10 +0800 [thread overview]
Message-ID: <f2ade097-5f4c-4de6-a7f2-9f3d026f95e7@loongson.cn> (raw)
In-Reply-To: <o7l4klg25pjx3glv7wg65l24uxe4tjdhz3cwd7dxegt46ytxfr@o7ofnqdovgsp>
在 2024/5/13 17:45, Serge Semin 写道:
> On Fri, May 10, 2024 at 06:13:40PM +0800, Yanteng Si wrote:
>> Hi Serge
>>
>> 在 2024/5/3 06:02, Serge Semin 写道:
>>> On Thu, Apr 25, 2024 at 09:01:55PM +0800, Yanteng Si wrote:
>>>> DW GMAC v3.x multi-channels feature is implemented as multiple
>>>> sets of the same CSRs. Here is only preliminary support, it will
>>>> be useful for the driver further evolution and for the users
>>>> having multi-channel DWGMAC v3.x devices.
>>> Why do you call it "preliminary"? AFAICS it's a fully functional
>>> support with no restrictions. Am I wrong?
>>>
>>> I would reformulate the commit message as:
>>>
>>> "DW GMAC v3.73 can be equipped with the Audio Video (AV) feature which
>>> enables transmission of time-sensitive traffic over bridged local area
>>> networks (DWC Ethernet QoS Product). In that case there can be up to two
>>> additional DMA-channels available with no Tx COE support (unless there is
>>> vendor-specific IP-core alterations). Each channel is implemented as a
>>> separate Control and Status register (CSR) for managing the transmit and
>>> receive functions, descriptor handling, and interrupt handling.
>>>
>>> Add the multi-channels DW GMAC controllers support just by making sure the
>>> already implemented DMA-configs are performed on the per-channel basis.
>>>
>>> Note the only currently known instance of the multi-channel DW GMAC
>>> IP-core is the LS2K2000 GNET controller, which has been released with the
>>> vendor-specific feature extension of having eight DMA-channels. The device
>>> support will be added in one of the following up commits."
>> OK.
>>>> @@ -153,7 +155,7 @@ static void dwmac1000_dma_operation_mode_rx(struct stmmac_priv *priv,
>>>> void __iomem *ioaddr, int mode,
>>>> u32 channel, int fifosz, u8 qmode)
>>>> {
>>>> - u32 csr6 = readl(ioaddr + DMA_CONTROL);
>>>> + u32 csr6 = readl(ioaddr + DMA_CHAN_CONTROL(channel));
>>>> if (mode == SF_DMA_MODE) {
>>>> pr_debug("GMAC: enable RX store and forward mode\n");
>>>> @@ -175,14 +177,14 @@ static void dwmac1000_dma_operation_mode_rx(struct stmmac_priv *priv,
>>>> /* Configure flow control based on rx fifo size */
>>>> csr6 = dwmac1000_configure_fc(csr6, fifosz);
>>>> - writel(csr6, ioaddr + DMA_CONTROL);
>>>> + writel(csr6, ioaddr + DMA_CHAN_CONTROL(channel));
>>>> }
>>>> static void dwmac1000_dma_operation_mode_tx(struct stmmac_priv *priv,
>>>> void __iomem *ioaddr, int mode,
>>>> u32 channel, int fifosz, u8 qmode)
>>>> {
>>>> - u32 csr6 = readl(ioaddr + DMA_CONTROL);
>>>> + u32 csr6 = readl(ioaddr + DMA_CHAN_CONTROL(channel));
>>>> if (mode == SF_DMA_MODE) {
>>>> pr_debug("GMAC: enable TX store and forward mode\n");
>>>> @@ -209,7 +211,7 @@ static void dwmac1000_dma_operation_mode_tx(struct stmmac_priv *priv,
>>>> csr6 |= DMA_CONTROL_TTC_256;
>>>> }
>>>> - writel(csr6, ioaddr + DMA_CONTROL);
>>>> + writel(csr6, ioaddr + DMA_CHAN_CONTROL(channel));
>>>> }
>>> Just figured out that besides of the channel-related changes you also need
>>> to have the stmmac_dma_operation_mode() method fixed. So one wouldn't
>>> redistribute the detected Tx/Rx FIFO between the channels. Each DW GMAC
>>> channel has separate FIFO of the same size. The databook explicitly says
>>> about that:
>>>
>>> "The Tx FIFO size of all selected Transmit channels is always same.
>>> Similarly, the Rx FIFO size of all selected Receive channels is same.
>>> These channels cannot be of different sizes."
>>>
>> Should I do this, right?
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> index 33d04243b4d8..9d4148daee68 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> @@ -2371,8 +2371,13 @@ static void stmmac_dma_operation_mode(struct
>> stmmac_priv *priv)
>> txfifosz = priv->dma_cap.tx_fifo_size;
>>
>> /* Adjust for real per queue fifo size */
>> - rxfifosz /= rx_channels_count;
>> - txfifosz /= tx_channels_count;
>> + if ((priv->synopsys_id != DWMAC_CORE_3_40) ||
>> + (priv->synopsys_id != DWMAC_CORE_3_50) ||
>> + (priv->synopsys_id != DWMAC_CORE_3_70)) {
>> + rxfifosz /= rx_channels_count;
>> + txfifosz /= tx_channels_count;
>> + }
>> +
>>
>> if (priv->plat->force_thresh_dma_mode) {
>> txmode = tc;
> Seeing the shared FIFO memory is specific for the DW QoS Eth and DW
> xGMAC IP-cores let's use the has_gmac4 and has_xgmac flags instead:
>
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -2371,8 +2371,13 @@ static void stmmac_dma_operation_mode(struct stmmac_priv *priv)
> if (txfifosz == 0)
> txfifosz = priv->dma_cap.tx_fifo_size;
>
> - /* Adjust for real per queue fifo size */
> - rxfifosz /= rx_channels_count;
> - txfifosz /= tx_channels_count;
> + /* Split up the shared Tx/Rx FIFO memory on DW QoS Eth and DW XGMAC */
> + if (priv->plat->has_gmac4 || priv->plat->has_xgmac) {
> + rxfifosz /= rx_channels_count;
> + txfifosz /= tx_channels_count;
> + }
>
> if (priv->plat->force_thresh_dma_mode) {
> txmode = tc;
OK.
Thanks,
Yanteng
next prev parent reply other threads:[~2024-05-13 9:49 UTC|newest]
Thread overview: 81+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-25 13:01 [PATCH net-next v12 00/15] stmmac: Add Loongson platform support Yanteng Si
2024-04-25 13:01 ` [PATCH net-next v12 01/15] net: stmmac: Move the atds flag to the stmmac_dma_cfg structure Yanteng Si
2024-05-02 19:10 ` Serge Semin
2024-05-09 12:44 ` Yanteng Si
2024-04-25 13:01 ` [PATCH net-next v12 02/15] net: stmmac: Add multi-channel support Yanteng Si
2024-05-02 22:02 ` Serge Semin
2024-05-10 10:13 ` Yanteng Si
2024-05-13 9:45 ` Serge Semin
2024-05-13 9:49 ` Yanteng Si [this message]
2024-04-25 13:01 ` [PATCH net-next v12 03/15] net: stmmac: Export dwmac1000_dma_ops Yanteng Si
2024-05-03 10:27 ` Serge Semin
2024-05-13 9:46 ` Yanteng Si
2024-04-25 13:04 ` [PATCH net-next v12 04/15] net: stmmac: dwmac-loongson: Drop useless platform data Yanteng Si
2024-05-03 10:55 ` Serge Semin
2024-05-03 14:47 ` Serge Semin
2024-05-13 9:47 ` Yanteng Si
2024-05-13 9:46 ` Yanteng Si
2024-04-25 13:04 ` [PATCH net-next v12 05/15] net: stmmac: dwmac-loongson: Use PCI_DEVICE_DATA() macro for device identification Yanteng Si
2024-05-03 13:43 ` Serge Semin
2024-05-13 9:50 ` Yanteng Si
2024-04-25 13:04 ` [PATCH net-next v12 06/15] net: stmmac: dwmac-loongson: Split up the platform data initialization Yanteng Si
2024-05-03 18:08 ` Serge Semin
2024-05-13 11:07 ` Yanteng Si
2024-05-13 12:42 ` Huacai Chen
2024-05-13 14:04 ` Serge Semin
2024-05-18 10:38 ` yanteng si
2024-04-25 13:06 ` [PATCH net-next v12 07/15] net: stmmac: dwmac-loongson: Add ref and ptp clocks for Loongson Yanteng Si
2024-05-03 18:21 ` Serge Semin
2024-05-09 13:01 ` Yanteng Si
2024-04-25 13:06 ` [PATCH net-next v12 08/15] net: stmmac: dwmac-loongson: Add phy mask for Loongson GMAC Yanteng Si
2024-05-03 18:28 ` Serge Semin
2024-05-13 10:23 ` Yanteng Si
2024-04-25 13:06 ` [PATCH net-next v12 09/15] net: stmmac: dwmac-loongson: Add phy_interface " Yanteng Si
2024-04-25 14:36 ` Russell King (Oracle)
2024-04-26 10:16 ` Yanteng Si
2024-04-26 11:00 ` Russell King (Oracle)
2024-05-03 21:01 ` Serge Semin
2024-05-07 8:22 ` Russell King (Oracle)
2024-04-25 13:10 ` [PATCH net-next v12 10/15] net: stmmac: dwmac-loongson: Add full PCI support Yanteng Si
2024-05-04 20:46 ` Serge Semin
2024-05-13 10:49 ` Yanteng Si
2024-04-25 13:10 ` [PATCH net-next v12 11/15] net: stmmac: dwmac-loongson: Add loongson_dwmac_config_legacy Yanteng Si
2024-05-04 21:28 ` Serge Semin
2024-05-13 10:12 ` Yanteng Si
2024-04-25 13:10 ` [PATCH net-next v12 12/15] net: stmmac: dwmac-loongson: Fixed failure to set network speed to 1000 Yanteng Si
2024-05-04 22:13 ` Serge Semin
2024-05-13 10:16 ` Yanteng Si
2024-04-25 13:11 ` [PATCH net-next v12 13/15] net: stmmac: dwmac-loongson: Add Loongson GNET support Yanteng Si
2024-04-26 5:12 ` Yanteng Si
2024-05-05 21:50 ` Serge Semin
2024-05-17 8:12 ` Yanteng Si
2024-05-17 9:48 ` Serge Semin
2024-05-17 11:14 ` yanteng si
2024-05-06 10:39 ` Serge Semin
2024-05-07 13:35 ` Yanteng Si
2024-05-08 14:38 ` Serge Semin
2024-05-08 14:58 ` Huacai Chen
2024-05-08 15:10 ` Serge Semin
2024-05-09 8:57 ` Yanteng Si
2024-05-13 10:56 ` Serge Semin
2024-05-13 13:26 ` Huacai Chen
2024-05-13 16:11 ` Serge Semin
2024-05-14 4:58 ` Huacai Chen
2024-05-14 11:33 ` Serge Semin
2024-05-14 12:53 ` Huacai Chen
2024-05-15 8:40 ` Serge Semin
2024-05-15 13:55 ` Huacai Chen
2024-05-17 8:42 ` Yanteng Si
2024-05-17 9:07 ` Serge Semin
2024-05-17 10:37 ` Yanteng Si
2024-05-17 16:37 ` Serge Semin
2024-05-18 10:47 ` yanteng si
2024-04-25 13:11 ` [PATCH net-next v12 14/15] net: stmmac: dwmac-loongson: Move disable_force flag to _gnet_date Yanteng Si
2024-05-05 21:53 ` Serge Semin
2024-05-13 10:20 ` Yanteng Si
2024-04-25 13:11 ` [PATCH net-next v12 15/15] net: stmmac: dwmac-loongson: Add loongson module author Yanteng Si
2024-05-06 2:12 ` Huacai Chen
2024-05-06 4:44 ` Serge Semin
2024-04-25 13:19 ` [PATCH net-next v12 00/15] stmmac: Add Loongson platform support Serge Semin
2024-04-26 4:55 ` Yanteng Si
2024-04-26 11:51 ` Serge Semin
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=f2ade097-5f4c-4de6-a7f2-9f3d026f95e7@loongson.cn \
--to=siyanteng@loongson.cn \
--cc=Jose.Abreu@synopsys.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew@lunn.ch \
--cc=chenhuacai@kernel.org \
--cc=chris.chenfeiyang@gmail.com \
--cc=fancer.lancer@gmail.com \
--cc=guyinggang@loongson.cn \
--cc=hkallweit1@gmail.com \
--cc=joabreu@synopsys.com \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.com \
--cc=siyanteng01@gmail.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 read-only IMAP folder(s) and NNTP newsgroup(s).