From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753303AbcLLQT2 convert rfc822-to-8bit (ORCPT ); Mon, 12 Dec 2016 11:19:28 -0500 Received: from smtp-out6.electric.net ([192.162.217.189]:57272 "EHLO smtp-out6.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751180AbcLLQT0 (ORCPT ); Mon, 12 Dec 2016 11:19:26 -0500 From: David Laight To: =?Windows-1252?B?J03lbnMgUnVsbGflcmQn?= , Felix Fietkau CC: "Jason A. Donenfeld" , David Miller , Netdev , "WireGuard mailing list" , LKML , "linux-mips@linux-mips.org" Subject: RE: Misalignment, MIPS, and ip_hdr(skb)->version Thread-Topic: Misalignment, MIPS, and ip_hdr(skb)->version Thread-Index: AQHSUuCZSiY7WnBz2Eyc66nqgU4ToqEBLAZXgANTVMA= Date: Mon, 12 Dec 2016 16:19:17 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6DB023BF78@AcuExch.aculab.com> References: <20161207.135127.789629809982860453.davem@davemloft.net> <040bcdb2-2725-c8de-11d9-a4f77b75d9d8@nbd.name> In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.99.200] Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Outbound-IP: 213.249.233.130 X-Env-From: David.Laight@ACULAB.COM X-Proto: esmtps X-Revdns: X-HELO: AcuExch.aculab.com X-TLS: TLSv1:AES128-SHA:128 X-Authenticated_ID: X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Måns Rullgård > Sent: 10 December 2016 13:25 ... > 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. That rather depends on where the packet payload ends up. It is likely that it will be copied to userspace (or maybe into some aligned kernel buffer). In which case you get an expensive misaligned copy. Encapsulation protocols not using headers that are multiples of 4 bytes is as stupid as ethernet hardware that can't place the mac address on a 4n+2 boundary. The latter is particularly stupid when it happens on embedded silicon with a processor that can only do aligned memory accesses. What do the hardware engineers think the ethernet interface will be used for! David