From owner-freebsd-hackers Fri Sep 21 23: 8: 0 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from info.iet.unipi.it (info.iet.unipi.it [131.114.9.184]) by hub.freebsd.org (Postfix) with ESMTP id D84A037B5AF; Fri, 21 Sep 2001 23:07:50 -0700 (PDT) Received: (from luigi@localhost) by info.iet.unipi.it (8.9.3/8.9.3) id HAA64949; Sat, 22 Sep 2001 07:58:25 +0200 (CEST) (envelope-from luigi) From: Luigi Rizzo Message-Id: <200109220558.HAA64949@info.iet.unipi.it> Subject: Re: any reason to use m_devget in the "dc" driver ? In-Reply-To: <3BAC2910.90CE4265@mindspring.com> from Terry Lambert at "Sep 21, 2001 11:00:48 pm" To: tlambert2@mindspring.com Date: Sat, 22 Sep 2001 07:58:25 +0200 (CEST) Cc: Andrew Gallatin , hackers@freebsd.org, wpaul@freebsd.org X-Mailer: ELM [version 2.4ME+ PL61 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I probably missed some emails ? In any case i was only concerned about the additional copy done by m_devget when the controller can already DMA into an mbuf, and there are no alignment constraints. cheers luigi > Andrew Gallatin wrote: > > > I disagree with this code; the elemenets in the header > > > are referenced multiple times. If you are doing the > > > checksum check, you might as well be relocating the data, > > > as well. The change I would make would be to integrate > > > the checksum calculation with the m_devget(), to ensure > > > a single pass, in the case that m_devget() must be used > > > to get aligned packet payload, and the checksum has not > > > been offloaded to hardware. > > > > Interesting idea... However, what if you're a bridge or a router? > > You've just done a whole lot of work for nothing. I imagine its just > > this case that Luigi cares about. > > > > If you want to integrate a checksum & a copy, it should really be done > > at the copyout() stage. > > You're missing the point. You do the m_devget() only when > you decide to do a checksum, which means you've decided to handle > the packet yourself. The alignment is done via a copy of the > header field; specifically, a byte copy of the protocol type, > when you decide how to handle it. > > In the case of the bridge, it's very easy: you don't care about > the contents of the packet, unless it's destined for you. For > a router, you are operating above layer 2, so you _do_ care, > and must hterefore do the checksum to be correct (since you > should not reference the field contents without knowledge that > the checksum is correct). The Cisco approach of ignoring the > checksums is all well and good, if the work is being done in > hardware, but for most software, it very definitely cares (it's > more overhead to relay bad packets onto your network, even if > you assume it's OK for a router to do that). > > -- Terry > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message