Browse Prior Art Database

Transmission Control Protocol/Internet Protocol Checksum Improvement for AIX 3.2 under RISC System/6000

IP.com Disclosure Number: IPCOM000111101D
Original Publication Date: 1994-Feb-01
Included in the Prior Art Database: 2005-Mar-26
Document File: 4 page(s) / 120K

Publishing Venue

IBM

Related People

Pan, ST: AUTHOR [+2]

Abstract

The checksum, used in the Internet Protocol, treats the byte streams (either header or data) as a sequence of 16-bit integers, and defines the checksum to be the ones complement of the sum of all 16-bit intergers. Also, the sum and complement are defined to use ones complement arithmetic. Since the checksum is such an important procedure, AIX 3.2* routine "in_cksum" uses assembly language to code the calculation and wants to improve the performance as much as possible.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 35% of the total text.

Transmission Control Protocol/Internet Protocol Checksum Improvement
for AIX 3.2 under RISC System/6000

      The checksum, used in the Internet Protocol, treats the byte
streams (either header or data) as a sequence of 16-bit integers, and
defines the checksum to be the ones complement of the sum of all
16-bit intergers.  Also, the sum and complement are defined to use
ones complement arithmetic.   Since the checksum is such an important
procedure, AIX 3.2* routine "in_cksum" uses assembly language to code
the calculation and wants to improve the performance as much as
possible.

      For current AIX 3.2 product, "in_cksum" calculation can be
improved further (in terms of cpu cycles) if using instructions which
take advantage of RISC/6000* architecture.  It is estimated that
about 18% performance improvement is achievable with the new approach
proposed in this invention.

CURRENT AIX 3.2 COD :

The current main body of checksum routine "in_cksum" is as follows:

   #  Register Usage:
    #         r5 = checksum
    #         r6 = mbuf dynamic address pointer
    #         r7 = mbuf dynamic counter
    #  Assume word alignment

             . . . .
    sum_fast64:
           cmpi    0,r7,64               # while ( mlen >=64 )
           blt     sum_fast16            # branch if not
    #     go to here if at least 64 more bytes to be checksummed
    #
    sum_64loop:
           lm       r16, 0(r6)           # get next 64 bytes into r16
thru r31
    @@@     ai       r7,r7,-64            # mlen -= 64
   @@@     ai       r6,r6,64             # ptr += 64; CLEARS CO bit
    #     DO 16 bit ones complemnt sum 32 bits at a time
    #     by adding the shorts side by side we apeed up the loop
considerably
    #     the carrys are folded back in by the "ae" instruction and
by
    #     carrys into the high short of the register.  After we do
these
    #     32 bit summing, the sum is folded back to 16 bits

           ae       r5,r5,r16
              ae       r5,r5,r17
              ae       r5,r5,r18
              ae       r5,r5,r19
              ae       r5,r5,r20
              ae       r5,r5,r21
              ae       r5,r5,r22
              ae       r5,r5,r23
              ae       r5,r5,r24
              ae       r5,r5,r25
              ae       r5,r5,r26
              ae       r5,r5,r27
              ae       r5,r5,r28
              ae       r5,r5,r29
              ae       r5,r5,r30
              ae       r5,r5,r31...