Skip to content

Commit

Permalink
Fix loadgen mem allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
agsiddharth committed Feb 6, 2023
1 parent d4e0080 commit 69f70fb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions gem5/src/dev/net/load_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace gem5
memcpy(head + 12, &size, 2);
memcpy(ethpacket->data, head, MACHeaderSize);
uint64_t timeStamp = gem5::curTick();
memcpy(&(ethpacket->data[8]), &timeStamp, sizeof(uint64_t));
memcpy(&(ethpacket->data[MACHeaderSize]), &timeStamp, sizeof(uint64_t));
}

void LoadGenerator::sendPacket()
Expand All @@ -84,10 +84,9 @@ namespace gem5

EthPacketPtr txPacket = std::make_shared<EthPacketData>(packetSize);
txPacket->length = packetSize;
// only allocate enough mem to store timestamp
txPacket->data = new uint8_t[2*sizeof(uint64_t)];
buildPacket(txPacket);
interface->sendPacket(txPacket);

if (curTick() < stopTick)
{
if (loadgenMode == Mode::Increment)
Expand Down

0 comments on commit 69f70fb

Please sign in to comment.