summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2004-11-18 16:23:31 -0500
committerNathan Binkert <binkertn@umich.edu>2004-11-18 16:23:31 -0500
commit86836124ed272945e9d360c068728cd03917398d (patch)
tree9ed1b9a3cfe3552e7a62d6b202436fd00acf2e3e
parente3c3e44ac15f030ca5b76dbdb85584e20932ee94 (diff)
downloadgem5-86836124ed272945e9d360c068728cd03917398d.tar.xz
always initalize the size of a packet (forgotten on checkpoints
in some places). use the constructor for setting the size. --HG-- extra : convert_revision : fad322c1d45b1952804cf35942b5685d70128e59
-rw-r--r--dev/etherlink.cc4
-rw-r--r--dev/ethertap.cc3
-rw-r--r--dev/ns_gige.cc7
-rw-r--r--dev/pktfifo.cc2
-rw-r--r--dev/sinic.cc4
5 files changed, 9 insertions, 11 deletions
diff --git a/dev/etherlink.cc b/dev/etherlink.cc
index 1e2be41fe..d637e152a 100644
--- a/dev/etherlink.cc
+++ b/dev/etherlink.cc
@@ -195,7 +195,7 @@ EtherLink::Link::unserialize(Checkpoint *cp, const string &section)
bool packet_exists;
UNSERIALIZE_SCALAR(packet_exists);
if (packet_exists) {
- packet = new PacketData;
+ packet = new PacketData(16384);
packet->unserialize("packet", cp, section);
}
@@ -244,7 +244,7 @@ void
LinkDelayEvent::unserialize(Checkpoint *cp, const string &section)
{
Event::unserialize(cp, section);
- packet = new PacketData;
+ packet = new PacketData(16384);
packet->unserialize("packet", cp, section);
}
diff --git a/dev/ethertap.cc b/dev/ethertap.cc
index 03f2724b1..1603a9bd3 100644
--- a/dev/ethertap.cc
+++ b/dev/ethertap.cc
@@ -219,8 +219,7 @@ EtherTap::process(int revent)
while (data_len != 0 && buffer_offset >= data_len + sizeof(u_int32_t)) {
PacketPtr packet;
- packet = new PacketData;
- packet->data = new uint8_t[data_len];
+ packet = new PacketData(data_len);
packet->length = data_len;
memcpy(packet->data, data, data_len);
diff --git a/dev/ns_gige.cc b/dev/ns_gige.cc
index c650c7943..c5489d5ee 100644
--- a/dev/ns_gige.cc
+++ b/dev/ns_gige.cc
@@ -1767,8 +1767,7 @@ NSGigE::txKick()
case txFifoBlock:
if (!txPacket) {
DPRINTF(EthernetSM, "****starting the tx of a new packet****\n");
- txPacket = new PacketData;
- txPacket->data = new uint8_t[16384];
+ txPacket = new PacketData(16384);
txPacketBufPtr = txPacket->data;
}
@@ -2257,7 +2256,7 @@ NSGigE::unserialize(Checkpoint *cp, const std::string &section)
bool txPacketExists;
UNSERIALIZE_SCALAR(txPacketExists);
if (txPacketExists) {
- txPacket = new PacketData;
+ txPacket = new PacketData(16384);
txPacket->unserialize("txPacket", cp, section);
uint32_t txPktBufPtr;
UNSERIALIZE_SCALAR(txPktBufPtr);
@@ -2269,7 +2268,7 @@ NSGigE::unserialize(Checkpoint *cp, const std::string &section)
UNSERIALIZE_SCALAR(rxPacketExists);
rxPacket = 0;
if (rxPacketExists) {
- rxPacket = new PacketData;
+ rxPacket = new PacketData(16384);
rxPacket->unserialize("rxPacket", cp, section);
uint32_t rxPktBufPtr;
UNSERIALIZE_SCALAR(rxPktBufPtr);
diff --git a/dev/pktfifo.cc b/dev/pktfifo.cc
index 00c12ce68..ae82123cf 100644
--- a/dev/pktfifo.cc
+++ b/dev/pktfifo.cc
@@ -63,7 +63,7 @@ PacketFifo::unserialize(const string &base, Checkpoint *cp,
fifo.resize(fifosize);
for (int i = 0; i < fifosize; ++i) {
- PacketPtr p = new PacketData;
+ PacketPtr p = new PacketData(16384);
p->unserialize(csprintf("%s.packet%d", base, i), cp, section);
fifo.push_back(p);
}
diff --git a/dev/sinic.cc b/dev/sinic.cc
index 4dff59a5a..56782b589 100644
--- a/dev/sinic.cc
+++ b/dev/sinic.cc
@@ -1225,7 +1225,7 @@ Device::unserialize(Checkpoint *cp, const std::string &section)
UNSERIALIZE_SCALAR(rxPacketExists);
rxPacket = 0;
if (rxPacketExists) {
- rxPacket = new PacketData;
+ rxPacket = new PacketData(16384);
rxPacket->unserialize("rxPacket", cp, section);
uint32_t rxPktBufPtr;
UNSERIALIZE_SCALAR(rxPktBufPtr);
@@ -1245,7 +1245,7 @@ Device::unserialize(Checkpoint *cp, const std::string &section)
UNSERIALIZE_SCALAR(txPacketExists);
txPacket = 0;
if (txPacketExists) {
- txPacket = new PacketData;
+ txPacket = new PacketData(16384);
txPacket->unserialize("txPacket", cp, section);
uint32_t txPktBufPtr;
UNSERIALIZE_SCALAR(txPktBufPtr);