From: Willy Tarreau <w@1wt.eu>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: linux-mips@linux-mips.org, Netdev <netdev@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
David Miller <davem@davemloft.net>,
WireGuard mailing list <wireguard@lists.zx2c4.com>
Subject: Re: Misalignment, MIPS, and ip_hdr(skb)->version
Date: Sun, 11 Dec 2016 09:07:18 +0100 [thread overview]
Message-ID: <20161211080718.GA7253@1wt.eu> (raw)
In-Reply-To: <CAHmME9qGoPGEFyqe0jBaZD5R51wHTEgAYb9edj+nu9nNPWSYCA@mail.gmail.com>
Hi Jason,
On Thu, Dec 08, 2016 at 11:20:04PM +0100, Jason A. Donenfeld wrote:
> Hi David,
>
> On Thu, Dec 8, 2016 at 1:37 AM, David Miller <davem@davemloft.net> wrote:
> > You really have to land the IP header on a proper 4 byte boundary.
> >
> > I would suggest pushing 3 dummy garbage bytes of padding at the front
> > or the end of your header.
>
> Are you sure 3 bytes to get 4 byte alignment is really the best?
It's always the best. However there's another option which should be
considered : maybe it's difficult but not impossible to move some bits
from the current protocol to remove one byte. That's not always easy,
and sometimes you cannot do it just for one bit. However after you run
through this exercise, if you notice there's really no way to shave
this extra byte, you'll realize there's no room left for future
extensions and you'll more easily accept to add 3 empty bytes for
this, typically protocol version, tags, qos or flagss that you'll be
happy to rely on for future versions of your protocol.
Also while it can feel like you're making your protocol less efficient,
keep in mind that these 3 bytes only matter for small packets, and
Ethernet already pads small frames to 64 bytes, so in practice any
IP packet smaller than 46 bytes will not bring any extra savings.
Best regards,
Willy
next prev parent reply other threads:[~2016-12-11 8:07 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-07 18:35 Misalignment, MIPS, and ip_hdr(skb)->version Jason A. Donenfeld
2016-12-07 18:47 ` Dave Taht
2016-12-07 18:51 ` David Miller
2016-12-07 18:54 ` Jason A. Donenfeld
2016-12-07 19:52 ` David Miller
2016-12-08 0:29 ` Jason A. Donenfeld
2016-12-08 0:37 ` David Miller
2016-12-08 22:20 ` Jason A. Donenfeld
2016-12-08 23:14 ` David Miller
2016-12-11 8:07 ` Willy Tarreau [this message]
2016-12-11 10:47 ` Måns Rullgård
2016-12-10 12:25 ` Felix Fietkau
2016-12-10 13:25 ` Måns Rullgård
2016-12-10 20:09 ` Felix Fietkau
2016-12-10 20:32 ` Måns Rullgård
2016-12-10 20:36 ` Felix Fietkau
2016-12-12 16:19 ` David Laight
2016-12-12 16:31 ` Måns Rullgård
2016-12-08 0:30 ` Hannes Frederic Sowa
2016-12-08 4:34 ` Daniel Kahn Gillmor
2016-12-09 11:26 ` Jiri Benc
2016-12-10 22:18 ` Dan Lüdtke
2016-12-11 7:15 ` Greg KH
2016-12-11 14:50 ` Jason A. Donenfeld
2016-12-11 15:30 ` Andrew Lunn
2016-12-11 15:37 ` Jason A. Donenfeld
2016-12-11 16:44 ` Willy Tarreau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161211080718.GA7253@1wt.eu \
--to=w@1wt.eu \
--cc=Jason@zx2c4.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=netdev@vger.kernel.org \
--cc=wireguard@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).