Re: udp checksums

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 11 Jul 2000, Scott Long wrote:
> Andi Kleen wrote:
> 
> > > > Ooops, i meant dynamically enabling/disabling udp checksuming as we do for
> > > > icmp_echo_ignore... :)
> > > >
> > > > Sharad.
> > >
> > > As far as I can tell from looking at the kernel, there is no facility
> > > for this. I wonder why not.
> > 
> > int on = 1;
> > setsockopt(sk, SOL_SOCK, SO_NO_CHECK, &on, sizeof on);
> 
> I have thought for a long time that IP checksumming should and could be
> implemented on the network interface hardware. TCP/IP is becoming more
> ubiquitous on a minute-by-minute basis and this would seem to make
> sense. Does anyone have any reason why this is a BAD idea? Or should we
> all start writing letters to 3Com and other manufacturers begging for
> this functionality?

3Com is just about the only company you shouldn't be writing to!

The 3c905C implements TCP/UDP/IP checksumming in clean, forward- and
backward-compatible manner.  The 3c59x.c driver uses the checksum indication
in the Rx path with the following trivial code:

   {					/* Use hardware checksum info. */
	int csum_bits = rx_status & 0xee000000;
	if (csum_bits &&
	    (csum_bits == (IPChksumValid | TCPChksumValid) ||
             csum_bits == (IPChksumValid | UDPChksumValid))) {
            skb->ip_summed = CHECKSUM_UNNECESSARY;
            rx_csumhits++;
        }
    }

The 3c59x driver does not do Tx checksums, since the protocol layers always
send a pre-checksummed packet.  There are several reasons why this is so
   It's barely more expensive to do IP-checksum-and-copy than just a copy,
     and most packets need the payload to copied to the skbuff.
   Having the hardware do Tx checksumming requires reading the whole packet,
     thus increasing Tx latency.
   In the case of forwarded packets it might not be correct to recalculate
     the payload checksum.

A few other chips implement partial IP checksums, but the 3Com Tornado is
easily the best implementation.

Donald Becker				becker@scyld.com
Scyld Computing Corporation		http://www.scyld.com
410 Severn Ave. Suite 210		Beowulf Clusters / Linux Installations
Annapolis MD 21403

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.rutgers.edu


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux