summaryrefslogtreecommitdiff
path: root/dev/ns_gige.cc
diff options
context:
space:
mode:
authorLisa Hsu <hsul@eecs.umich.edu>2004-06-10 14:27:44 -0400
committerLisa Hsu <hsul@eecs.umich.edu>2004-06-10 14:27:44 -0400
commit3c7f9617516ff650cd6e30d35b0b88562c0c552d (patch)
treee6f78cab869a08cb5b53add5ae593e025a4534c2 /dev/ns_gige.cc
parente34a309106d6ef42ef781c6bd6294810fecf577a (diff)
downloadgem5-3c7f9617516ff650cd6e30d35b0b88562c0c552d.tar.xz
fix some things on linux todo list. 1) the config.ini. 2) the etherpkt struct defs into ined_hdrs.hh
3) add some new functions to etherpkt. 4) checkin the nice ping_linux.ini that i've been using. dev/etherpkt.hh: remove the packet headers nate hated so much. also add some new functionality regarding packets, like isIpHdr(), etc. dev/ns_gige.cc: improve the code given the nice new functions offered in etherpkt --HG-- extra : convert_revision : 2e27f5a8dca5323c0fa22d3c51af44a35f6be1a2
Diffstat (limited to 'dev/ns_gige.cc')
-rw-r--r--dev/ns_gige.cc16
1 files changed, 5 insertions, 11 deletions
diff --git a/dev/ns_gige.cc b/dev/ns_gige.cc
index 812c10df4..486d16cb5 100644
--- a/dev/ns_gige.cc
+++ b/dev/ns_gige.cc
@@ -1299,19 +1299,15 @@ NSGigE::rxKick()
}
#endif
- eth_header *eth = (eth_header *) rxPacket->data;
- // eth->type 0x800 indicated that it's an ip packet.
- if (eth->type == 0x800 && extstsEnable) {
- rxDescCache.extsts |= EXTSTS_IPPKT;
+ if (rxPacket->isIpPkt() && extstsEnable) { rxDescCache.extsts |= EXTSTS_IPPKT;
if (!ipChecksum(rxPacket, false))
rxDescCache.extsts |= EXTSTS_IPERR;
- ip_header *ip = rxFifo.front()->getIpHdr();
- if (ip->protocol == 6) {
+ if (rxPacket->isTcpPkt()) {
rxDescCache.extsts |= EXTSTS_TCPPKT;
if (!tcpChecksum(rxPacket, false))
rxDescCache.extsts |= EXTSTS_TCPERR;
- } else if (ip->protocol == 17) {
+ } else if (rxPacket->isUdpPkt()) {
rxDescCache.extsts |= EXTSTS_UDPPKT;
if (!udpChecksum(rxPacket, false))
rxDescCache.extsts |= EXTSTS_UDPERR;
@@ -1914,9 +1910,8 @@ NSGigE::recvPacket(PacketPtr packet)
bool
NSGigE::udpChecksum(PacketPtr packet, bool gen)
{
- udp_header *hdr = (udp_header *) packet->getTransportHdr();
-
ip_header *ip = packet->getIpHdr();
+ udp_header *hdr = packet->getUdpHdr(ip);
pseudo_header *pseudo = new pseudo_header;
@@ -1941,9 +1936,8 @@ NSGigE::udpChecksum(PacketPtr packet, bool gen)
bool
NSGigE::tcpChecksum(PacketPtr packet, bool gen)
{
- tcp_header *hdr = (tcp_header *) packet->getTransportHdr();
-
ip_header *ip = packet->getIpHdr();
+ tcp_header *hdr = packet->getTcpHdr(ip);
pseudo_header *pseudo = new pseudo_header;