Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1539904

Re: Misalignment, MIPS, and ip_hdr(skb)->version

From Måns Rullgård <mans@mansr.com>
Newsgroups linux.kernel
Subject Re: Misalignment, MIPS, and ip_hdr(skb)->version
Date 2016-12-10 21:40 +0100
Message-ID <sMWB3-6OF-19@gated-at.bofh.it> (permalink)
References (2 earlier) <sLPBD-3ND-5@gated-at.bofh.it> <sLPBD-3ND-3@gated-at.bofh.it> <sMOWR-2d6-7@gated-at.bofh.it> <sMPSW-2Om-9@gated-at.bofh.it> <sMWhI-6Ie-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Felix Fietkau <nbd@nbd.name> writes:

> 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.

Yes, I can see that being an issue.  However, if you're doing zero-copy
routing, the header part of the original buffer should still be there,
unused, so you could presumably copy the header of the outgoing packet
there and then do dma as usual.  Maybe there's something in the network
stack that makes this impossible though.

-- 
Måns Rullgård

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Misalignment, MIPS, and ip_hdr(skb)->version "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-12-07 19:40 +0100
  Re: Misalignment, MIPS, and ip_hdr(skb)->version Dave Taht <dave.taht@gmail.com> - 2016-12-07 19:50 +0100
    Re: Misalignment, MIPS, and ip_hdr(skb)->version "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-12-07 20:00 +0100
      Re: Misalignment, MIPS, and ip_hdr(skb)->version David Miller <davem@davemloft.net> - 2016-12-07 21:00 +0100
        Re: Misalignment, MIPS, and ip_hdr(skb)->version "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-12-08 01:40 +0100
          Re: Misalignment, MIPS, and ip_hdr(skb)->version David Miller <davem@davemloft.net> - 2016-12-08 01:40 +0100
            Re: Misalignment, MIPS, and ip_hdr(skb)->version "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-12-08 23:30 +0100
              Re: Misalignment, MIPS, and ip_hdr(skb)->version David Miller <davem@davemloft.net> - 2016-12-09 00:20 +0100
              Re: Misalignment, MIPS, and ip_hdr(skb)->version Willy Tarreau <w@1wt.eu> - 2016-12-11 09:10 +0100
                Re: Misalignment, MIPS, and ip_hdr(skb)->version Måns Rullgård <mans@mansr.com> - 2016-12-11 11:50 +0100
      Re: Misalignment, MIPS, and ip_hdr(skb)->version Felix Fietkau <nbd@nbd.name> - 2016-12-10 13:30 +0100
        Re: Misalignment, MIPS, and ip_hdr(skb)->version Måns Rullgård <mans@mansr.com> - 2016-12-10 14:30 +0100
          Re: Misalignment, MIPS, and ip_hdr(skb)->version Felix Fietkau <nbd@nbd.name> - 2016-12-10 21:20 +0100
            Re: Misalignment, MIPS, and ip_hdr(skb)->version Felix Fietkau <nbd@nbd.name> - 2016-12-10 21:40 +0100
            Re: Misalignment, MIPS, and ip_hdr(skb)->version Måns Rullgård <mans@mansr.com> - 2016-12-10 21:40 +0100
          RE: Misalignment, MIPS, and ip_hdr(skb)->version David Laight <David.Laight@ACULAB.COM> - 2016-12-12 17:20 +0100
            Re: Misalignment, MIPS, and ip_hdr(skb)->version Måns Rullgård <mans@mansr.com> - 2016-12-12 17:40 +0100
    Re: Misalignment, MIPS, and ip_hdr(skb)->version David Miller <davem@davemloft.net> - 2016-12-07 20:00 +0100
  Re: Misalignment, MIPS, and ip_hdr(skb)->version Hannes Frederic Sowa <hannes@stressinduktion.org> - 2016-12-08 01:40 +0100
    Re: Misalignment, MIPS, and ip_hdr(skb)->version Daniel Kahn Gillmor <dkg@fifthhorseman.net> - 2016-12-08 06:10 +0100
      Re: Misalignment, MIPS, and ip_hdr(skb)->version Jiri Benc <jbenc@redhat.com> - 2016-12-09 12:30 +0100
      Re: Misalignment, MIPS, and ip_hdr(skb)->version Dan Lüdtke <mail@danrl.com> - 2016-12-10 23:30 +0100
        Re: Misalignment, MIPS, and ip_hdr(skb)->version Greg KH <gregkh@linuxfoundation.org> - 2016-12-11 08:20 +0100
          Re: Misalignment, MIPS, and ip_hdr(skb)->version "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-12-11 16:00 +0100
            Re: Misalignment, MIPS, and ip_hdr(skb)->version "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-12-11 16:40 +0100
            Re: Misalignment, MIPS, and ip_hdr(skb)->version Andrew Lunn <andrew@lunn.ch> - 2016-12-11 16:40 +0100
            Re: Misalignment, MIPS, and ip_hdr(skb)->version Willy Tarreau <w@1wt.eu> - 2016-12-11 17:50 +0100

csiph-web