From: Felix Fietkau <nbd@nbd.name>
To: "Måns Rullgård" <mans@mansr.com>
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>,
David Miller <davem@davemloft.net>,
Netdev <netdev@vger.kernel.org>,
WireGuard mailing list <wireguard@lists.zx2c4.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-mips@linux-mips.org
Subject: Re: Misalignment, MIPS, and ip_hdr(skb)->version
Date: Sat, 10 Dec 2016 21:09:57 +0100 [thread overview]
Message-ID: <7f8ba817-73ef-e1e1-4fdf-b9178e922008@nbd.name> (raw)
In-Reply-To: <yw1x37hvykzk.fsf@unicorn.mansr.com>
On 2016-12-10 14:25, Måns Rullgård wrote:
> Felix Fietkau <nbd@nbd.name> writes:
>
>> On 2016-12-07 19:54, Jason A. Donenfeld wrote:
>>> On Wed, Dec 7, 2016 at 7:51 PM, David Miller <davem@davemloft.net> wrote:
>>>> It's so much better to analyze properly where the misalignment comes from
>>>> and address it at the source, as we have for various cases that trip up
>>>> Sparc too.
>>>
>>> That's sort of my attitude too, hence starting this thread. Any
>>> pointers you have about this would be most welcome, so as not to
>>> perpetuate what already seems like an issue in other parts of the
>>> stack.
>> Hi Jason,
>>
>> I'm the author of that hackish LEDE/OpenWrt patch that works around the
>> misalignment issues. Here's some context regarding that patch:
>>
>> I intentionally put it in the target specific patches for only one of
>> our MIPS targets. There are a few ar71xx devices where the misalignment
>> cannot be fixed, because the Ethernet MAC has a 4-byte DMA alignment
>> requirement, and does not support inserting 2 bytes of padding to
>> correct the IP header misalignment.
>>
>> With these limitations the choice was between this ugly network stack
>> patch or inserting a very expensive memmove in the data path (which is
>> better than taking the mis-alignment traps, but still hurts routing
>> performance significantly).
>
> I solved this problem in an Ethernet driver by copying the initial part
> of the packet to an aligned skb and appending the remainder using
> skb_add_rx_frag(). The kernel network stack only cares about the
> headers, so the alignment of the packet payload doesn't matter.
I considered that as well, but it's bad for routing performance if the
ethernet MAC does not support scatter/gather for xmit.
Unfortunately that limitation is quite common on embedded hardware.
- Felix
next prev parent reply other threads:[~2016-12-10 20:10 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-07 18:35 Jason A. Donenfeld
2016-12-07 18:47 ` Dave Taht
2016-12-07 18:51 ` David Miller
2016-12-07 18:54 ` Jason A. Donenfeld
2016-12-07 19:52 ` David Miller
2016-12-08 0:29 ` Jason A. Donenfeld
2016-12-08 0:37 ` David Miller
2016-12-08 22:20 ` Jason A. Donenfeld
2016-12-08 23:14 ` David Miller
2016-12-11 8:07 ` Willy Tarreau
2016-12-11 10:47 ` Måns Rullgård
2016-12-10 12:25 ` Felix Fietkau
2016-12-10 13:25 ` Måns Rullgård
2016-12-10 20:09 ` Felix Fietkau [this message]
2016-12-10 20:32 ` Måns Rullgård
2016-12-10 20:36 ` Felix Fietkau
2016-12-12 16:19 ` David Laight
2016-12-12 16:31 ` Måns Rullgård
2016-12-08 0:30 ` Hannes Frederic Sowa
2016-12-08 4:34 ` Daniel Kahn Gillmor
2016-12-09 11:26 ` Jiri Benc
2016-12-10 22:18 ` Dan Lüdtke
2016-12-11 7:15 ` Greg KH
2016-12-11 14:50 ` Jason A. Donenfeld
2016-12-11 15:30 ` Andrew Lunn
2016-12-11 15:37 ` Jason A. Donenfeld
2016-12-11 16:44 ` Willy Tarreau
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=7f8ba817-73ef-e1e1-4fdf-b9178e922008@nbd.name \
--to=nbd@nbd.name \
--cc=Jason@zx2c4.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=mans@mansr.com \
--cc=netdev@vger.kernel.org \
--cc=wireguard@lists.zx2c4.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
all inboxes | Powered by JetHome®