From owner-freebsd-net@FreeBSD.ORG Sat Mar 19 03:17:41 2005 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DC45A16A4CE for ; Sat, 19 Mar 2005 03:17:41 +0000 (GMT) Received: from relay01.pair.com (relay01.pair.com [209.68.5.15]) by mx1.FreeBSD.org (Postfix) with SMTP id 480D843D31 for ; Sat, 19 Mar 2005 03:17:41 +0000 (GMT) (envelope-from silby@silby.com) Received: (qmail 38876 invoked from network); 19 Mar 2005 03:17:40 -0000 Received: from unknown (HELO localhost) (unknown) by unknown with SMTP; 19 Mar 2005 03:17:40 -0000 X-pair-Authenticated: 209.68.2.70 Date: Fri, 18 Mar 2005 21:17:39 -0600 (CST) From: Mike Silbersack To: John-Mark Gurney In-Reply-To: <20050318092429.GD37984@funkthat.com> Message-ID: <20050318211424.I99115@odysseus.silby.com> References: <20050317221359.GN89312@funkthat.com> <20050318021907.H844@odysseus.silby.com> <20050318024418.D844@odysseus.silby.com> <20050318092429.GD37984@funkthat.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed cc: freebsd-net@FreeBSD.org Subject: Re: changes to make ethernet packets able to be unaligned... X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Mar 2005 03:17:42 -0000 On Fri, 18 Mar 2005, John-Mark Gurney wrote: >> Moving the alignment out of the drivers and into a common place seems like >> a good idea, but I wonder if it should be done in the ethernet code >> instead of in the ip code; won't other protocols have unaligned access >> problems if the change is made exactly as is? > > Why force it on the protocols that might not need it? > > We don't know how much of the ip or foo header to bring in at the > ethernet layer, so the ip or foo layer might have to bring in more data... > > IMO, it's the protocol's job to ensure that it has correct alignment > to access the data... what happens when a protocol comes along that > requires the packet to be 8byte aligned? and the ethernet layer only > aligned it on a 4byte boundary? should we add a third mbuf to it? > > -- > John-Mark Gurney Voice: +1 415 225 5579 Well, right now most (all?) drivers handle the alignment issue, so moving the alignment step into the ethernet code would centralize it in one place, and would not break anything. Removing the alignment requirement without actually having tested all the protocols is going to break something. Having the protocols handle alignment themselves is a good goal, but that's a second step you can take later. I don't see why any extra mbuf allocation should be necessary if the alignment is done inside the ethernet code, actually. Once you strip the ethernet header off, you can just slide the rest of packet backwards by two bytes, in place. Mike "Silby" Silbersack