From owner-freebsd-hackers Fri Sep 21 23: 0:17 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from robin.mail.pas.earthlink.net (robin.mail.pas.earthlink.net [207.217.120.65]) by hub.freebsd.org (Postfix) with ESMTP id 9745D37B41D; Fri, 21 Sep 2001 23:00:14 -0700 (PDT) Received: from mindspring.com (dialup-209.245.141.15.Dial1.SanJose1.Level3.net [209.245.141.15]) by robin.mail.pas.earthlink.net (8.11.5/8.9.3) with ESMTP id f8M604H04015; Fri, 21 Sep 2001 23:00:04 -0700 (PDT) Message-ID: <3BAC2910.90CE4265@mindspring.com> Date: Fri, 21 Sep 2001 23:00:48 -0700 From: Terry Lambert Reply-To: tlambert2@mindspring.com X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Andrew Gallatin Cc: Luigi Rizzo , hackers@freebsd.org, wpaul@freebsd.org Subject: Re: any reason to use m_devget in the "dc" driver ? References: <200109210703.JAA57756@info.iet.unipi.it> <15275.15530.678683.65377@grasshopper.cs.duke.edu> <3BAB7CFD.D5776F77@mindspring.com> <15275.33173.594275.19570@grasshopper.cs.duke.edu> 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 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