From: Felix Fietkau <nbd@openwrt.org>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org, zajec5@gmail.com, hauke@hauke-m.de
Subject: Re: [PATCH v2 4/4] bgmac: fix DMA rx corruption
Date: Sun, 12 Apr 2015 23:38:40 +0200 [thread overview]
Message-ID: <552AE5E0.6040702@openwrt.org> (raw)
In-Reply-To: <1428865466.25985.366.camel@edumazet-glaptop2.roam.corp.google.com>
On 2015-04-12 21:04, Eric Dumazet wrote:
> On Sun, 2015-04-12 at 20:46 +0200, Felix Fietkau wrote:
>> On 2015-04-12 20:09, Eric Dumazet wrote:
>
>> >
>> > Given the fact that previous driver kind of worked, have you tried not
>> > doing the modulo at all here ?
>> The previous driver was causing reproducible DMA corruption issues under
>> load. My patch fixes this, and I've verified this with hours of stress
>> testing (previously I could reproduce the issue in minutes).
>>
>> > ring->end = desc_idx + 1;
>> >
>> > It looks like the hardware accepted setting BGMAC_DMA_RX_INDEX to
>> > ring->index_base + ring->num_slots * sizeof(struct bgmac_dma_desc)
>> The hardware accepts it, but with that value, it considers all rx slot
>> entries filled, there's no CPU ownership bit in the descriptor.
>> According to documentation, that register indicates the first *invalid*
>> rx descriptor (i.e. one where the CPU hasn't posted a valid buffer yet).
>>
>> > So apparently the presence of BGMAC_DESC_CTL0_EOT in last rx desc was
>> > enough to avoid any problem with this.
>> EOT serves a completely different purpose. It simply indicates the end
>> of the ring, telling the hardware to go back to the beginning for the
>> next descriptor.
>
> Right, but after your patch, we program the hardware with end == start
> == 0
>
> So I do not really understand how the hardware can still deliver first
> frame.
>
> If it was really taking care of 'end' value, then it should not even
> deliver one frame.
>
> The dma corruption happened because hardware was simply reusing frames,
> that driver already took to upper stack, since as you said, there is no
> ownership bit.
>
> You might try your patch with BGMAC_RX_RING_SLOTS = 3 and check if it is
> still working properly.
>
> I find BGMAC_RX_RING_SLOTS==511 very suspect, and a comment of why this
> magic value is not 512 would be nice.
I completely reworked the code and simplified handling
BGMAC_DMA_RX_INDEX by setting it to the last filled rx slot (keeping the
entire ring filled). I now get better performance and it stays reliable
even with smaller rings. Sending v3 now.
- Felix
prev parent reply other threads:[~2015-04-12 21:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-12 14:22 [PATCH v2 1/4] bgmac: simplify tx ring index handling Felix Fietkau
2015-04-12 14:22 ` [PATCH v2 2/4] bgmac: leave interrupts disabled as long as there is work to do Felix Fietkau
2015-04-12 14:22 ` [PATCH v2 3/4] bgmac: set received skb headroom to NET_SKB_PAD Felix Fietkau
2015-04-12 14:22 ` [PATCH v2 4/4] bgmac: fix DMA rx corruption Felix Fietkau
2015-04-12 18:09 ` Eric Dumazet
2015-04-12 18:46 ` Felix Fietkau
2015-04-12 19:04 ` Eric Dumazet
2015-04-12 19:25 ` Felix Fietkau
2015-04-12 20:29 ` Rafał Miłecki
2015-04-12 21:38 ` Felix Fietkau [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=552AE5E0.6040702@openwrt.org \
--to=nbd@openwrt.org \
--cc=eric.dumazet@gmail.com \
--cc=hauke@hauke-m.de \
--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.