Thread (23 messages) 23 messages, 6 authors, 2016-09-28

Re: [PATCH net-next] net/vxlan: Avoid unaligned access in vxlan_build_skb()

flat view

From: Alexander Duyck <hidden>
Date: 2016-09-23 14:17:05

On Fri, Sep 23, 2016 at 5:06 AM, David Miller [off-list ref] wrote:
From: Sowmini Varadhan <redacted>
Date: Thu, 22 Sep 2016 17:30:10 -0400
quoted
On (09/22/16 01:52), David Miller wrote:
quoted
Alternatively we can do Alexander Duyck's trick, by pushing
the headers into the frag list, forcing a pull and realignment
by the next protocol layer.
What is the "Alexander Duyck trick" (hints about module or commit id,
where this can be found, please)?

Is this basically about, e.g., putting the vxlanhdr in its own
skb_frag_t, or something else?
Yes, and this way skb_header_pointer() is forced to do a memcpy.
It is something I had proposed on the Rx side of things back in
February when the issue came up in relation to skb parsing.  On
architectures that require NET_IP_ALIGN to be set I had proposed that
we should only pull the outer headers from the page frag, and then
when the time is right we drop the outer headers and pull the inner
headers from the page frag.  That way we can keep all the headers
aligned.

For Tx it all becomes a bit trickier since it would likely require us
to shift the frags up by 1 when we go from outer headers to inner
headers.  One thought I had on that is that we could possibly avoid
having to do any allocation and could just take a reference on the
head_frag if that is what we are using.  Then we just add a 2 byte pad
and resume writing headers in place and the pointer offsets for the
inner headers would remain valid, though they would be past the point
of skb->tail.

- Alex
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help