Subject: Re: ISA used in TCP/IP/UDP

From: Patrick Klos <[email-masked]>
Date: Tue, 20 Jun 2000 08:41:36 -0400

>> What are the typical instruction set extension on
>> a CPU so that implementing TCP/IP/UDP network stacks
>> would be more efficient?
>
>add-with-carry is a nice instruction; it makes it somewhat faster to do IP 
>checksums...

I got the impression the original poster was asking for real extensions - 
not items that are already available on most processors.  Maybe I'm wrong.

If I were building a processor with TCP/UDP/IP specific extensions, I'd
probably add some of the following:

1)  Checksum register/instructions:

	Compute standard checksum on a range of bytes (useful to
	check IP header checksum).

	Copy and compute standard checksum (useful when collecting
	pieces of a packet before sending it).

	Initialize checksum (used to extract pseudo-header and compute
	checksum on it).

    Checksum instructions would be supported by several registers:

	Accumulator (the running checksum total)

	Checksum offset (where in the "packet" to ignore the data since
	the real checksum is stored there).

2)  Keep in mind similar extensions to support the possibility of
    IPv6.

3)  CRC instructions:

	Set 16 or 32 bit polynomial.

4)  Hash instructions?  (useful for routers)

5)  Built-in "mbuf"s?  I.e. the processor understands a specific scheme
    of chaining buffers to create packets, thus can more efficiently
    poke around in a packet for you, rather then your code having to 
    always do it by hand.

Just a few ideas...
============================================================================
    Patrick Klos                           Email: [email-masked]
    Klos Technologies, Inc.                Web:   http://www.klos.com/
============================================================================

---

From: Joe Touch <[email-masked]>
Date: Tue, 20 Jun 2000 09:15:30 -0700

>         pieces of a packet before sending it).

Better if done by a DMA.

>         the real checksum is stored there).

A simpler solution would be "ones complement add" - a little more than
add with carry (i.e., there's no carry, it just gets folded in).
However, all that would save is one instruction each time the checksum
is read, since intermediate carries can pipelined in.
 
> 2)  Keep in mind similar extensions to support the possibility of

Or lack of similar extensions. I.e., in IPv6, checksum of a range of
bytes becomes much less useful for header manipulations; checksum of
large quantities of data should be combined with DMA where possible.

>     poke around in a packet for you, rather then your code having to

Assumes mbufs. There are versions of TCP that don't rely on that
structure, and the structure and especially the order of its components
can be OS and even compiler-specific. 

Joe

---

From: Craig Partridge <[email-masked]>
Date: Tue, 20 Jun 2000 18:34:15 -0400

>>         pieces of a packet before sending it).

Joe -- several months ago I would have said this too -- but a study
of TCP checksum errors I did with Jonathan Stone suggests that
DMA logic on some systems is trashing the data periodically -- and that
the TCP checksum is catching the errors -- so do the checksum before you
DMA!

Craig