summaryrefslogtreecommitdiff
path: root/dev/etherpkt.hh
diff options
context:
space:
mode:
authorLisa Hsu <hsul@eecs.umich.edu>2004-06-21 17:25:18 -0400
committerLisa Hsu <hsul@eecs.umich.edu>2004-06-21 17:25:18 -0400
commite05dbb5116b9ff0984ea8214ec921d2db3aed41d (patch)
tree70a309c94c6776f673a9204f616ce3328dca88c8 /dev/etherpkt.hh
parent074969f8f16110680de05fca64a6be48aedcdfd8 (diff)
downloadgem5-e05dbb5116b9ff0984ea8214ec921d2db3aed41d.tar.xz
l
base/traceflags.py: added some more traceflags for ethernet to break it up better dev/etherpkt.hh: since we are not network host order, must reverse bytes for these typechecks. also, overload isTcp/UdpPkt to take an argument so you don't have to reget the ip header if you've already got one. dev/ns_gige.cc: 1) add some functions that reverse Endianness so we can generate adn evaluate checksum adn dprintf data accurately/more understandably 2) forget about the implementation of fifo fill/drain thresholds, it's not used by the driver much, nor does it matter with use sending/receiving in whole packets anyway. get rid of teh associated variables. 3) get rid of txFifoCnt the variable, it's redundant and unnecessary, just use txFifoAvail. 4) change io_enable to ioEnable, just to be picky. 5) modify some DPRINTF's to be clearer, also added a lot, and spread them into better traceflag categories 6) fix the device bug! it's the intrTick = 0 at teh beginning of cpuInterrupt(). 7) clear some bools in regsReset() so they don't holdover wrong state 8) fix pseudo header generation for Tcp checksumming to account for network order dev/ns_gige.hh: change io_enable to ioEnable, get rid of fill/drain thresh related variables and txFifoCnt, which is redundant --HG-- extra : convert_revision : c538b75731f3c9e04354f57e6df9a40aeca5096d
Diffstat (limited to 'dev/etherpkt.hh')
-rw-r--r--dev/etherpkt.hh16
1 files changed, 12 insertions, 4 deletions
diff --git a/dev/etherpkt.hh b/dev/etherpkt.hh
index 76b4a9156..abdf30166 100644
--- a/dev/etherpkt.hh
+++ b/dev/etherpkt.hh
@@ -64,11 +64,17 @@ class EtherPacket : public RefCounted
bool isIpPkt() {
eth_header *eth = (eth_header *) data;
- return (eth->type == 0x800);
+ return (eth->type == 0x8);
+ }
+ bool isTcpPkt(ip_header *ip) {
+ return (ip->protocol == 0x6);
}
bool isTcpPkt() {
ip_header *ip = getIpHdr();
- return (ip->protocol == 6);
+ return (ip->protocol == 0x6);
+ }
+ bool isUdpPkt(ip_header *ip) {
+ return (ip->protocol == 17);
}
bool isUdpPkt() {
ip_header *ip = getIpHdr();
@@ -81,11 +87,13 @@ class EtherPacket : public RefCounted
}
tcp_header *getTcpHdr(ip_header *ip) {
- return (tcp_header *) (ip + (ip->vers_len & 0xf));
+ assert(isTcpPkt(ip));
+ return (tcp_header *) ((uint8_t *) ip + (ip->vers_len & 0xf)*4);
}
udp_header *getUdpHdr(ip_header *ip) {
- return (udp_header *) (ip + (ip->vers_len & 0xf));
+ assert(isUdpPkt(ip));
+ return (udp_header *) ((uint8_t *) ip + (ip->vers_len & 0xf)*4);
}
typedef RefCountingPtr<EtherPacket> PacketPtr;