diff options
author | Lisa Hsu <hsul@eecs.umich.edu> | 2004-06-30 00:51:11 -0400 |
---|---|---|
committer | Lisa Hsu <hsul@eecs.umich.edu> | 2004-06-30 00:51:11 -0400 |
commit | 31c52ac0a7862253f773eb4f4a0ad38fcf43748f (patch) | |
tree | 7878015d64a1a2d20a84a1da26842ff1a928d6b7 | |
parent | a2afbeecce6d417bd89dd15e9268f9c41fa604a4 (diff) | |
parent | 167c57f265592e8baa3fc4809e256646efdf32df (diff) | |
download | gem5-31c52ac0a7862253f773eb4f4a0ad38fcf43748f.tar.xz |
Merge zizzer.eecs.umich.edu:/bk/m5
into shizzle.(none):/home/hsul/work/linux-clean
--HG--
extra : convert_revision : a072c1560e1f8b5cac378ed5f047a8a9c86b97b9
-rw-r--r-- | dev/ns_gige.cc | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/dev/ns_gige.cc b/dev/ns_gige.cc index f3f2f10b3..64f255e6b 100644 --- a/dev/ns_gige.cc +++ b/dev/ns_gige.cc @@ -1780,7 +1780,8 @@ NSGigE::txKick() udpChecksum(txPacket, true); } else if (txDescCache.extsts & EXTSTS_TCPPKT) { tcpChecksum(txPacket, true); - } else if (txDescCache.extsts & EXTSTS_IPPKT) { + } + if (txDescCache.extsts & EXTSTS_IPPKT) { ipChecksum(txPacket, true); } } @@ -2043,15 +2044,25 @@ NSGigE::tcpChecksum(PacketPtr packet, bool gen) ip_header *ip = packet->getIpHdr(); tcp_header *hdr = packet->getTcpHdr(ip); + uint16_t cksum; pseudo_header *pseudo = new pseudo_header; + if (!gen) { + pseudo->src_ip_addr = ip->src_ip_addr; + pseudo->dest_ip_addr = ip->dest_ip_addr; + pseudo->protocol = reverseEnd16(ip->protocol); + pseudo->len = reverseEnd16(reverseEnd16(ip->dgram_len) - (ip->vers_len & 0xf)*4); - pseudo->src_ip_addr = ip->src_ip_addr; - pseudo->dest_ip_addr = ip->dest_ip_addr; - pseudo->protocol = reverseEnd16(ip->protocol); - pseudo->len = reverseEnd16(reverseEnd16(ip->dgram_len) - (ip->vers_len & 0xf)*4); - - uint16_t cksum = checksumCalc((uint16_t *) pseudo, (uint16_t *) hdr, + cksum = checksumCalc((uint16_t *) pseudo, (uint16_t *) hdr, (uint32_t) reverseEnd16(pseudo->len)); + } else { + pseudo->src_ip_addr = 0; + pseudo->dest_ip_addr = 0; + pseudo->protocol = hdr->chksum; + pseudo->len = 0; + hdr->chksum = 0; + cksum = checksumCalc((uint16_t *) pseudo, (uint16_t *) hdr, + (uint32_t) (reverseEnd16(ip->dgram_len) - (ip->vers_len & 0xf)*4)); + } delete pseudo; if (gen) @@ -2071,7 +2082,7 @@ NSGigE::ipChecksum(PacketPtr packet, bool gen) uint16_t cksum = checksumCalc(NULL, (uint16_t *) hdr, (hdr->vers_len & 0xf)*4); if (gen) { - DPRINTF(Ethernet, "generated checksum: %#x\n", cksum); + DPRINTF(EthernetCksum, "generated checksum: %#x\n", cksum); hdr->hdr_chksum = cksum; } else |