Maxim Integrated 78Q8430 Software Driver User Manual
Page 34

78Q8430 Software Driver Development Guidelines
UG_8430_004
STEP 4: Use SNOOP access to retrieve the IP destination address.
The two MSBs of SNOOP address 0x320 plus the two LSBs of SNOOP address 0x324 contain the
destination IP address. If the address is not one assigned to this interface, use the host drop
procedure to drop the frame, otherwise, continue on to STEP 5.
STEP 5: Swap the source and destination addresses in the IP header.
• The two LSBs of SNOOP address 0x320 (already read in STEP 4) plus the two MSBs of
address 0x31C contain the IP source address. The IP destination address was already
retrieved in STEP 4.
• Replace the Src. Addr field with the destination address value and the Dst. Addr field with the
source address value. Leave the two LSBs of 0x31C and the two MSBs of 0x324
unchanged.
• Write the new values back using snoop addresses 0x31C, 0x320 and 0x324.
STEP 6: Swap the source and destination addresses in the MAC header.
• Read the MAC source and destination addresses using SNOOP addresses 0x304, 0x308
and 0x30C. The destination address is in Snoop address 0x304 plus the two LSBs of 0x308.
The source address is in the two MSBs of 0x308 plus address 0x30C.
• Replace the Src. Addr field with the destination address value and the Dst. Addr field with the
source address value.
• Write the new values back using SNOOP addresses 0x304, 0x308 and 0x31C.
STEP 7: Update the TTL field in the IP header.
A fresh TTL value needs to be written to the TTL field of the IP header as this will be a new frame
when it is transmitted.
STEP 8: Set the ICMP Type and Code fields to echo reply.
Set the two MSBs of SNOOP address 0x324 to 0x0000 and leave the two LSBs unchanged. This
converts the ICMP echo request into an ICMP echo reply.
STEP 9: Correct the ICMP checksum.
The two LSBs of SNOOP address 0x328 access the ICMP Header Checksum field. Only a single bit
change was made to the ICMP header, so the checksum can be easily corrected without
recalculation. The corrected checksum is the existing checksum +0x0800.
It is important to note that the first checksum byte to arrive is the most significant byte. This
means it is in the lower byte position in the snoop register.
STEP 10: Set the transmit options for the ICMP echo reply.
The value normally written to PCWR is written to SNOOP address 0x300 instead. Set the PCWR Fix
CRC bit because the existing CRC is incorrect after the changes made. The PCWR IP Header Offset
field must also be set as changes to the IP header have invalidated the IP header checksum. The
driver may wish to use a unique ID for this frame so that it does not try to free any buffers when it
retrieves the transmit status for this frame.
STEP 11: Transfer the frame from the receive QUE to transmit QUE 3.
Set the RTTR Transfer bit to enable the transfer. The RTTR Transfer bit is self-clearing. When the
bit is clear, it indicates that the First BLOCK from QUE 0 is now the last BLOCK in QUE 3. For
frames that are 252 bytes or smaller in length, only one transfer is required. If the frame size is
greater, more than one transfer is required. The transfer of a single BLOCK should complete quickly.
The driver must ensure that no data is read from the QUE 0 RDR until the transfer operation is
complete.
This procedure assumes that the driver has determined in advance that the next frame in the receive
QUE is an ICMP frame, or more specifically, an ICMP echo request. This can be done via classification
(see Enable ICMP Classification above) or through inspection. The driver can read a portion of the frame
34
Rev.
1.0