Subject: Re: Small Ethernet packet padding
To: Manuel Bouyer <>
From: Greg Troxel <>
List: tech-net
Date: 10/31/2004 07:51:37
  Now, I don't know if saving these extra CPU cycles is really important or
  not. When I did the work on this padding problem, it was decided that the
  best place to do this was in the drivers themselves, because it was the most

So perhaps if_ethersubr.c could have a 

 * Given an mbuf and a length, return an mbuf that has all the
 * original data, and that is at least length.  Any added data will be
 * zero.  Returns NULL and frees the mbuf if allocation was needed and
 * fails.
struct mbuf *
mbuf_ensure_length(struct mbuf *m, int length)

to be used by drivers that don't want to do something more
complicated; this would get the benefit of abstraction in that case
while not precluding efficiency for the cases you mention, and with
any luck decrease the odds that we'd leak kernel data or do dma from
non-existent memory above the top mbuf  - I actually had a FreeBSD
machine crash once in if_wl.c due to this.

        Greg Troxel <>