From owner-freebsd-net Tue Mar 21 18:38:17 2000 Delivered-To: freebsd-net@freebsd.org Received: from dustdevil.waterspout.com (dustdevil.waterspout.com [208.13.60.151]) by hub.freebsd.org (Postfix) with ESMTP id 1ECEB37BF4C for ; Tue, 21 Mar 2000 18:38:13 -0800 (PST) (envelope-from csg@waterspout.com) Received: from waterspout.com (csg@localhost [127.0.0.1]) by dustdevil.waterspout.com (8.9.3/8.9.3) with ESMTP id VAA01543 for ; Tue, 21 Mar 2000 21:39:25 -0500 (EST) (envelope-from csg@waterspout.com) Message-Id: <200003220239.VAA01543@dustdevil.waterspout.com> To: freebsd-net@freebsd.org From: "C. Stephen Gunn" Subject: Trimming ether_header before ether_input() MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1539.953692765.1@waterspout.com> Date: Tue, 21 Mar 2000 21:39:25 -0500 Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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