Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Sep 2001 23:00:48 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Andrew Gallatin <gallatin@cs.duke.edu>
Cc:        Luigi Rizzo <luigi@info.iet.unipi.it>, hackers@freebsd.org, wpaul@freebsd.org
Subject:   Re: any reason to use m_devget in the "dc" driver ?
Message-ID:  <3BAC2910.90CE4265@mindspring.com>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3BAC2910.90CE4265>