From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753029AbcLKHO4 (ORCPT ); Sun, 11 Dec 2016 02:14:56 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:49848 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751798AbcLKHOz (ORCPT ); Sun, 11 Dec 2016 02:14:55 -0500 Date: Sun, 11 Dec 2016 08:15:01 +0100 From: Greg KH To: Dan =?iso-8859-1?Q?L=FCdtke?= Cc: Daniel Kahn Gillmor , linux-mips@linux-mips.org, Netdev , LKML , Hannes Frederic Sowa , WireGuard mailing list Subject: Re: Misalignment, MIPS, and ip_hdr(skb)->version Message-ID: <20161211071501.GA32621@kroah.com> References: <095cac5b-b757-6f4a-e699-8eedf9ed7221@stressinduktion.org> <87vauvhwdu.fsf@alice.fifthhorseman.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Dec 10, 2016 at 11:18:14PM +0100, Dan Lüdtke wrote: > > > On 8 Dec 2016, at 05:34, Daniel Kahn Gillmor wrote: > > > > On Wed 2016-12-07 19:30:34 -0500, Hannes Frederic Sowa wrote: > >> Your custom protocol should be designed in a way you get an aligned ip > >> header. Most protocols of the IETF follow this mantra and it is always > >> possible to e.g. pad options so you end up on aligned boundaries for the > >> next header. > > > > fwiw, i'm not convinced that "most protocols of the IETF follow this > > mantra". we've had multiple discussions in different protocol groups > > about shaving or bloating by a few bytes here or there in different > > protocols, and i don't think anyone has brought up memory alignment as > > an argument in any of the discussions i've followed. > > > > If the trade-off is between 1 padding byte and 2 byte alignment versus > 3 padding bytes and 4 byte alignment I would definitely opt for 3 > padding bytes. I know how that waste feels like to a protocol > designer, but I think it is worth it. Maybe the padding/reserved will > be useful some day for an additional feature. Note, if you do do this (hint, I think it is a good idea), require that these reserved/pad fields always set to 0 for now, so that no one puts garbage in them and then if you later want to use them, it will be a mess. thanks, greg k-h