Sean Boudreau(deleted)
|
Re: Adding HW checksum in network driver
|
Sean Boudreau(deleted)
07/08/2008 10:20 AM
post10154
|
Re: Adding HW checksum in network driver
On Tue, Jul 08, 2008 at 05:40:32AM -0400, Rajat Jain wrote:
>
> Hi,
>
> I found out answer to my question 2, but my other two queries persist:
>
> Thanks,
>
> Rajat
>
>
> > Hi,
> >
> > I'm trying to add TCP / IP checksum support in my network driver and am a
> > little confused about its interaction with the higher layers. Can some one
> > please clarify my doubts:
> >
> > 1) Firstly, should a driver be ready for a situation where the user first
> > enables the HW checksum support and then disables it? Looking at the help for
> > ifconfig, this surely looks possible:
> >
> > # ifconfig en0 inet ip4csum-rx
> > # ifconfig en0 inet -ip4csum-rx
> >
> > But when I try this experimentally, I find that my driver's SIOCSIFCAP devctl
> > dutifully called with correct ifcr_capenable_rx set for the first command. But
> > my devctl() is never called again for the second command. What am I missing
> > here?
This is a bug in ifconfig. -ip4csum-[rt]x was trying to enable,
not disable. Since it was already enabled the stack didn't bother
calling your devctl. -ip4csum was doing the right thing. New x86
io-net version of ifconfig attached.
> >
> >
> > 3) Just to make sure I understand it correctly, can somebody please confirm my
> > understanding:
> >
> > Taking IPv4 as example, in Rx side checksum offloading, the driver should set
> > the flags in npkt->csum_flags like this:
> >
> > - If no checksum done, do not set any flags
If it's not enabled, the stack ignores your flags on rx so do whatever's
easiest / most efficient.
> > - If checksum verification done, and it was Correct - Just set M_CSUM_IPv4
> > - If checksum verification done, and it was bad -set M_CSUM_IPv4 and
> > M_CSUM_IPv4_BAD
> >
> > Is this right?
Yes.
|
|
|