always initalize the size of a packet (forgotten on checkpoints
authorNathan Binkert <binkertn@umich.edu>
Thu, 18 Nov 2004 21:23:31 +0000 (16:23 -0500)
committerNathan Binkert <binkertn@umich.edu>
Thu, 18 Nov 2004 21:23:31 +0000 (16:23 -0500)
in some places).  use the constructor for setting the size.

--HG--
extra : convert_revision : fad322c1d45b1952804cf35942b5685d70128e59

dev/etherlink.cc
dev/ethertap.cc
dev/ns_gige.cc
dev/pktfifo.cc
dev/sinic.cc

index 1e2be41fe488cfc840b2718c1967ac29678854f5..d637e152ad9cbaebea43065270ca50ea3a9e8df2 100644 (file)
@@ -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);
 }
 
index 03f2724b1d2e9bde685c2ddcb2a07cc0d84b1667..1603a9bd3a25f5a37cd59c6122a53630e3c56d9f 100644 (file)
@@ -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);
 
index c650c794391b347ce7e293e6601387ed762ba75c..c5489d5ee283284065e7624ee36cf1a5f8a46928 100644 (file)
@@ -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);
index 00c12ce6810e363c2579e6b8d284d067181b596a..ae82123cf688619da9cda34da51ab1da98417b6c 100644 (file)
@@ -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);
     }
index 4dff59a5a8e83c410d6d78265568fd41e0214a88..56782b589d80f437e70e1007aaf8dac8dbab26f4 100644 (file)
@@ -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);