All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Felix Fietkau <nbd@openwrt.org>, netdev@vger.kernel.org
Cc: zajec5@gmail.com, hauke@hauke-m.de
Subject: Re: [PATCH 4/4] bgmac: fix DMA rx corruption
Date: Sun, 12 Apr 2015 14:11:44 +0300	[thread overview]
Message-ID: <552A52F0.4080803@cogentembedded.com> (raw)
In-Reply-To: <1428833292-15356-4-git-send-email-nbd@openwrt.org>

Hello.

On 4/12/2015 1:08 PM, Felix Fietkau wrote:

> The driver needs to inform the hardware about the first invalid (not yet
> filled) rx slot, by writing its DMA descriptor pointer offset to the
> BGMAC_DMA_RX_INDEX register.

> This register was set to a value exceeding the rx ring size, effectively
> allowing the hardware constant access to the full ring, regardless of
> which slots are initialized.

> Fix this by updating the register in bgmac_dma_rx_setup_desc.

> Signed-off-by: Felix Fietkau <nbd@openwrt.org>
> ---
>   drivers/net/ethernet/broadcom/bgmac.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)

> diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
> index e332de8..856ceee 100644
> --- a/drivers/net/ethernet/broadcom/bgmac.c
> +++ b/drivers/net/ethernet/broadcom/bgmac.c
> @@ -380,6 +380,12 @@ static void bgmac_dma_rx_setup_desc(struct bgmac *bgmac,
>   	dma_desc->addr_high = cpu_to_le32(upper_32_bits(ring->slots[desc_idx].dma_addr));
>   	dma_desc->ctl0 = cpu_to_le32(ctl0);
>   	dma_desc->ctl1 = cpu_to_le32(ctl1);
> +
> +	desc_idx = (desc_idx + 1) % BGMAC_RX_RING_SLOTS;
> +
> +	bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_INDEX,
> +			ring->index_base +
> +			desc_idx * sizeof(struct bgmac_dma_desc));

    The continuation lines should start on the next column after ( on the 
first line.

[...]

WBR, Sergei

      parent reply	other threads:[~2015-04-12 11:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-12 10:08 [PATCH 1/4] bgmac: simplify tx ring index handling Felix Fietkau
2015-04-12 10:08 ` [PATCH 2/4] bgmac: leave interrupts disabled as long as there is work to do Felix Fietkau
2015-04-12 10:08 ` [PATCH 3/4] bgmac: set received skb headroom to NET_SKB_PAD Felix Fietkau
2015-04-12 10:08 ` [PATCH 4/4] bgmac: fix DMA rx corruption Felix Fietkau
2015-04-12 10:31   ` Eric Dumazet
2015-04-12 10:43     ` Felix Fietkau
2015-04-12 17:24       ` Eric Dumazet
2015-04-12 17:28         ` Felix Fietkau
2015-04-12 10:31   ` Jakub Kiciński
2015-04-12 11:11   ` Sergei Shtylyov [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=552A52F0.4080803@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=hauke@hauke-m.de \
    --cc=nbd@openwrt.org \
    --cc=netdev@vger.kernel.org \
    --cc=zajec5@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.