From: Joao Pinto <Joao.Pinto@synopsys.com>
To: Thierry Reding <thierry.reding@gmail.com>,
"David S . Miller" <davem@davemloft.net>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>,
Alexandre Torgue <alexandre.torgue@st.com>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Joao Pinto <Joao.Pinto@synopsys.com>,
"Alexandre Courbot" <gnurou@gmail.com>,
Jon Hunter <jonathanh@nvidia.com>, <netdev@vger.kernel.org>,
<linux-tegra@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 5/7] net: stmmac: Program RX queue size and flow control
Date: Thu, 2 Mar 2017 15:15:12 +0000 [thread overview]
Message-ID: <ea26c03c-6ce0-ff66-dcb5-6f95cdf2caed@synopsys.com> (raw)
In-Reply-To: <20170223172438.14770-6-thierry.reding@gmail.com>
Às 5:24 PM de 2/23/2017, Thierry Reding escreveu:
> From: Thierry Reding <treding@nvidia.com>
>
> Program the receive queue size based on the RX FIFO size and enable
> hardware flow control for large FIFOs.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
> drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 12 +++++++
> drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 43 ++++++++++++++++++++++--
> 2 files changed, 53 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
> index db45134fddf0..9acc1f1252b3 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
> @@ -180,6 +180,7 @@ enum power_event {
> #define MTL_OP_MODE_TSF BIT(1)
>
> #define MTL_OP_MODE_TQS_MASK GENMASK(24, 16)
> +#define MTL_OP_MODE_TQS_SHIFT 16
>
> #define MTL_OP_MODE_TTC_MASK 0x70
> #define MTL_OP_MODE_TTC_SHIFT 4
> @@ -193,6 +194,17 @@ enum power_event {
> #define MTL_OP_MODE_TTC_384 (6 << MTL_OP_MODE_TTC_SHIFT)
> #define MTL_OP_MODE_TTC_512 (7 << MTL_OP_MODE_TTC_SHIFT)
>
> +#define MTL_OP_MODE_RQS_MASK GENMASK(29, 20)
> +#define MTL_OP_MODE_RQS_SHIFT 20
> +
> +#define MTL_OP_MODE_RFD_MASK GENMASK(19, 14)
> +#define MTL_OP_MODE_RFD_SHIFT 14
> +
> +#define MTL_OP_MODE_RFA_MASK GENMASK(13, 8)
> +#define MTL_OP_MODE_RFA_SHIFT 8
> +
> +#define MTL_OP_MODE_EHFC BIT(7)
> +
> #define MTL_OP_MODE_RTC_MASK 0x18
> #define MTL_OP_MODE_RTC_SHIFT 3
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
> index 8d249f3b34c8..03d230201960 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
> @@ -185,8 +185,9 @@ static void dwmac4_rx_watchdog(void __iomem *ioaddr, u32 riwt)
> }
>
> static void dwmac4_dma_chan_op_mode(void __iomem *ioaddr, int txmode,
> - int rxmode, u32 channel)
> + int rxmode, u32 channel, int rxfifosz)
> {
> + unsigned int rqs = rxfifosz / 256 - 1;
> u32 mtl_tx_op, mtl_rx_op, mtl_rx_int;
>
> /* Following code only done for channel 0, other channels not yet
> @@ -252,6 +253,44 @@ static void dwmac4_dma_chan_op_mode(void __iomem *ioaddr, int txmode,
> mtl_rx_op |= MTL_OP_MODE_RTC_128;
> }
>
> + mtl_rx_op &= ~MTL_OP_MODE_RQS_MASK;
> + mtl_rx_op |= rqs << MTL_OP_MODE_RQS_SHIFT;
> +
> + /* enable flow control only if each channel gets 4 KiB or more FIFO */
> + if (rxfifosz >= 4096) {
> + unsigned int rfd, rfa;
> +
> + mtl_rx_op |= MTL_OP_MODE_EHFC;
> +
> + switch (rxfifosz) {
> + case 4096:
> + rfd = 0x03;
> + rfa = 0x01;
> + break;
> +
> + case 8192:
> + rfd = 0x06;
> + rfa = 0x0a;
> + break;
> +
> + case 16384:
> + rfd = 0x06;
> + rfa = 0x12;
> + break;
> +
> + default:
> + rfd = 0x06;
> + rfa = 0x1e;
> + break;
> + }
Are these RFA and RFD values suitable to any setup using thresholds? Please
justify their values in oerder for other developers to understand them.
> +
> + mtl_rx_op &= ~MTL_OP_MODE_RFD_MASK;
> + mtl_rx_op |= rfd << MTL_OP_MODE_RFD_SHIFT;
> +
> + mtl_rx_op &= ~MTL_OP_MODE_RFA_MASK;
> + mtl_rx_op |= rfa << MTL_OP_MODE_RFA_SHIFT;
> + }
> +
> writel(mtl_rx_op, ioaddr + MTL_CHAN_RX_OP_MODE(channel));
>
> /* Enable MTL RX overflow */
> @@ -264,7 +303,7 @@ static void dwmac4_dma_operation_mode(void __iomem *ioaddr, int txmode,
> int rxmode, int rxfifosz)
> {
> /* Only Channel 0 is actually configured and used */
> - dwmac4_dma_chan_op_mode(ioaddr, txmode, rxmode, 0);
> + dwmac4_dma_chan_op_mode(ioaddr, txmode, rxmode, 0, rxfifosz);
Why not configure tx fifo as well, you already getting it from the features
register.
> }
>
> static void dwmac4_get_hw_feature(void __iomem *ioaddr,
>
Thanks.
next prev parent reply other threads:[~2017-03-02 15:15 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-23 17:24 [PATCH 0/7] net: stmmac: Fixes and Tegra186 support Thierry Reding
2017-02-23 17:24 ` [PATCH 1/7] net: stmmac: Rename clk_ptp_ref clock to ptp_ref Thierry Reding
2017-02-23 17:24 ` [PATCH 2/7] net: stmmac: Balance PTP reference clock enable/disable Thierry Reding
[not found] ` <20170223172438.14770-3-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-27 9:31 ` Mikko Perttunen
[not found] ` <53f18077-6a4d-339f-192e-287a1f889fb7-/1wQRMveznE@public.gmane.org>
2017-03-09 19:30 ` Thierry Reding
2017-03-02 14:47 ` Joao Pinto
2017-02-23 17:24 ` [PATCH 3/7] net: stmmac: Check for DMA mapping errors Thierry Reding
2017-02-27 9:37 ` Mikko Perttunen
[not found] ` <35dec9cd-65db-c62b-f35f-c90cf35b27f2-/1wQRMveznE@public.gmane.org>
2017-03-09 19:29 ` Thierry Reding
2017-02-23 17:24 ` [PATCH 4/7] net: stmmac: Parse FIFO sizes from feature registers Thierry Reding
2017-02-27 9:51 ` Mikko Perttunen
2017-03-02 15:09 ` Joao Pinto
[not found] ` <b74f9b19-4315-1349-88c0-b549a2f8ef5d-HKixBCOQz3hWk0Htik3J/w@public.gmane.org>
2017-03-09 19:41 ` Thierry Reding
2017-03-10 10:32 ` Joao Pinto
2017-02-23 17:24 ` [PATCH 5/7] net: stmmac: Program RX queue size and flow control Thierry Reding
2017-02-27 10:09 ` Mikko Perttunen
[not found] ` <74ee5bff-8893-ebd4-bcf8-bb92c476f581-/1wQRMveznE@public.gmane.org>
2017-03-09 19:42 ` Thierry Reding
[not found] ` <20170309194231.GD5554-EkSeR96xj6Pcmrwk2tT4+A@public.gmane.org>
2017-03-09 20:18 ` Stephen Warren
[not found] ` <83aaa3b1-a2d4-8ddd-d31a-2fd6c653e3d1-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2017-03-09 20:44 ` Thierry Reding
2017-03-02 15:15 ` Joao Pinto [this message]
[not found] ` <ea26c03c-6ce0-ff66-dcb5-6f95cdf2caed-HKixBCOQz3hWk0Htik3J/w@public.gmane.org>
2017-03-09 19:44 ` Thierry Reding
[not found] ` <20170223172438.14770-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-23 17:24 ` [PATCH 6/7] net: stmmac: dwc-qos: Split out ->probe() and ->remove() Thierry Reding
[not found] ` <20170223172438.14770-7-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-27 11:17 ` Mikko Perttunen
2017-03-02 16:43 ` Joao Pinto
2017-02-23 17:24 ` [PATCH 7/7] net: stmmac: dwc-qos: Add Tegra186 support Thierry Reding
2017-02-27 11:46 ` Mikko Perttunen
[not found] ` <c72dc23e-cdc3-8b89-3b7d-dce8d81d4ae0-/1wQRMveznE@public.gmane.org>
2017-03-09 20:00 ` Thierry Reding
[not found] ` <20170223172438.14770-8-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-03-02 16:44 ` Joao Pinto
2017-02-23 17:57 ` [PATCH 0/7] net: stmmac: Fixes and " David Miller
[not found] ` <20170223.125705.464117483663954788.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2017-02-27 7:31 ` Thierry Reding
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=ea26c03c-6ce0-ff66-dcb5-6f95cdf2caed@synopsys.com \
--to=joao.pinto@synopsys.com \
--cc=alexandre.torgue@st.com \
--cc=davem@davemloft.net \
--cc=gnurou@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.com \
--cc=robh+dt@kernel.org \
--cc=thierry.reding@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 NNTP newsgroup(s).