User Manual
10/21/02
Examples
The following examples illustrate uses of the checksum and CRC engine. These are intended to illustrate use
of the data mover generators, in some cases it will be more efficient to do more processing of small buffers on
the CPU rather than expending more effort on managing descriptors.
Enable CS
Reset CS
Prefetch
Enable CS
Prefetch
Enable CS
Append CS
Prefetch
Example 1 illustrated in
The example has a packet made up of a header buffer (with Ethernet, IP and TCP headers) and two data
buffers. Prior to passing the descriptors to the data mover software should compute the checksum of the
pseudo-header (the source and destination IP addresses, the protocol type and the TCP Length) and write this
(rather than zero) to the checksum field in the TCP header. The descriptors are set up so the first resets the
sum and adds the bytes in the TCP header. The pseudo-header sum is included (this takes advantage of the
fact that the order of the adds does not matter). The second descriptor adds the first data block, and the third
descriptor the second data block. Because the Prefetch flag is set the buffers are only read and no copy is
made. The third descriptor has the Append CS flag set so the destination address is used to write out the final
checksum. The destination points to the checksum field in the TCP header, so the final checksum is
automatically written into the packet. If the packet is going to be sent over the Ethernet interface after only a
short delay then consideration should be given to setting the l2ca_src flag in all the descriptors so the packets
are only read from memory once and staged in the L2 cache for transmission. In this example l2ca_src should
certainly be set in the first descriptor since the buffer will be at most two cache blocks and the data mover will
soon be doing a read-modify-write to update the two checksum bytes.
Document
1250_1125-UM100CB-R
Src
Len=TCPHdr
Dst
Src
Len=Len(1)
Dst
Src
Len=Len(2)
Dst
Figure 33: Example 1 - TCP checksum a packet
Figure 33
shows preparing a packet for transmission by computing its TCP checksum.
B r oadco m C orp or ati on
BCM1250/BCM1125/BCM1125H
Eth
TCP
IP
Hdr
Hdr
Hdr
Data (1)
Data (2)
Section 7: DMA Page
181
Need help?
Do you have a question about the BCM1250 and is the answer not in the manual?