From: Lisa Hsu Date: Wed, 30 Jun 2004 04:50:56 +0000 (-0400) Subject: fix transmit side checksum offloading to not generate a pseudo header. X-Git-Tag: m5_1.0_tutorial~282^2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=167c57f265592e8baa3fc4809e256646efdf32df;p=gem5.git fix transmit side checksum offloading to not generate a pseudo header. dev/ns_gige.cc: transmit side checksum offloading doesn't need pseudo header generation, it just takes the pseudo header checksum and uses it. --HG-- extra : convert_revision : 9741bd650415c18ed37b06a453b23610d028135b --- 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