Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 May 2001 15:52:12 -0500
From:      Bob Willcox <bob@immure.com>
To:        Jesper Skriver <jesper@skriver.dk>
Cc:        hackers list <freebsd-hackers@freebsd.org>
Subject:   Re: How to disable software TCP checksumming?
Message-ID:  <20010529155212.M19771@luke.immure.com>
In-Reply-To: <20010529221107.C49875@skriver.dk>; from jesper@skriver.dk on Tue, May 29, 2001 at 10:11:07PM %2B0200
References:  <20010529144114.I19771@luke.immure.com> <20010529221107.C49875@skriver.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
Thanks for the info, but I don't think this will do what I want. I
have been looking at the Tigon driver which seems to support hardware
assisted CRC checking. I'm could be way off base here, but this snippit
of code from if_ti.c:

	if (ifp->if_hwassist) {
		m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED | 
		    CSUM_DATA_VALID;
		if ((cur_rx->ti_ip_cksum ^ 0xffff) == 0)
			m->m_pkthdr.csum_flags |= CSUM_IP_VALID;
		m->m_pkthdr.csum_data = cur_rx->ti_tcp_udp_cksum;
	}

looks like it might be related to what I want to do, and may prevent
the upper layers from checking the CRC on input. I also would like to
disable the CRC generation for output but, so far, can't seem to find
how that can be done. Note that I'm not above changing the kernel if
that's the only way, but would like to find some way in my driver to
turn off the checksums if possible.

Thanks,
Bob


On Tue, May 29, 2001 at 10:11:07PM +0200, Jesper Skriver wrote:
> On Tue, May 29, 2001 at 02:41:14PM -0500, Bob Willcox wrote:
> > Hi,
> > 
> > I am working on a device driver for a GSN adapter that has hardware CRC
> > checking and need to know if there is a way to disable the software CRC
> > checking for TCP?  This is on a FreeBSD 4.2-stable system.
> 
> Not without modifying the source, the below should do it from a
> quick look.
> 
> Index: src/sys/netinet/tcp_input.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/netinet/tcp_input.c,v
> retrieving revision 1.130
> diff -u -r1.130 tcp_input.c
> --- src/sys/netinet/tcp_input.c	2001/05/29 19:54:45	1.130
> +++ src/sys/netinet/tcp_input.c	2001/05/29 20:07:22
> @@ -401,6 +401,7 @@
>  	th = (struct tcphdr *)((caddr_t)ip + off0);
>  	tlen = ip->ip_len;
>  
> +#if 0
>  	if (m->m_pkthdr.csum_flags & CSUM_DATA_VALID) {
>  		if (m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR)
>                  	th->th_sum = m->m_pkthdr.csum_data;
> @@ -423,6 +424,7 @@
>  		tcpstat.tcps_rcvbadsum++;
>  		goto drop;
>  	}
> +#endif
>  #ifdef INET6
>  	/* Re-initialization for later version check */
>  	ip->ip_v = IPVERSION;
> 
> /Jesper
> 
> -- 
> Jesper Skriver, jesper(at)skriver(dot)dk  -  CCIE #5456
> Work:    Network manager   @ AS3292 (Tele Danmark DataNetworks)
> Private: FreeBSD committer @ AS2109 (A much smaller network ;-)
> 
> One Unix to rule them all, One Resolver to find them,
> One IP to bring them all and in the zone to bind them.

-- 
Bob Willcox      Egotist, n.:
bob@vieo.com       A person of low taste, more interested in himself than me.
Austin, TX                -- Ambrose Bierce, "The Devil's Dictionary"

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?20010529155212.M19771>