Re: [PATCH net-next] net/vxlan: Avoid unaligned access in vxlan_build_skb()
flat view
From: Alexander Duyck <hidden>
Date: 2016-09-24 00:43:42
On Fri, Sep 23, 2016 at 4:41 PM, Sowmini Varadhan [off-list ref] wrote:
On (09/23/16 10:38), Alexander Duyck wrote:quoted
So basically what I was thinking is we do something like reserving NET_IP_ALIGN and continue writing headers to skb->data, but we force the tracking for the inner headers into frag[0] so that we can keep the inner headers aligned without messing up the alignment for outer headers. In theory the inner offset and all that would still be functional but might need a few tweaks. You could probably even use the skb->encapsulation bit to indicate you are doing this. You could almost think of it as us doing something like the inverse of pskb_pull_tail. The general idea here is we want to actually leave the data in skb->data, but just reference it from frag[0] so that we don't accidentally pull in the 2 byte padding for alignment when transmitting the frame.yes, I think something along this line could do the trick.. I tried hacking it a bit today for vxlan, and it could be extended for all these encaps protocols. Let me fix/test this more next week, maybe we can discuss in Tokyo.
Agreed. Keep in mind we only really need it for the architectures that need to set NET_IP_ALIGN so we may want to end up wrapping the code in ifndef checks for HAVE_EFFICIENT_UNALIGNED_ACCESS. - Alex