On 9/20/2016 10:47 AM, Tom Herbert wrote:
> On Tue, Sep 20, 2016 at 10:35 AM, Joe Touch <to...@isi.edu> wrote:
>> If you've been handed Ethernet to encapsulate, then that is the header
>> whose alignment you should be optimizing.
>> As you point out, you can't align both IP and Ethernet to 4-byte
>> boundaries at the same time.
> You can if you insert a two byte pad before the encapsulated Ethernet
> header like ETHERIP (RFC3378 does).
You CAN do a lot of things, but you shouldn't.
If you're handed ethernet to encapsulate, then THAT is the header whose
access should be aligned.
You have no business ASSUMING that you need to optimize for IP header
access. All you're doing is messing up the ethernet access.
Frankly, anything that already parses Ethernet then IP ought to be able
to efficiently handle the difference in the two alignments - and you
might be messing THAT up.
RFC3378 defines a header used for ETHERIP; that header may or may not be
relevant to other ethernet-in-X encapsulations. The field needed to be
there for versioning and was expanded from 8 to 16 bits, which certainly
helps align the *ethernet* header that comes after it compared to the
earlier use of an 8-bit field. There's no mention of aligning for the
purposes of accessing the IP header, which again, I disagree with.
nvo3 mailing list