From 96905971f26e5218baebf8f953f05a9b341f9cc6 Mon Sep 17 00:00:00 2001 From: mlebeane Date: Wed, 26 Oct 2016 22:48:33 -0400 Subject: dev: Add 'simLength' parameter in EthPacketData Currently, all the network devices create a 16K buffer for the 'data' field in EthPacketData, and use 'length' to keep track of the size of the packet in the buffer. This patch introduces the 'simLength' parameter to EthPacketData, which is used to hold the effective length of the packet used for all timing calulations in the simulator. Serialization is performed using only the useful data in the packet ('length') and not necessarily the entire original buffer. --- src/dev/net/dist_iface.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/dev/net/dist_iface.cc') diff --git a/src/dev/net/dist_iface.cc b/src/dev/net/dist_iface.cc index 0e48770ed..26fe45317 100644 --- a/src/dev/net/dist_iface.cc +++ b/src/dev/net/dist_iface.cc @@ -407,7 +407,7 @@ DistIface::RecvScheduler::resumeRecvTicks() Desc d = descQueue.front(); descQueue.pop(); d.sendTick = curTick(); - d.sendDelay = d.packet->size(); // assume 1 tick/byte max link speed + d.sendDelay = d.packet->simLength; // assume 1 tick/byte max link speed v.push_back(d); } @@ -493,7 +493,7 @@ DistIface::RecvScheduler::Desc::unserialize(CheckpointIn &cp) { UNSERIALIZE_SCALAR(sendTick); UNSERIALIZE_SCALAR(sendDelay); - packet = std::make_shared(16384); + packet = std::make_shared(); packet->unserialize("rxPacket", cp); } @@ -583,14 +583,15 @@ DistIface::packetOut(EthPacketPtr pkt, Tick send_delay) header.sendTick = curTick(); header.sendDelay = send_delay; - header.dataPacketLength = pkt->size(); + header.dataPacketLength = pkt->length; + header.simLength = pkt->simLength; // Send out the packet and the meta info. sendPacket(header, pkt); DPRINTF(DistEthernetPkt, "DistIface::sendDataPacket() done size:%d send_delay:%llu\n", - pkt->size(), send_delay); + pkt->length, send_delay); } void -- cgit v1.2.3