From: Thierry Reding <treding@nvidia•com>
To: Joao Pinto <Joao.Pinto@synopsys•com>
Cc: <davem@davemloft•net>, <clabbe.montjoie@gmail•com>,
<niklas.cassel@axis•com>, <netdev@vger•kernel.org>
Subject: Re: [PATCH 2/4] net: stmmac: adding multiple buffers for rx
Date: Tue, 4 Apr 2017 21:14:53 +0200 [thread overview]
Message-ID: <20170404191453.GB24271@ulmo.ba.sec> (raw)
In-Reply-To: <4f35e9a73521ba4ab4868c75950166fb757b5f8a.1491328304.git.jpinto@synopsys.com>
[-- Attachment #1: Type: text/plain, Size: 1552 bytes --]
On Tue, Apr 04, 2017 at 06:54:25PM +0100, Joao Pinto wrote:
[...]
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
[...]
> static void stmmac_display_rx_rings(struct stmmac_priv *priv)
> {
> + u32 rx_cnt = priv->plat->rx_queues_to_use;
> void *head_rx;
> + u32 queue;
>
> - if (priv->extend_desc)
> - head_rx = (void *)priv->dma_erx;
> - else
> - head_rx = (void *)priv->dma_rx;
> + /* Display RX rings */
> + for (queue = 0; queue < rx_cnt; queue++) {
> + struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
>
> - /* Display RX ring */
> - priv->hw->desc->display_ring(head_rx, DMA_RX_SIZE, true);
> + pr_info("\tRX Queue %d rings\n", queue);
Nit: %u is the right specifier for unsigned integers.
> @@ -1107,46 +1135,65 @@ static int init_dma_rx_desc_rings(struct net_device *dev, gfp_t flags)
[...]
> err_init_rx_buffers:
> - while (--i >= 0)
> - stmmac_free_rx_buffers(priv, i);
> + while (queue-- >= 0) {
Why are you switching to postfix decrement here? Not only is it
inconsistent with the prefix decrement below, I think this also gives
you a wrong result. Consider what happens if queue == 0. The condition
evaluates to true, but within the loop the queue variable will wrap to
~0 and probably crash stmmac_free_rx_buffers().
Other than that, this looks fine, so with the above fixed:
Reviewed-by: Thierry Reding <treding@nvidia•com>
Also works on Tegra186, so:
Tested-by: Thierry Reding <treding@nvidia•com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-04-04 19:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-04 17:54 [PATCH 0/4 net-next] net: stmmac: adding multiple buffers Joao Pinto
2017-04-04 17:54 ` [PATCH 1/4] net: stmmac: break some functions into RX and TX scopes Joao Pinto
2017-04-04 17:54 ` [PATCH 2/4] net: stmmac: adding multiple buffers for rx Joao Pinto
2017-04-04 19:14 ` Thierry Reding [this message]
2017-04-04 19:15 ` Thierry Reding
2017-04-04 19:23 ` Thierry Reding
2017-04-04 17:54 ` [PATCH 3/4] net: stmmac: adding multiple buffers for TX Joao Pinto
2017-04-04 19:19 ` Thierry Reding
2017-04-04 17:54 ` [PATCH 4/4] net: stmmac: adding multiple napi mechanism Joao Pinto
2017-04-04 19:28 ` Thierry Reding
2017-04-04 18:57 ` [PATCH 1/4] net: stmmac: break some functions into RX and TX scopes Thierry Reding
2017-04-05 9:04 ` Joao Pinto
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=20170404191453.GB24271@ulmo.ba.sec \
--to=treding@nvidia$(echo .)com \
--cc=Joao.Pinto@synopsys$(echo .)com \
--cc=clabbe.montjoie@gmail$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
--cc=niklas.cassel@axis$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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