Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Mar 2000 21:39:25 -0500
From:      "C. Stephen Gunn" <csg@waterspout.com>
To:        freebsd-net@freebsd.org
Subject:   Trimming ether_header before ether_input()
Message-ID:  <200003220239.VAA01543@dustdevil.waterspout.com>

next in thread | raw e-mail | index | archive | help
In my wanderings through the FreeBSD networking code, I've noticed
something peculiar in all ethernet drivers.  Is there a historical
reason that the ethernet header is trimmed from the mbuf chain
before its passed to ether_input()?

I can only assume that (at one time) there were ethernet devices
(back in the IMP days) that handed you the link header and the
payload in separate buffers.

Today, _EVERY_ ethernet driver in FreeBSD does something like this
in its receive routine:

  m_adj(m, sizeof(struct ether_header));
  ether_input(ifp, eh, m);

Why not simply pass the entire frame to ether_input(), and let it
remove it when appropriate?

This would make the following cleanups/improvements:

 - A clean line between the device, which puts frames onto and receives
   frames from the physical (or logical) wire, and generalized ethernet
   support code, that parses/removes the local net header.

 - Lots of duplicated effort in drivers could be centralized into 
   the common ethernet code.  Mostly BPF taps, but not limited to
   those.

 - Some layer-2 protocols require the frame header.  Right now ether_input
   copies this data back into the mbuf before queing a NETISR for
   the protocol stack.

Comments?  Suggestions?  Blatant mis-observations?

 - Steve

--
C. Stephen Gunn                          URL: http://www.waterspout.com/
WaterSpout Communications, Inc.        Email: csg@waterspout.com
427 North 6th Street                   Phone: +1 765.742.6628
Lafayette, IN  47901                     Fax: +1 765.742.0646


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200003220239.VAA01543>