From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: mans@mansr.com Received: from krantz.zx2c4.com (localhost [127.0.0.1]) by krantz.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 2d8a59df for ; Sat, 10 Dec 2016 13:19:34 +0000 (UTC) Received: from unicorn.mansr.com (unicorn.mansr.com [81.2.72.234]) by krantz.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 2207d658 for ; Sat, 10 Dec 2016 13:19:34 +0000 (UTC) From: =?iso-8859-1?Q?M=E5ns_Rullg=E5rd?= To: Felix Fietkau Subject: Re: Misalignment, MIPS, and ip_hdr(skb)->version References: <20161207.135127.789629809982860453.davem@davemloft.net> <040bcdb2-2725-c8de-11d9-a4f77b75d9d8@nbd.name> Date: Sat, 10 Dec 2016 13:25:19 +0000 In-Reply-To: <040bcdb2-2725-c8de-11d9-a4f77b75d9d8@nbd.name> (Felix Fietkau's message of "Sat, 10 Dec 2016 13:25:07 +0100") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Cc: linux-mips@linux-mips.org, Netdev , LKML , David Miller , WireGuard mailing list List-Id: Development discussion of WireGuard List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Felix Fietkau writes: > On 2016-12-07 19:54, Jason A. Donenfeld wrote: >> On Wed, Dec 7, 2016 at 7:51 PM, David Miller wrote: >>> It's so much better to analyze properly where the misalignment comes fr= om >>> and address it at the source, as we have for various cases that trip up >>> Sparc too. >>=20 >> 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. --=20 M=E5ns Rullg=E5rd